sandforge 1.79.0 → 1.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/sandforge-pipeline.mjs +12 -0
- package/lib/{chunk-BN7A4GRQ.mjs → chunk-2IB7I3IQ.mjs} +1 -1
- package/lib/{chunk-PBI4BYWW.mjs → chunk-2NAIUKVL.mjs} +1 -1
- package/lib/chunk-2OIRJEYE.mjs +7 -0
- package/lib/{chunk-FOVVHGEP.mjs → chunk-2OZG6GRW.mjs} +1 -1
- package/lib/{chunk-5CD257T7.mjs → chunk-2Z54GB6X.mjs} +1 -1
- package/lib/chunk-2ZMGVBLW.mjs +7 -0
- package/lib/{chunk-4NAHW2D3.mjs → chunk-33ZX3A56.mjs} +1 -1
- package/lib/{chunk-4SNDMJP2.mjs → chunk-3AOKLIVE.mjs} +1 -1
- package/lib/{chunk-SIOZXPFG.mjs → chunk-3B5H24ZG.mjs} +1 -1
- package/lib/chunk-43K2C6H2.mjs +7 -0
- package/lib/chunk-4JKR4PTZ.mjs +8 -0
- package/lib/chunk-4L7FBOJS.mjs +8 -0
- package/lib/chunk-5344TZBT.mjs +11 -0
- package/lib/{chunk-SAR5622P.mjs → chunk-54HYHHVL.mjs} +1 -1
- package/lib/chunk-55LQD3Y3.mjs +7 -0
- package/lib/chunk-56MPPWLA.mjs +7 -0
- package/lib/chunk-5C5XEVZN.mjs +11 -0
- package/lib/chunk-5CKWGZX4.mjs +9 -0
- package/lib/{chunk-RSWDYIHY.mjs → chunk-5GBO4KD5.mjs} +1 -1
- package/lib/{chunk-GNC27UEU.mjs → chunk-5UT2ZBGF.mjs} +1 -1
- package/lib/chunk-5VQNKDFU.mjs +7 -0
- package/lib/chunk-5WGA5CZB.mjs +7 -0
- package/lib/chunk-5ZKCLBTN.mjs +474 -0
- package/lib/chunk-67CC7RAE.mjs +7 -0
- package/lib/{chunk-5O6JOMHS.mjs → chunk-6CDIIFNX.mjs} +1 -1
- package/lib/{chunk-AV5SWEHP.mjs → chunk-6FARZYMJ.mjs} +1 -1
- package/lib/{chunk-7UQD6V6F.mjs → chunk-6FMLW7PH.mjs} +1 -1
- package/lib/chunk-6IGEASOF.mjs +7 -0
- package/lib/{chunk-H2PJNIYJ.mjs → chunk-6NADW3OI.mjs} +1 -1
- package/lib/chunk-6SEDOIO3.mjs +10 -0
- package/lib/{chunk-AUTM6H6Z.mjs → chunk-742SSN7I.mjs} +1 -1
- package/lib/chunk-7DALDJMO.mjs +7 -0
- package/lib/chunk-7PK5QDQI.mjs +7 -0
- package/lib/chunk-AELFEK3G.mjs +7 -0
- package/lib/chunk-AITNZWLB.mjs +9 -0
- package/lib/{chunk-HV2MXMGI.mjs → chunk-AJPSGVMD.mjs} +1 -1
- package/lib/{chunk-OTWRDD6L.mjs → chunk-BNO5GIJ6.mjs} +1 -1
- package/lib/{chunk-K2FBZIXY.mjs → chunk-BWWQXU2B.mjs} +1 -1
- package/lib/{chunk-IC2C2GOF.mjs → chunk-BXZ73A5M.mjs} +1 -1
- package/lib/chunk-BZFIOZS3.mjs +156 -0
- package/lib/{chunk-XBG5SP6Q.mjs → chunk-C4YGSK6W.mjs} +1 -1
- package/lib/chunk-CAFUNR6D.mjs +7 -0
- package/lib/chunk-CULAOP3U.mjs +7 -0
- package/lib/chunk-D62KWDDT.mjs +7 -0
- package/lib/{chunk-BILZ3SSR.mjs → chunk-D7P7DTWL.mjs} +1 -1
- package/lib/chunk-DHGPDSXS.mjs +7 -0
- package/lib/{chunk-ZXH4MBWP.mjs → chunk-DHIW4IO5.mjs} +1 -1
- package/lib/{chunk-NM4MDLK4.mjs → chunk-DMBR24CK.mjs} +1 -1
- package/lib/chunk-DPYTG6DM.mjs +48 -0
- package/lib/chunk-DQR5NDMI.mjs +7 -0
- package/lib/chunk-DXOXLUZA.mjs +7 -0
- package/lib/chunk-E2OBAWSH.mjs +7 -0
- package/lib/chunk-E2YJVSX6.mjs +10 -0
- package/lib/chunk-EAFLDSQ2.mjs +7 -0
- package/lib/{chunk-HCIDVIOW.mjs → chunk-EH5YUA5W.mjs} +1 -1
- package/lib/{chunk-2BVTCNWA.mjs → chunk-EOSEMFPU.mjs} +1 -1
- package/lib/chunk-ETT5GP4P.mjs +13 -0
- package/lib/{chunk-3SRXFZSD.mjs → chunk-FDGFUEK3.mjs} +1 -1
- package/lib/{chunk-3DCUADVK.mjs → chunk-FLNLG43R.mjs} +1 -1
- package/lib/{chunk-HTJ5OGP5.mjs → chunk-FSDO4DJA.mjs} +1 -1
- package/lib/{chunk-HJKM3E56.mjs → chunk-FSZTXLNW.mjs} +1 -1
- package/lib/chunk-FTA5LOVX.mjs +7 -0
- package/lib/chunk-G4VXPS3A.mjs +7 -0
- package/lib/chunk-GF247DA7.mjs +7 -0
- package/lib/{chunk-QRV2OSIS.mjs → chunk-GK7VEYFM.mjs} +1 -1
- package/lib/{chunk-5MMXFWPD.mjs → chunk-GR3NGDVM.mjs} +1 -1
- package/lib/{chunk-P7GSGFJO.mjs → chunk-GTIXJCGS.mjs} +1 -1
- package/lib/{chunk-342FN7AO.mjs → chunk-GWRKS3AL.mjs} +1 -1
- package/lib/{chunk-LQ4DRFUH.mjs → chunk-GYKNCYES.mjs} +1 -1
- package/lib/{chunk-WIO4XO4F.mjs → chunk-HFSBDM7B.mjs} +1 -1
- package/lib/chunk-HVC5CYIB.mjs +7 -0
- package/lib/{chunk-EQF2IJS2.mjs → chunk-HYBH5PFM.mjs} +1 -1
- package/lib/chunk-HYOOJVR6.mjs +7 -0
- package/lib/{chunk-TQX3PURV.mjs → chunk-IBURU7T7.mjs} +1 -1
- package/lib/chunk-ICIYL45C.mjs +7 -0
- package/lib/{chunk-K22PA4XL.mjs → chunk-IKGHRYCN.mjs} +1 -1
- package/lib/chunk-IM2XA6JI.mjs +7 -0
- package/lib/{chunk-P2PJYWGQ.mjs → chunk-J6G23RUI.mjs} +1 -1
- package/lib/{chunk-JVL444U5.mjs → chunk-JU2XEKEO.mjs} +1 -1
- package/lib/{chunk-H45UXY6G.mjs → chunk-K55LH4ZQ.mjs} +1 -1
- package/lib/chunk-K5HV4YRO.mjs +7 -0
- package/lib/{chunk-IAZB4WIL.mjs → chunk-K77NR3UK.mjs} +1 -1
- package/lib/chunk-KE2PGD6C.mjs +7 -0
- package/lib/chunk-KGYXLSQ5.mjs +37 -0
- package/lib/{chunk-TEOLMRDO.mjs → chunk-KNIRA333.mjs} +1 -1
- package/lib/chunk-KOQV4WXC.mjs +8 -0
- package/lib/{chunk-PNCONNFJ.mjs → chunk-KRNFVAGC.mjs} +1 -1
- package/lib/chunk-L5FGY6YA.mjs +7 -0
- package/lib/{chunk-MTMH6H2A.mjs → chunk-LCDPCUXS.mjs} +1 -1
- package/lib/{chunk-YAZO75G2.mjs → chunk-LNXBCE7E.mjs} +1 -1
- package/lib/{chunk-ZOVSMN5C.mjs → chunk-LO527YLT.mjs} +1 -1
- package/lib/chunk-MAHZMPMZ.mjs +7 -0
- package/lib/{chunk-QQZZMKU3.mjs → chunk-MHW6DV6T.mjs} +1 -1
- package/lib/{chunk-2YIV2OB2.mjs → chunk-MIDBQ7SD.mjs} +1 -1
- package/lib/{chunk-6EBMEGZB.mjs → chunk-MKNAZPOT.mjs} +1 -1
- package/lib/{chunk-NTDN2JQZ.mjs → chunk-MNITSYI2.mjs} +8 -8
- package/lib/chunk-MO3N5XVV.mjs +341 -0
- package/lib/{chunk-SBIMVCXT.mjs → chunk-MS4FJDFD.mjs} +9 -9
- package/lib/chunk-MWLFFVQV.mjs +8 -0
- package/lib/chunk-N6HHNR6J.mjs +7 -0
- package/lib/chunk-N7J6NJQ6.mjs +7 -0
- package/lib/chunk-NJ3EOEHS.mjs +9 -0
- package/lib/chunk-NWPQF5XR.mjs +7 -0
- package/lib/{chunk-PUOX4NBJ.mjs → chunk-NWVVCZUK.mjs} +1 -1
- package/lib/{chunk-DLDX6RRC.mjs → chunk-O6ADMP36.mjs} +1 -1
- package/lib/chunk-O7DAFE6M.mjs +14 -0
- package/lib/chunk-OEHVAJAB.mjs +7 -0
- package/lib/chunk-OETEC3P7.mjs +7 -0
- package/lib/{chunk-GCOB7K5N.mjs → chunk-OHEOJISY.mjs} +1 -1
- package/lib/chunk-OIIL4NVI.mjs +7 -0
- package/lib/chunk-OMZJ37JI.mjs +15 -0
- package/lib/{chunk-NZ5ZZLKS.mjs → chunk-ONMBSACW.mjs} +1 -1
- package/lib/chunk-OQQHNYR7.mjs +272 -0
- package/lib/{chunk-AAVJ5XVX.mjs → chunk-OU5W7SCB.mjs} +1 -1
- package/lib/{chunk-RSYICMZG.mjs → chunk-OVOLG3AL.mjs} +1 -1
- package/lib/{chunk-F74IHMGL.mjs → chunk-OXKZ4Y3B.mjs} +1 -1
- package/lib/{chunk-W7KFAY55.mjs → chunk-OZNLOV4U.mjs} +1 -1
- package/lib/{chunk-TYYOBZMU.mjs → chunk-PC247GKX.mjs} +1 -1
- package/lib/chunk-PPGDAUEQ.mjs +7 -0
- package/lib/{chunk-RACDTRZA.mjs → chunk-PYUEHBA6.mjs} +1 -1
- package/lib/{chunk-TLH7AD35.mjs → chunk-PZBZ7MNC.mjs} +1 -1
- package/lib/{chunk-DBFJB2B6.mjs → chunk-QIRO4HTE.mjs} +1 -1
- package/lib/{chunk-PZTSVQSF.mjs → chunk-QXLZINZB.mjs} +1 -1
- package/lib/chunk-R2BJWO5N.mjs +20 -0
- package/lib/chunk-R6TF26V4.mjs +10 -0
- package/lib/{chunk-P42X3B4D.mjs → chunk-RKALOKAU.mjs} +1 -1
- package/lib/chunk-SQGP46QS.mjs +7 -0
- package/lib/chunk-SU65Z2BA.mjs +7 -0
- package/lib/chunk-SW2NUKQL.mjs +9 -0
- package/lib/chunk-T26C576X.mjs +9 -0
- package/lib/{chunk-3OHPD72J.mjs → chunk-T3PLRQ2T.mjs} +1 -1
- package/lib/chunk-T5VAULLQ.mjs +7 -0
- package/lib/chunk-TEIBWMJM.mjs +7 -0
- package/lib/chunk-TKQQVB2D.mjs +9 -0
- package/lib/{chunk-RAAANPPG.mjs → chunk-TPHXRHOA.mjs} +1 -1
- package/lib/chunk-TQ2TQHTT.mjs +9 -0
- package/lib/{chunk-IEYG5ATY.mjs → chunk-TQM2XJ27.mjs} +1 -1
- package/lib/{chunk-X65MT4W3.mjs → chunk-UCHAZ4ZU.mjs} +1 -1
- package/lib/chunk-UIUPPEFB.mjs +7 -0
- package/lib/{chunk-QPF6C5MX.mjs → chunk-UT27HXE7.mjs} +1 -1
- package/lib/{chunk-J7HVXMSW.mjs → chunk-UUSLTW5V.mjs} +1 -1
- package/lib/chunk-V2QO6KOE.mjs +19 -0
- package/lib/chunk-V473C7LY.mjs +7 -0
- package/lib/chunk-V4RKM4QZ.mjs +8 -0
- package/lib/chunk-VSU74RQ3.mjs +9 -0
- package/lib/chunk-VV3B6IC3.mjs +7 -0
- package/lib/chunk-W2AAGIZF.mjs +7 -0
- package/lib/{chunk-WR2GIKWE.mjs → chunk-WB2RIVO3.mjs} +1 -1
- package/lib/chunk-WD47PGUS.mjs +10 -0
- package/lib/{chunk-3CA767QB.mjs → chunk-WEZLXE34.mjs} +1 -1
- package/lib/{chunk-WFEB5X4U.mjs → chunk-WI4HYWV6.mjs} +1 -1
- package/lib/{chunk-AR7BE5O2.mjs → chunk-WM5JI4JI.mjs} +1 -1
- package/lib/chunk-WWTXRWNZ.mjs +7 -0
- package/lib/{chunk-7EANH5PY.mjs → chunk-WZQEK4WT.mjs} +1 -1
- package/lib/{chunk-ZJKCWBRJ.mjs → chunk-X2ZVSQ54.mjs} +1 -1
- package/lib/{chunk-SFURUNJM.mjs → chunk-XC2QKQT5.mjs} +1 -1
- package/lib/chunk-XC54KKKC.mjs +7 -0
- package/lib/chunk-XEB6HZ34.mjs +7 -0
- package/lib/chunk-XGKSSCW7.mjs +7 -0
- package/lib/chunk-XIZ5LMQM.mjs +7 -0
- package/lib/{chunk-RFEO2KAN.mjs → chunk-Y5ZCPY36.mjs} +1 -1
- package/lib/{chunk-TBZMC2VV.mjs → chunk-YCSFP6ER.mjs} +4 -4
- package/lib/{chunk-YBU4Z4QV.mjs → chunk-YHIOS2PU.mjs} +1 -1
- package/lib/chunk-YIGFYZQY.mjs +7 -0
- package/lib/chunk-YJEXE6HZ.mjs +925 -0
- package/lib/{chunk-57VHUYNG.mjs → chunk-YOGMP72T.mjs} +4 -4
- package/lib/chunk-ZRUDYB7O.mjs +7 -0
- package/lib/{chunk-55HEMHEG.mjs → chunk-ZUA5BNAO.mjs} +1 -1
- package/lib/chunk-ZWCRWF7E.mjs +7 -0
- package/lib/{chunk-VHI54FBK.mjs → chunk-ZWZXQTAK.mjs} +53 -53
- package/lib/sandforge-autopilot.mjs +29 -24
- package/lib/sandforge-backup.mjs +67 -32
- package/lib/sandforge-checkpoint.mjs +1 -347
- package/lib/sandforge-cleanup.mjs +14 -10
- package/lib/sandforge-clone.mjs +1 -1
- package/lib/sandforge-compare.mjs +9 -8
- package/lib/sandforge-dataops.mjs +1 -1
- package/lib/sandforge-empty.mjs +15 -15
- package/lib/sandforge-env.mjs +101 -101
- package/lib/sandforge-frozen.mjs +1 -257
- package/lib/sandforge-mcp.mjs +33 -14
- package/lib/sandforge-monitor.mjs +7 -7
- package/lib/sandforge-pipeline.mjs +88 -0
- package/lib/sandforge-seed.mjs +1 -1
- package/lib/sandforge-sync.mjs +1 -1
- package/lib/sandforge.mjs +6 -6
- package/package.json +2 -1
- package/lib/chunk-2S5OMIIA.mjs +0 -7
- package/lib/chunk-36U7IQ6Y.mjs +0 -25
- package/lib/chunk-3F5YMM2F.mjs +0 -7
- package/lib/chunk-3RYLICRX.mjs +0 -7
- package/lib/chunk-42RER7V4.mjs +0 -14
- package/lib/chunk-4GL773D5.mjs +0 -7
- package/lib/chunk-4HFRHFGQ.mjs +0 -7
- package/lib/chunk-4U6NXJNL.mjs +0 -7
- package/lib/chunk-4XZ5YT5O.mjs +0 -7
- package/lib/chunk-5AJRHRXA.mjs +0 -20
- package/lib/chunk-5HMAPZBV.mjs +0 -7
- package/lib/chunk-5P4PHJRL.mjs +0 -9
- package/lib/chunk-5QKTYCWE.mjs +0 -11
- package/lib/chunk-6LAXTAVN.mjs +0 -7
- package/lib/chunk-6MUEPV7M.mjs +0 -9
- package/lib/chunk-6QSM2WIH.mjs +0 -10
- package/lib/chunk-75ADZS6B.mjs +0 -7
- package/lib/chunk-ALJVEUUS.mjs +0 -7
- package/lib/chunk-ALUFROGA.mjs +0 -7
- package/lib/chunk-B45CNPUX.mjs +0 -47
- package/lib/chunk-BS5T3MOQ.mjs +0 -7
- package/lib/chunk-CGWXQX75.mjs +0 -7
- package/lib/chunk-D3QRXG63.mjs +0 -787
- package/lib/chunk-EEVVGGM6.mjs +0 -7
- package/lib/chunk-ENLBYECD.mjs +0 -7
- package/lib/chunk-EQOQASDQ.mjs +0 -7
- package/lib/chunk-FQBRBBY4.mjs +0 -7
- package/lib/chunk-GAM726CK.mjs +0 -7
- package/lib/chunk-HJC7AIBK.mjs +0 -7
- package/lib/chunk-HUMEKZT5.mjs +0 -8
- package/lib/chunk-I3JKJTLO.mjs +0 -110
- package/lib/chunk-I7O6C2B5.mjs +0 -8
- package/lib/chunk-KLX67VPL.mjs +0 -7
- package/lib/chunk-L776PUMV.mjs +0 -7
- package/lib/chunk-LRFAIUN7.mjs +0 -7
- package/lib/chunk-LV6G4XTK.mjs +0 -7
- package/lib/chunk-MYTIL2JD.mjs +0 -10
- package/lib/chunk-NEVXIGR6.mjs +0 -10
- package/lib/chunk-NGSMZZDA.mjs +0 -7
- package/lib/chunk-NHWE66K5.mjs +0 -7
- package/lib/chunk-OQOZAPCI.mjs +0 -7
- package/lib/chunk-PA3MKJVH.mjs +0 -7
- package/lib/chunk-QROPNEGY.mjs +0 -14
- package/lib/chunk-QWT2C74M.mjs +0 -7
- package/lib/chunk-RH3N2H7P.mjs +0 -7
- package/lib/chunk-SRQDABQ2.mjs +0 -15
- package/lib/chunk-SVS6UMDU.mjs +0 -323
- package/lib/chunk-TNXUU6W7.mjs +0 -14
- package/lib/chunk-VGW4MXXZ.mjs +0 -7
- package/lib/chunk-VXHDBYMI.mjs +0 -7
- package/lib/chunk-WJY54JO7.mjs +0 -13
- package/lib/chunk-WRU5FJFC.mjs +0 -7
- package/lib/chunk-X2PY6MWZ.mjs +0 -7
- package/lib/chunk-XEFDB2R4.mjs +0 -7
- package/lib/chunk-XETCPL7E.mjs +0 -7
- package/lib/chunk-Y5CGXLUB.mjs +0 -7
- package/lib/chunk-Y6J6QFI2.mjs +0 -7
- package/lib/chunk-YMJVMFPY.mjs +0 -7
- package/lib/chunk-YPSRZRIT.mjs +0 -7
- package/lib/chunk-YS4G22C2.mjs +0 -7
- package/lib/chunk-YW2SBL4Z.mjs +0 -7
- package/lib/chunk-Z7X534S4.mjs +0 -10
- package/lib/chunk-ZE6HKRR4.mjs +0 -9
- package/lib/chunk-ZLZRU6MO.mjs +0 -7
- package/lib/chunk-ZPYJPGDK.mjs +0 -7
- package/lib/chunk-ZQOZ4EFW.mjs +0 -7
- package/lib/chunk-ZUTYVST5.mjs +0 -7
- package/lib/chunk-ZYEE34WO.mjs +0 -7
|
@@ -65,4 +65,4 @@ ${s}`:s:"",l=Function,d=`return (input) => {
|
|
|
65
65
|
${s}
|
|
66
66
|
}`,f;try{f=new l(...a,d)(...u)}catch(m){throw new N(`this schema (generated code failed to evaluate: ${m.message})`)}return r?.debug&&(f.code=c),f.definite=o.definite,f}function S(e,r){for(let[o,t]of e.constants)if(t===r)return o;let i=`c${e.constantCounter++}`;return e.constants.set(i,r),i}function Je(e,r){return e.definite=!1,S(e,r)}function w(e){return`v${e.varCounter++}`}function $$(e,r){let i=e._zod.run({value:r,issues:[]},{});if(i&&typeof i.then=="function")return H;let o=i;return o.issues.length===0?o.value:H}function X(e,r,i,o,t=!0){let n=e.content.length,a=r.constants.size,u=r.constantCounter,s=r.varCounter;try{return R(e,r,i,o,t)}catch(c){if(!(c instanceof N)||!c.islandable)throw c;if(e.content.length=n,r.constants.size>a){let l=Array.from(r.constants.keys()).slice(a);for(let d of l)r.constants.delete(d)}return r.constantCounter=u,r.varCounter=s,h$(e,r,i,o)}}function h$(e,r,i,o){r.definite=!1;let t=S(r,i),n=S(r,$$),a=w(r);return e.write(`const ${a} = ${n}(${t}, ${o});`),e.write(`if (${a} === INVALID) return INVALID;`),a}var y$=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function _$(e,r,i,o){let t=i._zod.def.checks;if(!t||t.length===0)return o;let n=o;for(let a of t){let u=a._zod.def;if(u.when&&!y$.has(u.check))throw new N('check with a custom "when" condition');switch(u.check){case"greater_than":b$(e,r,u,n);break;case"less_than":k$(e,r,u,n);break;case"multiple_of":x$(e,r,u,n);break;case"number_format":Sf(e,u,n);break;case"min_length":{let s=Se(u.minimum,"min_length"),c=Tu(e,r,n,`${n}.length >= ${s} && ${n}.length < ${u.minimum*2}`);e.write(`if (${c} < ${s}) return INVALID;`);break}case"max_length":{let s=Se(u.maximum,"max_length"),c=Tu(e,r,n,`${n}.length > ${s}`);e.write(`if (${c} > ${s}) return INVALID;`);break}case"length_equals":{let s=Se(u.length,"length_equals"),c=Tu(e,r,n,`${n}.length >= ${s} && ${n}.length <= ${u.length*2}`);e.write(`if (${c} !== ${s}) return INVALID;`);break}case"min_size":e.write(`if (${n}.size < ${Se(u.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${n}.size > ${Se(u.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${n}.size !== ${Se(u.size,"size_equals")}) return INVALID;`);break;case"string_format":n=Pf(e,r,u,n);break;case"custom":n=D$(e,r,a,n);break;case"bigint_format":I$(e,u,n);break;case"mime_type":w$(e,r,u,n);break;case"property":S$(e,r,u,n);break;case"properties":z$(e,r,u,n);break;case"overwrite":{let s=w(r);P$(e,r,a,n,s),n=s;break}default:throw new N(`check type ${u.check}`)}}return n}function Tu(e,r,i,o){let t=S(r,Le),n=w(r);return e.write(`const ${n} = typeof ${i} === "string" && ${o} ? ${t}(${i}) : ${i}.length;`),n}function Se(e,r){if(typeof e!="number"||!Number.isFinite(e))throw new N(`${r} bound of type ${typeof e}`);return`${e}`}function zf(e,r){if(typeof r=="bigint")return`${r}n`;if(typeof r=="number"){if(Number.isNaN(r))throw new N("comparison check with NaN bound");return`${r}`}if(r instanceof Date){if(Number.isNaN(r.getTime()))throw new N("comparison check with Invalid Date bound");return S(e,r)}throw new N(`comparison check bound of type ${typeof r}`)}function b$(e,r,i,o){let t=i.inclusive?"<":"<=";e.write(`if (${o} ${t} ${zf(r,i.value)}) return INVALID;`)}function k$(e,r,i,o){let t=i.inclusive?">":">=";e.write(`if (${o} ${t} ${zf(r,i.value)}) return INVALID;`)}function x$(e,r,i,o){if(typeof i.value=="bigint"){if(i.value===BigInt(0))throw new N("multiple_of check with a zero divisor");e.write(`if (${o} % ${i.value}n !== 0n) return INVALID;`)}else{let t=S(r,Mt);e.write(`if (${t}(${o}, ${Se(i.value,"multiple_of")}) !== 0) return INVALID;`)}}function Sf(e,r,i){let o=r.format;switch(o){case"safeint":e.write(`if (!Number.isSafeInteger(${i})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${i}) || ${i} < -2147483648 || ${i} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${i}) || ${i} < 0 || ${i} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${i}) || ${i} < -3.4028234663852886e38 || ${i} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${i})) return INVALID;`);break;default:throw new N(`number format ${o}`)}}function I$(e,r,i){let o=r.format;if(o)switch(o){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break;default:throw new N(`bigint format ${o}`)}}function w$(e,r,i,o){let t=i.mime;if(t&&t.length>0){let n=S(r,new Set(t));e.write(`if (!${n}.has(${o}.type)) return INVALID;`)}}function z$(e,r,i,o){if(i.when)throw new N('check with a custom "when" condition');e.write(`if (${o} == null) return INVALID;`);let t=i.shape;for(let n of Reflect.ownKeys(t)){let a=typeof n=="symbol"?S(r,n):q(n),u=w(r);e.write(`const ${u} = ${o}[${a}];`),X(e,r,t[n],u,!1)}}function S$(e,r,i,o){let t=`${o}[${JSON.stringify(i.property)}]`;R(e,r,i.schema,t)}function P$(e,r,i,o,t){let n=i._zod.def.tx;if(!n)throw new N("overwrite check without a transform function");if(Be(n))throw new fe("z.compile: async overwrite transforms are not supported");let a=S(r,n);e.write(`const ${t} = ${a}(${o});`)}function Zu(){throw new ne}function Lu(e){this.issues.push(e)}function D$(e,r,i,o){let t=i._zod.def;if(t.fn){if(Be(t.fn))throw new fe("z.compile: async .refine() predicates are not supported");let n=Je(r,t.fn),a=S(r,Zu),u=w(r);return e.write(`const ${u} = ${n}(${o});`),e.write(`if (${u} instanceof Promise) ${a}();`),e.write(`if (!${u}) return INVALID;`),o}if(i._zod.check){if(Be(i._zod.check))throw new fe("z.compile: async .superRefine() / check functions are not supported");let n=i._zod.check,u=Je(r,c=>{let l={value:c,issues:[],addIssue:Lu};return n(l)instanceof Promise&&Zu(),l.issues.length===0?l.value:H}),s=w(r);return e.write(`const ${s} = ${u}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}throw new N("custom check without a predicate or check function")}var j$=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function Pf(e,r,i,o,t=!0){let n=i.format;if(n==="base64"){let c=S(r,sr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="base64url"){let c=S(r,yn);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="jwt"){let c=S(r,kn),l=S(r,i.alg??null);return e.write(`if (!${c}(${o}, ${l})) return INVALID;`),o}if(n==="ipv6"){let c=S(r,cr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="cidrv6"){let c=S(r,$n);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="credit_card"){let c=S(r,_n);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="iban"){let c=S(r,bn);return e.write(`if (!${c}(${o})) return INVALID;`),o}let a=i;if(n==="url"||n==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let c=S(r,pn),l=S(r,i),d=w(r),f=w(r);if(e.write(`const ${d} = ${o}.trim();`),e.write(`const ${f} = ${c}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),a.hostname!==void 0){let _=S(r,gn);e.write(`if (!${_}(${f}, ${l}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let _=S(r,vn);e.write(`if (!${_}(${f}, ${l}.protocol)) return INVALID;`)}if(!t)return null;let m=w(r),v=a.normalize?`${f}.href`:`${S(r,ur)}(${d})`;return e.write(`const ${m} = ${v};`),m}let u=i.fn;if(u){if(Be(u))throw new N(`async string format ${n}`);let c=S(r,u);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(j$.has(n)&&i.pattern){let c=S(r,i.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${o})) return INVALID;`),o}let s=i.format;switch(s){case"regex":throw new N("regex format without a pattern");case"lowercase":e.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${o}.includes(${q(i.includes)})) return INVALID;`);break;case"starts_with":{let c=i.prefix;e.write(`if (${o}.slice(0, ${c.length}) !== ${q(c)}) return INVALID;`);break}case"ends_with":{let c=i.suffix;e.write(`if (${o}.slice(-${c.length}) !== ${q(c)}) return INVALID;`);break}default:throw new N(`string format ${s}`)}return o}function R(e,r,i,o,t=!0){let n=i._zod.def,a=n.type;if(n.coerce)throw new N(`coercion (z.coerce.${a}())`);let u=t||!!n.checks?.length,s;switch(a){case"string":s=O$(e,r,i,o,u);break;case"number":s=N$(e,i,o);break;case"boolean":s=U$(e,o);break;case"bigint":s=A$(e,i,o);break;case"symbol":s=T$(e,o);break;case"undefined":s=Z$(e,o);break;case"null":s=E$(e,o);break;case"any":case"unknown":s=o;break;case"never":e.write("return INVALID;"),s=o;break;case"void":s=C$(e,o);break;case"nan":s=L$(e,o);break;case"date":s=V$(e,o);break;case"object":s=R$(e,r,i,o,u);break;case"optional":s=F$(e,r,i,o,u);break;case"nullable":s=B$(e,r,i,o,u);break;case"array":s=K$(e,r,i,o,u);break;case"literal":s=G$(e,r,i,o);break;case"enum":s=W$(e,r,i,o);break;case"readonly":{let c=xf(e,r,i,o),l=w(r);e.write(`const ${l} = Object.freeze(${c});`),s=l;break}case"success":xf(e,r,i,o),s="true";break;case"default":case"prefault":s=X$(e,r,i,o);break;case"nonoptional":s=q$(e,r,i,o);break;case"tuple":s=Y$(e,r,i,o);break;case"union":s=H$(e,r,i,o);break;case"intersection":s=th(e,r,i,o);break;case"record":s=rh(e,r,i,o);break;case"map":s=ih(e,r,i,o);break;case"set":s=oh(e,r,i,o);break;case"file":s=ah(e,o);break;case"template_literal":s=uh(e,r,i,o);break;case"lazy":s=ch(e,r,i,o);break;case"pipe":s=sh(e,r,i,o);break;case"custom":s=lh(e,r,i,o);break;case"transform":s=mh(e,r,i,o);break;case"catch":s=fh(e,r,i,o);break;default:throw new N(`schema type ${a}`)}return s===null?null:_$(e,r,i,s)}function O$(e,r,i,o,t=!0){e.write(`if (typeof ${o} !== "string") return INVALID;`);let n=i._zod.def;return n.format===void 0?o:Pf(e,r,n,o,t)}function N$(e,r,i){e.write(`if (typeof ${i} !== "number" || !Number.isFinite(${i})) return INVALID;`);let o=r._zod.def;return o.check==="number_format"&&o.format&&Sf(e,{format:o.format},i),i}function U$(e,r){return e.write(`if (typeof ${r} !== "boolean") return INVALID;`),r}function A$(e,r,i){e.write(`if (typeof ${i} !== "bigint") return INVALID;`);let o=r._zod.def;if(o.format)switch(o.format){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break}return i}function T$(e,r){return e.write(`if (typeof ${r} !== "symbol") return INVALID;`),r}function Z$(e,r){return e.write(`if (${r} !== undefined) return INVALID;`),r}function E$(e,r){return e.write(`if (${r} !== null) return INVALID;`),r}function C$(e,r){return e.write(`if (${r} !== undefined) return INVALID;`),r}function L$(e,r){return e.write(`if (typeof ${r} !== "number" || !Number.isNaN(${r})) return INVALID;`),r}function V$(e,r){return e.write(`if (!(${r} instanceof Date) || Number.isNaN(${r}.getTime())) return INVALID;`),r}function R$(e,r,i,o,t=!0){let n=i._zod.def;e.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let a=n.shape,u=Object.keys(a),s=Object.getOwnPropertySymbols(a),c=s.length?[...u,...s]:u,l=I=>typeof I=="symbol"?S(r,I):q(I),d=I=>typeof I=="symbol"?`[${l(I)}]`:q(I),f=a;if(u.includes("__proto__"))throw new N('object shape key "__proto__"');let m=new Map;for(let I of c){let D=f[I],A=l(I),V=w(r);if(e.write(`const ${V} = ${o}[${A}];`),D._zod.optin!==void 0){let U=w(r);e.write(`let ${U} = (() => {`),e.indented(W=>{let Rt=X(W,r,D,V);W.write(`return ${Rt};`)}),e.write("})();"),D._zod.optout==="optional"?(e.write(`if (${U} === INVALID) {`),e.indented(W=>{W.write(`if (${A} in ${o}) return INVALID;`),W.write(`${U} = undefined;`)}),e.write("}")):e.write(`if (${U} === INVALID) return INVALID;`),m.set(I,U)}else{J$(D)&&e.write(`if (!(${A} in ${o})) return INVALID;`);let U=X(e,r,D,V,t);U!==null&&m.set(I,U)}}let v=n.catchall,_="none";if(v){let I=v._zod.def.type;if(I==="never"){let D=u.map(A=>`k !== ${q(A)}`).join(" && ")||"true";e.write(`for (const k in ${o}) {`),e.indented(A=>{A.write(`if (${D}) return INVALID;`)}),e.write("}")}else(I==="unknown"||I==="any")&&!v._zod.def.checks?.length?_="passthrough":_="schema"}let k=w(r),z=c.some(I=>kf(f[I])||Eu(f[I]));if(!t){if(_==="schema"){let I=u.length>0?S(r,new Set(u)):null;e.write(`for (const k in ${o}) {`),e.indented(D=>{D.write('if (k === "__proto__") continue;'),I&&D.write(`if (${I}.has(k)) continue;`);let A=w(r);D.write(`const ${A} = ${o}[k];`),X(D,r,v,A,!1)}),e.write("}")}return null}if(z){e.write(`const ${k} = {};`);for(let I of c){let D=l(I),A=m.get(I);Eu(f[I])?e.write(`if (${D} in ${o}) ${k}[${D}] = ${A};`):kf(f[I])?e.write(`if (${A} !== undefined || ${D} in ${o}) ${k}[${D}] = ${A};`):e.write(`${k}[${D}] = ${A};`)}}else{let I=c.map(D=>`${d(D)}: ${m.get(D)}`).join(", ");e.write(`const ${k} = { ${I} };`)}if(_!=="none"){let I=u.length>0?S(r,new Set(u)):null;e.write(`for (const k in ${o}) {`),e.indented(D=>{if(D.write('if (k === "__proto__") continue;'),I&&D.write(`if (${I}.has(k)) continue;`),_==="passthrough")D.write(`${k}[k] = ${o}[k];`);else{let A=w(r);D.write(`const ${A} = ${o}[k];`);let V=X(D,r,v,A);D.write(`${k}[k] = ${V};`)}}),e.write("}")}return k}function F$(e,r,i,o,t=!0){let n=i._zod.def;if(M$(i))return R(e,r,n.innerType,o,t);if(n.innerType._zod.optin==="defaulted"){let u=w(r),s=w(r);return e.write(`let ${u};`),e.write(`if (${o} === undefined) {`),e.indented(c=>{c.write(`const ${s} = (() => {`),c.indented(l=>{let d=R(l,r,n.innerType,o);l.write(`return ${d};`)}),c.write("})();"),c.write(`if (${s} !== INVALID) ${u} = ${s};`)}),e.write("} else {"),e.indented(c=>{let l=R(c,r,n.innerType,o);c.write(`${u} = ${l};`)}),e.write("}"),u}let a=t?w(r):null;return a&&e.write(`let ${a};`),e.write(`if (${o} !== undefined) {`),e.indented(u=>{let s=R(u,r,n.innerType,o,t);a&&s!==null&&u.write(`${a} = ${s};`)}),e.write("}"),a}function M$(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function J$(e){return e._zod.optin===void 0&&Me(e)}function Me(e){if(e._zod.def.coerce)return!0;let r=e._zod.def;switch(r.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return r.innerType?Me(r.innerType):!1;case"literal":return!!r.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return r.innerType?Me(r.innerType):!0;case"catch":return!0;case"union":return r.options?r.options.some(Me):!0;case"intersection":return!r.left||!r.right?!0:Me(r.left)&&Me(r.right);case"pipe":return r.in?Me(r.in):!0;default:return!0}}function Eu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function kf(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&vt(e)}function vt(e){let r=e._zod.def;switch(r.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!r.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return r.innerType?vt(r.innerType):!0;case"union":return r.options?r.options.some(vt):!0;case"intersection":return!r.left||!r.right||vt(r.left)||vt(r.right);case"pipe":return r.out?vt(r.out):!0;default:return!0}}function B$(e,r,i,o,t=!0){let n=i._zod.def,a=t?w(r):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${o} !== null) {`),e.indented(u=>{let s=R(u,r,n.innerType,o,t);a&&s!==null&&u.write(`${a} = ${s};`)}),e.write("}"),a}function Vu(e,r,i){for(let[o,t]of at(r._zod.def.checks))e.write(`if (${i} > ${Se(o,t._zod.def.check)}) return INVALID;`)}function K$(e,r,i,o,t=!0){let n=i._zod.def;e.write(`if (!Array.isArray(${o})) return INVALID;`),Vu(e,i,`${o}.length`);let a=t?w(r):null,u=w(r),s=w(r);return a&&e.write(`const ${a} = new Array(${o}.length);`),e.write(`for (let ${u} = 0; ${u} < ${o}.length; ${u}++) {`),e.indented(c=>{c.write(`const ${s} = ${o}[${u}];`);let l=X(c,r,n.element,s,t);a&&l!==null&&c.write(`${a}[${u}] = ${l};`)}),e.write("}"),a}function G$(e,r,i,o){let n=i._zod.def.values;if(n.length!==1){let u=S(r,new Set(n));return e.write(`if (!${u}.has(${o})) return INVALID;`),o}let a=n[0];if(typeof a=="number"&&Number.isNaN(a)){let u=S(r,new Set(n));return e.write(`if (!${u}.has(${o})) return INVALID;`),o}if(typeof a=="string")e.write(`if (${o} !== ${q(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${o} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${o} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${o} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${o} !== ${a}n) return INVALID;`);else throw new N(`literal type ${typeof a}`);return o}function W$(e,r,i,o){let t=i._zod.values;if(!t)throw new N("enum schema without enumerated values");let n=S(r,t);return e.write(`if (!${n}.has(${o})) return INVALID;`),o}function xf(e,r,i,o){let t=i._zod.def;return R(e,r,t.innerType,o)}function X$(e,r,i,o){let t=i._zod.def,a=Object.getOwnPropertyDescriptor(i._zod.def,"defaultValue")?()=>i._zod.def.defaultValue:void 0;if(i._zod.def.type==="prefault"){if(!a)return R(e,r,t.innerType,o);let s=S(r,a),c=w(r);return e.write(`let ${c} = ${o};`),e.write(`if (${o} === undefined) ${c} = ${s}();`),R(e,r,t.innerType,c)}let u=w(r);if(a){let s=S(r,a),c=S(r,Jt);e.write(`let ${u};`),e.write(`if (${o} === undefined) {`),e.indented(l=>{l.write(`${u} = ${c}(${s}());`)}),e.write("} else {"),e.indented(l=>{let d=R(l,r,t.innerType,o);l.write(`${u} = ${d} === undefined ? ${c}(${s}()) : ${d};`)}),e.write("}")}else e.write(`let ${u};`),e.write(`if (${o} !== undefined) {`),e.indented(s=>{let c=R(s,r,t.innerType,o);s.write(`${u} = ${c};`)}),e.write("}");return u}function q$(e,r,i,o){let t=i._zod.def,n=R(e,r,t.innerType,o),a=w(r);return e.write(`const ${a} = ${n};`),e.write(`if (${a} === undefined) return INVALID;`),a}function Y$(e,r,i,o){let t=i._zod.def,n=t.items,a=t.rest;e.write(`if (!Array.isArray(${o})) return INVALID;`);let u=If(n,"optin"),s=If(n,"optout");a?e.write(`if (${o}.length < ${u}) return INVALID;`):e.write(`if (${o}.length < ${u} || ${o}.length > ${n.length}) return INVALID;`);let c=w(r);e.write(`const ${c} = [];`);for(let l=0;l<n.length;l++){let d=n[l];if(l>=s)e.write(`if (${c}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${o}.length) {`),f.indented(m=>{let v=w(r);m.write(`const ${v} = ${o}[${l}];`);let _=X(m,r,d,v);m.write(`${c}[${l}] = ${_};`)}),f.write("} else {"),f.indented(m=>{if(Eu(d)){m.write(`${c}.length = ${l};`);return}let v=w(r),_=w(r);m.write(`const ${v} = undefined;`),m.write(`const ${_} = (() => {`),m.indented(k=>{let z=X(k,r,d,v);k.write(`return ${z};`)}),m.write("})();"),m.write(`if (${_} === INVALID || ${_} === undefined) ${c}.length = ${l};`),m.write(`else ${c}[${l}] = ${_};`)}),f.write("}")}),e.write("}");else{let f=w(r);e.write(`const ${f} = ${o}[${l}];`);let m=X(e,r,d,f);e.write(`${c}[${l}] = ${m};`)}}if(a){let l=w(r),d=w(r);e.write(`for (let ${l} = ${n.length}; ${l} < ${o}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${o}[${l}];`);let m=X(f,r,a,d);f.write(`${c}[${l}] = ${m};`)}),e.write("}")}return c}function If(e,r){for(let i=e.length-1;i>=0;i--)if(!(r==="optin"?e[i]._zod.optin!==void 0:e[i]._zod.optout==="optional"))return i+1;return 0}function H$(e,r,i,o){let t=i._zod.def,n=t.options;if(t.discriminator)return Q$(e,r,t,o);if(t.inclusive===!1)throw new N("exclusive unions (z.xor)");if(n.length===0)return e.write("return INVALID;"),o;if(n.length===1)return R(e,r,n[0],o);if(n.every(s=>s._zod.def.type==="literal"&&!s._zod.def.checks?.length)){let s=new Set(n.flatMap(l=>l._zod.def.values)),c=S(r,s);return e.write(`if (!${c}.has(${o})) return INVALID;`),o}let u=w(r);e.write(`let ${u};`);for(let s=0;s<n.length;s++){let c=n[s];s===0?e.write(`${u} = (() => {`):e.write(`if (${u} === INVALID) ${u} = (() => {`),e.indented(l=>{let d=R(l,r,c,o);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${u} === INVALID) return INVALID;`),u}function Q$(e,r,i,o){if(i.unionFallback)throw new N("discriminated union with unionFallback");if(i.options.length===0)return e.write("return INVALID;"),o;let t=w(r),n=w(r);e.write(`const ${t} = ${o}?.[${q(i.discriminator)}];`),e.write(`let ${n};`);let a=!0,u=new Set;for(let s of i.options){let c=s._zod.propValues?.[i.discriminator];if(!c||c.size===0)throw new N("discriminated union option without static discriminator values");for(let f of c){if(u.has(f))throw new N(`duplicate discriminator value ${String(f)}`);u.add(f)}let l=Array.from(c,f=>eh(r,t,f)),d=a?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let m=R(f,r,s,o);f.write(`${n} = ${m};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),n}function eh(e,r,i){if(typeof i=="string")return`${r} === ${q(i)}`;if(typeof i=="number")return Number.isNaN(i)?`Number.isNaN(${r})`:`${r} === ${i}`;if(typeof i=="boolean")return`${r} === ${i}`;if(i===null)return`${r} === null`;if(i===void 0)return`${r} === undefined`;if(typeof i=="bigint")return`${r} === ${i}n`;if(typeof i=="symbol"){let o=S(e,i);return`${r} === ${o}`}throw new N(`literal discriminator value ${String(i)}`)}function th(e,r,i,o){let t=i._zod.def;r.definite=!1;let n=X(e,r,t.left,o),a=X(e,r,t.right,o),u=S(r,mt),s=w(r);return e.write(`const ${s} = ${u}(${n}, ${a});`),e.write(`if (!${s}.valid) return INVALID;`),`${s}.data`}function rh(e,r,i,o){let t=i._zod.def,n=S(r,ce);e.write(`if (!${n}(${o})) return INVALID;`);let a=w(r),u=w(r),s=w(r);e.write(`const ${a} = {};`);let c=t,l=c.partial?void 0:t.keyType._zod.values;if(l){let m=[];for(let _ of l){if(!(typeof _=="string"||typeof _=="number"||typeof _=="symbol"))throw new N(`record key value ${String(_)}`);let k=typeof _=="number"?_.toString():_;if(k==="__proto__")throw new N('record key "__proto__"');m.push(k);let z=S(r,_),I=R(e,r,t.keyType,z),D=w(r);e.write(`const ${D} = ${o}[${nh(r,k)}];`);let A=X(e,r,t.valueType,D);e.write(`${a}[${I}] = ${A};`)}let v=S(r,new Set(m));return e.write(`for (const ${u} in ${o}) {`),e.indented(_=>{_.write(`if (${v}.has(${u})) continue;`),c.mode==="loose"?_.write(`if (${u} !== "__proto__") ${a}[${u}] = ${o}[${u}];`):_.write("return INVALID;")}),e.write("}"),a}let d=t.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let m=t.mode==="loose",v=Vn(t.keyType);v.definite===!1&&(r.definite=!1);let _=S(r,v),k=S(r,be),z=w(r);return wf(e,r,o,u,I=>{I.write(`let ${z} = ${_}(${u});`),I.write(`if (${z} === INVALID && typeof ${u} === "string" && ${k}.test(${u})) ${z} = ${_}(Number(${u}));`),m?I.write(`if (${z} === INVALID) { ${a}[${u}] = ${o}[${u}]; continue; }`):I.write(`if (${z} === INVALID) return INVALID;`),I.write(`if (${z} === "__proto__") continue;`);let D=w(r);I.write(`const ${D} = ${o}[${u}];`);let A=X(I,r,t.valueType,D);I.write(`${a}[${z}] = ${A};`)}),a}return wf(e,r,o,u,m=>{m.write(`const ${s} = ${o}[${u}];`);let v=X(m,r,t.valueType,s);m.write(`${a}[${u}] = ${v};`)},"return INVALID;"),a}function wf(e,r,i,o,t,n){let a=S(r,Object.prototype.propertyIsEnumerable),u=w(r),s=w(r),c=w(r);e.write(`const ${u} = Object.getOwnPropertySymbols(${i});`),e.write(`const ${s} = Object.getOwnPropertyNames(${i});`),e.write(`for (let ${c} = 0; ${c} < ${s}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${s}[${c}];`),l.write(`if (${o} === "__proto__" || !${a}.call(${i}, ${o})) continue;`),t(l)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${u}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${u}[${c}];`),l.write(`if (!${a}.call(${i}, ${o})) continue;`),n?l.write(n):t(l)}),e.write("}")}function nh(e,r){return typeof r=="string"?q(r):S(e,r)}function ih(e,r,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Map)) return INVALID;`),Vu(e,i,`${o}.size`);let n=w(r),a=w(r),u=w(r);return e.write(`const ${n} = new Map();`),e.write(`for (const [${a}, ${u}] of ${o}) {`),e.indented(s=>{let c=R(s,r,t.keyType,a),l=R(s,r,t.valueType,u);s.write(`${n}.set(${c}, ${l});`)}),e.write("}"),n}function oh(e,r,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Set)) return INVALID;`),Vu(e,i,`${o}.size`);let n=w(r),a=w(r);return e.write(`const ${n} = new Set();`),e.write(`for (const ${a} of ${o}) {`),e.indented(u=>{let s=R(u,r,t.valueType,a);u.write(`${n}.add(${s});`)}),e.write("}"),n}function ah(e,r){return e.write(`if (!(${r} instanceof File)) return INVALID;`),r}function uh(e,r,i,o){e.write(`if (typeof ${o} !== "string") return INVALID;`);let t=i._zod.pattern;if(t){let n=S(r,t);e.write(`${n}.lastIndex = 0;`),e.write(`if (!${n}.test(${o})) return INVALID;`)}return o}function ch(e,r,i,o){let t=i._zod.def,n=Je(r,t.getter),a=S(r,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(s=>{s.write(`const inner = ${n}();`),s.write(`${a}.parser = function(input) {`),s.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),s.write("};")}),e.write("}");let u=w(r);return e.write(`const ${u} = ${a}.parser(${o});`),e.write(`if (${u} === INVALID) return INVALID;`),u}function sh(e,r,i,o){let t=i._zod.def,n=R(e,r,t.in,o);if(t.transform){if(Be(t.transform))throw new fe("z.compile: async transforms in pipes are not supported");let a=t.transform,s=Je(r,l=>{let d={value:l,issues:[],addIssue:Lu},f=a(l,d);return f instanceof Promise?H:d.issues.length===0?f:H}),c=w(r);return e.write(`const ${c} = ${s}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),R(e,r,t.out,c)}else return R(e,r,t.out,n)}function Be(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function lh(e,r,i,o){let t=i._zod.def;if(t.fn){if(Be(t.fn))throw new fe("z.compile: async custom predicates are not supported");let n=Je(r,t.fn),a=S(r,Zu),u=w(r);e.write(`const ${u} = ${n}(${o});`),e.write(`if (${u} instanceof Promise) ${a}();`),e.write(`if (!${u}) return INVALID;`)}else throw new N("custom schema without a predicate function");return o}function dh(e,r,i){let o=e._zod.run({value:i,issues:[]},{});if(o&&typeof o.then=="function")return H;let t=o;return t.issues.length===0?t.value:r()}function fh(e,r,i,o){let t=i._zod.def;if(!t.catchValue[Jr])throw new N("catch with a callback (only a constant catch value compiles)",!1);let n=w(r);e.write(`let ${n} = (() => {`),e.indented(c=>{let l=X(c,r,t.innerType,o);c.write(`return ${l};`)}),e.write("})();");let a=S(r,t.innerType),u=Je(r,t.catchValue),s=S(r,dh);return e.write(`if (${n} === INVALID) {`),e.indented(c=>{c.write(`${n} = ${s}(${a}, ${u}, ${o});`),c.write(`if (${n} === INVALID) return INVALID;`)}),e.write("}"),n}function mh(e,r,i,o){let t=i._zod.def;if(t.transform){if(Be(t.transform))throw new fe("z.compile: async transforms are not supported");let n=t.transform,u=Je(r,c=>{let l={value:c,issues:[],addIssue:Lu},d=n(c,l);return d instanceof Promise?H:l.issues.length===0?d:H}),s=w(r);return e.write(`const ${s} = ${u}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}return o}function Rn(e){return e.checks&&(e.checks=[...e.checks]),e}function Ru(e,r){return new e(Rn({type:"string",...b(r)}))}function Fu(e,r){return new e(Rn({type:"string",coerce:!0,...b(r)}))}function Fn(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(r)})}function Mn(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(r)})}function Jn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(r)})}function Bn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(r)})}function Kn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(r)})}function Gn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(r)})}function _r(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(r)})}function Wn(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(r)})}function Xn(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(r)})}function qn(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(r)})}function Yn(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(r)})}function Hn(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(r)})}function Qn(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(r)})}function ei(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(r)})}function ti(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(r)})}function ri(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(r)})}function Mu(e,r){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...b(r)})}function ni(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(r)})}function ii(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(r)})}function oi(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(r)})}function ai(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(r)})}function ui(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(r)})}function Ju(e,r){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...b(r)})}function Bu(e,r){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...b(r)})}function ci(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(r)})}var Ku={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function br(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(r)})}function kr(e,r){return new e({type:"string",format:"date",check:"string_format",...b(r)})}function xr(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(r)})}function Ir(e,r){return new e({type:"string",format:"duration",check:"string_format",...b(r)})}function Gu(e,r){return new e(Rn({type:"number",checks:[],...b(r)}))}function Wu(e,r){return new e(Rn({type:"number",coerce:!0,checks:[],...b(r)}))}function Xu(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...b(r)})}function qu(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...b(r)})}function Yu(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...b(r)})}function Hu(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...b(r)})}function Qu(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...b(r)})}function ec(e,r){return new e({type:"boolean",...b(r)})}function tc(e,r){return new e({type:"boolean",coerce:!0,...b(r)})}function rc(e,r){return new e({type:"bigint",...b(r)})}function nc(e,r){return new e({type:"bigint",coerce:!0,...b(r)})}function ic(e,r){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...b(r)})}function oc(e,r){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...b(r)})}function ac(e,r){return new e({type:"symbol",...b(r)})}function uc(e,r){return new e({type:"undefined",...b(r)})}function cc(e,r){return new e({type:"null",...b(r)})}function sc(e){return new e({type:"any"})}function lc(e){return new e({type:"unknown"})}function dc(e,r){return new e({type:"never",...b(r)})}function fc(e,r){return new e({type:"void",...b(r)})}function mc(e,r){return new e({type:"date",...b(r)})}function pc(e,r){return new e({type:"date",coerce:!0,...b(r)})}function gc(e,r){return new e({type:"nan",...b(r)})}function pe(e,r){return new un({check:"less_than",...b(r),value:e,inclusive:!1})}function ae(e,r){return new un({check:"less_than",...b(r),value:e,inclusive:!0})}function ge(e,r){return new cn({check:"greater_than",...b(r),value:e,inclusive:!1})}function ue(e,r){return new cn({check:"greater_than",...b(r),value:e,inclusive:!0})}function si(e){return ge(0,e)}function li(e){return pe(0,e)}function di(e){return ae(0,e)}function fi(e){return ue(0,e)}function Pe(e,r){return new Yo({check:"multiple_of",...b(r),value:e})}function De(e,r){return new ea({check:"max_size",...b(r),maximum:e})}function ve(e,r){return new ta({check:"min_size",...b(r),minimum:e})}function Ke(e,r){return new ra({check:"size_equals",...b(r),size:e})}function Ge(e,r){return new na({check:"max_length",...b(r),maximum:e})}function ke(e,r){return new ia({check:"min_length",...b(r),minimum:e})}function We(e,r){return new oa({check:"length_equals",...b(r),length:e})}function $t(e,r){return new aa({check:"string_format",format:"regex",...b(r),pattern:e})}function ht(e){return new ua({check:"string_format",format:"lowercase",...b(e)})}function yt(e){return new ca({check:"string_format",format:"uppercase",...b(e)})}function _t(e,r){return new sa({check:"string_format",format:"includes",...b(r),includes:e})}function bt(e,r){return new la({check:"string_format",format:"starts_with",...b(r),prefix:e})}function kt(e,r){return new da({check:"string_format",format:"ends_with",...b(r),suffix:e})}function mi(e,r,i){return new fa({check:"property",property:e,schema:r,...b(i)})}function xt(e,r){return new ma({check:"properties",shape:e,...b(r)})}function It(e,r){return new pa({check:"mime_type",mime:e,...b(r)})}function me(e){return new ga({check:"overwrite",tx:e})}function wt(e){return me(r=>r.normalize(e))}function zt(){return me(e=>e.trim())}function St(){return me(e=>e.toLowerCase())}function Pt(){return me(e=>e.toUpperCase())}function Dt(){return me(e=>Hi(e))}function vc(e,r,i){return new e({type:"array",element:r,...b(i)})}function ph(e,r,i){return new e({type:"union",options:r,...b(i)})}function gh(e,r,i){return new e({type:"union",options:r,inclusive:!1,...b(i)})}function vh(e,r,i,o){return new e({type:"union",options:i,discriminator:r,...b(o)})}function $h(e,r,i){return new e({type:"intersection",left:r,right:i})}function hh(e,r,i,o){let t=i instanceof P,n=t?o:i,a=t?i:null;return new e({type:"tuple",items:r,rest:a,...b(n)})}function yh(e,r,i,o){return new e({type:"record",keyType:r,valueType:i,...b(o)})}function _h(e,r,i,o){return new e({type:"map",keyType:r,valueType:i,...b(o)})}function bh(e,r,i){return new e({type:"set",valueType:r,...b(i)})}function kh(e,r,i){let o=Array.isArray(r)?Object.fromEntries(r.map(t=>[t,t])):r;return new e({type:"enum",entries:o,...b(i)})}function xh(e,r,i){return new e({type:"enum",entries:r,...b(i)})}function Ih(e,r,i){return new e({type:"literal",values:Array.isArray(r)?r:[r],...b(i)})}function $c(e,r){return new e({type:"file",...b(r)})}function wh(e,r){return new e({type:"transform",transform:r})}function zh(e,r){return new e({type:"optional",innerType:r})}function Sh(e,r){return new e({type:"nullable",innerType:r})}function Ph(e,r,i){return new e({type:"default",innerType:r,get defaultValue(){return typeof i=="function"?i():Jt(i)}})}function Dh(e,r,i){return new e({type:"nonoptional",innerType:r,...b(i)})}function jh(e,r){return new e({type:"success",innerType:r})}function Oh(e,r,i){return new e({type:"catch",innerType:r,catchValue:typeof i=="function"?i:io(i)})}function Nh(e,r,i){return new e({type:"pipe",in:r,out:i})}function Uh(e,r){return new e({type:"readonly",innerType:r})}function Ah(e,r,i){return new e({type:"template_literal",parts:r,...b(i)})}function Th(e,r){return new e({type:"lazy",getter:r})}function Zh(e,r){return new e({type:"promise",innerType:r})}function hc(e,r,i){let o=b(i);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:r,...o})}function yc(e,r,i){return new e({type:"custom",check:"custom",fn:r,...b(i)})}function _c(e,r){let i=Df(o=>(o.addIssue=t=>{if(typeof t=="string")o.issues.push(ut(t,o.value,i._zod.def));else{let n=t;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),"input"in n||(n.input=o.value),n.inst??(n.inst=i),n.continue??(n.continue=!i._zod.def.abort),o.issues.push(ut(n))}},e(o.value,o)),r);return i}function Df(e,r){let i=new L({check:"custom",...b(r)});return i._zod.check=e,i}function bc(e){let r=new L({check:"describe"});return r._zod.onattach=[i=>{let o=G.get(i)??{};G.add(i,{...o,description:e})}],r._zod.check=()=>{},r}function kc(e){let r=new L({check:"meta"});return r._zod.onattach=[i=>{let o=G.get(i)??{};G.add(i,{...o,...e})}],r._zod.check=()=>{},r}function xc(e,r){let i=b(r),o=i.truthy??["true","1","yes","on","y","enabled"],t=i.falsy??["false","0","no","off","n","disabled"];i.case!=="sensitive"&&(o=o.map(m=>typeof m=="string"?m.toLowerCase():m),t=t.map(m=>typeof m=="string"?m.toLowerCase():m));let n=new Set(o),a=new Set(t),u=e.Codec??mr,s=e.Boolean??dr,c=e.String??Fe,l=new c({type:"string",error:i.error}),d=new s({type:"boolean",error:i.error}),f=new u({type:"pipe",in:l,out:d,transform:((m,v)=>{let _=m;return i.case!=="sensitive"&&(_=_.toLowerCase()),n.has(_)?!0:a.has(_)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...n,...a],input:v.value,inst:f,continue:!1}),{})}),reverseTransform:((m,v)=>m===!0?o[0]||"true":t[0]||"false"),error:i.error});return f._zod.bag.truthy=o,f._zod.bag.falsy=t,f._zod.bag.case=i.case??"insensitive",f}function Xe(e,r,i,o={}){let t=b(o),n={check:"string_format",type:"string",format:r,fn:typeof i=="function"?i:u=>i.test(u),...t};return i instanceof RegExp&&(n.pattern=i),new e(n)}function wr(e,...r){for(let i of r)for(let o of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,o)&&K(e,o,i[o]);return e}function je(e){let r=e?.target??"draft-2020-12";return r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??G,target:r,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function M(e,r,i,o,t){let n=typeof r.unrepresentable=="function"?r.unrepresentable({zodSchema:e,path:o.path,message:t}):r.unrepresentable;if(n==="any")return!1;if(n===void 0||n==="throw")throw new Error(t);return Object.assign(i,n),!0}function E(e,r,i={path:[],schemaPath:[]}){var o;let t=e._zod.def,n=r.seen.get(e);if(n)return n.count++,i.schemaPath.includes(e)&&(n.cycle=i.path),n.schema;let a={schema:{},count:1,cycle:void 0,path:i.path};r.seen.set(e,a),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let u=e._zod.toJSONSchema?.();if(u)a.schema=u;else{let l={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(r,a.schema,l);else{let f=a.schema,m=r.processors[t.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${t.type}`);m(e,r,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),E(d,r,l),r.seen.get(d).isParent=!0)}let s=r.metadataRegistry.get(e);return s&&wr(a.schema,s),r.io==="input"&&Q(e)&&(delete a.schema.examples,delete a.schema.default),r.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,r.seen.get(e).schema}function jf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Oe(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let a of e.seen.entries()){let u=e.metadataRegistry.get(a[0])?.id;if(u){let s=o.get(u);if(s&&s!==a[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(u,a[0])}}let t=a=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,f=e.external.uri??(v=>v);if(d)return{ref:f(d)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${f("__shared")}#/${u}/${jf(m)}`}}let s="#",c=`${s}/${u}/`;if(a[1]===i&&!a[1].schema.id)return{ref:s};let l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+jf(l)}},n=a=>{if(a[1].schema.$ref)return;let u=a[1],{ref:s,defId:c}=t(a);u.def={...u.schema},c&&(u.defId=c);let l=u.schema;for(let d in l)delete l[d];l.$ref=s};if(e.cycles==="throw")for(let a of e.seen.entries()){let u=a[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
|
|
67
67
|
|
|
68
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let u=a[1];if(r===a[0]){n(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(r!==a[0]&&c){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(u.cycle){n(a);continue}u.count>1&&e.reused==="ref"&&n(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Uf(e){let r=e.anyOf;if(!Array.isArray(r)||r.length===0||e.type!==void 0)return;let i=[];for(let o of r){if(!o||typeof o!="object")return;Uf(o);let t=Object.keys(o);if(t.length!==1||t[0]!=="type")return;let n=o.type;for(let a of Array.isArray(n)?n:[n]){if(typeof a!="string")return;i.includes(a)||i.push(a)}}delete e.anyOf,e.type=i.length===1?i[0]:i}var Af=new Set(["type","properties","required","additionalProperties"]),Of=["oneOf","anyOf"];function Nf(e){let r=e.additionalProperties;return r===void 0||r===!1||typeof r!="object"||r===null?null:Object.keys(r).length?r:null}function Ic(e){let r=[];for(let n of e){if(typeof n!="object"||n.type!=="object")return null;for(let a in n)if(!Af.has(a))return null;r.push(n)}let i={},o=new Set;for(let n of r){for(let a in n.properties){if(Object.prototype.hasOwnProperty.call(i,a))continue;let u=[];for(let c of r){let l=c.properties?.[a]??Nf(c);l!=null&&(u.some(d=>JSON.stringify(d)===JSON.stringify(l))||u.push(l))}let s=u.length===1?u[0]:Ic(u)??{allOf:u};K(i,a,s)}for(let a of n.required??[])o.add(a)}let t={type:"object",properties:i};if(o.size&&(t.required=[...o]),r.every(n=>n.additionalProperties===!1))t.additionalProperties=!1;else{let n=[];for(let a of r){let u=Nf(a);u&&!n.some(s=>JSON.stringify(s)===JSON.stringify(u))&&n.push(u)}n.length===1?t.additionalProperties=n[0]:n.length>1&&(t.additionalProperties={allOf:n})}return t}function Eh(e){let r=e.allOf;if(!Array.isArray(r)||r.length<2)return;for(let t of Af)if(t in e)return;let i=r.filter(t=>Of.some(n=>Array.isArray(t[n]))),o=null;if(!i.length)o=Ic(r);else{let t=i[0],n=Of.find(s=>Array.isArray(t[s]));if(Object.keys(t).length!==1)return;let a=r.filter(s=>s!==t),u=t[n].map(s=>Ic([...a,s]));if(u.some(s=>!s))return;o={[n]:u}}o&&(delete e.allOf,wr(e,o))}function Ne(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=u=>{let s=e.seen.get(u);if(s.ref===null)return;let c=s.def??s.schema,l={...c},d=s.ref;if(s.ref=null,d){o(d);let m=e.seen.get(d),v=m.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(v)):wr(c,v),wr(c,l),u._zod.parent===d)for(let k in c)k==="$ref"||k==="allOf"||k in l||delete c[k];if(v.$ref&&m.def)for(let k in c)k==="$ref"||k==="allOf"||k in m.def&&JSON.stringify(c[k])===JSON.stringify(m.def[k])&&delete c[k]}let f=u._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let v in c)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(c[v])===JSON.stringify(m.def[v])&&delete c[v]}e.override({zodSchema:u,jsonSchema:c,path:s.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let u of[...e.seen.entries()].reverse())o(u[0]);if(e.target!=="openapi-3.0")for(let u of e.seen.entries())Uf(u[1].def??u[1].schema);for(let u of e.deferred)u();if(e.intersections.length){let u=new Map;for(let s of e.seen.values())for(let c of[s.schema,s.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=u.get(l);d?d.push(c):u.set(l,[c])}for(let s of e.intersections)for(let c of u.get(s)??[])Eh(c)}}let t={};if(e.target==="draft-2020-12"?t.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?t.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?t.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let u=e.external.registry.get(r)?.id;if(!u)throw new Error("Schema is missing an `id` property");t.$id=e.external.uri(u)}wr(t,i.defId?i.schema:i.def??i.schema);let n=e.metadataRegistry.get(r)?.id;n!==void 0&&t.id===n&&delete t.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let u of e.seen.entries()){let s=u[1];s.def&&s.defId&&(s.def.id===s.defId&&delete s.def.id,K(a,s.defId,s.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?t.$defs=a:t.definitions=a);try{let u=JSON.parse(JSON.stringify(t));return Object.defineProperty(u,"~standard",{value:{...r["~standard"],jsonSchema:{input:jt(r,"input",e.processors),output:jt(r,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Q(e,r){let i=r??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Q(o.element,i);if(o.type==="set")return Q(o.valueType,i);if(o.type==="lazy")return Q(o.getter(),i);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return Q(o.innerType,i);if(o.type==="intersection")return Q(o.left,i)||Q(o.right,i);if(o.type==="record"||o.type==="map")return Q(o.keyType,i)||Q(o.valueType,i);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(o.in,i)||Q(o.out,i);if(o.type==="object"){for(let t in o.shape)if(Q(o.shape[t],i))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(Q(t,i))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(Q(t,i))return!0;return!!(o.rest&&Q(o.rest,i))}return!1}var wc=(e,r={})=>i=>{let o=je({...i,processors:r});return E(e,o),Oe(o,e),Ne(o,e)},jt=(e,r,i={})=>o=>{let{libraryOptions:t,target:n}=o??{},a=je({...t??{},target:n,io:r,processors:i});return E(e,a),Oe(a,e),Ne(a,e)};var Ot=(e,r,i)=>{(e[r]===void 0||i>e[r])&&(e[r]=i)},Nt=(e,r,i)=>{(e[r]===void 0||i<e[r])&&(e[r]=i)},Tf=(e,r)=>{Ot(e,"minimum",r),Nt(e,"maximum",r)},Lf=(e,r)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(r)||e.multipleOf.push(r)},Vf=(e,r)=>{e.patterns??(e.patterns=new Set),e.patterns.add(r)},Rf=(e,r)=>{e.mime=e.mime?e.mime.filter(i=>r.includes(i)):[...r]},Ff=(e,r)=>{e.format=r,r.includes("int")&&(e.isInt=!0)},Zf=(e,r)=>Ot(e,"minimum",r.minimum),Ef=(e,r)=>Nt(e,"maximum",r.maximum),Cf=e=>(r,i)=>{Ff(r,i.format);let[o,t]=e[i.format];Ot(r,"minimum",o),Nt(r,"maximum",t)},Ch={greater_than:(e,r)=>Ot(e,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(e,r)=>Nt(e,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(e,r)=>Lf(e,r.value),number_format:Cf(Kt),bigint_format:Cf(Gt),min_length:Zf,max_length:Ef,length_equals:(e,r)=>Tf(e,r.length),min_size:Zf,max_size:Ef,size_equals:(e,r)=>Tf(e,r.size),string_format:(e,r)=>{Ff(e,r.format),r.pattern&&Vf(e,r.pattern),(r.format==="base64"||r.format==="base64url")&&(e.contentEncoding=r.format),(r.local||r.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,r)=>Rf(e,r.mime)};function J(e){let r={},i=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(let n of o)Ch[n._zod.def.check]?.(r,n._zod.def);let t=e._zod.bag;t.minimum!==void 0&&Ot(r,"minimum",t.minimum),t.exclusiveMinimum!==void 0&&Ot(r,"exclusiveMinimum",t.exclusiveMinimum),t.maximum!==void 0&&Nt(r,"maximum",t.maximum),t.exclusiveMaximum!==void 0&&Nt(r,"exclusiveMaximum",t.exclusiveMaximum),t.multipleOf!==void 0&&Lf(r,t.multipleOf),t.format!==void 0&&(r.format??(r.format=t.format),t.format.includes("int")&&(r.isInt=!0)),t.mime&&Rf(r,t.mime);for(let n of t.patterns??[])Vf(r,n);return r}var Lh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Vh=new Map([[hn,Oo],[lr,No]]),Mf=e=>Vh.get(e)??e,Pc=(e,r,i,o)=>{let t=i;t.type="string";let{minimum:n,maximum:a,format:u,patterns:s,contentEncoding:c,laxFormat:l}=J(e);if(typeof n=="number"&&(t.minLength=n),typeof a=="number"&&(t.maxLength=a),u&&(t.format=Lh[u]??u,t.format===""&&delete t.format,(u==="time"||l)&&delete t.format),c&&(t.contentEncoding=c),s&&s.size>0){let d=[...s].map(Mf);d.length===1?t.pattern=d[0].source:d.length>1&&(t.allOf=[...d.map(f=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Dc=(e,r,i,o)=>{let t=i,{minimum:n,maximum:a,multipleOf:u,exclusiveMaximum:s,exclusiveMinimum:c,isInt:l}=J(e);t.type=l?"integer":"number";let d=typeof c=="number"&&c>=(n??Number.NEGATIVE_INFINITY),f=typeof s=="number"&&s<=(a??Number.POSITIVE_INFINITY),m=r.target==="draft-04"||r.target==="openapi-3.0";if(d?m?(t.minimum=c,t.exclusiveMinimum=!0):t.exclusiveMinimum=c:typeof n=="number"&&(t.minimum=n),f?m?(t.maximum=s,t.exclusiveMaximum=!0):t.exclusiveMaximum=s:typeof a=="number"&&(t.maximum=a),u){let v=new Set;for(let z of u)Number.isFinite(z)&&z!==0?v.add(Math.abs(z)):M(e,r,t,o,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[_,...k]=v;_!==void 0&&(t.multipleOf=_),k.length&&(t.allOf=[...t.allOf??[],...k.map(z=>({multipleOf:z}))])}},jc=(e,r,i,o)=>{i.type="boolean"},Oc=(e,r,i,o)=>{M(e,r,i,o,"BigInt cannot be represented in JSON Schema")},Nc=(e,r,i,o)=>{M(e,r,i,o,"Symbols cannot be represented in JSON Schema")},Uc=(e,r,i,o)=>{r.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Ac=(e,r,i,o)=>{M(e,r,i,o,"Undefined cannot be represented in JSON Schema")},Tc=(e,r,i,o)=>{M(e,r,i,o,"Void cannot be represented in JSON Schema")},Zc=(e,r,i,o)=>{i.not={}},Ec=(e,r,i,o)=>{},Cc=(e,r,i,o)=>{},Lc=(e,r,i,o)=>{M(e,r,i,o,"Date cannot be represented in JSON Schema")},Vc=(e,r,i,o)=>{let t=e._zod.def,n=rt(t.entries);if(n.length===0){i.not={};return}n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),i.enum=n},Rc=(e,r,i,o)=>{let t=e._zod.def;if(t.values.length===0){i.not={};return}let n=[];for(let a of t.values)if(a===void 0){if(M(e,r,i,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(M(e,r,i,o,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(a))}else n.push(a);if(n.length!==0)if(n.length===1){let a=n[0];i.type=a===null?"null":typeof a,r.target==="draft-04"||r.target==="openapi-3.0"?i.enum=[a]:i.const=a}else n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),n.every(a=>typeof a=="boolean")&&(i.type="boolean"),n.every(a=>a===null)&&(i.type="null"),i.enum=n},Fc=(e,r,i,o)=>{M(e,r,i,o,"NaN cannot be represented in JSON Schema")},Mc=(e,r,i,o)=>{let t=i,n=e._zod.pattern;if(!n)throw new Error("Pattern not found in template literal");t.type="string",t.pattern=n.source},Jc=(e,r,i,o)=>{let t=i;t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:n,maximum:a,mime:u}=J(e);n!==void 0&&(t.minLength=n),a!==void 0&&(t.maxLength=a),u&&(u.length===0?t.not={}:u.length===1?t.contentMediaType=u[0]:t.anyOf=u.map(s=>({contentMediaType:s})))},Bc=(e,r,i,o)=>{i.type="boolean"},Kc=(e,r,i,o)=>{M(e,r,i,o,"Custom types cannot be represented in JSON Schema")},Gc=(e,r,i,o)=>{M(e,r,i,o,"Function types cannot be represented in JSON Schema")},Wc=(e,r,i,o)=>{M(e,r,i,o,"Transforms cannot be represented in JSON Schema")},Xc=(e,r,i,o)=>{M(e,r,i,o,"Map cannot be represented in JSON Schema")},qc=(e,r,i,o)=>{M(e,r,i,o,"Set cannot be represented in JSON Schema")},Yc=(e,r,i,o)=>{let t=i,n=e._zod.def,{minimum:a,maximum:u}=J(e);typeof a=="number"&&(t.minItems=a),typeof u=="number"&&(t.maxItems=u),t.type="array",t.items=E(n.element,r,{...o,path:[...o.path,"items"]})};function zr(e){let r=e._zod.def;return r.type==="pipe"&&r.in._zod.traits.has("$ZodTransform")?zr(r.out):r.type==="catch"?zr(r.innerType):e._zod.optin}var Hc=(e,r,i,o)=>{let t=i,n=e._zod.def,a=n.shape;if(Object.getOwnPropertySymbols(a).length&&M(e,r,t,o,"Symbol keys cannot be represented in JSON Schema"))return;t.type="object",t.properties={};for(let c in a)K(t.properties,c,E(a[c],r,{...o,path:[...o.path,"properties",c]}));let s=[];for(let c of Object.keys(a)){let l=n.shape[c];(r.io==="input"?zr(l)===void 0:l._zod.optout===void 0)&&s.push(c)}s.length>0&&(t.required=s),n.catchall?._zod.def.type==="never"?t.additionalProperties=!1:n.catchall?n.catchall&&(t.additionalProperties=E(n.catchall,r,{...o,path:[...o.path,"additionalProperties"]})):r.io==="output"&&(t.additionalProperties=!1)},gi=(e,r,i,o)=>{let t=e._zod.def,n=t.inclusive===!1,a=t.options.map((u,s)=>E(u,r,{...o,path:[...o.path,n?"oneOf":"anyOf",s]}));n?i.oneOf=a:i.anyOf=a},Qc=(e,r,i,o)=>{let t=e._zod.def,n=E(t.left,r,{...o,path:[...o.path,"allOf",0]}),a=E(t.right,r,{...o,path:[...o.path,"allOf",1]}),u=c=>"allOf"in c&&Object.keys(c).length===1,s=[...u(n)?n.allOf:[n],...u(a)?a.allOf:[a]];i.allOf=s,r.intersections.push(s)},es=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="array";let a=r.target==="draft-2020-12"?"prefixItems":"items",u=r.target==="draft-2020-12"||r.target==="openapi-3.0"?"items":"additionalItems",s=n.items.map((_,k)=>E(_,r,{...o,path:[...o.path,a,k]})),c=n.rest?E(n.rest,r,{...o,path:[...o.path,u,...r.target==="openapi-3.0"?[n.items.length]:[]]}):null,l=n.items.length;for(;l>0;){let _=n.items[l-1];if(!(r.io==="input"?zr(_)!==void 0:_._zod.optout==="optional"))break;l--}let d=n.items.length,f=!n.rest;r.target==="draft-2020-12"?(t.prefixItems=s,f?t.items=!1:c&&(t.items=c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):r.target==="openapi-3.0"?(t.items={anyOf:s},c&&t.items.anyOf.push(c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):(t.items=s,f?t.additionalItems=!1:c&&(t.additionalItems=c),l>0&&(t.minItems=l),f&&(t.maxItems=d));let{minimum:m,maximum:v}=J(e);typeof m=="number"&&(t.minItems=m),typeof v=="number"&&(t.maxItems=v)};function zc(e,r,i){if(r.$ref){if(i.has(r))return r;i.add(r);let v=e.get(r)?.def;if(!v)return r;let _=zc(e,v,i);return _===v?r:_}for(let v of["anyOf","oneOf"]){let _=r[v];if(!Array.isArray(_))continue;let k=_.map(z=>zc(e,z,i));k.some((z,I)=>z!==_[I])&&(r={...r,[v]:k})}let o=Array.isArray(r.type)?r.type:[r.type],t=!o.includes("string")&&o.some(v=>v==="number"||v==="integer"),n=r.enum??(r.const!==void 0?[r.const]:void 0);if(!t&&!n?.some(v=>typeof v=="number"))return r;let{minimum:a,maximum:u,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,format:d,id:f,...m}=r;return m.enum?m.enum=m.enum.map(v=>typeof v=="number"?String(v):v):typeof m.const=="number"&&(m.const=String(m.const)),t&&(m.type="string",n||(m.pattern=(o.includes("number")?be:nr).source)),m}var Sc=new WeakMap;function Rh(e){let r=new Map;for(let o of e.seen.values())o.def&&!r.has(o.schema)&&r.set(o.schema,o);let i=new Map;for(let o of Sc.get(e)??[]){let t=e.seen.get(o),n=(t?.def??t?.schema)?.propertyNames;if(!n||n===!0||i.has(n))continue;let a=zc(r,n,new Set);a!==n&&i.set(n,a)}if(i.size)for(let o of e.seen.values())for(let t of[o.schema,o.def]){let n=t&&i.get(t.propertyNames);n&&(t.propertyNames=n)}}var ts=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="object";let a=n.keyType,u=J(a).patterns;if(n.mode==="loose"&&u&&u.size>0){let l=E(n.valueType,r,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let d of u)K(t.patternProperties,Mf(d).source,l)}else{if(r.target==="draft-07"||r.target==="draft-2020-12"){t.propertyNames=E(n.keyType,r,{...o,path:[...o.path,"propertyNames"]});let l=Sc.get(r);l||(l=[],Sc.set(r,l),r.deferred.push(()=>Rh(r))),l.push(e)}t.additionalProperties=E(n.valueType,r,{...o,path:[...o.path,"additionalProperties"]})}let s=a._zod.values,c=r.io==="input"&&zr(n.valueType)!==void 0;if(s&&!n.partial&&!c){let l=[...s].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(t.required=l.map(String))}},rs=(e,r,i,o)=>{let t=e._zod.def,n=E(t.innerType,r,o),a=r.seen.get(e);r.target==="openapi-3.0"?(a.ref=t.innerType,i.nullable=!0):i.anyOf=[n,{type:"null"}]},ns=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},is=Symbol();function Jf(e,r,i,o,t){let n=!1,a=JSON.stringify(e,(u,s)=>typeof s!="bigint"?s:(n=!0,null));return n?(M(r,i,o,t,"BigInt defaults cannot be represented in JSON Schema"),is):JSON.parse(a)}var os=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a=Jf(t.defaultValue,e,r,i,o);a!==is&&(i.default=a)},as=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);if(n.ref=t.innerType,r.io!=="input")return;let a=Jf(t.defaultValue,e,r,i,o);a!==is&&(i._prefault=a)},us=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a;try{a=t.catchValue(void 0)}catch{M(e,r,i,o,"Dynamic catch values are not supported in JSON Schema");return}i.default=a},cs=(e,r,i,o)=>{let t=e._zod.def,n=t.in._zod.traits.has("$ZodTransform"),a=r.io==="input"?n?t.out:t.in:t.out;E(a,r,o);let u=r.seen.get(e);u.ref=a},ss=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType,i.readOnly=!0},ls=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},vi=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},ds=(e,r,i,o)=>{let t=e._zod.innerType;E(t,r,o);let n=r.seen.get(e);n.ref=t},pi={string:Pc,number:Dc,boolean:jc,bigint:Oc,symbol:Nc,null:Uc,undefined:Ac,void:Tc,never:Zc,any:Ec,unknown:Cc,date:Lc,enum:Vc,literal:Rc,nan:Fc,template_literal:Mc,file:Jc,success:Bc,custom:Kc,function:Gc,transform:Wc,map:Xc,set:qc,array:Yc,object:Hc,union:gi,intersection:Qc,tuple:es,record:ts,nullable:rs,nonoptional:ns,default:os,prefault:as,catch:us,pipe:cs,readonly:ss,promise:ls,optional:vi,lazy:ds};function $i(e,r){if("_idmap"in e){let o=e,t=je({...r,processors:pi}),n={};for(let s of o._idmap.entries()){let[c,l]=s;E(l,t)}let a={},u={registry:o,uri:r?.uri,defs:n};t.external=u;for(let s of o._idmap.entries()){let[c,l]=s;Oe(t,l),K(a,c,Ne(t,l))}if(Object.keys(n).length>0){let s=t.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:n}}return{schemas:a}}let i=je({...r,processors:pi});return E(e,i),Oe(i,e),Ne(i,e)}var hi=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(r){this.ctx.counter=r}get seen(){return this.ctx.seen}constructor(r){let i=r?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=je({processors:pi,target:i,...r?.metadata&&{metadata:r.metadata},...r?.unrepresentable&&{unrepresentable:r.unrepresentable},...r?.override&&{override:r.override},...r?.io&&{io:r.io}})}process(r,i={path:[],schemaPath:[]}){return E(r,this.ctx,i)}emit(r,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Oe(this.ctx,r);let o=Ne(this.ctx,r),{"~standard":t,...n}=o;return n}};var Bf={};var yi={};he(yi,{endsWith:()=>kt,gt:()=>ge,gte:()=>ue,includes:()=>_t,length:()=>We,lowercase:()=>ht,lt:()=>pe,lte:()=>ae,maxLength:()=>Ge,maxSize:()=>De,mime:()=>It,minLength:()=>ke,minSize:()=>ve,multipleOf:()=>Pe,negative:()=>li,nonnegative:()=>fi,nonpositive:()=>di,normalize:()=>wt,overwrite:()=>me,positive:()=>si,properties:()=>xt,property:()=>mi,regex:()=>$t,size:()=>Ke,slugify:()=>Dt,startsWith:()=>bt,toLowerCase:()=>St,toUpperCase:()=>Pt,trim:()=>zt,uppercase:()=>yt});var Kf=new WeakSet([Object.prototype,Error.prototype]);function _i(e,r,i){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,get(){let o=i(this);return Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0})}})}var Gf=(e,r)=>{lo.init(e,r),e.name="ZodError";let i=Object.getPrototypeOf(e);Kf.has(i)||(Kf.add(i),_i(i,"format",o=>t=>Qt(o,t)),_i(i,"flatten",o=>t=>Ht(o,t)),_i(i,"addIssue",o=>t=>{o.issues.push(t),o.message=JSON.stringify(o.issues,nt,2)}),_i(i,"addIssues",o=>t=>{o.issues.push(...t),o.message=JSON.stringify(o.issues,nt,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Mh=p("ZodError",Gf),oe=p("ZodError",Gf,void 0,{Parent:Error});var fs=ct(oe),ms=st(oe),ps=lt(oe),gs=dt(oe),vs=Wr(oe),$s=Xr(oe),hs=qr(oe),ys=Yr(oe),_s=Hr(oe),bs=Qr(oe),ks=en(oe),xs=tn(oe);function Bh(){B.localeError||F(An())}function He(){B.memoizer||F({memoizer:$r()})}var j=p("ZodType",(e,r)=>(Bh(),P.init(e,r),e.def=r,e.type=r.type,e),{check(...e){let r=this.def;return this.clone($.mergeDefs(r,{checks:[...r.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,r){return T(this,e,r)},brand(){return this},register(e,r){return e.add(this,r),this},refine(e,r){return this.check(gl(e,r))},superRefine(e,r){return this.check(vl(e,r))},overwrite(e){return this.check(me(e))},optional(){return Ye(this)},exactOptional(){return qs(this)},nullable(){return Pr(this)},nullish(){return Ye(Pr(this))},nonoptional(e){return rl(this,e)},array(){return Or(this)},or(e){return Lt([this,e])},and(e){return Rs(this,e)},transform(e){return ki(this,Ji(e))},default(e){return Qs(this,e)},prefault(e){return tl(this,e)},catch(e){return ol(this,e)},pipe(e){return ki(this,e)},readonly(){return sl(this)},describe(e){let r=this.clone();return G.add(r,{description:e}),r},meta(...e){if(e.length===0)return G.get(this);let r=this.clone();return G.add(r,e[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...r){return r.length===0?e(this):e(this,...r)},get"~standard"(){return $.hide(this,"~standard",{...mn(this),jsonSchema:{input:jt(this,"input"),output:jt(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(r,i){return fs(this,r,i,{callee:e})},parseAsync:async function e(r,i){return await ms(this,r,i,{callee:e})},safeParse(e,r){return ps(this,e,r)},async safeParseAsync(e,r){return gs(this,e,r)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,r){return er(this,e,r)},validateAsync(e,r){return tr(this,e,r)},encode:function e(r,i){return vs(this,r,i,{callee:e})},decode:function e(r,i){return $s(this,r,i,{callee:e})},encodeAsync:async function e(r,i){return await hs(this,r,i,{callee:e})},decodeAsync:async function e(r,i){return await ys(this,r,i,{callee:e})},safeEncode(e,r){return _s(this,e,r)},safeDecode(e,r){return bs(this,e,r)},async safeEncodeAsync(e,r){return ks(this,e,r)},async safeDecodeAsync(e,r){return xs(this,e,r)},toJSONSchema(e){return wc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),xi=p("_ZodString",(e,r)=>{Fe.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Pc(e,i,o,t)},$.derived({format:e=>J(e).format??null,minLength:e=>J(e).minimum??null,maxLength:e=>J(e).maximum??null},{regex(...e){return this.check($t(...e))},includes(...e){return this.check(_t(...e))},startsWith(...e){return this.check(bt(...e))},endsWith(...e){return this.check(kt(...e))},min(...e){return this.check(ke(...e))},max(...e){return this.check(Ge(...e))},length(...e){return this.check(We(...e))},nonempty(...e){return this.check(ke(1,...e))},lowercase(e){return this.check(ht(e))},uppercase(e){return this.check(yt(e))},trim(){return this.check(zt())},normalize(...e){return this.check(wt(...e))},toLowerCase(){return this.check(St())},toUpperCase(){return this.check(Pt())},slugify(){return this.check(Dt())}})),Tt=p("ZodString",(e,r)=>{Fe.init(e,r),xi.init(e,r)},{email(e){return this.check(Fn(Ii,e))},url(e){return this.check(_r(Dr,e))},jwt(e){return this.check(ci(Vi,e))},emoji(e){return this.check(Wn(zi,e))},guid(e){return this.check(Mn(wi,e))},uuid(e){return this.check(Jn($e,e))},uuidv4(e){return this.check(Bn($e,e))},uuidv6(e){return this.check(Kn($e,e))},uuidv7(e){return this.check(Gn($e,e))},nanoid(e){return this.check(Xn(Si,e))},cuid(e){return this.check(qn(Pi,e))},cuid2(e){return this.check(Yn(Di,e))},ulid(e){return this.check(Hn(ji,e))},base64(e){return this.check(oi(Ei,e))},base64url(e){return this.check(ai(Ci,e))},xid(e){return this.check(Qn(Oi,e))},ksuid(e){return this.check(ei(Ni,e))},ipv4(e){return this.check(ti(Ui,e))},ipv6(e){return this.check(ri(Ai,e))},cidrv4(e){return this.check(ni(Ti,e))},cidrv6(e){return this.check(ii(Zi,e))},e164(e){return this.check(ui(Li,e))},datetime(e){return this.check(br(Ue,e))},date(e){return this.check(kr(Ae,e))},time(e){return this.check(xr(Te,e))},duration(e){return this.check(Ir(Ze,e))}});function Sr(e){return Ru(Tt,e)}var C=p("ZodStringFormat",(e,r)=>{Z.init(e,r),xi.init(e,r)}),Ue=p("ZodISODateTime",(e,r)=>{Oa.init(e,r),C.init(e,r)}),Ae=p("ZodISODate",(e,r)=>{Na.init(e,r),C.init(e,r)}),Te=p("ZodISOTime",(e,r)=>{Ua.init(e,r),C.init(e,r)}),Ze=p("ZodISODuration",(e,r)=>{Aa.init(e,r),C.init(e,r)}),Ii=p("ZodEmail",(e,r)=>{_a.init(e,r),C.init(e,r)});function Wf(e){return Fn(Ii,e)}var wi=p("ZodGUID",(e,r)=>{ha.init(e,r),C.init(e,r)});function Xf(e){return Mn(wi,e)}var $e=p("ZodUUID",(e,r)=>{ya.init(e,r),C.init(e,r)});function qf(e){return Jn($e,e)}function Yf(e){return Bn($e,e)}function Hf(e){return Kn($e,e)}function Qf(e){return Gn($e,e)}var Dr=p("ZodURL",(e,r)=>{xa.init(e,r),C.init(e,r)});function em(e){return _r(Dr,e)}function tm(e){return _r(Dr,{protocol:rr,hostname:Ao,...$.normalizeParams(e)})}var zi=p("ZodEmoji",(e,r)=>{Ia.init(e,r),C.init(e,r)});function rm(e){return Wn(zi,e)}var Si=p("ZodNanoID",(e,r)=>{wa.init(e,r),C.init(e,r)});function nm(e){return Xn(Si,e)}var Pi=p("ZodCUID",(e,r)=>{za.init(e,r),C.init(e,r)});function im(e){return qn(Pi,e)}var Di=p("ZodCUID2",(e,r)=>{Sa.init(e,r),C.init(e,r)});function om(e){return Yn(Di,e)}var ji=p("ZodULID",(e,r)=>{Pa.init(e,r),C.init(e,r)});function am(e){return Hn(ji,e)}var Oi=p("ZodXID",(e,r)=>{Da.init(e,r),C.init(e,r)});function um(e){return Qn(Oi,e)}var Ni=p("ZodKSUID",(e,r)=>{ja.init(e,r),C.init(e,r)});function cm(e){return ei(Ni,e)}var Ui=p("ZodIPv4",(e,r)=>{Ta.init(e,r),C.init(e,r)});function sm(e){return ti(Ui,e)}var Is=p("ZodMAC",(e,r)=>{Ea.init(e,r),C.init(e,r)});function lm(e){return Mu(Is,e)}var Ai=p("ZodIPv6",(e,r)=>{Za.init(e,r),C.init(e,r)});function dm(e){return ri(Ai,e)}var Ti=p("ZodCIDRv4",(e,r)=>{Ca.init(e,r),C.init(e,r)});function fm(e){return ni(Ti,e)}var Zi=p("ZodCIDRv6",(e,r)=>{La.init(e,r),C.init(e,r)});function mm(e){return ii(Zi,e)}var Ei=p("ZodBase64",(e,r)=>{Va.init(e,r),C.init(e,r)});function pm(e){return oi(Ei,e)}var Ci=p("ZodBase64URL",(e,r)=>{Ra.init(e,r),C.init(e,r)});function gm(e){return ai(Ci,e)}var Li=p("ZodE164",(e,r)=>{Fa.init(e,r),C.init(e,r)});function vm(e){return ui(Li,e)}var ws=p("ZodCreditCard",(e,r)=>{Ma.init(e,r),C.init(e,r)});function $m(e){return Ju(ws,e)}var zs=p("ZodIBAN",(e,r)=>{Ja.init(e,r),C.init(e,r)});function hm(e){return Bu(zs,e)}var Vi=p("ZodJWT",(e,r)=>{Ba.init(e,r),C.init(e,r)});function ym(e){return ci(Vi,e)}var Qe=p("ZodCustomStringFormat",(e,r)=>{Ka.init(e,r),C.init(e,r)});function _m(e,r,i={}){return Xe(Qe,e,r,i)}function bm(e){return Xe(Qe,"hostname",Uo,e)}function km(e){return Xe(Qe,"hex",Wo,e)}function xm(e){return Xe(Qe,"currency_code",Zo,e)}function Im(e,r){let i=r?.enc??"hex",o=`${e}_${i}`,t=le[o];if(!t)throw new Error(`Unrecognized hash format: ${o}`);return Xe(Qe,o,t,r)}var Zt=p("ZodNumber",(e,r)=>{xn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Dc(e,i,o,t),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:r,exclusiveMinimum:i}=J(e);return Math.max(r??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:r,exclusiveMaximum:i}=J(e);return Math.min(r??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:r,multipleOf:i}=J(e);return!!r||!!i?.some(Number.isSafeInteger)},format:e=>J(e).format??null},{gt(e,r){return this.check(ge(e,r))},gte(e,r){return this.check(ue(e,r))},min(e,r){return this.check(ue(e,r))},lt(e,r){return this.check(pe(e,r))},lte(e,r){return this.check(ae(e,r))},max(e,r){return this.check(ae(e,r))},int(e){return this.check(bi(e))},safe(e){return this.check(bi(e))},positive(e){return this.check(ge(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(pe(0,e))},nonpositive(e){return this.check(ae(0,e))},multipleOf(e,r){return this.check(Pe(e,r))},step(e,r){return this.check(Pe(e,r))},finite(){return this}}));function Ss(e){return Gu(Zt,e)}var et=p("ZodNumberFormat",(e,r)=>{Ga.init(e,r),Zt.init(e,r)});function bi(e){return Xu(et,e)}function wm(e){return qu(et,e)}function zm(e){return Yu(et,e)}function Sm(e){return Hu(et,e)}function Pm(e){return Qu(et,e)}var Et=p("ZodBoolean",(e,r)=>{dr.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>jc(e,i,o,t)});function Ps(e){return ec(Et,e)}var Ct=p("ZodBigInt",(e,r)=>{In.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Oc(e,i,o,t)},$.derived({minValue:e=>J(e).minimum??null,maxValue:e=>J(e).maximum??null,format:e=>J(e).format??null},{gte(e,r){return this.check(ue(e,r))},min(e,r){return this.check(ue(e,r))},gt(e,r){return this.check(ge(e,r))},lt(e,r){return this.check(pe(e,r))},lte(e,r){return this.check(ae(e,r))},max(e,r){return this.check(ae(e,r))},positive(e){return this.check(ge(BigInt(0),e))},negative(e){return this.check(pe(BigInt(0),e))},nonpositive(e){return this.check(ae(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,r){return this.check(Pe(e,r))}}));function Dm(e){return rc(Ct,e)}var Ri=p("ZodBigIntFormat",(e,r)=>{Wa.init(e,r),Ct.init(e,r)});function jm(e){return ic(Ri,e)}function Om(e){return oc(Ri,e)}var Ds=p("ZodSymbol",(e,r)=>{Xa.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Nc(e,i,o,t)});function Nm(e){return ac(Ds,e)}var js=p("ZodUndefined",(e,r)=>{qa.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Ac(e,i,o,t)});function Um(e){return uc(js,e)}var Os=p("ZodNull",(e,r)=>{Ya.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Uc(e,i,o,t)});function Ns(e){return cc(Os,e)}var Us=p("ZodAny",(e,r)=>{Ha.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Ec(e,i,o,t)});function Am(){return sc(Us)}var As=p("ZodUnknown",(e,r)=>{Qa.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Cc(e,i,o,t)});function qe(){return lc(As)}var Ts=p("ZodNever",(e,r)=>{eu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Zc(e,i,o,t)});function Fi(e){return dc(Ts,e)}var Zs=p("ZodVoid",(e,r)=>{tu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Tc(e,i,o,t)});function Tm(e){return fc(Zs,e)}var jr=p("ZodDate",(e,r)=>{ru.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Lc(e,i,o,t),e.min=(i,o)=>e.check(ue(i,o)),e.max=(i,o)=>e.check(ae(i,o))},$.derived({minDate:e=>{let{minimum:r}=J(e);return r?new Date(r):null},maxDate:e=>{let{maximum:r}=J(e);return r?new Date(r):null}},{}));function Zm(e){return mc(jr,e)}var Es=p("ZodArray",(e,r)=>{He(),iu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Yc(e,i,o,t),e.element=r.element},{min(e,r){return this.check(ke(e,r))},nonempty(e){return this.check(ke(1,e))},max(e,r){return this.check(Ge(e,r))},length(e,r){return this.check(We(e,r))},unwrap(){return this.element}});function Or(e,r){return vc(Es,e,r)}function Em(e){let r=e._zod.def.shape;return Mi(Object.keys(r))}var Nr=p("ZodObject",(e,r)=>{He(),ou.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Hc(e,i,o,t),$.installLazyProp(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return Mi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:qe()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:qe()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:Fi()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(Ar,this,e[0])},exactPartial(...e){return $.partial(Bi,this,e[0],"exactPartial")},required(...e){return $.required(Ki,this,e[0])}});function Cm(e,r){let i={type:"object",shape:e??{},...$.normalizeParams(r)};return new Nr(i)}function Lm(e,r){return new Nr({type:"object",shape:e,catchall:Fi(),...$.normalizeParams(r)})}function Vm(e,r){return new Nr({type:"object",shape:e,catchall:qe(),...$.normalizeParams(r)})}var Ur=p("ZodUnion",(e,r)=>{fr.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>gi(e,i,o,t),e.options=r.options});function Lt(e,r){return new Ur({type:"union",options:e,...$.normalizeParams(r)})}var Cs=p("ZodXor",(e,r)=>{Ur.init(e,r),au.init(e,r),e._zod.processJSONSchema=(i,o,t)=>gi(e,i,o,t),e.options=r.options});function Rm(e,r){return new Cs({type:"union",options:e,inclusive:!1,...$.normalizeParams(r)})}var Ls=p("ZodDiscriminatedUnion",(e,r)=>{Ur.init(e,r),cu.init(e,r)});function Fm(e,r,i){return new Ls({type:"union",options:r,discriminator:e,...$.normalizeParams(i)})}var Vs=p("ZodIntersection",(e,r)=>{su.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Qc(e,i,o,t)});function Rs(e,r){return new Vs({type:"intersection",left:e,right:r})}var Fs=p("ZodTuple",(e,r)=>{He(),wn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>es(e,i,o,t)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(r=>new Ar({type:"optional",innerType:r}))})}});function Ms(e,r,i){let o=r instanceof P,t=o?i:r,n=o?r:null;return new Fs({type:"tuple",items:e,rest:n,...$.normalizeParams(t)})}var Ut=p("ZodRecord",(e,r)=>{He(),lu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ts(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType});function Js(e,r,i){return!r||!r._zod?new Ut({type:"record",keyType:Sr(),valueType:e,...$.normalizeParams(r)}):new Ut({type:"record",keyType:e,valueType:r,...$.normalizeParams(i)})}function Mm(e,r,i){return new Ut({type:"record",keyType:e,valueType:r,...$.normalizeParams(i),partial:!0})}function Jm(e,r,i){return new Ut({type:"record",keyType:e,valueType:r,mode:"loose",...$.normalizeParams(i)})}var Bs=p("ZodMap",(e,r)=>{He(),du.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Xc(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType,e.min=(...i)=>e.check(ve(...i)),e.nonempty=i=>e.check(ve(1,i)),e.max=(...i)=>e.check(De(...i)),e.size=(...i)=>e.check(Ke(...i))});function Bm(e,r,i){return new Bs({type:"map",keyType:e,valueType:r,...$.normalizeParams(i)})}var Ks=p("ZodSet",(e,r)=>{He(),fu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>qc(e,i,o,t),e.min=(...i)=>e.check(ve(...i)),e.nonempty=i=>e.check(ve(1,i)),e.max=(...i)=>e.check(De(...i)),e.size=(...i)=>e.check(Ke(...i))});function Km(e,r){return new Ks({type:"set",valueType:e,...$.normalizeParams(r)})}var At=p("ZodEnum",(e,r)=>{mu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(o,t,n)=>Vc(e,o,t,n),e.enum=r.entries,e.options=[...e._zod.values];let i=new Set(Object.keys(r.entries));e.extract=(o,t)=>{let n={};for(let a of o)if(i.has(a))n[a]=r.entries[a];else throw new Error(`Key ${a} not found in enum`);return new At({...r,checks:[],...$.normalizeParams(t),entries:n})},e.exclude=(o,t)=>{let n={...r.entries};for(let a of o)if(i.has(a))delete n[a];else throw new Error(`Key ${a} not found in enum`);return new At({...r,checks:[],...$.normalizeParams(t),entries:n})}});function Mi(e,r){let i=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new At({type:"enum",entries:i,...$.normalizeParams(r)})}function Gm(e,r){return new At({type:"enum",entries:e,...$.normalizeParams(r)})}var Gs=p("ZodLiteral",(e,r)=>{pu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Rc(e,i,o,t),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function Wm(e,r){return new Gs({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(r)})}var Ws=p("ZodFile",(e,r)=>{gu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Jc(e,i,o,t),e.min=(i,o)=>e.check(ve(i,o)),e.max=(i,o)=>e.check(De(i,o)),e.mime=(i,o)=>e.check(It(Array.isArray(i)?i:[i],o))});function Xm(e){return $c(Ws,e)}var Xs=p("ZodTransform",(e,r)=>{He(),vu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Wc(e,i,o,t),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new ze(e.constructor.name);i.addIssue=n=>{if(typeof n=="string")i.issues.push($.issue(n,i.value,r));else{let a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=e),i.issues.push($.issue(a))}};let t=r.transform(i.value,i);return t instanceof Promise?t.then(n=>(i.value=n,i)):(i.value=t,i)}});function Ji(e){return new Xs({type:"transform",transform:e})}var Ar=p("ZodOptional",(e,r)=>{zn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>vi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Ye(e){return new Ar({type:"optional",innerType:e})}var Bi=p("ZodExactOptional",(e,r)=>{$u.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>vi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function qs(e){return new Bi({type:"optional",innerType:e})}var Ys=p("ZodNullable",(e,r)=>{hu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>rs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Pr(e){return new Ys({type:"nullable",innerType:e})}function qm(e){return Ye(Pr(e))}var Hs=p("ZodDefault",(e,r)=>{yu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>os(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Qs(e,r){return new Hs({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var el=p("ZodPrefault",(e,r)=>{_u.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>as(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function tl(e,r){return new el({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var Ki=p("ZodNonOptional",(e,r)=>{bu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ns(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function rl(e,r){return new Ki({type:"nonoptional",innerType:e,...$.normalizeParams(r)})}var nl=p("ZodSuccess",(e,r)=>{ku.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Bc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Ym(e){return new nl({type:"success",innerType:e})}var il=p("ZodCatch",(e,r)=>{xu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>us(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ol(e,r){return new il({type:"catch",innerType:e,catchValue:typeof r=="function"?r:$.constantCatch(r)})}var al=p("ZodNaN",(e,r)=>{Iu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Fc(e,i,o,t)});function Hm(e){return gc(al,e)}var Tr=p("ZodPipe",(e,r)=>{Sn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>cs(e,i,o,t),e.in=r.in,e.out=r.out});function ki(e,r){return new Tr({type:"pipe",in:e,out:r})}var Zr=p("ZodCodec",(e,r)=>{Tr.init(e,r),mr.init(e,r)});function Qm(e,r,i){return new Zr({type:"pipe",in:e,out:r,transform:i.decode,reverseTransform:i.encode})}function ep(e){let r=e._zod.def;return new Zr({type:"pipe",in:r.out,out:r.in,transform:r.reverseTransform,reverseTransform:r.transform})}var ul=p("ZodPreprocess",(e,r)=>{Tr.init(e,r),wu.init(e,r)}),cl=p("ZodReadonly",(e,r)=>{zu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ss(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function sl(e){return new cl({type:"readonly",innerType:e})}var ll=p("ZodTemplateLiteral",(e,r)=>{Su.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Mc(e,i,o,t)});function tp(e,r){return new ll({type:"template_literal",parts:e,...$.normalizeParams(r)})}var dl=p("ZodLazy",(e,r)=>{pr.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ds(e,i,o,t),e.unwrap=()=>e._zod.def.getter()});function fl(e){return new dl({type:"lazy",getter:e})}var ml=p("ZodPromise",(e,r)=>{Du.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ls(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function rp(e){return new ml({type:"promise",innerType:e})}var pl=p("ZodFunction",(e,r)=>{Pu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Gc(e,i,o,t)});function np(e){return new pl({type:"function",input:Array.isArray(e?.input)?Ms(e?.input):e?.input??Or(qe()),output:e?.output??qe()})}var Er=p("ZodCustom",(e,r)=>{ju.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Kc(e,i,o,t)});function ip(e){let r=new L({check:"custom"});return r._zod.check=e,r}function op(e,r){return hc(Er,e??(()=>!0),r)}function gl(e,r={}){return yc(Er,e,r)}function vl(e,r){return _c(e,r)}var ap=bc,up=kc,$l=p("ZodInstanceOf",(e,r)=>{Er.init(e,r)},{properties(e,r){return this.check(xt(e,r))}});function cp(e,r={}){let i=new $l({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.normalizeParams(r)});return i._zod.bag.Class=e,i._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:i,path:[...i._zod.def.path??[]]})},i}var sp=(...e)=>xc({Codec:Zr,Boolean:Et,String:Tt},...e);function lp(e){let r=fl(()=>Lt([Sr(e),Ss(),Ps(),Ns(),Or(r),Js(Sr(),r)]));return r}function dp(e,r){return new ul({type:"pipe",in:Ji(e),out:r})}var kp={};he(kp,{$brand:()=>uo,$input:()=>Au,$output:()=>Uu,INVALID:()=>H,NEVER:()=>ao,TimePrecision:()=>Ku,ZodAny:()=>Us,ZodArray:()=>Es,ZodBase64:()=>Ei,ZodBase64URL:()=>Ci,ZodBigInt:()=>Ct,ZodBigIntFormat:()=>Ri,ZodBoolean:()=>Et,ZodCIDRv4:()=>Ti,ZodCIDRv6:()=>Zi,ZodCUID:()=>Pi,ZodCUID2:()=>Di,ZodCatch:()=>il,ZodCodec:()=>Zr,ZodCompileAsyncError:()=>fe,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>ws,ZodCustom:()=>Er,ZodCustomStringFormat:()=>Qe,ZodDate:()=>jr,ZodDefault:()=>Hs,ZodDiscriminatedUnion:()=>Ls,ZodE164:()=>Li,ZodEmail:()=>Ii,ZodEmoji:()=>zi,ZodEnum:()=>At,ZodError:()=>Mh,ZodExactOptional:()=>Bi,ZodFile:()=>Ws,ZodFirstPartyTypeKind:()=>hl,ZodFunction:()=>pl,ZodGUID:()=>wi,ZodIBAN:()=>zs,ZodIPv4:()=>Ui,ZodIPv6:()=>Ai,ZodISODate:()=>Ae,ZodISODateTime:()=>Ue,ZodISODuration:()=>Ze,ZodISOTime:()=>Te,ZodInstanceOf:()=>$l,ZodIntersection:()=>Vs,ZodIssueCode:()=>Kh,ZodJWT:()=>Vi,ZodKSUID:()=>Ni,ZodLazy:()=>dl,ZodLiteral:()=>Gs,ZodMAC:()=>Is,ZodMap:()=>Bs,ZodNaN:()=>al,ZodNanoID:()=>Si,ZodNever:()=>Ts,ZodNonOptional:()=>Ki,ZodNull:()=>Os,ZodNullable:()=>Ys,ZodNumber:()=>Zt,ZodNumberFormat:()=>et,ZodObject:()=>Nr,ZodOptional:()=>Ar,ZodPipe:()=>Tr,ZodPrefault:()=>el,ZodPreprocess:()=>ul,ZodPromise:()=>ml,ZodReadonly:()=>cl,ZodRealError:()=>oe,ZodRecord:()=>Ut,ZodSet:()=>Ks,ZodString:()=>Tt,ZodStringFormat:()=>C,ZodSuccess:()=>nl,ZodSymbol:()=>Ds,ZodTemplateLiteral:()=>ll,ZodTransform:()=>Xs,ZodTuple:()=>Fs,ZodType:()=>j,ZodULID:()=>ji,ZodURL:()=>Dr,ZodUUID:()=>$e,ZodUndefined:()=>js,ZodUnion:()=>Ur,ZodUnknown:()=>As,ZodVoid:()=>Zs,ZodXID:()=>Oi,ZodXor:()=>Cs,_ZodString:()=>xi,_default:()=>Qs,_function:()=>np,any:()=>Am,array:()=>Or,base64:()=>pm,base64url:()=>gm,bigint:()=>Dm,boolean:()=>Ps,catch:()=>ol,check:()=>ip,cidrv4:()=>fm,cidrv6:()=>mm,clone:()=>T,codec:()=>Qm,coerce:()=>_l,compile:()=>Cu,config:()=>F,core:()=>xe,creditCard:()=>$m,cuid:()=>im,cuid2:()=>om,currencyCode:()=>xm,custom:()=>op,date:()=>Zm,decode:()=>$s,decodeAsync:()=>ys,deepPartial:()=>hp,describe:()=>ap,discriminatedUnion:()=>Fm,e164:()=>vm,email:()=>Wf,emoji:()=>rm,encode:()=>vs,encodeAsync:()=>hs,endsWith:()=>kt,enum:()=>Mi,exactOptional:()=>qs,file:()=>Xm,flattenError:()=>Ht,float32:()=>wm,float64:()=>zm,formatError:()=>Qt,fromJSONSchema:()=>vp,function:()=>np,getDiscriminatedOption:()=>uu,getErrorMap:()=>Wh,globalRegistry:()=>G,gt:()=>ge,gte:()=>ue,guid:()=>Xf,hash:()=>Im,hex:()=>km,hostname:()=>bm,httpUrl:()=>tm,iban:()=>hm,includes:()=>_t,input:()=>_p,instanceof:()=>cp,int:()=>bi,int32:()=>Sm,int64:()=>jm,intersection:()=>Rs,invertCodec:()=>ep,ipv4:()=>sm,ipv6:()=>dm,iso:()=>Cr,json:()=>lp,jwt:()=>ym,keyof:()=>Em,ksuid:()=>cm,lazy:()=>fl,length:()=>We,literal:()=>Wm,locales:()=>yr,looseObject:()=>Vm,looseRecord:()=>Jm,lowercase:()=>ht,lt:()=>pe,lte:()=>ae,mac:()=>lm,map:()=>Bm,maxLength:()=>Ge,maxSize:()=>De,memoizer:()=>$r,meta:()=>up,mime:()=>It,minLength:()=>ke,minSize:()=>ve,multipleOf:()=>Pe,nan:()=>Hm,nanoid:()=>nm,nativeEnum:()=>Gm,negative:()=>li,never:()=>Fi,nonnegative:()=>fi,nonoptional:()=>rl,nonpositive:()=>di,normalize:()=>wt,null:()=>Ns,nullable:()=>Pr,nullish:()=>qm,number:()=>Ss,object:()=>Cm,optional:()=>Ye,output:()=>bp,overwrite:()=>me,parse:()=>fs,parseAsync:()=>ms,partialRecord:()=>Mm,pipe:()=>ki,positive:()=>si,prefault:()=>tl,preprocess:()=>dp,prettifyError:()=>mo,promise:()=>rp,properties:()=>xt,property:()=>mi,readonly:()=>sl,record:()=>Js,refine:()=>gl,regex:()=>$t,regexes:()=>le,registry:()=>Cn,safeDecode:()=>bs,safeDecodeAsync:()=>xs,safeEncode:()=>_s,safeEncodeAsync:()=>ks,safeParse:()=>ps,safeParseAsync:()=>gs,set:()=>Km,setErrorMap:()=>Gh,size:()=>Ke,slugify:()=>Dt,startsWith:()=>bt,strictObject:()=>Lm,string:()=>Sr,stringFormat:()=>_m,stringbool:()=>sp,success:()=>Ym,superRefine:()=>vl,symbol:()=>Nm,templateLiteral:()=>tp,toJSONSchema:()=>$i,toLowerCase:()=>St,toUpperCase:()=>Pt,toZod:()=>Ft,transform:()=>Ji,treeifyError:()=>fo,trim:()=>zt,tuple:()=>Ms,uint32:()=>Pm,uint64:()=>Om,ulid:()=>am,undefined:()=>Um,union:()=>Lt,unknown:()=>qe,uppercase:()=>yt,url:()=>em,util:()=>$,uuid:()=>qf,uuidv4:()=>Yf,uuidv6:()=>Hf,uuidv7:()=>Qf,validate:()=>er,validateAsync:()=>tr,void:()=>Tm,withParser:()=>Ln,xid:()=>um,xor:()=>Rm});var Kh={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Gh(e){F({customError:e})}function Wh(){return F().customError}var hl;hl||(hl={});var Cr={};he(Cr,{ZodISODate:()=>Ae,ZodISODateTime:()=>Ue,ZodISODuration:()=>Ze,ZodISOTime:()=>Te,date:()=>qh,datetime:()=>Xh,duration:()=>Hh,time:()=>Yh});function Xh(e){return br(Ue,e)}function qh(e){return kr(Ae,e)}function Yh(e){return xr(Te,e)}function Hh(e){return Ir(Ze,e)}var x={...Vt,...yi,iso:Cr},Qh=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function ey(e,r){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":r??"draft-2020-12"}function fp(e,r){return e.map((i,o)=>o<r?i:i.optional())}function ty(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function ry(e,r){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let i=e.slice(1).split("/").filter(Boolean);if(i.length===0)return r.rootSchema;let o=r.version==="draft-2020-12"?"$defs":"definitions";if(i[0]===o){let t=i[1]===void 0?void 0:ty(i[1]);if(!t||!r.defs[t])throw new Error(`Reference not found: ${e}`);return r.defs[t]}throw new Error(`Reference not found: ${e}`)}function ny(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(typeof t!="object"||t===null||Array.isArray(t))return;let n=Object.getOwnPropertyNames(t);if(r.minProperties!==void 0&&n.length<r.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:r.minProperties,inclusive:!0,message:`Too small: expected object to have >=${r.minProperties} properties`,input:t,inst:e,continue:!0}),r.maxProperties!==void 0&&n.length>r.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:r.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${r.maxProperties} properties`,input:t,inst:e,continue:!0}),r.keySchema)for(let a of n){let u=r.keySchema.safeParse(a);u.success||o.issues.push({code:"invalid_key",origin:"record",issues:u.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function yl(e,r){if(e===null)return"z";let i=typeof e;if(i!=="object"){if(i==="number"&&Number.isNaN(e))return null;let o=String(e);return`${i[0]}${o.length}:${o}`}if(r.has(e))return null;r.add(e);try{if(Array.isArray(e)){let n=[];for(let a of e){let u=yl(a,r);if(u===null)return null;n.push(u)}return`a${n.length}:[${n.join(",")}]`}let o=Object.keys(e).sort(),t=[];for(let n of o){let a=yl(e[n],r);if(a===null)return null;t.push(`${n.length}:${n}=${a}`)}return`o${t.length}:{${t.join(",")}}`}finally{r.delete(e)}}var iy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),oy=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Lr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Lr):typeof e.$ref=="string"?!0:Object.entries(e).some(([r,i])=>iy.has(r)?Lr(i):!oy.has(r)||typeof i!="object"||i===null?!1:Object.values(i).some(Lr))}function mp(e){return e===1?"element":"elements"}function ay(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(Array.isArray(t)){if(r.uniqueItems===!0){let n=new Map;for(let a=0;a<t.length;a++){let u=yl(t[a],new Set);if(u===null)continue;let s=n.get(u);if(s===void 0){n.set(u,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${s}`,input:t,path:[a],continue:!0})}}if(r.containsSchema){let n=r.minContains??1,a=r.maxContains!==void 0?r.maxContains+1:Number.POSITIVE_INFINITY,u=0;for(let s of t)if(r.containsSchema.safeParse(s).success&&++u>=a)break;u<n&&o.issues.push({code:"custom",message:`Array must contain at least ${n} matching ${mp(n)}; found ${u}`,input:t,continue:!0}),r.maxContains!==void 0&&u>r.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${r.maxContains} matching ${mp(r.maxContains)}`,input:t,continue:!0})}}}).pipe(e)}function pp(e,r){if(e!==!1)return e===void 0||e===!0?x.any():ee(e,r)}var uy=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function gp(e,r){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let t=e.$ref;if(r.refs.has(t))return r.refs.get(t);if(r.processing.has(t))return x.lazy(()=>{if(!r.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return r.refs.get(t)});r.processing.add(t);let n=ry(t,r),a=ee(n,r);return r.refs.set(t,a),r.processing.delete(t),a}if(e.enum!==void 0){let t=e.enum;if(r.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return x.null();if(t.length===0)return x.never();if(t.length===1)return x.literal(t[0]);if(t.every(a=>typeof a=="string"))return x.enum(t);let n=t.map(a=>x.literal(a));return n.length<2?n[0]:x.union([n[0],n[1],...n.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let i=e.type;if(Array.isArray(i)){let t=i.map(n=>{let a={...e,type:n};return gp(a,r)});return t.length===0?x.never():t.length===1?t[0]:x.union(t)}if(!i)return x.any();let o;switch(i){case"string":{let t=x.string();if(e.format){let n=e.format;n==="email"?t=t.check(x.email()):n==="uri"||n==="uri-reference"?t=t.check(x.url()):n==="uuid"||n==="guid"?t=t.check(x.uuid()):n==="date-time"?t=t.check(x.iso.datetime({offset:!0})):n==="date"?t=t.check(x.iso.date()):n==="time"?t=t.check(x.regex(uy)):n==="duration"?t=t.check(x.iso.duration()):n==="hostname"?t=t.check(x.hostname()):n==="ipv4"?t=t.check(x.ipv4()):n==="ipv6"?t=t.check(x.ipv6()):n==="mac"?t=t.check(x.mac()):n==="cidr"?t=t.check(x.cidrv4()):n==="cidr-v6"?t=t.check(x.cidrv6()):n==="base64"?t=t.check(x.base64()):n==="base64url"?t=t.check(x.base64url()):n==="e164"?t=t.check(x.e164()):n==="credit_card"?t=t.check(x.creditCard()):n==="iban"?t=t.check(x.iban()):n==="jwt"?t=t.check(x.jwt()):n==="emoji"?t=t.check(x.emoji()):n==="nanoid"?t=t.check(x.nanoid()):n==="cuid"?t=t.check(x.cuid()):n==="cuid2"?t=t.check(x.cuid2()):n==="ulid"?t=t.check(x.ulid()):n==="xid"?t=t.check(x.xid()):n==="ksuid"&&(t=t.check(x.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),o=t;break}case"number":case"integer":{let t=i==="integer"?x.number().int():x.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),o=t;break}case"boolean":{o=x.boolean();break}case"null":{o=x.null();break}case"object":{let t={},n=e.properties||{},a=new Set(e.required||[]),u=typeof e.additionalProperties=="object"?ee(e.additionalProperties,r):void 0;for(let[d,f]of Object.entries(n)){let m=ee(f,r);K(t,d,a.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),m=[];for(let _ of f){let k=ee(d[_],r),z=x.string().regex(new RegExp(_));m.push(x.looseRecord(z,k))}let v=[];if(Object.keys(t).length>0&&v.push(x.object(t).passthrough()),v.push(...m),v.length===0)o=x.object({}).passthrough();else if(v.length===1)o=v[0];else{let _=x.intersection(v[0],v[1]);for(let k=2;k<v.length;k++)_=x.intersection(_,v[k]);o=_}if(e.additionalProperties===!1){let _=Object.keys(t),k=f.map(I=>new RegExp(I)),z=o;o=o.check(I=>{if(!ce(I.value))return;let D=[];for(let A of Object.keys(I.value))_.includes(A)||k.some(V=>V.test(A))||D.push(A);D.length&&I.issues.push({code:"unrecognized_keys",keys:D,input:I.value,inst:z})})}}else{let d=x.object(t);e.additionalProperties===!1?o=d.strict():u?o=d.catchall(u):o=d.passthrough()}let s=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(s||c!==void 0||l!==void 0){let d;if(s){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=ee(f,r)}o=ny(o,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let t=e.prefixItems,n=e.items;if(t&&Array.isArray(t)){let a=typeof e.minItems=="number"?e.minItems:0,u=t.map(d=>ee(d,r)),s=fp(u,a),c=Array.isArray(n)?void 0:pp(n,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,u=n.map(d=>ee(d,r)),s=fp(u,a),c=pp(e.additionalItems,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(n!==void 0){let a=ee(n,r),u=x.array(a);typeof e.minItems=="number"&&(u=u.min(e.minItems)),typeof e.maxItems=="number"&&(u=u.max(e.maxItems)),o=u}else o=x.array(x.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=ay(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(e.contains,r):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${i}`)}return o}function ee(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i=gp(e,r),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let u=e.anyOf.map(c=>ee(c,r)),s=x.union(u);i=o?x.intersection(i,s):s}if(e.oneOf&&Array.isArray(e.oneOf)){let u=e.oneOf.map(c=>ee(c,r)),s=x.xor(u);i=o?x.intersection(i,s):s}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=o?i:x.any();else{let u=o?i:ee(e.allOf[0],r),s=o?0:1;for(let c=s;c<e.allOf.length;c++)u=x.intersection(u,ee(e.allOf[c],r));i=u}e.nullable===!0&&r.version==="openapi-3.0"&&(i=x.nullable(i)),e.readOnly===!0&&(i=x.readonly(i)),e.default!==void 0&&(i=i.default(e.default));let t={},n=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of n)u in e&&(t[u]=e[u]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let u of a)u in e&&(t[u]=e[u]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Lr(e.propertyNames)&&(t.propertyNames=e.propertyNames);for(let u of["minProperties","maxProperties"])e[u]!==void 0&&(t[u]=e[u])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Lr(e.contains)&&(t.contains=e.contains);for(let u of["uniqueItems","minContains","maxContains"])e[u]!==void 0&&(t[u]=e[u])}for(let u of Object.keys(e))Qh.has(u)||K(t,u,e[u]);return Object.keys(t).length>0&&r.registry.add(i,t),e.description&&(i=i.describe(e.description)),i}function vp(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=ey(i,r?.defaultTarget),t=i.$defs||i.definitions||{},n={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:i,registry:r?.registry??G};return ee(i,n)}var $p=Symbol("z.visit/resolving");function Vr(e,r){let i=typeof r=="function"?r:(a,u)=>{let s=r[a._zod.def.type];return s?s(a,u):a},o=new Map;function t(a){let u=o.get(a);if(u===$p)return new pr({type:"lazy",getter:()=>o.get(a)});if(u!==void 0)return u;o.set(a,$p);let s=n(a),c=i(s,s!==a);return o.set(a,c),c}function n(a){let u=a._zod.def,s=u.type;switch(s){case"object":{let c=u.shape,l=Object.keys(c),d=!1,f={};for(let v of l){let _=t(c[v]);_!==c[v]&&(d=!0),f[v]=_}let m=u.catchall;return u.catchall&&(m=t(u.catchall),m!==u.catchall&&(d=!0)),d?T(a,{...u,shape:f,catchall:m}):a}case"array":{let c=t(u.element);return c===u.element?a:T(a,{...u,element:c})}case"tuple":{let c=u.items,l=!1,d=[];for(let m of c){let v=t(m);v!==m&&(l=!0),d.push(v)}let f=u.rest;return u.rest&&(f=t(u.rest),f!==u.rest&&(l=!0)),l?T(a,{...u,items:d,rest:f}):a}case"record":case"map":{let c=t(u.keyType),l=t(u.valueType);return c===u.keyType&&l===u.valueType?a:T(a,{...u,keyType:c,valueType:l})}case"set":{let c=t(u.valueType);return c===u.valueType?a:T(a,{...u,valueType:c})}case"union":{let c=u.options,l=!1,d=[];for(let f of c){let m=t(f);m!==f&&(l=!0),d.push(m)}return l?T(a,{...u,options:d}):a}case"intersection":{let c=t(u.left),l=t(u.right);return c===u.left&&l===u.right?a:T(a,{...u,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=t(u.innerType);return c===u.innerType?a:T(a,{...u,innerType:c})}case"pipe":{let c=t(u.in),l=t(u.out);return c===u.in&&l===u.out?a:T(a,{...u,in:c,out:l})}case"function":{let c=t(u.input),l=t(u.output);return c===u.input&&l===u.output?a:T(a,{...u,input:c,output:l})}case"lazy":{let c=u.getter,{_cachedInner:l,...d}=u;return T(a,{...d,getter:()=>t(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return a;default:return a}}return t(e)}function hp(e){return Vr(e,{object:r=>r.partial(),union:r=>{let i=r._zod.def;return i.discriminator===void 0?r:Lt(i.options)}})}function cy(e,r){if(!r?.length)return e;let i=e._zod.def;return T(e,de(i,{checks:[...i.checks??[],...r]}),{parent:!0})}function yp(e){return cy(e.out,e.checks)}function sy(e){return e.in._zod.traits.has("$ZodTransform")?yp(e):e.in}function _p(e){return Vr(e,{pipe:r=>sy(r._zod.def),default:(r,i)=>i?Ye(r._zod.def.innerType):r,catch:(r,i)=>i?r._zod.def.innerType:r})}function bp(e){return Vr(e,{pipe:r=>yp(r._zod.def),prefault:(r,i)=>i?r._zod.def.innerType:r})}var _l={};he(_l,{bigint:()=>my,boolean:()=>fy,date:()=>py,number:()=>dy,string:()=>ly});function ly(e){return Fu(Tt,e)}function dy(e){return Wu(Zt,e)}function fy(e){return tc(Et,e)}function my(e){return nc(Ct,e)}function py(e){return pc(jr,e)}export{ao as a,Sr as b,qf as c,em as d,Ss as e,Ps as f,Um as g,Ns as h,qe as i,Fi as j,Or as k,Cm as l,Lm as m,Vm as n,Lt as o,Fm as p,Rs as q,Ms as r,Js as s,Mm as t,Mi as u,Wm as v,op as w,dp as x,Kh as y,Cr as z,kp as A};
|
|
68
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let u=a[1];if(r===a[0]){n(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(r!==a[0]&&c){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(u.cycle){n(a);continue}u.count>1&&e.reused==="ref"&&n(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Uf(e){let r=e.anyOf;if(!Array.isArray(r)||r.length===0||e.type!==void 0)return;let i=[];for(let o of r){if(!o||typeof o!="object")return;Uf(o);let t=Object.keys(o);if(t.length!==1||t[0]!=="type")return;let n=o.type;for(let a of Array.isArray(n)?n:[n]){if(typeof a!="string")return;i.includes(a)||i.push(a)}}delete e.anyOf,e.type=i.length===1?i[0]:i}var Af=new Set(["type","properties","required","additionalProperties"]),Of=["oneOf","anyOf"];function Nf(e){let r=e.additionalProperties;return r===void 0||r===!1||typeof r!="object"||r===null?null:Object.keys(r).length?r:null}function Ic(e){let r=[];for(let n of e){if(typeof n!="object"||n.type!=="object")return null;for(let a in n)if(!Af.has(a))return null;r.push(n)}let i={},o=new Set;for(let n of r){for(let a in n.properties){if(Object.prototype.hasOwnProperty.call(i,a))continue;let u=[];for(let c of r){let l=c.properties?.[a]??Nf(c);l!=null&&(u.some(d=>JSON.stringify(d)===JSON.stringify(l))||u.push(l))}let s=u.length===1?u[0]:Ic(u)??{allOf:u};K(i,a,s)}for(let a of n.required??[])o.add(a)}let t={type:"object",properties:i};if(o.size&&(t.required=[...o]),r.every(n=>n.additionalProperties===!1))t.additionalProperties=!1;else{let n=[];for(let a of r){let u=Nf(a);u&&!n.some(s=>JSON.stringify(s)===JSON.stringify(u))&&n.push(u)}n.length===1?t.additionalProperties=n[0]:n.length>1&&(t.additionalProperties={allOf:n})}return t}function Eh(e){let r=e.allOf;if(!Array.isArray(r)||r.length<2)return;for(let t of Af)if(t in e)return;let i=r.filter(t=>Of.some(n=>Array.isArray(t[n]))),o=null;if(!i.length)o=Ic(r);else{let t=i[0],n=Of.find(s=>Array.isArray(t[s]));if(Object.keys(t).length!==1)return;let a=r.filter(s=>s!==t),u=t[n].map(s=>Ic([...a,s]));if(u.some(s=>!s))return;o={[n]:u}}o&&(delete e.allOf,wr(e,o))}function Ne(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=u=>{let s=e.seen.get(u);if(s.ref===null)return;let c=s.def??s.schema,l={...c},d=s.ref;if(s.ref=null,d){o(d);let m=e.seen.get(d),v=m.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(v)):wr(c,v),wr(c,l),u._zod.parent===d)for(let k in c)k==="$ref"||k==="allOf"||k in l||delete c[k];if(v.$ref&&m.def)for(let k in c)k==="$ref"||k==="allOf"||k in m.def&&JSON.stringify(c[k])===JSON.stringify(m.def[k])&&delete c[k]}let f=u._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let v in c)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(c[v])===JSON.stringify(m.def[v])&&delete c[v]}e.override({zodSchema:u,jsonSchema:c,path:s.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let u of[...e.seen.entries()].reverse())o(u[0]);if(e.target!=="openapi-3.0")for(let u of e.seen.entries())Uf(u[1].def??u[1].schema);for(let u of e.deferred)u();if(e.intersections.length){let u=new Map;for(let s of e.seen.values())for(let c of[s.schema,s.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=u.get(l);d?d.push(c):u.set(l,[c])}for(let s of e.intersections)for(let c of u.get(s)??[])Eh(c)}}let t={};if(e.target==="draft-2020-12"?t.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?t.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?t.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let u=e.external.registry.get(r)?.id;if(!u)throw new Error("Schema is missing an `id` property");t.$id=e.external.uri(u)}wr(t,i.defId?i.schema:i.def??i.schema);let n=e.metadataRegistry.get(r)?.id;n!==void 0&&t.id===n&&delete t.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let u of e.seen.entries()){let s=u[1];s.def&&s.defId&&(s.def.id===s.defId&&delete s.def.id,K(a,s.defId,s.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?t.$defs=a:t.definitions=a);try{let u=JSON.parse(JSON.stringify(t));return Object.defineProperty(u,"~standard",{value:{...r["~standard"],jsonSchema:{input:jt(r,"input",e.processors),output:jt(r,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Q(e,r){let i=r??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Q(o.element,i);if(o.type==="set")return Q(o.valueType,i);if(o.type==="lazy")return Q(o.getter(),i);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return Q(o.innerType,i);if(o.type==="intersection")return Q(o.left,i)||Q(o.right,i);if(o.type==="record"||o.type==="map")return Q(o.keyType,i)||Q(o.valueType,i);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(o.in,i)||Q(o.out,i);if(o.type==="object"){for(let t in o.shape)if(Q(o.shape[t],i))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(Q(t,i))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(Q(t,i))return!0;return!!(o.rest&&Q(o.rest,i))}return!1}var wc=(e,r={})=>i=>{let o=je({...i,processors:r});return E(e,o),Oe(o,e),Ne(o,e)},jt=(e,r,i={})=>o=>{let{libraryOptions:t,target:n}=o??{},a=je({...t??{},target:n,io:r,processors:i});return E(e,a),Oe(a,e),Ne(a,e)};var Ot=(e,r,i)=>{(e[r]===void 0||i>e[r])&&(e[r]=i)},Nt=(e,r,i)=>{(e[r]===void 0||i<e[r])&&(e[r]=i)},Tf=(e,r)=>{Ot(e,"minimum",r),Nt(e,"maximum",r)},Lf=(e,r)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(r)||e.multipleOf.push(r)},Vf=(e,r)=>{e.patterns??(e.patterns=new Set),e.patterns.add(r)},Rf=(e,r)=>{e.mime=e.mime?e.mime.filter(i=>r.includes(i)):[...r]},Ff=(e,r)=>{e.format=r,r.includes("int")&&(e.isInt=!0)},Zf=(e,r)=>Ot(e,"minimum",r.minimum),Ef=(e,r)=>Nt(e,"maximum",r.maximum),Cf=e=>(r,i)=>{Ff(r,i.format);let[o,t]=e[i.format];Ot(r,"minimum",o),Nt(r,"maximum",t)},Ch={greater_than:(e,r)=>Ot(e,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(e,r)=>Nt(e,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(e,r)=>Lf(e,r.value),number_format:Cf(Kt),bigint_format:Cf(Gt),min_length:Zf,max_length:Ef,length_equals:(e,r)=>Tf(e,r.length),min_size:Zf,max_size:Ef,size_equals:(e,r)=>Tf(e,r.size),string_format:(e,r)=>{Ff(e,r.format),r.pattern&&Vf(e,r.pattern),(r.format==="base64"||r.format==="base64url")&&(e.contentEncoding=r.format),(r.local||r.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,r)=>Rf(e,r.mime)};function J(e){let r={},i=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(let n of o)Ch[n._zod.def.check]?.(r,n._zod.def);let t=e._zod.bag;t.minimum!==void 0&&Ot(r,"minimum",t.minimum),t.exclusiveMinimum!==void 0&&Ot(r,"exclusiveMinimum",t.exclusiveMinimum),t.maximum!==void 0&&Nt(r,"maximum",t.maximum),t.exclusiveMaximum!==void 0&&Nt(r,"exclusiveMaximum",t.exclusiveMaximum),t.multipleOf!==void 0&&Lf(r,t.multipleOf),t.format!==void 0&&(r.format??(r.format=t.format),t.format.includes("int")&&(r.isInt=!0)),t.mime&&Rf(r,t.mime);for(let n of t.patterns??[])Vf(r,n);return r}var Lh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Vh=new Map([[hn,Oo],[lr,No]]),Mf=e=>Vh.get(e)??e,Pc=(e,r,i,o)=>{let t=i;t.type="string";let{minimum:n,maximum:a,format:u,patterns:s,contentEncoding:c,laxFormat:l}=J(e);if(typeof n=="number"&&(t.minLength=n),typeof a=="number"&&(t.maxLength=a),u&&(t.format=Lh[u]??u,t.format===""&&delete t.format,(u==="time"||l)&&delete t.format),c&&(t.contentEncoding=c),s&&s.size>0){let d=[...s].map(Mf);d.length===1?t.pattern=d[0].source:d.length>1&&(t.allOf=[...d.map(f=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Dc=(e,r,i,o)=>{let t=i,{minimum:n,maximum:a,multipleOf:u,exclusiveMaximum:s,exclusiveMinimum:c,isInt:l}=J(e);t.type=l?"integer":"number";let d=typeof c=="number"&&c>=(n??Number.NEGATIVE_INFINITY),f=typeof s=="number"&&s<=(a??Number.POSITIVE_INFINITY),m=r.target==="draft-04"||r.target==="openapi-3.0";if(d?m?(t.minimum=c,t.exclusiveMinimum=!0):t.exclusiveMinimum=c:typeof n=="number"&&(t.minimum=n),f?m?(t.maximum=s,t.exclusiveMaximum=!0):t.exclusiveMaximum=s:typeof a=="number"&&(t.maximum=a),u){let v=new Set;for(let z of u)Number.isFinite(z)&&z!==0?v.add(Math.abs(z)):M(e,r,t,o,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[_,...k]=v;_!==void 0&&(t.multipleOf=_),k.length&&(t.allOf=[...t.allOf??[],...k.map(z=>({multipleOf:z}))])}},jc=(e,r,i,o)=>{i.type="boolean"},Oc=(e,r,i,o)=>{M(e,r,i,o,"BigInt cannot be represented in JSON Schema")},Nc=(e,r,i,o)=>{M(e,r,i,o,"Symbols cannot be represented in JSON Schema")},Uc=(e,r,i,o)=>{r.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Ac=(e,r,i,o)=>{M(e,r,i,o,"Undefined cannot be represented in JSON Schema")},Tc=(e,r,i,o)=>{M(e,r,i,o,"Void cannot be represented in JSON Schema")},Zc=(e,r,i,o)=>{i.not={}},Ec=(e,r,i,o)=>{},Cc=(e,r,i,o)=>{},Lc=(e,r,i,o)=>{M(e,r,i,o,"Date cannot be represented in JSON Schema")},Vc=(e,r,i,o)=>{let t=e._zod.def,n=rt(t.entries);if(n.length===0){i.not={};return}n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),i.enum=n},Rc=(e,r,i,o)=>{let t=e._zod.def;if(t.values.length===0){i.not={};return}let n=[];for(let a of t.values)if(a===void 0){if(M(e,r,i,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(M(e,r,i,o,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(a))}else n.push(a);if(n.length!==0)if(n.length===1){let a=n[0];i.type=a===null?"null":typeof a,r.target==="draft-04"||r.target==="openapi-3.0"?i.enum=[a]:i.const=a}else n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),n.every(a=>typeof a=="boolean")&&(i.type="boolean"),n.every(a=>a===null)&&(i.type="null"),i.enum=n},Fc=(e,r,i,o)=>{M(e,r,i,o,"NaN cannot be represented in JSON Schema")},Mc=(e,r,i,o)=>{let t=i,n=e._zod.pattern;if(!n)throw new Error("Pattern not found in template literal");t.type="string",t.pattern=n.source},Jc=(e,r,i,o)=>{let t=i;t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:n,maximum:a,mime:u}=J(e);n!==void 0&&(t.minLength=n),a!==void 0&&(t.maxLength=a),u&&(u.length===0?t.not={}:u.length===1?t.contentMediaType=u[0]:t.anyOf=u.map(s=>({contentMediaType:s})))},Bc=(e,r,i,o)=>{i.type="boolean"},Kc=(e,r,i,o)=>{M(e,r,i,o,"Custom types cannot be represented in JSON Schema")},Gc=(e,r,i,o)=>{M(e,r,i,o,"Function types cannot be represented in JSON Schema")},Wc=(e,r,i,o)=>{M(e,r,i,o,"Transforms cannot be represented in JSON Schema")},Xc=(e,r,i,o)=>{M(e,r,i,o,"Map cannot be represented in JSON Schema")},qc=(e,r,i,o)=>{M(e,r,i,o,"Set cannot be represented in JSON Schema")},Yc=(e,r,i,o)=>{let t=i,n=e._zod.def,{minimum:a,maximum:u}=J(e);typeof a=="number"&&(t.minItems=a),typeof u=="number"&&(t.maxItems=u),t.type="array",t.items=E(n.element,r,{...o,path:[...o.path,"items"]})};function zr(e){let r=e._zod.def;return r.type==="pipe"&&r.in._zod.traits.has("$ZodTransform")?zr(r.out):r.type==="catch"?zr(r.innerType):e._zod.optin}var Hc=(e,r,i,o)=>{let t=i,n=e._zod.def,a=n.shape;if(Object.getOwnPropertySymbols(a).length&&M(e,r,t,o,"Symbol keys cannot be represented in JSON Schema"))return;t.type="object",t.properties={};for(let c in a)K(t.properties,c,E(a[c],r,{...o,path:[...o.path,"properties",c]}));let s=[];for(let c of Object.keys(a)){let l=n.shape[c];(r.io==="input"?zr(l)===void 0:l._zod.optout===void 0)&&s.push(c)}s.length>0&&(t.required=s),n.catchall?._zod.def.type==="never"?t.additionalProperties=!1:n.catchall?n.catchall&&(t.additionalProperties=E(n.catchall,r,{...o,path:[...o.path,"additionalProperties"]})):r.io==="output"&&(t.additionalProperties=!1)},gi=(e,r,i,o)=>{let t=e._zod.def,n=t.inclusive===!1,a=t.options.map((u,s)=>E(u,r,{...o,path:[...o.path,n?"oneOf":"anyOf",s]}));n?i.oneOf=a:i.anyOf=a},Qc=(e,r,i,o)=>{let t=e._zod.def,n=E(t.left,r,{...o,path:[...o.path,"allOf",0]}),a=E(t.right,r,{...o,path:[...o.path,"allOf",1]}),u=c=>"allOf"in c&&Object.keys(c).length===1,s=[...u(n)?n.allOf:[n],...u(a)?a.allOf:[a]];i.allOf=s,r.intersections.push(s)},es=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="array";let a=r.target==="draft-2020-12"?"prefixItems":"items",u=r.target==="draft-2020-12"||r.target==="openapi-3.0"?"items":"additionalItems",s=n.items.map((_,k)=>E(_,r,{...o,path:[...o.path,a,k]})),c=n.rest?E(n.rest,r,{...o,path:[...o.path,u,...r.target==="openapi-3.0"?[n.items.length]:[]]}):null,l=n.items.length;for(;l>0;){let _=n.items[l-1];if(!(r.io==="input"?zr(_)!==void 0:_._zod.optout==="optional"))break;l--}let d=n.items.length,f=!n.rest;r.target==="draft-2020-12"?(t.prefixItems=s,f?t.items=!1:c&&(t.items=c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):r.target==="openapi-3.0"?(t.items={anyOf:s},c&&t.items.anyOf.push(c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):(t.items=s,f?t.additionalItems=!1:c&&(t.additionalItems=c),l>0&&(t.minItems=l),f&&(t.maxItems=d));let{minimum:m,maximum:v}=J(e);typeof m=="number"&&(t.minItems=m),typeof v=="number"&&(t.maxItems=v)};function zc(e,r,i){if(r.$ref){if(i.has(r))return r;i.add(r);let v=e.get(r)?.def;if(!v)return r;let _=zc(e,v,i);return _===v?r:_}for(let v of["anyOf","oneOf"]){let _=r[v];if(!Array.isArray(_))continue;let k=_.map(z=>zc(e,z,i));k.some((z,I)=>z!==_[I])&&(r={...r,[v]:k})}let o=Array.isArray(r.type)?r.type:[r.type],t=!o.includes("string")&&o.some(v=>v==="number"||v==="integer"),n=r.enum??(r.const!==void 0?[r.const]:void 0);if(!t&&!n?.some(v=>typeof v=="number"))return r;let{minimum:a,maximum:u,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,format:d,id:f,...m}=r;return m.enum?m.enum=m.enum.map(v=>typeof v=="number"?String(v):v):typeof m.const=="number"&&(m.const=String(m.const)),t&&(m.type="string",n||(m.pattern=(o.includes("number")?be:nr).source)),m}var Sc=new WeakMap;function Rh(e){let r=new Map;for(let o of e.seen.values())o.def&&!r.has(o.schema)&&r.set(o.schema,o);let i=new Map;for(let o of Sc.get(e)??[]){let t=e.seen.get(o),n=(t?.def??t?.schema)?.propertyNames;if(!n||n===!0||i.has(n))continue;let a=zc(r,n,new Set);a!==n&&i.set(n,a)}if(i.size)for(let o of e.seen.values())for(let t of[o.schema,o.def]){let n=t&&i.get(t.propertyNames);n&&(t.propertyNames=n)}}var ts=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="object";let a=n.keyType,u=J(a).patterns;if(n.mode==="loose"&&u&&u.size>0){let l=E(n.valueType,r,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let d of u)K(t.patternProperties,Mf(d).source,l)}else{if(r.target==="draft-07"||r.target==="draft-2020-12"){t.propertyNames=E(n.keyType,r,{...o,path:[...o.path,"propertyNames"]});let l=Sc.get(r);l||(l=[],Sc.set(r,l),r.deferred.push(()=>Rh(r))),l.push(e)}t.additionalProperties=E(n.valueType,r,{...o,path:[...o.path,"additionalProperties"]})}let s=a._zod.values,c=r.io==="input"&&zr(n.valueType)!==void 0;if(s&&!n.partial&&!c){let l=[...s].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(t.required=l.map(String))}},rs=(e,r,i,o)=>{let t=e._zod.def,n=E(t.innerType,r,o),a=r.seen.get(e);r.target==="openapi-3.0"?(a.ref=t.innerType,i.nullable=!0):i.anyOf=[n,{type:"null"}]},ns=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},is=Symbol();function Jf(e,r,i,o,t){let n=!1,a=JSON.stringify(e,(u,s)=>typeof s!="bigint"?s:(n=!0,null));return n?(M(r,i,o,t,"BigInt defaults cannot be represented in JSON Schema"),is):JSON.parse(a)}var os=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a=Jf(t.defaultValue,e,r,i,o);a!==is&&(i.default=a)},as=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);if(n.ref=t.innerType,r.io!=="input")return;let a=Jf(t.defaultValue,e,r,i,o);a!==is&&(i._prefault=a)},us=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a;try{a=t.catchValue(void 0)}catch{M(e,r,i,o,"Dynamic catch values are not supported in JSON Schema");return}i.default=a},cs=(e,r,i,o)=>{let t=e._zod.def,n=t.in._zod.traits.has("$ZodTransform"),a=r.io==="input"?n?t.out:t.in:t.out;E(a,r,o);let u=r.seen.get(e);u.ref=a},ss=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType,i.readOnly=!0},ls=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},vi=(e,r,i,o)=>{let t=e._zod.def;E(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},ds=(e,r,i,o)=>{let t=e._zod.innerType;E(t,r,o);let n=r.seen.get(e);n.ref=t},pi={string:Pc,number:Dc,boolean:jc,bigint:Oc,symbol:Nc,null:Uc,undefined:Ac,void:Tc,never:Zc,any:Ec,unknown:Cc,date:Lc,enum:Vc,literal:Rc,nan:Fc,template_literal:Mc,file:Jc,success:Bc,custom:Kc,function:Gc,transform:Wc,map:Xc,set:qc,array:Yc,object:Hc,union:gi,intersection:Qc,tuple:es,record:ts,nullable:rs,nonoptional:ns,default:os,prefault:as,catch:us,pipe:cs,readonly:ss,promise:ls,optional:vi,lazy:ds};function $i(e,r){if("_idmap"in e){let o=e,t=je({...r,processors:pi}),n={};for(let s of o._idmap.entries()){let[c,l]=s;E(l,t)}let a={},u={registry:o,uri:r?.uri,defs:n};t.external=u;for(let s of o._idmap.entries()){let[c,l]=s;Oe(t,l),K(a,c,Ne(t,l))}if(Object.keys(n).length>0){let s=t.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:n}}return{schemas:a}}let i=je({...r,processors:pi});return E(e,i),Oe(i,e),Ne(i,e)}var hi=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(r){this.ctx.counter=r}get seen(){return this.ctx.seen}constructor(r){let i=r?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=je({processors:pi,target:i,...r?.metadata&&{metadata:r.metadata},...r?.unrepresentable&&{unrepresentable:r.unrepresentable},...r?.override&&{override:r.override},...r?.io&&{io:r.io}})}process(r,i={path:[],schemaPath:[]}){return E(r,this.ctx,i)}emit(r,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Oe(this.ctx,r);let o=Ne(this.ctx,r),{"~standard":t,...n}=o;return n}};var Bf={};var yi={};he(yi,{endsWith:()=>kt,gt:()=>ge,gte:()=>ue,includes:()=>_t,length:()=>We,lowercase:()=>ht,lt:()=>pe,lte:()=>ae,maxLength:()=>Ge,maxSize:()=>De,mime:()=>It,minLength:()=>ke,minSize:()=>ve,multipleOf:()=>Pe,negative:()=>li,nonnegative:()=>fi,nonpositive:()=>di,normalize:()=>wt,overwrite:()=>me,positive:()=>si,properties:()=>xt,property:()=>mi,regex:()=>$t,size:()=>Ke,slugify:()=>Dt,startsWith:()=>bt,toLowerCase:()=>St,toUpperCase:()=>Pt,trim:()=>zt,uppercase:()=>yt});var Kf=new WeakSet([Object.prototype,Error.prototype]);function _i(e,r,i){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,get(){let o=i(this);return Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0})}})}var Gf=(e,r)=>{lo.init(e,r),e.name="ZodError";let i=Object.getPrototypeOf(e);Kf.has(i)||(Kf.add(i),_i(i,"format",o=>t=>Qt(o,t)),_i(i,"flatten",o=>t=>Ht(o,t)),_i(i,"addIssue",o=>t=>{o.issues.push(t),o.message=JSON.stringify(o.issues,nt,2)}),_i(i,"addIssues",o=>t=>{o.issues.push(...t),o.message=JSON.stringify(o.issues,nt,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Mh=p("ZodError",Gf),oe=p("ZodError",Gf,void 0,{Parent:Error});var fs=ct(oe),ms=st(oe),ps=lt(oe),gs=dt(oe),vs=Wr(oe),$s=Xr(oe),hs=qr(oe),ys=Yr(oe),_s=Hr(oe),bs=Qr(oe),ks=en(oe),xs=tn(oe);function Bh(){B.localeError||F(An())}function He(){B.memoizer||F({memoizer:$r()})}var j=p("ZodType",(e,r)=>(Bh(),P.init(e,r),e.def=r,e.type=r.type,e),{check(...e){let r=this.def;return this.clone($.mergeDefs(r,{checks:[...r.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,r){return T(this,e,r)},brand(){return this},register(e,r){return e.add(this,r),this},refine(e,r){return this.check(gl(e,r))},superRefine(e,r){return this.check(vl(e,r))},overwrite(e){return this.check(me(e))},optional(){return Ye(this)},exactOptional(){return qs(this)},nullable(){return Pr(this)},nullish(){return Ye(Pr(this))},nonoptional(e){return rl(this,e)},array(){return Or(this)},or(e){return Lt([this,e])},and(e){return Rs(this,e)},transform(e){return ki(this,Ji(e))},default(e){return Qs(this,e)},prefault(e){return tl(this,e)},catch(e){return ol(this,e)},pipe(e){return ki(this,e)},readonly(){return sl(this)},describe(e){let r=this.clone();return G.add(r,{description:e}),r},meta(...e){if(e.length===0)return G.get(this);let r=this.clone();return G.add(r,e[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...r){return r.length===0?e(this):e(this,...r)},get"~standard"(){return $.hide(this,"~standard",{...mn(this),jsonSchema:{input:jt(this,"input"),output:jt(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(r,i){return fs(this,r,i,{callee:e})},parseAsync:async function e(r,i){return await ms(this,r,i,{callee:e})},safeParse(e,r){return ps(this,e,r)},async safeParseAsync(e,r){return gs(this,e,r)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,r){return er(this,e,r)},validateAsync(e,r){return tr(this,e,r)},encode:function e(r,i){return vs(this,r,i,{callee:e})},decode:function e(r,i){return $s(this,r,i,{callee:e})},encodeAsync:async function e(r,i){return await hs(this,r,i,{callee:e})},decodeAsync:async function e(r,i){return await ys(this,r,i,{callee:e})},safeEncode(e,r){return _s(this,e,r)},safeDecode(e,r){return bs(this,e,r)},async safeEncodeAsync(e,r){return ks(this,e,r)},async safeDecodeAsync(e,r){return xs(this,e,r)},toJSONSchema(e){return wc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),xi=p("_ZodString",(e,r)=>{Fe.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Pc(e,i,o,t)},$.derived({format:e=>J(e).format??null,minLength:e=>J(e).minimum??null,maxLength:e=>J(e).maximum??null},{regex(...e){return this.check($t(...e))},includes(...e){return this.check(_t(...e))},startsWith(...e){return this.check(bt(...e))},endsWith(...e){return this.check(kt(...e))},min(...e){return this.check(ke(...e))},max(...e){return this.check(Ge(...e))},length(...e){return this.check(We(...e))},nonempty(...e){return this.check(ke(1,...e))},lowercase(e){return this.check(ht(e))},uppercase(e){return this.check(yt(e))},trim(){return this.check(zt())},normalize(...e){return this.check(wt(...e))},toLowerCase(){return this.check(St())},toUpperCase(){return this.check(Pt())},slugify(){return this.check(Dt())}})),Tt=p("ZodString",(e,r)=>{Fe.init(e,r),xi.init(e,r)},{email(e){return this.check(Fn(Ii,e))},url(e){return this.check(_r(Dr,e))},jwt(e){return this.check(ci(Vi,e))},emoji(e){return this.check(Wn(zi,e))},guid(e){return this.check(Mn(wi,e))},uuid(e){return this.check(Jn($e,e))},uuidv4(e){return this.check(Bn($e,e))},uuidv6(e){return this.check(Kn($e,e))},uuidv7(e){return this.check(Gn($e,e))},nanoid(e){return this.check(Xn(Si,e))},cuid(e){return this.check(qn(Pi,e))},cuid2(e){return this.check(Yn(Di,e))},ulid(e){return this.check(Hn(ji,e))},base64(e){return this.check(oi(Ei,e))},base64url(e){return this.check(ai(Ci,e))},xid(e){return this.check(Qn(Oi,e))},ksuid(e){return this.check(ei(Ni,e))},ipv4(e){return this.check(ti(Ui,e))},ipv6(e){return this.check(ri(Ai,e))},cidrv4(e){return this.check(ni(Ti,e))},cidrv6(e){return this.check(ii(Zi,e))},e164(e){return this.check(ui(Li,e))},datetime(e){return this.check(br(Ue,e))},date(e){return this.check(kr(Ae,e))},time(e){return this.check(xr(Te,e))},duration(e){return this.check(Ir(Ze,e))}});function Sr(e){return Ru(Tt,e)}var C=p("ZodStringFormat",(e,r)=>{Z.init(e,r),xi.init(e,r)}),Ue=p("ZodISODateTime",(e,r)=>{Oa.init(e,r),C.init(e,r)}),Ae=p("ZodISODate",(e,r)=>{Na.init(e,r),C.init(e,r)}),Te=p("ZodISOTime",(e,r)=>{Ua.init(e,r),C.init(e,r)}),Ze=p("ZodISODuration",(e,r)=>{Aa.init(e,r),C.init(e,r)}),Ii=p("ZodEmail",(e,r)=>{_a.init(e,r),C.init(e,r)});function Wf(e){return Fn(Ii,e)}var wi=p("ZodGUID",(e,r)=>{ha.init(e,r),C.init(e,r)});function Xf(e){return Mn(wi,e)}var $e=p("ZodUUID",(e,r)=>{ya.init(e,r),C.init(e,r)});function qf(e){return Jn($e,e)}function Yf(e){return Bn($e,e)}function Hf(e){return Kn($e,e)}function Qf(e){return Gn($e,e)}var Dr=p("ZodURL",(e,r)=>{xa.init(e,r),C.init(e,r)});function em(e){return _r(Dr,e)}function tm(e){return _r(Dr,{protocol:rr,hostname:Ao,...$.normalizeParams(e)})}var zi=p("ZodEmoji",(e,r)=>{Ia.init(e,r),C.init(e,r)});function rm(e){return Wn(zi,e)}var Si=p("ZodNanoID",(e,r)=>{wa.init(e,r),C.init(e,r)});function nm(e){return Xn(Si,e)}var Pi=p("ZodCUID",(e,r)=>{za.init(e,r),C.init(e,r)});function im(e){return qn(Pi,e)}var Di=p("ZodCUID2",(e,r)=>{Sa.init(e,r),C.init(e,r)});function om(e){return Yn(Di,e)}var ji=p("ZodULID",(e,r)=>{Pa.init(e,r),C.init(e,r)});function am(e){return Hn(ji,e)}var Oi=p("ZodXID",(e,r)=>{Da.init(e,r),C.init(e,r)});function um(e){return Qn(Oi,e)}var Ni=p("ZodKSUID",(e,r)=>{ja.init(e,r),C.init(e,r)});function cm(e){return ei(Ni,e)}var Ui=p("ZodIPv4",(e,r)=>{Ta.init(e,r),C.init(e,r)});function sm(e){return ti(Ui,e)}var Is=p("ZodMAC",(e,r)=>{Ea.init(e,r),C.init(e,r)});function lm(e){return Mu(Is,e)}var Ai=p("ZodIPv6",(e,r)=>{Za.init(e,r),C.init(e,r)});function dm(e){return ri(Ai,e)}var Ti=p("ZodCIDRv4",(e,r)=>{Ca.init(e,r),C.init(e,r)});function fm(e){return ni(Ti,e)}var Zi=p("ZodCIDRv6",(e,r)=>{La.init(e,r),C.init(e,r)});function mm(e){return ii(Zi,e)}var Ei=p("ZodBase64",(e,r)=>{Va.init(e,r),C.init(e,r)});function pm(e){return oi(Ei,e)}var Ci=p("ZodBase64URL",(e,r)=>{Ra.init(e,r),C.init(e,r)});function gm(e){return ai(Ci,e)}var Li=p("ZodE164",(e,r)=>{Fa.init(e,r),C.init(e,r)});function vm(e){return ui(Li,e)}var ws=p("ZodCreditCard",(e,r)=>{Ma.init(e,r),C.init(e,r)});function $m(e){return Ju(ws,e)}var zs=p("ZodIBAN",(e,r)=>{Ja.init(e,r),C.init(e,r)});function hm(e){return Bu(zs,e)}var Vi=p("ZodJWT",(e,r)=>{Ba.init(e,r),C.init(e,r)});function ym(e){return ci(Vi,e)}var Qe=p("ZodCustomStringFormat",(e,r)=>{Ka.init(e,r),C.init(e,r)});function _m(e,r,i={}){return Xe(Qe,e,r,i)}function bm(e){return Xe(Qe,"hostname",Uo,e)}function km(e){return Xe(Qe,"hex",Wo,e)}function xm(e){return Xe(Qe,"currency_code",Zo,e)}function Im(e,r){let i=r?.enc??"hex",o=`${e}_${i}`,t=le[o];if(!t)throw new Error(`Unrecognized hash format: ${o}`);return Xe(Qe,o,t,r)}var Zt=p("ZodNumber",(e,r)=>{xn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Dc(e,i,o,t),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:r,exclusiveMinimum:i}=J(e);return Math.max(r??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:r,exclusiveMaximum:i}=J(e);return Math.min(r??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:r,multipleOf:i}=J(e);return!!r||!!i?.some(Number.isSafeInteger)},format:e=>J(e).format??null},{gt(e,r){return this.check(ge(e,r))},gte(e,r){return this.check(ue(e,r))},min(e,r){return this.check(ue(e,r))},lt(e,r){return this.check(pe(e,r))},lte(e,r){return this.check(ae(e,r))},max(e,r){return this.check(ae(e,r))},int(e){return this.check(bi(e))},safe(e){return this.check(bi(e))},positive(e){return this.check(ge(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(pe(0,e))},nonpositive(e){return this.check(ae(0,e))},multipleOf(e,r){return this.check(Pe(e,r))},step(e,r){return this.check(Pe(e,r))},finite(){return this}}));function Ss(e){return Gu(Zt,e)}var et=p("ZodNumberFormat",(e,r)=>{Ga.init(e,r),Zt.init(e,r)});function bi(e){return Xu(et,e)}function wm(e){return qu(et,e)}function zm(e){return Yu(et,e)}function Sm(e){return Hu(et,e)}function Pm(e){return Qu(et,e)}var Et=p("ZodBoolean",(e,r)=>{dr.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>jc(e,i,o,t)});function Ps(e){return ec(Et,e)}var Ct=p("ZodBigInt",(e,r)=>{In.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Oc(e,i,o,t)},$.derived({minValue:e=>J(e).minimum??null,maxValue:e=>J(e).maximum??null,format:e=>J(e).format??null},{gte(e,r){return this.check(ue(e,r))},min(e,r){return this.check(ue(e,r))},gt(e,r){return this.check(ge(e,r))},lt(e,r){return this.check(pe(e,r))},lte(e,r){return this.check(ae(e,r))},max(e,r){return this.check(ae(e,r))},positive(e){return this.check(ge(BigInt(0),e))},negative(e){return this.check(pe(BigInt(0),e))},nonpositive(e){return this.check(ae(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,r){return this.check(Pe(e,r))}}));function Dm(e){return rc(Ct,e)}var Ri=p("ZodBigIntFormat",(e,r)=>{Wa.init(e,r),Ct.init(e,r)});function jm(e){return ic(Ri,e)}function Om(e){return oc(Ri,e)}var Ds=p("ZodSymbol",(e,r)=>{Xa.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Nc(e,i,o,t)});function Nm(e){return ac(Ds,e)}var js=p("ZodUndefined",(e,r)=>{qa.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Ac(e,i,o,t)});function Um(e){return uc(js,e)}var Os=p("ZodNull",(e,r)=>{Ya.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Uc(e,i,o,t)});function Ns(e){return cc(Os,e)}var Us=p("ZodAny",(e,r)=>{Ha.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Ec(e,i,o,t)});function Am(){return sc(Us)}var As=p("ZodUnknown",(e,r)=>{Qa.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Cc(e,i,o,t)});function qe(){return lc(As)}var Ts=p("ZodNever",(e,r)=>{eu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Zc(e,i,o,t)});function Fi(e){return dc(Ts,e)}var Zs=p("ZodVoid",(e,r)=>{tu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Tc(e,i,o,t)});function Tm(e){return fc(Zs,e)}var jr=p("ZodDate",(e,r)=>{ru.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Lc(e,i,o,t),e.min=(i,o)=>e.check(ue(i,o)),e.max=(i,o)=>e.check(ae(i,o))},$.derived({minDate:e=>{let{minimum:r}=J(e);return r?new Date(r):null},maxDate:e=>{let{maximum:r}=J(e);return r?new Date(r):null}},{}));function Zm(e){return mc(jr,e)}var Es=p("ZodArray",(e,r)=>{He(),iu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Yc(e,i,o,t),e.element=r.element},{min(e,r){return this.check(ke(e,r))},nonempty(e){return this.check(ke(1,e))},max(e,r){return this.check(Ge(e,r))},length(e,r){return this.check(We(e,r))},unwrap(){return this.element}});function Or(e,r){return vc(Es,e,r)}function Em(e){let r=e._zod.def.shape;return Mi(Object.keys(r))}var Nr=p("ZodObject",(e,r)=>{He(),ou.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Hc(e,i,o,t),$.installLazyProp(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return Mi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:qe()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:qe()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:Fi()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(Ar,this,e[0])},exactPartial(...e){return $.partial(Bi,this,e[0],"exactPartial")},required(...e){return $.required(Ki,this,e[0])}});function Cm(e,r){let i={type:"object",shape:e??{},...$.normalizeParams(r)};return new Nr(i)}function Lm(e,r){return new Nr({type:"object",shape:e,catchall:Fi(),...$.normalizeParams(r)})}function Vm(e,r){return new Nr({type:"object",shape:e,catchall:qe(),...$.normalizeParams(r)})}var Ur=p("ZodUnion",(e,r)=>{fr.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>gi(e,i,o,t),e.options=r.options});function Lt(e,r){return new Ur({type:"union",options:e,...$.normalizeParams(r)})}var Cs=p("ZodXor",(e,r)=>{Ur.init(e,r),au.init(e,r),e._zod.processJSONSchema=(i,o,t)=>gi(e,i,o,t),e.options=r.options});function Rm(e,r){return new Cs({type:"union",options:e,inclusive:!1,...$.normalizeParams(r)})}var Ls=p("ZodDiscriminatedUnion",(e,r)=>{Ur.init(e,r),cu.init(e,r)});function Fm(e,r,i){return new Ls({type:"union",options:r,discriminator:e,...$.normalizeParams(i)})}var Vs=p("ZodIntersection",(e,r)=>{su.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Qc(e,i,o,t)});function Rs(e,r){return new Vs({type:"intersection",left:e,right:r})}var Fs=p("ZodTuple",(e,r)=>{He(),wn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>es(e,i,o,t)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(r=>new Ar({type:"optional",innerType:r}))})}});function Ms(e,r,i){let o=r instanceof P,t=o?i:r,n=o?r:null;return new Fs({type:"tuple",items:e,rest:n,...$.normalizeParams(t)})}var Ut=p("ZodRecord",(e,r)=>{He(),lu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ts(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType});function Js(e,r,i){return!r||!r._zod?new Ut({type:"record",keyType:Sr(),valueType:e,...$.normalizeParams(r)}):new Ut({type:"record",keyType:e,valueType:r,...$.normalizeParams(i)})}function Mm(e,r,i){return new Ut({type:"record",keyType:e,valueType:r,...$.normalizeParams(i),partial:!0})}function Jm(e,r,i){return new Ut({type:"record",keyType:e,valueType:r,mode:"loose",...$.normalizeParams(i)})}var Bs=p("ZodMap",(e,r)=>{He(),du.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Xc(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType,e.min=(...i)=>e.check(ve(...i)),e.nonempty=i=>e.check(ve(1,i)),e.max=(...i)=>e.check(De(...i)),e.size=(...i)=>e.check(Ke(...i))});function Bm(e,r,i){return new Bs({type:"map",keyType:e,valueType:r,...$.normalizeParams(i)})}var Ks=p("ZodSet",(e,r)=>{He(),fu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>qc(e,i,o,t),e.min=(...i)=>e.check(ve(...i)),e.nonempty=i=>e.check(ve(1,i)),e.max=(...i)=>e.check(De(...i)),e.size=(...i)=>e.check(Ke(...i))});function Km(e,r){return new Ks({type:"set",valueType:e,...$.normalizeParams(r)})}var At=p("ZodEnum",(e,r)=>{mu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(o,t,n)=>Vc(e,o,t,n),e.enum=r.entries,e.options=[...e._zod.values];let i=new Set(Object.keys(r.entries));e.extract=(o,t)=>{let n={};for(let a of o)if(i.has(a))n[a]=r.entries[a];else throw new Error(`Key ${a} not found in enum`);return new At({...r,checks:[],...$.normalizeParams(t),entries:n})},e.exclude=(o,t)=>{let n={...r.entries};for(let a of o)if(i.has(a))delete n[a];else throw new Error(`Key ${a} not found in enum`);return new At({...r,checks:[],...$.normalizeParams(t),entries:n})}});function Mi(e,r){let i=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new At({type:"enum",entries:i,...$.normalizeParams(r)})}function Gm(e,r){return new At({type:"enum",entries:e,...$.normalizeParams(r)})}var Gs=p("ZodLiteral",(e,r)=>{pu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Rc(e,i,o,t),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function Wm(e,r){return new Gs({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(r)})}var Ws=p("ZodFile",(e,r)=>{gu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Jc(e,i,o,t),e.min=(i,o)=>e.check(ve(i,o)),e.max=(i,o)=>e.check(De(i,o)),e.mime=(i,o)=>e.check(It(Array.isArray(i)?i:[i],o))});function Xm(e){return $c(Ws,e)}var Xs=p("ZodTransform",(e,r)=>{He(),vu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Wc(e,i,o,t),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new ze(e.constructor.name);i.addIssue=n=>{if(typeof n=="string")i.issues.push($.issue(n,i.value,r));else{let a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=e),i.issues.push($.issue(a))}};let t=r.transform(i.value,i);return t instanceof Promise?t.then(n=>(i.value=n,i)):(i.value=t,i)}});function Ji(e){return new Xs({type:"transform",transform:e})}var Ar=p("ZodOptional",(e,r)=>{zn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>vi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Ye(e){return new Ar({type:"optional",innerType:e})}var Bi=p("ZodExactOptional",(e,r)=>{$u.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>vi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function qs(e){return new Bi({type:"optional",innerType:e})}var Ys=p("ZodNullable",(e,r)=>{hu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>rs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Pr(e){return new Ys({type:"nullable",innerType:e})}function qm(e){return Ye(Pr(e))}var Hs=p("ZodDefault",(e,r)=>{yu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>os(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Qs(e,r){return new Hs({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var el=p("ZodPrefault",(e,r)=>{_u.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>as(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function tl(e,r){return new el({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var Ki=p("ZodNonOptional",(e,r)=>{bu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ns(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function rl(e,r){return new Ki({type:"nonoptional",innerType:e,...$.normalizeParams(r)})}var nl=p("ZodSuccess",(e,r)=>{ku.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Bc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Ym(e){return new nl({type:"success",innerType:e})}var il=p("ZodCatch",(e,r)=>{xu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>us(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ol(e,r){return new il({type:"catch",innerType:e,catchValue:typeof r=="function"?r:$.constantCatch(r)})}var al=p("ZodNaN",(e,r)=>{Iu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Fc(e,i,o,t)});function Hm(e){return gc(al,e)}var Tr=p("ZodPipe",(e,r)=>{Sn.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>cs(e,i,o,t),e.in=r.in,e.out=r.out});function ki(e,r){return new Tr({type:"pipe",in:e,out:r})}var Zr=p("ZodCodec",(e,r)=>{Tr.init(e,r),mr.init(e,r)});function Qm(e,r,i){return new Zr({type:"pipe",in:e,out:r,transform:i.decode,reverseTransform:i.encode})}function ep(e){let r=e._zod.def;return new Zr({type:"pipe",in:r.out,out:r.in,transform:r.reverseTransform,reverseTransform:r.transform})}var ul=p("ZodPreprocess",(e,r)=>{Tr.init(e,r),wu.init(e,r)}),cl=p("ZodReadonly",(e,r)=>{zu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ss(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function sl(e){return new cl({type:"readonly",innerType:e})}var ll=p("ZodTemplateLiteral",(e,r)=>{Su.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Mc(e,i,o,t)});function tp(e,r){return new ll({type:"template_literal",parts:e,...$.normalizeParams(r)})}var dl=p("ZodLazy",(e,r)=>{pr.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ds(e,i,o,t),e.unwrap=()=>e._zod.def.getter()});function fl(e){return new dl({type:"lazy",getter:e})}var ml=p("ZodPromise",(e,r)=>{Du.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ls(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function rp(e){return new ml({type:"promise",innerType:e})}var pl=p("ZodFunction",(e,r)=>{Pu.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Gc(e,i,o,t)});function np(e){return new pl({type:"function",input:Array.isArray(e?.input)?Ms(e?.input):e?.input??Or(qe()),output:e?.output??qe()})}var Er=p("ZodCustom",(e,r)=>{ju.init(e,r),j.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Kc(e,i,o,t)});function ip(e){let r=new L({check:"custom"});return r._zod.check=e,r}function op(e,r){return hc(Er,e??(()=>!0),r)}function gl(e,r={}){return yc(Er,e,r)}function vl(e,r){return _c(e,r)}var ap=bc,up=kc,$l=p("ZodInstanceOf",(e,r)=>{Er.init(e,r)},{properties(e,r){return this.check(xt(e,r))}});function cp(e,r={}){let i=new $l({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.normalizeParams(r)});return i._zod.bag.Class=e,i._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:i,path:[...i._zod.def.path??[]]})},i}var sp=(...e)=>xc({Codec:Zr,Boolean:Et,String:Tt},...e);function lp(e){let r=fl(()=>Lt([Sr(e),Ss(),Ps(),Ns(),Or(r),Js(Sr(),r)]));return r}function dp(e,r){return new ul({type:"pipe",in:Ji(e),out:r})}var Cr={};he(Cr,{ZodISODate:()=>Ae,ZodISODateTime:()=>Ue,ZodISODuration:()=>Ze,ZodISOTime:()=>Te,date:()=>Gh,datetime:()=>Kh,duration:()=>Xh,time:()=>Wh});function Kh(e){return br(Ue,e)}function Gh(e){return kr(Ae,e)}function Wh(e){return xr(Te,e)}function Xh(e){return Ir(Ze,e)}var kp={};he(kp,{$brand:()=>uo,$input:()=>Au,$output:()=>Uu,INVALID:()=>H,NEVER:()=>ao,TimePrecision:()=>Ku,ZodAny:()=>Us,ZodArray:()=>Es,ZodBase64:()=>Ei,ZodBase64URL:()=>Ci,ZodBigInt:()=>Ct,ZodBigIntFormat:()=>Ri,ZodBoolean:()=>Et,ZodCIDRv4:()=>Ti,ZodCIDRv6:()=>Zi,ZodCUID:()=>Pi,ZodCUID2:()=>Di,ZodCatch:()=>il,ZodCodec:()=>Zr,ZodCompileAsyncError:()=>fe,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>ws,ZodCustom:()=>Er,ZodCustomStringFormat:()=>Qe,ZodDate:()=>jr,ZodDefault:()=>Hs,ZodDiscriminatedUnion:()=>Ls,ZodE164:()=>Li,ZodEmail:()=>Ii,ZodEmoji:()=>zi,ZodEnum:()=>At,ZodError:()=>Mh,ZodExactOptional:()=>Bi,ZodFile:()=>Ws,ZodFirstPartyTypeKind:()=>hl,ZodFunction:()=>pl,ZodGUID:()=>wi,ZodIBAN:()=>zs,ZodIPv4:()=>Ui,ZodIPv6:()=>Ai,ZodISODate:()=>Ae,ZodISODateTime:()=>Ue,ZodISODuration:()=>Ze,ZodISOTime:()=>Te,ZodInstanceOf:()=>$l,ZodIntersection:()=>Vs,ZodIssueCode:()=>qh,ZodJWT:()=>Vi,ZodKSUID:()=>Ni,ZodLazy:()=>dl,ZodLiteral:()=>Gs,ZodMAC:()=>Is,ZodMap:()=>Bs,ZodNaN:()=>al,ZodNanoID:()=>Si,ZodNever:()=>Ts,ZodNonOptional:()=>Ki,ZodNull:()=>Os,ZodNullable:()=>Ys,ZodNumber:()=>Zt,ZodNumberFormat:()=>et,ZodObject:()=>Nr,ZodOptional:()=>Ar,ZodPipe:()=>Tr,ZodPrefault:()=>el,ZodPreprocess:()=>ul,ZodPromise:()=>ml,ZodReadonly:()=>cl,ZodRealError:()=>oe,ZodRecord:()=>Ut,ZodSet:()=>Ks,ZodString:()=>Tt,ZodStringFormat:()=>C,ZodSuccess:()=>nl,ZodSymbol:()=>Ds,ZodTemplateLiteral:()=>ll,ZodTransform:()=>Xs,ZodTuple:()=>Fs,ZodType:()=>j,ZodULID:()=>ji,ZodURL:()=>Dr,ZodUUID:()=>$e,ZodUndefined:()=>js,ZodUnion:()=>Ur,ZodUnknown:()=>As,ZodVoid:()=>Zs,ZodXID:()=>Oi,ZodXor:()=>Cs,_ZodString:()=>xi,_default:()=>Qs,_function:()=>np,any:()=>Am,array:()=>Or,base64:()=>pm,base64url:()=>gm,bigint:()=>Dm,boolean:()=>Ps,catch:()=>ol,check:()=>ip,cidrv4:()=>fm,cidrv6:()=>mm,clone:()=>T,codec:()=>Qm,coerce:()=>_l,compile:()=>Cu,config:()=>F,core:()=>xe,creditCard:()=>$m,cuid:()=>im,cuid2:()=>om,currencyCode:()=>xm,custom:()=>op,date:()=>Zm,decode:()=>$s,decodeAsync:()=>ys,deepPartial:()=>hp,describe:()=>ap,discriminatedUnion:()=>Fm,e164:()=>vm,email:()=>Wf,emoji:()=>rm,encode:()=>vs,encodeAsync:()=>hs,endsWith:()=>kt,enum:()=>Mi,exactOptional:()=>qs,file:()=>Xm,flattenError:()=>Ht,float32:()=>wm,float64:()=>zm,formatError:()=>Qt,fromJSONSchema:()=>vp,function:()=>np,getDiscriminatedOption:()=>uu,getErrorMap:()=>Hh,globalRegistry:()=>G,gt:()=>ge,gte:()=>ue,guid:()=>Xf,hash:()=>Im,hex:()=>km,hostname:()=>bm,httpUrl:()=>tm,iban:()=>hm,includes:()=>_t,input:()=>_p,instanceof:()=>cp,int:()=>bi,int32:()=>Sm,int64:()=>jm,intersection:()=>Rs,invertCodec:()=>ep,ipv4:()=>sm,ipv6:()=>dm,iso:()=>Cr,json:()=>lp,jwt:()=>ym,keyof:()=>Em,ksuid:()=>cm,lazy:()=>fl,length:()=>We,literal:()=>Wm,locales:()=>yr,looseObject:()=>Vm,looseRecord:()=>Jm,lowercase:()=>ht,lt:()=>pe,lte:()=>ae,mac:()=>lm,map:()=>Bm,maxLength:()=>Ge,maxSize:()=>De,memoizer:()=>$r,meta:()=>up,mime:()=>It,minLength:()=>ke,minSize:()=>ve,multipleOf:()=>Pe,nan:()=>Hm,nanoid:()=>nm,nativeEnum:()=>Gm,negative:()=>li,never:()=>Fi,nonnegative:()=>fi,nonoptional:()=>rl,nonpositive:()=>di,normalize:()=>wt,null:()=>Ns,nullable:()=>Pr,nullish:()=>qm,number:()=>Ss,object:()=>Cm,optional:()=>Ye,output:()=>bp,overwrite:()=>me,parse:()=>fs,parseAsync:()=>ms,partialRecord:()=>Mm,pipe:()=>ki,positive:()=>si,prefault:()=>tl,preprocess:()=>dp,prettifyError:()=>mo,promise:()=>rp,properties:()=>xt,property:()=>mi,readonly:()=>sl,record:()=>Js,refine:()=>gl,regex:()=>$t,regexes:()=>le,registry:()=>Cn,safeDecode:()=>bs,safeDecodeAsync:()=>xs,safeEncode:()=>_s,safeEncodeAsync:()=>ks,safeParse:()=>ps,safeParseAsync:()=>gs,set:()=>Km,setErrorMap:()=>Yh,size:()=>Ke,slugify:()=>Dt,startsWith:()=>bt,strictObject:()=>Lm,string:()=>Sr,stringFormat:()=>_m,stringbool:()=>sp,success:()=>Ym,superRefine:()=>vl,symbol:()=>Nm,templateLiteral:()=>tp,toJSONSchema:()=>$i,toLowerCase:()=>St,toUpperCase:()=>Pt,toZod:()=>Ft,transform:()=>Ji,treeifyError:()=>fo,trim:()=>zt,tuple:()=>Ms,uint32:()=>Pm,uint64:()=>Om,ulid:()=>am,undefined:()=>Um,union:()=>Lt,unknown:()=>qe,uppercase:()=>yt,url:()=>em,util:()=>$,uuid:()=>qf,uuidv4:()=>Yf,uuidv6:()=>Hf,uuidv7:()=>Qf,validate:()=>er,validateAsync:()=>tr,void:()=>Tm,withParser:()=>Ln,xid:()=>um,xor:()=>Rm});var qh={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Yh(e){F({customError:e})}function Hh(){return F().customError}var hl;hl||(hl={});var x={...Vt,...yi,iso:Cr},Qh=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function ey(e,r){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":r??"draft-2020-12"}function fp(e,r){return e.map((i,o)=>o<r?i:i.optional())}function ty(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function ry(e,r){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let i=e.slice(1).split("/").filter(Boolean);if(i.length===0)return r.rootSchema;let o=r.version==="draft-2020-12"?"$defs":"definitions";if(i[0]===o){let t=i[1]===void 0?void 0:ty(i[1]);if(!t||!r.defs[t])throw new Error(`Reference not found: ${e}`);return r.defs[t]}throw new Error(`Reference not found: ${e}`)}function ny(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(typeof t!="object"||t===null||Array.isArray(t))return;let n=Object.getOwnPropertyNames(t);if(r.minProperties!==void 0&&n.length<r.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:r.minProperties,inclusive:!0,message:`Too small: expected object to have >=${r.minProperties} properties`,input:t,inst:e,continue:!0}),r.maxProperties!==void 0&&n.length>r.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:r.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${r.maxProperties} properties`,input:t,inst:e,continue:!0}),r.keySchema)for(let a of n){let u=r.keySchema.safeParse(a);u.success||o.issues.push({code:"invalid_key",origin:"record",issues:u.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function yl(e,r){if(e===null)return"z";let i=typeof e;if(i!=="object"){if(i==="number"&&Number.isNaN(e))return null;let o=String(e);return`${i[0]}${o.length}:${o}`}if(r.has(e))return null;r.add(e);try{if(Array.isArray(e)){let n=[];for(let a of e){let u=yl(a,r);if(u===null)return null;n.push(u)}return`a${n.length}:[${n.join(",")}]`}let o=Object.keys(e).sort(),t=[];for(let n of o){let a=yl(e[n],r);if(a===null)return null;t.push(`${n.length}:${n}=${a}`)}return`o${t.length}:{${t.join(",")}}`}finally{r.delete(e)}}var iy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),oy=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Lr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Lr):typeof e.$ref=="string"?!0:Object.entries(e).some(([r,i])=>iy.has(r)?Lr(i):!oy.has(r)||typeof i!="object"||i===null?!1:Object.values(i).some(Lr))}function mp(e){return e===1?"element":"elements"}function ay(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(Array.isArray(t)){if(r.uniqueItems===!0){let n=new Map;for(let a=0;a<t.length;a++){let u=yl(t[a],new Set);if(u===null)continue;let s=n.get(u);if(s===void 0){n.set(u,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${s}`,input:t,path:[a],continue:!0})}}if(r.containsSchema){let n=r.minContains??1,a=r.maxContains!==void 0?r.maxContains+1:Number.POSITIVE_INFINITY,u=0;for(let s of t)if(r.containsSchema.safeParse(s).success&&++u>=a)break;u<n&&o.issues.push({code:"custom",message:`Array must contain at least ${n} matching ${mp(n)}; found ${u}`,input:t,continue:!0}),r.maxContains!==void 0&&u>r.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${r.maxContains} matching ${mp(r.maxContains)}`,input:t,continue:!0})}}}).pipe(e)}function pp(e,r){if(e!==!1)return e===void 0||e===!0?x.any():ee(e,r)}var uy=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function gp(e,r){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let t=e.$ref;if(r.refs.has(t))return r.refs.get(t);if(r.processing.has(t))return x.lazy(()=>{if(!r.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return r.refs.get(t)});r.processing.add(t);let n=ry(t,r),a=ee(n,r);return r.refs.set(t,a),r.processing.delete(t),a}if(e.enum!==void 0){let t=e.enum;if(r.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return x.null();if(t.length===0)return x.never();if(t.length===1)return x.literal(t[0]);if(t.every(a=>typeof a=="string"))return x.enum(t);let n=t.map(a=>x.literal(a));return n.length<2?n[0]:x.union([n[0],n[1],...n.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let i=e.type;if(Array.isArray(i)){let t=i.map(n=>{let a={...e,type:n};return gp(a,r)});return t.length===0?x.never():t.length===1?t[0]:x.union(t)}if(!i)return x.any();let o;switch(i){case"string":{let t=x.string();if(e.format){let n=e.format;n==="email"?t=t.check(x.email()):n==="uri"||n==="uri-reference"?t=t.check(x.url()):n==="uuid"||n==="guid"?t=t.check(x.uuid()):n==="date-time"?t=t.check(x.iso.datetime({offset:!0})):n==="date"?t=t.check(x.iso.date()):n==="time"?t=t.check(x.regex(uy)):n==="duration"?t=t.check(x.iso.duration()):n==="hostname"?t=t.check(x.hostname()):n==="ipv4"?t=t.check(x.ipv4()):n==="ipv6"?t=t.check(x.ipv6()):n==="mac"?t=t.check(x.mac()):n==="cidr"?t=t.check(x.cidrv4()):n==="cidr-v6"?t=t.check(x.cidrv6()):n==="base64"?t=t.check(x.base64()):n==="base64url"?t=t.check(x.base64url()):n==="e164"?t=t.check(x.e164()):n==="credit_card"?t=t.check(x.creditCard()):n==="iban"?t=t.check(x.iban()):n==="jwt"?t=t.check(x.jwt()):n==="emoji"?t=t.check(x.emoji()):n==="nanoid"?t=t.check(x.nanoid()):n==="cuid"?t=t.check(x.cuid()):n==="cuid2"?t=t.check(x.cuid2()):n==="ulid"?t=t.check(x.ulid()):n==="xid"?t=t.check(x.xid()):n==="ksuid"&&(t=t.check(x.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),o=t;break}case"number":case"integer":{let t=i==="integer"?x.number().int():x.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),o=t;break}case"boolean":{o=x.boolean();break}case"null":{o=x.null();break}case"object":{let t={},n=e.properties||{},a=new Set(e.required||[]),u=typeof e.additionalProperties=="object"?ee(e.additionalProperties,r):void 0;for(let[d,f]of Object.entries(n)){let m=ee(f,r);K(t,d,a.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),m=[];for(let _ of f){let k=ee(d[_],r),z=x.string().regex(new RegExp(_));m.push(x.looseRecord(z,k))}let v=[];if(Object.keys(t).length>0&&v.push(x.object(t).passthrough()),v.push(...m),v.length===0)o=x.object({}).passthrough();else if(v.length===1)o=v[0];else{let _=x.intersection(v[0],v[1]);for(let k=2;k<v.length;k++)_=x.intersection(_,v[k]);o=_}if(e.additionalProperties===!1){let _=Object.keys(t),k=f.map(I=>new RegExp(I)),z=o;o=o.check(I=>{if(!ce(I.value))return;let D=[];for(let A of Object.keys(I.value))_.includes(A)||k.some(V=>V.test(A))||D.push(A);D.length&&I.issues.push({code:"unrecognized_keys",keys:D,input:I.value,inst:z})})}}else{let d=x.object(t);e.additionalProperties===!1?o=d.strict():u?o=d.catchall(u):o=d.passthrough()}let s=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(s||c!==void 0||l!==void 0){let d;if(s){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=ee(f,r)}o=ny(o,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let t=e.prefixItems,n=e.items;if(t&&Array.isArray(t)){let a=typeof e.minItems=="number"?e.minItems:0,u=t.map(d=>ee(d,r)),s=fp(u,a),c=Array.isArray(n)?void 0:pp(n,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,u=n.map(d=>ee(d,r)),s=fp(u,a),c=pp(e.additionalItems,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(n!==void 0){let a=ee(n,r),u=x.array(a);typeof e.minItems=="number"&&(u=u.min(e.minItems)),typeof e.maxItems=="number"&&(u=u.max(e.maxItems)),o=u}else o=x.array(x.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=ay(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(e.contains,r):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${i}`)}return o}function ee(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i=gp(e,r),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let u=e.anyOf.map(c=>ee(c,r)),s=x.union(u);i=o?x.intersection(i,s):s}if(e.oneOf&&Array.isArray(e.oneOf)){let u=e.oneOf.map(c=>ee(c,r)),s=x.xor(u);i=o?x.intersection(i,s):s}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=o?i:x.any();else{let u=o?i:ee(e.allOf[0],r),s=o?0:1;for(let c=s;c<e.allOf.length;c++)u=x.intersection(u,ee(e.allOf[c],r));i=u}e.nullable===!0&&r.version==="openapi-3.0"&&(i=x.nullable(i)),e.readOnly===!0&&(i=x.readonly(i)),e.default!==void 0&&(i=i.default(e.default));let t={},n=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of n)u in e&&(t[u]=e[u]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let u of a)u in e&&(t[u]=e[u]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Lr(e.propertyNames)&&(t.propertyNames=e.propertyNames);for(let u of["minProperties","maxProperties"])e[u]!==void 0&&(t[u]=e[u])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Lr(e.contains)&&(t.contains=e.contains);for(let u of["uniqueItems","minContains","maxContains"])e[u]!==void 0&&(t[u]=e[u])}for(let u of Object.keys(e))Qh.has(u)||K(t,u,e[u]);return Object.keys(t).length>0&&r.registry.add(i,t),e.description&&(i=i.describe(e.description)),i}function vp(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=ey(i,r?.defaultTarget),t=i.$defs||i.definitions||{},n={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:i,registry:r?.registry??G};return ee(i,n)}var $p=Symbol("z.visit/resolving");function Vr(e,r){let i=typeof r=="function"?r:(a,u)=>{let s=r[a._zod.def.type];return s?s(a,u):a},o=new Map;function t(a){let u=o.get(a);if(u===$p)return new pr({type:"lazy",getter:()=>o.get(a)});if(u!==void 0)return u;o.set(a,$p);let s=n(a),c=i(s,s!==a);return o.set(a,c),c}function n(a){let u=a._zod.def,s=u.type;switch(s){case"object":{let c=u.shape,l=Object.keys(c),d=!1,f={};for(let v of l){let _=t(c[v]);_!==c[v]&&(d=!0),f[v]=_}let m=u.catchall;return u.catchall&&(m=t(u.catchall),m!==u.catchall&&(d=!0)),d?T(a,{...u,shape:f,catchall:m}):a}case"array":{let c=t(u.element);return c===u.element?a:T(a,{...u,element:c})}case"tuple":{let c=u.items,l=!1,d=[];for(let m of c){let v=t(m);v!==m&&(l=!0),d.push(v)}let f=u.rest;return u.rest&&(f=t(u.rest),f!==u.rest&&(l=!0)),l?T(a,{...u,items:d,rest:f}):a}case"record":case"map":{let c=t(u.keyType),l=t(u.valueType);return c===u.keyType&&l===u.valueType?a:T(a,{...u,keyType:c,valueType:l})}case"set":{let c=t(u.valueType);return c===u.valueType?a:T(a,{...u,valueType:c})}case"union":{let c=u.options,l=!1,d=[];for(let f of c){let m=t(f);m!==f&&(l=!0),d.push(m)}return l?T(a,{...u,options:d}):a}case"intersection":{let c=t(u.left),l=t(u.right);return c===u.left&&l===u.right?a:T(a,{...u,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=t(u.innerType);return c===u.innerType?a:T(a,{...u,innerType:c})}case"pipe":{let c=t(u.in),l=t(u.out);return c===u.in&&l===u.out?a:T(a,{...u,in:c,out:l})}case"function":{let c=t(u.input),l=t(u.output);return c===u.input&&l===u.output?a:T(a,{...u,input:c,output:l})}case"lazy":{let c=u.getter,{_cachedInner:l,...d}=u;return T(a,{...d,getter:()=>t(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return a;default:return a}}return t(e)}function hp(e){return Vr(e,{object:r=>r.partial(),union:r=>{let i=r._zod.def;return i.discriminator===void 0?r:Lt(i.options)}})}function cy(e,r){if(!r?.length)return e;let i=e._zod.def;return T(e,de(i,{checks:[...i.checks??[],...r]}),{parent:!0})}function yp(e){return cy(e.out,e.checks)}function sy(e){return e.in._zod.traits.has("$ZodTransform")?yp(e):e.in}function _p(e){return Vr(e,{pipe:r=>sy(r._zod.def),default:(r,i)=>i?Ye(r._zod.def.innerType):r,catch:(r,i)=>i?r._zod.def.innerType:r})}function bp(e){return Vr(e,{pipe:r=>yp(r._zod.def),prefault:(r,i)=>i?r._zod.def.innerType:r})}var _l={};he(_l,{bigint:()=>my,boolean:()=>fy,date:()=>py,number:()=>dy,string:()=>ly});function ly(e){return Fu(Tt,e)}function dy(e){return Wu(Zt,e)}function fy(e){return tc(Et,e)}function my(e){return nc(Ct,e)}function py(e){return pc(jr,e)}export{ao as a,Sr as b,qf as c,em as d,Ss as e,Ps as f,Um as g,Ns as h,qe as i,Fi as j,Or as k,Cm as l,Lm as m,Vm as n,Lt as o,Fm as p,Rs as q,Ms as r,Js as s,Mm as t,Mi as u,Wm as v,op as w,dp as x,qh as y,Cr as z,kp as A};
|
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{a as c}from"./chunk-
|
|
7
|
+
import{a as c}from"./chunk-FSZTXLNW.mjs";import{Nd as a,Od as b}from"./chunk-DPYTG6DM.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{c as ConditionalRouter,a as conditionDefect,b as evaluateCondition};
|
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{m as a,n as b,o as c,p as d,q as e,r as f,s as g}from"./chunk-
|
|
7
|
+
import{m as a,n as b,o as c,p as d,q as e,r as f,s as g}from"./chunk-DHGPDSXS.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-UIUPPEFB.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-ZUA5BNAO.mjs";import"./chunk-RKALOKAU.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-55LQD3Y3.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-3B5H24ZG.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-DPYTG6DM.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as DataSync,f as MAX_RESULT_REFUSALS_PER_OBJECT,g as buildObjectResult,d as linkedRecordOf,c as notReachedOf,b as unsetOf,e as withCurrencies};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{l as a,m as b,n as c,o as d,p as e,q as f}from"./chunk-4L7FBOJS.mjs";import"./chunk-OXKZ4Y3B.mjs";import"./chunk-MAHZMPMZ.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-UIUPPEFB.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-SW2NUKQL.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-E2YJVSX6.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-CULAOP3U.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-KRNFVAGC.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-55LQD3Y3.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-3B5H24ZG.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-EAFLDSQ2.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-DPYTG6DM.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as WHOLE_ORG_MAX_NODES,b as WHOLE_ORG_MAX_PAIRS,f as discoverWholeOrg,d as eachInPool,e as recordCountsOf,c as refusedByTheOrg};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{a as P}from"./chunk-ICIYL45C.mjs";import{d as J}from"./chunk-ZUA5BNAO.mjs";import{d as Z}from"./chunk-HFSBDM7B.mjs";import{c as H,g as Y}from"./chunk-OHEOJISY.mjs";import{a as F}from"./chunk-EADHKH3A.mjs";import{g as W,t as Q}from"./chunk-55LQD3Y3.mjs";import{a as U,f as D,h as k}from"./chunk-TZE3Y7IQ.mjs";import{O as z,Q as B,T as V,vc as R}from"./chunk-DPYTG6DM.mjs";import{b as I,k as G,l as A,v as K,z as _}from"./chunk-WZQEK4WT.mjs";function Le(e){let n=new Set;for(let t of e)t.controllerName&&n.add(t.controllerName);return n}function X(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0}function je(e,n){let t=X(e.precision),r=typeof e.scale=="number"&&e.scale>=0?e.scale:void 0,o=X(e.digits),s=(e.picklistValues??[]).filter(d=>d!==null&&typeof d.value=="string"),i={};if(e.controllerName)for(let d of s)d.active===!1||typeof d.validFor!="string"||(i[d.value]=d.validFor);return{...t!==void 0?{precision:t}:{},...t!==void 0&&r!==void 0?{scale:r}:{},...o!==void 0?{digits:o}:{},...e.unique===!0?{unique:!0}:{},...e.unique===!0&&typeof e.caseSensitive=="boolean"?{caseSensitive:e.caseSensitive}:{},...e.calculated===!0?{calculated:!0}:{},...e.filteredLookupInfo?{filteredLookup:!0}:{},...Object.keys(i).length>0?{validFor:i}:{},...n.has(e.name)&&s.length>0?{controllingValues:s.map(d=>d.value)}:{}}}function Ce(e,n){return e.caseSensitive===!1?n.toLowerCase():n}function M(e,n){if(n<0)return!1;let r=Buffer.from(e,"base64")[n>>3];return r!==void 0&&(r&128>>n%8)!==0}var ie={picklist_value_refused:["map_value","leave_empty","skip_rows","exclude_object","ignore"],dependent_value_invalid:["map_value","leave_empty","exclude_object","ignore"],picklist_value_absent:["map_value","skip_rows","ignore"],required_field_missing:["set_default","exclude_object","ignore"],value_too_long:["truncate","exclude_object","ignore"],number_out_of_range:["exclude_object","ignore"],record_type_unmapped:["map_record_type","exclude_object","ignore"],record_type_unavailable:["map_record_type","exclude_object","ignore"],currency_inactive:["map_value","skip_rows","exclude_object","ignore"],unique_value_collision:["exclude_object","ignore"]};function w(e){return[...ie[e]??["ignore"]]}var se=100,ae=new Set(["longest","colliding"]),O=class{gaps=new Map;recordTypes=new Map;get size(){return this.gaps.size}knowRecordTypes(n,t,r){let o=de(r);o!==void 0&&this.recordTypes.set(n,{...this.recordTypes.get(n),[t]:o})}add(n){let t=z(n.kind,n.objectApiName,n.field,n.recordType,n.value),r=this.gaps.get(t);if(!r){this.gaps.set(t,{...n,id:t,source:"simulation",decisions:[...n.decisions]});return}r.rows+=n.rows,n.decisions.includes("skip_rows")||(r.decisions=r.decisions.filter(s=>s!=="skip_rows"));let o={...n.detail??{},...r.detail??{}};for(let s of ae){let i=r.detail?.[s],d=n.detail?.[s];typeof i=="number"&&typeof d=="number"&&(o[s]=Math.max(i,d))}r.detail=o}list(n){let t=[...this.gaps.keys()],r=[...this.gaps.values()].map(o=>this.withSameDeveloperName(o)).map(o=>B(n,o,t)!==void 0?{...o,detail:{...o.detail??{},ignored:!0}}:o);return V(r)}withSameDeveloperName(n){let t=n.kind==="record_type_unmapped";return le(n,this.recordTypes.get(n.objectApiName)?.[t?"source":"target"])}};function de(e){let n=e.filter(t=>!t.master);if(!n.some(t=>t.namespacePrefix===void 0))return n.map(Z)}function le(e,n){let t=e.kind==="record_type_unmapped"?e.value:e.recordType;if(t===void 0||n===void 0)return e;let r=Y(t);if(!r.namespacePrefix)return e;let o=n.filter(s=>s.developerName===r.developerName&&s.namespacePrefix!==r.namespacePrefix).map(s=>H(s.namespacePrefix,s.developerName));return o.length===0?e:{...e,detail:{...e.detail??{},sameDeveloperName:[...new Set(o)].sort()}}}function L(e){return[...new Set(e)].sort().slice(0,se)}function We(e,n,t){let r=[];for(let o of n){if(o.field===P)continue;let s=t(o);for(let i of o.values)r.push({kind:"picklist_value_refused",severity:"warning",objectApiName:e,field:o.field,...o.recordType!==void 0?{recordType:o.recordType}:{},value:i,rows:1,detail:{reason:o.reason,...s?{allowed:L(s)}:{},...o.controllingField?{controllingField:o.controllingField}:{},...o.replacedBy!==void 0?{replacement:o.replacedBy}:{}},decisions:w("picklist_value_refused").filter(d=>d!=="skip_rows"||o.reason!=="controlling-value"),defaultDecision:o.replacedBy!==void 0?"map_value":"leave_empty"})}return r}var ce=new Set(["string","textarea","email","phone","url","encryptedstring"]),ue=new Set(["double","currency","percent"]);function fe(e){return e==null||e===""}function ne(e){return e.createable&&e.nillable===!1&&e.defaultedOnCreate!==!0&&e.calculated!==!0&&e.type!=="boolean"}function pe(e,n,t){return e==="Account"&&n==="Name"&&Q(t)}function ge(e,n,t,r){return r.filter(o=>ne(o)&&fe(n[o.name])&&!pe(e,o.name,t))}function me(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;let n=Number(e);return Number.isFinite(n)?n:void 0}function ee(e){if(e.type==="int"&&e.digits!==void 0)return e.digits;if(e.precision!==void 0)return e.precision-(e.scale??0)}function ye(e,n){return e?e.type==="boolean"?n===!0||n==="true"?1:n===!1||n==="false"?0:-1:typeof n!="string"||n===""?-1:(e.controllingValues??[]).indexOf(n):-1}function te(e,n){let{objectApiName:t,rows:r,targetFields:o,picklistValuesByField:s,picklistFields:i}=e,d=new Map(o.map(u=>[u.name,u])),f=o.filter(ne),y=o.filter(u=>u.createable&&ce.has(u.type??"")&&(u.length??0)>0),g=o.filter(u=>u.createable&&(ue.has(u.type??"")||u.type==="int")&&ee(u)!==void 0),c=[...i].filter(([u,l])=>l.anyValue===!0&&s?.has(u)===!0),p=o.filter(u=>u.createable&&u.controllerName!==void 0&&u.validFor!==void 0);for(let{payload:u,source:l,typed:m}of r){for(let a of ge(t,u,l,f))n.add({kind:"required_field_missing",severity:"blocking",objectApiName:t,field:a.name,rows:1,...a.type?{detail:{type:a.type}}:{},decisions:w("required_field_missing")});for(let a of y){let h=u[a.name],b=a.length??0;typeof h!="string"||h.length<=b||n.add({kind:"value_too_long",severity:"blocking",objectApiName:t,field:a.name,rows:1,detail:{length:b,longest:h.length},decisions:w("value_too_long")})}for(let a of g){let h=me(u[a.name]),b=ee(a);h===void 0||b===void 0||Math.abs(Math.trunc(h))<10**b||n.add({kind:"number_out_of_range",severity:"blocking",objectApiName:t,field:a.name,rows:1,detail:{...a.precision!==void 0?{precision:a.precision}:{},...a.scale!==void 0?{scale:a.scale}:{},...a.type==="int"&&a.digits!==void 0?{digits:a.digits}:{}},decisions:w("number_out_of_range")})}for(let[a,h]of c){let b=u[a];if(typeof b!="string"||b==="")continue;let x=s?.get(a),v=h.multi?b.split(";"):[b];for(let E of new Set(v))x?.has(E)||n.add({kind:"picklist_value_absent",severity:"info",objectApiName:t,field:a,value:E,rows:1,decisions:w("picklist_value_absent")})}if(!m)for(let a of p){let h=u[a.name];if(typeof h!="string"||h==="")continue;let b=d.get(a.controllerName??""),x=ye(b,u[a.controllerName??""]),v=i.get(a.name)?.restricted===!0,E=i.get(a.name)?.multi?h.split(";"):[h];for(let q of new Set(E)){let $=a.validFor?.[q];$!==void 0&&(x>=0&&M($,x)||n.add({kind:"dependent_value_invalid",severity:v?"blocking":"warning",objectApiName:t,field:a.name,value:q,rows:1,detail:{controllingField:a.controllerName??"",allowed:L((b?.controllingValues??[]).filter((Me,oe)=>M($,oe)))},decisions:w("dependent_value_invalid")}))}}}}function Qe(e,n,t,r){return{kind:"currency_inactive",severity:"warning",objectApiName:e,field:P,value:n,rows:t,...r&&r.to.length>0?{detail:{replacement:r.to.join(", "),...r.converted.length>0?{amountsConverted:[...r.converted]}:{},...r.asRead?{amountsAsRead:!0}:{}}}:{},decisions:w("currency_inactive"),defaultDecision:"map_value"}}function He(e,n,t,r){return{kind:"unique_value_collision",severity:"warning",objectApiName:e,field:n,rows:t,detail:{colliding:r,linkedToTheRecordItNames:!0},decisions:w("unique_value_collision"),defaultDecision:"ignore"}}function Ye(e,n,t,r,o){return{kind:e,severity:"blocking",objectApiName:n,field:"RecordTypeId",...e==="record_type_unavailable"?{recordType:t}:{value:t},rows:r,detail:{mapTo:L(o)},decisions:w(e)}}var he=10;function re(e){switch(e.operation){case"insert":return null;case"upsert":return e.externalIdField??"Id";case"update":case"delete":return"Id"}}function S(e){if(e==null||typeof e!="string"&&typeof e!="number"&&typeof e!="boolean")return null;let n=String(e);return n===""?null:n.toLowerCase()}function T(e){return typeof e=="number"&&Number.isFinite(e)?String(e):typeof e=="boolean"?e?"true":"false":`'${U(String(e))}'`}var be=200,Se=4e3;function N(e){let n=[],t=[],r=0;for(let o of e){let s=T(o).length+2;t.length>0&&(t.length>=be||r+s>Se)&&(n.push(t),t=[],r=0),t.push(o),r+=s}return t.length>0&&n.push(t),n}function rn(e,n){return async(t,r,o,s)=>{let i=R(r.objectApiName),d=k(o),f=new Map;for(let y of N(s)){if(n?.aborted)throw new Error("The simulation was cancelled.");let{records:g}=await F(e,`SELECT ${d} FROM ${i} WHERE ${d} IN (${y.map(T).join(", ")})`);for(let c of g){let p=S(c[d]);p!==null&&f.set(p,(f.get(p)??0)+1)}}return f}}var we=new Set(["attributes","Id"]);function Re(e,n,t,r){return n?e.conflictFields.filter(o=>o!==t&&!we.has(o)&&o in n&&(r===null||r.has(o))):[]}var on=new Set(["noKey","notInTarget","ambiguous"]);function _e(e,n,t){let r=e.operation,o=re(e);if(o===null)return"insert";let s=S(n[o]);if(s===null)return r==="delete"?"notSent":"noKey";let i=t.get(s)??0;return r==="upsert"?i===0?o.toLowerCase()==="id"?"notInTarget":"insert":i===1?"update":"ambiguous":i===0?"notInTarget":r==="update"?"update":"delete"}var ke=1e4;function sn(e,n,t){let r=e>t?ke:Math.max(1,n);return{callOf:o=>Math.floor(o/r),job:e>t}}function an(e,n,t,r){let o=new Map;n.forEach((c,p)=>{if(c===null)return;let u=`${r.callOf(p)}\0${c}`,l=o.get(u);l?l.push(p):o.set(u,[p])});let s=new Set;for(let c of o.values())if(c.length>1)for(let p of c)s.add(p);let i=new Map,d=new Set,f=0;n.forEach((c,p)=>{if(c===null||s.has(p))return;let u=r.callOf(p);if(i.get(c)===void 0){t[p]==="insert"&&i.set(c,u);return}r.job?f++:t[p]==="insert"&&d.add(p)});let y=[],g=[];if(s.size>0){let c=`${s.size} record(s) carry the ${e} of another record of the same call: an upsert finds its record by its key, and the target refuses every record of a call whose key another carries (DUPLICATE_VALUE: Duplicate external id specified).`;y.push(c),g.push({code:"DUPLICATE_VALUE",rows:s.size,note:c})}return d.size>0&&y.push(`${d.size} record(s) carry the ${e} of a record sent in an earlier call: the upsert finds the record that one created and updates it with theirs.`),f>0&&y.push(`${f} record(s) carry the ${e} of a record in another batch of the Bulk API job: the platform may write the batches at once, so whether each updates the record the other created or creates one of its own cannot be told before the run.`),{refused:s,updated:d,notes:y,refusedFor:g}}function dn(e){let{objectConfig:n,records:t,inTarget:r}=e,o=n.operation,s=re(n),i={insert:0,update:0,delete:0,noKey:0,notInTarget:0,notSent:0,ambiguous:0},d=new Set;t.forEach((l,m)=>{let a=e.simulated?.[m]??_e(n,l,r);i[a]++,(a==="insert"||a==="update")&&d.add(m)});let f=e.leftOut.map(({why:l,count:m})=>W(m,l));i.noKey>0&&f.push(o==="upsert"?`${i.noKey} record(s) carry no value in ${s}: an upsert matches on it, and the target refuses a record without one.`:`${i.noKey} record(s) carry no Id: an update finds its record by Id, and the target refuses one without it.`),i.notInTarget>0&&f.push(`${i.notInTarget} record(s) carry an Id the target does not hold: ${o==="upsert"?"an upsert on the Id finds no record there and creates none":`${o==="update"?"an update":"a delete"} finds no record there`}, and the target refuses it. Two orgs share a record's Id only when it was copied with the org.`),i.ambiguous>0&&f.push(`${i.ambiguous} record(s) match more than one record of the target on ${s}: an upsert finds no single record to update, and the target refuses it.`),i.notSent>0&&f.push(`${i.notSent} record(s) carry no Id: a delete sends ids alone, so the run leaves them out.`);let y=new Map;e.unsettled.forEach((l,m)=>{let a=String(l[e.matchField]??"");a&&d.has(m)&&y.set(a,l)});let g=new Map,c=0;for(let l of e.conflicts){let m=Re(l,y.get(l.recordId),e.matchField,e.writable);if(m.length!==0){c++;for(let a of m)g.set(a,(g.get(a)??0)+1)}}let p=[...g].sort(([l,m],[a,h])=>h-m||l.localeCompare(a)).slice(0,he).map(([l])=>l),u=e.leftOut.reduce((l,{count:m})=>l+m,0);return{objectApiName:n.objectApiName,operation:o,read:e.read,insert:i.insert,update:i.update,delete:i.delete,skipped:u+i.notSent,refused:i.noKey+i.notInTarget+i.ambiguous,conflicts:c,conflictFields:p,notes:f}}var Fe={required_field_missing:"REQUIRED_FIELD_MISSING",value_too_long:"STRING_TOO_LONG",number_out_of_range:"NUMBER_OUTSIDE_VALID_RANGE"};function Ie(e){let n=e.field??"";switch(e.kind){case"required_field_missing":return`${e.rows} record(s) leave ${n} empty, which the target requires: it refuses them (REQUIRED_FIELD_MISSING).`;case"value_too_long":return`${e.rows} record(s) hold a ${n} longer than the ${String(e.detail?.length)} characters the target's field takes (the longest, ${String(e.detail?.longest)}): it refuses them (STRING_TOO_LONG).`;case"number_out_of_range":return`${e.rows} record(s) hold a ${n} larger than the target's field takes: it refuses them (NUMBER_OUTSIDE_VALID_RANGE).`;default:return}}function ln(e,n,t){let r=new Set,o=new O;n.forEach(({payload:i,source:d,creates:f},y)=>{let g=new O;te({objectApiName:e,rows:[{payload:i,source:d,typed:!0}],targetFields:t,picklistValuesByField:null,picklistFields:new Map},g);let c=g.list(new Set).filter(p=>p.severity==="blocking"&&(f||p.kind!=="required_field_missing"));if(c.length!==0){r.add(y);for(let p of c)o.add(p)}});let s=o.list(new Set).flatMap(i=>{let d=Ie(i),f=Fe[i.kind];return d&&f?[{code:f,rows:i.rows,note:d}]:[]});return{refused:r,notes:s.map(({note:i})=>i),refusedFor:s}}function cn(e,n){let t=new Set,r=new Set,o=[],s=[];for(let[i,d]of n){let f=new Set,y=0,g=0,c=0;if(e.forEach((u,l)=>{let m=S(u[i]);if(m===null)return;let a=d.get(m)??0;a===1?(y++,r.add(l)):a>1?(g++,t.add(l)):f.has(m)&&(c++,t.add(l)),f.add(m)}),y>0&&o.push(`LINKED_TO_EXISTING: ${y} record(s) hold a ${i} the target keeps unique, which a record of the target holds already: it refuses them as duplicates (DUPLICATE_VALUE) and names that record, which the run links them to \u2014 what it writes under them points at that record.`),g+c===0)continue;let p=`${g+c} record(s) hold a ${i} the target keeps unique, which `+[g>0?`several records of the target hold already (${g})`:"",c>0?`a record sent before them holds (${c})`:""].filter(Boolean).join(" or ")+": it refuses them (DUPLICATE_VALUE).";o.push(p),s.push({code:"DUPLICATE_VALUE",rows:g+c,note:p})}for(let i of t)r.delete(i);return{refused:t,linked:r,notes:o,refusedFor:s}}import{createHash as Oe}from"node:crypto";var Te=5*6e4,xe=500,Ee=A({sourceOrgId:I().min(1).max(200),targetOrgId:I().min(1).max(200),objectApiName:I().regex(/^[A-Za-z][A-Za-z0-9_]{0,79}$/),watermark:_.datetime(),fingerprint:I().regex(/^[0-9a-f]{64}$/),recordedAt:_.datetime(),filesSeen:_.datetime().optional(),removedAt:_.datetime().optional()}),Ne=A({version:K(1),entries:G(Ee).max(xe),resetAt:_.datetime().optional()});function Sn(e){if(e==null)return{kind:"none"};let n=Ne.safeParse(e);if(n.success)return{kind:"stored",state:n.data};let t=n.error.issues[0];return{kind:"unreadable",issue:`${t.path.join(".")||"state"}: ${t.message}`}}function j(e){return Array.isArray(e)?`[${e.map(j).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t<r?-1:t>r?1:0).map(([t,r])=>`${JSON.stringify(t)}:${j(r)}`).join(",")}}`:JSON.stringify(e)}function C(e){let n=e?.trim();return n||null}function ve(e,n){let t={direction:e.direction,conflictStrategy:e.conflictStrategy,copiesFiles:e.files?!0:void 0,objectApiName:n.objectApiName,operation:n.operation,externalIdField:C(n.externalIdField),where:C(n.where),fieldMappings:n.fieldMappings??[],unmappedSentAsRead:(n.fieldMappings??[]).length>0?!0:void 0,transformRules:n.transformRules??[],excludedFields:n.excludedFields??[],addOnFields:n.addOnFields??[]};return Oe("sha256").update(j(t)).digest("hex")}function wn(e,n,t){let r=ve(e,n);if(t===null)return{read:"full",reason:"not_saved",fingerprint:r};if(t.kind==="unreadable")return{read:"full",reason:"unreadable",fingerprint:r};if(t.kind==="none")return{read:"full",reason:"first_run",fingerprint:r};let o=t.state.entries.find(s=>s.sourceOrgId===e.sourceOrgId&&s.targetOrgId===e.targetOrgId&&s.objectApiName===n.objectApiName);return o?o.fingerprint!==r?{read:"full",reason:"scope_changed",fingerprint:r}:o.removedAt!==void 0?{read:"full",reason:"removed",fingerprint:r}:{read:"delta",since:o.watermark,fingerprint:r,...o.filesSeen!==void 0?{filesSeen:o.filesSeen}:{}}:{read:"full",reason:t.state.resetAt?"reset":"first_run",fingerprint:r}}var $e=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;function Rn(e,n=Te){let t=Date.parse(e);if(!Number.isFinite(t))throw new Error(`Not a watermark: "${e}".`);let r=Math.floor((t-n)/1e3)*1e3;return new Date(r).toISOString().replace(/\.\d{3}Z$/,"Z")}function _n(e){let n=Date.parse(e);if(!Number.isFinite(n))throw new Error(`Not a date: "${e}".`);return new Date(Math.floor(n/1e3)*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")}function Ae(e){if(!$e.test(e)||!Number.isFinite(Date.parse(e)))throw new Error(`Not a SOQL datetime: "${e}".`);return e}function kn(e,n){let t=e?.trim()?D(e):void 0;if(n===void 0)return t;let r=`SystemModstamp > ${Ae(n)}`;return t?`${r} AND (${t})`:r}function De(e){if(typeof e!="string"||e==="")return null;let n=Date.parse(e.replace(/([+-]\d{2})(\d{2})$/,"$1:$2"));return Number.isFinite(n)?new Date(n).toISOString():null}function Fn(e,n,t){let r={query:i=>e.query(i),queryMore:i=>e.queryMore(i)},o={query:i=>e.query(i,{scanAll:!0}),queryMore:i=>e.queryMore(i)},s=()=>{if(t?.aborted)throw new Error("The run was cancelled.")};return{async latestModstamp(i){let d=R(i),y=(await e.query(`SELECT SystemModstamp FROM ${d} ORDER BY SystemModstamp DESC LIMIT 1`)).records[0];if(!y)return null;let g=De(y.SystemModstamp);if(g===null)throw new Error(`${d} answered a SystemModstamp that is not a date.`);return g},async deletedRows(i,d,f){let y=R(i),g=new Set(["Id","SystemModstamp",...d.map(k)]),{records:c,truncated:p}=await F(o,`SELECT ${[...g].join(", ")} FROM ${y} WHERE IsDeleted = true AND (${D(f)})`);return{records:c,truncated:p}},async heldInSource(i,d,f){let y=R(i),g=k(d),c=new Set;for(let p of N(f)){s();let{records:u}=await F(r,`SELECT ${g} FROM ${y} WHERE ${g} IN (${p.map(T).join(", ")})`);for(let l of u){let m=S(l[g]);m!==null&&c.add(m)}}return c},async targetIdsByKey(i,d,f){let y=R(i),g=k(d),c=g==="Id"?"Id":`Id, ${g}`,p=new Map;for(let u of N(f)){s();let{records:l}=await F(n,`SELECT ${c} FROM ${y} WHERE ${g} IN (${u.map(T).join(", ")})`);for(let m of l){let a=S(m[g]);a===null||typeof m.Id!="string"||p.set(a,[...p.get(a)??[],m.Id])}}return p}}}var Pe=new Set(["direct","rename","transform"]);function In(e){let n=e.objectApiName;if(e.operation==="insert"||e.operation==="delete")return{refused:`${n} is written by ${e.operation}, which finds no record by a key: a deleted source record cannot be tied to a target record.`};if(e.operation==="update")return{sourceField:"Id",keyField:"Id"};let t=C(e.externalIdField)??"Id";if((e.addOnFields??[]).some(s=>s.fieldApiName===t))return{refused:`${n}: an add-on writes ${t}, the key the upsert matches on, so it ties no deleted source record to one target record.`};let r=e.fieldMappings??[],o=r.find(s=>s.targetField.toLowerCase()===t.toLowerCase());return!o&&!J(r,e.excludedFields??[]).has(t.toLowerCase())?{sourceField:t,keyField:t}:!o||!Pe.has(o.type)?{refused:`${n}: no source field is carried onto ${t}, the key the upsert matches on, so no deleted source record can be tied to a target record.`}:{sourceField:o.sourceField,keyField:t}}async function On(e,n,t,r,o){let s=n.objectApiName,{records:i,truncated:d}=await e.deletedRows(s,[t.sourceField],r),f={ids:[],read:i.length,stillInSource:0,ambiguous:0,noKey:0,truncated:d};if(i.length===0)return f;let y=[];for(let l of i){let m=l[t.sourceField],a=o(l);if(S(m)===null||S(a)===null){f.noKey++;continue}y.push({raw:m,key:a})}if(y.length===0)return f;let g=t.sourceField==="Id"?new Set:await e.heldInSource(s,t.sourceField,y.map(l=>l.raw)),c=y.filter(l=>g.has(S(l.raw))?(f.stillInSource++,!1):!0);if(c.length===0)return f;let p=await e.targetIdsByKey(s,t.keyField,c.map(l=>l.key)),u=new Set;for(let l of c){let m=p.get(S(l.key))??[];m.length>1?f.ambiguous++:m.length===1&&!u.has(m[0])&&(u.add(m[0]),f.ids.push(m[0]))}return f}function Tn(e,n){let t=[];return e.stillInSource>0&&t.push(`${e.stillInSource} record(s) deleted in the source share their ${n} with a record the source still holds: their target record was kept.`),e.ambiguous>0&&t.push(`${e.ambiguous} record(s) deleted in the source match more than one target record on ${n}: none of those target records was deleted.`),e.noKey>0&&t.push(`${e.noKey} record(s) deleted in the source carry no ${n}: no target record is tied to them.`),e.truncated&&t.push("The source's deleted records were read up to a bound: the rest are read by the next run, from the same watermark."),t}function xn(e,n,t,r,o=0){return{read:e.read,...e.read==="delta"?{since:e.since}:{reason:e.reason},changed:n,deletionsChecked:t!==void 0,deleted:t?.deleted??0,deleteFailed:t?.deleteFailed??0,...t?.error!==void 0?{deletionError:t.error}:{},...r!==void 0?{recorded:r}:{},...o>0?{lookupsOwed:o}:{}}}export{Le as a,je as b,Ce as c,ie as d,O as e,de as f,le as g,We as h,ge as i,te as j,Qe as k,He as l,Ye as m,re as n,S as o,rn as p,on as q,_e as r,sn as s,an as t,dn as u,ln as v,cn as w,Te as x,Sn as y,wn as z,Rn as A,_n as B,Ae as C,kn as D,De as E,Fn as F,In as G,On as H,Tn as I,xn as J};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{f as a,g as b,h as c,i as d,j as e,k as f,l as g}from"./chunk-YOGMP72T.mjs";import"./chunk-2Z54GB6X.mjs";import"./chunk-R6TF26V4.mjs";import"./chunk-JU2XEKEO.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-AITNZWLB.mjs";import"./chunk-ZWCRWF7E.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-ETT5GP4P.mjs";import"./chunk-SW2NUKQL.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-E2YJVSX6.mjs";import"./chunk-BNO5GIJ6.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-KRNFVAGC.mjs";import"./chunk-XEB6HZ34.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-ZUA5BNAO.mjs";import"./chunk-RKALOKAU.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-55LQD3Y3.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-3B5H24ZG.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-EAFLDSQ2.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-DPYTG6DM.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{d as diffOfPicked,b as heldInPlaceReason,g as planSelection,c as rewindPlan,a as rewindWriters,f as selectionPlanOf,e as snapshotRowsOf};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{b as N}from"./chunk-WB2RIVO3.mjs";import{a as k}from"./chunk-BOGNK4LV.mjs";import{i as S}from"./chunk-6SEDOIO3.mjs";import{a as _,b as E}from"./chunk-T63U4OZJ.mjs";import{Ac as X,Sa as L,Wb as M,Zb as W,bb as F,cc as z,db as w,fb as U,fc as V,gb as x,ib as G,jb as v,lb as B,lc as H,zb as j}from"./chunk-KOQV4WXC.mjs";import{b as C,f as P,k as b,l as D}from"./chunk-WZQEK4WT.mjs";var q={PII:"PII",PHI:"PHI",PCI:"PCI",Confidential:"SENSITIVE"},K={PII:"fake",PHI:"nullify",PCI:"mask",SENSITIVE:"hash",NONE:"fake"},$={name_pattern:"field_name",type_analysis:"field_name",content_pattern:"content_sampling"},J=.9;function ie(e,t){let n=[];for(let[i,a]of t){let c=a.fields.filter(o=>o.createable&&N({name:o.name,label:o.label,type:o.type})),l=new Map(c.map(o=>[o.name,o])),r=new Map,s=e.detectPII(i,c.map(o=>({apiName:o.name,label:o.label,type:o.type})));for(let o of s.piiFields){let u=l.get(o.fieldApiName);if(!u)continue;let d=q[o.classification];r.set(u.name,{objectApiName:i,fieldApiName:u.name,fieldLabel:u.label,fieldType:u.type,piiCategory:d,detectionMethod:$[o.detectionMethod],confidence:o.confidence,suggestedMethod:K[d]})}for(let o of c)r.has(o.name)||E(o.name,o.type)===void 0||r.set(o.name,{objectApiName:i,fieldApiName:o.name,fieldLabel:o.label,fieldType:o.type,piiCategory:"PII",detectionMethod:"field_name",confidence:J,suggestedMethod:"fake"});n.push(...r.values())}return n}function ae(e,t){let n=a=>`${a.objectApiName}.${a.fieldApiName}`,i=new Set(e.map(n));return[...e,...t.filter(a=>!i.has(n(a)))]}var Y=["Contact","Lead"];function re(e,t,n){if(e==="none")return[];let i=new Set(t),a=[];for(let c of Y){if(!i.has(c))continue;let l=n.filter(s=>s.objectApiName===c).map(s=>s.fieldApiName),r=[];l.some(_)||r.push("name"),l.some(s=>E(s,"string")==="email")||r.push("email"),l.some(s=>E(s,"string")==="phone")||r.push("phone"),r.length>0&&a.push({objectApiName:c,missing:r})}return a}function ce(e){return e.fatalError!==void 0?"failure":e.totalFailure>0||e.failedObjects.length>0?e.totalSuccess+(e.totalLinked??0)>0?"partial":"failure":[...Object.values(e.lookups??{}),...Object.values(e.statuses??{})].some(n=>n.refusals.length>0)||e.stopped===!0?"partial":"success"}var Q=D({name:C().min(1),referenceTo:b(C()).min(1),createable:P().optional(),updateable:P().optional()}).loose();function de(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let i=Q.safeParse(n);i.success&&t.push({name:i.data.name,referenceTo:i.data.referenceTo,createable:i.data.createable??!1,updateable:i.data.updateable??!1})}return t}var ge={STORAGE_EXCEEDED:"AUTOPILOT_STORAGE_EXCEEDED",API_BUDGET_EXCEEDED:"API_BUDGET_EXCEEDED",WRITE_DECLINED:"AUTOPILOT_WRITE_DECLINED",CONFIRMATION_UNAVAILABLE:"AUTOPILOT_CONFIRMATION_UNAVAILABLE",CHECKPOINT_REFUSED:"CHECKPOINT_REFUSED",RUN_CANCELLED:"RUN_CANCELLED",EMAILS_NOT_ACCEPTED:z},Ae={NO_PLAN:"AUTOPILOT_NO_PLAN",STORAGE_UNREAD:"AUTOPILOT_FIT_STORAGE_UNREAD",READ_REFUSED:"AUTOPILOT_FIT_READ_REFUSED",STALE:"AUTOPILOT_FIT_STALE"};function Ie(e,t,n=new Map){return L(e.waves.flatMap(i=>i.objects).map(i=>{let a=n.get(i);return{objectApiName:i,rows:[],counted:{rows:t.get(i)??0,...a!==void 0?{personAccounts:a}:{}}}}))}function he(e){return[...new Set(e.waves.flatMap(t=>t.objects.map(String)))]}async function Ce(e){return M(e)}function Z(e){return e.filter(t=>t.verdict==="exceeds").map(W)}function ee(e){return e.filter(t=>t.verdict==="unread").map(t=>({limit:t.limit,emails:t.emails,unread:t.unread??""}))}function Pe(e){return e.objects.filter(({rows:t})=>t>0).length}async function te(e,t,n,i,a={}){let c="unread"in t?await n().catch(o=>({unread:o instanceof Error?o.message:String(o)})):t.dailyApiRequests,{readBack:l=0,deliverability:r=0,mute:s=0}=a;return w({run:F(e.objects.map(({rows:o})=>({rows:o}))),...G(i),...s>0?{mute:s}:{},...l>0?{readBack:l}:{},...r>0?{deliverability:r}:{}},c)}async function ke(e){let{plan:t}=e,n=j(t,e.storage);if(t.totalRows===0)return{go:!0,check:n,asked:!1};let i=e.checkpointFirst?.estimate,a=v(i);if(a)return{go:!1,...a,check:n};let c=X(n,e.org);if(c)return{go:!1,code:"STORAGE_EXCEEDED",message:`${c} Nothing was written.`,check:n};let l=await te(t,e.storage,e.readApiBudget,i,{...e.readBack!==void 0?{readBack:e.readBack}:{},...e.mute!==void 0?{mute:e.mute}:{},...V(e.runEmails?.ofRun)}),r=U(l,e.org);if(r)return{go:!1,code:"API_BUDGET_EXCEEDED",message:r,check:n};let s=e.confirmAboveRecords,o=s>0&&t.totalRows>s?s:void 0,u=Z(e.emails??[]),d=ee(e.emails??[]),g=e.emailsUncounted,f=e.runEmails?.gate,y=f?.verdict==="asks",R=async m=>{let p=k(f,m&&y),I=e.checkpointFirst;if(I===void 0)return{go:!0,check:n,asked:m,...p};let h=await B(()=>I.take(I.estimate));return"stop"in h?{go:!1,...h.stop,check:n,...p}:{go:!0,check:n,asked:m,checkpoint:h.checkpoint,...p}};if(o===void 0&&n.verdict==="fits"&&u.length===0&&d.length===0&&g===void 0&&i===void 0&&!y)return R(!1);let A=S(e.orgTier),T=await e.confirm({stage:"write",module:"autopilot",org:e.org,orgTier:e.orgTier,objects:t.objects.map(({objectApiName:m,rows:p})=>({objectApiName:m,rows:p})),total:t.totalRows,...o!==void 0?{aboveRecords:o}:{},...A!==void 0&&t.totalRows>A?{largeVolume:A}:{},storage:H(n),counted:!0,...u.length>0?{emails:u}:{},...d.length>0?{emailsUnread:d}:{},...g!==void 0?{emailsUncounted:g}:{},...x(l),...i!==void 0?{checkpoint:i}:{},...f?.confirmation});if(T==="confirmed")return R(!0);let O=k(f,!1);return T==="declined"?{go:!1,code:"WRITE_DECLINED",message:"The Autopilot run was cancelled before it wrote anything. Nothing was written.",check:n,...O}:{go:!1,code:"CONFIRMATION_UNAVAILABLE",message:"The Autopilot run needed a confirmation before it wrote, and there was no one to ask. Nothing was written: run it again from the Autopilot page, where the question is asked.",check:n,...O}}export{ie as a,ae as b,re as c,ce as d,de as e,ge as f,Ae as g,Ie as h,he as i,Ce as j,Pe as k,te as l,ke as m};
|