@elabs-ai/components-ui 4.2.0 → 5.1.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/README.md +2 -1
- package/dist/chunk-22Z735L6.js +18 -0
- package/dist/chunk-22Z735L6.js.map +1 -0
- package/dist/chunk-23E62DNM.js +2 -0
- package/dist/chunk-23E62DNM.js.map +1 -0
- package/dist/chunk-2AABRSIN.js +2 -0
- package/dist/chunk-2AABRSIN.js.map +1 -0
- package/dist/chunk-2DFB4YTK.js +55 -0
- package/dist/chunk-2DFB4YTK.js.map +1 -0
- package/dist/chunk-2SBYBN45.js +2 -0
- package/dist/chunk-2SBYBN45.js.map +1 -0
- package/dist/chunk-2ZMPAD6C.js +357 -0
- package/dist/chunk-2ZMPAD6C.js.map +1 -0
- package/dist/chunk-36SY7TID.js +36 -0
- package/dist/chunk-36SY7TID.js.map +1 -0
- package/dist/chunk-36VULFFV.js +2 -0
- package/dist/chunk-36VULFFV.js.map +1 -0
- package/dist/chunk-3BZBNDRP.js +123 -0
- package/dist/chunk-3BZBNDRP.js.map +1 -0
- package/dist/chunk-3DJ4KY3U.js +82 -0
- package/dist/chunk-3DJ4KY3U.js.map +1 -0
- package/dist/chunk-3EDNWHWD.js +125 -0
- package/dist/chunk-3EDNWHWD.js.map +1 -0
- package/dist/chunk-3JAEQNCB.js +60 -0
- package/dist/chunk-3JAEQNCB.js.map +1 -0
- package/dist/chunk-3OSGTUN2.js +2 -0
- package/dist/chunk-3OSGTUN2.js.map +1 -0
- package/dist/chunk-3P7SRCDB.js +23 -0
- package/dist/chunk-3P7SRCDB.js.map +1 -0
- package/dist/chunk-3ZR5PMKB.js +41 -0
- package/dist/chunk-3ZR5PMKB.js.map +1 -0
- package/dist/chunk-45ICJ3EV.js +2 -0
- package/dist/chunk-45ICJ3EV.js.map +1 -0
- package/dist/chunk-47YSHR3H.js +77 -0
- package/dist/chunk-47YSHR3H.js.map +1 -0
- package/dist/chunk-4ACT7RLU.js +2 -0
- package/dist/chunk-4ACT7RLU.js.map +1 -0
- package/dist/chunk-4B2E4OCZ.js +44 -0
- package/dist/chunk-4B2E4OCZ.js.map +1 -0
- package/dist/chunk-4C4D6T5M.js +229 -0
- package/dist/chunk-4C4D6T5M.js.map +1 -0
- package/dist/chunk-4DWIMWR5.js +726 -0
- package/dist/chunk-4DWIMWR5.js.map +1 -0
- package/dist/chunk-4DZGAY6R.js +140 -0
- package/dist/chunk-4DZGAY6R.js.map +1 -0
- package/dist/chunk-4HTVJZVG.js +2 -0
- package/dist/chunk-4HTVJZVG.js.map +1 -0
- package/dist/chunk-4KDA5MDC.js +2 -0
- package/dist/chunk-4KDA5MDC.js.map +1 -0
- package/dist/chunk-4NSCLIES.js +126 -0
- package/dist/chunk-4NSCLIES.js.map +1 -0
- package/dist/chunk-4PXDZR2W.js +2 -0
- package/dist/chunk-4PXDZR2W.js.map +1 -0
- package/dist/chunk-4UWOADYM.js +2 -0
- package/dist/chunk-4UWOADYM.js.map +1 -0
- package/dist/chunk-4VCU3GFI.js +23 -0
- package/dist/chunk-4VCU3GFI.js.map +1 -0
- package/dist/chunk-4W3MVVKN.js +66 -0
- package/dist/chunk-4W3MVVKN.js.map +1 -0
- package/dist/chunk-4YOFSGHD.js +2 -0
- package/dist/chunk-4YOFSGHD.js.map +1 -0
- package/dist/chunk-545HI223.js +2 -0
- package/dist/chunk-545HI223.js.map +1 -0
- package/dist/chunk-55BM2IU2.js +186 -0
- package/dist/chunk-55BM2IU2.js.map +1 -0
- package/dist/chunk-5C5W52O2.js +27 -0
- package/dist/chunk-5C5W52O2.js.map +1 -0
- package/dist/chunk-5G2DDMHR.js +2 -0
- package/dist/chunk-5G2DDMHR.js.map +1 -0
- package/dist/chunk-5LCN5Q2L.js +23 -0
- package/dist/chunk-5LCN5Q2L.js.map +1 -0
- package/dist/chunk-5MXQ5CP7.js +93 -0
- package/dist/chunk-5MXQ5CP7.js.map +1 -0
- package/dist/chunk-5P4BSHIG.js +2 -0
- package/dist/chunk-5P4BSHIG.js.map +1 -0
- package/dist/chunk-5SHHIQVA.js +22 -0
- package/dist/chunk-5SHHIQVA.js.map +1 -0
- package/dist/chunk-5YZLOAKR.js +2 -0
- package/dist/chunk-5YZLOAKR.js.map +1 -0
- package/dist/chunk-653ZIWX6.js +2 -0
- package/dist/chunk-653ZIWX6.js.map +1 -0
- package/dist/chunk-6DHG7JVP.js +2 -0
- package/dist/chunk-6DHG7JVP.js.map +1 -0
- package/dist/chunk-6HTZBBTC.js +35 -0
- package/dist/chunk-6HTZBBTC.js.map +1 -0
- package/dist/chunk-6ROQKB4U.js +2 -0
- package/dist/chunk-6ROQKB4U.js.map +1 -0
- package/dist/chunk-6S43VAN7.js +2 -0
- package/dist/chunk-6S43VAN7.js.map +1 -0
- package/dist/chunk-6TJVJPNU.js +1321 -0
- package/dist/chunk-6TJVJPNU.js.map +1 -0
- package/dist/chunk-6VLJL7Q4.js +2 -0
- package/dist/chunk-6VLJL7Q4.js.map +1 -0
- package/dist/chunk-72H7HUTH.js +161 -0
- package/dist/chunk-72H7HUTH.js.map +1 -0
- package/dist/chunk-7KV7H2TW.js +323 -0
- package/dist/chunk-7KV7H2TW.js.map +1 -0
- package/dist/chunk-7WIHVGYL.js +2 -0
- package/dist/chunk-7WIHVGYL.js.map +1 -0
- package/dist/chunk-7Z2RAGOA.js +90 -0
- package/dist/chunk-7Z2RAGOA.js.map +1 -0
- package/dist/chunk-AA3SPDJU.js +2 -0
- package/dist/chunk-AA3SPDJU.js.map +1 -0
- package/dist/chunk-AC7X3D2M.js +2 -0
- package/dist/chunk-AC7X3D2M.js.map +1 -0
- package/dist/chunk-AE6LFFME.js +201 -0
- package/dist/chunk-AE6LFFME.js.map +1 -0
- package/dist/chunk-AE6UDP36.js +2 -0
- package/dist/chunk-AE6UDP36.js.map +1 -0
- package/dist/chunk-AFEFAGPW.js +2 -0
- package/dist/chunk-AFEFAGPW.js.map +1 -0
- package/dist/chunk-AFJCS2WV.js +95 -0
- package/dist/chunk-AFJCS2WV.js.map +1 -0
- package/dist/chunk-ALNJV4XB.js +218 -0
- package/dist/chunk-ALNJV4XB.js.map +1 -0
- package/dist/chunk-AQNLEP5F.js +2 -0
- package/dist/chunk-AQNLEP5F.js.map +1 -0
- package/dist/chunk-AUQVJ7KO.js +2 -0
- package/dist/chunk-AUQVJ7KO.js.map +1 -0
- package/dist/chunk-AXHMQOIZ.js +116 -0
- package/dist/chunk-AXHMQOIZ.js.map +1 -0
- package/dist/chunk-AZEABCK4.js +30 -0
- package/dist/chunk-AZEABCK4.js.map +1 -0
- package/dist/chunk-B23VW24W.js +2 -0
- package/dist/chunk-B23VW24W.js.map +1 -0
- package/dist/chunk-B2RSOLLO.js +2 -0
- package/dist/chunk-B2RSOLLO.js.map +1 -0
- package/dist/chunk-B3DANITU.js +85 -0
- package/dist/chunk-B3DANITU.js.map +1 -0
- package/dist/chunk-B7FAQKHH.js +87 -0
- package/dist/chunk-B7FAQKHH.js.map +1 -0
- package/dist/chunk-BDOG4YSM.js +989 -0
- package/dist/chunk-BDOG4YSM.js.map +1 -0
- package/dist/chunk-BRL2HMZJ.js +110 -0
- package/dist/chunk-BRL2HMZJ.js.map +1 -0
- package/dist/chunk-BTBYNKT4.js +2 -0
- package/dist/chunk-BTBYNKT4.js.map +1 -0
- package/dist/chunk-BWL7HWEF.js +325 -0
- package/dist/chunk-BWL7HWEF.js.map +1 -0
- package/dist/chunk-BYFRDLDL.js +246 -0
- package/dist/chunk-BYFRDLDL.js.map +1 -0
- package/dist/chunk-BZQF5QCN.js +18 -0
- package/dist/chunk-BZQF5QCN.js.map +1 -0
- package/dist/chunk-C2AQEEFB.js +2 -0
- package/dist/chunk-C2AQEEFB.js.map +1 -0
- package/dist/chunk-C2ICCCP5.js +400 -0
- package/dist/chunk-C2ICCCP5.js.map +1 -0
- package/dist/chunk-C5QBV5RE.js +77 -0
- package/dist/chunk-C5QBV5RE.js.map +1 -0
- package/dist/chunk-C753P3VJ.js +2 -0
- package/dist/chunk-C753P3VJ.js.map +1 -0
- package/dist/chunk-CDE74W6O.js +2 -0
- package/dist/chunk-CDE74W6O.js.map +1 -0
- package/dist/chunk-CDMJSXCB.js +62 -0
- package/dist/chunk-CDMJSXCB.js.map +1 -0
- package/dist/chunk-CEDK5GM2.js +68 -0
- package/dist/chunk-CEDK5GM2.js.map +1 -0
- package/dist/chunk-CEHCVDYR.js +476 -0
- package/dist/chunk-CEHCVDYR.js.map +1 -0
- package/dist/chunk-CEQ3YKHR.js +35 -0
- package/dist/chunk-CEQ3YKHR.js.map +1 -0
- package/dist/chunk-CEQER4CV.js +2 -0
- package/dist/chunk-CEQER4CV.js.map +1 -0
- package/dist/chunk-CMP4F537.js +190 -0
- package/dist/chunk-CMP4F537.js.map +1 -0
- package/dist/chunk-CRGGGHAM.js +2 -0
- package/dist/chunk-CRGGGHAM.js.map +1 -0
- package/dist/chunk-CRVB4SLG.js +2 -0
- package/dist/chunk-CRVB4SLG.js.map +1 -0
- package/dist/chunk-CT6XJIPY.js +2 -0
- package/dist/chunk-CT6XJIPY.js.map +1 -0
- package/dist/chunk-CY5ISPFB.js +235 -0
- package/dist/chunk-CY5ISPFB.js.map +1 -0
- package/dist/chunk-CY624JOL.js +2 -0
- package/dist/chunk-CY624JOL.js.map +1 -0
- package/dist/chunk-D53EN4Q6.js +2 -0
- package/dist/chunk-D53EN4Q6.js.map +1 -0
- package/dist/chunk-D5INX2EF.js +50 -0
- package/dist/chunk-D5INX2EF.js.map +1 -0
- package/dist/chunk-DCHYNTHI.js +11 -0
- package/dist/chunk-DCHYNTHI.js.map +1 -0
- package/dist/chunk-DIQJODQR.js +2 -0
- package/dist/chunk-DIQJODQR.js.map +1 -0
- package/dist/chunk-DSGTH6JW.js +2 -0
- package/dist/chunk-DSGTH6JW.js.map +1 -0
- package/dist/chunk-DU6ITAJL.js +2 -0
- package/dist/chunk-DU6ITAJL.js.map +1 -0
- package/dist/chunk-DXC3DTCV.js +256 -0
- package/dist/chunk-DXC3DTCV.js.map +1 -0
- package/dist/chunk-DXDLTYTT.js +2 -0
- package/dist/chunk-DXDLTYTT.js.map +1 -0
- package/dist/chunk-E3GNYOLS.js +26 -0
- package/dist/chunk-E3GNYOLS.js.map +1 -0
- package/dist/chunk-EAFPUZ46.js +2 -0
- package/dist/chunk-EAFPUZ46.js.map +1 -0
- package/dist/chunk-EBDOKU5K.js +2 -0
- package/dist/chunk-EBDOKU5K.js.map +1 -0
- package/dist/chunk-EBNPVPR7.js +266 -0
- package/dist/chunk-EBNPVPR7.js.map +1 -0
- package/dist/chunk-EDE73Q6Z.js +2 -0
- package/dist/chunk-EDE73Q6Z.js.map +1 -0
- package/dist/chunk-EJ3XWNY3.js +52 -0
- package/dist/chunk-EJ3XWNY3.js.map +1 -0
- package/dist/chunk-EJQYE4MY.js +100 -0
- package/dist/chunk-EJQYE4MY.js.map +1 -0
- package/dist/chunk-ENL3CCZB.js +385 -0
- package/dist/chunk-ENL3CCZB.js.map +1 -0
- package/dist/chunk-EP3U7OQ3.js +18 -0
- package/dist/chunk-EP3U7OQ3.js.map +1 -0
- package/dist/chunk-ERTYAID6.js +101 -0
- package/dist/chunk-ERTYAID6.js.map +1 -0
- package/dist/chunk-FAOX6A5D.js +2 -0
- package/dist/chunk-FAOX6A5D.js.map +1 -0
- package/dist/chunk-FBJ2JSRA.js +47 -0
- package/dist/chunk-FBJ2JSRA.js.map +1 -0
- package/dist/chunk-FDJ77DTR.js +2 -0
- package/dist/chunk-FDJ77DTR.js.map +1 -0
- package/dist/chunk-FG3PDWE3.js +31 -0
- package/dist/chunk-FG3PDWE3.js.map +1 -0
- package/dist/chunk-FHDJKH2A.js +2 -0
- package/dist/chunk-FHDJKH2A.js.map +1 -0
- package/dist/chunk-FLCQKC64.js +97 -0
- package/dist/chunk-FLCQKC64.js.map +1 -0
- package/dist/chunk-FPLZ24MK.js +2 -0
- package/dist/chunk-FPLZ24MK.js.map +1 -0
- package/dist/chunk-FRFSDZIN.js +2 -0
- package/dist/chunk-FRFSDZIN.js.map +1 -0
- package/dist/chunk-FXC64HLD.js +137 -0
- package/dist/chunk-FXC64HLD.js.map +1 -0
- package/dist/chunk-FXWWDMMP.js +55 -0
- package/dist/chunk-FXWWDMMP.js.map +1 -0
- package/dist/chunk-FZEG2R3E.js +30 -0
- package/dist/chunk-FZEG2R3E.js.map +1 -0
- package/dist/chunk-G3OTDYCD.js +53 -0
- package/dist/chunk-G3OTDYCD.js.map +1 -0
- package/dist/chunk-G72UOVKS.js +2 -0
- package/dist/chunk-G72UOVKS.js.map +1 -0
- package/dist/chunk-GAI4NEPU.js +151 -0
- package/dist/chunk-GAI4NEPU.js.map +1 -0
- package/dist/chunk-GMXSCEYN.js +24 -0
- package/dist/chunk-GMXSCEYN.js.map +1 -0
- package/dist/chunk-GTBVTLZJ.js +54 -0
- package/dist/chunk-GTBVTLZJ.js.map +1 -0
- package/dist/chunk-GTDCC4YX.js +197 -0
- package/dist/chunk-GTDCC4YX.js.map +1 -0
- package/dist/chunk-GV6GQXKX.js +176 -0
- package/dist/chunk-GV6GQXKX.js.map +1 -0
- package/dist/chunk-GWHO5ACE.js +637 -0
- package/dist/chunk-GWHO5ACE.js.map +1 -0
- package/dist/chunk-H5XSI63P.js +2 -0
- package/dist/chunk-H5XSI63P.js.map +1 -0
- package/dist/chunk-HANBQNW3.js +1498 -0
- package/dist/chunk-HANBQNW3.js.map +1 -0
- package/dist/chunk-HCU2JHPH.js +169 -0
- package/dist/chunk-HCU2JHPH.js.map +1 -0
- package/dist/chunk-HDDXP2J7.js +2 -0
- package/dist/chunk-HDDXP2J7.js.map +1 -0
- package/dist/chunk-HDS64Z5L.js +54 -0
- package/dist/chunk-HDS64Z5L.js.map +1 -0
- package/dist/chunk-HF6BGFUV.js +78 -0
- package/dist/chunk-HF6BGFUV.js.map +1 -0
- package/dist/chunk-HHVULJGX.js +2 -0
- package/dist/chunk-HHVULJGX.js.map +1 -0
- package/dist/chunk-HHZJALGA.js +163 -0
- package/dist/chunk-HHZJALGA.js.map +1 -0
- package/dist/chunk-HLMFRCFE.js +2 -0
- package/dist/chunk-HLMFRCFE.js.map +1 -0
- package/dist/chunk-HND6FAMX.js +75 -0
- package/dist/chunk-HND6FAMX.js.map +1 -0
- package/dist/chunk-HNLYRHAU.js +74 -0
- package/dist/chunk-HNLYRHAU.js.map +1 -0
- package/dist/chunk-HPUPDT4Q.js +2 -0
- package/dist/chunk-HPUPDT4Q.js.map +1 -0
- package/dist/chunk-HUIYDDDL.js +189 -0
- package/dist/chunk-HUIYDDDL.js.map +1 -0
- package/dist/chunk-HWVU636Q.js +787 -0
- package/dist/chunk-HWVU636Q.js.map +1 -0
- package/dist/chunk-HXQ4MDCH.js +296 -0
- package/dist/chunk-HXQ4MDCH.js.map +1 -0
- package/dist/chunk-HZPNST7D.js +2 -0
- package/dist/chunk-HZPNST7D.js.map +1 -0
- package/dist/chunk-I3U52BDH.js +36 -0
- package/dist/chunk-I3U52BDH.js.map +1 -0
- package/dist/chunk-I6O6ACCH.js +2 -0
- package/dist/chunk-I6O6ACCH.js.map +1 -0
- package/dist/chunk-IE5GWE72.js +177 -0
- package/dist/chunk-IE5GWE72.js.map +1 -0
- package/dist/chunk-IIY5JRNW.js +93 -0
- package/dist/chunk-IIY5JRNW.js.map +1 -0
- package/dist/chunk-IM5VJP6T.js +2 -0
- package/dist/chunk-IM5VJP6T.js.map +1 -0
- package/dist/chunk-IRUZDWJ3.js +218 -0
- package/dist/chunk-IRUZDWJ3.js.map +1 -0
- package/dist/chunk-ISWUCXEZ.js +2 -0
- package/dist/chunk-ISWUCXEZ.js.map +1 -0
- package/dist/chunk-IUQ474IC.js +2 -0
- package/dist/chunk-IUQ474IC.js.map +1 -0
- package/dist/chunk-IVEDMK5U.js +61 -0
- package/dist/chunk-IVEDMK5U.js.map +1 -0
- package/dist/chunk-IY23F2Y5.js +2 -0
- package/dist/chunk-IY23F2Y5.js.map +1 -0
- package/dist/chunk-JCRBDA66.js +2 -0
- package/dist/chunk-JCRBDA66.js.map +1 -0
- package/dist/chunk-JTY3REOB.js +76 -0
- package/dist/chunk-JTY3REOB.js.map +1 -0
- package/dist/chunk-JVCIAEFT.js +68 -0
- package/dist/chunk-JVCIAEFT.js.map +1 -0
- package/dist/chunk-JWWJ2Z5C.js +2 -0
- package/dist/chunk-JWWJ2Z5C.js.map +1 -0
- package/dist/chunk-K2GLXCTG.js +2 -0
- package/dist/chunk-K2GLXCTG.js.map +1 -0
- package/dist/chunk-K4V2ELUZ.js +36 -0
- package/dist/chunk-K4V2ELUZ.js.map +1 -0
- package/dist/chunk-KAAJL2HA.js +327 -0
- package/dist/chunk-KAAJL2HA.js.map +1 -0
- package/dist/chunk-KBWHHAI3.js +246 -0
- package/dist/chunk-KBWHHAI3.js.map +1 -0
- package/dist/chunk-KK2TIWTF.js +54 -0
- package/dist/chunk-KK2TIWTF.js.map +1 -0
- package/dist/chunk-KPZFLTZ2.js +61 -0
- package/dist/chunk-KPZFLTZ2.js.map +1 -0
- package/dist/chunk-KRVSD4OK.js +2 -0
- package/dist/chunk-KRVSD4OK.js.map +1 -0
- package/dist/chunk-KXYL3CUS.js +74 -0
- package/dist/chunk-KXYL3CUS.js.map +1 -0
- package/dist/chunk-L37QZALU.js +17 -0
- package/dist/chunk-L37QZALU.js.map +1 -0
- package/dist/chunk-L3SHPHLK.js +35 -0
- package/dist/chunk-L3SHPHLK.js.map +1 -0
- package/dist/chunk-L5O2O67Y.js +164 -0
- package/dist/chunk-L5O2O67Y.js.map +1 -0
- package/dist/chunk-L66VJIRD.js +2 -0
- package/dist/chunk-L66VJIRD.js.map +1 -0
- package/dist/chunk-L6A3RXCU.js +140 -0
- package/dist/chunk-L6A3RXCU.js.map +1 -0
- package/dist/chunk-LDOCY4SU.js +68 -0
- package/dist/chunk-LDOCY4SU.js.map +1 -0
- package/dist/chunk-LG33MONJ.js +74 -0
- package/dist/chunk-LG33MONJ.js.map +1 -0
- package/dist/chunk-LJGWA2XL.js +2 -0
- package/dist/chunk-LJGWA2XL.js.map +1 -0
- package/dist/chunk-LLQWLZ75.js +2 -0
- package/dist/chunk-LLQWLZ75.js.map +1 -0
- package/dist/chunk-LLYLDZXC.js +54 -0
- package/dist/chunk-LLYLDZXC.js.map +1 -0
- package/dist/chunk-LMV225AS.js +39 -0
- package/dist/chunk-LMV225AS.js.map +1 -0
- package/dist/chunk-LSYVAOSH.js +2 -0
- package/dist/chunk-LSYVAOSH.js.map +1 -0
- package/dist/chunk-LYVBDMDQ.js +2 -0
- package/dist/chunk-LYVBDMDQ.js.map +1 -0
- package/dist/chunk-M2KNQZUL.js +73 -0
- package/dist/chunk-M2KNQZUL.js.map +1 -0
- package/dist/chunk-M3WSUFD4.js +2 -0
- package/dist/chunk-M3WSUFD4.js.map +1 -0
- package/dist/chunk-M5WPZXBA.js +118 -0
- package/dist/chunk-M5WPZXBA.js.map +1 -0
- package/dist/chunk-MDQYRES4.js +796 -0
- package/dist/chunk-MDQYRES4.js.map +1 -0
- package/dist/chunk-MIXCXZWT.js +2 -0
- package/dist/chunk-MIXCXZWT.js.map +1 -0
- package/dist/chunk-MJAIURHO.js +56 -0
- package/dist/chunk-MJAIURHO.js.map +1 -0
- package/dist/chunk-MLGBLKUH.js +2 -0
- package/dist/chunk-MLGBLKUH.js.map +1 -0
- package/dist/chunk-MNS2VWHD.js +2 -0
- package/dist/chunk-MNS2VWHD.js.map +1 -0
- package/dist/chunk-MPMMU3QI.js +2 -0
- package/dist/chunk-MPMMU3QI.js.map +1 -0
- package/dist/chunk-MRBDJASL.js +97 -0
- package/dist/chunk-MRBDJASL.js.map +1 -0
- package/dist/chunk-MRWOHWEH.js +2 -0
- package/dist/chunk-MRWOHWEH.js.map +1 -0
- package/dist/chunk-MY5H6D5Y.js +245 -0
- package/dist/chunk-MY5H6D5Y.js.map +1 -0
- package/dist/chunk-MZDL7N52.js +2 -0
- package/dist/chunk-MZDL7N52.js.map +1 -0
- package/dist/chunk-N7PJTMRL.js +2 -0
- package/dist/chunk-N7PJTMRL.js.map +1 -0
- package/dist/chunk-NMGNXW3J.js +98 -0
- package/dist/chunk-NMGNXW3J.js.map +1 -0
- package/dist/chunk-NRNIUM75.js +2 -0
- package/dist/chunk-NRNIUM75.js.map +1 -0
- package/dist/chunk-NRPZ3BH4.js +85 -0
- package/dist/chunk-NRPZ3BH4.js.map +1 -0
- package/dist/chunk-NXCOVGDU.js +100 -0
- package/dist/chunk-NXCOVGDU.js.map +1 -0
- package/dist/chunk-NZUKZRT7.js +201 -0
- package/dist/chunk-NZUKZRT7.js.map +1 -0
- package/dist/chunk-O3JWMB6O.js +20 -0
- package/dist/chunk-O3JWMB6O.js.map +1 -0
- package/dist/chunk-O6V65J5J.js +81 -0
- package/dist/chunk-O6V65J5J.js.map +1 -0
- package/dist/chunk-OEPN373X.js +2 -0
- package/dist/chunk-OEPN373X.js.map +1 -0
- package/dist/chunk-OGTILHKP.js +355 -0
- package/dist/chunk-OGTILHKP.js.map +1 -0
- package/dist/chunk-OITCRC5D.js +2 -0
- package/dist/chunk-OITCRC5D.js.map +1 -0
- package/dist/chunk-OKV3N7QK.js +2 -0
- package/dist/chunk-OKV3N7QK.js.map +1 -0
- package/dist/chunk-OKY7ACZK.js +31 -0
- package/dist/chunk-OKY7ACZK.js.map +1 -0
- package/dist/chunk-ON2E7XHD.js +51 -0
- package/dist/chunk-ON2E7XHD.js.map +1 -0
- package/dist/chunk-OPBSVEMX.js +192 -0
- package/dist/chunk-OPBSVEMX.js.map +1 -0
- package/dist/chunk-OR4NVFPH.js +2 -0
- package/dist/chunk-OR4NVFPH.js.map +1 -0
- package/dist/chunk-OYKS7YHE.js +2 -0
- package/dist/chunk-OYKS7YHE.js.map +1 -0
- package/dist/chunk-PGKQZBLZ.js +55 -0
- package/dist/chunk-PGKQZBLZ.js.map +1 -0
- package/dist/chunk-PHAENHGL.js +19 -0
- package/dist/chunk-PHAENHGL.js.map +1 -0
- package/dist/chunk-PLCQZBZS.js +63 -0
- package/dist/chunk-PLCQZBZS.js.map +1 -0
- package/dist/chunk-PQZD5W3E.js +170 -0
- package/dist/chunk-PQZD5W3E.js.map +1 -0
- package/dist/chunk-PSBNQZB4.js +2 -0
- package/dist/chunk-PSBNQZB4.js.map +1 -0
- package/dist/chunk-PSXUEWUS.js +87 -0
- package/dist/chunk-PSXUEWUS.js.map +1 -0
- package/dist/chunk-PT5P4AAU.js +128 -0
- package/dist/chunk-PT5P4AAU.js.map +1 -0
- package/dist/chunk-PUACHQRH.js +31 -0
- package/dist/chunk-PUACHQRH.js.map +1 -0
- package/dist/chunk-QDJHUNBQ.js +2 -0
- package/dist/chunk-QDJHUNBQ.js.map +1 -0
- package/dist/chunk-QF6UWWDY.js +125 -0
- package/dist/chunk-QF6UWWDY.js.map +1 -0
- package/dist/chunk-QKZX5HDY.js +209 -0
- package/dist/chunk-QKZX5HDY.js.map +1 -0
- package/dist/chunk-QLM3KTAQ.js +100 -0
- package/dist/chunk-QLM3KTAQ.js.map +1 -0
- package/dist/chunk-QODOFLHL.js +2 -0
- package/dist/chunk-QODOFLHL.js.map +1 -0
- package/dist/chunk-QRGYKV4J.js +2 -0
- package/dist/chunk-QRGYKV4J.js.map +1 -0
- package/dist/chunk-R27VUCWR.js +140 -0
- package/dist/chunk-R27VUCWR.js.map +1 -0
- package/dist/chunk-R5JYMCEA.js +2 -0
- package/dist/chunk-R5JYMCEA.js.map +1 -0
- package/dist/chunk-RB5AWLDJ.js +26 -0
- package/dist/chunk-RB5AWLDJ.js.map +1 -0
- package/dist/chunk-RF7JSNXJ.js +2 -0
- package/dist/chunk-RF7JSNXJ.js.map +1 -0
- package/dist/chunk-RFTC5UVB.js +126 -0
- package/dist/chunk-RFTC5UVB.js.map +1 -0
- package/dist/chunk-RHVYRQN4.js +201 -0
- package/dist/chunk-RHVYRQN4.js.map +1 -0
- package/dist/chunk-RHXVQZOW.js +2 -0
- package/dist/chunk-RHXVQZOW.js.map +1 -0
- package/dist/chunk-RIYDAMSQ.js +25 -0
- package/dist/chunk-RIYDAMSQ.js.map +1 -0
- package/dist/chunk-RMSMTLXH.js +2 -0
- package/dist/chunk-RMSMTLXH.js.map +1 -0
- package/dist/chunk-RRYWMYGI.js +14 -0
- package/dist/chunk-RRYWMYGI.js.map +1 -0
- package/dist/chunk-RTHCX2TG.js +59 -0
- package/dist/chunk-RTHCX2TG.js.map +1 -0
- package/dist/chunk-RYPK72YP.js +395 -0
- package/dist/chunk-RYPK72YP.js.map +1 -0
- package/dist/chunk-SCCBEFVK.js +187 -0
- package/dist/chunk-SCCBEFVK.js.map +1 -0
- package/dist/chunk-SEGTBIR4.js +110 -0
- package/dist/chunk-SEGTBIR4.js.map +1 -0
- package/dist/chunk-SGBCLZQF.js +38 -0
- package/dist/chunk-SGBCLZQF.js.map +1 -0
- package/dist/chunk-SLDJYJEG.js +133 -0
- package/dist/chunk-SLDJYJEG.js.map +1 -0
- package/dist/chunk-SMTAPQEQ.js +2 -0
- package/dist/chunk-SMTAPQEQ.js.map +1 -0
- package/dist/chunk-SS6EOZKZ.js +2 -0
- package/dist/chunk-SS6EOZKZ.js.map +1 -0
- package/dist/chunk-SSQG36MH.js +226 -0
- package/dist/chunk-SSQG36MH.js.map +1 -0
- package/dist/chunk-SWQCCR6Q.js +140 -0
- package/dist/chunk-SWQCCR6Q.js.map +1 -0
- package/dist/chunk-T2XEMEN2.js +2 -0
- package/dist/chunk-T2XEMEN2.js.map +1 -0
- package/dist/chunk-T7JOWG2A.js +10 -0
- package/dist/chunk-T7JOWG2A.js.map +1 -0
- package/dist/chunk-TAQI4JTE.js +12 -0
- package/dist/chunk-TAQI4JTE.js.map +1 -0
- package/dist/chunk-TNOANK34.js +4483 -0
- package/dist/chunk-TNOANK34.js.map +1 -0
- package/dist/chunk-U5BZXNHW.js +80 -0
- package/dist/chunk-U5BZXNHW.js.map +1 -0
- package/dist/chunk-U756JCDK.js +27 -0
- package/dist/chunk-U756JCDK.js.map +1 -0
- package/dist/chunk-U7QYCYHC.js +2 -0
- package/dist/chunk-U7QYCYHC.js.map +1 -0
- package/dist/chunk-UANAVLMS.js +2 -0
- package/dist/chunk-UANAVLMS.js.map +1 -0
- package/dist/chunk-UCEVPLR5.js +2 -0
- package/dist/chunk-UCEVPLR5.js.map +1 -0
- package/dist/chunk-UCQDLRHR.js +31 -0
- package/dist/chunk-UCQDLRHR.js.map +1 -0
- package/dist/chunk-UFF7LLGU.js +2 -0
- package/dist/chunk-UFF7LLGU.js.map +1 -0
- package/dist/chunk-UG2T7LMX.js +198 -0
- package/dist/chunk-UG2T7LMX.js.map +1 -0
- package/dist/chunk-UG5TKXTK.js +2 -0
- package/dist/chunk-UG5TKXTK.js.map +1 -0
- package/dist/chunk-UPGIQXUY.js +24 -0
- package/dist/chunk-UPGIQXUY.js.map +1 -0
- package/dist/chunk-UQPW7INX.js +91 -0
- package/dist/chunk-UQPW7INX.js.map +1 -0
- package/dist/chunk-UQRYTMR7.js +2 -0
- package/dist/chunk-UQRYTMR7.js.map +1 -0
- package/dist/chunk-USI4LB3N.js +2 -0
- package/dist/chunk-USI4LB3N.js.map +1 -0
- package/dist/chunk-UUSOIPM2.js +69 -0
- package/dist/chunk-UUSOIPM2.js.map +1 -0
- package/dist/chunk-V2S5DINS.js +2 -0
- package/dist/chunk-V2S5DINS.js.map +1 -0
- package/dist/chunk-V3EQ6ACC.js +2 -0
- package/dist/chunk-V3EQ6ACC.js.map +1 -0
- package/dist/chunk-V5QCJHDA.js +173 -0
- package/dist/chunk-V5QCJHDA.js.map +1 -0
- package/dist/chunk-V6U75PIG.js +147 -0
- package/dist/chunk-V6U75PIG.js.map +1 -0
- package/dist/chunk-VC4GKLZL.js +111 -0
- package/dist/chunk-VC4GKLZL.js.map +1 -0
- package/dist/chunk-VFS52GGI.js +2 -0
- package/dist/chunk-VFS52GGI.js.map +1 -0
- package/dist/chunk-VH7GG77B.js +2 -0
- package/dist/chunk-VH7GG77B.js.map +1 -0
- package/dist/chunk-VHLPJ4XW.js +2 -0
- package/dist/chunk-VHLPJ4XW.js.map +1 -0
- package/dist/chunk-VLE5THFD.js +2 -0
- package/dist/chunk-VLE5THFD.js.map +1 -0
- package/dist/chunk-VORFRWM5.js +2 -0
- package/dist/chunk-VORFRWM5.js.map +1 -0
- package/dist/chunk-VQ2T3OEC.js +27 -0
- package/dist/chunk-VQ2T3OEC.js.map +1 -0
- package/dist/chunk-W26KFY35.js +32 -0
- package/dist/chunk-W26KFY35.js.map +1 -0
- package/dist/chunk-W35X6J5P.js +232 -0
- package/dist/chunk-W35X6J5P.js.map +1 -0
- package/dist/chunk-W7I2X6VI.js +2 -0
- package/dist/chunk-W7I2X6VI.js.map +1 -0
- package/dist/chunk-W7OIVERI.js +31 -0
- package/dist/chunk-W7OIVERI.js.map +1 -0
- package/dist/chunk-WEEVXQIM.js +45 -0
- package/dist/chunk-WEEVXQIM.js.map +1 -0
- package/dist/chunk-WEM6XJ7Z.js +75 -0
- package/dist/chunk-WEM6XJ7Z.js.map +1 -0
- package/dist/chunk-WKNOKJA3.js +42 -0
- package/dist/chunk-WKNOKJA3.js.map +1 -0
- package/dist/chunk-WNIVCHDP.js +2 -0
- package/dist/chunk-WNIVCHDP.js.map +1 -0
- package/dist/chunk-WOMO5CZ7.js +2 -0
- package/dist/chunk-WOMO5CZ7.js.map +1 -0
- package/dist/chunk-WYENWW3Y.js +2 -0
- package/dist/chunk-WYENWW3Y.js.map +1 -0
- package/dist/chunk-X4FE7UKP.js +2 -0
- package/dist/chunk-X4FE7UKP.js.map +1 -0
- package/dist/chunk-XGX3UFLD.js +2 -0
- package/dist/chunk-XGX3UFLD.js.map +1 -0
- package/dist/chunk-XGXCMA5M.js +2 -0
- package/dist/chunk-XGXCMA5M.js.map +1 -0
- package/dist/chunk-XJQADN6S.js +41 -0
- package/dist/chunk-XJQADN6S.js.map +1 -0
- package/dist/chunk-XYFEQHEM.js +2 -0
- package/dist/chunk-XYFEQHEM.js.map +1 -0
- package/dist/chunk-Y33ZFTMR.js +163 -0
- package/dist/chunk-Y33ZFTMR.js.map +1 -0
- package/dist/chunk-YA2QGLUL.js +32 -0
- package/dist/chunk-YA2QGLUL.js.map +1 -0
- package/dist/chunk-YCFOFNQF.js +28 -0
- package/dist/chunk-YCFOFNQF.js.map +1 -0
- package/dist/chunk-YFGFNFVW.js +59 -0
- package/dist/chunk-YFGFNFVW.js.map +1 -0
- package/dist/chunk-YFKKMDJL.js +35 -0
- package/dist/chunk-YFKKMDJL.js.map +1 -0
- package/dist/chunk-YHVXYOL6.js +80 -0
- package/dist/chunk-YHVXYOL6.js.map +1 -0
- package/dist/chunk-YIFB24WW.js +37 -0
- package/dist/chunk-YIFB24WW.js.map +1 -0
- package/dist/chunk-YK4H7VWM.js +2 -0
- package/dist/chunk-YK4H7VWM.js.map +1 -0
- package/dist/chunk-YMFEBGTU.js +2 -0
- package/dist/chunk-YMFEBGTU.js.map +1 -0
- package/dist/chunk-YUFDC6RW.js +55 -0
- package/dist/chunk-YUFDC6RW.js.map +1 -0
- package/dist/chunk-YZVXIPBC.js +2 -0
- package/dist/chunk-YZVXIPBC.js.map +1 -0
- package/dist/chunk-Z44RRTMX.js +2 -0
- package/dist/chunk-Z44RRTMX.js.map +1 -0
- package/dist/chunk-Z4CYBG3H.js +2 -0
- package/dist/chunk-Z4CYBG3H.js.map +1 -0
- package/dist/chunk-ZALGMUSW.js +236 -0
- package/dist/chunk-ZALGMUSW.js.map +1 -0
- package/dist/chunk-ZE2H4J3P.js +2 -0
- package/dist/chunk-ZE2H4J3P.js.map +1 -0
- package/dist/chunk-ZEMTALKO.js +2 -0
- package/dist/chunk-ZEMTALKO.js.map +1 -0
- package/dist/chunk-ZFMM2NLA.js +169 -0
- package/dist/chunk-ZFMM2NLA.js.map +1 -0
- package/dist/chunk-ZI2OXD6L.js +244 -0
- package/dist/chunk-ZI2OXD6L.js.map +1 -0
- package/dist/chunk-ZRMF4YAS.js +158 -0
- package/dist/chunk-ZRMF4YAS.js.map +1 -0
- package/dist/chunk-ZSYT5H6U.js +178 -0
- package/dist/chunk-ZSYT5H6U.js.map +1 -0
- package/dist/chunk-ZXVPEQM5.js +2 -0
- package/dist/chunk-ZXVPEQM5.js.map +1 -0
- package/dist/components/accordion/accordion.js +16 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/accordion/index.js +17 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/advanced-group/advanced-group.js +18 -0
- package/dist/components/advanced-group/advanced-group.js.map +1 -0
- package/dist/components/advanced-group/index.js +18 -0
- package/dist/components/advanced-group/index.js.map +1 -0
- package/dist/components/alert/alert.js +16 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert/index.js +17 -0
- package/dist/components/alert/index.js.map +1 -0
- package/dist/components/alert-dialog/alert-dialog.js +30 -0
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/components/alert-dialog/index.js +31 -0
- package/dist/components/alert-dialog/index.js.map +1 -0
- package/dist/components/ambient-field/ambient-field.css +59 -0
- package/dist/components/ambient-field/ambient-field.css.map +1 -0
- package/dist/components/ambient-field/ambient-field.js +15 -0
- package/dist/components/ambient-field/ambient-field.js.map +1 -0
- package/dist/components/ambient-field/index.css +59 -0
- package/dist/components/ambient-field/index.css.map +1 -0
- package/dist/components/ambient-field/index.js +16 -0
- package/dist/components/ambient-field/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.js +14 -0
- package/dist/components/app-shell/app-shell.js.map +1 -0
- package/dist/components/app-shell/index.js +15 -0
- package/dist/components/app-shell/index.js.map +1 -0
- package/dist/components/app-sidebar/app-sidebar.js +31 -0
- package/dist/components/app-sidebar/app-sidebar.js.map +1 -0
- package/dist/components/app-sidebar/index.js +31 -0
- package/dist/components/app-sidebar/index.js.map +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +9 -0
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -0
- package/dist/components/aspect-ratio/index.js +10 -0
- package/dist/components/aspect-ratio/index.js.map +1 -0
- package/dist/components/attribution-panel/attribution-panel.js +24 -0
- package/dist/components/attribution-panel/attribution-panel.js.map +1 -0
- package/dist/components/attribution-panel/attribution-types.js +2 -0
- package/dist/components/attribution-panel/attribution-types.js.map +1 -0
- package/dist/components/attribution-panel/attributions.generated.js +9 -0
- package/dist/components/attribution-panel/attributions.generated.js.map +1 -0
- package/dist/components/attribution-panel/index.js +24 -0
- package/dist/components/attribution-panel/index.js.map +1 -0
- package/dist/components/avatar/avatar.js +14 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/avatar/index.js +15 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/badge.js +16 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/badge/index.js +13 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/bento-grid/bento-grid.js +16 -0
- package/dist/components/bento-grid/bento-grid.js.map +1 -0
- package/dist/components/bento-grid/index.js +16 -0
- package/dist/components/bento-grid/index.js.map +1 -0
- package/dist/components/bounded-number/bounded-number.js +24 -0
- package/dist/components/bounded-number/bounded-number.js.map +1 -0
- package/dist/components/bounded-number/index.js +24 -0
- package/dist/components/bounded-number/index.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.js +28 -0
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/breadcrumb/index.js +26 -0
- package/dist/components/breadcrumb/index.js.map +1 -0
- package/dist/components/button/button.js +12 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/index.js +13 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button-group/button-group.js +18 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/button-group/index.js +19 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/calendar.js +12 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/index.js +13 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/card/card.js +27 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/card/index.js +27 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/carousel/carousel.js +24 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/carousel/index.js +24 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/change-review/change-review.js +34 -0
- package/dist/components/change-review/change-review.js.map +1 -0
- package/dist/components/change-review/index.js +34 -0
- package/dist/components/change-review/index.js.map +1 -0
- package/dist/components/checkbox/checkbox.js +10 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/index.js +11 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/collapsible/collapsible.js +14 -0
- package/dist/components/collapsible/collapsible.js.map +1 -0
- package/dist/components/collapsible/index.js +15 -0
- package/dist/components/collapsible/index.js.map +1 -0
- package/dist/components/collapsible-panel/index.js +11 -0
- package/dist/components/collapsible-panel/index.js.map +1 -0
- package/dist/components/collapsible-panel/use-collapsible-panel.js +11 -0
- package/dist/components/collapsible-panel/use-collapsible-panel.js.map +1 -0
- package/dist/components/color-picker/color-picker.js +18 -0
- package/dist/components/color-picker/color-picker.js.map +1 -0
- package/dist/components/color-picker/index.js +18 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/combobox/combobox.js +28 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/combobox/index.js +28 -0
- package/dist/components/combobox/index.js.map +1 -0
- package/dist/components/command/command.js +39 -0
- package/dist/components/command/command.js.map +1 -0
- package/dist/components/command/index.js +39 -0
- package/dist/components/command/index.js.map +1 -0
- package/dist/components/command-chip/command-chip.js +17 -0
- package/dist/components/command-chip/command-chip.js.map +1 -0
- package/dist/components/command-chip/index.js +17 -0
- package/dist/components/command-chip/index.js.map +1 -0
- package/dist/components/command-trigger/command-trigger.js +12 -0
- package/dist/components/command-trigger/command-trigger.js.map +1 -0
- package/dist/components/command-trigger/index.js +13 -0
- package/dist/components/command-trigger/index.js.map +1 -0
- package/dist/components/confirm-dialog/confirm-dialog.js +20 -0
- package/dist/components/confirm-dialog/confirm-dialog.js.map +1 -0
- package/dist/components/confirm-dialog/index.js +20 -0
- package/dist/components/confirm-dialog/index.js.map +1 -0
- package/dist/components/context-menu/context-menu.js +36 -0
- package/dist/components/context-menu/context-menu.js.map +1 -0
- package/dist/components/context-menu/index.js +37 -0
- package/dist/components/context-menu/index.js.map +1 -0
- package/dist/components/context-rail/context-rail.js +35 -0
- package/dist/components/context-rail/context-rail.js.map +1 -0
- package/dist/components/context-rail/index.js +35 -0
- package/dist/components/context-rail/index.js.map +1 -0
- package/dist/components/copyable-value/copyable-value.js +19 -0
- package/dist/components/copyable-value/copyable-value.js.map +1 -0
- package/dist/components/copyable-value/index.js +17 -0
- package/dist/components/copyable-value/index.js.map +1 -0
- package/dist/components/date-picker/date-picker.js +21 -0
- package/dist/components/date-picker/date-picker.js.map +1 -0
- package/dist/components/date-picker/index.js +21 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/date-range-picker.js +22 -0
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -0
- package/dist/components/date-range-picker/index.js +22 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/descriptions/descriptions.js +12 -0
- package/dist/components/descriptions/descriptions.js.map +1 -0
- package/dist/components/descriptions/index.js +13 -0
- package/dist/components/descriptions/index.js.map +1 -0
- package/dist/components/dialog/dialog.js +41 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dialog/index.js +45 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/dialog/use-dialog-dismiss-guard.js +10 -0
- package/dist/components/dialog/use-dialog-dismiss-guard.js.map +1 -0
- package/dist/components/drafting-marks/drafting-marks.js +14 -0
- package/dist/components/drafting-marks/drafting-marks.js.map +1 -0
- package/dist/components/drafting-marks/index.js +15 -0
- package/dist/components/drafting-marks/index.js.map +1 -0
- package/dist/components/drawer/drawer.js +26 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/drawer/index.js +27 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +38 -0
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/dropdown-menu/index.js +39 -0
- package/dist/components/dropdown-menu/index.js.map +1 -0
- package/dist/components/empty-state/empty-state.js +15 -0
- package/dist/components/empty-state/empty-state.js.map +1 -0
- package/dist/components/empty-state/index.js +16 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/error-state/error-state.js +15 -0
- package/dist/components/error-state/error-state.js.map +1 -0
- package/dist/components/error-state/index.js +16 -0
- package/dist/components/error-state/index.js.map +1 -0
- package/dist/components/expand-dialog/expand-dialog.js +28 -0
- package/dist/components/expand-dialog/expand-dialog.js.map +1 -0
- package/dist/components/expand-dialog/index.js +28 -0
- package/dist/components/expand-dialog/index.js.map +1 -0
- package/dist/components/field/field-context.js +11 -0
- package/dist/components/field/field-context.js.map +1 -0
- package/dist/components/field/field.js +23 -0
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/field/index.js +23 -0
- package/dist/components/field/index.js.map +1 -0
- package/dist/components/field-row/field-row.js +14 -0
- package/dist/components/field-row/field-row.js.map +1 -0
- package/dist/components/field-row/index.js +14 -0
- package/dist/components/field-row/index.js.map +1 -0
- package/dist/components/file-upload/file-upload.js +28 -0
- package/dist/components/file-upload/file-upload.js.map +1 -0
- package/dist/components/file-upload/index.js +26 -0
- package/dist/components/file-upload/index.js.map +1 -0
- package/dist/components/form/form.js +27 -0
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/hover-card/hover-card.js +14 -0
- package/dist/components/hover-card/hover-card.js.map +1 -0
- package/dist/components/hover-card/index.js +15 -0
- package/dist/components/hover-card/index.js.map +1 -0
- package/dist/components/icon-button/icon-button.js +14 -0
- package/dist/components/icon-button/icon-button.js.map +1 -0
- package/dist/components/icon-button/index.js +15 -0
- package/dist/components/icon-button/index.js.map +1 -0
- package/dist/components/input/index.js +11 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input/input.js +10 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/input-group/index.js +31 -0
- package/dist/components/input-group/index.js.map +1 -0
- package/dist/components/input-group/input-group.js +30 -0
- package/dist/components/input-group/input-group.js.map +1 -0
- package/dist/components/input-otp/index.js +17 -0
- package/dist/components/input-otp/index.js.map +1 -0
- package/dist/components/input-otp/input-otp.js +17 -0
- package/dist/components/input-otp/input-otp.js.map +1 -0
- package/dist/components/install-tabs/index.js +28 -0
- package/dist/components/install-tabs/index.js.map +1 -0
- package/dist/components/install-tabs/install-tabs.js +28 -0
- package/dist/components/install-tabs/install-tabs.js.map +1 -0
- package/dist/components/integration-matrix/index.js +26 -0
- package/dist/components/integration-matrix/index.js.map +1 -0
- package/dist/components/integration-matrix/integration-matrix.js +26 -0
- package/dist/components/integration-matrix/integration-matrix.js.map +1 -0
- package/dist/components/kbd/index.js +11 -0
- package/dist/components/kbd/index.js.map +1 -0
- package/dist/components/kbd/kbd.js +10 -0
- package/dist/components/kbd/kbd.js.map +1 -0
- package/dist/components/key-value-editor/index.js +18 -0
- package/dist/components/key-value-editor/index.js.map +1 -0
- package/dist/components/key-value-editor/key-value-editor.js +18 -0
- package/dist/components/key-value-editor/key-value-editor.js.map +1 -0
- package/dist/components/keyboard-shortcuts/index.js +25 -0
- package/dist/components/keyboard-shortcuts/index.js.map +1 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.js +25 -0
- package/dist/components/keyboard-shortcuts/keyboard-shortcuts.js.map +1 -0
- package/dist/components/label/index.js +11 -0
- package/dist/components/label/index.js.map +1 -0
- package/dist/components/label/label.js +10 -0
- package/dist/components/label/label.js.map +1 -0
- package/dist/components/link-preview/index.js +14 -0
- package/dist/components/link-preview/index.js.map +1 -0
- package/dist/components/link-preview/link-preview.js +14 -0
- package/dist/components/link-preview/link-preview.js.map +1 -0
- package/dist/components/list-editor/index.js +18 -0
- package/dist/components/list-editor/index.js.map +1 -0
- package/dist/components/list-editor/list-editor.js +18 -0
- package/dist/components/list-editor/list-editor.js.map +1 -0
- package/dist/components/loading-state/index.js +16 -0
- package/dist/components/loading-state/index.js.map +1 -0
- package/dist/components/loading-state/loading-state.js +15 -0
- package/dist/components/loading-state/loading-state.js.map +1 -0
- package/dist/components/locale-provider/index.js +16 -0
- package/dist/components/locale-provider/index.js.map +1 -0
- package/dist/components/locale-provider/locale-provider.js +13 -0
- package/dist/components/locale-provider/locale-provider.js.map +1 -0
- package/dist/components/locale-provider/messages.js +10 -0
- package/dist/components/locale-provider/messages.js.map +1 -0
- package/dist/components/match-highlight/index.js +15 -0
- package/dist/components/match-highlight/index.js.map +1 -0
- package/dist/components/match-highlight/match-highlight.js +14 -0
- package/dist/components/match-highlight/match-highlight.js.map +1 -0
- package/dist/components/mention-input/index.js +46 -0
- package/dist/components/mention-input/index.js.map +1 -0
- package/dist/components/mention-input/mention-input.js +33 -0
- package/dist/components/mention-input/mention-input.js.map +1 -0
- package/dist/components/mention-input/mention-value.js +20 -0
- package/dist/components/mention-input/mention-value.js.map +1 -0
- package/dist/components/menubar/index.js +39 -0
- package/dist/components/menubar/index.js.map +1 -0
- package/dist/components/menubar/menubar.js +38 -0
- package/dist/components/menubar/menubar.js.map +1 -0
- package/dist/components/meter/index.js +15 -0
- package/dist/components/meter/index.js.map +1 -0
- package/dist/components/meter/meter.js +15 -0
- package/dist/components/meter/meter.js.map +1 -0
- package/dist/components/metric-card/index.js +24 -0
- package/dist/components/metric-card/index.js.map +1 -0
- package/dist/components/metric-card/metric-card.js +24 -0
- package/dist/components/metric-card/metric-card.js.map +1 -0
- package/dist/components/model-picker/index.js +37 -0
- package/dist/components/model-picker/index.js.map +1 -0
- package/dist/components/model-picker/model-picker-state.js +13 -0
- package/dist/components/model-picker/model-picker-state.js.map +1 -0
- package/dist/components/model-picker/model-picker.js +37 -0
- package/dist/components/model-picker/model-picker.js.map +1 -0
- package/dist/components/nav-main/index.js +33 -0
- package/dist/components/nav-main/index.js.map +1 -0
- package/dist/components/nav-main/nav-main.js +33 -0
- package/dist/components/nav-main/nav-main.js.map +1 -0
- package/dist/components/nav-notifications/index.js +20 -0
- package/dist/components/nav-notifications/index.js.map +1 -0
- package/dist/components/nav-notifications/nav-notifications.js +20 -0
- package/dist/components/nav-notifications/nav-notifications.js.map +1 -0
- package/dist/components/nav-user/index.js +35 -0
- package/dist/components/nav-user/index.js.map +1 -0
- package/dist/components/nav-user/nav-user.js +35 -0
- package/dist/components/nav-user/nav-user.js.map +1 -0
- package/dist/components/navigation-menu/index.js +25 -0
- package/dist/components/navigation-menu/index.js.map +1 -0
- package/dist/components/navigation-menu/navigation-menu.js +25 -0
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -0
- package/dist/components/number-input/index.js +22 -0
- package/dist/components/number-input/index.js.map +1 -0
- package/dist/components/number-input/number-input.js +22 -0
- package/dist/components/number-input/number-input.js.map +1 -0
- package/dist/components/page-shell/index.js +11 -0
- package/dist/components/page-shell/index.js.map +1 -0
- package/dist/components/page-shell/page-shell.js +10 -0
- package/dist/components/page-shell/page-shell.js.map +1 -0
- package/dist/components/pagination/index.js +28 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.js +28 -0
- package/dist/components/pagination/pagination.js.map +1 -0
- package/dist/components/parallax-plane/index.css +17 -0
- package/dist/components/parallax-plane/index.css.map +1 -0
- package/dist/components/parallax-plane/index.js +18 -0
- package/dist/components/parallax-plane/index.js.map +1 -0
- package/dist/components/parallax-plane/parallax-plane.css +17 -0
- package/dist/components/parallax-plane/parallax-plane.css.map +1 -0
- package/dist/components/parallax-plane/parallax-plane.js +18 -0
- package/dist/components/parallax-plane/parallax-plane.js.map +1 -0
- package/dist/components/popover/index.js +17 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/popover/popover.js +16 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/progress/index.js +13 -0
- package/dist/components/progress/index.js.map +1 -0
- package/dist/components/progress/progress.js +12 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/radio-group/index.js +13 -0
- package/dist/components/radio-group/index.js.map +1 -0
- package/dist/components/radio-group/radio-group.js +12 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/rating/index.js +11 -0
- package/dist/components/rating/index.js.map +1 -0
- package/dist/components/rating/rating.js +11 -0
- package/dist/components/rating/rating.js.map +1 -0
- package/dist/components/resizable/index.js +15 -0
- package/dist/components/resizable/index.js.map +1 -0
- package/dist/components/resizable/resizable.js +14 -0
- package/dist/components/resizable/resizable.js.map +1 -0
- package/dist/components/reveal/index.js +15 -0
- package/dist/components/reveal/index.js.map +1 -0
- package/dist/components/reveal/reveal.js +14 -0
- package/dist/components/reveal/reveal.js.map +1 -0
- package/dist/components/reveal-on-enter/index.css +21 -0
- package/dist/components/reveal-on-enter/index.css.map +1 -0
- package/dist/components/reveal-on-enter/index.js +12 -0
- package/dist/components/reveal-on-enter/index.js.map +1 -0
- package/dist/components/reveal-on-enter/reveal-on-enter.css +21 -0
- package/dist/components/reveal-on-enter/reveal-on-enter.css.map +1 -0
- package/dist/components/reveal-on-enter/reveal-on-enter.js +12 -0
- package/dist/components/reveal-on-enter/reveal-on-enter.js.map +1 -0
- package/dist/components/revision-timeline/index.js +18 -0
- package/dist/components/revision-timeline/index.js.map +1 -0
- package/dist/components/revision-timeline/revision-timeline.js +18 -0
- package/dist/components/revision-timeline/revision-timeline.js.map +1 -0
- package/dist/components/schema-form/from-json-schema.js +13 -0
- package/dist/components/schema-form/from-json-schema.js.map +1 -0
- package/dist/components/schema-form/index.js +140 -0
- package/dist/components/schema-form/index.js.map +1 -0
- package/dist/components/schema-form/schema-form-spec.js +63 -0
- package/dist/components/schema-form/schema-form-spec.js.map +1 -0
- package/dist/components/schema-form/schema-form-store.js +21 -0
- package/dist/components/schema-form/schema-form-store.js.map +1 -0
- package/dist/components/schema-form/schema-form.js +77 -0
- package/dist/components/schema-form/schema-form.js.map +1 -0
- package/dist/components/scroll-area/index.js +13 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.js +12 -0
- package/dist/components/scroll-area/scroll-area.js.map +1 -0
- package/dist/components/section-header/index.js +11 -0
- package/dist/components/section-header/index.js.map +1 -0
- package/dist/components/section-header/section-header.js +10 -0
- package/dist/components/section-header/section-header.js.map +1 -0
- package/dist/components/segmented-field/index.js +17 -0
- package/dist/components/segmented-field/index.js.map +1 -0
- package/dist/components/segmented-field/segmented-field.js +17 -0
- package/dist/components/segmented-field/segmented-field.js.map +1 -0
- package/dist/components/select/index.js +26 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/select/select.js +26 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/separator/index.js +11 -0
- package/dist/components/separator/index.js.map +1 -0
- package/dist/components/separator/separator.js +10 -0
- package/dist/components/separator/separator.js.map +1 -0
- package/dist/components/sheet/index.js +30 -0
- package/dist/components/sheet/index.js.map +1 -0
- package/dist/components/sheet/sheet.js +30 -0
- package/dist/components/sheet/sheet.js.map +1 -0
- package/dist/components/side-dock/index.js +20 -0
- package/dist/components/side-dock/index.js.map +1 -0
- package/dist/components/side-dock/side-dock.js +20 -0
- package/dist/components/side-dock/side-dock.js.map +1 -0
- package/dist/components/sidebar/index.js +77 -0
- package/dist/components/sidebar/index.js.map +1 -0
- package/dist/components/sidebar/sidebar.js +77 -0
- package/dist/components/sidebar/sidebar.js.map +1 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/skeleton/index.js.map +1 -0
- package/dist/components/skeleton/skeleton.js +10 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/skip-link/index.js +11 -0
- package/dist/components/skip-link/index.js.map +1 -0
- package/dist/components/skip-link/skip-link.js +10 -0
- package/dist/components/skip-link/skip-link.js.map +1 -0
- package/dist/components/slider/index.js +11 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/slider/slider.js +10 -0
- package/dist/components/slider/slider.js.map +1 -0
- package/dist/components/slider-number/index.js +26 -0
- package/dist/components/slider-number/index.js.map +1 -0
- package/dist/components/slider-number/slider-number.js +26 -0
- package/dist/components/slider-number/slider-number.js.map +1 -0
- package/dist/components/sonner/index.js +13 -0
- package/dist/components/sonner/index.js.map +1 -0
- package/dist/components/sonner/sonner.js +13 -0
- package/dist/components/sonner/sonner.js.map +1 -0
- package/dist/components/spec-playground/index.js +23 -0
- package/dist/components/spec-playground/index.js.map +1 -0
- package/dist/components/spec-playground/locate-json-path.js +17 -0
- package/dist/components/spec-playground/locate-json-path.js.map +1 -0
- package/dist/components/spec-playground/spec-playground.js +23 -0
- package/dist/components/spec-playground/spec-playground.js.map +1 -0
- package/dist/components/spinner/index.js +14 -0
- package/dist/components/spinner/index.js.map +1 -0
- package/dist/components/spinner/spinner.js +14 -0
- package/dist/components/spinner/spinner.js.map +1 -0
- package/dist/components/split-panel/index.js +13 -0
- package/dist/components/split-panel/index.js.map +1 -0
- package/dist/components/split-panel/split-panel.js +12 -0
- package/dist/components/split-panel/split-panel.js.map +1 -0
- package/dist/components/state-panel/index.js +17 -0
- package/dist/components/state-panel/index.js.map +1 -0
- package/dist/components/state-panel/state-panel.js +17 -0
- package/dist/components/state-panel/state-panel.js.map +1 -0
- package/dist/components/status-badge/index.js +30 -0
- package/dist/components/status-badge/index.js.map +1 -0
- package/dist/components/status-badge/status-badge.js +29 -0
- package/dist/components/status-badge/status-badge.js.map +1 -0
- package/dist/components/surface-tour/index.css +21 -0
- package/dist/components/surface-tour/index.css.map +1 -0
- package/dist/components/surface-tour/index.js +36 -0
- package/dist/components/surface-tour/index.js.map +1 -0
- package/dist/components/surface-tour/surface-tour.css +21 -0
- package/dist/components/surface-tour/surface-tour.css.map +1 -0
- package/dist/components/surface-tour/surface-tour.js +36 -0
- package/dist/components/surface-tour/surface-tour.js.map +1 -0
- package/dist/components/switch/index.js +11 -0
- package/dist/components/switch/index.js.map +1 -0
- package/dist/components/switch/switch.js +10 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/index.js +28 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/table.js +28 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/index.js +22 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs/tabs.js +22 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/tag-input/index.js +21 -0
- package/dist/components/tag-input/index.js.map +1 -0
- package/dist/components/tag-input/tag-input.js +21 -0
- package/dist/components/tag-input/tag-input.js.map +1 -0
- package/dist/components/team-switcher/index.js +33 -0
- package/dist/components/team-switcher/index.js.map +1 -0
- package/dist/components/team-switcher/team-switcher.js +33 -0
- package/dist/components/team-switcher/team-switcher.js.map +1 -0
- package/dist/components/textarea/index.js +11 -0
- package/dist/components/textarea/index.js.map +1 -0
- package/dist/components/textarea/textarea.js +10 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/theme-family-switch/index.js +19 -0
- package/dist/components/theme-family-switch/index.js.map +1 -0
- package/dist/components/theme-family-switch/theme-family-switch.js +19 -0
- package/dist/components/theme-family-switch/theme-family-switch.js.map +1 -0
- package/dist/components/theme-switcher/index.js +24 -0
- package/dist/components/theme-switcher/index.js.map +1 -0
- package/dist/components/theme-switcher/theme-switcher.js +21 -0
- package/dist/components/theme-switcher/theme-switcher.js.map +1 -0
- package/dist/components/theme-switcher/use-theme-transition.js +10 -0
- package/dist/components/theme-switcher/use-theme-transition.js.map +1 -0
- package/dist/components/timeline/index.js +18 -0
- package/dist/components/timeline/index.js.map +1 -0
- package/dist/components/timeline/timeline.js +19 -0
- package/dist/components/timeline/timeline.js.map +1 -0
- package/dist/components/toggle/index.js +13 -0
- package/dist/components/toggle/index.js.map +1 -0
- package/dist/components/toggle/toggle.js +12 -0
- package/dist/components/toggle/toggle.js.map +1 -0
- package/dist/components/toggle-group/index.js +15 -0
- package/dist/components/toggle-group/index.js.map +1 -0
- package/dist/components/toggle-group/toggle-group.js +15 -0
- package/dist/components/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/token-spotlight/index.css +25 -0
- package/dist/components/token-spotlight/index.css.map +1 -0
- package/dist/components/token-spotlight/index.js +23 -0
- package/dist/components/token-spotlight/index.js.map +1 -0
- package/dist/components/token-spotlight/token-spotlight.css +25 -0
- package/dist/components/token-spotlight/token-spotlight.css.map +1 -0
- package/dist/components/token-spotlight/token-spotlight.js +23 -0
- package/dist/components/token-spotlight/token-spotlight.js.map +1 -0
- package/dist/components/token-spotlight/token-value-format.js +11 -0
- package/dist/components/token-spotlight/token-value-format.js.map +1 -0
- package/dist/components/toolbar/index.js +27 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/components/toolbar/toolbar.js +27 -0
- package/dist/components/toolbar/toolbar.js.map +1 -0
- package/dist/components/tooltip/index.js +17 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tooltip/tooltip.js +16 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/top-nav/index.js +11 -0
- package/dist/components/top-nav/index.js.map +1 -0
- package/dist/components/top-nav/top-nav.js +10 -0
- package/dist/components/top-nav/top-nav.js.map +1 -0
- package/dist/components/transfer/index.js +26 -0
- package/dist/components/transfer/index.js.map +1 -0
- package/dist/components/transfer/transfer.js +26 -0
- package/dist/components/transfer/transfer.js.map +1 -0
- package/dist/components/tree/index.js +21 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree.js +18 -0
- package/dist/components/tree/tree.js.map +1 -0
- package/dist/components/tree/use-tree-keyboard.js +14 -0
- package/dist/components/tree/use-tree-keyboard.js.map +1 -0
- package/dist/components/tree-select/index.js +26 -0
- package/dist/components/tree-select/index.js.map +1 -0
- package/dist/components/tree-select/tree-select.js +26 -0
- package/dist/components/tree-select/tree-select.js.map +1 -0
- package/dist/components/typography/index.js +41 -0
- package/dist/components/typography/index.js.map +1 -0
- package/dist/components/typography/prose.js +29 -0
- package/dist/components/typography/prose.js.map +1 -0
- package/dist/components/typography/typography.js +18 -0
- package/dist/components/typography/typography.js.map +1 -0
- package/dist/components/view-toolbar/index.js +27 -0
- package/dist/components/view-toolbar/index.js.map +1 -0
- package/dist/components/view-toolbar/view-toolbar.js +27 -0
- package/dist/components/view-toolbar/view-toolbar.js.map +1 -0
- package/dist/components/virtual-select/index.js +26 -0
- package/dist/components/virtual-select/index.js.map +1 -0
- package/dist/components/virtual-select/use-virtual-listbox.js +10 -0
- package/dist/components/virtual-select/use-virtual-listbox.js.map +1 -0
- package/dist/components/virtual-select/virtual-select.js +23 -0
- package/dist/components/virtual-select/virtual-select.js.map +1 -0
- package/dist/components/wizard/index.js +19 -0
- package/dist/components/wizard/index.js.map +1 -0
- package/dist/components/wizard/wizard.js +19 -0
- package/dist/components/wizard/wizard.js.map +1 -0
- package/dist/components/workspace-picker/index.js +38 -0
- package/dist/components/workspace-picker/index.js.map +1 -0
- package/dist/components/workspace-picker/workspace-picker-state.js +9 -0
- package/dist/components/workspace-picker/workspace-picker-state.js.map +1 -0
- package/dist/components/workspace-picker/workspace-picker.js +35 -0
- package/dist/components/workspace-picker/workspace-picker.js.map +1 -0
- package/dist/form.js +13 -110
- package/dist/form.js.map +1 -1
- package/dist/illustrations/empty-list-illustration.js +11 -0
- package/dist/illustrations/empty-list-illustration.js.map +1 -0
- package/dist/illustrations/error-illustration.js +11 -0
- package/dist/illustrations/error-illustration.js.map +1 -0
- package/dist/illustrations/first-run-illustration.js +11 -0
- package/dist/illustrations/first-run-illustration.js.map +1 -0
- package/dist/illustrations/illustration-base.js +16 -0
- package/dist/illustrations/illustration-base.js.map +1 -0
- package/dist/illustrations/index.js +41 -0
- package/dist/illustrations/index.js.map +1 -0
- package/dist/illustrations/no-access-illustration.js +11 -0
- package/dist/illustrations/no-access-illustration.js.map +1 -0
- package/dist/illustrations/no-results-illustration.js +11 -0
- package/dist/illustrations/no-results-illustration.js.map +1 -0
- package/dist/illustrations/offline-illustration.js +11 -0
- package/dist/illustrations/offline-illustration.js.map +1 -0
- package/dist/illustrations/success-illustration.js +11 -0
- package/dist/illustrations/success-illustration.js.map +1 -0
- package/dist/index.css +122 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +1312 -119
- package/dist/index.js +1002 -23939
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-event-model.js +9 -0
- package/dist/lib/agent-event-model.js.map +1 -0
- package/dist/lib/approval-option.js +9 -0
- package/dist/lib/approval-option.js.map +1 -0
- package/dist/lib/check-result.js +3 -0
- package/dist/lib/check-result.js.map +1 -0
- package/dist/lib/cn.js +30 -7
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/color-scale.js +11 -0
- package/dist/lib/color-scale.js.map +1 -0
- package/dist/lib/compact-number.js +21 -0
- package/dist/lib/compact-number.js.map +1 -0
- package/dist/lib/csv.js +11 -0
- package/dist/lib/csv.js.map +1 -0
- package/dist/lib/diff-line.js +11 -0
- package/dist/lib/diff-line.js.map +1 -0
- package/dist/lib/diff-rows.js +12 -0
- package/dist/lib/diff-rows.js.map +1 -0
- package/dist/lib/document-address.js +13 -0
- package/dist/lib/document-address.js.map +1 -0
- package/dist/lib/download.js +11 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/file-icon.js +12 -0
- package/dist/lib/file-icon.js.map +1 -0
- package/dist/lib/file-kind.js +13 -0
- package/dist/lib/file-kind.js.map +1 -0
- package/dist/lib/file-source.js +10 -0
- package/dist/lib/file-source.js.map +1 -0
- package/dist/lib/format-duration.js +9 -0
- package/dist/lib/format-duration.js.map +1 -0
- package/dist/lib/has-renderable-content.js +9 -0
- package/dist/lib/has-renderable-content.js.map +1 -0
- package/dist/lib/merge-refs.js +10 -0
- package/dist/lib/merge-refs.js.map +1 -0
- package/dist/lib/operating-mode.js +9 -0
- package/dist/lib/operating-mode.js.map +1 -0
- package/dist/lib/optional-peer.js +11 -0
- package/dist/lib/optional-peer.js.map +1 -0
- package/dist/lib/session-launch.js +3 -0
- package/dist/lib/session-launch.js.map +1 -0
- package/dist/lib/slash-command.js +11 -0
- package/dist/lib/slash-command.js.map +1 -0
- package/dist/lib/streamdown-translations.js +15 -0
- package/dist/lib/streamdown-translations.js.map +1 -0
- package/dist/lib/trigger-query.js +11 -0
- package/dist/lib/trigger-query.js.map +1 -0
- package/dist/lib/use-controllable-state.js +10 -0
- package/dist/lib/use-controllable-state.js.map +1 -0
- package/dist/lib/use-copy-to-clipboard.js +12 -0
- package/dist/lib/use-copy-to-clipboard.js.map +1 -0
- package/dist/lib/use-mobile.js +10 -0
- package/dist/lib/use-mobile.js.map +1 -0
- package/dist/lib/use-scroll-progress.js +18 -0
- package/dist/lib/use-scroll-progress.js.map +1 -0
- package/package.json +13 -6
- package/src/__contract__/ambient-field.contract.test.tsx +49 -0
- package/src/__contract__/command-chip.contract.test.tsx +49 -0
- package/src/__contract__/install-tabs.contract.test.tsx +49 -0
- package/src/__contract__/integration-matrix.contract.test.tsx +49 -0
- package/src/__contract__/meter.contract.test.tsx +49 -0
- package/src/__contract__/parallax-plane.contract.test.tsx +49 -0
- package/src/__contract__/reveal-on-enter.contract.test.tsx +49 -0
- package/src/__contract__/spec-playground.contract.test.tsx +49 -0
- package/src/__contract__/surface-tour.contract.test.tsx +49 -0
- package/src/__contract__/theme-family-switch.contract.test.tsx +49 -0
- package/src/__contract__/token-spotlight.contract.test.tsx +49 -0
- package/src/blocks-comparison-table.stories.tsx +1 -1
- package/src/components/accordion/accordion.tsx +31 -15
- package/src/components/advanced-group/advanced-group.stories.tsx +2 -0
- package/src/components/alert/alert.tsx +13 -5
- package/src/components/alert-dialog/alert-dialog.tsx +1 -1
- package/src/components/ambient-field/ambient-field.css +98 -0
- package/src/components/ambient-field/ambient-field.stories.tsx +75 -0
- package/src/components/ambient-field/ambient-field.test.tsx +28 -0
- package/src/components/ambient-field/ambient-field.tsx +69 -0
- package/src/components/ambient-field/index.ts +7 -0
- package/src/components/app-shell/app-shell.stories.tsx +344 -1
- package/src/components/app-shell/app-shell.test.tsx +167 -0
- package/src/components/app-shell/app-shell.tsx +119 -5
- package/src/components/app-shell/index.ts +1 -1
- package/src/components/attribution-panel/attributions.generated.ts +77 -4
- package/src/components/badge/badge.stories.tsx +62 -0
- package/src/components/badge/badge.test.tsx +21 -0
- package/src/components/badge/badge.tsx +88 -8
- package/src/components/breadcrumb/breadcrumb.stories.tsx +1 -1
- package/src/components/breadcrumb/breadcrumb.tsx +2 -0
- package/src/components/button/button.stories.tsx +5 -1
- package/src/components/button/button.tsx +19 -8
- package/src/components/calendar/calendar.tsx +6 -1
- package/src/components/card/card.stories.tsx +73 -1
- package/src/components/card/card.test.tsx +29 -2
- package/src/components/card/card.tsx +77 -13
- package/src/components/card/index.ts +2 -0
- package/src/components/change-review/change-review.tsx +1 -1
- package/src/components/collapsible-panel/index.ts +1 -0
- package/src/components/collapsible-panel/use-collapsible-panel.ts +21 -2
- package/src/components/color-picker/color-picker.tsx +3 -3
- package/src/components/command/command.stories.tsx +64 -1
- package/src/components/command/command.test.tsx +73 -0
- package/src/components/command/command.tsx +73 -2
- package/src/components/command-chip/command-chip.stories.tsx +78 -0
- package/src/components/command-chip/command-chip.test.tsx +57 -0
- package/src/components/command-chip/command-chip.tsx +168 -0
- package/src/components/command-chip/index.ts +7 -0
- package/src/components/command-trigger/command-trigger.tsx +1 -1
- package/src/components/confirm-dialog/confirm-dialog.stories.tsx +2 -0
- package/src/components/context-menu/context-menu.stories.tsx +26 -0
- package/src/components/context-menu/context-menu.tsx +6 -6
- package/src/components/context-rail/context-rail.tsx +22 -4
- package/src/components/date-picker/date-picker.tsx +2 -0
- package/src/components/descriptions/descriptions.stories.tsx +6 -0
- package/src/components/descriptions/descriptions.test.tsx +18 -0
- package/src/components/descriptions/descriptions.tsx +33 -5
- package/src/components/descriptions/index.ts +1 -0
- package/src/components/dialog/dialog.stories.tsx +5 -0
- package/src/components/dialog/dialog.tsx +1 -1
- package/src/components/drafting-marks/drafting-marks.stories.tsx +88 -0
- package/src/components/drafting-marks/drafting-marks.test.tsx +55 -0
- package/src/components/drafting-marks/drafting-marks.tsx +120 -0
- package/src/components/drafting-marks/index.ts +7 -0
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +37 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +14 -6
- package/src/components/expand-dialog/expand-dialog.test.tsx +47 -0
- package/src/components/expand-dialog/expand-dialog.tsx +20 -5
- package/src/components/hover-card/hover-card.tsx +1 -1
- package/src/components/input/input.stories.tsx +17 -0
- package/src/components/input/input.tsx +1 -1
- package/src/components/input-group/input-group.stories.tsx +43 -6
- package/src/components/input-group/input-group.tsx +5 -2
- package/src/components/input-otp/input-otp.tsx +4 -2
- package/src/components/install-tabs/index.ts +8 -0
- package/src/components/install-tabs/install-tabs.stories.tsx +147 -0
- package/src/components/install-tabs/install-tabs.test.tsx +120 -0
- package/src/components/install-tabs/install-tabs.tsx +238 -0
- package/src/components/integration-matrix/index.ts +10 -0
- package/src/components/integration-matrix/integration-matrix.stories.tsx +171 -0
- package/src/components/integration-matrix/integration-matrix.test.tsx +89 -0
- package/src/components/integration-matrix/integration-matrix.tsx +237 -0
- package/src/components/locale-provider/messages.ts +252 -0
- package/src/components/mention-input/mention-input.tsx +1 -1
- package/src/components/menubar/menubar.stories.tsx +25 -0
- package/src/components/menubar/menubar.tsx +7 -7
- package/src/components/meter/index.ts +1 -0
- package/src/components/meter/meter.stories.tsx +102 -0
- package/src/components/meter/meter.test.tsx +61 -0
- package/src/components/meter/meter.tsx +173 -0
- package/src/components/metric-card/index.ts +6 -1
- package/src/components/metric-card/metric-card.stories.tsx +63 -0
- package/src/components/metric-card/metric-card.test.tsx +83 -0
- package/src/components/metric-card/metric-card.tsx +97 -14
- package/src/components/nav-user/nav-user.test.tsx +23 -1
- package/src/components/nav-user/nav-user.tsx +68 -53
- package/src/components/navigation-menu/navigation-menu.stories.tsx +42 -0
- package/src/components/navigation-menu/navigation-menu.tsx +1 -1
- package/src/components/page-shell/page-shell.stories.tsx +1 -1
- package/src/components/page-shell/page-shell.tsx +3 -2
- package/src/components/pagination/pagination.tsx +2 -0
- package/src/components/parallax-plane/index.ts +8 -0
- package/src/components/parallax-plane/parallax-plane.css +26 -0
- package/src/components/parallax-plane/parallax-plane.stories.tsx +88 -0
- package/src/components/parallax-plane/parallax-plane.test.tsx +57 -0
- package/src/components/parallax-plane/parallax-plane.tsx +80 -0
- package/src/components/popover/popover.tsx +1 -1
- package/src/components/progress/progress.stories.tsx +85 -0
- package/src/components/progress/progress.test.tsx +47 -0
- package/src/components/progress/progress.tsx +57 -3
- package/src/components/reveal-on-enter/index.ts +5 -0
- package/src/components/reveal-on-enter/reveal-on-enter.css +32 -0
- package/src/components/reveal-on-enter/reveal-on-enter.stories.tsx +100 -0
- package/src/components/reveal-on-enter/reveal-on-enter.test.tsx +87 -0
- package/src/components/reveal-on-enter/reveal-on-enter.tsx +75 -0
- package/src/components/revision-timeline/revision-timeline.tsx +1 -3
- package/src/components/schema-form/index.ts +2 -0
- package/src/components/schema-form/schema-form-spec.ts +36 -0
- package/src/components/schema-form/schema-form.stories.tsx +33 -0
- package/src/components/schema-form/schema-form.test.tsx +43 -0
- package/src/components/schema-form/schema-form.tsx +111 -4
- package/src/components/scroll-area/index.ts +1 -1
- package/src/components/scroll-area/scroll-area.tsx +47 -18
- package/src/components/section-header/section-header.stories.tsx +23 -0
- package/src/components/section-header/section-header.tsx +27 -9
- package/src/components/select/select.stories.tsx +17 -0
- package/src/components/select/select.test.tsx +28 -1
- package/src/components/select/select.tsx +3 -3
- package/src/components/sheet/sheet.tsx +1 -1
- package/src/components/side-dock/side-dock.stories.tsx +83 -0
- package/src/components/side-dock/side-dock.tsx +50 -16
- package/src/components/sidebar/sidebar.stories.tsx +3 -3
- package/src/components/sidebar/sidebar.test.tsx +31 -1
- package/src/components/sidebar/sidebar.tsx +40 -8
- package/src/components/skip-link/skip-link.stories.tsx +1 -0
- package/src/components/slider/slider.stories.tsx +13 -77
- package/src/components/spec-playground/index.ts +10 -0
- package/src/components/spec-playground/locate-json-path.ts +144 -0
- package/src/components/spec-playground/spec-playground.stories.tsx +156 -0
- package/src/components/spec-playground/spec-playground.test.tsx +106 -0
- package/src/components/spec-playground/spec-playground.tsx +351 -0
- package/src/components/state-panel/state-panel.stories.tsx +4 -2
- package/src/components/state-panel/state-panel.tsx +1 -1
- package/src/components/status-badge/status-badge.stories.tsx +53 -0
- package/src/components/status-badge/status-badge.test.tsx +37 -0
- package/src/components/status-badge/status-badge.tsx +75 -13
- package/src/components/surface-tour/index.ts +11 -0
- package/src/components/surface-tour/surface-tour.stories.tsx +150 -0
- package/src/components/surface-tour/surface-tour.test.tsx +117 -0
- package/src/components/surface-tour/surface-tour.tsx +456 -0
- package/src/components/table/table.tsx +5 -2
- package/src/components/tabs/tabs.stories.tsx +47 -1
- package/src/components/tabs/tabs.test.tsx +26 -0
- package/src/components/tabs/tabs.tsx +51 -11
- package/src/components/textarea/textarea.tsx +1 -1
- package/src/components/theme-family-switch/index.ts +10 -0
- package/src/components/theme-family-switch/theme-family-switch.stories.tsx +97 -0
- package/src/components/theme-family-switch/theme-family-switch.test.tsx +85 -0
- package/src/components/theme-family-switch/theme-family-switch.tsx +166 -0
- package/src/components/theme-switcher/theme-switcher.tsx +11 -4
- package/src/components/token-spotlight/index.ts +11 -0
- package/src/components/token-spotlight/token-spotlight.css +32 -0
- package/src/components/token-spotlight/token-spotlight.stories.tsx +161 -0
- package/src/components/token-spotlight/token-spotlight.test.tsx +323 -0
- package/src/components/token-spotlight/token-spotlight.tsx +379 -0
- package/src/components/token-spotlight/token-value-format.ts +205 -0
- package/src/components/top-nav/top-nav.test.tsx +59 -0
- package/src/components/top-nav/top-nav.tsx +36 -6
- package/src/components/tree/tree.stories.tsx +1 -1
- package/src/components/tree/tree.test.tsx +4 -4
- package/src/components/tree/tree.tsx +4 -4
- package/src/components/typography/typography.stories.tsx +7 -2
- package/src/components/typography/typography.tsx +8 -0
- package/src/components/view-toolbar/view-toolbar.stories.tsx +2 -1
- package/src/components/view-toolbar/view-toolbar.tsx +2 -2
- package/src/decoration.stories.tsx +243 -2
- package/src/index.ts +47 -0
- package/src/lib/cn.test.ts +49 -0
- package/src/lib/cn.ts +39 -7
- package/src/lib/color-scale.test.ts +386 -0
- package/src/lib/color-scale.ts +628 -0
- package/src/lib/compact-number.ts +118 -28
- package/src/lib/use-scroll-progress.ts +103 -0
- package/src/motion.stories.tsx +1 -0
- package/src/templates-object-detail-hub.stories.tsx +8 -8
- package/src/templates-screen-states.stories.tsx +1 -1
- package/src/templates-settings.stories.tsx +8 -3
- package/dist/chunk-FCH4ZN6G.js +0 -57
- package/dist/chunk-FCH4ZN6G.js.map +0 -1
|
@@ -0,0 +1,4483 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__export
|
|
4
|
+
} from "./chunk-DCHYNTHI.js";
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
7
|
+
var external_exports = {};
|
|
8
|
+
__export(external_exports, {
|
|
9
|
+
BRAND: () => BRAND,
|
|
10
|
+
DIRTY: () => DIRTY,
|
|
11
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
12
|
+
INVALID: () => INVALID,
|
|
13
|
+
NEVER: () => NEVER,
|
|
14
|
+
OK: () => OK,
|
|
15
|
+
ParseStatus: () => ParseStatus,
|
|
16
|
+
Schema: () => ZodType,
|
|
17
|
+
ZodAny: () => ZodAny,
|
|
18
|
+
ZodArray: () => ZodArray,
|
|
19
|
+
ZodBigInt: () => ZodBigInt,
|
|
20
|
+
ZodBoolean: () => ZodBoolean,
|
|
21
|
+
ZodBranded: () => ZodBranded,
|
|
22
|
+
ZodCatch: () => ZodCatch,
|
|
23
|
+
ZodDate: () => ZodDate,
|
|
24
|
+
ZodDefault: () => ZodDefault,
|
|
25
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
26
|
+
ZodEffects: () => ZodEffects,
|
|
27
|
+
ZodEnum: () => ZodEnum,
|
|
28
|
+
ZodError: () => ZodError,
|
|
29
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
30
|
+
ZodFunction: () => ZodFunction,
|
|
31
|
+
ZodIntersection: () => ZodIntersection,
|
|
32
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
33
|
+
ZodLazy: () => ZodLazy,
|
|
34
|
+
ZodLiteral: () => ZodLiteral,
|
|
35
|
+
ZodMap: () => ZodMap,
|
|
36
|
+
ZodNaN: () => ZodNaN,
|
|
37
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
38
|
+
ZodNever: () => ZodNever,
|
|
39
|
+
ZodNull: () => ZodNull,
|
|
40
|
+
ZodNullable: () => ZodNullable,
|
|
41
|
+
ZodNumber: () => ZodNumber,
|
|
42
|
+
ZodObject: () => ZodObject,
|
|
43
|
+
ZodOptional: () => ZodOptional,
|
|
44
|
+
ZodParsedType: () => ZodParsedType,
|
|
45
|
+
ZodPipeline: () => ZodPipeline,
|
|
46
|
+
ZodPromise: () => ZodPromise,
|
|
47
|
+
ZodReadonly: () => ZodReadonly,
|
|
48
|
+
ZodRecord: () => ZodRecord,
|
|
49
|
+
ZodSchema: () => ZodType,
|
|
50
|
+
ZodSet: () => ZodSet,
|
|
51
|
+
ZodString: () => ZodString,
|
|
52
|
+
ZodSymbol: () => ZodSymbol,
|
|
53
|
+
ZodTransformer: () => ZodEffects,
|
|
54
|
+
ZodTuple: () => ZodTuple,
|
|
55
|
+
ZodType: () => ZodType,
|
|
56
|
+
ZodUndefined: () => ZodUndefined,
|
|
57
|
+
ZodUnion: () => ZodUnion,
|
|
58
|
+
ZodUnknown: () => ZodUnknown,
|
|
59
|
+
ZodVoid: () => ZodVoid,
|
|
60
|
+
addIssueToContext: () => addIssueToContext,
|
|
61
|
+
any: () => anyType,
|
|
62
|
+
array: () => arrayType,
|
|
63
|
+
bigint: () => bigIntType,
|
|
64
|
+
boolean: () => booleanType,
|
|
65
|
+
coerce: () => coerce,
|
|
66
|
+
custom: () => custom,
|
|
67
|
+
date: () => dateType,
|
|
68
|
+
datetimeRegex: () => datetimeRegex,
|
|
69
|
+
defaultErrorMap: () => en_default,
|
|
70
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
71
|
+
effect: () => effectsType,
|
|
72
|
+
enum: () => enumType,
|
|
73
|
+
function: () => functionType,
|
|
74
|
+
getErrorMap: () => getErrorMap,
|
|
75
|
+
getParsedType: () => getParsedType,
|
|
76
|
+
instanceof: () => instanceOfType,
|
|
77
|
+
intersection: () => intersectionType,
|
|
78
|
+
isAborted: () => isAborted,
|
|
79
|
+
isAsync: () => isAsync,
|
|
80
|
+
isDirty: () => isDirty,
|
|
81
|
+
isValid: () => isValid,
|
|
82
|
+
late: () => late,
|
|
83
|
+
lazy: () => lazyType,
|
|
84
|
+
literal: () => literalType,
|
|
85
|
+
makeIssue: () => makeIssue,
|
|
86
|
+
map: () => mapType,
|
|
87
|
+
nan: () => nanType,
|
|
88
|
+
nativeEnum: () => nativeEnumType,
|
|
89
|
+
never: () => neverType,
|
|
90
|
+
null: () => nullType,
|
|
91
|
+
nullable: () => nullableType,
|
|
92
|
+
number: () => numberType,
|
|
93
|
+
object: () => objectType,
|
|
94
|
+
objectUtil: () => objectUtil,
|
|
95
|
+
oboolean: () => oboolean,
|
|
96
|
+
onumber: () => onumber,
|
|
97
|
+
optional: () => optionalType,
|
|
98
|
+
ostring: () => ostring,
|
|
99
|
+
pipeline: () => pipelineType,
|
|
100
|
+
preprocess: () => preprocessType,
|
|
101
|
+
promise: () => promiseType,
|
|
102
|
+
quotelessJson: () => quotelessJson,
|
|
103
|
+
record: () => recordType,
|
|
104
|
+
set: () => setType,
|
|
105
|
+
setErrorMap: () => setErrorMap,
|
|
106
|
+
strictObject: () => strictObjectType,
|
|
107
|
+
string: () => stringType,
|
|
108
|
+
symbol: () => symbolType,
|
|
109
|
+
transformer: () => effectsType,
|
|
110
|
+
tuple: () => tupleType,
|
|
111
|
+
undefined: () => undefinedType,
|
|
112
|
+
union: () => unionType,
|
|
113
|
+
unknown: () => unknownType,
|
|
114
|
+
util: () => util,
|
|
115
|
+
void: () => voidType
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
119
|
+
var util;
|
|
120
|
+
(function(util2) {
|
|
121
|
+
util2.assertEqual = (_) => {
|
|
122
|
+
};
|
|
123
|
+
function assertIs(_arg) {
|
|
124
|
+
}
|
|
125
|
+
util2.assertIs = assertIs;
|
|
126
|
+
function assertNever(_x) {
|
|
127
|
+
throw new Error();
|
|
128
|
+
}
|
|
129
|
+
util2.assertNever = assertNever;
|
|
130
|
+
util2.arrayToEnum = (items) => {
|
|
131
|
+
const obj = {};
|
|
132
|
+
for (const item of items) {
|
|
133
|
+
obj[item] = item;
|
|
134
|
+
}
|
|
135
|
+
return obj;
|
|
136
|
+
};
|
|
137
|
+
util2.getValidEnumValues = (obj) => {
|
|
138
|
+
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
139
|
+
const filtered = {};
|
|
140
|
+
for (const k of validKeys) {
|
|
141
|
+
filtered[k] = obj[k];
|
|
142
|
+
}
|
|
143
|
+
return util2.objectValues(filtered);
|
|
144
|
+
};
|
|
145
|
+
util2.objectValues = (obj) => {
|
|
146
|
+
return util2.objectKeys(obj).map(function(e) {
|
|
147
|
+
return obj[e];
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
|
|
151
|
+
const keys = [];
|
|
152
|
+
for (const key in object) {
|
|
153
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
154
|
+
keys.push(key);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return keys;
|
|
158
|
+
};
|
|
159
|
+
util2.find = (arr, checker) => {
|
|
160
|
+
for (const item of arr) {
|
|
161
|
+
if (checker(item))
|
|
162
|
+
return item;
|
|
163
|
+
}
|
|
164
|
+
return void 0;
|
|
165
|
+
};
|
|
166
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
167
|
+
function joinValues(array, separator = " | ") {
|
|
168
|
+
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
169
|
+
}
|
|
170
|
+
util2.joinValues = joinValues;
|
|
171
|
+
util2.jsonStringifyReplacer = (_, value) => {
|
|
172
|
+
if (typeof value === "bigint") {
|
|
173
|
+
return value.toString();
|
|
174
|
+
}
|
|
175
|
+
return value;
|
|
176
|
+
};
|
|
177
|
+
})(util || (util = {}));
|
|
178
|
+
var objectUtil;
|
|
179
|
+
(function(objectUtil2) {
|
|
180
|
+
objectUtil2.mergeShapes = (first, second) => {
|
|
181
|
+
return {
|
|
182
|
+
...first,
|
|
183
|
+
...second
|
|
184
|
+
// second overwrites first
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
})(objectUtil || (objectUtil = {}));
|
|
188
|
+
var ZodParsedType = util.arrayToEnum([
|
|
189
|
+
"string",
|
|
190
|
+
"nan",
|
|
191
|
+
"number",
|
|
192
|
+
"integer",
|
|
193
|
+
"float",
|
|
194
|
+
"boolean",
|
|
195
|
+
"date",
|
|
196
|
+
"bigint",
|
|
197
|
+
"symbol",
|
|
198
|
+
"function",
|
|
199
|
+
"undefined",
|
|
200
|
+
"null",
|
|
201
|
+
"array",
|
|
202
|
+
"object",
|
|
203
|
+
"unknown",
|
|
204
|
+
"promise",
|
|
205
|
+
"void",
|
|
206
|
+
"never",
|
|
207
|
+
"map",
|
|
208
|
+
"set"
|
|
209
|
+
]);
|
|
210
|
+
var getParsedType = (data) => {
|
|
211
|
+
const t = typeof data;
|
|
212
|
+
switch (t) {
|
|
213
|
+
case "undefined":
|
|
214
|
+
return ZodParsedType.undefined;
|
|
215
|
+
case "string":
|
|
216
|
+
return ZodParsedType.string;
|
|
217
|
+
case "number":
|
|
218
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
219
|
+
case "boolean":
|
|
220
|
+
return ZodParsedType.boolean;
|
|
221
|
+
case "function":
|
|
222
|
+
return ZodParsedType.function;
|
|
223
|
+
case "bigint":
|
|
224
|
+
return ZodParsedType.bigint;
|
|
225
|
+
case "symbol":
|
|
226
|
+
return ZodParsedType.symbol;
|
|
227
|
+
case "object":
|
|
228
|
+
if (Array.isArray(data)) {
|
|
229
|
+
return ZodParsedType.array;
|
|
230
|
+
}
|
|
231
|
+
if (data === null) {
|
|
232
|
+
return ZodParsedType.null;
|
|
233
|
+
}
|
|
234
|
+
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
|
235
|
+
return ZodParsedType.promise;
|
|
236
|
+
}
|
|
237
|
+
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
238
|
+
return ZodParsedType.map;
|
|
239
|
+
}
|
|
240
|
+
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
241
|
+
return ZodParsedType.set;
|
|
242
|
+
}
|
|
243
|
+
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
244
|
+
return ZodParsedType.date;
|
|
245
|
+
}
|
|
246
|
+
return ZodParsedType.object;
|
|
247
|
+
default:
|
|
248
|
+
return ZodParsedType.unknown;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
253
|
+
var ZodIssueCode = util.arrayToEnum([
|
|
254
|
+
"invalid_type",
|
|
255
|
+
"invalid_literal",
|
|
256
|
+
"custom",
|
|
257
|
+
"invalid_union",
|
|
258
|
+
"invalid_union_discriminator",
|
|
259
|
+
"invalid_enum_value",
|
|
260
|
+
"unrecognized_keys",
|
|
261
|
+
"invalid_arguments",
|
|
262
|
+
"invalid_return_type",
|
|
263
|
+
"invalid_date",
|
|
264
|
+
"invalid_string",
|
|
265
|
+
"too_small",
|
|
266
|
+
"too_big",
|
|
267
|
+
"invalid_intersection_types",
|
|
268
|
+
"not_multiple_of",
|
|
269
|
+
"not_finite"
|
|
270
|
+
]);
|
|
271
|
+
var quotelessJson = (obj) => {
|
|
272
|
+
const json = JSON.stringify(obj, null, 2);
|
|
273
|
+
return json.replace(/"([^"]+)":/g, "$1:");
|
|
274
|
+
};
|
|
275
|
+
var ZodError = class _ZodError extends Error {
|
|
276
|
+
get errors() {
|
|
277
|
+
return this.issues;
|
|
278
|
+
}
|
|
279
|
+
constructor(issues) {
|
|
280
|
+
super();
|
|
281
|
+
this.issues = [];
|
|
282
|
+
this.addIssue = (sub) => {
|
|
283
|
+
this.issues = [...this.issues, sub];
|
|
284
|
+
};
|
|
285
|
+
this.addIssues = (subs = []) => {
|
|
286
|
+
this.issues = [...this.issues, ...subs];
|
|
287
|
+
};
|
|
288
|
+
const actualProto = new.target.prototype;
|
|
289
|
+
if (Object.setPrototypeOf) {
|
|
290
|
+
Object.setPrototypeOf(this, actualProto);
|
|
291
|
+
} else {
|
|
292
|
+
this.__proto__ = actualProto;
|
|
293
|
+
}
|
|
294
|
+
this.name = "ZodError";
|
|
295
|
+
this.issues = issues;
|
|
296
|
+
}
|
|
297
|
+
format(_mapper) {
|
|
298
|
+
const mapper = _mapper || function(issue) {
|
|
299
|
+
return issue.message;
|
|
300
|
+
};
|
|
301
|
+
const fieldErrors = { _errors: [] };
|
|
302
|
+
const processError = (error) => {
|
|
303
|
+
for (const issue of error.issues) {
|
|
304
|
+
if (issue.code === "invalid_union") {
|
|
305
|
+
issue.unionErrors.map(processError);
|
|
306
|
+
} else if (issue.code === "invalid_return_type") {
|
|
307
|
+
processError(issue.returnTypeError);
|
|
308
|
+
} else if (issue.code === "invalid_arguments") {
|
|
309
|
+
processError(issue.argumentsError);
|
|
310
|
+
} else if (issue.path.length === 0) {
|
|
311
|
+
fieldErrors._errors.push(mapper(issue));
|
|
312
|
+
} else {
|
|
313
|
+
let curr = fieldErrors;
|
|
314
|
+
let i = 0;
|
|
315
|
+
while (i < issue.path.length) {
|
|
316
|
+
const el = issue.path[i];
|
|
317
|
+
const terminal = i === issue.path.length - 1;
|
|
318
|
+
if (!terminal) {
|
|
319
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
320
|
+
} else {
|
|
321
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
322
|
+
curr[el]._errors.push(mapper(issue));
|
|
323
|
+
}
|
|
324
|
+
curr = curr[el];
|
|
325
|
+
i++;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
processError(this);
|
|
331
|
+
return fieldErrors;
|
|
332
|
+
}
|
|
333
|
+
static assert(value) {
|
|
334
|
+
if (!(value instanceof _ZodError)) {
|
|
335
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
toString() {
|
|
339
|
+
return this.message;
|
|
340
|
+
}
|
|
341
|
+
get message() {
|
|
342
|
+
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
343
|
+
}
|
|
344
|
+
get isEmpty() {
|
|
345
|
+
return this.issues.length === 0;
|
|
346
|
+
}
|
|
347
|
+
flatten(mapper = (issue) => issue.message) {
|
|
348
|
+
const fieldErrors = {};
|
|
349
|
+
const formErrors = [];
|
|
350
|
+
for (const sub of this.issues) {
|
|
351
|
+
if (sub.path.length > 0) {
|
|
352
|
+
const firstEl = sub.path[0];
|
|
353
|
+
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
|
354
|
+
fieldErrors[firstEl].push(mapper(sub));
|
|
355
|
+
} else {
|
|
356
|
+
formErrors.push(mapper(sub));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return { formErrors, fieldErrors };
|
|
360
|
+
}
|
|
361
|
+
get formErrors() {
|
|
362
|
+
return this.flatten();
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
ZodError.create = (issues) => {
|
|
366
|
+
const error = new ZodError(issues);
|
|
367
|
+
return error;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
371
|
+
var errorMap = (issue, _ctx) => {
|
|
372
|
+
let message;
|
|
373
|
+
switch (issue.code) {
|
|
374
|
+
case ZodIssueCode.invalid_type:
|
|
375
|
+
if (issue.received === ZodParsedType.undefined) {
|
|
376
|
+
message = "Required";
|
|
377
|
+
} else {
|
|
378
|
+
message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
379
|
+
}
|
|
380
|
+
break;
|
|
381
|
+
case ZodIssueCode.invalid_literal:
|
|
382
|
+
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
|
383
|
+
break;
|
|
384
|
+
case ZodIssueCode.unrecognized_keys:
|
|
385
|
+
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
|
386
|
+
break;
|
|
387
|
+
case ZodIssueCode.invalid_union:
|
|
388
|
+
message = `Invalid input`;
|
|
389
|
+
break;
|
|
390
|
+
case ZodIssueCode.invalid_union_discriminator:
|
|
391
|
+
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
|
392
|
+
break;
|
|
393
|
+
case ZodIssueCode.invalid_enum_value:
|
|
394
|
+
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
395
|
+
break;
|
|
396
|
+
case ZodIssueCode.invalid_arguments:
|
|
397
|
+
message = `Invalid function arguments`;
|
|
398
|
+
break;
|
|
399
|
+
case ZodIssueCode.invalid_return_type:
|
|
400
|
+
message = `Invalid function return type`;
|
|
401
|
+
break;
|
|
402
|
+
case ZodIssueCode.invalid_date:
|
|
403
|
+
message = `Invalid date`;
|
|
404
|
+
break;
|
|
405
|
+
case ZodIssueCode.invalid_string:
|
|
406
|
+
if (typeof issue.validation === "object") {
|
|
407
|
+
if ("includes" in issue.validation) {
|
|
408
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
409
|
+
if (typeof issue.validation.position === "number") {
|
|
410
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
411
|
+
}
|
|
412
|
+
} else if ("startsWith" in issue.validation) {
|
|
413
|
+
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
414
|
+
} else if ("endsWith" in issue.validation) {
|
|
415
|
+
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
416
|
+
} else {
|
|
417
|
+
util.assertNever(issue.validation);
|
|
418
|
+
}
|
|
419
|
+
} else if (issue.validation !== "regex") {
|
|
420
|
+
message = `Invalid ${issue.validation}`;
|
|
421
|
+
} else {
|
|
422
|
+
message = "Invalid";
|
|
423
|
+
}
|
|
424
|
+
break;
|
|
425
|
+
case ZodIssueCode.too_small:
|
|
426
|
+
if (issue.type === "array")
|
|
427
|
+
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
|
428
|
+
else if (issue.type === "string")
|
|
429
|
+
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
430
|
+
else if (issue.type === "number")
|
|
431
|
+
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
432
|
+
else if (issue.type === "bigint")
|
|
433
|
+
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
434
|
+
else if (issue.type === "date")
|
|
435
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
436
|
+
else
|
|
437
|
+
message = "Invalid input";
|
|
438
|
+
break;
|
|
439
|
+
case ZodIssueCode.too_big:
|
|
440
|
+
if (issue.type === "array")
|
|
441
|
+
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
|
442
|
+
else if (issue.type === "string")
|
|
443
|
+
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
444
|
+
else if (issue.type === "number")
|
|
445
|
+
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
446
|
+
else if (issue.type === "bigint")
|
|
447
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
448
|
+
else if (issue.type === "date")
|
|
449
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
450
|
+
else
|
|
451
|
+
message = "Invalid input";
|
|
452
|
+
break;
|
|
453
|
+
case ZodIssueCode.custom:
|
|
454
|
+
message = `Invalid input`;
|
|
455
|
+
break;
|
|
456
|
+
case ZodIssueCode.invalid_intersection_types:
|
|
457
|
+
message = `Intersection results could not be merged`;
|
|
458
|
+
break;
|
|
459
|
+
case ZodIssueCode.not_multiple_of:
|
|
460
|
+
message = `Number must be a multiple of ${issue.multipleOf}`;
|
|
461
|
+
break;
|
|
462
|
+
case ZodIssueCode.not_finite:
|
|
463
|
+
message = "Number must be finite";
|
|
464
|
+
break;
|
|
465
|
+
default:
|
|
466
|
+
message = _ctx.defaultError;
|
|
467
|
+
util.assertNever(issue);
|
|
468
|
+
}
|
|
469
|
+
return { message };
|
|
470
|
+
};
|
|
471
|
+
var en_default = errorMap;
|
|
472
|
+
|
|
473
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
474
|
+
var overrideErrorMap = en_default;
|
|
475
|
+
function setErrorMap(map) {
|
|
476
|
+
overrideErrorMap = map;
|
|
477
|
+
}
|
|
478
|
+
function getErrorMap() {
|
|
479
|
+
return overrideErrorMap;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
483
|
+
var makeIssue = (params) => {
|
|
484
|
+
const { data, path, errorMaps, issueData } = params;
|
|
485
|
+
const fullPath = [...path, ...issueData.path || []];
|
|
486
|
+
const fullIssue = {
|
|
487
|
+
...issueData,
|
|
488
|
+
path: fullPath
|
|
489
|
+
};
|
|
490
|
+
if (issueData.message !== void 0) {
|
|
491
|
+
return {
|
|
492
|
+
...issueData,
|
|
493
|
+
path: fullPath,
|
|
494
|
+
message: issueData.message
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
let errorMessage = "";
|
|
498
|
+
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
499
|
+
for (const map of maps) {
|
|
500
|
+
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
...issueData,
|
|
504
|
+
path: fullPath,
|
|
505
|
+
message: errorMessage
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
var EMPTY_PATH = [];
|
|
509
|
+
function addIssueToContext(ctx, issueData) {
|
|
510
|
+
const overrideMap = getErrorMap();
|
|
511
|
+
const issue = makeIssue({
|
|
512
|
+
issueData,
|
|
513
|
+
data: ctx.data,
|
|
514
|
+
path: ctx.path,
|
|
515
|
+
errorMaps: [
|
|
516
|
+
ctx.common.contextualErrorMap,
|
|
517
|
+
// contextual error map is first priority
|
|
518
|
+
ctx.schemaErrorMap,
|
|
519
|
+
// then schema-bound map if available
|
|
520
|
+
overrideMap,
|
|
521
|
+
// then global override map
|
|
522
|
+
overrideMap === en_default ? void 0 : en_default
|
|
523
|
+
// then global default map
|
|
524
|
+
].filter((x) => !!x)
|
|
525
|
+
});
|
|
526
|
+
ctx.common.issues.push(issue);
|
|
527
|
+
}
|
|
528
|
+
var ParseStatus = class _ParseStatus {
|
|
529
|
+
constructor() {
|
|
530
|
+
this.value = "valid";
|
|
531
|
+
}
|
|
532
|
+
dirty() {
|
|
533
|
+
if (this.value === "valid")
|
|
534
|
+
this.value = "dirty";
|
|
535
|
+
}
|
|
536
|
+
abort() {
|
|
537
|
+
if (this.value !== "aborted")
|
|
538
|
+
this.value = "aborted";
|
|
539
|
+
}
|
|
540
|
+
static mergeArray(status, results) {
|
|
541
|
+
const arrayValue = [];
|
|
542
|
+
for (const s of results) {
|
|
543
|
+
if (s.status === "aborted")
|
|
544
|
+
return INVALID;
|
|
545
|
+
if (s.status === "dirty")
|
|
546
|
+
status.dirty();
|
|
547
|
+
arrayValue.push(s.value);
|
|
548
|
+
}
|
|
549
|
+
return { status: status.value, value: arrayValue };
|
|
550
|
+
}
|
|
551
|
+
static async mergeObjectAsync(status, pairs) {
|
|
552
|
+
const syncPairs = [];
|
|
553
|
+
for (const pair of pairs) {
|
|
554
|
+
const key = await pair.key;
|
|
555
|
+
const value = await pair.value;
|
|
556
|
+
syncPairs.push({
|
|
557
|
+
key,
|
|
558
|
+
value
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
562
|
+
}
|
|
563
|
+
static mergeObjectSync(status, pairs) {
|
|
564
|
+
const finalObject = {};
|
|
565
|
+
for (const pair of pairs) {
|
|
566
|
+
const { key, value } = pair;
|
|
567
|
+
if (key.status === "aborted")
|
|
568
|
+
return INVALID;
|
|
569
|
+
if (value.status === "aborted")
|
|
570
|
+
return INVALID;
|
|
571
|
+
if (key.status === "dirty")
|
|
572
|
+
status.dirty();
|
|
573
|
+
if (value.status === "dirty")
|
|
574
|
+
status.dirty();
|
|
575
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
576
|
+
finalObject[key.value] = value.value;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
return { status: status.value, value: finalObject };
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
var INVALID = Object.freeze({
|
|
583
|
+
status: "aborted"
|
|
584
|
+
});
|
|
585
|
+
var DIRTY = (value) => ({ status: "dirty", value });
|
|
586
|
+
var OK = (value) => ({ status: "valid", value });
|
|
587
|
+
var isAborted = (x) => x.status === "aborted";
|
|
588
|
+
var isDirty = (x) => x.status === "dirty";
|
|
589
|
+
var isValid = (x) => x.status === "valid";
|
|
590
|
+
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
591
|
+
|
|
592
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
593
|
+
var errorUtil;
|
|
594
|
+
(function(errorUtil2) {
|
|
595
|
+
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
596
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
597
|
+
})(errorUtil || (errorUtil = {}));
|
|
598
|
+
|
|
599
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
600
|
+
var ParseInputLazyPath = class {
|
|
601
|
+
constructor(parent, value, path, key) {
|
|
602
|
+
this._cachedPath = [];
|
|
603
|
+
this.parent = parent;
|
|
604
|
+
this.data = value;
|
|
605
|
+
this._path = path;
|
|
606
|
+
this._key = key;
|
|
607
|
+
}
|
|
608
|
+
get path() {
|
|
609
|
+
if (!this._cachedPath.length) {
|
|
610
|
+
if (Array.isArray(this._key)) {
|
|
611
|
+
this._cachedPath.push(...this._path, ...this._key);
|
|
612
|
+
} else {
|
|
613
|
+
this._cachedPath.push(...this._path, this._key);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return this._cachedPath;
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
var handleResult = (ctx, result) => {
|
|
620
|
+
if (isValid(result)) {
|
|
621
|
+
return { success: true, data: result.value };
|
|
622
|
+
} else {
|
|
623
|
+
if (!ctx.common.issues.length) {
|
|
624
|
+
throw new Error("Validation failed but no issues detected.");
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
success: false,
|
|
628
|
+
get error() {
|
|
629
|
+
if (this._error)
|
|
630
|
+
return this._error;
|
|
631
|
+
const error = new ZodError(ctx.common.issues);
|
|
632
|
+
this._error = error;
|
|
633
|
+
return this._error;
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
function processCreateParams(params) {
|
|
639
|
+
if (!params)
|
|
640
|
+
return {};
|
|
641
|
+
const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
|
|
642
|
+
if (errorMap2 && (invalid_type_error || required_error)) {
|
|
643
|
+
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
644
|
+
}
|
|
645
|
+
if (errorMap2)
|
|
646
|
+
return { errorMap: errorMap2, description };
|
|
647
|
+
const customMap = (iss, ctx) => {
|
|
648
|
+
const { message } = params;
|
|
649
|
+
if (iss.code === "invalid_enum_value") {
|
|
650
|
+
return { message: message ?? ctx.defaultError };
|
|
651
|
+
}
|
|
652
|
+
if (typeof ctx.data === "undefined") {
|
|
653
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
654
|
+
}
|
|
655
|
+
if (iss.code !== "invalid_type")
|
|
656
|
+
return { message: ctx.defaultError };
|
|
657
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
658
|
+
};
|
|
659
|
+
return { errorMap: customMap, description };
|
|
660
|
+
}
|
|
661
|
+
var ZodType = class {
|
|
662
|
+
get description() {
|
|
663
|
+
return this._def.description;
|
|
664
|
+
}
|
|
665
|
+
_getType(input) {
|
|
666
|
+
return getParsedType(input.data);
|
|
667
|
+
}
|
|
668
|
+
_getOrReturnCtx(input, ctx) {
|
|
669
|
+
return ctx || {
|
|
670
|
+
common: input.parent.common,
|
|
671
|
+
data: input.data,
|
|
672
|
+
parsedType: getParsedType(input.data),
|
|
673
|
+
schemaErrorMap: this._def.errorMap,
|
|
674
|
+
path: input.path,
|
|
675
|
+
parent: input.parent
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
_processInputParams(input) {
|
|
679
|
+
return {
|
|
680
|
+
status: new ParseStatus(),
|
|
681
|
+
ctx: {
|
|
682
|
+
common: input.parent.common,
|
|
683
|
+
data: input.data,
|
|
684
|
+
parsedType: getParsedType(input.data),
|
|
685
|
+
schemaErrorMap: this._def.errorMap,
|
|
686
|
+
path: input.path,
|
|
687
|
+
parent: input.parent
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
_parseSync(input) {
|
|
692
|
+
const result = this._parse(input);
|
|
693
|
+
if (isAsync(result)) {
|
|
694
|
+
throw new Error("Synchronous parse encountered promise.");
|
|
695
|
+
}
|
|
696
|
+
return result;
|
|
697
|
+
}
|
|
698
|
+
_parseAsync(input) {
|
|
699
|
+
const result = this._parse(input);
|
|
700
|
+
return Promise.resolve(result);
|
|
701
|
+
}
|
|
702
|
+
parse(data, params) {
|
|
703
|
+
const result = this.safeParse(data, params);
|
|
704
|
+
if (result.success)
|
|
705
|
+
return result.data;
|
|
706
|
+
throw result.error;
|
|
707
|
+
}
|
|
708
|
+
safeParse(data, params) {
|
|
709
|
+
const ctx = {
|
|
710
|
+
common: {
|
|
711
|
+
issues: [],
|
|
712
|
+
async: params?.async ?? false,
|
|
713
|
+
contextualErrorMap: params?.errorMap
|
|
714
|
+
},
|
|
715
|
+
path: params?.path || [],
|
|
716
|
+
schemaErrorMap: this._def.errorMap,
|
|
717
|
+
parent: null,
|
|
718
|
+
data,
|
|
719
|
+
parsedType: getParsedType(data)
|
|
720
|
+
};
|
|
721
|
+
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
722
|
+
return handleResult(ctx, result);
|
|
723
|
+
}
|
|
724
|
+
"~validate"(data) {
|
|
725
|
+
const ctx = {
|
|
726
|
+
common: {
|
|
727
|
+
issues: [],
|
|
728
|
+
async: !!this["~standard"].async
|
|
729
|
+
},
|
|
730
|
+
path: [],
|
|
731
|
+
schemaErrorMap: this._def.errorMap,
|
|
732
|
+
parent: null,
|
|
733
|
+
data,
|
|
734
|
+
parsedType: getParsedType(data)
|
|
735
|
+
};
|
|
736
|
+
if (!this["~standard"].async) {
|
|
737
|
+
try {
|
|
738
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
739
|
+
return isValid(result) ? {
|
|
740
|
+
value: result.value
|
|
741
|
+
} : {
|
|
742
|
+
issues: ctx.common.issues
|
|
743
|
+
};
|
|
744
|
+
} catch (err) {
|
|
745
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
746
|
+
this["~standard"].async = true;
|
|
747
|
+
}
|
|
748
|
+
ctx.common = {
|
|
749
|
+
issues: [],
|
|
750
|
+
async: true
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
|
755
|
+
value: result.value
|
|
756
|
+
} : {
|
|
757
|
+
issues: ctx.common.issues
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
async parseAsync(data, params) {
|
|
761
|
+
const result = await this.safeParseAsync(data, params);
|
|
762
|
+
if (result.success)
|
|
763
|
+
return result.data;
|
|
764
|
+
throw result.error;
|
|
765
|
+
}
|
|
766
|
+
async safeParseAsync(data, params) {
|
|
767
|
+
const ctx = {
|
|
768
|
+
common: {
|
|
769
|
+
issues: [],
|
|
770
|
+
contextualErrorMap: params?.errorMap,
|
|
771
|
+
async: true
|
|
772
|
+
},
|
|
773
|
+
path: params?.path || [],
|
|
774
|
+
schemaErrorMap: this._def.errorMap,
|
|
775
|
+
parent: null,
|
|
776
|
+
data,
|
|
777
|
+
parsedType: getParsedType(data)
|
|
778
|
+
};
|
|
779
|
+
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
780
|
+
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
781
|
+
return handleResult(ctx, result);
|
|
782
|
+
}
|
|
783
|
+
refine(check, message) {
|
|
784
|
+
const getIssueProperties = (val) => {
|
|
785
|
+
if (typeof message === "string" || typeof message === "undefined") {
|
|
786
|
+
return { message };
|
|
787
|
+
} else if (typeof message === "function") {
|
|
788
|
+
return message(val);
|
|
789
|
+
} else {
|
|
790
|
+
return message;
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
return this._refinement((val, ctx) => {
|
|
794
|
+
const result = check(val);
|
|
795
|
+
const setError = () => ctx.addIssue({
|
|
796
|
+
code: ZodIssueCode.custom,
|
|
797
|
+
...getIssueProperties(val)
|
|
798
|
+
});
|
|
799
|
+
if (typeof Promise !== "undefined" && result instanceof Promise) {
|
|
800
|
+
return result.then((data) => {
|
|
801
|
+
if (!data) {
|
|
802
|
+
setError();
|
|
803
|
+
return false;
|
|
804
|
+
} else {
|
|
805
|
+
return true;
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
if (!result) {
|
|
810
|
+
setError();
|
|
811
|
+
return false;
|
|
812
|
+
} else {
|
|
813
|
+
return true;
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
refinement(check, refinementData) {
|
|
818
|
+
return this._refinement((val, ctx) => {
|
|
819
|
+
if (!check(val)) {
|
|
820
|
+
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
|
|
821
|
+
return false;
|
|
822
|
+
} else {
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
_refinement(refinement) {
|
|
828
|
+
return new ZodEffects({
|
|
829
|
+
schema: this,
|
|
830
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
831
|
+
effect: { type: "refinement", refinement }
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
superRefine(refinement) {
|
|
835
|
+
return this._refinement(refinement);
|
|
836
|
+
}
|
|
837
|
+
constructor(def) {
|
|
838
|
+
this.spa = this.safeParseAsync;
|
|
839
|
+
this._def = def;
|
|
840
|
+
this.parse = this.parse.bind(this);
|
|
841
|
+
this.safeParse = this.safeParse.bind(this);
|
|
842
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
843
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
844
|
+
this.spa = this.spa.bind(this);
|
|
845
|
+
this.refine = this.refine.bind(this);
|
|
846
|
+
this.refinement = this.refinement.bind(this);
|
|
847
|
+
this.superRefine = this.superRefine.bind(this);
|
|
848
|
+
this.optional = this.optional.bind(this);
|
|
849
|
+
this.nullable = this.nullable.bind(this);
|
|
850
|
+
this.nullish = this.nullish.bind(this);
|
|
851
|
+
this.array = this.array.bind(this);
|
|
852
|
+
this.promise = this.promise.bind(this);
|
|
853
|
+
this.or = this.or.bind(this);
|
|
854
|
+
this.and = this.and.bind(this);
|
|
855
|
+
this.transform = this.transform.bind(this);
|
|
856
|
+
this.brand = this.brand.bind(this);
|
|
857
|
+
this.default = this.default.bind(this);
|
|
858
|
+
this.catch = this.catch.bind(this);
|
|
859
|
+
this.describe = this.describe.bind(this);
|
|
860
|
+
this.pipe = this.pipe.bind(this);
|
|
861
|
+
this.readonly = this.readonly.bind(this);
|
|
862
|
+
this.isNullable = this.isNullable.bind(this);
|
|
863
|
+
this.isOptional = this.isOptional.bind(this);
|
|
864
|
+
this["~standard"] = {
|
|
865
|
+
version: 1,
|
|
866
|
+
vendor: "zod",
|
|
867
|
+
validate: (data) => this["~validate"](data)
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
optional() {
|
|
871
|
+
return ZodOptional.create(this, this._def);
|
|
872
|
+
}
|
|
873
|
+
nullable() {
|
|
874
|
+
return ZodNullable.create(this, this._def);
|
|
875
|
+
}
|
|
876
|
+
nullish() {
|
|
877
|
+
return this.nullable().optional();
|
|
878
|
+
}
|
|
879
|
+
array() {
|
|
880
|
+
return ZodArray.create(this);
|
|
881
|
+
}
|
|
882
|
+
promise() {
|
|
883
|
+
return ZodPromise.create(this, this._def);
|
|
884
|
+
}
|
|
885
|
+
or(option) {
|
|
886
|
+
return ZodUnion.create([this, option], this._def);
|
|
887
|
+
}
|
|
888
|
+
and(incoming) {
|
|
889
|
+
return ZodIntersection.create(this, incoming, this._def);
|
|
890
|
+
}
|
|
891
|
+
transform(transform) {
|
|
892
|
+
return new ZodEffects({
|
|
893
|
+
...processCreateParams(this._def),
|
|
894
|
+
schema: this,
|
|
895
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
896
|
+
effect: { type: "transform", transform }
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
default(def) {
|
|
900
|
+
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
901
|
+
return new ZodDefault({
|
|
902
|
+
...processCreateParams(this._def),
|
|
903
|
+
innerType: this,
|
|
904
|
+
defaultValue: defaultValueFunc,
|
|
905
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
brand() {
|
|
909
|
+
return new ZodBranded({
|
|
910
|
+
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
911
|
+
type: this,
|
|
912
|
+
...processCreateParams(this._def)
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
catch(def) {
|
|
916
|
+
const catchValueFunc = typeof def === "function" ? def : () => def;
|
|
917
|
+
return new ZodCatch({
|
|
918
|
+
...processCreateParams(this._def),
|
|
919
|
+
innerType: this,
|
|
920
|
+
catchValue: catchValueFunc,
|
|
921
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
describe(description) {
|
|
925
|
+
const This = this.constructor;
|
|
926
|
+
return new This({
|
|
927
|
+
...this._def,
|
|
928
|
+
description
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
pipe(target) {
|
|
932
|
+
return ZodPipeline.create(this, target);
|
|
933
|
+
}
|
|
934
|
+
readonly() {
|
|
935
|
+
return ZodReadonly.create(this);
|
|
936
|
+
}
|
|
937
|
+
isOptional() {
|
|
938
|
+
return this.safeParse(void 0).success;
|
|
939
|
+
}
|
|
940
|
+
isNullable() {
|
|
941
|
+
return this.safeParse(null).success;
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
945
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
946
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
947
|
+
var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
948
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
949
|
+
var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
950
|
+
var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
951
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
952
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
953
|
+
var emojiRegex;
|
|
954
|
+
var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
955
|
+
var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
|
|
956
|
+
var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
957
|
+
var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
958
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
959
|
+
var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
960
|
+
var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
961
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
962
|
+
function timeRegexSource(args) {
|
|
963
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
964
|
+
if (args.precision) {
|
|
965
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
966
|
+
} else if (args.precision == null) {
|
|
967
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
968
|
+
}
|
|
969
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
|
970
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
971
|
+
}
|
|
972
|
+
function timeRegex(args) {
|
|
973
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
974
|
+
}
|
|
975
|
+
function datetimeRegex(args) {
|
|
976
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
977
|
+
const opts = [];
|
|
978
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
979
|
+
if (args.offset)
|
|
980
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
981
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
982
|
+
return new RegExp(`^${regex}$`);
|
|
983
|
+
}
|
|
984
|
+
function isValidIP(ip, version) {
|
|
985
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
|
989
|
+
return true;
|
|
990
|
+
}
|
|
991
|
+
return false;
|
|
992
|
+
}
|
|
993
|
+
function isValidJWT(jwt, alg) {
|
|
994
|
+
if (!jwtRegex.test(jwt))
|
|
995
|
+
return false;
|
|
996
|
+
try {
|
|
997
|
+
const [header] = jwt.split(".");
|
|
998
|
+
if (!header)
|
|
999
|
+
return false;
|
|
1000
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
1001
|
+
const decoded = JSON.parse(atob(base64));
|
|
1002
|
+
if (typeof decoded !== "object" || decoded === null)
|
|
1003
|
+
return false;
|
|
1004
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
1005
|
+
return false;
|
|
1006
|
+
if (!decoded.alg)
|
|
1007
|
+
return false;
|
|
1008
|
+
if (alg && decoded.alg !== alg)
|
|
1009
|
+
return false;
|
|
1010
|
+
return true;
|
|
1011
|
+
} catch {
|
|
1012
|
+
return false;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function isValidCidr(ip, version) {
|
|
1016
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
|
1017
|
+
return true;
|
|
1018
|
+
}
|
|
1019
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
|
1020
|
+
return true;
|
|
1021
|
+
}
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
var ZodString = class _ZodString extends ZodType {
|
|
1025
|
+
_parse(input) {
|
|
1026
|
+
if (this._def.coerce) {
|
|
1027
|
+
input.data = String(input.data);
|
|
1028
|
+
}
|
|
1029
|
+
const parsedType = this._getType(input);
|
|
1030
|
+
if (parsedType !== ZodParsedType.string) {
|
|
1031
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
1032
|
+
addIssueToContext(ctx2, {
|
|
1033
|
+
code: ZodIssueCode.invalid_type,
|
|
1034
|
+
expected: ZodParsedType.string,
|
|
1035
|
+
received: ctx2.parsedType
|
|
1036
|
+
});
|
|
1037
|
+
return INVALID;
|
|
1038
|
+
}
|
|
1039
|
+
const status = new ParseStatus();
|
|
1040
|
+
let ctx = void 0;
|
|
1041
|
+
for (const check of this._def.checks) {
|
|
1042
|
+
if (check.kind === "min") {
|
|
1043
|
+
if (input.data.length < check.value) {
|
|
1044
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1045
|
+
addIssueToContext(ctx, {
|
|
1046
|
+
code: ZodIssueCode.too_small,
|
|
1047
|
+
minimum: check.value,
|
|
1048
|
+
type: "string",
|
|
1049
|
+
inclusive: true,
|
|
1050
|
+
exact: false,
|
|
1051
|
+
message: check.message
|
|
1052
|
+
});
|
|
1053
|
+
status.dirty();
|
|
1054
|
+
}
|
|
1055
|
+
} else if (check.kind === "max") {
|
|
1056
|
+
if (input.data.length > check.value) {
|
|
1057
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1058
|
+
addIssueToContext(ctx, {
|
|
1059
|
+
code: ZodIssueCode.too_big,
|
|
1060
|
+
maximum: check.value,
|
|
1061
|
+
type: "string",
|
|
1062
|
+
inclusive: true,
|
|
1063
|
+
exact: false,
|
|
1064
|
+
message: check.message
|
|
1065
|
+
});
|
|
1066
|
+
status.dirty();
|
|
1067
|
+
}
|
|
1068
|
+
} else if (check.kind === "length") {
|
|
1069
|
+
const tooBig = input.data.length > check.value;
|
|
1070
|
+
const tooSmall = input.data.length < check.value;
|
|
1071
|
+
if (tooBig || tooSmall) {
|
|
1072
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1073
|
+
if (tooBig) {
|
|
1074
|
+
addIssueToContext(ctx, {
|
|
1075
|
+
code: ZodIssueCode.too_big,
|
|
1076
|
+
maximum: check.value,
|
|
1077
|
+
type: "string",
|
|
1078
|
+
inclusive: true,
|
|
1079
|
+
exact: true,
|
|
1080
|
+
message: check.message
|
|
1081
|
+
});
|
|
1082
|
+
} else if (tooSmall) {
|
|
1083
|
+
addIssueToContext(ctx, {
|
|
1084
|
+
code: ZodIssueCode.too_small,
|
|
1085
|
+
minimum: check.value,
|
|
1086
|
+
type: "string",
|
|
1087
|
+
inclusive: true,
|
|
1088
|
+
exact: true,
|
|
1089
|
+
message: check.message
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
status.dirty();
|
|
1093
|
+
}
|
|
1094
|
+
} else if (check.kind === "email") {
|
|
1095
|
+
if (!emailRegex.test(input.data)) {
|
|
1096
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1097
|
+
addIssueToContext(ctx, {
|
|
1098
|
+
validation: "email",
|
|
1099
|
+
code: ZodIssueCode.invalid_string,
|
|
1100
|
+
message: check.message
|
|
1101
|
+
});
|
|
1102
|
+
status.dirty();
|
|
1103
|
+
}
|
|
1104
|
+
} else if (check.kind === "emoji") {
|
|
1105
|
+
if (!emojiRegex) {
|
|
1106
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
1107
|
+
}
|
|
1108
|
+
if (!emojiRegex.test(input.data)) {
|
|
1109
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1110
|
+
addIssueToContext(ctx, {
|
|
1111
|
+
validation: "emoji",
|
|
1112
|
+
code: ZodIssueCode.invalid_string,
|
|
1113
|
+
message: check.message
|
|
1114
|
+
});
|
|
1115
|
+
status.dirty();
|
|
1116
|
+
}
|
|
1117
|
+
} else if (check.kind === "uuid") {
|
|
1118
|
+
if (!uuidRegex.test(input.data)) {
|
|
1119
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1120
|
+
addIssueToContext(ctx, {
|
|
1121
|
+
validation: "uuid",
|
|
1122
|
+
code: ZodIssueCode.invalid_string,
|
|
1123
|
+
message: check.message
|
|
1124
|
+
});
|
|
1125
|
+
status.dirty();
|
|
1126
|
+
}
|
|
1127
|
+
} else if (check.kind === "nanoid") {
|
|
1128
|
+
if (!nanoidRegex.test(input.data)) {
|
|
1129
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1130
|
+
addIssueToContext(ctx, {
|
|
1131
|
+
validation: "nanoid",
|
|
1132
|
+
code: ZodIssueCode.invalid_string,
|
|
1133
|
+
message: check.message
|
|
1134
|
+
});
|
|
1135
|
+
status.dirty();
|
|
1136
|
+
}
|
|
1137
|
+
} else if (check.kind === "cuid") {
|
|
1138
|
+
if (!cuidRegex.test(input.data)) {
|
|
1139
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1140
|
+
addIssueToContext(ctx, {
|
|
1141
|
+
validation: "cuid",
|
|
1142
|
+
code: ZodIssueCode.invalid_string,
|
|
1143
|
+
message: check.message
|
|
1144
|
+
});
|
|
1145
|
+
status.dirty();
|
|
1146
|
+
}
|
|
1147
|
+
} else if (check.kind === "cuid2") {
|
|
1148
|
+
if (!cuid2Regex.test(input.data)) {
|
|
1149
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1150
|
+
addIssueToContext(ctx, {
|
|
1151
|
+
validation: "cuid2",
|
|
1152
|
+
code: ZodIssueCode.invalid_string,
|
|
1153
|
+
message: check.message
|
|
1154
|
+
});
|
|
1155
|
+
status.dirty();
|
|
1156
|
+
}
|
|
1157
|
+
} else if (check.kind === "ulid") {
|
|
1158
|
+
if (!ulidRegex.test(input.data)) {
|
|
1159
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1160
|
+
addIssueToContext(ctx, {
|
|
1161
|
+
validation: "ulid",
|
|
1162
|
+
code: ZodIssueCode.invalid_string,
|
|
1163
|
+
message: check.message
|
|
1164
|
+
});
|
|
1165
|
+
status.dirty();
|
|
1166
|
+
}
|
|
1167
|
+
} else if (check.kind === "url") {
|
|
1168
|
+
try {
|
|
1169
|
+
new URL(input.data);
|
|
1170
|
+
} catch {
|
|
1171
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1172
|
+
addIssueToContext(ctx, {
|
|
1173
|
+
validation: "url",
|
|
1174
|
+
code: ZodIssueCode.invalid_string,
|
|
1175
|
+
message: check.message
|
|
1176
|
+
});
|
|
1177
|
+
status.dirty();
|
|
1178
|
+
}
|
|
1179
|
+
} else if (check.kind === "regex") {
|
|
1180
|
+
check.regex.lastIndex = 0;
|
|
1181
|
+
const testResult = check.regex.test(input.data);
|
|
1182
|
+
if (!testResult) {
|
|
1183
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1184
|
+
addIssueToContext(ctx, {
|
|
1185
|
+
validation: "regex",
|
|
1186
|
+
code: ZodIssueCode.invalid_string,
|
|
1187
|
+
message: check.message
|
|
1188
|
+
});
|
|
1189
|
+
status.dirty();
|
|
1190
|
+
}
|
|
1191
|
+
} else if (check.kind === "trim") {
|
|
1192
|
+
input.data = input.data.trim();
|
|
1193
|
+
} else if (check.kind === "includes") {
|
|
1194
|
+
if (!input.data.includes(check.value, check.position)) {
|
|
1195
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1196
|
+
addIssueToContext(ctx, {
|
|
1197
|
+
code: ZodIssueCode.invalid_string,
|
|
1198
|
+
validation: { includes: check.value, position: check.position },
|
|
1199
|
+
message: check.message
|
|
1200
|
+
});
|
|
1201
|
+
status.dirty();
|
|
1202
|
+
}
|
|
1203
|
+
} else if (check.kind === "toLowerCase") {
|
|
1204
|
+
input.data = input.data.toLowerCase();
|
|
1205
|
+
} else if (check.kind === "toUpperCase") {
|
|
1206
|
+
input.data = input.data.toUpperCase();
|
|
1207
|
+
} else if (check.kind === "startsWith") {
|
|
1208
|
+
if (!input.data.startsWith(check.value)) {
|
|
1209
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1210
|
+
addIssueToContext(ctx, {
|
|
1211
|
+
code: ZodIssueCode.invalid_string,
|
|
1212
|
+
validation: { startsWith: check.value },
|
|
1213
|
+
message: check.message
|
|
1214
|
+
});
|
|
1215
|
+
status.dirty();
|
|
1216
|
+
}
|
|
1217
|
+
} else if (check.kind === "endsWith") {
|
|
1218
|
+
if (!input.data.endsWith(check.value)) {
|
|
1219
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1220
|
+
addIssueToContext(ctx, {
|
|
1221
|
+
code: ZodIssueCode.invalid_string,
|
|
1222
|
+
validation: { endsWith: check.value },
|
|
1223
|
+
message: check.message
|
|
1224
|
+
});
|
|
1225
|
+
status.dirty();
|
|
1226
|
+
}
|
|
1227
|
+
} else if (check.kind === "datetime") {
|
|
1228
|
+
const regex = datetimeRegex(check);
|
|
1229
|
+
if (!regex.test(input.data)) {
|
|
1230
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1231
|
+
addIssueToContext(ctx, {
|
|
1232
|
+
code: ZodIssueCode.invalid_string,
|
|
1233
|
+
validation: "datetime",
|
|
1234
|
+
message: check.message
|
|
1235
|
+
});
|
|
1236
|
+
status.dirty();
|
|
1237
|
+
}
|
|
1238
|
+
} else if (check.kind === "date") {
|
|
1239
|
+
const regex = dateRegex;
|
|
1240
|
+
if (!regex.test(input.data)) {
|
|
1241
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1242
|
+
addIssueToContext(ctx, {
|
|
1243
|
+
code: ZodIssueCode.invalid_string,
|
|
1244
|
+
validation: "date",
|
|
1245
|
+
message: check.message
|
|
1246
|
+
});
|
|
1247
|
+
status.dirty();
|
|
1248
|
+
}
|
|
1249
|
+
} else if (check.kind === "time") {
|
|
1250
|
+
const regex = timeRegex(check);
|
|
1251
|
+
if (!regex.test(input.data)) {
|
|
1252
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1253
|
+
addIssueToContext(ctx, {
|
|
1254
|
+
code: ZodIssueCode.invalid_string,
|
|
1255
|
+
validation: "time",
|
|
1256
|
+
message: check.message
|
|
1257
|
+
});
|
|
1258
|
+
status.dirty();
|
|
1259
|
+
}
|
|
1260
|
+
} else if (check.kind === "duration") {
|
|
1261
|
+
if (!durationRegex.test(input.data)) {
|
|
1262
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1263
|
+
addIssueToContext(ctx, {
|
|
1264
|
+
validation: "duration",
|
|
1265
|
+
code: ZodIssueCode.invalid_string,
|
|
1266
|
+
message: check.message
|
|
1267
|
+
});
|
|
1268
|
+
status.dirty();
|
|
1269
|
+
}
|
|
1270
|
+
} else if (check.kind === "ip") {
|
|
1271
|
+
if (!isValidIP(input.data, check.version)) {
|
|
1272
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1273
|
+
addIssueToContext(ctx, {
|
|
1274
|
+
validation: "ip",
|
|
1275
|
+
code: ZodIssueCode.invalid_string,
|
|
1276
|
+
message: check.message
|
|
1277
|
+
});
|
|
1278
|
+
status.dirty();
|
|
1279
|
+
}
|
|
1280
|
+
} else if (check.kind === "jwt") {
|
|
1281
|
+
if (!isValidJWT(input.data, check.alg)) {
|
|
1282
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1283
|
+
addIssueToContext(ctx, {
|
|
1284
|
+
validation: "jwt",
|
|
1285
|
+
code: ZodIssueCode.invalid_string,
|
|
1286
|
+
message: check.message
|
|
1287
|
+
});
|
|
1288
|
+
status.dirty();
|
|
1289
|
+
}
|
|
1290
|
+
} else if (check.kind === "cidr") {
|
|
1291
|
+
if (!isValidCidr(input.data, check.version)) {
|
|
1292
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1293
|
+
addIssueToContext(ctx, {
|
|
1294
|
+
validation: "cidr",
|
|
1295
|
+
code: ZodIssueCode.invalid_string,
|
|
1296
|
+
message: check.message
|
|
1297
|
+
});
|
|
1298
|
+
status.dirty();
|
|
1299
|
+
}
|
|
1300
|
+
} else if (check.kind === "base64") {
|
|
1301
|
+
if (!base64Regex.test(input.data)) {
|
|
1302
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1303
|
+
addIssueToContext(ctx, {
|
|
1304
|
+
validation: "base64",
|
|
1305
|
+
code: ZodIssueCode.invalid_string,
|
|
1306
|
+
message: check.message
|
|
1307
|
+
});
|
|
1308
|
+
status.dirty();
|
|
1309
|
+
}
|
|
1310
|
+
} else if (check.kind === "base64url") {
|
|
1311
|
+
if (!base64urlRegex.test(input.data)) {
|
|
1312
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1313
|
+
addIssueToContext(ctx, {
|
|
1314
|
+
validation: "base64url",
|
|
1315
|
+
code: ZodIssueCode.invalid_string,
|
|
1316
|
+
message: check.message
|
|
1317
|
+
});
|
|
1318
|
+
status.dirty();
|
|
1319
|
+
}
|
|
1320
|
+
} else {
|
|
1321
|
+
util.assertNever(check);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return { status: status.value, value: input.data };
|
|
1325
|
+
}
|
|
1326
|
+
_regex(regex, validation, message) {
|
|
1327
|
+
return this.refinement((data) => regex.test(data), {
|
|
1328
|
+
validation,
|
|
1329
|
+
code: ZodIssueCode.invalid_string,
|
|
1330
|
+
...errorUtil.errToObj(message)
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
_addCheck(check) {
|
|
1334
|
+
return new _ZodString({
|
|
1335
|
+
...this._def,
|
|
1336
|
+
checks: [...this._def.checks, check]
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
email(message) {
|
|
1340
|
+
return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
|
|
1341
|
+
}
|
|
1342
|
+
url(message) {
|
|
1343
|
+
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
|
1344
|
+
}
|
|
1345
|
+
emoji(message) {
|
|
1346
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
|
1347
|
+
}
|
|
1348
|
+
uuid(message) {
|
|
1349
|
+
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
1350
|
+
}
|
|
1351
|
+
nanoid(message) {
|
|
1352
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
1353
|
+
}
|
|
1354
|
+
cuid(message) {
|
|
1355
|
+
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
1356
|
+
}
|
|
1357
|
+
cuid2(message) {
|
|
1358
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
1359
|
+
}
|
|
1360
|
+
ulid(message) {
|
|
1361
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
1362
|
+
}
|
|
1363
|
+
base64(message) {
|
|
1364
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1365
|
+
}
|
|
1366
|
+
base64url(message) {
|
|
1367
|
+
return this._addCheck({
|
|
1368
|
+
kind: "base64url",
|
|
1369
|
+
...errorUtil.errToObj(message)
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
jwt(options) {
|
|
1373
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
|
1374
|
+
}
|
|
1375
|
+
ip(options) {
|
|
1376
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1377
|
+
}
|
|
1378
|
+
cidr(options) {
|
|
1379
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
1380
|
+
}
|
|
1381
|
+
datetime(options) {
|
|
1382
|
+
if (typeof options === "string") {
|
|
1383
|
+
return this._addCheck({
|
|
1384
|
+
kind: "datetime",
|
|
1385
|
+
precision: null,
|
|
1386
|
+
offset: false,
|
|
1387
|
+
local: false,
|
|
1388
|
+
message: options
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
return this._addCheck({
|
|
1392
|
+
kind: "datetime",
|
|
1393
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1394
|
+
offset: options?.offset ?? false,
|
|
1395
|
+
local: options?.local ?? false,
|
|
1396
|
+
...errorUtil.errToObj(options?.message)
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
date(message) {
|
|
1400
|
+
return this._addCheck({ kind: "date", message });
|
|
1401
|
+
}
|
|
1402
|
+
time(options) {
|
|
1403
|
+
if (typeof options === "string") {
|
|
1404
|
+
return this._addCheck({
|
|
1405
|
+
kind: "time",
|
|
1406
|
+
precision: null,
|
|
1407
|
+
message: options
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
return this._addCheck({
|
|
1411
|
+
kind: "time",
|
|
1412
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1413
|
+
...errorUtil.errToObj(options?.message)
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
duration(message) {
|
|
1417
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
1418
|
+
}
|
|
1419
|
+
regex(regex, message) {
|
|
1420
|
+
return this._addCheck({
|
|
1421
|
+
kind: "regex",
|
|
1422
|
+
regex,
|
|
1423
|
+
...errorUtil.errToObj(message)
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
includes(value, options) {
|
|
1427
|
+
return this._addCheck({
|
|
1428
|
+
kind: "includes",
|
|
1429
|
+
value,
|
|
1430
|
+
position: options?.position,
|
|
1431
|
+
...errorUtil.errToObj(options?.message)
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
startsWith(value, message) {
|
|
1435
|
+
return this._addCheck({
|
|
1436
|
+
kind: "startsWith",
|
|
1437
|
+
value,
|
|
1438
|
+
...errorUtil.errToObj(message)
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
endsWith(value, message) {
|
|
1442
|
+
return this._addCheck({
|
|
1443
|
+
kind: "endsWith",
|
|
1444
|
+
value,
|
|
1445
|
+
...errorUtil.errToObj(message)
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
min(minLength, message) {
|
|
1449
|
+
return this._addCheck({
|
|
1450
|
+
kind: "min",
|
|
1451
|
+
value: minLength,
|
|
1452
|
+
...errorUtil.errToObj(message)
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
max(maxLength, message) {
|
|
1456
|
+
return this._addCheck({
|
|
1457
|
+
kind: "max",
|
|
1458
|
+
value: maxLength,
|
|
1459
|
+
...errorUtil.errToObj(message)
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
length(len, message) {
|
|
1463
|
+
return this._addCheck({
|
|
1464
|
+
kind: "length",
|
|
1465
|
+
value: len,
|
|
1466
|
+
...errorUtil.errToObj(message)
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Equivalent to `.min(1)`
|
|
1471
|
+
*/
|
|
1472
|
+
nonempty(message) {
|
|
1473
|
+
return this.min(1, errorUtil.errToObj(message));
|
|
1474
|
+
}
|
|
1475
|
+
trim() {
|
|
1476
|
+
return new _ZodString({
|
|
1477
|
+
...this._def,
|
|
1478
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
toLowerCase() {
|
|
1482
|
+
return new _ZodString({
|
|
1483
|
+
...this._def,
|
|
1484
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
toUpperCase() {
|
|
1488
|
+
return new _ZodString({
|
|
1489
|
+
...this._def,
|
|
1490
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
get isDatetime() {
|
|
1494
|
+
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
1495
|
+
}
|
|
1496
|
+
get isDate() {
|
|
1497
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
1498
|
+
}
|
|
1499
|
+
get isTime() {
|
|
1500
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
1501
|
+
}
|
|
1502
|
+
get isDuration() {
|
|
1503
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
1504
|
+
}
|
|
1505
|
+
get isEmail() {
|
|
1506
|
+
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
1507
|
+
}
|
|
1508
|
+
get isURL() {
|
|
1509
|
+
return !!this._def.checks.find((ch) => ch.kind === "url");
|
|
1510
|
+
}
|
|
1511
|
+
get isEmoji() {
|
|
1512
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
|
1513
|
+
}
|
|
1514
|
+
get isUUID() {
|
|
1515
|
+
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
1516
|
+
}
|
|
1517
|
+
get isNANOID() {
|
|
1518
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
1519
|
+
}
|
|
1520
|
+
get isCUID() {
|
|
1521
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
1522
|
+
}
|
|
1523
|
+
get isCUID2() {
|
|
1524
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
1525
|
+
}
|
|
1526
|
+
get isULID() {
|
|
1527
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
|
1528
|
+
}
|
|
1529
|
+
get isIP() {
|
|
1530
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1531
|
+
}
|
|
1532
|
+
get isCIDR() {
|
|
1533
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
|
1534
|
+
}
|
|
1535
|
+
get isBase64() {
|
|
1536
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1537
|
+
}
|
|
1538
|
+
get isBase64url() {
|
|
1539
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
|
1540
|
+
}
|
|
1541
|
+
get minLength() {
|
|
1542
|
+
let min = null;
|
|
1543
|
+
for (const ch of this._def.checks) {
|
|
1544
|
+
if (ch.kind === "min") {
|
|
1545
|
+
if (min === null || ch.value > min)
|
|
1546
|
+
min = ch.value;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
return min;
|
|
1550
|
+
}
|
|
1551
|
+
get maxLength() {
|
|
1552
|
+
let max = null;
|
|
1553
|
+
for (const ch of this._def.checks) {
|
|
1554
|
+
if (ch.kind === "max") {
|
|
1555
|
+
if (max === null || ch.value < max)
|
|
1556
|
+
max = ch.value;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return max;
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
ZodString.create = (params) => {
|
|
1563
|
+
return new ZodString({
|
|
1564
|
+
checks: [],
|
|
1565
|
+
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1566
|
+
coerce: params?.coerce ?? false,
|
|
1567
|
+
...processCreateParams(params)
|
|
1568
|
+
});
|
|
1569
|
+
};
|
|
1570
|
+
function floatSafeRemainder(val, step) {
|
|
1571
|
+
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1572
|
+
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
1573
|
+
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
1574
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1575
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1576
|
+
return valInt % stepInt / 10 ** decCount;
|
|
1577
|
+
}
|
|
1578
|
+
var ZodNumber = class _ZodNumber extends ZodType {
|
|
1579
|
+
constructor() {
|
|
1580
|
+
super(...arguments);
|
|
1581
|
+
this.min = this.gte;
|
|
1582
|
+
this.max = this.lte;
|
|
1583
|
+
this.step = this.multipleOf;
|
|
1584
|
+
}
|
|
1585
|
+
_parse(input) {
|
|
1586
|
+
if (this._def.coerce) {
|
|
1587
|
+
input.data = Number(input.data);
|
|
1588
|
+
}
|
|
1589
|
+
const parsedType = this._getType(input);
|
|
1590
|
+
if (parsedType !== ZodParsedType.number) {
|
|
1591
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
1592
|
+
addIssueToContext(ctx2, {
|
|
1593
|
+
code: ZodIssueCode.invalid_type,
|
|
1594
|
+
expected: ZodParsedType.number,
|
|
1595
|
+
received: ctx2.parsedType
|
|
1596
|
+
});
|
|
1597
|
+
return INVALID;
|
|
1598
|
+
}
|
|
1599
|
+
let ctx = void 0;
|
|
1600
|
+
const status = new ParseStatus();
|
|
1601
|
+
for (const check of this._def.checks) {
|
|
1602
|
+
if (check.kind === "int") {
|
|
1603
|
+
if (!util.isInteger(input.data)) {
|
|
1604
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1605
|
+
addIssueToContext(ctx, {
|
|
1606
|
+
code: ZodIssueCode.invalid_type,
|
|
1607
|
+
expected: "integer",
|
|
1608
|
+
received: "float",
|
|
1609
|
+
message: check.message
|
|
1610
|
+
});
|
|
1611
|
+
status.dirty();
|
|
1612
|
+
}
|
|
1613
|
+
} else if (check.kind === "min") {
|
|
1614
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1615
|
+
if (tooSmall) {
|
|
1616
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1617
|
+
addIssueToContext(ctx, {
|
|
1618
|
+
code: ZodIssueCode.too_small,
|
|
1619
|
+
minimum: check.value,
|
|
1620
|
+
type: "number",
|
|
1621
|
+
inclusive: check.inclusive,
|
|
1622
|
+
exact: false,
|
|
1623
|
+
message: check.message
|
|
1624
|
+
});
|
|
1625
|
+
status.dirty();
|
|
1626
|
+
}
|
|
1627
|
+
} else if (check.kind === "max") {
|
|
1628
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1629
|
+
if (tooBig) {
|
|
1630
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1631
|
+
addIssueToContext(ctx, {
|
|
1632
|
+
code: ZodIssueCode.too_big,
|
|
1633
|
+
maximum: check.value,
|
|
1634
|
+
type: "number",
|
|
1635
|
+
inclusive: check.inclusive,
|
|
1636
|
+
exact: false,
|
|
1637
|
+
message: check.message
|
|
1638
|
+
});
|
|
1639
|
+
status.dirty();
|
|
1640
|
+
}
|
|
1641
|
+
} else if (check.kind === "multipleOf") {
|
|
1642
|
+
if (floatSafeRemainder(input.data, check.value) !== 0) {
|
|
1643
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1644
|
+
addIssueToContext(ctx, {
|
|
1645
|
+
code: ZodIssueCode.not_multiple_of,
|
|
1646
|
+
multipleOf: check.value,
|
|
1647
|
+
message: check.message
|
|
1648
|
+
});
|
|
1649
|
+
status.dirty();
|
|
1650
|
+
}
|
|
1651
|
+
} else if (check.kind === "finite") {
|
|
1652
|
+
if (!Number.isFinite(input.data)) {
|
|
1653
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1654
|
+
addIssueToContext(ctx, {
|
|
1655
|
+
code: ZodIssueCode.not_finite,
|
|
1656
|
+
message: check.message
|
|
1657
|
+
});
|
|
1658
|
+
status.dirty();
|
|
1659
|
+
}
|
|
1660
|
+
} else {
|
|
1661
|
+
util.assertNever(check);
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
return { status: status.value, value: input.data };
|
|
1665
|
+
}
|
|
1666
|
+
gte(value, message) {
|
|
1667
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
1668
|
+
}
|
|
1669
|
+
gt(value, message) {
|
|
1670
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
|
1671
|
+
}
|
|
1672
|
+
lte(value, message) {
|
|
1673
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
|
1674
|
+
}
|
|
1675
|
+
lt(value, message) {
|
|
1676
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1677
|
+
}
|
|
1678
|
+
setLimit(kind, value, inclusive, message) {
|
|
1679
|
+
return new _ZodNumber({
|
|
1680
|
+
...this._def,
|
|
1681
|
+
checks: [
|
|
1682
|
+
...this._def.checks,
|
|
1683
|
+
{
|
|
1684
|
+
kind,
|
|
1685
|
+
value,
|
|
1686
|
+
inclusive,
|
|
1687
|
+
message: errorUtil.toString(message)
|
|
1688
|
+
}
|
|
1689
|
+
]
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
_addCheck(check) {
|
|
1693
|
+
return new _ZodNumber({
|
|
1694
|
+
...this._def,
|
|
1695
|
+
checks: [...this._def.checks, check]
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
int(message) {
|
|
1699
|
+
return this._addCheck({
|
|
1700
|
+
kind: "int",
|
|
1701
|
+
message: errorUtil.toString(message)
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
positive(message) {
|
|
1705
|
+
return this._addCheck({
|
|
1706
|
+
kind: "min",
|
|
1707
|
+
value: 0,
|
|
1708
|
+
inclusive: false,
|
|
1709
|
+
message: errorUtil.toString(message)
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
negative(message) {
|
|
1713
|
+
return this._addCheck({
|
|
1714
|
+
kind: "max",
|
|
1715
|
+
value: 0,
|
|
1716
|
+
inclusive: false,
|
|
1717
|
+
message: errorUtil.toString(message)
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
nonpositive(message) {
|
|
1721
|
+
return this._addCheck({
|
|
1722
|
+
kind: "max",
|
|
1723
|
+
value: 0,
|
|
1724
|
+
inclusive: true,
|
|
1725
|
+
message: errorUtil.toString(message)
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
nonnegative(message) {
|
|
1729
|
+
return this._addCheck({
|
|
1730
|
+
kind: "min",
|
|
1731
|
+
value: 0,
|
|
1732
|
+
inclusive: true,
|
|
1733
|
+
message: errorUtil.toString(message)
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
multipleOf(value, message) {
|
|
1737
|
+
return this._addCheck({
|
|
1738
|
+
kind: "multipleOf",
|
|
1739
|
+
value,
|
|
1740
|
+
message: errorUtil.toString(message)
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
finite(message) {
|
|
1744
|
+
return this._addCheck({
|
|
1745
|
+
kind: "finite",
|
|
1746
|
+
message: errorUtil.toString(message)
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
safe(message) {
|
|
1750
|
+
return this._addCheck({
|
|
1751
|
+
kind: "min",
|
|
1752
|
+
inclusive: true,
|
|
1753
|
+
value: Number.MIN_SAFE_INTEGER,
|
|
1754
|
+
message: errorUtil.toString(message)
|
|
1755
|
+
})._addCheck({
|
|
1756
|
+
kind: "max",
|
|
1757
|
+
inclusive: true,
|
|
1758
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
1759
|
+
message: errorUtil.toString(message)
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
get minValue() {
|
|
1763
|
+
let min = null;
|
|
1764
|
+
for (const ch of this._def.checks) {
|
|
1765
|
+
if (ch.kind === "min") {
|
|
1766
|
+
if (min === null || ch.value > min)
|
|
1767
|
+
min = ch.value;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
return min;
|
|
1771
|
+
}
|
|
1772
|
+
get maxValue() {
|
|
1773
|
+
let max = null;
|
|
1774
|
+
for (const ch of this._def.checks) {
|
|
1775
|
+
if (ch.kind === "max") {
|
|
1776
|
+
if (max === null || ch.value < max)
|
|
1777
|
+
max = ch.value;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
return max;
|
|
1781
|
+
}
|
|
1782
|
+
get isInt() {
|
|
1783
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
1784
|
+
}
|
|
1785
|
+
get isFinite() {
|
|
1786
|
+
let max = null;
|
|
1787
|
+
let min = null;
|
|
1788
|
+
for (const ch of this._def.checks) {
|
|
1789
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1790
|
+
return true;
|
|
1791
|
+
} else if (ch.kind === "min") {
|
|
1792
|
+
if (min === null || ch.value > min)
|
|
1793
|
+
min = ch.value;
|
|
1794
|
+
} else if (ch.kind === "max") {
|
|
1795
|
+
if (max === null || ch.value < max)
|
|
1796
|
+
max = ch.value;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
ZodNumber.create = (params) => {
|
|
1803
|
+
return new ZodNumber({
|
|
1804
|
+
checks: [],
|
|
1805
|
+
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1806
|
+
coerce: params?.coerce || false,
|
|
1807
|
+
...processCreateParams(params)
|
|
1808
|
+
});
|
|
1809
|
+
};
|
|
1810
|
+
var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
1811
|
+
constructor() {
|
|
1812
|
+
super(...arguments);
|
|
1813
|
+
this.min = this.gte;
|
|
1814
|
+
this.max = this.lte;
|
|
1815
|
+
}
|
|
1816
|
+
_parse(input) {
|
|
1817
|
+
if (this._def.coerce) {
|
|
1818
|
+
try {
|
|
1819
|
+
input.data = BigInt(input.data);
|
|
1820
|
+
} catch {
|
|
1821
|
+
return this._getInvalidInput(input);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
const parsedType = this._getType(input);
|
|
1825
|
+
if (parsedType !== ZodParsedType.bigint) {
|
|
1826
|
+
return this._getInvalidInput(input);
|
|
1827
|
+
}
|
|
1828
|
+
let ctx = void 0;
|
|
1829
|
+
const status = new ParseStatus();
|
|
1830
|
+
for (const check of this._def.checks) {
|
|
1831
|
+
if (check.kind === "min") {
|
|
1832
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1833
|
+
if (tooSmall) {
|
|
1834
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1835
|
+
addIssueToContext(ctx, {
|
|
1836
|
+
code: ZodIssueCode.too_small,
|
|
1837
|
+
type: "bigint",
|
|
1838
|
+
minimum: check.value,
|
|
1839
|
+
inclusive: check.inclusive,
|
|
1840
|
+
message: check.message
|
|
1841
|
+
});
|
|
1842
|
+
status.dirty();
|
|
1843
|
+
}
|
|
1844
|
+
} else if (check.kind === "max") {
|
|
1845
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1846
|
+
if (tooBig) {
|
|
1847
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1848
|
+
addIssueToContext(ctx, {
|
|
1849
|
+
code: ZodIssueCode.too_big,
|
|
1850
|
+
type: "bigint",
|
|
1851
|
+
maximum: check.value,
|
|
1852
|
+
inclusive: check.inclusive,
|
|
1853
|
+
message: check.message
|
|
1854
|
+
});
|
|
1855
|
+
status.dirty();
|
|
1856
|
+
}
|
|
1857
|
+
} else if (check.kind === "multipleOf") {
|
|
1858
|
+
if (input.data % check.value !== BigInt(0)) {
|
|
1859
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1860
|
+
addIssueToContext(ctx, {
|
|
1861
|
+
code: ZodIssueCode.not_multiple_of,
|
|
1862
|
+
multipleOf: check.value,
|
|
1863
|
+
message: check.message
|
|
1864
|
+
});
|
|
1865
|
+
status.dirty();
|
|
1866
|
+
}
|
|
1867
|
+
} else {
|
|
1868
|
+
util.assertNever(check);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
return { status: status.value, value: input.data };
|
|
1872
|
+
}
|
|
1873
|
+
_getInvalidInput(input) {
|
|
1874
|
+
const ctx = this._getOrReturnCtx(input);
|
|
1875
|
+
addIssueToContext(ctx, {
|
|
1876
|
+
code: ZodIssueCode.invalid_type,
|
|
1877
|
+
expected: ZodParsedType.bigint,
|
|
1878
|
+
received: ctx.parsedType
|
|
1879
|
+
});
|
|
1880
|
+
return INVALID;
|
|
1881
|
+
}
|
|
1882
|
+
gte(value, message) {
|
|
1883
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
1884
|
+
}
|
|
1885
|
+
gt(value, message) {
|
|
1886
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
|
1887
|
+
}
|
|
1888
|
+
lte(value, message) {
|
|
1889
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
|
1890
|
+
}
|
|
1891
|
+
lt(value, message) {
|
|
1892
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1893
|
+
}
|
|
1894
|
+
setLimit(kind, value, inclusive, message) {
|
|
1895
|
+
return new _ZodBigInt({
|
|
1896
|
+
...this._def,
|
|
1897
|
+
checks: [
|
|
1898
|
+
...this._def.checks,
|
|
1899
|
+
{
|
|
1900
|
+
kind,
|
|
1901
|
+
value,
|
|
1902
|
+
inclusive,
|
|
1903
|
+
message: errorUtil.toString(message)
|
|
1904
|
+
}
|
|
1905
|
+
]
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
_addCheck(check) {
|
|
1909
|
+
return new _ZodBigInt({
|
|
1910
|
+
...this._def,
|
|
1911
|
+
checks: [...this._def.checks, check]
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
positive(message) {
|
|
1915
|
+
return this._addCheck({
|
|
1916
|
+
kind: "min",
|
|
1917
|
+
value: BigInt(0),
|
|
1918
|
+
inclusive: false,
|
|
1919
|
+
message: errorUtil.toString(message)
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
negative(message) {
|
|
1923
|
+
return this._addCheck({
|
|
1924
|
+
kind: "max",
|
|
1925
|
+
value: BigInt(0),
|
|
1926
|
+
inclusive: false,
|
|
1927
|
+
message: errorUtil.toString(message)
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
nonpositive(message) {
|
|
1931
|
+
return this._addCheck({
|
|
1932
|
+
kind: "max",
|
|
1933
|
+
value: BigInt(0),
|
|
1934
|
+
inclusive: true,
|
|
1935
|
+
message: errorUtil.toString(message)
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
nonnegative(message) {
|
|
1939
|
+
return this._addCheck({
|
|
1940
|
+
kind: "min",
|
|
1941
|
+
value: BigInt(0),
|
|
1942
|
+
inclusive: true,
|
|
1943
|
+
message: errorUtil.toString(message)
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
multipleOf(value, message) {
|
|
1947
|
+
return this._addCheck({
|
|
1948
|
+
kind: "multipleOf",
|
|
1949
|
+
value,
|
|
1950
|
+
message: errorUtil.toString(message)
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
get minValue() {
|
|
1954
|
+
let min = null;
|
|
1955
|
+
for (const ch of this._def.checks) {
|
|
1956
|
+
if (ch.kind === "min") {
|
|
1957
|
+
if (min === null || ch.value > min)
|
|
1958
|
+
min = ch.value;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
return min;
|
|
1962
|
+
}
|
|
1963
|
+
get maxValue() {
|
|
1964
|
+
let max = null;
|
|
1965
|
+
for (const ch of this._def.checks) {
|
|
1966
|
+
if (ch.kind === "max") {
|
|
1967
|
+
if (max === null || ch.value < max)
|
|
1968
|
+
max = ch.value;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
return max;
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
ZodBigInt.create = (params) => {
|
|
1975
|
+
return new ZodBigInt({
|
|
1976
|
+
checks: [],
|
|
1977
|
+
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1978
|
+
coerce: params?.coerce ?? false,
|
|
1979
|
+
...processCreateParams(params)
|
|
1980
|
+
});
|
|
1981
|
+
};
|
|
1982
|
+
var ZodBoolean = class extends ZodType {
|
|
1983
|
+
_parse(input) {
|
|
1984
|
+
if (this._def.coerce) {
|
|
1985
|
+
input.data = Boolean(input.data);
|
|
1986
|
+
}
|
|
1987
|
+
const parsedType = this._getType(input);
|
|
1988
|
+
if (parsedType !== ZodParsedType.boolean) {
|
|
1989
|
+
const ctx = this._getOrReturnCtx(input);
|
|
1990
|
+
addIssueToContext(ctx, {
|
|
1991
|
+
code: ZodIssueCode.invalid_type,
|
|
1992
|
+
expected: ZodParsedType.boolean,
|
|
1993
|
+
received: ctx.parsedType
|
|
1994
|
+
});
|
|
1995
|
+
return INVALID;
|
|
1996
|
+
}
|
|
1997
|
+
return OK(input.data);
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
2000
|
+
ZodBoolean.create = (params) => {
|
|
2001
|
+
return new ZodBoolean({
|
|
2002
|
+
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
2003
|
+
coerce: params?.coerce || false,
|
|
2004
|
+
...processCreateParams(params)
|
|
2005
|
+
});
|
|
2006
|
+
};
|
|
2007
|
+
var ZodDate = class _ZodDate extends ZodType {
|
|
2008
|
+
_parse(input) {
|
|
2009
|
+
if (this._def.coerce) {
|
|
2010
|
+
input.data = new Date(input.data);
|
|
2011
|
+
}
|
|
2012
|
+
const parsedType = this._getType(input);
|
|
2013
|
+
if (parsedType !== ZodParsedType.date) {
|
|
2014
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
2015
|
+
addIssueToContext(ctx2, {
|
|
2016
|
+
code: ZodIssueCode.invalid_type,
|
|
2017
|
+
expected: ZodParsedType.date,
|
|
2018
|
+
received: ctx2.parsedType
|
|
2019
|
+
});
|
|
2020
|
+
return INVALID;
|
|
2021
|
+
}
|
|
2022
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
2023
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
2024
|
+
addIssueToContext(ctx2, {
|
|
2025
|
+
code: ZodIssueCode.invalid_date
|
|
2026
|
+
});
|
|
2027
|
+
return INVALID;
|
|
2028
|
+
}
|
|
2029
|
+
const status = new ParseStatus();
|
|
2030
|
+
let ctx = void 0;
|
|
2031
|
+
for (const check of this._def.checks) {
|
|
2032
|
+
if (check.kind === "min") {
|
|
2033
|
+
if (input.data.getTime() < check.value) {
|
|
2034
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2035
|
+
addIssueToContext(ctx, {
|
|
2036
|
+
code: ZodIssueCode.too_small,
|
|
2037
|
+
message: check.message,
|
|
2038
|
+
inclusive: true,
|
|
2039
|
+
exact: false,
|
|
2040
|
+
minimum: check.value,
|
|
2041
|
+
type: "date"
|
|
2042
|
+
});
|
|
2043
|
+
status.dirty();
|
|
2044
|
+
}
|
|
2045
|
+
} else if (check.kind === "max") {
|
|
2046
|
+
if (input.data.getTime() > check.value) {
|
|
2047
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2048
|
+
addIssueToContext(ctx, {
|
|
2049
|
+
code: ZodIssueCode.too_big,
|
|
2050
|
+
message: check.message,
|
|
2051
|
+
inclusive: true,
|
|
2052
|
+
exact: false,
|
|
2053
|
+
maximum: check.value,
|
|
2054
|
+
type: "date"
|
|
2055
|
+
});
|
|
2056
|
+
status.dirty();
|
|
2057
|
+
}
|
|
2058
|
+
} else {
|
|
2059
|
+
util.assertNever(check);
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
return {
|
|
2063
|
+
status: status.value,
|
|
2064
|
+
value: new Date(input.data.getTime())
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
_addCheck(check) {
|
|
2068
|
+
return new _ZodDate({
|
|
2069
|
+
...this._def,
|
|
2070
|
+
checks: [...this._def.checks, check]
|
|
2071
|
+
});
|
|
2072
|
+
}
|
|
2073
|
+
min(minDate, message) {
|
|
2074
|
+
return this._addCheck({
|
|
2075
|
+
kind: "min",
|
|
2076
|
+
value: minDate.getTime(),
|
|
2077
|
+
message: errorUtil.toString(message)
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
max(maxDate, message) {
|
|
2081
|
+
return this._addCheck({
|
|
2082
|
+
kind: "max",
|
|
2083
|
+
value: maxDate.getTime(),
|
|
2084
|
+
message: errorUtil.toString(message)
|
|
2085
|
+
});
|
|
2086
|
+
}
|
|
2087
|
+
get minDate() {
|
|
2088
|
+
let min = null;
|
|
2089
|
+
for (const ch of this._def.checks) {
|
|
2090
|
+
if (ch.kind === "min") {
|
|
2091
|
+
if (min === null || ch.value > min)
|
|
2092
|
+
min = ch.value;
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
return min != null ? new Date(min) : null;
|
|
2096
|
+
}
|
|
2097
|
+
get maxDate() {
|
|
2098
|
+
let max = null;
|
|
2099
|
+
for (const ch of this._def.checks) {
|
|
2100
|
+
if (ch.kind === "max") {
|
|
2101
|
+
if (max === null || ch.value < max)
|
|
2102
|
+
max = ch.value;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return max != null ? new Date(max) : null;
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
ZodDate.create = (params) => {
|
|
2109
|
+
return new ZodDate({
|
|
2110
|
+
checks: [],
|
|
2111
|
+
coerce: params?.coerce || false,
|
|
2112
|
+
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
2113
|
+
...processCreateParams(params)
|
|
2114
|
+
});
|
|
2115
|
+
};
|
|
2116
|
+
var ZodSymbol = class extends ZodType {
|
|
2117
|
+
_parse(input) {
|
|
2118
|
+
const parsedType = this._getType(input);
|
|
2119
|
+
if (parsedType !== ZodParsedType.symbol) {
|
|
2120
|
+
const ctx = this._getOrReturnCtx(input);
|
|
2121
|
+
addIssueToContext(ctx, {
|
|
2122
|
+
code: ZodIssueCode.invalid_type,
|
|
2123
|
+
expected: ZodParsedType.symbol,
|
|
2124
|
+
received: ctx.parsedType
|
|
2125
|
+
});
|
|
2126
|
+
return INVALID;
|
|
2127
|
+
}
|
|
2128
|
+
return OK(input.data);
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2131
|
+
ZodSymbol.create = (params) => {
|
|
2132
|
+
return new ZodSymbol({
|
|
2133
|
+
typeName: ZodFirstPartyTypeKind.ZodSymbol,
|
|
2134
|
+
...processCreateParams(params)
|
|
2135
|
+
});
|
|
2136
|
+
};
|
|
2137
|
+
var ZodUndefined = class extends ZodType {
|
|
2138
|
+
_parse(input) {
|
|
2139
|
+
const parsedType = this._getType(input);
|
|
2140
|
+
if (parsedType !== ZodParsedType.undefined) {
|
|
2141
|
+
const ctx = this._getOrReturnCtx(input);
|
|
2142
|
+
addIssueToContext(ctx, {
|
|
2143
|
+
code: ZodIssueCode.invalid_type,
|
|
2144
|
+
expected: ZodParsedType.undefined,
|
|
2145
|
+
received: ctx.parsedType
|
|
2146
|
+
});
|
|
2147
|
+
return INVALID;
|
|
2148
|
+
}
|
|
2149
|
+
return OK(input.data);
|
|
2150
|
+
}
|
|
2151
|
+
};
|
|
2152
|
+
ZodUndefined.create = (params) => {
|
|
2153
|
+
return new ZodUndefined({
|
|
2154
|
+
typeName: ZodFirstPartyTypeKind.ZodUndefined,
|
|
2155
|
+
...processCreateParams(params)
|
|
2156
|
+
});
|
|
2157
|
+
};
|
|
2158
|
+
var ZodNull = class extends ZodType {
|
|
2159
|
+
_parse(input) {
|
|
2160
|
+
const parsedType = this._getType(input);
|
|
2161
|
+
if (parsedType !== ZodParsedType.null) {
|
|
2162
|
+
const ctx = this._getOrReturnCtx(input);
|
|
2163
|
+
addIssueToContext(ctx, {
|
|
2164
|
+
code: ZodIssueCode.invalid_type,
|
|
2165
|
+
expected: ZodParsedType.null,
|
|
2166
|
+
received: ctx.parsedType
|
|
2167
|
+
});
|
|
2168
|
+
return INVALID;
|
|
2169
|
+
}
|
|
2170
|
+
return OK(input.data);
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
ZodNull.create = (params) => {
|
|
2174
|
+
return new ZodNull({
|
|
2175
|
+
typeName: ZodFirstPartyTypeKind.ZodNull,
|
|
2176
|
+
...processCreateParams(params)
|
|
2177
|
+
});
|
|
2178
|
+
};
|
|
2179
|
+
var ZodAny = class extends ZodType {
|
|
2180
|
+
constructor() {
|
|
2181
|
+
super(...arguments);
|
|
2182
|
+
this._any = true;
|
|
2183
|
+
}
|
|
2184
|
+
_parse(input) {
|
|
2185
|
+
return OK(input.data);
|
|
2186
|
+
}
|
|
2187
|
+
};
|
|
2188
|
+
ZodAny.create = (params) => {
|
|
2189
|
+
return new ZodAny({
|
|
2190
|
+
typeName: ZodFirstPartyTypeKind.ZodAny,
|
|
2191
|
+
...processCreateParams(params)
|
|
2192
|
+
});
|
|
2193
|
+
};
|
|
2194
|
+
var ZodUnknown = class extends ZodType {
|
|
2195
|
+
constructor() {
|
|
2196
|
+
super(...arguments);
|
|
2197
|
+
this._unknown = true;
|
|
2198
|
+
}
|
|
2199
|
+
_parse(input) {
|
|
2200
|
+
return OK(input.data);
|
|
2201
|
+
}
|
|
2202
|
+
};
|
|
2203
|
+
ZodUnknown.create = (params) => {
|
|
2204
|
+
return new ZodUnknown({
|
|
2205
|
+
typeName: ZodFirstPartyTypeKind.ZodUnknown,
|
|
2206
|
+
...processCreateParams(params)
|
|
2207
|
+
});
|
|
2208
|
+
};
|
|
2209
|
+
var ZodNever = class extends ZodType {
|
|
2210
|
+
_parse(input) {
|
|
2211
|
+
const ctx = this._getOrReturnCtx(input);
|
|
2212
|
+
addIssueToContext(ctx, {
|
|
2213
|
+
code: ZodIssueCode.invalid_type,
|
|
2214
|
+
expected: ZodParsedType.never,
|
|
2215
|
+
received: ctx.parsedType
|
|
2216
|
+
});
|
|
2217
|
+
return INVALID;
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
ZodNever.create = (params) => {
|
|
2221
|
+
return new ZodNever({
|
|
2222
|
+
typeName: ZodFirstPartyTypeKind.ZodNever,
|
|
2223
|
+
...processCreateParams(params)
|
|
2224
|
+
});
|
|
2225
|
+
};
|
|
2226
|
+
var ZodVoid = class extends ZodType {
|
|
2227
|
+
_parse(input) {
|
|
2228
|
+
const parsedType = this._getType(input);
|
|
2229
|
+
if (parsedType !== ZodParsedType.undefined) {
|
|
2230
|
+
const ctx = this._getOrReturnCtx(input);
|
|
2231
|
+
addIssueToContext(ctx, {
|
|
2232
|
+
code: ZodIssueCode.invalid_type,
|
|
2233
|
+
expected: ZodParsedType.void,
|
|
2234
|
+
received: ctx.parsedType
|
|
2235
|
+
});
|
|
2236
|
+
return INVALID;
|
|
2237
|
+
}
|
|
2238
|
+
return OK(input.data);
|
|
2239
|
+
}
|
|
2240
|
+
};
|
|
2241
|
+
ZodVoid.create = (params) => {
|
|
2242
|
+
return new ZodVoid({
|
|
2243
|
+
typeName: ZodFirstPartyTypeKind.ZodVoid,
|
|
2244
|
+
...processCreateParams(params)
|
|
2245
|
+
});
|
|
2246
|
+
};
|
|
2247
|
+
var ZodArray = class _ZodArray extends ZodType {
|
|
2248
|
+
_parse(input) {
|
|
2249
|
+
const { ctx, status } = this._processInputParams(input);
|
|
2250
|
+
const def = this._def;
|
|
2251
|
+
if (ctx.parsedType !== ZodParsedType.array) {
|
|
2252
|
+
addIssueToContext(ctx, {
|
|
2253
|
+
code: ZodIssueCode.invalid_type,
|
|
2254
|
+
expected: ZodParsedType.array,
|
|
2255
|
+
received: ctx.parsedType
|
|
2256
|
+
});
|
|
2257
|
+
return INVALID;
|
|
2258
|
+
}
|
|
2259
|
+
if (def.exactLength !== null) {
|
|
2260
|
+
const tooBig = ctx.data.length > def.exactLength.value;
|
|
2261
|
+
const tooSmall = ctx.data.length < def.exactLength.value;
|
|
2262
|
+
if (tooBig || tooSmall) {
|
|
2263
|
+
addIssueToContext(ctx, {
|
|
2264
|
+
code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
|
|
2265
|
+
minimum: tooSmall ? def.exactLength.value : void 0,
|
|
2266
|
+
maximum: tooBig ? def.exactLength.value : void 0,
|
|
2267
|
+
type: "array",
|
|
2268
|
+
inclusive: true,
|
|
2269
|
+
exact: true,
|
|
2270
|
+
message: def.exactLength.message
|
|
2271
|
+
});
|
|
2272
|
+
status.dirty();
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
if (def.minLength !== null) {
|
|
2276
|
+
if (ctx.data.length < def.minLength.value) {
|
|
2277
|
+
addIssueToContext(ctx, {
|
|
2278
|
+
code: ZodIssueCode.too_small,
|
|
2279
|
+
minimum: def.minLength.value,
|
|
2280
|
+
type: "array",
|
|
2281
|
+
inclusive: true,
|
|
2282
|
+
exact: false,
|
|
2283
|
+
message: def.minLength.message
|
|
2284
|
+
});
|
|
2285
|
+
status.dirty();
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
if (def.maxLength !== null) {
|
|
2289
|
+
if (ctx.data.length > def.maxLength.value) {
|
|
2290
|
+
addIssueToContext(ctx, {
|
|
2291
|
+
code: ZodIssueCode.too_big,
|
|
2292
|
+
maximum: def.maxLength.value,
|
|
2293
|
+
type: "array",
|
|
2294
|
+
inclusive: true,
|
|
2295
|
+
exact: false,
|
|
2296
|
+
message: def.maxLength.message
|
|
2297
|
+
});
|
|
2298
|
+
status.dirty();
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
if (ctx.common.async) {
|
|
2302
|
+
return Promise.all([...ctx.data].map((item, i) => {
|
|
2303
|
+
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2304
|
+
})).then((result2) => {
|
|
2305
|
+
return ParseStatus.mergeArray(status, result2);
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
const result = [...ctx.data].map((item, i) => {
|
|
2309
|
+
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2310
|
+
});
|
|
2311
|
+
return ParseStatus.mergeArray(status, result);
|
|
2312
|
+
}
|
|
2313
|
+
get element() {
|
|
2314
|
+
return this._def.type;
|
|
2315
|
+
}
|
|
2316
|
+
min(minLength, message) {
|
|
2317
|
+
return new _ZodArray({
|
|
2318
|
+
...this._def,
|
|
2319
|
+
minLength: { value: minLength, message: errorUtil.toString(message) }
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
max(maxLength, message) {
|
|
2323
|
+
return new _ZodArray({
|
|
2324
|
+
...this._def,
|
|
2325
|
+
maxLength: { value: maxLength, message: errorUtil.toString(message) }
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
length(len, message) {
|
|
2329
|
+
return new _ZodArray({
|
|
2330
|
+
...this._def,
|
|
2331
|
+
exactLength: { value: len, message: errorUtil.toString(message) }
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
nonempty(message) {
|
|
2335
|
+
return this.min(1, message);
|
|
2336
|
+
}
|
|
2337
|
+
};
|
|
2338
|
+
ZodArray.create = (schema, params) => {
|
|
2339
|
+
return new ZodArray({
|
|
2340
|
+
type: schema,
|
|
2341
|
+
minLength: null,
|
|
2342
|
+
maxLength: null,
|
|
2343
|
+
exactLength: null,
|
|
2344
|
+
typeName: ZodFirstPartyTypeKind.ZodArray,
|
|
2345
|
+
...processCreateParams(params)
|
|
2346
|
+
});
|
|
2347
|
+
};
|
|
2348
|
+
function deepPartialify(schema) {
|
|
2349
|
+
if (schema instanceof ZodObject) {
|
|
2350
|
+
const newShape = {};
|
|
2351
|
+
for (const key in schema.shape) {
|
|
2352
|
+
const fieldSchema = schema.shape[key];
|
|
2353
|
+
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
|
2354
|
+
}
|
|
2355
|
+
return new ZodObject({
|
|
2356
|
+
...schema._def,
|
|
2357
|
+
shape: () => newShape
|
|
2358
|
+
});
|
|
2359
|
+
} else if (schema instanceof ZodArray) {
|
|
2360
|
+
return new ZodArray({
|
|
2361
|
+
...schema._def,
|
|
2362
|
+
type: deepPartialify(schema.element)
|
|
2363
|
+
});
|
|
2364
|
+
} else if (schema instanceof ZodOptional) {
|
|
2365
|
+
return ZodOptional.create(deepPartialify(schema.unwrap()));
|
|
2366
|
+
} else if (schema instanceof ZodNullable) {
|
|
2367
|
+
return ZodNullable.create(deepPartialify(schema.unwrap()));
|
|
2368
|
+
} else if (schema instanceof ZodTuple) {
|
|
2369
|
+
return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
|
|
2370
|
+
} else {
|
|
2371
|
+
return schema;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
var ZodObject = class _ZodObject extends ZodType {
|
|
2375
|
+
constructor() {
|
|
2376
|
+
super(...arguments);
|
|
2377
|
+
this._cached = null;
|
|
2378
|
+
this.nonstrict = this.passthrough;
|
|
2379
|
+
this.augment = this.extend;
|
|
2380
|
+
}
|
|
2381
|
+
_getCached() {
|
|
2382
|
+
if (this._cached !== null)
|
|
2383
|
+
return this._cached;
|
|
2384
|
+
const shape = this._def.shape();
|
|
2385
|
+
const keys = util.objectKeys(shape);
|
|
2386
|
+
this._cached = { shape, keys };
|
|
2387
|
+
return this._cached;
|
|
2388
|
+
}
|
|
2389
|
+
_parse(input) {
|
|
2390
|
+
const parsedType = this._getType(input);
|
|
2391
|
+
if (parsedType !== ZodParsedType.object) {
|
|
2392
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
2393
|
+
addIssueToContext(ctx2, {
|
|
2394
|
+
code: ZodIssueCode.invalid_type,
|
|
2395
|
+
expected: ZodParsedType.object,
|
|
2396
|
+
received: ctx2.parsedType
|
|
2397
|
+
});
|
|
2398
|
+
return INVALID;
|
|
2399
|
+
}
|
|
2400
|
+
const { status, ctx } = this._processInputParams(input);
|
|
2401
|
+
const { shape, keys: shapeKeys } = this._getCached();
|
|
2402
|
+
const extraKeys = [];
|
|
2403
|
+
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
2404
|
+
for (const key in ctx.data) {
|
|
2405
|
+
if (!shapeKeys.includes(key)) {
|
|
2406
|
+
extraKeys.push(key);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
const pairs = [];
|
|
2411
|
+
for (const key of shapeKeys) {
|
|
2412
|
+
const keyValidator = shape[key];
|
|
2413
|
+
const value = ctx.data[key];
|
|
2414
|
+
pairs.push({
|
|
2415
|
+
key: { status: "valid", value: key },
|
|
2416
|
+
value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
|
2417
|
+
alwaysSet: key in ctx.data
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
if (this._def.catchall instanceof ZodNever) {
|
|
2421
|
+
const unknownKeys = this._def.unknownKeys;
|
|
2422
|
+
if (unknownKeys === "passthrough") {
|
|
2423
|
+
for (const key of extraKeys) {
|
|
2424
|
+
pairs.push({
|
|
2425
|
+
key: { status: "valid", value: key },
|
|
2426
|
+
value: { status: "valid", value: ctx.data[key] }
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
} else if (unknownKeys === "strict") {
|
|
2430
|
+
if (extraKeys.length > 0) {
|
|
2431
|
+
addIssueToContext(ctx, {
|
|
2432
|
+
code: ZodIssueCode.unrecognized_keys,
|
|
2433
|
+
keys: extraKeys
|
|
2434
|
+
});
|
|
2435
|
+
status.dirty();
|
|
2436
|
+
}
|
|
2437
|
+
} else if (unknownKeys === "strip") {
|
|
2438
|
+
} else {
|
|
2439
|
+
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
2440
|
+
}
|
|
2441
|
+
} else {
|
|
2442
|
+
const catchall = this._def.catchall;
|
|
2443
|
+
for (const key of extraKeys) {
|
|
2444
|
+
const value = ctx.data[key];
|
|
2445
|
+
pairs.push({
|
|
2446
|
+
key: { status: "valid", value: key },
|
|
2447
|
+
value: catchall._parse(
|
|
2448
|
+
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
|
2449
|
+
//, ctx.child(key), value, getParsedType(value)
|
|
2450
|
+
),
|
|
2451
|
+
alwaysSet: key in ctx.data
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
if (ctx.common.async) {
|
|
2456
|
+
return Promise.resolve().then(async () => {
|
|
2457
|
+
const syncPairs = [];
|
|
2458
|
+
for (const pair of pairs) {
|
|
2459
|
+
const key = await pair.key;
|
|
2460
|
+
const value = await pair.value;
|
|
2461
|
+
syncPairs.push({
|
|
2462
|
+
key,
|
|
2463
|
+
value,
|
|
2464
|
+
alwaysSet: pair.alwaysSet
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
return syncPairs;
|
|
2468
|
+
}).then((syncPairs) => {
|
|
2469
|
+
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
2470
|
+
});
|
|
2471
|
+
} else {
|
|
2472
|
+
return ParseStatus.mergeObjectSync(status, pairs);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
get shape() {
|
|
2476
|
+
return this._def.shape();
|
|
2477
|
+
}
|
|
2478
|
+
strict(message) {
|
|
2479
|
+
errorUtil.errToObj;
|
|
2480
|
+
return new _ZodObject({
|
|
2481
|
+
...this._def,
|
|
2482
|
+
unknownKeys: "strict",
|
|
2483
|
+
...message !== void 0 ? {
|
|
2484
|
+
errorMap: (issue, ctx) => {
|
|
2485
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
2486
|
+
if (issue.code === "unrecognized_keys")
|
|
2487
|
+
return {
|
|
2488
|
+
message: errorUtil.errToObj(message).message ?? defaultError
|
|
2489
|
+
};
|
|
2490
|
+
return {
|
|
2491
|
+
message: defaultError
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
} : {}
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
strip() {
|
|
2498
|
+
return new _ZodObject({
|
|
2499
|
+
...this._def,
|
|
2500
|
+
unknownKeys: "strip"
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
passthrough() {
|
|
2504
|
+
return new _ZodObject({
|
|
2505
|
+
...this._def,
|
|
2506
|
+
unknownKeys: "passthrough"
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
// const AugmentFactory =
|
|
2510
|
+
// <Def extends ZodObjectDef>(def: Def) =>
|
|
2511
|
+
// <Augmentation extends ZodRawShape>(
|
|
2512
|
+
// augmentation: Augmentation
|
|
2513
|
+
// ): ZodObject<
|
|
2514
|
+
// extendShape<ReturnType<Def["shape"]>, Augmentation>,
|
|
2515
|
+
// Def["unknownKeys"],
|
|
2516
|
+
// Def["catchall"]
|
|
2517
|
+
// > => {
|
|
2518
|
+
// return new ZodObject({
|
|
2519
|
+
// ...def,
|
|
2520
|
+
// shape: () => ({
|
|
2521
|
+
// ...def.shape(),
|
|
2522
|
+
// ...augmentation,
|
|
2523
|
+
// }),
|
|
2524
|
+
// }) as any;
|
|
2525
|
+
// };
|
|
2526
|
+
extend(augmentation) {
|
|
2527
|
+
return new _ZodObject({
|
|
2528
|
+
...this._def,
|
|
2529
|
+
shape: () => ({
|
|
2530
|
+
...this._def.shape(),
|
|
2531
|
+
...augmentation
|
|
2532
|
+
})
|
|
2533
|
+
});
|
|
2534
|
+
}
|
|
2535
|
+
/**
|
|
2536
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
2537
|
+
* inferred type of merged objects. Please
|
|
2538
|
+
* upgrade if you are experiencing issues.
|
|
2539
|
+
*/
|
|
2540
|
+
merge(merging) {
|
|
2541
|
+
const merged = new _ZodObject({
|
|
2542
|
+
unknownKeys: merging._def.unknownKeys,
|
|
2543
|
+
catchall: merging._def.catchall,
|
|
2544
|
+
shape: () => ({
|
|
2545
|
+
...this._def.shape(),
|
|
2546
|
+
...merging._def.shape()
|
|
2547
|
+
}),
|
|
2548
|
+
typeName: ZodFirstPartyTypeKind.ZodObject
|
|
2549
|
+
});
|
|
2550
|
+
return merged;
|
|
2551
|
+
}
|
|
2552
|
+
// merge<
|
|
2553
|
+
// Incoming extends AnyZodObject,
|
|
2554
|
+
// Augmentation extends Incoming["shape"],
|
|
2555
|
+
// NewOutput extends {
|
|
2556
|
+
// [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
|
|
2557
|
+
// ? Augmentation[k]["_output"]
|
|
2558
|
+
// : k extends keyof Output
|
|
2559
|
+
// ? Output[k]
|
|
2560
|
+
// : never;
|
|
2561
|
+
// },
|
|
2562
|
+
// NewInput extends {
|
|
2563
|
+
// [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
|
|
2564
|
+
// ? Augmentation[k]["_input"]
|
|
2565
|
+
// : k extends keyof Input
|
|
2566
|
+
// ? Input[k]
|
|
2567
|
+
// : never;
|
|
2568
|
+
// }
|
|
2569
|
+
// >(
|
|
2570
|
+
// merging: Incoming
|
|
2571
|
+
// ): ZodObject<
|
|
2572
|
+
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
2573
|
+
// Incoming["_def"]["unknownKeys"],
|
|
2574
|
+
// Incoming["_def"]["catchall"],
|
|
2575
|
+
// NewOutput,
|
|
2576
|
+
// NewInput
|
|
2577
|
+
// > {
|
|
2578
|
+
// const merged: any = new ZodObject({
|
|
2579
|
+
// unknownKeys: merging._def.unknownKeys,
|
|
2580
|
+
// catchall: merging._def.catchall,
|
|
2581
|
+
// shape: () =>
|
|
2582
|
+
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
2583
|
+
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2584
|
+
// }) as any;
|
|
2585
|
+
// return merged;
|
|
2586
|
+
// }
|
|
2587
|
+
setKey(key, schema) {
|
|
2588
|
+
return this.augment({ [key]: schema });
|
|
2589
|
+
}
|
|
2590
|
+
// merge<Incoming extends AnyZodObject>(
|
|
2591
|
+
// merging: Incoming
|
|
2592
|
+
// ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
|
|
2593
|
+
// ZodObject<
|
|
2594
|
+
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
2595
|
+
// Incoming["_def"]["unknownKeys"],
|
|
2596
|
+
// Incoming["_def"]["catchall"]
|
|
2597
|
+
// > {
|
|
2598
|
+
// // const mergedShape = objectUtil.mergeShapes(
|
|
2599
|
+
// // this._def.shape(),
|
|
2600
|
+
// // merging._def.shape()
|
|
2601
|
+
// // );
|
|
2602
|
+
// const merged: any = new ZodObject({
|
|
2603
|
+
// unknownKeys: merging._def.unknownKeys,
|
|
2604
|
+
// catchall: merging._def.catchall,
|
|
2605
|
+
// shape: () =>
|
|
2606
|
+
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
2607
|
+
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2608
|
+
// }) as any;
|
|
2609
|
+
// return merged;
|
|
2610
|
+
// }
|
|
2611
|
+
catchall(index) {
|
|
2612
|
+
return new _ZodObject({
|
|
2613
|
+
...this._def,
|
|
2614
|
+
catchall: index
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
pick(mask) {
|
|
2618
|
+
const shape = {};
|
|
2619
|
+
for (const key of util.objectKeys(mask)) {
|
|
2620
|
+
if (mask[key] && this.shape[key]) {
|
|
2621
|
+
shape[key] = this.shape[key];
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
return new _ZodObject({
|
|
2625
|
+
...this._def,
|
|
2626
|
+
shape: () => shape
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
omit(mask) {
|
|
2630
|
+
const shape = {};
|
|
2631
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2632
|
+
if (!mask[key]) {
|
|
2633
|
+
shape[key] = this.shape[key];
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
return new _ZodObject({
|
|
2637
|
+
...this._def,
|
|
2638
|
+
shape: () => shape
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* @deprecated
|
|
2643
|
+
*/
|
|
2644
|
+
deepPartial() {
|
|
2645
|
+
return deepPartialify(this);
|
|
2646
|
+
}
|
|
2647
|
+
partial(mask) {
|
|
2648
|
+
const newShape = {};
|
|
2649
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2650
|
+
const fieldSchema = this.shape[key];
|
|
2651
|
+
if (mask && !mask[key]) {
|
|
2652
|
+
newShape[key] = fieldSchema;
|
|
2653
|
+
} else {
|
|
2654
|
+
newShape[key] = fieldSchema.optional();
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
return new _ZodObject({
|
|
2658
|
+
...this._def,
|
|
2659
|
+
shape: () => newShape
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
required(mask) {
|
|
2663
|
+
const newShape = {};
|
|
2664
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2665
|
+
if (mask && !mask[key]) {
|
|
2666
|
+
newShape[key] = this.shape[key];
|
|
2667
|
+
} else {
|
|
2668
|
+
const fieldSchema = this.shape[key];
|
|
2669
|
+
let newField = fieldSchema;
|
|
2670
|
+
while (newField instanceof ZodOptional) {
|
|
2671
|
+
newField = newField._def.innerType;
|
|
2672
|
+
}
|
|
2673
|
+
newShape[key] = newField;
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
return new _ZodObject({
|
|
2677
|
+
...this._def,
|
|
2678
|
+
shape: () => newShape
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
2681
|
+
keyof() {
|
|
2682
|
+
return createZodEnum(util.objectKeys(this.shape));
|
|
2683
|
+
}
|
|
2684
|
+
};
|
|
2685
|
+
ZodObject.create = (shape, params) => {
|
|
2686
|
+
return new ZodObject({
|
|
2687
|
+
shape: () => shape,
|
|
2688
|
+
unknownKeys: "strip",
|
|
2689
|
+
catchall: ZodNever.create(),
|
|
2690
|
+
typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2691
|
+
...processCreateParams(params)
|
|
2692
|
+
});
|
|
2693
|
+
};
|
|
2694
|
+
ZodObject.strictCreate = (shape, params) => {
|
|
2695
|
+
return new ZodObject({
|
|
2696
|
+
shape: () => shape,
|
|
2697
|
+
unknownKeys: "strict",
|
|
2698
|
+
catchall: ZodNever.create(),
|
|
2699
|
+
typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2700
|
+
...processCreateParams(params)
|
|
2701
|
+
});
|
|
2702
|
+
};
|
|
2703
|
+
ZodObject.lazycreate = (shape, params) => {
|
|
2704
|
+
return new ZodObject({
|
|
2705
|
+
shape,
|
|
2706
|
+
unknownKeys: "strip",
|
|
2707
|
+
catchall: ZodNever.create(),
|
|
2708
|
+
typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2709
|
+
...processCreateParams(params)
|
|
2710
|
+
});
|
|
2711
|
+
};
|
|
2712
|
+
var ZodUnion = class extends ZodType {
|
|
2713
|
+
_parse(input) {
|
|
2714
|
+
const { ctx } = this._processInputParams(input);
|
|
2715
|
+
const options = this._def.options;
|
|
2716
|
+
function handleResults(results) {
|
|
2717
|
+
for (const result of results) {
|
|
2718
|
+
if (result.result.status === "valid") {
|
|
2719
|
+
return result.result;
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
for (const result of results) {
|
|
2723
|
+
if (result.result.status === "dirty") {
|
|
2724
|
+
ctx.common.issues.push(...result.ctx.common.issues);
|
|
2725
|
+
return result.result;
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
|
|
2729
|
+
addIssueToContext(ctx, {
|
|
2730
|
+
code: ZodIssueCode.invalid_union,
|
|
2731
|
+
unionErrors
|
|
2732
|
+
});
|
|
2733
|
+
return INVALID;
|
|
2734
|
+
}
|
|
2735
|
+
if (ctx.common.async) {
|
|
2736
|
+
return Promise.all(options.map(async (option) => {
|
|
2737
|
+
const childCtx = {
|
|
2738
|
+
...ctx,
|
|
2739
|
+
common: {
|
|
2740
|
+
...ctx.common,
|
|
2741
|
+
issues: []
|
|
2742
|
+
},
|
|
2743
|
+
parent: null
|
|
2744
|
+
};
|
|
2745
|
+
return {
|
|
2746
|
+
result: await option._parseAsync({
|
|
2747
|
+
data: ctx.data,
|
|
2748
|
+
path: ctx.path,
|
|
2749
|
+
parent: childCtx
|
|
2750
|
+
}),
|
|
2751
|
+
ctx: childCtx
|
|
2752
|
+
};
|
|
2753
|
+
})).then(handleResults);
|
|
2754
|
+
} else {
|
|
2755
|
+
let dirty = void 0;
|
|
2756
|
+
const issues = [];
|
|
2757
|
+
for (const option of options) {
|
|
2758
|
+
const childCtx = {
|
|
2759
|
+
...ctx,
|
|
2760
|
+
common: {
|
|
2761
|
+
...ctx.common,
|
|
2762
|
+
issues: []
|
|
2763
|
+
},
|
|
2764
|
+
parent: null
|
|
2765
|
+
};
|
|
2766
|
+
const result = option._parseSync({
|
|
2767
|
+
data: ctx.data,
|
|
2768
|
+
path: ctx.path,
|
|
2769
|
+
parent: childCtx
|
|
2770
|
+
});
|
|
2771
|
+
if (result.status === "valid") {
|
|
2772
|
+
return result;
|
|
2773
|
+
} else if (result.status === "dirty" && !dirty) {
|
|
2774
|
+
dirty = { result, ctx: childCtx };
|
|
2775
|
+
}
|
|
2776
|
+
if (childCtx.common.issues.length) {
|
|
2777
|
+
issues.push(childCtx.common.issues);
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
if (dirty) {
|
|
2781
|
+
ctx.common.issues.push(...dirty.ctx.common.issues);
|
|
2782
|
+
return dirty.result;
|
|
2783
|
+
}
|
|
2784
|
+
const unionErrors = issues.map((issues2) => new ZodError(issues2));
|
|
2785
|
+
addIssueToContext(ctx, {
|
|
2786
|
+
code: ZodIssueCode.invalid_union,
|
|
2787
|
+
unionErrors
|
|
2788
|
+
});
|
|
2789
|
+
return INVALID;
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
get options() {
|
|
2793
|
+
return this._def.options;
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
ZodUnion.create = (types, params) => {
|
|
2797
|
+
return new ZodUnion({
|
|
2798
|
+
options: types,
|
|
2799
|
+
typeName: ZodFirstPartyTypeKind.ZodUnion,
|
|
2800
|
+
...processCreateParams(params)
|
|
2801
|
+
});
|
|
2802
|
+
};
|
|
2803
|
+
var getDiscriminator = (type) => {
|
|
2804
|
+
if (type instanceof ZodLazy) {
|
|
2805
|
+
return getDiscriminator(type.schema);
|
|
2806
|
+
} else if (type instanceof ZodEffects) {
|
|
2807
|
+
return getDiscriminator(type.innerType());
|
|
2808
|
+
} else if (type instanceof ZodLiteral) {
|
|
2809
|
+
return [type.value];
|
|
2810
|
+
} else if (type instanceof ZodEnum) {
|
|
2811
|
+
return type.options;
|
|
2812
|
+
} else if (type instanceof ZodNativeEnum) {
|
|
2813
|
+
return util.objectValues(type.enum);
|
|
2814
|
+
} else if (type instanceof ZodDefault) {
|
|
2815
|
+
return getDiscriminator(type._def.innerType);
|
|
2816
|
+
} else if (type instanceof ZodUndefined) {
|
|
2817
|
+
return [void 0];
|
|
2818
|
+
} else if (type instanceof ZodNull) {
|
|
2819
|
+
return [null];
|
|
2820
|
+
} else if (type instanceof ZodOptional) {
|
|
2821
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
2822
|
+
} else if (type instanceof ZodNullable) {
|
|
2823
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
2824
|
+
} else if (type instanceof ZodBranded) {
|
|
2825
|
+
return getDiscriminator(type.unwrap());
|
|
2826
|
+
} else if (type instanceof ZodReadonly) {
|
|
2827
|
+
return getDiscriminator(type.unwrap());
|
|
2828
|
+
} else if (type instanceof ZodCatch) {
|
|
2829
|
+
return getDiscriminator(type._def.innerType);
|
|
2830
|
+
} else {
|
|
2831
|
+
return [];
|
|
2832
|
+
}
|
|
2833
|
+
};
|
|
2834
|
+
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
2835
|
+
_parse(input) {
|
|
2836
|
+
const { ctx } = this._processInputParams(input);
|
|
2837
|
+
if (ctx.parsedType !== ZodParsedType.object) {
|
|
2838
|
+
addIssueToContext(ctx, {
|
|
2839
|
+
code: ZodIssueCode.invalid_type,
|
|
2840
|
+
expected: ZodParsedType.object,
|
|
2841
|
+
received: ctx.parsedType
|
|
2842
|
+
});
|
|
2843
|
+
return INVALID;
|
|
2844
|
+
}
|
|
2845
|
+
const discriminator = this.discriminator;
|
|
2846
|
+
const discriminatorValue = ctx.data[discriminator];
|
|
2847
|
+
const option = this.optionsMap.get(discriminatorValue);
|
|
2848
|
+
if (!option) {
|
|
2849
|
+
addIssueToContext(ctx, {
|
|
2850
|
+
code: ZodIssueCode.invalid_union_discriminator,
|
|
2851
|
+
options: Array.from(this.optionsMap.keys()),
|
|
2852
|
+
path: [discriminator]
|
|
2853
|
+
});
|
|
2854
|
+
return INVALID;
|
|
2855
|
+
}
|
|
2856
|
+
if (ctx.common.async) {
|
|
2857
|
+
return option._parseAsync({
|
|
2858
|
+
data: ctx.data,
|
|
2859
|
+
path: ctx.path,
|
|
2860
|
+
parent: ctx
|
|
2861
|
+
});
|
|
2862
|
+
} else {
|
|
2863
|
+
return option._parseSync({
|
|
2864
|
+
data: ctx.data,
|
|
2865
|
+
path: ctx.path,
|
|
2866
|
+
parent: ctx
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
get discriminator() {
|
|
2871
|
+
return this._def.discriminator;
|
|
2872
|
+
}
|
|
2873
|
+
get options() {
|
|
2874
|
+
return this._def.options;
|
|
2875
|
+
}
|
|
2876
|
+
get optionsMap() {
|
|
2877
|
+
return this._def.optionsMap;
|
|
2878
|
+
}
|
|
2879
|
+
/**
|
|
2880
|
+
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
2881
|
+
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
2882
|
+
* have a different value for each object in the union.
|
|
2883
|
+
* @param discriminator the name of the discriminator property
|
|
2884
|
+
* @param types an array of object schemas
|
|
2885
|
+
* @param params
|
|
2886
|
+
*/
|
|
2887
|
+
static create(discriminator, options, params) {
|
|
2888
|
+
const optionsMap = /* @__PURE__ */ new Map();
|
|
2889
|
+
for (const type of options) {
|
|
2890
|
+
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
2891
|
+
if (!discriminatorValues.length) {
|
|
2892
|
+
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
2893
|
+
}
|
|
2894
|
+
for (const value of discriminatorValues) {
|
|
2895
|
+
if (optionsMap.has(value)) {
|
|
2896
|
+
throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
|
|
2897
|
+
}
|
|
2898
|
+
optionsMap.set(value, type);
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
return new _ZodDiscriminatedUnion({
|
|
2902
|
+
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
2903
|
+
discriminator,
|
|
2904
|
+
options,
|
|
2905
|
+
optionsMap,
|
|
2906
|
+
...processCreateParams(params)
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
};
|
|
2910
|
+
function mergeValues(a, b) {
|
|
2911
|
+
const aType = getParsedType(a);
|
|
2912
|
+
const bType = getParsedType(b);
|
|
2913
|
+
if (a === b) {
|
|
2914
|
+
return { valid: true, data: a };
|
|
2915
|
+
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
2916
|
+
const bKeys = util.objectKeys(b);
|
|
2917
|
+
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2918
|
+
const newObj = { ...a, ...b };
|
|
2919
|
+
for (const key of sharedKeys) {
|
|
2920
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
2921
|
+
if (!sharedValue.valid) {
|
|
2922
|
+
return { valid: false };
|
|
2923
|
+
}
|
|
2924
|
+
newObj[key] = sharedValue.data;
|
|
2925
|
+
}
|
|
2926
|
+
return { valid: true, data: newObj };
|
|
2927
|
+
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
|
2928
|
+
if (a.length !== b.length) {
|
|
2929
|
+
return { valid: false };
|
|
2930
|
+
}
|
|
2931
|
+
const newArray = [];
|
|
2932
|
+
for (let index = 0; index < a.length; index++) {
|
|
2933
|
+
const itemA = a[index];
|
|
2934
|
+
const itemB = b[index];
|
|
2935
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
2936
|
+
if (!sharedValue.valid) {
|
|
2937
|
+
return { valid: false };
|
|
2938
|
+
}
|
|
2939
|
+
newArray.push(sharedValue.data);
|
|
2940
|
+
}
|
|
2941
|
+
return { valid: true, data: newArray };
|
|
2942
|
+
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
|
2943
|
+
return { valid: true, data: a };
|
|
2944
|
+
} else {
|
|
2945
|
+
return { valid: false };
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
var ZodIntersection = class extends ZodType {
|
|
2949
|
+
_parse(input) {
|
|
2950
|
+
const { status, ctx } = this._processInputParams(input);
|
|
2951
|
+
const handleParsed = (parsedLeft, parsedRight) => {
|
|
2952
|
+
if (isAborted(parsedLeft) || isAborted(parsedRight)) {
|
|
2953
|
+
return INVALID;
|
|
2954
|
+
}
|
|
2955
|
+
const merged = mergeValues(parsedLeft.value, parsedRight.value);
|
|
2956
|
+
if (!merged.valid) {
|
|
2957
|
+
addIssueToContext(ctx, {
|
|
2958
|
+
code: ZodIssueCode.invalid_intersection_types
|
|
2959
|
+
});
|
|
2960
|
+
return INVALID;
|
|
2961
|
+
}
|
|
2962
|
+
if (isDirty(parsedLeft) || isDirty(parsedRight)) {
|
|
2963
|
+
status.dirty();
|
|
2964
|
+
}
|
|
2965
|
+
return { status: status.value, value: merged.data };
|
|
2966
|
+
};
|
|
2967
|
+
if (ctx.common.async) {
|
|
2968
|
+
return Promise.all([
|
|
2969
|
+
this._def.left._parseAsync({
|
|
2970
|
+
data: ctx.data,
|
|
2971
|
+
path: ctx.path,
|
|
2972
|
+
parent: ctx
|
|
2973
|
+
}),
|
|
2974
|
+
this._def.right._parseAsync({
|
|
2975
|
+
data: ctx.data,
|
|
2976
|
+
path: ctx.path,
|
|
2977
|
+
parent: ctx
|
|
2978
|
+
})
|
|
2979
|
+
]).then(([left, right]) => handleParsed(left, right));
|
|
2980
|
+
} else {
|
|
2981
|
+
return handleParsed(this._def.left._parseSync({
|
|
2982
|
+
data: ctx.data,
|
|
2983
|
+
path: ctx.path,
|
|
2984
|
+
parent: ctx
|
|
2985
|
+
}), this._def.right._parseSync({
|
|
2986
|
+
data: ctx.data,
|
|
2987
|
+
path: ctx.path,
|
|
2988
|
+
parent: ctx
|
|
2989
|
+
}));
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
};
|
|
2993
|
+
ZodIntersection.create = (left, right, params) => {
|
|
2994
|
+
return new ZodIntersection({
|
|
2995
|
+
left,
|
|
2996
|
+
right,
|
|
2997
|
+
typeName: ZodFirstPartyTypeKind.ZodIntersection,
|
|
2998
|
+
...processCreateParams(params)
|
|
2999
|
+
});
|
|
3000
|
+
};
|
|
3001
|
+
var ZodTuple = class _ZodTuple extends ZodType {
|
|
3002
|
+
_parse(input) {
|
|
3003
|
+
const { status, ctx } = this._processInputParams(input);
|
|
3004
|
+
if (ctx.parsedType !== ZodParsedType.array) {
|
|
3005
|
+
addIssueToContext(ctx, {
|
|
3006
|
+
code: ZodIssueCode.invalid_type,
|
|
3007
|
+
expected: ZodParsedType.array,
|
|
3008
|
+
received: ctx.parsedType
|
|
3009
|
+
});
|
|
3010
|
+
return INVALID;
|
|
3011
|
+
}
|
|
3012
|
+
if (ctx.data.length < this._def.items.length) {
|
|
3013
|
+
addIssueToContext(ctx, {
|
|
3014
|
+
code: ZodIssueCode.too_small,
|
|
3015
|
+
minimum: this._def.items.length,
|
|
3016
|
+
inclusive: true,
|
|
3017
|
+
exact: false,
|
|
3018
|
+
type: "array"
|
|
3019
|
+
});
|
|
3020
|
+
return INVALID;
|
|
3021
|
+
}
|
|
3022
|
+
const rest = this._def.rest;
|
|
3023
|
+
if (!rest && ctx.data.length > this._def.items.length) {
|
|
3024
|
+
addIssueToContext(ctx, {
|
|
3025
|
+
code: ZodIssueCode.too_big,
|
|
3026
|
+
maximum: this._def.items.length,
|
|
3027
|
+
inclusive: true,
|
|
3028
|
+
exact: false,
|
|
3029
|
+
type: "array"
|
|
3030
|
+
});
|
|
3031
|
+
status.dirty();
|
|
3032
|
+
}
|
|
3033
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
|
3034
|
+
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
3035
|
+
if (!schema)
|
|
3036
|
+
return null;
|
|
3037
|
+
return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
3038
|
+
}).filter((x) => !!x);
|
|
3039
|
+
if (ctx.common.async) {
|
|
3040
|
+
return Promise.all(items).then((results) => {
|
|
3041
|
+
return ParseStatus.mergeArray(status, results);
|
|
3042
|
+
});
|
|
3043
|
+
} else {
|
|
3044
|
+
return ParseStatus.mergeArray(status, items);
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
get items() {
|
|
3048
|
+
return this._def.items;
|
|
3049
|
+
}
|
|
3050
|
+
rest(rest) {
|
|
3051
|
+
return new _ZodTuple({
|
|
3052
|
+
...this._def,
|
|
3053
|
+
rest
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
};
|
|
3057
|
+
ZodTuple.create = (schemas, params) => {
|
|
3058
|
+
if (!Array.isArray(schemas)) {
|
|
3059
|
+
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
3060
|
+
}
|
|
3061
|
+
return new ZodTuple({
|
|
3062
|
+
items: schemas,
|
|
3063
|
+
typeName: ZodFirstPartyTypeKind.ZodTuple,
|
|
3064
|
+
rest: null,
|
|
3065
|
+
...processCreateParams(params)
|
|
3066
|
+
});
|
|
3067
|
+
};
|
|
3068
|
+
var ZodRecord = class _ZodRecord extends ZodType {
|
|
3069
|
+
get keySchema() {
|
|
3070
|
+
return this._def.keyType;
|
|
3071
|
+
}
|
|
3072
|
+
get valueSchema() {
|
|
3073
|
+
return this._def.valueType;
|
|
3074
|
+
}
|
|
3075
|
+
_parse(input) {
|
|
3076
|
+
const { status, ctx } = this._processInputParams(input);
|
|
3077
|
+
if (ctx.parsedType !== ZodParsedType.object) {
|
|
3078
|
+
addIssueToContext(ctx, {
|
|
3079
|
+
code: ZodIssueCode.invalid_type,
|
|
3080
|
+
expected: ZodParsedType.object,
|
|
3081
|
+
received: ctx.parsedType
|
|
3082
|
+
});
|
|
3083
|
+
return INVALID;
|
|
3084
|
+
}
|
|
3085
|
+
const pairs = [];
|
|
3086
|
+
const keyType = this._def.keyType;
|
|
3087
|
+
const valueType = this._def.valueType;
|
|
3088
|
+
for (const key in ctx.data) {
|
|
3089
|
+
pairs.push({
|
|
3090
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
3091
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
3092
|
+
alwaysSet: key in ctx.data
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
if (ctx.common.async) {
|
|
3096
|
+
return ParseStatus.mergeObjectAsync(status, pairs);
|
|
3097
|
+
} else {
|
|
3098
|
+
return ParseStatus.mergeObjectSync(status, pairs);
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
get element() {
|
|
3102
|
+
return this._def.valueType;
|
|
3103
|
+
}
|
|
3104
|
+
static create(first, second, third) {
|
|
3105
|
+
if (second instanceof ZodType) {
|
|
3106
|
+
return new _ZodRecord({
|
|
3107
|
+
keyType: first,
|
|
3108
|
+
valueType: second,
|
|
3109
|
+
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
3110
|
+
...processCreateParams(third)
|
|
3111
|
+
});
|
|
3112
|
+
}
|
|
3113
|
+
return new _ZodRecord({
|
|
3114
|
+
keyType: ZodString.create(),
|
|
3115
|
+
valueType: first,
|
|
3116
|
+
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
3117
|
+
...processCreateParams(second)
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
var ZodMap = class extends ZodType {
|
|
3122
|
+
get keySchema() {
|
|
3123
|
+
return this._def.keyType;
|
|
3124
|
+
}
|
|
3125
|
+
get valueSchema() {
|
|
3126
|
+
return this._def.valueType;
|
|
3127
|
+
}
|
|
3128
|
+
_parse(input) {
|
|
3129
|
+
const { status, ctx } = this._processInputParams(input);
|
|
3130
|
+
if (ctx.parsedType !== ZodParsedType.map) {
|
|
3131
|
+
addIssueToContext(ctx, {
|
|
3132
|
+
code: ZodIssueCode.invalid_type,
|
|
3133
|
+
expected: ZodParsedType.map,
|
|
3134
|
+
received: ctx.parsedType
|
|
3135
|
+
});
|
|
3136
|
+
return INVALID;
|
|
3137
|
+
}
|
|
3138
|
+
const keyType = this._def.keyType;
|
|
3139
|
+
const valueType = this._def.valueType;
|
|
3140
|
+
const pairs = [...ctx.data.entries()].map(([key, value], index) => {
|
|
3141
|
+
return {
|
|
3142
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
|
|
3143
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
|
|
3144
|
+
};
|
|
3145
|
+
});
|
|
3146
|
+
if (ctx.common.async) {
|
|
3147
|
+
const finalMap = /* @__PURE__ */ new Map();
|
|
3148
|
+
return Promise.resolve().then(async () => {
|
|
3149
|
+
for (const pair of pairs) {
|
|
3150
|
+
const key = await pair.key;
|
|
3151
|
+
const value = await pair.value;
|
|
3152
|
+
if (key.status === "aborted" || value.status === "aborted") {
|
|
3153
|
+
return INVALID;
|
|
3154
|
+
}
|
|
3155
|
+
if (key.status === "dirty" || value.status === "dirty") {
|
|
3156
|
+
status.dirty();
|
|
3157
|
+
}
|
|
3158
|
+
finalMap.set(key.value, value.value);
|
|
3159
|
+
}
|
|
3160
|
+
return { status: status.value, value: finalMap };
|
|
3161
|
+
});
|
|
3162
|
+
} else {
|
|
3163
|
+
const finalMap = /* @__PURE__ */ new Map();
|
|
3164
|
+
for (const pair of pairs) {
|
|
3165
|
+
const key = pair.key;
|
|
3166
|
+
const value = pair.value;
|
|
3167
|
+
if (key.status === "aborted" || value.status === "aborted") {
|
|
3168
|
+
return INVALID;
|
|
3169
|
+
}
|
|
3170
|
+
if (key.status === "dirty" || value.status === "dirty") {
|
|
3171
|
+
status.dirty();
|
|
3172
|
+
}
|
|
3173
|
+
finalMap.set(key.value, value.value);
|
|
3174
|
+
}
|
|
3175
|
+
return { status: status.value, value: finalMap };
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
ZodMap.create = (keyType, valueType, params) => {
|
|
3180
|
+
return new ZodMap({
|
|
3181
|
+
valueType,
|
|
3182
|
+
keyType,
|
|
3183
|
+
typeName: ZodFirstPartyTypeKind.ZodMap,
|
|
3184
|
+
...processCreateParams(params)
|
|
3185
|
+
});
|
|
3186
|
+
};
|
|
3187
|
+
var ZodSet = class _ZodSet extends ZodType {
|
|
3188
|
+
_parse(input) {
|
|
3189
|
+
const { status, ctx } = this._processInputParams(input);
|
|
3190
|
+
if (ctx.parsedType !== ZodParsedType.set) {
|
|
3191
|
+
addIssueToContext(ctx, {
|
|
3192
|
+
code: ZodIssueCode.invalid_type,
|
|
3193
|
+
expected: ZodParsedType.set,
|
|
3194
|
+
received: ctx.parsedType
|
|
3195
|
+
});
|
|
3196
|
+
return INVALID;
|
|
3197
|
+
}
|
|
3198
|
+
const def = this._def;
|
|
3199
|
+
if (def.minSize !== null) {
|
|
3200
|
+
if (ctx.data.size < def.minSize.value) {
|
|
3201
|
+
addIssueToContext(ctx, {
|
|
3202
|
+
code: ZodIssueCode.too_small,
|
|
3203
|
+
minimum: def.minSize.value,
|
|
3204
|
+
type: "set",
|
|
3205
|
+
inclusive: true,
|
|
3206
|
+
exact: false,
|
|
3207
|
+
message: def.minSize.message
|
|
3208
|
+
});
|
|
3209
|
+
status.dirty();
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
if (def.maxSize !== null) {
|
|
3213
|
+
if (ctx.data.size > def.maxSize.value) {
|
|
3214
|
+
addIssueToContext(ctx, {
|
|
3215
|
+
code: ZodIssueCode.too_big,
|
|
3216
|
+
maximum: def.maxSize.value,
|
|
3217
|
+
type: "set",
|
|
3218
|
+
inclusive: true,
|
|
3219
|
+
exact: false,
|
|
3220
|
+
message: def.maxSize.message
|
|
3221
|
+
});
|
|
3222
|
+
status.dirty();
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
const valueType = this._def.valueType;
|
|
3226
|
+
function finalizeSet(elements2) {
|
|
3227
|
+
const parsedSet = /* @__PURE__ */ new Set();
|
|
3228
|
+
for (const element of elements2) {
|
|
3229
|
+
if (element.status === "aborted")
|
|
3230
|
+
return INVALID;
|
|
3231
|
+
if (element.status === "dirty")
|
|
3232
|
+
status.dirty();
|
|
3233
|
+
parsedSet.add(element.value);
|
|
3234
|
+
}
|
|
3235
|
+
return { status: status.value, value: parsedSet };
|
|
3236
|
+
}
|
|
3237
|
+
const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
|
|
3238
|
+
if (ctx.common.async) {
|
|
3239
|
+
return Promise.all(elements).then((elements2) => finalizeSet(elements2));
|
|
3240
|
+
} else {
|
|
3241
|
+
return finalizeSet(elements);
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
min(minSize, message) {
|
|
3245
|
+
return new _ZodSet({
|
|
3246
|
+
...this._def,
|
|
3247
|
+
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
3248
|
+
});
|
|
3249
|
+
}
|
|
3250
|
+
max(maxSize, message) {
|
|
3251
|
+
return new _ZodSet({
|
|
3252
|
+
...this._def,
|
|
3253
|
+
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
3254
|
+
});
|
|
3255
|
+
}
|
|
3256
|
+
size(size, message) {
|
|
3257
|
+
return this.min(size, message).max(size, message);
|
|
3258
|
+
}
|
|
3259
|
+
nonempty(message) {
|
|
3260
|
+
return this.min(1, message);
|
|
3261
|
+
}
|
|
3262
|
+
};
|
|
3263
|
+
ZodSet.create = (valueType, params) => {
|
|
3264
|
+
return new ZodSet({
|
|
3265
|
+
valueType,
|
|
3266
|
+
minSize: null,
|
|
3267
|
+
maxSize: null,
|
|
3268
|
+
typeName: ZodFirstPartyTypeKind.ZodSet,
|
|
3269
|
+
...processCreateParams(params)
|
|
3270
|
+
});
|
|
3271
|
+
};
|
|
3272
|
+
var ZodFunction = class _ZodFunction extends ZodType {
|
|
3273
|
+
constructor() {
|
|
3274
|
+
super(...arguments);
|
|
3275
|
+
this.validate = this.implement;
|
|
3276
|
+
}
|
|
3277
|
+
_parse(input) {
|
|
3278
|
+
const { ctx } = this._processInputParams(input);
|
|
3279
|
+
if (ctx.parsedType !== ZodParsedType.function) {
|
|
3280
|
+
addIssueToContext(ctx, {
|
|
3281
|
+
code: ZodIssueCode.invalid_type,
|
|
3282
|
+
expected: ZodParsedType.function,
|
|
3283
|
+
received: ctx.parsedType
|
|
3284
|
+
});
|
|
3285
|
+
return INVALID;
|
|
3286
|
+
}
|
|
3287
|
+
function makeArgsIssue(args, error) {
|
|
3288
|
+
return makeIssue({
|
|
3289
|
+
data: args,
|
|
3290
|
+
path: ctx.path,
|
|
3291
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
3292
|
+
issueData: {
|
|
3293
|
+
code: ZodIssueCode.invalid_arguments,
|
|
3294
|
+
argumentsError: error
|
|
3295
|
+
}
|
|
3296
|
+
});
|
|
3297
|
+
}
|
|
3298
|
+
function makeReturnsIssue(returns, error) {
|
|
3299
|
+
return makeIssue({
|
|
3300
|
+
data: returns,
|
|
3301
|
+
path: ctx.path,
|
|
3302
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
3303
|
+
issueData: {
|
|
3304
|
+
code: ZodIssueCode.invalid_return_type,
|
|
3305
|
+
returnTypeError: error
|
|
3306
|
+
}
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
3310
|
+
const fn = ctx.data;
|
|
3311
|
+
if (this._def.returns instanceof ZodPromise) {
|
|
3312
|
+
const me = this;
|
|
3313
|
+
return OK(async function(...args) {
|
|
3314
|
+
const error = new ZodError([]);
|
|
3315
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
3316
|
+
error.addIssue(makeArgsIssue(args, e));
|
|
3317
|
+
throw error;
|
|
3318
|
+
});
|
|
3319
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3320
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
3321
|
+
error.addIssue(makeReturnsIssue(result, e));
|
|
3322
|
+
throw error;
|
|
3323
|
+
});
|
|
3324
|
+
return parsedReturns;
|
|
3325
|
+
});
|
|
3326
|
+
} else {
|
|
3327
|
+
const me = this;
|
|
3328
|
+
return OK(function(...args) {
|
|
3329
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
3330
|
+
if (!parsedArgs.success) {
|
|
3331
|
+
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
3332
|
+
}
|
|
3333
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3334
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
3335
|
+
if (!parsedReturns.success) {
|
|
3336
|
+
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
3337
|
+
}
|
|
3338
|
+
return parsedReturns.data;
|
|
3339
|
+
});
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
parameters() {
|
|
3343
|
+
return this._def.args;
|
|
3344
|
+
}
|
|
3345
|
+
returnType() {
|
|
3346
|
+
return this._def.returns;
|
|
3347
|
+
}
|
|
3348
|
+
args(...items) {
|
|
3349
|
+
return new _ZodFunction({
|
|
3350
|
+
...this._def,
|
|
3351
|
+
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3354
|
+
returns(returnType) {
|
|
3355
|
+
return new _ZodFunction({
|
|
3356
|
+
...this._def,
|
|
3357
|
+
returns: returnType
|
|
3358
|
+
});
|
|
3359
|
+
}
|
|
3360
|
+
implement(func) {
|
|
3361
|
+
const validatedFunc = this.parse(func);
|
|
3362
|
+
return validatedFunc;
|
|
3363
|
+
}
|
|
3364
|
+
strictImplement(func) {
|
|
3365
|
+
const validatedFunc = this.parse(func);
|
|
3366
|
+
return validatedFunc;
|
|
3367
|
+
}
|
|
3368
|
+
static create(args, returns, params) {
|
|
3369
|
+
return new _ZodFunction({
|
|
3370
|
+
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
3371
|
+
returns: returns || ZodUnknown.create(),
|
|
3372
|
+
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
3373
|
+
...processCreateParams(params)
|
|
3374
|
+
});
|
|
3375
|
+
}
|
|
3376
|
+
};
|
|
3377
|
+
var ZodLazy = class extends ZodType {
|
|
3378
|
+
get schema() {
|
|
3379
|
+
return this._def.getter();
|
|
3380
|
+
}
|
|
3381
|
+
_parse(input) {
|
|
3382
|
+
const { ctx } = this._processInputParams(input);
|
|
3383
|
+
const lazySchema = this._def.getter();
|
|
3384
|
+
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
3385
|
+
}
|
|
3386
|
+
};
|
|
3387
|
+
ZodLazy.create = (getter, params) => {
|
|
3388
|
+
return new ZodLazy({
|
|
3389
|
+
getter,
|
|
3390
|
+
typeName: ZodFirstPartyTypeKind.ZodLazy,
|
|
3391
|
+
...processCreateParams(params)
|
|
3392
|
+
});
|
|
3393
|
+
};
|
|
3394
|
+
var ZodLiteral = class extends ZodType {
|
|
3395
|
+
_parse(input) {
|
|
3396
|
+
if (input.data !== this._def.value) {
|
|
3397
|
+
const ctx = this._getOrReturnCtx(input);
|
|
3398
|
+
addIssueToContext(ctx, {
|
|
3399
|
+
received: ctx.data,
|
|
3400
|
+
code: ZodIssueCode.invalid_literal,
|
|
3401
|
+
expected: this._def.value
|
|
3402
|
+
});
|
|
3403
|
+
return INVALID;
|
|
3404
|
+
}
|
|
3405
|
+
return { status: "valid", value: input.data };
|
|
3406
|
+
}
|
|
3407
|
+
get value() {
|
|
3408
|
+
return this._def.value;
|
|
3409
|
+
}
|
|
3410
|
+
};
|
|
3411
|
+
ZodLiteral.create = (value, params) => {
|
|
3412
|
+
return new ZodLiteral({
|
|
3413
|
+
value,
|
|
3414
|
+
typeName: ZodFirstPartyTypeKind.ZodLiteral,
|
|
3415
|
+
...processCreateParams(params)
|
|
3416
|
+
});
|
|
3417
|
+
};
|
|
3418
|
+
function createZodEnum(values, params) {
|
|
3419
|
+
return new ZodEnum({
|
|
3420
|
+
values,
|
|
3421
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
3422
|
+
...processCreateParams(params)
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
var ZodEnum = class _ZodEnum extends ZodType {
|
|
3426
|
+
_parse(input) {
|
|
3427
|
+
if (typeof input.data !== "string") {
|
|
3428
|
+
const ctx = this._getOrReturnCtx(input);
|
|
3429
|
+
const expectedValues = this._def.values;
|
|
3430
|
+
addIssueToContext(ctx, {
|
|
3431
|
+
expected: util.joinValues(expectedValues),
|
|
3432
|
+
received: ctx.parsedType,
|
|
3433
|
+
code: ZodIssueCode.invalid_type
|
|
3434
|
+
});
|
|
3435
|
+
return INVALID;
|
|
3436
|
+
}
|
|
3437
|
+
if (!this._cache) {
|
|
3438
|
+
this._cache = new Set(this._def.values);
|
|
3439
|
+
}
|
|
3440
|
+
if (!this._cache.has(input.data)) {
|
|
3441
|
+
const ctx = this._getOrReturnCtx(input);
|
|
3442
|
+
const expectedValues = this._def.values;
|
|
3443
|
+
addIssueToContext(ctx, {
|
|
3444
|
+
received: ctx.data,
|
|
3445
|
+
code: ZodIssueCode.invalid_enum_value,
|
|
3446
|
+
options: expectedValues
|
|
3447
|
+
});
|
|
3448
|
+
return INVALID;
|
|
3449
|
+
}
|
|
3450
|
+
return OK(input.data);
|
|
3451
|
+
}
|
|
3452
|
+
get options() {
|
|
3453
|
+
return this._def.values;
|
|
3454
|
+
}
|
|
3455
|
+
get enum() {
|
|
3456
|
+
const enumValues = {};
|
|
3457
|
+
for (const val of this._def.values) {
|
|
3458
|
+
enumValues[val] = val;
|
|
3459
|
+
}
|
|
3460
|
+
return enumValues;
|
|
3461
|
+
}
|
|
3462
|
+
get Values() {
|
|
3463
|
+
const enumValues = {};
|
|
3464
|
+
for (const val of this._def.values) {
|
|
3465
|
+
enumValues[val] = val;
|
|
3466
|
+
}
|
|
3467
|
+
return enumValues;
|
|
3468
|
+
}
|
|
3469
|
+
get Enum() {
|
|
3470
|
+
const enumValues = {};
|
|
3471
|
+
for (const val of this._def.values) {
|
|
3472
|
+
enumValues[val] = val;
|
|
3473
|
+
}
|
|
3474
|
+
return enumValues;
|
|
3475
|
+
}
|
|
3476
|
+
extract(values, newDef = this._def) {
|
|
3477
|
+
return _ZodEnum.create(values, {
|
|
3478
|
+
...this._def,
|
|
3479
|
+
...newDef
|
|
3480
|
+
});
|
|
3481
|
+
}
|
|
3482
|
+
exclude(values, newDef = this._def) {
|
|
3483
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
3484
|
+
...this._def,
|
|
3485
|
+
...newDef
|
|
3486
|
+
});
|
|
3487
|
+
}
|
|
3488
|
+
};
|
|
3489
|
+
ZodEnum.create = createZodEnum;
|
|
3490
|
+
var ZodNativeEnum = class extends ZodType {
|
|
3491
|
+
_parse(input) {
|
|
3492
|
+
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3493
|
+
const ctx = this._getOrReturnCtx(input);
|
|
3494
|
+
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
3495
|
+
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3496
|
+
addIssueToContext(ctx, {
|
|
3497
|
+
expected: util.joinValues(expectedValues),
|
|
3498
|
+
received: ctx.parsedType,
|
|
3499
|
+
code: ZodIssueCode.invalid_type
|
|
3500
|
+
});
|
|
3501
|
+
return INVALID;
|
|
3502
|
+
}
|
|
3503
|
+
if (!this._cache) {
|
|
3504
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
3505
|
+
}
|
|
3506
|
+
if (!this._cache.has(input.data)) {
|
|
3507
|
+
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3508
|
+
addIssueToContext(ctx, {
|
|
3509
|
+
received: ctx.data,
|
|
3510
|
+
code: ZodIssueCode.invalid_enum_value,
|
|
3511
|
+
options: expectedValues
|
|
3512
|
+
});
|
|
3513
|
+
return INVALID;
|
|
3514
|
+
}
|
|
3515
|
+
return OK(input.data);
|
|
3516
|
+
}
|
|
3517
|
+
get enum() {
|
|
3518
|
+
return this._def.values;
|
|
3519
|
+
}
|
|
3520
|
+
};
|
|
3521
|
+
ZodNativeEnum.create = (values, params) => {
|
|
3522
|
+
return new ZodNativeEnum({
|
|
3523
|
+
values,
|
|
3524
|
+
typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
|
|
3525
|
+
...processCreateParams(params)
|
|
3526
|
+
});
|
|
3527
|
+
};
|
|
3528
|
+
var ZodPromise = class extends ZodType {
|
|
3529
|
+
unwrap() {
|
|
3530
|
+
return this._def.type;
|
|
3531
|
+
}
|
|
3532
|
+
_parse(input) {
|
|
3533
|
+
const { ctx } = this._processInputParams(input);
|
|
3534
|
+
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
3535
|
+
addIssueToContext(ctx, {
|
|
3536
|
+
code: ZodIssueCode.invalid_type,
|
|
3537
|
+
expected: ZodParsedType.promise,
|
|
3538
|
+
received: ctx.parsedType
|
|
3539
|
+
});
|
|
3540
|
+
return INVALID;
|
|
3541
|
+
}
|
|
3542
|
+
const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
3543
|
+
return OK(promisified.then((data) => {
|
|
3544
|
+
return this._def.type.parseAsync(data, {
|
|
3545
|
+
path: ctx.path,
|
|
3546
|
+
errorMap: ctx.common.contextualErrorMap
|
|
3547
|
+
});
|
|
3548
|
+
}));
|
|
3549
|
+
}
|
|
3550
|
+
};
|
|
3551
|
+
ZodPromise.create = (schema, params) => {
|
|
3552
|
+
return new ZodPromise({
|
|
3553
|
+
type: schema,
|
|
3554
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
3555
|
+
...processCreateParams(params)
|
|
3556
|
+
});
|
|
3557
|
+
};
|
|
3558
|
+
var ZodEffects = class extends ZodType {
|
|
3559
|
+
innerType() {
|
|
3560
|
+
return this._def.schema;
|
|
3561
|
+
}
|
|
3562
|
+
sourceType() {
|
|
3563
|
+
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3564
|
+
}
|
|
3565
|
+
_parse(input) {
|
|
3566
|
+
const { status, ctx } = this._processInputParams(input);
|
|
3567
|
+
const effect = this._def.effect || null;
|
|
3568
|
+
const checkCtx = {
|
|
3569
|
+
addIssue: (arg) => {
|
|
3570
|
+
addIssueToContext(ctx, arg);
|
|
3571
|
+
if (arg.fatal) {
|
|
3572
|
+
status.abort();
|
|
3573
|
+
} else {
|
|
3574
|
+
status.dirty();
|
|
3575
|
+
}
|
|
3576
|
+
},
|
|
3577
|
+
get path() {
|
|
3578
|
+
return ctx.path;
|
|
3579
|
+
}
|
|
3580
|
+
};
|
|
3581
|
+
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
3582
|
+
if (effect.type === "preprocess") {
|
|
3583
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
3584
|
+
if (ctx.common.async) {
|
|
3585
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
3586
|
+
if (status.value === "aborted")
|
|
3587
|
+
return INVALID;
|
|
3588
|
+
const result = await this._def.schema._parseAsync({
|
|
3589
|
+
data: processed2,
|
|
3590
|
+
path: ctx.path,
|
|
3591
|
+
parent: ctx
|
|
3592
|
+
});
|
|
3593
|
+
if (result.status === "aborted")
|
|
3594
|
+
return INVALID;
|
|
3595
|
+
if (result.status === "dirty")
|
|
3596
|
+
return DIRTY(result.value);
|
|
3597
|
+
if (status.value === "dirty")
|
|
3598
|
+
return DIRTY(result.value);
|
|
3599
|
+
return result;
|
|
3600
|
+
});
|
|
3601
|
+
} else {
|
|
3602
|
+
if (status.value === "aborted")
|
|
3603
|
+
return INVALID;
|
|
3604
|
+
const result = this._def.schema._parseSync({
|
|
3605
|
+
data: processed,
|
|
3606
|
+
path: ctx.path,
|
|
3607
|
+
parent: ctx
|
|
3608
|
+
});
|
|
3609
|
+
if (result.status === "aborted")
|
|
3610
|
+
return INVALID;
|
|
3611
|
+
if (result.status === "dirty")
|
|
3612
|
+
return DIRTY(result.value);
|
|
3613
|
+
if (status.value === "dirty")
|
|
3614
|
+
return DIRTY(result.value);
|
|
3615
|
+
return result;
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
if (effect.type === "refinement") {
|
|
3619
|
+
const executeRefinement = (acc) => {
|
|
3620
|
+
const result = effect.refinement(acc, checkCtx);
|
|
3621
|
+
if (ctx.common.async) {
|
|
3622
|
+
return Promise.resolve(result);
|
|
3623
|
+
}
|
|
3624
|
+
if (result instanceof Promise) {
|
|
3625
|
+
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3626
|
+
}
|
|
3627
|
+
return acc;
|
|
3628
|
+
};
|
|
3629
|
+
if (ctx.common.async === false) {
|
|
3630
|
+
const inner = this._def.schema._parseSync({
|
|
3631
|
+
data: ctx.data,
|
|
3632
|
+
path: ctx.path,
|
|
3633
|
+
parent: ctx
|
|
3634
|
+
});
|
|
3635
|
+
if (inner.status === "aborted")
|
|
3636
|
+
return INVALID;
|
|
3637
|
+
if (inner.status === "dirty")
|
|
3638
|
+
status.dirty();
|
|
3639
|
+
executeRefinement(inner.value);
|
|
3640
|
+
return { status: status.value, value: inner.value };
|
|
3641
|
+
} else {
|
|
3642
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
3643
|
+
if (inner.status === "aborted")
|
|
3644
|
+
return INVALID;
|
|
3645
|
+
if (inner.status === "dirty")
|
|
3646
|
+
status.dirty();
|
|
3647
|
+
return executeRefinement(inner.value).then(() => {
|
|
3648
|
+
return { status: status.value, value: inner.value };
|
|
3649
|
+
});
|
|
3650
|
+
});
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
if (effect.type === "transform") {
|
|
3654
|
+
if (ctx.common.async === false) {
|
|
3655
|
+
const base = this._def.schema._parseSync({
|
|
3656
|
+
data: ctx.data,
|
|
3657
|
+
path: ctx.path,
|
|
3658
|
+
parent: ctx
|
|
3659
|
+
});
|
|
3660
|
+
if (!isValid(base))
|
|
3661
|
+
return INVALID;
|
|
3662
|
+
const result = effect.transform(base.value, checkCtx);
|
|
3663
|
+
if (result instanceof Promise) {
|
|
3664
|
+
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
3665
|
+
}
|
|
3666
|
+
return { status: status.value, value: result };
|
|
3667
|
+
} else {
|
|
3668
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
3669
|
+
if (!isValid(base))
|
|
3670
|
+
return INVALID;
|
|
3671
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3672
|
+
status: status.value,
|
|
3673
|
+
value: result
|
|
3674
|
+
}));
|
|
3675
|
+
});
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
util.assertNever(effect);
|
|
3679
|
+
}
|
|
3680
|
+
};
|
|
3681
|
+
ZodEffects.create = (schema, effect, params) => {
|
|
3682
|
+
return new ZodEffects({
|
|
3683
|
+
schema,
|
|
3684
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
3685
|
+
effect,
|
|
3686
|
+
...processCreateParams(params)
|
|
3687
|
+
});
|
|
3688
|
+
};
|
|
3689
|
+
ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
3690
|
+
return new ZodEffects({
|
|
3691
|
+
schema,
|
|
3692
|
+
effect: { type: "preprocess", transform: preprocess },
|
|
3693
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
3694
|
+
...processCreateParams(params)
|
|
3695
|
+
});
|
|
3696
|
+
};
|
|
3697
|
+
var ZodOptional = class extends ZodType {
|
|
3698
|
+
_parse(input) {
|
|
3699
|
+
const parsedType = this._getType(input);
|
|
3700
|
+
if (parsedType === ZodParsedType.undefined) {
|
|
3701
|
+
return OK(void 0);
|
|
3702
|
+
}
|
|
3703
|
+
return this._def.innerType._parse(input);
|
|
3704
|
+
}
|
|
3705
|
+
unwrap() {
|
|
3706
|
+
return this._def.innerType;
|
|
3707
|
+
}
|
|
3708
|
+
};
|
|
3709
|
+
ZodOptional.create = (type, params) => {
|
|
3710
|
+
return new ZodOptional({
|
|
3711
|
+
innerType: type,
|
|
3712
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional,
|
|
3713
|
+
...processCreateParams(params)
|
|
3714
|
+
});
|
|
3715
|
+
};
|
|
3716
|
+
var ZodNullable = class extends ZodType {
|
|
3717
|
+
_parse(input) {
|
|
3718
|
+
const parsedType = this._getType(input);
|
|
3719
|
+
if (parsedType === ZodParsedType.null) {
|
|
3720
|
+
return OK(null);
|
|
3721
|
+
}
|
|
3722
|
+
return this._def.innerType._parse(input);
|
|
3723
|
+
}
|
|
3724
|
+
unwrap() {
|
|
3725
|
+
return this._def.innerType;
|
|
3726
|
+
}
|
|
3727
|
+
};
|
|
3728
|
+
ZodNullable.create = (type, params) => {
|
|
3729
|
+
return new ZodNullable({
|
|
3730
|
+
innerType: type,
|
|
3731
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable,
|
|
3732
|
+
...processCreateParams(params)
|
|
3733
|
+
});
|
|
3734
|
+
};
|
|
3735
|
+
var ZodDefault = class extends ZodType {
|
|
3736
|
+
_parse(input) {
|
|
3737
|
+
const { ctx } = this._processInputParams(input);
|
|
3738
|
+
let data = ctx.data;
|
|
3739
|
+
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
3740
|
+
data = this._def.defaultValue();
|
|
3741
|
+
}
|
|
3742
|
+
return this._def.innerType._parse({
|
|
3743
|
+
data,
|
|
3744
|
+
path: ctx.path,
|
|
3745
|
+
parent: ctx
|
|
3746
|
+
});
|
|
3747
|
+
}
|
|
3748
|
+
removeDefault() {
|
|
3749
|
+
return this._def.innerType;
|
|
3750
|
+
}
|
|
3751
|
+
};
|
|
3752
|
+
ZodDefault.create = (type, params) => {
|
|
3753
|
+
return new ZodDefault({
|
|
3754
|
+
innerType: type,
|
|
3755
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
3756
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
3757
|
+
...processCreateParams(params)
|
|
3758
|
+
});
|
|
3759
|
+
};
|
|
3760
|
+
var ZodCatch = class extends ZodType {
|
|
3761
|
+
_parse(input) {
|
|
3762
|
+
const { ctx } = this._processInputParams(input);
|
|
3763
|
+
const newCtx = {
|
|
3764
|
+
...ctx,
|
|
3765
|
+
common: {
|
|
3766
|
+
...ctx.common,
|
|
3767
|
+
issues: []
|
|
3768
|
+
}
|
|
3769
|
+
};
|
|
3770
|
+
const result = this._def.innerType._parse({
|
|
3771
|
+
data: newCtx.data,
|
|
3772
|
+
path: newCtx.path,
|
|
3773
|
+
parent: {
|
|
3774
|
+
...newCtx
|
|
3775
|
+
}
|
|
3776
|
+
});
|
|
3777
|
+
if (isAsync(result)) {
|
|
3778
|
+
return result.then((result2) => {
|
|
3779
|
+
return {
|
|
3780
|
+
status: "valid",
|
|
3781
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
3782
|
+
get error() {
|
|
3783
|
+
return new ZodError(newCtx.common.issues);
|
|
3784
|
+
},
|
|
3785
|
+
input: newCtx.data
|
|
3786
|
+
})
|
|
3787
|
+
};
|
|
3788
|
+
});
|
|
3789
|
+
} else {
|
|
3790
|
+
return {
|
|
3791
|
+
status: "valid",
|
|
3792
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
3793
|
+
get error() {
|
|
3794
|
+
return new ZodError(newCtx.common.issues);
|
|
3795
|
+
},
|
|
3796
|
+
input: newCtx.data
|
|
3797
|
+
})
|
|
3798
|
+
};
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
removeCatch() {
|
|
3802
|
+
return this._def.innerType;
|
|
3803
|
+
}
|
|
3804
|
+
};
|
|
3805
|
+
ZodCatch.create = (type, params) => {
|
|
3806
|
+
return new ZodCatch({
|
|
3807
|
+
innerType: type,
|
|
3808
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
3809
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
3810
|
+
...processCreateParams(params)
|
|
3811
|
+
});
|
|
3812
|
+
};
|
|
3813
|
+
var ZodNaN = class extends ZodType {
|
|
3814
|
+
_parse(input) {
|
|
3815
|
+
const parsedType = this._getType(input);
|
|
3816
|
+
if (parsedType !== ZodParsedType.nan) {
|
|
3817
|
+
const ctx = this._getOrReturnCtx(input);
|
|
3818
|
+
addIssueToContext(ctx, {
|
|
3819
|
+
code: ZodIssueCode.invalid_type,
|
|
3820
|
+
expected: ZodParsedType.nan,
|
|
3821
|
+
received: ctx.parsedType
|
|
3822
|
+
});
|
|
3823
|
+
return INVALID;
|
|
3824
|
+
}
|
|
3825
|
+
return { status: "valid", value: input.data };
|
|
3826
|
+
}
|
|
3827
|
+
};
|
|
3828
|
+
ZodNaN.create = (params) => {
|
|
3829
|
+
return new ZodNaN({
|
|
3830
|
+
typeName: ZodFirstPartyTypeKind.ZodNaN,
|
|
3831
|
+
...processCreateParams(params)
|
|
3832
|
+
});
|
|
3833
|
+
};
|
|
3834
|
+
var BRAND = /* @__PURE__ */ Symbol("zod_brand");
|
|
3835
|
+
var ZodBranded = class extends ZodType {
|
|
3836
|
+
_parse(input) {
|
|
3837
|
+
const { ctx } = this._processInputParams(input);
|
|
3838
|
+
const data = ctx.data;
|
|
3839
|
+
return this._def.type._parse({
|
|
3840
|
+
data,
|
|
3841
|
+
path: ctx.path,
|
|
3842
|
+
parent: ctx
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3845
|
+
unwrap() {
|
|
3846
|
+
return this._def.type;
|
|
3847
|
+
}
|
|
3848
|
+
};
|
|
3849
|
+
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
3850
|
+
_parse(input) {
|
|
3851
|
+
const { status, ctx } = this._processInputParams(input);
|
|
3852
|
+
if (ctx.common.async) {
|
|
3853
|
+
const handleAsync = async () => {
|
|
3854
|
+
const inResult = await this._def.in._parseAsync({
|
|
3855
|
+
data: ctx.data,
|
|
3856
|
+
path: ctx.path,
|
|
3857
|
+
parent: ctx
|
|
3858
|
+
});
|
|
3859
|
+
if (inResult.status === "aborted")
|
|
3860
|
+
return INVALID;
|
|
3861
|
+
if (inResult.status === "dirty") {
|
|
3862
|
+
status.dirty();
|
|
3863
|
+
return DIRTY(inResult.value);
|
|
3864
|
+
} else {
|
|
3865
|
+
return this._def.out._parseAsync({
|
|
3866
|
+
data: inResult.value,
|
|
3867
|
+
path: ctx.path,
|
|
3868
|
+
parent: ctx
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3871
|
+
};
|
|
3872
|
+
return handleAsync();
|
|
3873
|
+
} else {
|
|
3874
|
+
const inResult = this._def.in._parseSync({
|
|
3875
|
+
data: ctx.data,
|
|
3876
|
+
path: ctx.path,
|
|
3877
|
+
parent: ctx
|
|
3878
|
+
});
|
|
3879
|
+
if (inResult.status === "aborted")
|
|
3880
|
+
return INVALID;
|
|
3881
|
+
if (inResult.status === "dirty") {
|
|
3882
|
+
status.dirty();
|
|
3883
|
+
return {
|
|
3884
|
+
status: "dirty",
|
|
3885
|
+
value: inResult.value
|
|
3886
|
+
};
|
|
3887
|
+
} else {
|
|
3888
|
+
return this._def.out._parseSync({
|
|
3889
|
+
data: inResult.value,
|
|
3890
|
+
path: ctx.path,
|
|
3891
|
+
parent: ctx
|
|
3892
|
+
});
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
static create(a, b) {
|
|
3897
|
+
return new _ZodPipeline({
|
|
3898
|
+
in: a,
|
|
3899
|
+
out: b,
|
|
3900
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
3901
|
+
});
|
|
3902
|
+
}
|
|
3903
|
+
};
|
|
3904
|
+
var ZodReadonly = class extends ZodType {
|
|
3905
|
+
_parse(input) {
|
|
3906
|
+
const result = this._def.innerType._parse(input);
|
|
3907
|
+
const freeze = (data) => {
|
|
3908
|
+
if (isValid(data)) {
|
|
3909
|
+
data.value = Object.freeze(data.value);
|
|
3910
|
+
}
|
|
3911
|
+
return data;
|
|
3912
|
+
};
|
|
3913
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3914
|
+
}
|
|
3915
|
+
unwrap() {
|
|
3916
|
+
return this._def.innerType;
|
|
3917
|
+
}
|
|
3918
|
+
};
|
|
3919
|
+
ZodReadonly.create = (type, params) => {
|
|
3920
|
+
return new ZodReadonly({
|
|
3921
|
+
innerType: type,
|
|
3922
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
3923
|
+
...processCreateParams(params)
|
|
3924
|
+
});
|
|
3925
|
+
};
|
|
3926
|
+
function cleanParams(params, data) {
|
|
3927
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3928
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3929
|
+
return p2;
|
|
3930
|
+
}
|
|
3931
|
+
function custom(check, _params = {}, fatal) {
|
|
3932
|
+
if (check)
|
|
3933
|
+
return ZodAny.create().superRefine((data, ctx) => {
|
|
3934
|
+
const r = check(data);
|
|
3935
|
+
if (r instanceof Promise) {
|
|
3936
|
+
return r.then((r2) => {
|
|
3937
|
+
if (!r2) {
|
|
3938
|
+
const params = cleanParams(_params, data);
|
|
3939
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
3940
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3941
|
+
}
|
|
3942
|
+
});
|
|
3943
|
+
}
|
|
3944
|
+
if (!r) {
|
|
3945
|
+
const params = cleanParams(_params, data);
|
|
3946
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
3947
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3948
|
+
}
|
|
3949
|
+
return;
|
|
3950
|
+
});
|
|
3951
|
+
return ZodAny.create();
|
|
3952
|
+
}
|
|
3953
|
+
var late = {
|
|
3954
|
+
object: ZodObject.lazycreate
|
|
3955
|
+
};
|
|
3956
|
+
var ZodFirstPartyTypeKind;
|
|
3957
|
+
(function(ZodFirstPartyTypeKind2) {
|
|
3958
|
+
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
3959
|
+
ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
|
|
3960
|
+
ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
|
|
3961
|
+
ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
|
|
3962
|
+
ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
|
|
3963
|
+
ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
|
|
3964
|
+
ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
|
|
3965
|
+
ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
|
|
3966
|
+
ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
|
|
3967
|
+
ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
|
|
3968
|
+
ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
|
|
3969
|
+
ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
|
|
3970
|
+
ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
|
|
3971
|
+
ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
|
|
3972
|
+
ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
|
|
3973
|
+
ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
|
|
3974
|
+
ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
|
|
3975
|
+
ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
|
|
3976
|
+
ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
|
|
3977
|
+
ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
|
|
3978
|
+
ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
|
|
3979
|
+
ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
|
|
3980
|
+
ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
|
|
3981
|
+
ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
|
|
3982
|
+
ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
|
|
3983
|
+
ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
|
|
3984
|
+
ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
|
|
3985
|
+
ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
|
|
3986
|
+
ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
|
|
3987
|
+
ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
|
|
3988
|
+
ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
|
|
3989
|
+
ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
|
|
3990
|
+
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
3991
|
+
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
3992
|
+
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
3993
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
3994
|
+
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3995
|
+
var instanceOfType = (cls, params = {
|
|
3996
|
+
message: `Input not instance of ${cls.name}`
|
|
3997
|
+
}) => custom((data) => data instanceof cls, params);
|
|
3998
|
+
var stringType = ZodString.create;
|
|
3999
|
+
var numberType = ZodNumber.create;
|
|
4000
|
+
var nanType = ZodNaN.create;
|
|
4001
|
+
var bigIntType = ZodBigInt.create;
|
|
4002
|
+
var booleanType = ZodBoolean.create;
|
|
4003
|
+
var dateType = ZodDate.create;
|
|
4004
|
+
var symbolType = ZodSymbol.create;
|
|
4005
|
+
var undefinedType = ZodUndefined.create;
|
|
4006
|
+
var nullType = ZodNull.create;
|
|
4007
|
+
var anyType = ZodAny.create;
|
|
4008
|
+
var unknownType = ZodUnknown.create;
|
|
4009
|
+
var neverType = ZodNever.create;
|
|
4010
|
+
var voidType = ZodVoid.create;
|
|
4011
|
+
var arrayType = ZodArray.create;
|
|
4012
|
+
var objectType = ZodObject.create;
|
|
4013
|
+
var strictObjectType = ZodObject.strictCreate;
|
|
4014
|
+
var unionType = ZodUnion.create;
|
|
4015
|
+
var discriminatedUnionType = ZodDiscriminatedUnion.create;
|
|
4016
|
+
var intersectionType = ZodIntersection.create;
|
|
4017
|
+
var tupleType = ZodTuple.create;
|
|
4018
|
+
var recordType = ZodRecord.create;
|
|
4019
|
+
var mapType = ZodMap.create;
|
|
4020
|
+
var setType = ZodSet.create;
|
|
4021
|
+
var functionType = ZodFunction.create;
|
|
4022
|
+
var lazyType = ZodLazy.create;
|
|
4023
|
+
var literalType = ZodLiteral.create;
|
|
4024
|
+
var enumType = ZodEnum.create;
|
|
4025
|
+
var nativeEnumType = ZodNativeEnum.create;
|
|
4026
|
+
var promiseType = ZodPromise.create;
|
|
4027
|
+
var effectsType = ZodEffects.create;
|
|
4028
|
+
var optionalType = ZodOptional.create;
|
|
4029
|
+
var nullableType = ZodNullable.create;
|
|
4030
|
+
var preprocessType = ZodEffects.createWithPreprocess;
|
|
4031
|
+
var pipelineType = ZodPipeline.create;
|
|
4032
|
+
var ostring = () => stringType().optional();
|
|
4033
|
+
var onumber = () => numberType().optional();
|
|
4034
|
+
var oboolean = () => booleanType().optional();
|
|
4035
|
+
var coerce = {
|
|
4036
|
+
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
4037
|
+
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
4038
|
+
boolean: ((arg) => ZodBoolean.create({
|
|
4039
|
+
...arg,
|
|
4040
|
+
coerce: true
|
|
4041
|
+
})),
|
|
4042
|
+
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
4043
|
+
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
4044
|
+
};
|
|
4045
|
+
var NEVER = INVALID;
|
|
4046
|
+
|
|
4047
|
+
// src/components/schema-form/schema-form-spec.ts
|
|
4048
|
+
var enumOptionSchema = external_exports.union([
|
|
4049
|
+
external_exports.string(),
|
|
4050
|
+
external_exports.object({ const: external_exports.string(), title: external_exports.string().optional() })
|
|
4051
|
+
]);
|
|
4052
|
+
function optionValue(option) {
|
|
4053
|
+
return typeof option === "string" ? option : option.const;
|
|
4054
|
+
}
|
|
4055
|
+
function optionLabel(option) {
|
|
4056
|
+
return typeof option === "string" ? option : option.title ?? option.const;
|
|
4057
|
+
}
|
|
4058
|
+
var keyValueRowSchema = external_exports.object({
|
|
4059
|
+
key: external_exports.string(),
|
|
4060
|
+
value: external_exports.string(),
|
|
4061
|
+
/** Mask this row's value (rendered as `type="password"` with a reveal toggle). */
|
|
4062
|
+
secret: external_exports.boolean().optional()
|
|
4063
|
+
});
|
|
4064
|
+
var baseField = {
|
|
4065
|
+
/** Value key in the emitted form state (the `values` object key). */
|
|
4066
|
+
name: external_exports.string(),
|
|
4067
|
+
/** Human label. Falls back to a humanized `name` when omitted. */
|
|
4068
|
+
label: external_exports.string().optional(),
|
|
4069
|
+
/** Helper text shown under the control. */
|
|
4070
|
+
description: external_exports.string().optional(),
|
|
4071
|
+
/** Whether a value is required before the form can submit. */
|
|
4072
|
+
required: external_exports.boolean().optional(),
|
|
4073
|
+
/**
|
|
4074
|
+
* Conditional visibility: render (and validate/submit) this field only
|
|
4075
|
+
* when another field's current value equals `equals` — e.g. show a
|
|
4076
|
+
* "client secret" field only once `authMethod` equals `"oauth"`. Evaluated
|
|
4077
|
+
* by `isFieldVisible` against the form's current values; a hidden field is
|
|
4078
|
+
* excluded from rendering, validation and the first-invalid-focus walk, so
|
|
4079
|
+
* a hidden `required` field never blocks submit.
|
|
4080
|
+
*/
|
|
4081
|
+
visibleWhen: external_exports.object({
|
|
4082
|
+
/** Name of the controlling field. */
|
|
4083
|
+
field: external_exports.string(),
|
|
4084
|
+
/** The controlling field's value that makes this field visible. */
|
|
4085
|
+
equals: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
|
|
4086
|
+
}).optional(),
|
|
4087
|
+
/**
|
|
4088
|
+
* Show the value as read-only text (a `Descriptions` item) instead of an
|
|
4089
|
+
* editable control. The value still belongs to the form's `values`.
|
|
4090
|
+
*/
|
|
4091
|
+
readOnly: external_exports.boolean().optional()
|
|
4092
|
+
};
|
|
4093
|
+
var stringFieldSchema = external_exports.object({
|
|
4094
|
+
type: external_exports.literal("string"),
|
|
4095
|
+
...baseField,
|
|
4096
|
+
default: external_exports.string().optional(),
|
|
4097
|
+
format: external_exports.enum(["email", "uri", "date", "date-time"]).optional(),
|
|
4098
|
+
minLength: external_exports.number().int().nonnegative().optional(),
|
|
4099
|
+
maxLength: external_exports.number().int().nonnegative().optional(),
|
|
4100
|
+
/** A serialized RegExp source string (client-enforced when present). */
|
|
4101
|
+
pattern: external_exports.string().optional(),
|
|
4102
|
+
/** Render a textarea instead of a single-line input. */
|
|
4103
|
+
multiline: external_exports.boolean().optional()
|
|
4104
|
+
});
|
|
4105
|
+
var numberFieldSchema = external_exports.object({
|
|
4106
|
+
type: external_exports.literal("number"),
|
|
4107
|
+
...baseField,
|
|
4108
|
+
default: external_exports.number().optional(),
|
|
4109
|
+
min: external_exports.number().optional(),
|
|
4110
|
+
max: external_exports.number().optional()
|
|
4111
|
+
});
|
|
4112
|
+
var integerFieldSchema = external_exports.object({
|
|
4113
|
+
type: external_exports.literal("integer"),
|
|
4114
|
+
...baseField,
|
|
4115
|
+
default: external_exports.number().int().optional(),
|
|
4116
|
+
min: external_exports.number().optional(),
|
|
4117
|
+
max: external_exports.number().optional()
|
|
4118
|
+
});
|
|
4119
|
+
var booleanFieldSchema = external_exports.object({
|
|
4120
|
+
type: external_exports.literal("boolean"),
|
|
4121
|
+
...baseField,
|
|
4122
|
+
default: external_exports.boolean().optional()
|
|
4123
|
+
});
|
|
4124
|
+
var enumFieldSchema = external_exports.object({
|
|
4125
|
+
type: external_exports.literal("enum"),
|
|
4126
|
+
...baseField,
|
|
4127
|
+
options: external_exports.array(enumOptionSchema),
|
|
4128
|
+
default: external_exports.string().optional()
|
|
4129
|
+
});
|
|
4130
|
+
var multiEnumFieldSchema = external_exports.object({
|
|
4131
|
+
type: external_exports.literal("multi-enum"),
|
|
4132
|
+
...baseField,
|
|
4133
|
+
options: external_exports.array(enumOptionSchema),
|
|
4134
|
+
default: external_exports.array(external_exports.string()).optional()
|
|
4135
|
+
});
|
|
4136
|
+
var listFieldSchema = external_exports.object({
|
|
4137
|
+
type: external_exports.literal("list"),
|
|
4138
|
+
...baseField,
|
|
4139
|
+
default: external_exports.array(external_exports.string()).optional(),
|
|
4140
|
+
minItems: external_exports.number().int().nonnegative().optional(),
|
|
4141
|
+
maxItems: external_exports.number().int().nonnegative().optional(),
|
|
4142
|
+
itemPlaceholder: external_exports.string().optional()
|
|
4143
|
+
});
|
|
4144
|
+
var keyValueFieldSchema = external_exports.object({
|
|
4145
|
+
type: external_exports.literal("key-value"),
|
|
4146
|
+
...baseField,
|
|
4147
|
+
default: external_exports.array(keyValueRowSchema).optional(),
|
|
4148
|
+
keyPlaceholder: external_exports.string().optional(),
|
|
4149
|
+
valuePlaceholder: external_exports.string().optional()
|
|
4150
|
+
});
|
|
4151
|
+
var fileFieldSchema = external_exports.object({
|
|
4152
|
+
type: external_exports.literal("file"),
|
|
4153
|
+
...baseField,
|
|
4154
|
+
/** Forwarded to the native `<input accept>` (comma-separated extensions/MIME types). */
|
|
4155
|
+
accept: external_exports.string().optional(),
|
|
4156
|
+
multiple: external_exports.boolean().optional(),
|
|
4157
|
+
/** Maximum individual file size, in bytes. */
|
|
4158
|
+
maxSize: external_exports.number().positive().optional(),
|
|
4159
|
+
/** Maximum number of files (only meaningful when `multiple`). */
|
|
4160
|
+
maxFiles: external_exports.number().int().positive().optional()
|
|
4161
|
+
});
|
|
4162
|
+
var groupItemSchema = external_exports.object({
|
|
4163
|
+
key: external_exports.string(),
|
|
4164
|
+
label: external_exports.string(),
|
|
4165
|
+
description: external_exports.string().optional(),
|
|
4166
|
+
fields: external_exports.array(external_exports.lazy(() => fieldSpecSchema))
|
|
4167
|
+
});
|
|
4168
|
+
var groupFieldSchemaObject = external_exports.object({
|
|
4169
|
+
type: external_exports.literal("group"),
|
|
4170
|
+
...baseField,
|
|
4171
|
+
variant: external_exports.enum(["tabs", "advanced"]),
|
|
4172
|
+
groups: external_exports.array(groupItemSchema),
|
|
4173
|
+
default: external_exports.string().optional()
|
|
4174
|
+
});
|
|
4175
|
+
var groupFieldSchema = groupFieldSchemaObject;
|
|
4176
|
+
var fieldSpecSchema = external_exports.discriminatedUnion("type", [
|
|
4177
|
+
stringFieldSchema,
|
|
4178
|
+
numberFieldSchema,
|
|
4179
|
+
integerFieldSchema,
|
|
4180
|
+
booleanFieldSchema,
|
|
4181
|
+
enumFieldSchema,
|
|
4182
|
+
multiEnumFieldSchema,
|
|
4183
|
+
listFieldSchema,
|
|
4184
|
+
keyValueFieldSchema,
|
|
4185
|
+
fileFieldSchema,
|
|
4186
|
+
groupFieldSchemaObject
|
|
4187
|
+
]);
|
|
4188
|
+
var formSpecSchema = external_exports.object({
|
|
4189
|
+
/** Stable identifier echoed back in the submit payload. */
|
|
4190
|
+
formName: external_exports.string(),
|
|
4191
|
+
/** Heading rendered above the fields (also the accessible form name). */
|
|
4192
|
+
title: external_exports.string().optional(),
|
|
4193
|
+
/** Supplemental description under the title. */
|
|
4194
|
+
description: external_exports.string().optional(),
|
|
4195
|
+
/** The ordered fields to render. */
|
|
4196
|
+
fields: external_exports.array(fieldSpecSchema),
|
|
4197
|
+
/** Submit button label. @default "Submit" */
|
|
4198
|
+
submitLabel: external_exports.string().optional(),
|
|
4199
|
+
/**
|
|
4200
|
+
* Collapsible groups of top-level fields, in display order. Fields not named
|
|
4201
|
+
* in any section render first, ungrouped. Omit for the flat layout.
|
|
4202
|
+
*/
|
|
4203
|
+
sections: external_exports.array(external_exports.lazy(() => formSectionSchema)).optional()
|
|
4204
|
+
});
|
|
4205
|
+
var formSectionSchema = external_exports.object({
|
|
4206
|
+
/** Stable key for the section. */
|
|
4207
|
+
id: external_exports.string(),
|
|
4208
|
+
/** Heading on the section's disclosure trigger. */
|
|
4209
|
+
label: external_exports.string(),
|
|
4210
|
+
/** Names of the top-level fields the section holds, in display order. */
|
|
4211
|
+
fields: external_exports.array(external_exports.string()),
|
|
4212
|
+
/** Start collapsed. @default false */
|
|
4213
|
+
collapsed: external_exports.boolean().optional()
|
|
4214
|
+
});
|
|
4215
|
+
function collectFieldNames(fields, names = []) {
|
|
4216
|
+
for (const field of fields) {
|
|
4217
|
+
names.push(field.name);
|
|
4218
|
+
if (field.type === "group") {
|
|
4219
|
+
for (const group of field.groups) collectFieldNames(group.fields, names);
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
return names;
|
|
4223
|
+
}
|
|
4224
|
+
function normalizeFormSpec(spec) {
|
|
4225
|
+
if (spec === null || typeof spec !== "object" || Array.isArray(spec)) {
|
|
4226
|
+
return { ok: false, reason: "Form specification is missing or malformed." };
|
|
4227
|
+
}
|
|
4228
|
+
const raw = spec;
|
|
4229
|
+
const rawFields = Array.isArray(raw.fields) ? raw.fields : [];
|
|
4230
|
+
const fields = [];
|
|
4231
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4232
|
+
for (const candidate of rawFields) {
|
|
4233
|
+
const parsed = fieldSpecSchema.safeParse(candidate);
|
|
4234
|
+
if (!parsed.success) continue;
|
|
4235
|
+
const names = collectFieldNames([parsed.data]);
|
|
4236
|
+
const hasInternalDuplicate = new Set(names).size !== names.length;
|
|
4237
|
+
const collidesWithAccepted = names.some((name) => seen.has(name));
|
|
4238
|
+
if (hasInternalDuplicate || collidesWithAccepted) continue;
|
|
4239
|
+
for (const name of names) seen.add(name);
|
|
4240
|
+
fields.push(parsed.data);
|
|
4241
|
+
}
|
|
4242
|
+
return {
|
|
4243
|
+
ok: true,
|
|
4244
|
+
spec: {
|
|
4245
|
+
formName: typeof raw.formName === "string" ? raw.formName : "",
|
|
4246
|
+
title: typeof raw.title === "string" ? raw.title : void 0,
|
|
4247
|
+
description: typeof raw.description === "string" ? raw.description : void 0,
|
|
4248
|
+
submitLabel: typeof raw.submitLabel === "string" ? raw.submitLabel : void 0,
|
|
4249
|
+
fields,
|
|
4250
|
+
...normalizeSections(raw.sections)
|
|
4251
|
+
}
|
|
4252
|
+
};
|
|
4253
|
+
}
|
|
4254
|
+
function normalizeSections(raw) {
|
|
4255
|
+
if (!Array.isArray(raw)) return {};
|
|
4256
|
+
const sections = raw.flatMap((candidate) => {
|
|
4257
|
+
const parsed = formSectionSchema.safeParse(candidate);
|
|
4258
|
+
return parsed.success ? [parsed.data] : [];
|
|
4259
|
+
});
|
|
4260
|
+
return sections.length > 0 ? { sections } : {};
|
|
4261
|
+
}
|
|
4262
|
+
function findFieldByName(fields, name) {
|
|
4263
|
+
for (const field of fields) {
|
|
4264
|
+
if (field.name === name) return field;
|
|
4265
|
+
if (field.type === "group") {
|
|
4266
|
+
for (const group of field.groups) {
|
|
4267
|
+
const found = findFieldByName(group.fields, name);
|
|
4268
|
+
if (found) return found;
|
|
4269
|
+
}
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
return void 0;
|
|
4273
|
+
}
|
|
4274
|
+
function isFieldVisible(field, values) {
|
|
4275
|
+
if (!field.visibleWhen) return true;
|
|
4276
|
+
return values[field.visibleWhen.field] === field.visibleWhen.equals;
|
|
4277
|
+
}
|
|
4278
|
+
function collectValidatableFields(fields, values) {
|
|
4279
|
+
const result = [];
|
|
4280
|
+
for (const field of fields) {
|
|
4281
|
+
if (!isFieldVisible(field, values)) continue;
|
|
4282
|
+
if (field.type !== "group") {
|
|
4283
|
+
result.push(field);
|
|
4284
|
+
continue;
|
|
4285
|
+
}
|
|
4286
|
+
if (field.variant === "tabs") {
|
|
4287
|
+
const activeKey = typeof values[field.name] === "string" ? values[field.name] : void 0;
|
|
4288
|
+
const active = field.groups.find((g) => g.key === activeKey) ?? field.groups.find((g) => g.key === field.default) ?? field.groups[0];
|
|
4289
|
+
if (active) result.push(...collectValidatableFields(active.fields, values));
|
|
4290
|
+
} else {
|
|
4291
|
+
for (const group of field.groups) {
|
|
4292
|
+
result.push(...collectValidatableFields(group.fields, values));
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
return result;
|
|
4297
|
+
}
|
|
4298
|
+
function humanize(name) {
|
|
4299
|
+
const spaced = name.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim();
|
|
4300
|
+
if (!spaced) return name;
|
|
4301
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
4302
|
+
}
|
|
4303
|
+
function fieldLabel(field) {
|
|
4304
|
+
return field.label && field.label.length > 0 ? field.label : humanize(field.name);
|
|
4305
|
+
}
|
|
4306
|
+
function seedField(field, values) {
|
|
4307
|
+
if (field.type === "group") {
|
|
4308
|
+
if (field.variant === "tabs") {
|
|
4309
|
+
values[field.name] = field.default ?? field.groups[0]?.key;
|
|
4310
|
+
}
|
|
4311
|
+
for (const group of field.groups) {
|
|
4312
|
+
for (const child of group.fields) seedField(child, values);
|
|
4313
|
+
}
|
|
4314
|
+
return;
|
|
4315
|
+
}
|
|
4316
|
+
if (field.type === "file") {
|
|
4317
|
+
values[field.name] = [];
|
|
4318
|
+
return;
|
|
4319
|
+
}
|
|
4320
|
+
if (field.default !== void 0) {
|
|
4321
|
+
values[field.name] = field.default;
|
|
4322
|
+
return;
|
|
4323
|
+
}
|
|
4324
|
+
if (field.type === "boolean") values[field.name] = false;
|
|
4325
|
+
else if (field.type === "multi-enum" || field.type === "list") values[field.name] = [];
|
|
4326
|
+
else if (field.type === "key-value") values[field.name] = [];
|
|
4327
|
+
}
|
|
4328
|
+
function initialFormValues(fields) {
|
|
4329
|
+
const values = {};
|
|
4330
|
+
for (const field of fields) seedField(field, values);
|
|
4331
|
+
return values;
|
|
4332
|
+
}
|
|
4333
|
+
var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
4334
|
+
function isEmptyValue(value) {
|
|
4335
|
+
return value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
|
|
4336
|
+
}
|
|
4337
|
+
function isValidUrl(value) {
|
|
4338
|
+
try {
|
|
4339
|
+
void new URL(value);
|
|
4340
|
+
return true;
|
|
4341
|
+
} catch {
|
|
4342
|
+
return false;
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
function validateField(field, value) {
|
|
4346
|
+
const empty = isEmptyValue(value);
|
|
4347
|
+
if (field.required) {
|
|
4348
|
+
if (field.type === "boolean") {
|
|
4349
|
+
if (value !== true) return "This field is required.";
|
|
4350
|
+
} else if (empty) {
|
|
4351
|
+
return "This field is required.";
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
if (empty) return null;
|
|
4355
|
+
switch (field.type) {
|
|
4356
|
+
case "string": {
|
|
4357
|
+
const text = String(value);
|
|
4358
|
+
if (field.minLength !== void 0 && text.length < field.minLength) {
|
|
4359
|
+
return `Must be at least ${field.minLength} character${field.minLength === 1 ? "" : "s"}.`;
|
|
4360
|
+
}
|
|
4361
|
+
if (field.maxLength !== void 0 && text.length > field.maxLength) {
|
|
4362
|
+
return `Must be at most ${field.maxLength} character${field.maxLength === 1 ? "" : "s"}.`;
|
|
4363
|
+
}
|
|
4364
|
+
if (field.format === "email" && !EMAIL_RE.test(text)) {
|
|
4365
|
+
return "Enter a valid email address.";
|
|
4366
|
+
}
|
|
4367
|
+
if (field.format === "uri" && !isValidUrl(text)) {
|
|
4368
|
+
return "Enter a valid URL.";
|
|
4369
|
+
}
|
|
4370
|
+
if (field.pattern) {
|
|
4371
|
+
let re = null;
|
|
4372
|
+
try {
|
|
4373
|
+
re = new RegExp(field.pattern);
|
|
4374
|
+
} catch {
|
|
4375
|
+
re = null;
|
|
4376
|
+
}
|
|
4377
|
+
if (re && !re.test(text)) return "Value doesn't match the required format.";
|
|
4378
|
+
}
|
|
4379
|
+
return null;
|
|
4380
|
+
}
|
|
4381
|
+
case "number":
|
|
4382
|
+
case "integer": {
|
|
4383
|
+
const num = typeof value === "number" ? value : Number(value);
|
|
4384
|
+
if (Number.isNaN(num)) return "Enter a number.";
|
|
4385
|
+
if (field.type === "integer" && !Number.isInteger(num)) return "Enter a whole number.";
|
|
4386
|
+
if (field.min !== void 0 && num < field.min) return `Must be at least ${field.min}.`;
|
|
4387
|
+
if (field.max !== void 0 && num > field.max) return `Must be at most ${field.max}.`;
|
|
4388
|
+
return null;
|
|
4389
|
+
}
|
|
4390
|
+
case "list": {
|
|
4391
|
+
const items = Array.isArray(value) ? value : [];
|
|
4392
|
+
if (field.minItems !== void 0 && items.length < field.minItems) {
|
|
4393
|
+
return `Add at least ${field.minItems} item${field.minItems === 1 ? "" : "s"}.`;
|
|
4394
|
+
}
|
|
4395
|
+
if (field.maxItems !== void 0 && items.length > field.maxItems) {
|
|
4396
|
+
return `Add at most ${field.maxItems} item${field.maxItems === 1 ? "" : "s"}.`;
|
|
4397
|
+
}
|
|
4398
|
+
return null;
|
|
4399
|
+
}
|
|
4400
|
+
case "file": {
|
|
4401
|
+
const files = Array.isArray(value) ? value : [];
|
|
4402
|
+
for (const file of files) {
|
|
4403
|
+
const issue = checkFileIssue(file, field);
|
|
4404
|
+
if (issue) return issue.message;
|
|
4405
|
+
}
|
|
4406
|
+
if (field.maxFiles !== void 0 && files.length > field.maxFiles) {
|
|
4407
|
+
return `Add at most ${field.maxFiles} file${field.maxFiles === 1 ? "" : "s"}.`;
|
|
4408
|
+
}
|
|
4409
|
+
return null;
|
|
4410
|
+
}
|
|
4411
|
+
default:
|
|
4412
|
+
return null;
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
function validateForm(fields, values) {
|
|
4416
|
+
const errors = {};
|
|
4417
|
+
for (const field of collectValidatableFields(fields, values)) {
|
|
4418
|
+
errors[field.name] = validateField(field, values[field.name]);
|
|
4419
|
+
}
|
|
4420
|
+
return errors;
|
|
4421
|
+
}
|
|
4422
|
+
function formatBytes(bytes) {
|
|
4423
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
4424
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
4425
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
4426
|
+
}
|
|
4427
|
+
function fileMatchesAccept(file, accept) {
|
|
4428
|
+
if (!accept) return true;
|
|
4429
|
+
const patterns = accept.split(",").map((p) => p.trim()).filter(Boolean);
|
|
4430
|
+
if (patterns.length === 0) return true;
|
|
4431
|
+
const name = file.name.toLowerCase();
|
|
4432
|
+
const type = (file.type || "").toLowerCase();
|
|
4433
|
+
return patterns.some((pattern) => {
|
|
4434
|
+
const p = pattern.toLowerCase();
|
|
4435
|
+
if (p.startsWith(".")) return name.endsWith(p);
|
|
4436
|
+
if (p.endsWith("/*")) return type.startsWith(p.slice(0, -1));
|
|
4437
|
+
return type === p;
|
|
4438
|
+
});
|
|
4439
|
+
}
|
|
4440
|
+
function checkFileIssue(file, field) {
|
|
4441
|
+
if (!fileMatchesAccept(file, field.accept)) {
|
|
4442
|
+
return { reason: "wrong-type", message: "This file type isn't accepted." };
|
|
4443
|
+
}
|
|
4444
|
+
if (field.maxSize !== void 0 && file.size > field.maxSize) {
|
|
4445
|
+
return {
|
|
4446
|
+
reason: "too-large",
|
|
4447
|
+
message: `File is larger than the ${formatBytes(field.maxSize)} limit.`
|
|
4448
|
+
};
|
|
4449
|
+
}
|
|
4450
|
+
return null;
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4453
|
+
export {
|
|
4454
|
+
enumOptionSchema,
|
|
4455
|
+
optionValue,
|
|
4456
|
+
optionLabel,
|
|
4457
|
+
keyValueRowSchema,
|
|
4458
|
+
stringFieldSchema,
|
|
4459
|
+
numberFieldSchema,
|
|
4460
|
+
integerFieldSchema,
|
|
4461
|
+
booleanFieldSchema,
|
|
4462
|
+
enumFieldSchema,
|
|
4463
|
+
multiEnumFieldSchema,
|
|
4464
|
+
listFieldSchema,
|
|
4465
|
+
keyValueFieldSchema,
|
|
4466
|
+
fileFieldSchema,
|
|
4467
|
+
groupItemSchema,
|
|
4468
|
+
groupFieldSchema,
|
|
4469
|
+
fieldSpecSchema,
|
|
4470
|
+
formSpecSchema,
|
|
4471
|
+
formSectionSchema,
|
|
4472
|
+
normalizeFormSpec,
|
|
4473
|
+
findFieldByName,
|
|
4474
|
+
isFieldVisible,
|
|
4475
|
+
collectValidatableFields,
|
|
4476
|
+
fieldLabel,
|
|
4477
|
+
initialFormValues,
|
|
4478
|
+
validateField,
|
|
4479
|
+
validateForm,
|
|
4480
|
+
fileMatchesAccept,
|
|
4481
|
+
checkFileIssue
|
|
4482
|
+
};
|
|
4483
|
+
//# sourceMappingURL=chunk-TNOANK34.js.map
|