vercel 65.0.0 → 65.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.
Files changed (342) hide show
  1. package/dist/chunks/add-G44L5OSZ.js +8 -0
  2. package/dist/chunks/add-JATTZAMX.js +8 -0
  3. package/dist/chunks/add-QMLQDEWM.js +8 -0
  4. package/dist/chunks/build-ODRPV34E.js +7 -0
  5. package/dist/chunks/chunk-2N5LDFMR.js +10 -0
  6. package/dist/chunks/chunk-2NABMKFV.js +29 -0
  7. package/dist/chunks/chunk-2PKEEQ5W.js +25 -0
  8. package/dist/chunks/{chunk-27QCVNMI.js → chunk-3LIKVGFT.js} +1 -1
  9. package/dist/chunks/{chunk-VF2WX27D.js → chunk-3PMDNDOO.js} +2 -2
  10. package/dist/chunks/{chunk-VY63XWWU.js → chunk-3V6MUBCO.js} +1 -1
  11. package/dist/chunks/{chunk-RRWEIG6B.js → chunk-3XW7N4W3.js} +1 -1
  12. package/dist/chunks/{chunk-HBPSZHXX.js → chunk-4B45V3VM.js} +1 -1
  13. package/dist/chunks/{chunk-VO2XAQFF.js → chunk-4CKX6KUQ.js} +8 -9
  14. package/dist/chunks/{detect-projects-CHMBPFSE.js → chunk-4VFYJU37.js} +1 -1
  15. package/dist/chunks/chunk-4YDPE5DC.js +7 -0
  16. package/dist/chunks/{chunk-VAZQS475.js → chunk-572TYS62.js} +1 -1
  17. package/dist/chunks/{chunk-ZIWS57E4.js → chunk-5A46JI25.js} +1 -1
  18. package/dist/chunks/chunk-5Q7PEC6C.js +7 -0
  19. package/dist/chunks/chunk-5RMIM4S2.js +7 -0
  20. package/dist/chunks/{chunk-3XDTQFBL.js → chunk-5WTGQDJ7.js} +7 -7
  21. package/dist/chunks/chunk-64XCYUH7.js +7 -0
  22. package/dist/chunks/{chunk-KNTBWMVA.js → chunk-67NIX52O.js} +1 -1
  23. package/dist/chunks/{chunk-2UBZCG4F.js → chunk-6A4CDEBQ.js} +1 -1
  24. package/dist/chunks/chunk-6CXJXQ6W.js +8 -0
  25. package/dist/chunks/chunk-6HEPFWGT.js +7 -0
  26. package/dist/chunks/chunk-6IDNVZZR.js +7 -0
  27. package/dist/chunks/{chunk-Z6JDXW4A.js → chunk-6KF43YYP.js} +1 -1
  28. package/dist/chunks/{chunk-DBNQ45J5.js → chunk-6OVX3PWM.js} +1 -1
  29. package/dist/chunks/{chunk-OVV5MV5M.js → chunk-6RCYHBTM.js} +1 -1
  30. package/dist/chunks/{chunk-AZ5OUZPP.js → chunk-6VH56CX2.js} +1 -1
  31. package/dist/chunks/chunk-6Y2ZL5XJ.js +98 -0
  32. package/dist/chunks/{chunk-ENWROHWX.js → chunk-7MQHQTCJ.js} +1 -1
  33. package/dist/chunks/chunk-7YKFF6CE.js +7 -0
  34. package/dist/chunks/{chunk-WDWYKX2I.js → chunk-ADLBLGT3.js} +1 -1
  35. package/dist/chunks/{chunk-DGDNI76L.js → chunk-AMUAIMYY.js} +1 -1
  36. package/dist/chunks/chunk-ANMDN3EG.js +9 -0
  37. package/dist/chunks/chunk-BLUPZPAS.js +7 -0
  38. package/dist/chunks/chunk-BTI5TG6Q.js +7 -0
  39. package/dist/chunks/chunk-BUJITHGZ.js +8 -0
  40. package/dist/chunks/chunk-C6GY2G73.js +7 -0
  41. package/dist/chunks/chunk-CBXS6UFD.js +10 -0
  42. package/dist/chunks/{chunk-52JGR5SZ.js → chunk-CGSHQ7QM.js} +1 -1
  43. package/dist/chunks/chunk-CKZLNL5F.js +8 -0
  44. package/dist/chunks/chunk-CS532HK4.js +7 -0
  45. package/dist/chunks/{chunk-IYM5GO57.js → chunk-CV333GGZ.js} +1 -1
  46. package/dist/chunks/{chunk-WFSQ3OSN.js → chunk-CVDK3IYT.js} +6 -9
  47. package/dist/chunks/{chunk-BFJC3UDU.js → chunk-CWQJK5IX.js} +1 -1
  48. package/dist/chunks/chunk-D3M2JG5C.js +7 -0
  49. package/dist/chunks/{chunk-RUOOZ574.js → chunk-DHYND2QH.js} +1 -1
  50. package/dist/chunks/chunk-DQYCNHTR.js +21 -0
  51. package/dist/chunks/{chunk-VO36D4U4.js → chunk-DRT6ITIC.js} +1 -1
  52. package/dist/chunks/chunk-DWJRJK7I.js +7 -0
  53. package/dist/chunks/chunk-DWZBL4NK.js +7 -0
  54. package/dist/chunks/{chunk-SSKMT5SL.js → chunk-E432NQGO.js} +1 -1
  55. package/dist/chunks/chunk-ECQIO5K3.js +7 -0
  56. package/dist/chunks/{chunk-4T22AQTB.js → chunk-EKLONFSU.js} +1 -1
  57. package/dist/chunks/chunk-ESCYLPN6.js +7 -0
  58. package/dist/chunks/{chunk-EKMQNUO4.js → chunk-F2LZJWGH.js} +1 -1
  59. package/dist/chunks/{chunk-X5J7LOJK.js → chunk-F5QCUTBE.js} +1 -1
  60. package/dist/chunks/chunk-F7AVGV4Y.js +7 -0
  61. package/dist/chunks/{chunk-JETQEZ24.js → chunk-FDAMQA44.js} +2 -2
  62. package/dist/chunks/chunk-FDYDTFFM.js +7 -0
  63. package/dist/chunks/{chunk-KDABXEHF.js → chunk-FGEWQYON.js} +1 -1
  64. package/dist/chunks/{chunk-FPC5LINQ.js → chunk-FGFLTLEA.js} +1 -1
  65. package/dist/chunks/{chunk-2BAAJZBZ.js → chunk-FQ5EU3ML.js} +1 -1
  66. package/dist/chunks/chunk-FUX6LKNP.js +7 -0
  67. package/dist/chunks/{chunk-L5ANBZTX.js → chunk-GA277JFB.js} +1 -1
  68. package/dist/chunks/chunk-GD7AV7BO.js +9 -0
  69. package/dist/chunks/chunk-GENXRXFN.js +10 -0
  70. package/dist/chunks/{chunk-W7J5HTTY.js → chunk-GENZ5QV5.js} +1 -1
  71. package/dist/chunks/{chunk-KXHUMVXD.js → chunk-H2FI64HG.js} +1 -1
  72. package/dist/chunks/{chunk-PNUH3XXW.js → chunk-HBLBUOZ7.js} +2 -2
  73. package/dist/chunks/{chunk-EJINOHL3.js → chunk-HCRD3JFL.js} +1 -1
  74. package/dist/chunks/{chunk-X3VSVBXT.js → chunk-HO6ECDO3.js} +2 -2
  75. package/dist/chunks/chunk-HRR57QNP.js +7 -0
  76. package/dist/chunks/{chunk-AGDMSAYW.js → chunk-I26SSWTS.js} +1 -1
  77. package/dist/chunks/{chunk-XD2FF2PZ.js → chunk-IC27IY7N.js} +1 -1
  78. package/dist/chunks/{chunk-IKSZMJKB.js → chunk-IPZHE3OU.js} +2 -2
  79. package/dist/chunks/{chunk-WTBGMDQ7.js → chunk-IQKGQ2Y2.js} +1 -1
  80. package/dist/chunks/chunk-IWVEHRIU.js +7 -0
  81. package/dist/chunks/chunk-IZWASLQ6.js +7 -0
  82. package/dist/chunks/{chunk-JWX2YZVC.js → chunk-J2RX4B5S.js} +1 -1
  83. package/dist/chunks/chunk-J52VRTEQ.js +10 -0
  84. package/dist/chunks/{chunk-PXU645V7.js → chunk-JB7ZP4L4.js} +1 -1
  85. package/dist/chunks/{chunk-JDVUKDX3.js → chunk-JBUFVCTP.js} +1 -1
  86. package/dist/chunks/{chunk-6CXHR2ND.js → chunk-JELLVPCM.js} +2 -2
  87. package/dist/chunks/{chunk-CTKJQTC5.js → chunk-JLEJB6KM.js} +1 -1
  88. package/dist/chunks/{chunk-66262IYI.js → chunk-JP2W5MLV.js} +1 -1
  89. package/dist/chunks/chunk-JXLPHMKT.js +7 -0
  90. package/dist/chunks/{chunk-VCV3H73W.js → chunk-JY4EKLND.js} +1 -1
  91. package/dist/chunks/{chunk-RAN5LUZY.js → chunk-K246KRFS.js} +1 -1
  92. package/dist/chunks/chunk-K4AZWWRJ.js +7 -0
  93. package/dist/chunks/{chunk-7OMWRRY4.js → chunk-KINNDNJ3.js} +1 -1
  94. package/dist/chunks/chunk-KKRTKV62.js +7 -0
  95. package/dist/chunks/chunk-KRPY5FHJ.js +7 -0
  96. package/dist/chunks/{chunk-YXZGKFF3.js → chunk-KW6GSQXV.js} +1 -1
  97. package/dist/chunks/chunk-L3FAM6KS.js +8 -0
  98. package/dist/chunks/chunk-L3T6AEPG.js +7 -0
  99. package/dist/chunks/{chunk-YPX7BXJ6.js → chunk-L6TM45P4.js} +2 -2
  100. package/dist/chunks/chunk-M5WBBJRW.js +7 -0
  101. package/dist/chunks/{chunk-RTWGDRYT.js → chunk-MG7CRSO5.js} +1 -1
  102. package/dist/chunks/chunk-MTTYJO4W.js +8 -0
  103. package/dist/chunks/{chunk-MTETAZA4.js → chunk-NFEG7ONP.js} +1 -1
  104. package/dist/chunks/chunk-NFUAFRIC.js +7 -0
  105. package/dist/chunks/{chunk-WYJGP5QW.js → chunk-NHRZRW54.js} +1 -1
  106. package/dist/chunks/chunk-NNH2H4LZ.js +15 -0
  107. package/dist/chunks/chunk-OAM5NJCU.js +9 -0
  108. package/dist/chunks/chunk-OCR5CRTH.js +10 -0
  109. package/dist/chunks/chunk-OFDTADPQ.js +7 -0
  110. package/dist/chunks/{chunk-X7CLBXWL.js → chunk-OPORM35X.js} +1 -1
  111. package/dist/chunks/chunk-PA2A2V5Y.js +10 -0
  112. package/dist/chunks/{chunk-UDMEPP3K.js → chunk-PBC276AK.js} +1 -1
  113. package/dist/chunks/{chunk-B6U5434D.js → chunk-PCLWLNZC.js} +1 -1
  114. package/dist/chunks/chunk-PDY2YXG7.js +7 -0
  115. package/dist/chunks/{chunk-KCVCGYAR.js → chunk-PF6O7LHL.js} +2 -2
  116. package/dist/chunks/chunk-PFD7LETF.js +7 -0
  117. package/dist/chunks/{chunk-LJIQZ3LU.js → chunk-PRAWMNTU.js} +1 -1
  118. package/dist/chunks/chunk-PSOVLGHP.js +7 -0
  119. package/dist/chunks/chunk-PWNCGM6A.js +7 -0
  120. package/dist/chunks/{chunk-KUGFILF5.js → chunk-PXGJGWVA.js} +1 -1
  121. package/dist/chunks/chunk-QO7CBCML.js +7 -0
  122. package/dist/chunks/{chunk-66ODHUGV.js → chunk-QWE7OFE7.js} +1 -1
  123. package/dist/chunks/{chunk-CZ2KEML2.js → chunk-R6BEOVTU.js} +1 -1
  124. package/dist/chunks/chunk-RLKS5G6C.js +12 -0
  125. package/dist/chunks/{chunk-WFEEUZ6B.js → chunk-RX2VZBEZ.js} +1 -1
  126. package/dist/chunks/chunk-S3L2OHPO.js +7 -0
  127. package/dist/chunks/{chunk-JT273F22.js → chunk-S3QPCSQR.js} +1 -1
  128. package/dist/chunks/{chunk-7G72V52B.js → chunk-SDDKXGMK.js} +1 -1
  129. package/dist/chunks/chunk-SSULKPUE.js +12 -0
  130. package/dist/chunks/chunk-TAAWMNNL.js +7 -0
  131. package/dist/chunks/chunk-THRWLZ3N.js +7 -0
  132. package/dist/chunks/chunk-U4Z2MMOF.js +301 -0
  133. package/dist/chunks/chunk-UVHKXCR5.js +11 -0
  134. package/dist/chunks/chunk-UYOFNAH5.js +33 -0
  135. package/dist/chunks/{chunk-GRVLQZFQ.js → chunk-VG2AJII6.js} +1 -1
  136. package/dist/chunks/chunk-VPH6RJ5P.js +7 -0
  137. package/dist/chunks/chunk-VT3QK5IV.js +7 -0
  138. package/dist/chunks/{chunk-T5LBVZWY.js → chunk-VWIHFPW2.js} +1 -1
  139. package/dist/chunks/{chunk-F4ZFLPMT.js → chunk-W4FODG6F.js} +1 -1
  140. package/dist/chunks/{chunk-FN7TTXXY.js → chunk-W6RCABNS.js} +1 -1
  141. package/dist/chunks/{chunk-43T3YKNH.js → chunk-WFAZDFAR.js} +1 -1
  142. package/dist/chunks/{chunk-VWK26HHN.js → chunk-WSD53RLA.js} +1 -1
  143. package/dist/chunks/chunk-XGTKHQTT.js +7 -0
  144. package/dist/chunks/{chunk-UGZ3HFHI.js → chunk-XP3FT56R.js} +3 -3
  145. package/dist/chunks/chunk-XR6QY7RR.js +7 -0
  146. package/dist/chunks/chunk-XRRGT7CM.js +9 -0
  147. package/dist/chunks/chunk-Y3J6UDPB.js +7 -0
  148. package/dist/chunks/chunk-Y5RR6CRP.js +17 -0
  149. package/dist/chunks/chunk-YEYZP3IH.js +7 -0
  150. package/dist/chunks/{chunk-HNF2BEOE.js → chunk-YJXE7NJC.js} +1 -1
  151. package/dist/chunks/{chunk-7C5JHTHO.js → chunk-YPKKC232.js} +1 -1
  152. package/dist/chunks/chunk-ZF27J6FQ.js +7 -0
  153. package/dist/chunks/chunk-ZFRNVIHI.js +7 -0
  154. package/dist/chunks/chunk-ZPXMOZ4S.js +7 -0
  155. package/dist/chunks/clear-REFHHJJB.js +8 -0
  156. package/dist/chunks/compile-vercel-config-Q7JGV2RD.js +7 -0
  157. package/dist/chunks/config-DQ23X4AJ.js +7 -0
  158. package/dist/chunks/config-GKMT3G67.js +8 -0
  159. package/dist/chunks/config-validator.mjs +1 -1
  160. package/dist/chunks/connect-git-provider-FS5Q2HO4.js +7 -0
  161. package/dist/chunks/delete-5H7AMGTE.js +10 -0
  162. package/dist/chunks/delete-MIDLGXPG.js +9 -0
  163. package/dist/chunks/detect-projects-NLAYKNQX.js +7 -0
  164. package/dist/chunks/detect-services-CNIBYXAN.js +7 -0
  165. package/dist/chunks/disable-45GKGBKT.js +7 -0
  166. package/dist/chunks/discard-ZHC6DXON.js +14 -0
  167. package/dist/chunks/dist-33WTJLVQ.js +7 -0
  168. package/dist/chunks/dist-RXYNZPEA.js +7 -0
  169. package/dist/chunks/edit-N6D2VXVA.js +9 -0
  170. package/dist/chunks/edit-TVSUOODD.js +8 -0
  171. package/dist/chunks/enable-SXFQAYFU.js +7 -0
  172. package/dist/chunks/{exec-5ZWP5NC6.js → exec-OZSY46V6.js} +1 -1
  173. package/dist/chunks/{export-3OE2RWU7.js → export-5G7MAWTT.js} +1 -1
  174. package/dist/chunks/fetch-proxy-45DGILKR.js +67 -0
  175. package/dist/chunks/future-3BZKO5JV.js +7 -0
  176. package/dist/chunks/generate-cert-for-deploy-YAJHY6TW.js +7 -0
  177. package/dist/chunks/image-W5TWCF3B.js +7 -0
  178. package/dist/chunks/import-builders-PK2EHZ43.js +7 -0
  179. package/dist/chunks/{inspect-HYJULYCV.js → inspect-5PNUHNL2.js} +1 -1
  180. package/dist/chunks/{inspect-GD6JJPWG.js → inspect-BNOMQCB4.js} +1 -1
  181. package/dist/chunks/inspect-IS5SYBTI.js +9 -0
  182. package/dist/chunks/{inspect-JWDH7C6F.js → inspect-NWAB6AGM.js} +1 -1
  183. package/dist/chunks/inspect-O5IKZFOG.js +13 -0
  184. package/dist/chunks/{list-AGS47O5P.js → list-3Q5CBGFH.js} +1 -1
  185. package/dist/chunks/{list-4SZS2TB7.js → list-JF2OEQON.js} +1 -1
  186. package/dist/chunks/list-OVHNSNGA.js +12 -0
  187. package/dist/chunks/login-3BXNN3JH.js +7 -0
  188. package/dist/chunks/login-5FKYBEVP.js +9 -0
  189. package/dist/chunks/logs-ALPOUQZZ.js +7 -0
  190. package/dist/chunks/ls-4WMW65WV.js +8 -0
  191. package/dist/chunks/{ls-Y2JQYSVO.js → ls-DVHKDVJJ.js} +1 -1
  192. package/dist/chunks/{ls-LGL5ZKEJ.js → ls-GCFLDDFZ.js} +1 -1
  193. package/dist/chunks/{ls-ZPUNJ7ND.js → ls-MERY5XTJ.js} +1 -1
  194. package/dist/chunks/{ls-KNRG7G5K.js → ls-RO7VUFMS.js} +1 -1
  195. package/dist/chunks/{ls-WQX2DS4X.js → ls-RWBJBEIJ.js} +1 -1
  196. package/dist/chunks/ls-YOXQDZ7X.js +11 -0
  197. package/dist/chunks/mutate-TGIOOZVQ.js +9 -0
  198. package/dist/chunks/notifications-J24CW3SD.js +7 -0
  199. package/dist/chunks/open-5U4GN2S4.js +7 -0
  200. package/dist/chunks/openapi-CZCUACZA.js +7 -0
  201. package/dist/chunks/permissions-B2RJ4FS6.js +7 -0
  202. package/dist/chunks/plugin-offer-E4DLD4HU.js +9 -0
  203. package/dist/chunks/prompt-missing-credentials-WWEM2TVX.js +7 -0
  204. package/dist/chunks/publish-BK3BK3PV.js +15 -0
  205. package/dist/chunks/pull-CSFLO6P5.js +7 -0
  206. package/dist/chunks/purchase-domain-if-available-7VAJB3SY.js +7 -0
  207. package/dist/chunks/push-ENXU4VFN.js +7 -0
  208. package/dist/chunks/{query-JA5OWDSP.js → query-RW2DLTO5.js} +1 -1
  209. package/dist/chunks/reauthenticate-QKPBNAAH.js +7 -0
  210. package/dist/chunks/reorder-XXOCBKOR.js +10 -0
  211. package/dist/chunks/reply-IJ4UMSYT.js +9 -0
  212. package/dist/chunks/resolve-FHUXU6TQ.js +12 -0
  213. package/dist/chunks/resolve-agent-team-3432OTOK.js +7 -0
  214. package/dist/chunks/{resolve-deployment-framework-preset-JPT2MRPA.js → resolve-deployment-framework-preset-AXXYBFCL.js} +1 -1
  215. package/dist/chunks/restore-V2KCZWP3.js +16 -0
  216. package/dist/chunks/rm-5CDEDJXM.js +8 -0
  217. package/dist/chunks/rm-FN3G7ARM.js +8 -0
  218. package/dist/chunks/rm-MPREW2CR.js +8 -0
  219. package/dist/chunks/rm-VDEXQXNO.js +8 -0
  220. package/dist/chunks/rm-XUEOPXWC.js +8 -0
  221. package/dist/chunks/routes-KHBSGELO.js +7 -0
  222. package/dist/chunks/rule-inspect-27A23NWG.js +8 -0
  223. package/dist/chunks/schema-CE2N7SZP.js +14 -0
  224. package/dist/chunks/{schema-OV4SUO52.js → schema-JCJF3AUI.js} +1 -1
  225. package/dist/chunks/select-org-IAA5ZTIS.js +7 -0
  226. package/dist/chunks/set-YP4JEPJQ.js +7 -0
  227. package/dist/chunks/setup-and-link-HS4GH2QQ.js +7 -0
  228. package/dist/chunks/{skills-6EFE7KH7.js → skills-U52S6GRY.js} +1 -1
  229. package/dist/chunks/tags-7WRBB2U4.js +7 -0
  230. package/dist/chunks/token-W6P2KNI5.js +7 -0
  231. package/dist/chunks/token-util-JDQI37VN.js +7 -0
  232. package/dist/chunks/{types-2DDQTYAO.js → types-LKCU7WSY.js} +1 -1
  233. package/dist/chunks/{update-XUMH6CAJ.js → update-DUSQP2H7.js} +1 -1
  234. package/dist/chunks/zod-2C2SXNIK.js +7 -0
  235. package/dist/commands/build/index.js +1 -1
  236. package/dist/commands/deploy/index.js +6 -6
  237. package/dist/commands/dev/index.js +17 -15
  238. package/dist/commands/env/index.js +8 -8
  239. package/dist/commands/link/index.js +1 -1
  240. package/dist/commands/list/index.js +1 -1
  241. package/dist/commands/project/index.js +113 -0
  242. package/dist/commands-account.js +185 -0
  243. package/dist/commands-ai.js +200 -0
  244. package/dist/commands-blob.js +107 -0
  245. package/dist/commands-core.js +222 -0
  246. package/dist/commands-deployments.js +84 -0
  247. package/dist/commands-flags.js +377 -0
  248. package/dist/commands-integrations.js +143 -0
  249. package/dist/commands-observability.js +93 -0
  250. package/dist/commands-routing.js +273 -0
  251. package/dist/index.js +4 -4
  252. package/dist/internal-build-worker.js +1 -1
  253. package/dist/internal-build.js +2 -2
  254. package/dist/root-help-commands.mjs +1 -1
  255. package/dist/version.mjs +1 -1
  256. package/package.json +59 -58
  257. package/dist/chunks/add-2HOGPYWC.js +0 -8
  258. package/dist/chunks/add-2RYLJ442.js +0 -8
  259. package/dist/chunks/add-PAQE7CT2.js +0 -8
  260. package/dist/chunks/build-77Q2YPHO.js +0 -7
  261. package/dist/chunks/chunk-36N6VMW4.js +0 -7
  262. package/dist/chunks/chunk-3GXZPT7T.js +0 -7
  263. package/dist/chunks/chunk-3L4MAGRI.js +0 -31
  264. package/dist/chunks/chunk-732WJANV.js +0 -15
  265. package/dist/chunks/chunk-AW7DEWIM.js +0 -7
  266. package/dist/chunks/chunk-BHWEIKSP.js +0 -10
  267. package/dist/chunks/chunk-BJ5APZ6X.js +0 -7
  268. package/dist/chunks/chunk-BZQ7YWSB.js +0 -10
  269. package/dist/chunks/chunk-CLKHGKJA.js +0 -7
  270. package/dist/chunks/chunk-FRSHC2HN.js +0 -7
  271. package/dist/chunks/chunk-IMMMID5G.js +0 -7
  272. package/dist/chunks/chunk-INDGZ3JK.js +0 -30
  273. package/dist/chunks/chunk-MIKNK3B6.js +0 -7
  274. package/dist/chunks/chunk-MVCAUS4F.js +0 -36
  275. package/dist/chunks/chunk-NYKEU7DQ.js +0 -8
  276. package/dist/chunks/chunk-O3AL3QFA.js +0 -7
  277. package/dist/chunks/chunk-ODB7LEAO.js +0 -7
  278. package/dist/chunks/chunk-PS3KKHSI.js +0 -7
  279. package/dist/chunks/chunk-R3MRIQMO.js +0 -7
  280. package/dist/chunks/chunk-RH2SQQWH.js +0 -10
  281. package/dist/chunks/chunk-UMUPJDWU.js +0 -7
  282. package/dist/chunks/chunk-WKC7S5IW.js +0 -9
  283. package/dist/chunks/chunk-XBTLXKOI.js +0 -7
  284. package/dist/chunks/chunk-XDKCDGJF.js +0 -25
  285. package/dist/chunks/chunk-YNOLLMOG.js +0 -9
  286. package/dist/chunks/chunk-YTDK6AHS.js +0 -7
  287. package/dist/chunks/chunk-ZVRKM3UD.js +0 -12
  288. package/dist/chunks/clear-HPHGW2CD.js +0 -8
  289. package/dist/chunks/compile-vercel-config-YG2E5LXN.js +0 -7
  290. package/dist/chunks/config-PZ7HFZQZ.js +0 -8
  291. package/dist/chunks/config-XH532PP3.js +0 -7
  292. package/dist/chunks/connect-git-provider-WEFO2ESM.js +0 -7
  293. package/dist/chunks/delete-UPHMMYEJ.js +0 -10
  294. package/dist/chunks/delete-Z7PXYHTL.js +0 -9
  295. package/dist/chunks/detect-services-ZYHOOBMO.js +0 -7
  296. package/dist/chunks/disable-34LCZPFL.js +0 -7
  297. package/dist/chunks/discard-HDUCYAHG.js +0 -14
  298. package/dist/chunks/edit-4F7DADVN.js +0 -9
  299. package/dist/chunks/edit-5WKAHKCW.js +0 -8
  300. package/dist/chunks/enable-YV6I32W6.js +0 -7
  301. package/dist/chunks/fetch-proxy-OC6B22AW.js +0 -7
  302. package/dist/chunks/future-N2ZTDYVW.js +0 -7
  303. package/dist/chunks/generate-cert-for-deploy-ORS7XL64.js +0 -7
  304. package/dist/chunks/image-WTWQT7A4.js +0 -7
  305. package/dist/chunks/import-builders-XBGAW4MC.js +0 -7
  306. package/dist/chunks/inspect-ISRYYL7L.js +0 -13
  307. package/dist/chunks/inspect-MEYRAEVT.js +0 -9
  308. package/dist/chunks/list-O7FAMXMT.js +0 -12
  309. package/dist/chunks/login-KNE2BGUB.js +0 -9
  310. package/dist/chunks/login-NCAGHBZD.js +0 -7
  311. package/dist/chunks/logs-7H5XDI44.js +0 -7
  312. package/dist/chunks/ls-RI6BNJO7.js +0 -8
  313. package/dist/chunks/ls-UJHETSDA.js +0 -11
  314. package/dist/chunks/mutate-QHSLJCQU.js +0 -9
  315. package/dist/chunks/notifications-557GW5KI.js +0 -7
  316. package/dist/chunks/open-IYLA5OZF.js +0 -7
  317. package/dist/chunks/openapi-IVXUCJPM.js +0 -7
  318. package/dist/chunks/permissions-2XHSDRNE.js +0 -7
  319. package/dist/chunks/prompt-missing-credentials-BLT57RIR.js +0 -7
  320. package/dist/chunks/publish-MQ56IB4K.js +0 -15
  321. package/dist/chunks/pull-K3JVXGZM.js +0 -7
  322. package/dist/chunks/purchase-domain-if-available-VDMLT3J2.js +0 -7
  323. package/dist/chunks/push-YXUJGMP4.js +0 -7
  324. package/dist/chunks/reauthenticate-YZXHWSEC.js +0 -7
  325. package/dist/chunks/reorder-UNU63VF3.js +0 -10
  326. package/dist/chunks/reply-CTLC5KAK.js +0 -9
  327. package/dist/chunks/resolve-HTKF4MMV.js +0 -12
  328. package/dist/chunks/resolve-agent-team-DLIROIXX.js +0 -7
  329. package/dist/chunks/restore-CSZYM5WU.js +0 -16
  330. package/dist/chunks/rm-BGLDOP4N.js +0 -8
  331. package/dist/chunks/rm-O2XVUZOW.js +0 -8
  332. package/dist/chunks/rm-OSMI52XV.js +0 -8
  333. package/dist/chunks/rm-SZIT75ZY.js +0 -8
  334. package/dist/chunks/rm-WJERY4WM.js +0 -8
  335. package/dist/chunks/routes-ZNPZJERJ.js +0 -7
  336. package/dist/chunks/rule-inspect-NGI6XURL.js +0 -8
  337. package/dist/chunks/schema-JLQ7SNYR.js +0 -14
  338. package/dist/chunks/select-org-URO7GRAY.js +0 -7
  339. package/dist/chunks/set-RU227EQQ.js +0 -7
  340. package/dist/chunks/setup-and-link-WX6IEZZO.js +0 -7
  341. package/dist/chunks/tags-KJINDQSV.js +0 -7
  342. package/dist/commands-bulk.js +0 -1673
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{mapCertError}from"./chunk-EJINOHL3.js";import{DeploymentNotFound,DeploymentPermissionDenied,InvalidDeploymentId,isAPIError}from"./chunk-AZ5OUZPP.js";function toHost(url){return url.replace(/^(?:.*?\/\/)?([^/]+).*/,"$1")}async function getDeployment(client,contextName,hostOrId){hostOrId.includes(".")&&(hostOrId=toHost(hostOrId));try{return await client.fetch(`/v13/deployments/${encodeURIComponent(hostOrId)}`)}catch(err){if(isAPIError(err)){if(err.status===404)throw new DeploymentNotFound({id:hostOrId,context:contextName});if(err.status===403)throw new DeploymentPermissionDenied(hostOrId,contextName);if(err.status===400&&err.message.includes("`id`"))throw new InvalidDeploymentId(hostOrId);let certError=mapCertError(err);if(certError)throw certError}throw err}}export{toHost,getDeployment};
7
+ import{mapCertError}from"./chunk-HCRD3JFL.js";import{DeploymentNotFound,DeploymentPermissionDenied,InvalidDeploymentId,isAPIError}from"./chunk-6VH56CX2.js";function toHost(url){return url.replace(/^(?:.*?\/\/)?([^/]+).*/,"$1")}async function getDeployment(client,contextName,hostOrId){hostOrId.includes(".")&&(hostOrId=toHost(hostOrId));try{return await client.fetch(`/v13/deployments/${encodeURIComponent(hostOrId)}`)}catch(err){if(isAPIError(err)){if(err.status===404)throw new DeploymentNotFound({id:hostOrId,context:contextName});if(err.status===403)throw new DeploymentPermissionDenied(hostOrId,contextName);if(err.status===400&&err.message.includes("`id`"))throw new InvalidDeploymentId(hostOrId);let certError=mapCertError(err);if(certError)throw certError}throw err}}export{toHost,getDeployment};
@@ -0,0 +1,12 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import{require_strip_ansi}from"./chunk-BS32OUOC.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_strip_ansi=__toESM(require_strip_ansi(),1),border=["\u2500","\u256D","\u256E","\u2502","\u2502","\u2570","\u256F"],nothing=["\u2500","","","","","",""];function box(message,{borderColor,padding=1,textAlignment="center",terminalColumns:cols=process.stdout.columns||process.env.COLUMNS&&parseInt(process.env.COLUMNS,10)||80}={}){let lines=message.split(/\r?\n/).map(line=>[line,(0,import_strip_ansi.default)(line).length]),maxLine=lines.reduce((p,[,len])=>Math.max(p,len),0),borderColorFn=borderColor&&import_chalk.default[borderColor]||import_chalk.default.yellow,clampedSidePadding=Math.max(1,padding*3),narrowMode=maxLine+2+clampedSidePadding*2>cols,sidePadding=narrowMode?0:clampedSidePadding,innerWidth=Math.min(maxLine+sidePadding*2,cols),[hr,topLeft,topRight,left,right,bottomLeft,bottomRight]=narrowMode?nothing:border,spacerRow=narrowMode?`
8
+ `.repeat(padding):`${borderColorFn(`${left}${" ".repeat(innerWidth)}${right}`)}
9
+ `.repeat(padding),renderLine=([line,len])=>{let leftPadding=0,rightPadding=0;return narrowMode||(leftPadding=sidePadding,rightPadding=sidePadding,textAlignment==="center"?(leftPadding+=Math.floor((maxLine-len)/2),rightPadding+=maxLine-len-leftPadding+sidePadding):textAlignment==="right"?leftPadding+=maxLine-len:textAlignment==="left"&&(rightPadding+=maxLine-len)),borderColorFn(left)+" ".repeat(leftPadding)+line+" ".repeat(rightPadding)+borderColorFn(right)};return borderColorFn(`${topLeft}${hr.repeat(innerWidth)}${topRight}`)+`
10
+ `+spacerRow+lines.map(renderLine).join(`
11
+ `)+`
12
+ `+spacerRow+borderColorFn(`${bottomLeft}${hr.repeat(innerWidth)}${bottomRight}`)}export{box};
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{param}from"./chunk-3G3FQYMW.js";import{getTeams}from"./chunk-FPC5LINQ.js";import{outputActionRequired}from"./chunk-RH2SQQWH.js";import{getUser}from"./chunk-3XDTQFBL.js";import{printAlignedLabel}from"./chunk-WDWYKX2I.js";import{getCommandName,packageName}from"./chunk-JESNVRVR.js";import{emoji,output_manager_default,require_build_utils}from"./chunk-UGZ3HFHI.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var import_build_utils=__toESM(require_build_utils(),1);function getScopeOrTeamFromArgv(argv){let args=argv.slice(2);for(let i=0;i<args.length;i++){let arg=args[i];if(arg==="--scope"||arg==="--team"||arg==="-S"||arg==="-T"){let next=args[i+1];if(typeof next=="string"&&!next.startsWith("-"))return next;continue}if(arg.startsWith("--scope="))return arg.slice(8);if(arg.startsWith("--team="))return arg.slice(7)}return null}async function selectOrg(client,question,autoConfirm,searchable=!1,meta,description){let{config:{currentTeam}}=client;output_manager_default.spinner("Loading teams\u2026",1e3);let user,teams;try{[user,teams]=await Promise.all([getUser(client),getTeams(client)])}finally{output_manager_default.stopSpinner()}let formatChoiceName=(name,slug,isCurrent,limited)=>{let title=`${name} (${slug})`;return isCurrent&&(title+=` ${import_chalk.default.bold("(current)")}`),limited&&(title+=` ${emoji("locked")}`),title},personalAccountChoice=user.version==="northstar"?[]:[{name:formatChoiceName(user.name||user.username,user.username,!currentTeam,user.limited),value:{type:"user",id:user.id,slug:user.username}}],orderedTeams=client.ignoresSavedTeam?teams:teams.sort(a=>a.id===user.defaultTeamId?-1:1),choices=[...personalAccountChoice,...orderedTeams.map(team=>({name:formatChoiceName(team.name||team.slug,team.slug,team.id===currentTeam,team.limited),value:{type:"team",id:team.id,slug:team.slug}}))],defaultChoiceIndex=Math.max(choices.findIndex(choice=>choice.value.id===currentTeam),0);meta&&(meta.choiceCount=choices.length);let localConfigScope=client.localConfig?.scope,explicitScope=getScopeOrTeamFromArgv(client.argv)??(typeof localConfigScope=="string"?localConfigScope:null)??(0,import_build_utils.getPlatformEnv)("ORG_ID")??null,matchExplicitScope=()=>{if(!explicitScope)return;let match=choices.find(c=>c.value.id===explicitScope||c.value.slug===explicitScope);if(match)return match.value;if(user.id===explicitScope||user.email===explicitScope||user.username===explicitScope)return choices.find(c=>c.value.type==="user")?.value};if(client.nonInteractive||!client.stdin.isTTY){let match=matchExplicitScope();if(match)return match;if(choices.length===1)return choices[0].value;let actionRequired={status:"action_required",reason:"missing_scope",message:choices.length>0?"Provide --team or --scope explicitly. No default is applied in non-interactive mode.":"No teams available.",...choices.length>0&&{userActionRequired:!0,hint:"Ask the user which team to use, then run the matching command in next[]. Do not choose a team yourself."},choices:choices.map(c=>({id:c.value.id,name:c.value.slug})),next:choices.map(c=>({command:`${packageName} link --team ${c.value.slug}`}))};outputActionRequired(client,actionRequired),output_manager_default.error(choices.length>0?`Multiple teams found. Teams are never auto-selected when the CLI runs without an interactive terminal. Re-run this command with ${param("--team <slug>")}, or run ${getCommandName("teams ls")} to list your teams.`:"No teams available."),process.exit(1)}let explicitOrg=matchExplicitScope();if(explicitOrg)return explicitOrg;if(choices.length===1)return printAlignedLabel("Team",choices[0].value.slug),choices[0].value;let descriptionLine=description?`
7
+ import{param}from"./chunk-3G3FQYMW.js";import{getTeams}from"./chunk-FGFLTLEA.js";import{outputActionRequired}from"./chunk-GENXRXFN.js";import{getUser}from"./chunk-5WTGQDJ7.js";import{printAlignedLabel}from"./chunk-ADLBLGT3.js";import{getCommandName,packageName}from"./chunk-JESNVRVR.js";import{emoji,output_manager_default,require_build_utils}from"./chunk-XP3FT56R.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var import_build_utils=__toESM(require_build_utils(),1);function getScopeOrTeamFromArgv(argv){let args=argv.slice(2);for(let i=0;i<args.length;i++){let arg=args[i];if(arg==="--scope"||arg==="--team"||arg==="-S"||arg==="-T"){let next=args[i+1];if(typeof next=="string"&&!next.startsWith("-"))return next;continue}if(arg.startsWith("--scope="))return arg.slice(8);if(arg.startsWith("--team="))return arg.slice(7)}return null}async function selectOrg(client,question,autoConfirm,searchable=!1,meta,description){let{config:{currentTeam}}=client;output_manager_default.spinner("Loading teams\u2026",1e3);let user,teams;try{[user,teams]=await Promise.all([getUser(client),getTeams(client)])}finally{output_manager_default.stopSpinner()}let formatChoiceName=(name,slug,isCurrent,limited)=>{let title=`${name} (${slug})`;return isCurrent&&(title+=` ${import_chalk.default.bold("(current)")}`),limited&&(title+=` ${emoji("locked")}`),title},personalAccountChoice=user.version==="northstar"?[]:[{name:formatChoiceName(user.name||user.username,user.username,!currentTeam,user.limited),value:{type:"user",id:user.id,slug:user.username}}],orderedTeams=client.ignoresSavedTeam?teams:teams.sort(a=>a.id===user.defaultTeamId?-1:1),choices=[...personalAccountChoice,...orderedTeams.map(team=>({name:formatChoiceName(team.name||team.slug,team.slug,team.id===currentTeam,team.limited),value:{type:"team",id:team.id,slug:team.slug}}))],defaultChoiceIndex=Math.max(choices.findIndex(choice=>choice.value.id===currentTeam),0);meta&&(meta.choiceCount=choices.length);let localConfigScope=client.localConfig?.scope,explicitScope=getScopeOrTeamFromArgv(client.argv)??(typeof localConfigScope=="string"?localConfigScope:null)??(0,import_build_utils.getPlatformEnv)("ORG_ID")??null,matchExplicitScope=()=>{if(!explicitScope)return;let match=choices.find(c=>c.value.id===explicitScope||c.value.slug===explicitScope);if(match)return match.value;if(user.id===explicitScope||user.email===explicitScope||user.username===explicitScope)return choices.find(c=>c.value.type==="user")?.value};if(client.nonInteractive||!client.stdin.isTTY){let match=matchExplicitScope();if(match)return match;if(choices.length===1)return choices[0].value;let actionRequired={status:"action_required",reason:"missing_scope",message:choices.length>0?"Provide --team or --scope explicitly. No default is applied in non-interactive mode.":"No teams available.",...choices.length>0&&{userActionRequired:!0,hint:"Ask the user which team to use, then run the matching command in next[]. Do not choose a team yourself."},choices:choices.map(c=>({id:c.value.id,name:c.value.slug})),next:choices.map(c=>({command:`${packageName} link --team ${c.value.slug}`}))};outputActionRequired(client,actionRequired),output_manager_default.error(choices.length>0?`Multiple teams found. Teams are never auto-selected when the CLI runs without an interactive terminal. Re-run this command with ${param("--team <slug>")}, or run ${getCommandName("teams ls")} to list your teams.`:"No teams available."),process.exit(1)}let explicitOrg=matchExplicitScope();if(explicitOrg)return explicitOrg;if(choices.length===1)return printAlignedLabel("Team",choices[0].value.slug),choices[0].value;let descriptionLine=description?`
8
8
  ${import_chalk.default.dim(` ${description}`)}`:"";if(!searchable)return await client.input.select({message:`${question}${descriptionLine}`,choices,default:choices[defaultChoiceIndex].value});let defaultChoice=choices[defaultChoiceIndex],initialChoices=defaultChoice?[defaultChoice,...choices.filter(choice=>choice!==defaultChoice)]:choices,pageSize=15,countHint=choices.length>pageSize?` ${import_chalk.default.dim(`(${choices.length} teams)`)}`:"";return await client.input.search({message:`${question}${countHint}${descriptionLine}`,pageSize,source:term=>{let searchTerm=term?.trim().toLowerCase();return searchTerm?choices.filter(choice=>choice.name.toLowerCase().includes(searchTerm)||choice.value.slug.toLowerCase().includes(searchTerm)):initialChoices}})}export{selectOrg};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import{__export}from"./chunk-BZENIQ7N.js";import{Buffer as Buffer2}from"node:buffer";import{createHash}from"node:crypto";var digest=(algorithm,data)=>createHash(algorithm).update(data).digest(),digest_default=digest;var encoder=new TextEncoder,decoder=new TextDecoder,MAX_INT32=2**32;function concat(...buffers){let size=buffers.reduce((acc,{length})=>acc+length,0),buf=new Uint8Array(size),i=0;for(let buffer of buffers)buf.set(buffer,i),i+=buffer.length;return buf}function p2s(alg,p2sInput){return concat(encoder.encode(alg),new Uint8Array([0]),p2sInput)}function writeUInt32BE(buf,value,offset){if(value<0||value>=MAX_INT32)throw new RangeError(`value must be >= 0 and <= ${MAX_INT32-1}. Received ${value}`);buf.set([value>>>24,value>>>16,value>>>8,value&255],offset)}function uint64be(value){let high=Math.floor(value/MAX_INT32),low=value%MAX_INT32,buf=new Uint8Array(8);return writeUInt32BE(buf,high,0),writeUInt32BE(buf,low,4),buf}function uint32be(value){let buf=new Uint8Array(4);return writeUInt32BE(buf,value),buf}function lengthAndInput(input){return concat(uint32be(input.length),input)}async function concatKdf(secret,bits,value){let iterations=Math.ceil((bits>>3)/32),res=new Uint8Array(iterations*32);for(let iter=0;iter<iterations;iter++){let buf=new Uint8Array(4+secret.length+value.length);buf.set(uint32be(iter+1)),buf.set(secret,4),buf.set(value,4+secret.length),res.set(await digest_default("sha256",buf),iter*32)}return res.slice(0,bits>>3)}function normalize(input){let encoded=input;return encoded instanceof Uint8Array&&(encoded=decoder.decode(encoded)),encoded}var encode=input=>Buffer2.from(input).toString("base64url");var decode=input=>new Uint8Array(Buffer2.from(normalize(input),"base64url"));import{createDecipheriv,KeyObject}from"node:crypto";var JOSEError=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(message2,options){super(message2,options),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},JWTClaimValidationFailed=class extends JOSEError{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(message2,payload,claim="unspecified",reason="unspecified"){super(message2,{cause:{claim,reason,payload}}),this.claim=claim,this.reason=reason,this.payload=payload}},JWTExpired=class extends JOSEError{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(message2,payload,claim="unspecified",reason="unspecified"){super(message2,{cause:{claim,reason,payload}}),this.claim=claim,this.reason=reason,this.payload=payload}},JOSEAlgNotAllowed=class extends JOSEError{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},JOSENotSupported=class extends JOSEError{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},JWEDecryptionFailed=class extends JOSEError{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(message2="decryption operation failed",options){super(message2,options)}},JWEInvalid=class extends JOSEError{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"};var JWTInvalid=class extends JOSEError{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};var JWKSMultipleMatchingKeys=class extends JOSEError{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(message2="multiple matching keys found in the JSON Web Key Set",options){super(message2,options)}};import{randomFillSync}from"node:crypto";function bitLength(alg){switch(alg){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`)}}var iv_default=alg=>randomFillSync(new Uint8Array(bitLength(alg)>>3));var checkIvLength=(enc,iv)=>{if(iv.length<<3!==bitLength(enc))throw new JWEInvalid("Invalid Initialization Vector length")},check_iv_length_default=checkIvLength;import*as util from"node:util";var is_key_object_default=obj=>util.types.isKeyObject(obj);var checkCekLength=(enc,cek)=>{let expected;switch(enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":expected=parseInt(enc.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":expected=parseInt(enc.slice(1,4),10);break;default:throw new JOSENotSupported(`Content Encryption Algorithm ${enc} is not supported either by JOSE or your javascript runtime`)}if(cek instanceof Uint8Array){let actual=cek.byteLength<<3;if(actual!==expected)throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);return}if(is_key_object_default(cek)&&cek.type==="secret"){let actual=cek.symmetricKeySize<<3;if(actual!==expected)throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);return}throw new TypeError("Invalid Content Encryption Key type")},check_cek_length_default=checkCekLength;import{timingSafeEqual as impl}from"node:crypto";var timingSafeEqual=impl,timing_safe_equal_default=timingSafeEqual;import{createHmac}from"node:crypto";function cbcTag(aad,iv,ciphertext,macSize,macKey,keySize){let macData=concat(aad,iv,ciphertext,uint64be(aad.length<<3)),hmac=createHmac(`sha${macSize}`,macKey);return hmac.update(macData),hmac.digest().slice(0,keySize>>3)}import*as crypto from"node:crypto";import*as util2 from"node:util";var webcrypto2=crypto.webcrypto,webcrypto_default=webcrypto2,isCryptoKey=key=>util2.types.isCryptoKey(key);function unusable(name,prop="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`)}function isAlgorithm(algorithm,name){return algorithm.name===name}function getHashLength(hash){return parseInt(hash.name.slice(4),10)}function checkUsage(key,usages){if(usages.length&&!usages.some(expected=>key.usages.includes(expected))){let msg="CryptoKey does not support this operation, its usages must include ";if(usages.length>2){let last=usages.pop();msg+=`one of ${usages.join(", ")}, or ${last}.`}else usages.length===2?msg+=`one of ${usages[0]} or ${usages[1]}.`:msg+=`${usages[0]}.`;throw new TypeError(msg)}}function checkEncCryptoKey(key,alg,...usages){switch(alg){case"A128GCM":case"A192GCM":case"A256GCM":{if(!isAlgorithm(key.algorithm,"AES-GCM"))throw unusable("AES-GCM");let expected=parseInt(alg.slice(1,4),10);if(key.algorithm.length!==expected)throw unusable(expected,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!isAlgorithm(key.algorithm,"AES-KW"))throw unusable("AES-KW");let expected=parseInt(alg.slice(1,4),10);if(key.algorithm.length!==expected)throw unusable(expected,"algorithm.length");break}case"ECDH":{switch(key.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw unusable("ECDH, X25519, or X448")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!isAlgorithm(key.algorithm,"PBKDF2"))throw unusable("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!isAlgorithm(key.algorithm,"RSA-OAEP"))throw unusable("RSA-OAEP");let expected=parseInt(alg.slice(9),10)||1;if(getHashLength(key.algorithm.hash)!==expected)throw unusable(`SHA-${expected}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}checkUsage(key,usages)}function message(msg,actual,...types4){if(types4=types4.filter(Boolean),types4.length>2){let last=types4.pop();msg+=`one of type ${types4.join(", ")}, or ${last}.`}else types4.length===2?msg+=`one of type ${types4[0]} or ${types4[1]}.`:msg+=`of type ${types4[0]}.`;return actual==null?msg+=` Received ${actual}`:typeof actual=="function"&&actual.name?msg+=` Received function ${actual.name}`:typeof actual=="object"&&actual!=null&&actual.constructor?.name&&(msg+=` Received an instance of ${actual.constructor.name}`),msg}var invalid_key_input_default=(actual,...types4)=>message("Key must be ",actual,...types4);function withAlg(alg,actual,...types4){return message(`Key for the ${alg} algorithm must be `,actual,...types4)}import{getCiphers}from"node:crypto";var ciphers,ciphers_default=algorithm=>(ciphers||=new Set(getCiphers()),ciphers.has(algorithm));var is_key_like_default=key=>is_key_object_default(key)||isCryptoKey(key),types3=["KeyObject"];(globalThis.CryptoKey||webcrypto_default?.CryptoKey)&&types3.push("CryptoKey");function cbcDecrypt(enc,cek,ciphertext,iv,tag2,aad){let keySize=parseInt(enc.slice(1,4),10);is_key_object_default(cek)&&(cek=cek.export());let encKey=cek.subarray(keySize>>3),macKey=cek.subarray(0,keySize>>3),macSize=parseInt(enc.slice(-3),10),algorithm=`aes-${keySize}-cbc`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let expectedTag=cbcTag(aad,iv,ciphertext,macSize,macKey,keySize),macCheckPassed;try{macCheckPassed=timing_safe_equal_default(tag2,expectedTag)}catch{}if(!macCheckPassed)throw new JWEDecryptionFailed;let plaintext;try{let decipher=createDecipheriv(algorithm,encKey,iv);plaintext=concat(decipher.update(ciphertext),decipher.final())}catch{}if(!plaintext)throw new JWEDecryptionFailed;return plaintext}function gcmDecrypt(enc,cek,ciphertext,iv,tag2,aad){let algorithm=`aes-${parseInt(enc.slice(1,4),10)}-gcm`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);try{let decipher=createDecipheriv(algorithm,cek,iv,{authTagLength:16});decipher.setAuthTag(tag2),aad.byteLength&&decipher.setAAD(aad,{plaintextLength:ciphertext.length});let plaintext=decipher.update(ciphertext);return decipher.final(),plaintext}catch{throw new JWEDecryptionFailed}}var decrypt=(enc,cek,ciphertext,iv,tag2,aad)=>{let key;if(isCryptoKey(cek))checkEncCryptoKey(cek,enc,"decrypt"),key=KeyObject.from(cek);else if(cek instanceof Uint8Array||is_key_object_default(cek))key=cek;else throw new TypeError(invalid_key_input_default(cek,...types3,"Uint8Array"));if(!iv)throw new JWEInvalid("JWE Initialization Vector missing");if(!tag2)throw new JWEInvalid("JWE Authentication Tag missing");switch(check_cek_length_default(enc,key),check_iv_length_default(enc,iv),enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return cbcDecrypt(enc,key,ciphertext,iv,tag2,aad);case"A128GCM":case"A192GCM":case"A256GCM":return gcmDecrypt(enc,key,ciphertext,iv,tag2,aad);default:throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},decrypt_default=decrypt;var isDisjoint=(...headers)=>{let sources=headers.filter(Boolean);if(sources.length===0||sources.length===1)return!0;let acc;for(let header of sources){let parameters=Object.keys(header);if(!acc||acc.size===0){acc=new Set(parameters);continue}for(let parameter of parameters){if(acc.has(parameter))return!1;acc.add(parameter)}}return!0},is_disjoint_default=isDisjoint;function isObjectLike(value){return typeof value=="object"&&value!==null}function isObject(input){if(!isObjectLike(input)||Object.prototype.toString.call(input)!=="[object Object]")return!1;if(Object.getPrototypeOf(input)===null)return!0;let proto=input;for(;Object.getPrototypeOf(proto)!==null;)proto=Object.getPrototypeOf(proto);return Object.getPrototypeOf(input)===proto}import{Buffer as Buffer3}from"node:buffer";import{KeyObject as KeyObject2,createDecipheriv as createDecipheriv2,createCipheriv,createSecretKey}from"node:crypto";function checkKeySize(key,alg){if(key.symmetricKeySize<<3!==parseInt(alg.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${alg}`)}function ensureKeyObject(key,alg,usage){if(is_key_object_default(key))return key;if(key instanceof Uint8Array)return createSecretKey(key);if(isCryptoKey(key))return checkEncCryptoKey(key,alg,usage),KeyObject2.from(key);throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}var wrap=(alg,key,cek)=>{let algorithm=`aes${parseInt(alg.slice(1,4),10)}-wrap`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);let keyObject=ensureKeyObject(key,alg,"wrapKey");checkKeySize(keyObject,alg);let cipher=createCipheriv(algorithm,keyObject,Buffer3.alloc(8,166));return concat(cipher.update(cek),cipher.final())},unwrap=(alg,key,encryptedKey)=>{let algorithm=`aes${parseInt(alg.slice(1,4),10)}-wrap`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);let keyObject=ensureKeyObject(key,alg,"unwrapKey");checkKeySize(keyObject,alg);let cipher=createDecipheriv2(algorithm,keyObject,Buffer3.alloc(8,166));return concat(cipher.update(encryptedKey),cipher.final())};import{diffieHellman,generateKeyPair as generateKeyPairCb,KeyObject as KeyObject4}from"node:crypto";import{promisify}from"node:util";import{KeyObject as KeyObject3}from"node:crypto";function isJWK(key){return isObject(key)&&typeof key.kty=="string"}function isPrivateJWK(key){return key.kty!=="oct"&&typeof key.d=="string"}function isPublicJWK(key){return key.kty!=="oct"&&typeof key.d>"u"}function isSecretJWK(key){return isJWK(key)&&key.kty==="oct"&&typeof key.k=="string"}var namedCurveToJOSE=namedCurve=>{switch(namedCurve){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new JOSENotSupported("Unsupported key curve for this operation")}},getNamedCurve=(kee,raw)=>{let key;if(isCryptoKey(kee))key=KeyObject3.from(kee);else if(is_key_object_default(kee))key=kee;else{if(isJWK(kee))return kee.crv;throw new TypeError(invalid_key_input_default(kee,...types3))}if(key.type==="secret")throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(key.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${key.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${key.asymmetricKeyType.slice(1)}`;case"ec":{let namedCurve=key.asymmetricKeyDetails.namedCurve;return raw?namedCurve:namedCurveToJOSE(namedCurve)}default:throw new TypeError("Invalid asymmetric key type for this operation")}},get_named_curve_default=getNamedCurve;var generateKeyPair=promisify(generateKeyPairCb);async function deriveKey(publicKee,privateKee,algorithm,keyLength,apu=new Uint8Array(0),apv=new Uint8Array(0)){let publicKey;if(isCryptoKey(publicKee))checkEncCryptoKey(publicKee,"ECDH"),publicKey=KeyObject4.from(publicKee);else if(is_key_object_default(publicKee))publicKey=publicKee;else throw new TypeError(invalid_key_input_default(publicKee,...types3));let privateKey;if(isCryptoKey(privateKee))checkEncCryptoKey(privateKee,"ECDH","deriveBits"),privateKey=KeyObject4.from(privateKee);else if(is_key_object_default(privateKee))privateKey=privateKee;else throw new TypeError(invalid_key_input_default(privateKee,...types3));let value=concat(lengthAndInput(encoder.encode(algorithm)),lengthAndInput(apu),lengthAndInput(apv),uint32be(keyLength)),sharedSecret=diffieHellman({privateKey,publicKey});return concatKdf(sharedSecret,keyLength,value)}async function generateEpk(kee){let key;if(isCryptoKey(kee))key=KeyObject4.from(kee);else if(is_key_object_default(kee))key=kee;else throw new TypeError(invalid_key_input_default(kee,...types3));switch(key.asymmetricKeyType){case"x25519":return generateKeyPair("x25519");case"x448":return generateKeyPair("x448");case"ec":{let namedCurve=get_named_curve_default(key);return generateKeyPair("ec",{namedCurve})}default:throw new JOSENotSupported("Invalid or unsupported EPK")}}var ecdhAllowed=key=>["P-256","P-384","P-521","X25519","X448"].includes(get_named_curve_default(key));import{promisify as promisify2}from"node:util";import{KeyObject as KeyObject5,pbkdf2 as pbkdf2cb}from"node:crypto";function checkP2s(p2s2){if(!(p2s2 instanceof Uint8Array)||p2s2.length<8)throw new JWEInvalid("PBES2 Salt Input must be 8 or more octets")}var pbkdf2=promisify2(pbkdf2cb);function getPassword(key,alg){if(is_key_object_default(key))return key.export();if(key instanceof Uint8Array)return key;if(isCryptoKey(key))return checkEncCryptoKey(key,alg,"deriveBits","deriveKey"),KeyObject5.from(key).export();throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}var encrypt=async(alg,key,cek,p2c=2048,p2s2=randomFillSync(new Uint8Array(16)))=>{checkP2s(p2s2);let salt=p2s(alg,p2s2),keylen=parseInt(alg.slice(13,16),10)>>3,password=getPassword(key,alg),derivedKey=await pbkdf2(password,salt,p2c,keylen,`sha${alg.slice(8,11)}`);return{encryptedKey:await wrap(alg.slice(-6),derivedKey,cek),p2c,p2s:encode(p2s2)}},decrypt2=async(alg,key,encryptedKey,p2c,p2s2)=>{checkP2s(p2s2);let salt=p2s(alg,p2s2),keylen=parseInt(alg.slice(13,16),10)>>3,password=getPassword(key,alg),derivedKey=await pbkdf2(password,salt,p2c,keylen,`sha${alg.slice(8,11)}`);return unwrap(alg.slice(-6),derivedKey,encryptedKey)};import{KeyObject as KeyObject7,publicEncrypt,constants,privateDecrypt}from"node:crypto";import{deprecate}from"node:util";import{KeyObject as KeyObject6}from"node:crypto";var check_key_length_default=(key,alg)=>{let modulusLength;try{key instanceof KeyObject6?modulusLength=key.asymmetricKeyDetails?.modulusLength:modulusLength=Buffer.from(key.n,"base64url").byteLength<<3}catch{}if(typeof modulusLength!="number"||modulusLength<2048)throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`)};var checkKey=(key,alg)=>{if(key.asymmetricKeyType!=="rsa")throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");check_key_length_default(key,alg)},RSA1_5=deprecate(()=>constants.RSA_PKCS1_PADDING,'The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.'),resolvePadding=alg=>{switch(alg){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return RSA1_5();default:return}},resolveOaepHash=alg=>{switch(alg){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}};function ensureKeyObject2(key,alg,...usages){if(is_key_object_default(key))return key;if(isCryptoKey(key))return checkEncCryptoKey(key,alg,...usages),KeyObject7.from(key);throw new TypeError(invalid_key_input_default(key,...types3))}var encrypt2=(alg,key,cek)=>{let padding=resolvePadding(alg),oaepHash=resolveOaepHash(alg),keyObject=ensureKeyObject2(key,alg,"wrapKey","encrypt");return checkKey(keyObject,alg),publicEncrypt({key:keyObject,oaepHash,padding},cek)},decrypt3=(alg,key,encryptedKey)=>{let padding=resolvePadding(alg),oaepHash=resolveOaepHash(alg),keyObject=ensureKeyObject2(key,alg,"unwrapKey","decrypt");return checkKey(keyObject,alg),privateDecrypt({key:keyObject,oaepHash,padding},encryptedKey)};var normalize_key_default={};function bitLength2(alg){switch(alg){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`)}}var cek_default=alg=>randomFillSync(new Uint8Array(bitLength2(alg)>>3));import{createPrivateKey,createPublicKey}from"node:crypto";var parse=key=>key.d?createPrivateKey({format:"jwk",key}):createPublicKey({format:"jwk",key}),jwk_to_key_default=parse;async function importJWK(jwk,alg){if(!isObject(jwk))throw new TypeError("JWK must be an object");switch(alg||=jwk.alg,jwk.kty){case"oct":if(typeof jwk.k!="string"||!jwk.k)throw new TypeError('missing "k" (Key Value) Parameter value');return decode(jwk.k);case"RSA":if(jwk.oth!==void 0)throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return jwk_to_key_default({...jwk,alg});default:throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}var tag=key=>key?.[Symbol.toStringTag],jwkMatchesOp=(alg,key,usage)=>{if(key.use!==void 0&&key.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(key.key_ops!==void 0&&key.key_ops.includes?.(usage)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);if(key.alg!==void 0&&key.alg!==alg)throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);return!0},symmetricTypeCheck=(alg,key,usage,allowJwk)=>{if(!(key instanceof Uint8Array)){if(allowJwk&&isJWK(key)){if(isSecretJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!is_key_like_default(key))throw new TypeError(withAlg(alg,key,...types3,"Uint8Array",allowJwk?"JSON Web Key":null));if(key.type!=="secret")throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`)}},asymmetricTypeCheck=(alg,key,usage,allowJwk)=>{if(allowJwk&&isJWK(key))switch(usage){case"sign":if(isPrivateJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(isPublicJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!is_key_like_default(key))throw new TypeError(withAlg(alg,key,...types3,allowJwk?"JSON Web Key":null));if(key.type==="secret")throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);if(usage==="sign"&&key.type==="public")throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);if(usage==="decrypt"&&key.type==="public")throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);if(key.algorithm&&usage==="verify"&&key.type==="private")throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);if(key.algorithm&&usage==="encrypt"&&key.type==="private")throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`)};function checkKeyType(allowJwk,alg,key,usage){alg.startsWith("HS")||alg==="dir"||alg.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(alg)?symmetricTypeCheck(alg,key,usage,allowJwk):asymmetricTypeCheck(alg,key,usage,allowJwk)}var check_key_type_default=checkKeyType.bind(void 0,!1),checkKeyTypeWithJwk=checkKeyType.bind(void 0,!0);import{createCipheriv as createCipheriv2,KeyObject as KeyObject8}from"node:crypto";function cbcEncrypt(enc,plaintext,cek,iv,aad){let keySize=parseInt(enc.slice(1,4),10);is_key_object_default(cek)&&(cek=cek.export());let encKey=cek.subarray(keySize>>3),macKey=cek.subarray(0,keySize>>3),algorithm=`aes-${keySize}-cbc`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let cipher=createCipheriv2(algorithm,encKey,iv),ciphertext=concat(cipher.update(plaintext),cipher.final()),macSize=parseInt(enc.slice(-3),10),tag2=cbcTag(aad,iv,ciphertext,macSize,macKey,keySize);return{ciphertext,tag:tag2,iv}}function gcmEncrypt(enc,plaintext,cek,iv,aad){let algorithm=`aes-${parseInt(enc.slice(1,4),10)}-gcm`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let cipher=createCipheriv2(algorithm,cek,iv,{authTagLength:16});aad.byteLength&&cipher.setAAD(aad,{plaintextLength:plaintext.length});let ciphertext=cipher.update(plaintext);cipher.final();let tag2=cipher.getAuthTag();return{ciphertext,tag:tag2,iv}}var encrypt3=(enc,plaintext,cek,iv,aad)=>{let key;if(isCryptoKey(cek))checkEncCryptoKey(cek,enc,"encrypt"),key=KeyObject8.from(cek);else if(cek instanceof Uint8Array||is_key_object_default(cek))key=cek;else throw new TypeError(invalid_key_input_default(cek,...types3,"Uint8Array"));switch(check_cek_length_default(enc,key),iv?check_iv_length_default(enc,iv):iv=iv_default(enc),enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return cbcEncrypt(enc,plaintext,key,iv,aad);case"A128GCM":case"A192GCM":case"A256GCM":return gcmEncrypt(enc,plaintext,key,iv,aad);default:throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},encrypt_default=encrypt3;async function wrap2(alg,key,cek,iv){let jweAlgorithm=alg.slice(0,7),wrapped=await encrypt_default(jweAlgorithm,cek,key,iv,new Uint8Array(0));return{encryptedKey:wrapped.ciphertext,iv:encode(wrapped.iv),tag:encode(wrapped.tag)}}async function unwrap2(alg,key,encryptedKey,iv,tag2){let jweAlgorithm=alg.slice(0,7);return decrypt_default(jweAlgorithm,key,encryptedKey,iv,tag2,new Uint8Array(0))}async function decryptKeyManagement(alg,key,encryptedKey,joseHeader,options){switch(check_key_type_default(alg,key,"decrypt"),key=await normalize_key_default.normalizePrivateKey?.(key,alg)||key,alg){case"dir":{if(encryptedKey!==void 0)throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");return key}case"ECDH-ES":if(encryptedKey!==void 0)throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!isObject(joseHeader.epk))throw new JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!ecdhAllowed(key))throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let epk=await importJWK(joseHeader.epk,alg),partyUInfo,partyVInfo;if(joseHeader.apu!==void 0){if(typeof joseHeader.apu!="string")throw new JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{partyUInfo=decode(joseHeader.apu)}catch{throw new JWEInvalid("Failed to base64url decode the apu")}}if(joseHeader.apv!==void 0){if(typeof joseHeader.apv!="string")throw new JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{partyVInfo=decode(joseHeader.apv)}catch{throw new JWEInvalid("Failed to base64url decode the apv")}}let sharedSecret=await deriveKey(epk,key,alg==="ECDH-ES"?joseHeader.enc:alg,alg==="ECDH-ES"?bitLength2(joseHeader.enc):parseInt(alg.slice(-5,-2),10),partyUInfo,partyVInfo);if(alg==="ECDH-ES")return sharedSecret;if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return unwrap(alg.slice(-6),sharedSecret,encryptedKey)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return decrypt3(alg,key,encryptedKey)}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");if(typeof joseHeader.p2c!="number")throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');let p2cLimit=options?.maxPBES2Count||1e4;if(joseHeader.p2c>p2cLimit)throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof joseHeader.p2s!="string")throw new JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let p2s2;try{p2s2=decode(joseHeader.p2s)}catch{throw new JWEInvalid("Failed to base64url decode the p2s")}return decrypt2(alg,key,encryptedKey,joseHeader.p2c,p2s2)}case"A128KW":case"A192KW":case"A256KW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return unwrap(alg,key,encryptedKey)}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");if(typeof joseHeader.iv!="string")throw new JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof joseHeader.tag!="string")throw new JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let iv;try{iv=decode(joseHeader.iv)}catch{throw new JWEInvalid("Failed to base64url decode the iv")}let tag2;try{tag2=decode(joseHeader.tag)}catch{throw new JWEInvalid("Failed to base64url decode the tag")}return unwrap2(alg,key,encryptedKey,iv,tag2)}default:throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}var decrypt_key_management_default=decryptKeyManagement;function validateCrit(Err,recognizedDefault,recognizedOption,protectedHeader,joseHeader){if(joseHeader.crit!==void 0&&protectedHeader?.crit===void 0)throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');if(!protectedHeader||protectedHeader.crit===void 0)return new Set;if(!Array.isArray(protectedHeader.crit)||protectedHeader.crit.length===0||protectedHeader.crit.some(input=>typeof input!="string"||input.length===0))throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let recognized;recognizedOption!==void 0?recognized=new Map([...Object.entries(recognizedOption),...recognizedDefault.entries()]):recognized=recognizedDefault;for(let parameter of protectedHeader.crit){if(!recognized.has(parameter))throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);if(joseHeader[parameter]===void 0)throw new Err(`Extension Header Parameter "${parameter}" is missing`);if(recognized.get(parameter)&&protectedHeader[parameter]===void 0)throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`)}return new Set(protectedHeader.crit)}var validate_crit_default=validateCrit;var validateAlgorithms=(option,algorithms)=>{if(algorithms!==void 0&&(!Array.isArray(algorithms)||algorithms.some(s=>typeof s!="string")))throw new TypeError(`"${option}" option must be an array of strings`);if(algorithms)return new Set(algorithms)},validate_algorithms_default=validateAlgorithms;async function flattenedDecrypt(jwe,key,options){if(!isObject(jwe))throw new JWEInvalid("Flattened JWE must be an object");if(jwe.protected===void 0&&jwe.header===void 0&&jwe.unprotected===void 0)throw new JWEInvalid("JOSE Header missing");if(jwe.iv!==void 0&&typeof jwe.iv!="string")throw new JWEInvalid("JWE Initialization Vector incorrect type");if(typeof jwe.ciphertext!="string")throw new JWEInvalid("JWE Ciphertext missing or incorrect type");if(jwe.tag!==void 0&&typeof jwe.tag!="string")throw new JWEInvalid("JWE Authentication Tag incorrect type");if(jwe.protected!==void 0&&typeof jwe.protected!="string")throw new JWEInvalid("JWE Protected Header incorrect type");if(jwe.encrypted_key!==void 0&&typeof jwe.encrypted_key!="string")throw new JWEInvalid("JWE Encrypted Key incorrect type");if(jwe.aad!==void 0&&typeof jwe.aad!="string")throw new JWEInvalid("JWE AAD incorrect type");if(jwe.header!==void 0&&!isObject(jwe.header))throw new JWEInvalid("JWE Shared Unprotected Header incorrect type");if(jwe.unprotected!==void 0&&!isObject(jwe.unprotected))throw new JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let parsedProt;if(jwe.protected)try{let protectedHeader2=decode(jwe.protected);parsedProt=JSON.parse(decoder.decode(protectedHeader2))}catch{throw new JWEInvalid("JWE Protected Header is invalid")}if(!is_disjoint_default(parsedProt,jwe.header,jwe.unprotected))throw new JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let joseHeader={...parsedProt,...jwe.header,...jwe.unprotected};if(validate_crit_default(JWEInvalid,new Map,options?.crit,parsedProt,joseHeader),joseHeader.zip!==void 0)throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg,enc}=joseHeader;if(typeof alg!="string"||!alg)throw new JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if(typeof enc!="string"||!enc)throw new JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");let keyManagementAlgorithms=options&&validate_algorithms_default("keyManagementAlgorithms",options.keyManagementAlgorithms),contentEncryptionAlgorithms=options&&validate_algorithms_default("contentEncryptionAlgorithms",options.contentEncryptionAlgorithms);if(keyManagementAlgorithms&&!keyManagementAlgorithms.has(alg)||!keyManagementAlgorithms&&alg.startsWith("PBES2"))throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');if(contentEncryptionAlgorithms&&!contentEncryptionAlgorithms.has(enc))throw new JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter value not allowed');let encryptedKey;if(jwe.encrypted_key!==void 0)try{encryptedKey=decode(jwe.encrypted_key)}catch{throw new JWEInvalid("Failed to base64url decode the encrypted_key")}let resolvedKey=!1;typeof key=="function"&&(key=await key(parsedProt,jwe),resolvedKey=!0);let cek;try{cek=await decrypt_key_management_default(alg,key,encryptedKey,joseHeader,options)}catch(err){if(err instanceof TypeError||err instanceof JWEInvalid||err instanceof JOSENotSupported)throw err;cek=cek_default(enc)}let iv,tag2;if(jwe.iv!==void 0)try{iv=decode(jwe.iv)}catch{throw new JWEInvalid("Failed to base64url decode the iv")}if(jwe.tag!==void 0)try{tag2=decode(jwe.tag)}catch{throw new JWEInvalid("Failed to base64url decode the tag")}let protectedHeader=encoder.encode(jwe.protected??""),additionalData;jwe.aad!==void 0?additionalData=concat(protectedHeader,encoder.encode("."),encoder.encode(jwe.aad)):additionalData=protectedHeader;let ciphertext;try{ciphertext=decode(jwe.ciphertext)}catch{throw new JWEInvalid("Failed to base64url decode the ciphertext")}let result={plaintext:await decrypt_default(enc,cek,ciphertext,iv,tag2,additionalData)};if(jwe.protected!==void 0&&(result.protectedHeader=parsedProt),jwe.aad!==void 0)try{result.additionalAuthenticatedData=decode(jwe.aad)}catch{throw new JWEInvalid("Failed to base64url decode the aad")}return jwe.unprotected!==void 0&&(result.sharedUnprotectedHeader=jwe.unprotected),jwe.header!==void 0&&(result.unprotectedHeader=jwe.header),resolvedKey?{...result,key}:result}async function compactDecrypt(jwe,key,options){if(jwe instanceof Uint8Array&&(jwe=decoder.decode(jwe)),typeof jwe!="string")throw new JWEInvalid("Compact JWE must be a string or Uint8Array");let{0:protectedHeader,1:encryptedKey,2:iv,3:ciphertext,4:tag2,length}=jwe.split(".");if(length!==5)throw new JWEInvalid("Invalid Compact JWE");let decrypted=await flattenedDecrypt({ciphertext,iv:iv||void 0,protected:protectedHeader,tag:tag2||void 0,encrypted_key:encryptedKey||void 0},key,options),result={plaintext:decrypted.plaintext,protectedHeader:decrypted.protectedHeader};return typeof key=="function"?{...result,key:decrypted.key}:result}var epoch_default=date=>Math.floor(date.getTime()/1e3);var REGEX=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,secs_default=str=>{let matched=REGEX.exec(str);if(!matched||matched[4]&&matched[1])throw new TypeError("Invalid time period format");let value=parseFloat(matched[2]),unit=matched[3].toLowerCase(),numericDate;switch(unit){case"sec":case"secs":case"second":case"seconds":case"s":numericDate=Math.round(value);break;case"minute":case"minutes":case"min":case"mins":case"m":numericDate=Math.round(value*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":numericDate=Math.round(value*3600);break;case"day":case"days":case"d":numericDate=Math.round(value*86400);break;case"week":case"weeks":case"w":numericDate=Math.round(value*604800);break;default:numericDate=Math.round(value*31557600);break}return matched[1]==="-"||matched[4]==="ago"?-numericDate:numericDate};var normalizeTyp=value=>value.toLowerCase().replace(/^application\//,""),checkAudiencePresence=(audPayload,audOption)=>typeof audPayload=="string"?audOption.includes(audPayload):Array.isArray(audPayload)?audOption.some(Set.prototype.has.bind(new Set(audPayload))):!1,jwt_claims_set_default=(protectedHeader,encodedPayload,options={})=>{let payload;try{payload=JSON.parse(decoder.decode(encodedPayload))}catch{}if(!isObject(payload))throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");let{typ}=options;if(typ&&(typeof protectedHeader.typ!="string"||normalizeTyp(protectedHeader.typ)!==normalizeTyp(typ)))throw new JWTClaimValidationFailed('unexpected "typ" JWT header value',payload,"typ","check_failed");let{requiredClaims=[],issuer,subject,audience,maxTokenAge}=options,presenceCheck=[...requiredClaims];maxTokenAge!==void 0&&presenceCheck.push("iat"),audience!==void 0&&presenceCheck.push("aud"),subject!==void 0&&presenceCheck.push("sub"),issuer!==void 0&&presenceCheck.push("iss");for(let claim of new Set(presenceCheck.reverse()))if(!(claim in payload))throw new JWTClaimValidationFailed(`missing required "${claim}" claim`,payload,claim,"missing");if(issuer&&!(Array.isArray(issuer)?issuer:[issuer]).includes(payload.iss))throw new JWTClaimValidationFailed('unexpected "iss" claim value',payload,"iss","check_failed");if(subject&&payload.sub!==subject)throw new JWTClaimValidationFailed('unexpected "sub" claim value',payload,"sub","check_failed");if(audience&&!checkAudiencePresence(payload.aud,typeof audience=="string"?[audience]:audience))throw new JWTClaimValidationFailed('unexpected "aud" claim value',payload,"aud","check_failed");let tolerance;switch(typeof options.clockTolerance){case"string":tolerance=secs_default(options.clockTolerance);break;case"number":tolerance=options.clockTolerance;break;case"undefined":tolerance=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate}=options,now=epoch_default(currentDate||new Date);if((payload.iat!==void 0||maxTokenAge)&&typeof payload.iat!="number")throw new JWTClaimValidationFailed('"iat" claim must be a number',payload,"iat","invalid");if(payload.nbf!==void 0){if(typeof payload.nbf!="number")throw new JWTClaimValidationFailed('"nbf" claim must be a number',payload,"nbf","invalid");if(payload.nbf>now+tolerance)throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed',payload,"nbf","check_failed")}if(payload.exp!==void 0){if(typeof payload.exp!="number")throw new JWTClaimValidationFailed('"exp" claim must be a number',payload,"exp","invalid");if(payload.exp<=now-tolerance)throw new JWTExpired('"exp" claim timestamp check failed',payload,"exp","check_failed")}if(maxTokenAge){let age=now-payload.iat,max=typeof maxTokenAge=="number"?maxTokenAge:secs_default(maxTokenAge);if(age-tolerance>max)throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)',payload,"iat","check_failed");if(age<0-tolerance)throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',payload,"iat","check_failed")}return payload};async function jwtDecrypt(jwt,key,options){let decrypted=await compactDecrypt(jwt,key,options),payload=jwt_claims_set_default(decrypted.protectedHeader,decrypted.plaintext,options),{protectedHeader}=decrypted;if(protectedHeader.iss!==void 0&&protectedHeader.iss!==payload.iss)throw new JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',payload,"iss","mismatch");if(protectedHeader.sub!==void 0&&protectedHeader.sub!==payload.sub)throw new JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',payload,"sub","mismatch");if(protectedHeader.aud!==void 0&&JSON.stringify(protectedHeader.aud)!==JSON.stringify(payload.aud))throw new JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',payload,"aud","mismatch");let result={payload,protectedHeader};return typeof key=="function"?{...result,key:decrypted.key}:result}var unprotected=Symbol();import{KeyObject as KeyObject9}from"node:crypto";var keyToJWK=key=>{let keyObject;if(isCryptoKey(key)){if(!key.extractable)throw new TypeError("CryptoKey is not extractable");keyObject=KeyObject9.from(key)}else if(is_key_object_default(key))keyObject=key;else{if(key instanceof Uint8Array)return{kty:"oct",k:encode(key)};throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}if(keyObject.type!=="secret"&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(keyObject.asymmetricKeyType))throw new JOSENotSupported("Unsupported key asymmetricKeyType");return keyObject.export({format:"jwk"})},key_to_jwk_default=keyToJWK;async function exportJWK(key){return key_to_jwk_default(key)}async function encryptKeyManagement(alg,enc,key,providedCek,providedParameters={}){let encryptedKey,parameters,cek;switch(check_key_type_default(alg,key,"encrypt"),key=await normalize_key_default.normalizePublicKey?.(key,alg)||key,alg){case"dir":{cek=key;break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!ecdhAllowed(key))throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu,apv}=providedParameters,{epk:ephemeralKey}=providedParameters;ephemeralKey||=(await generateEpk(key)).privateKey;let{x,y,crv,kty}=await exportJWK(ephemeralKey),sharedSecret=await deriveKey(key,ephemeralKey,alg==="ECDH-ES"?enc:alg,alg==="ECDH-ES"?bitLength2(enc):parseInt(alg.slice(-5,-2),10),apu,apv);if(parameters={epk:{x,crv,kty}},kty==="EC"&&(parameters.epk.y=y),apu&&(parameters.apu=encode(apu)),apv&&(parameters.apv=encode(apv)),alg==="ECDH-ES"){cek=sharedSecret;break}cek=providedCek||cek_default(enc);let kwAlg=alg.slice(-6);encryptedKey=await wrap(kwAlg,sharedSecret,cek);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{cek=providedCek||cek_default(enc),encryptedKey=await encrypt2(alg,key,cek);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{cek=providedCek||cek_default(enc);let{p2c,p2s:p2s2}=providedParameters;({encryptedKey,...parameters}=await encrypt(alg,key,cek,p2c,p2s2));break}case"A128KW":case"A192KW":case"A256KW":{cek=providedCek||cek_default(enc),encryptedKey=await wrap(alg,key,cek);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{cek=providedCek||cek_default(enc);let{iv}=providedParameters;({encryptedKey,...parameters}=await wrap2(alg,key,cek,iv));break}default:throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek,encryptedKey,parameters}}var encrypt_key_management_default=encryptKeyManagement;var FlattenedEncrypt=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(plaintext){if(!(plaintext instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=plaintext}setKeyManagementParameters(parameters){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=parameters,this}setProtectedHeader(protectedHeader){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=protectedHeader,this}setSharedUnprotectedHeader(sharedUnprotectedHeader){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=sharedUnprotectedHeader,this}setUnprotectedHeader(unprotectedHeader){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=unprotectedHeader,this}setAdditionalAuthenticatedData(aad){return this._aad=aad,this}setContentEncryptionKey(cek){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=cek,this}setInitializationVector(iv){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=iv,this}async encrypt(key,options){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!is_disjoint_default(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let joseHeader={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(validate_crit_default(JWEInvalid,new Map,options?.crit,this._protectedHeader,joseHeader),joseHeader.zip!==void 0)throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg,enc}=joseHeader;if(typeof alg!="string"||!alg)throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof enc!="string"||!enc)throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let encryptedKey;if(this._cek&&(alg==="dir"||alg==="ECDH-ES"))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${alg}`);let cek;{let parameters;({cek,encryptedKey,parameters}=await encrypt_key_management_default(alg,enc,key,this._cek,this._keyManagementParameters)),parameters&&(options&&unprotected in options?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...parameters}:this.setUnprotectedHeader(parameters):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...parameters}:this.setProtectedHeader(parameters))}let additionalData,protectedHeader,aadMember;this._protectedHeader?protectedHeader=encoder.encode(encode(JSON.stringify(this._protectedHeader))):protectedHeader=encoder.encode(""),this._aad?(aadMember=encode(this._aad),additionalData=concat(protectedHeader,encoder.encode("."),encoder.encode(aadMember))):additionalData=protectedHeader;let{ciphertext,tag:tag2,iv}=await encrypt_default(enc,this._plaintext,cek,this._iv,additionalData),jwe={ciphertext:encode(ciphertext)};return iv&&(jwe.iv=encode(iv)),tag2&&(jwe.tag=encode(tag2)),encryptedKey&&(jwe.encrypted_key=encode(encryptedKey)),aadMember&&(jwe.aad=aadMember),this._protectedHeader&&(jwe.protected=decoder.decode(protectedHeader)),this._sharedUnprotectedHeader&&(jwe.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(jwe.header=this._unprotectedHeader),jwe}};var CompactEncrypt=class{_flattened;constructor(plaintext){this._flattened=new FlattenedEncrypt(plaintext)}setContentEncryptionKey(cek){return this._flattened.setContentEncryptionKey(cek),this}setInitializationVector(iv){return this._flattened.setInitializationVector(iv),this}setProtectedHeader(protectedHeader){return this._flattened.setProtectedHeader(protectedHeader),this}setKeyManagementParameters(parameters){return this._flattened.setKeyManagementParameters(parameters),this}async encrypt(key,options){let jwe=await this._flattened.encrypt(key,options);return[jwe.protected,jwe.encrypted_key,jwe.iv,jwe.ciphertext,jwe.tag].join(".")}};function validateInput(label,input){if(!Number.isFinite(input))throw new TypeError(`Invalid ${label} input`);return input}var ProduceJWT=class{_payload;constructor(payload={}){if(!isObject(payload))throw new TypeError("JWT Claims Set MUST be an object");this._payload=payload}setIssuer(issuer){return this._payload={...this._payload,iss:issuer},this}setSubject(subject){return this._payload={...this._payload,sub:subject},this}setAudience(audience){return this._payload={...this._payload,aud:audience},this}setJti(jwtId){return this._payload={...this._payload,jti:jwtId},this}setNotBefore(input){return typeof input=="number"?this._payload={...this._payload,nbf:validateInput("setNotBefore",input)}:input instanceof Date?this._payload={...this._payload,nbf:validateInput("setNotBefore",epoch_default(input))}:this._payload={...this._payload,nbf:epoch_default(new Date)+secs_default(input)},this}setExpirationTime(input){return typeof input=="number"?this._payload={...this._payload,exp:validateInput("setExpirationTime",input)}:input instanceof Date?this._payload={...this._payload,exp:validateInput("setExpirationTime",epoch_default(input))}:this._payload={...this._payload,exp:epoch_default(new Date)+secs_default(input)},this}setIssuedAt(input){return typeof input>"u"?this._payload={...this._payload,iat:epoch_default(new Date)}:input instanceof Date?this._payload={...this._payload,iat:validateInput("setIssuedAt",epoch_default(input))}:typeof input=="string"?this._payload={...this._payload,iat:validateInput("setIssuedAt",epoch_default(new Date)+secs_default(input))}:this._payload={...this._payload,iat:validateInput("setIssuedAt",input)},this}};var EncryptJWT=class extends ProduceJWT{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(protectedHeader){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=protectedHeader,this}setKeyManagementParameters(parameters){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=parameters,this}setContentEncryptionKey(cek){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=cek,this}setInitializationVector(iv){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=iv,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(key,options){let enc=new CompactEncrypt(encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),enc.setProtectedHeader(this._protectedHeader),this._iv&&enc.setInitializationVector(this._iv),this._cek&&enc.setContentEncryptionKey(this._cek),this._keyManagementParameters&&enc.setKeyManagementParameters(this._keyManagementParameters),enc.encrypt(key,options)}};var base64url_exports={};__export(base64url_exports,{decode:()=>decode2,encode:()=>encode2});var encode2=encode,decode2=decode;function decodeJwt(jwt){if(typeof jwt!="string")throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");let{1:payload,length}=jwt.split(".");if(length===5)throw new JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(length!==3)throw new JWTInvalid("Invalid JWT");if(!payload)throw new JWTInvalid("JWTs must contain a payload");let decoded;try{decoded=decode2(payload)}catch{throw new JWTInvalid("Failed to base64url decode the payload")}let result;try{result=JSON.parse(decoder.decode(decoded))}catch{throw new JWTInvalid("Failed to parse the decoded payload as JSON")}if(!isObject(result))throw new JWTInvalid("Invalid JWT Claims Set");return result}export{jwtDecrypt,EncryptJWT,base64url_exports,decodeJwt};
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{formatCondition,formatTransform,isTargetTransform}from"./chunk-JETQEZ24.js";import{output_manager_default}from"./chunk-UGZ3HFHI.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";function extractEnvVarNames(value){let names=new Set;for(let m of value.matchAll(/\$\{?([A-Z_][A-Z0-9_]*)\}?/g))names.add(m[1]);return Array.from(names)}function escapeRegex(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function referencesEnvVar(value,name){let escapedName=escapeRegex(name);return new RegExp(`\\$(?:\\{${escapedName}\\}|${escapedName}(?![A-Za-z0-9_]))`).test(value)}function referencesBracedEnvVar(value,name){return new RegExp(`\\$\\{${escapeRegex(name)}\\}`).test(value)}function collectReferencedEnvVars(values,explicitEnv=[],excludedNames=new Set){let names=new Set(explicitEnv.filter(name=>values.some(value=>referencesEnvVar(value,name))));for(let value of values)for(let name of extractEnvVarNames(value))(!excludedNames.has(name)||names.has(name)||referencesBracedEnvVar(value,name))&&names.add(name);return Array.from(names)}function collectNamedRegexCaptures(source){return new Set(Array.from(source.matchAll(/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g),match=>match[1]))}function populateRouteEnv(route,srcSyntax="regex"){let excludedNames=srcSyntax==="regex"&&route.src?collectNamedRegexCaptures(route.src):new Set,routeValues=[...route.dest?[route.dest]:[],...Object.values(route.headers||{})],routeEnv=collectReferencedEnvVars(routeValues,route.env,excludedNames);if(route.env=routeEnv.length>0?routeEnv:void 0,route.transforms)for(let transform of route.transforms){let args=transform.args?Array.isArray(transform.args)?transform.args:[transform.args]:[],names=collectReferencedEnvVars(args,transform.env,excludedNames);transform.env=names.length>0?names:void 0}}async function generateRoute(client,projectId,input,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes/generate${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input)})}function parseTransforms(values,type,op){return values.map(value=>parseTransform(value,type,op))}function parseTransform(input,type,op){if(op==="delete"){let key2=input.trim();if(!key2)throw new Error("Delete operation requires a key");return{type,op,target:{key:key2}}}let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),args=input.slice(eqIndex+1);if(!key)throw new Error("Transform key cannot be empty");return{type,op,target:{key},args}}function collectTransforms(flags){let transforms=[];return flags.setResponseHeader&&transforms.push(...parseTransforms(flags.setResponseHeader,"response.headers","set")),flags.appendResponseHeader&&transforms.push(...parseTransforms(flags.appendResponseHeader,"response.headers","append")),flags.deleteResponseHeader&&transforms.push(...parseTransforms(flags.deleteResponseHeader,"response.headers","delete")),flags.setRequestHeader&&transforms.push(...parseTransforms(flags.setRequestHeader,"request.headers","set")),flags.appendRequestHeader&&transforms.push(...parseTransforms(flags.appendRequestHeader,"request.headers","append")),flags.deleteRequestHeader&&transforms.push(...parseTransforms(flags.deleteRequestHeader,"request.headers","delete")),flags.setRequestQuery&&transforms.push(...parseTransforms(flags.setRequestQuery,"request.query","set")),flags.appendRequestQuery&&transforms.push(...parseTransforms(flags.appendRequestQuery,"request.query","append")),flags.deleteRequestQuery&&transforms.push(...parseTransforms(flags.deleteRequestQuery,"request.query","delete")),transforms}function collectResponseHeaders(setHeaders){let headers={};for(let input of setHeaders){let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid header format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),value=input.slice(eqIndex+1);if(!key)throw new Error("Header key cannot be empty");headers[key]=value}return headers}var MAX_NAME_LENGTH=256,MAX_DESCRIPTION_LENGTH=1024,MAX_CONDITIONS=16,VALID_SYNTAXES=["regex","path-to-regexp","equals"],REDIRECT_STATUS_CODES=[301,302,303,307,308],VALID_ACTION_TYPES=["rewrite","redirect","set-status"],ALL_ACTION_CHOICES=[{name:"Rewrite",value:"rewrite",exclusive:!0},{name:"Redirect",value:"redirect",exclusive:!0},{name:"Set Status Code",value:"set-status",exclusive:!0},{name:"Response Headers",value:"response-headers"},{name:"Request Headers",value:"request-headers"},{name:"Request Query",value:"request-query"}];function stripQuotes(str){return str.startsWith('"')&&str.endsWith('"')&&str.length>=2||str.startsWith("'")&&str.endsWith("'")&&str.length>=2?str.slice(1,-1):str}function extractTransformFlags(flags){return{setResponseHeader:flags["--set-response-header"],appendResponseHeader:flags["--append-response-header"],deleteResponseHeader:flags["--delete-response-header"],setRequestHeader:flags["--set-request-header"],appendRequestHeader:flags["--append-request-header"],deleteRequestHeader:flags["--delete-request-header"],setRequestQuery:flags["--set-request-query"],appendRequestQuery:flags["--append-request-query"],deleteRequestQuery:flags["--delete-request-query"]}}function collectHeadersAndTransforms(transformFlags){let headers=transformFlags.setResponseHeader?collectResponseHeaders(transformFlags.setResponseHeader):{},transforms=collectTransforms({...transformFlags,setResponseHeader:void 0});return{headers,transforms}}function hasAnyTransformFlags(flags){let tf=extractTransformFlags(flags);return!!(tf.setResponseHeader||tf.appendResponseHeader||tf.deleteResponseHeader||tf.setRequestHeader||tf.appendRequestHeader||tf.deleteRequestHeader||tf.setRequestQuery||tf.appendRequestQuery||tf.deleteRequestQuery)}function validateActionFlags(action,dest,status){if(!action)return dest||status!==void 0?"--action is required when using --dest or --status. Use --action rewrite, --action redirect, or --action set-status.":null;if(!VALID_ACTION_TYPES.includes(action))return`Invalid action type: "${action}". Valid types: ${VALID_ACTION_TYPES.join(", ")}`;switch(action){case"rewrite":if(!dest)return"--action rewrite requires --dest.";if(status!==void 0)return"--action rewrite does not accept --status.";break;case"redirect":if(!dest)return"--action redirect requires --dest.";if(status===void 0)return`--action redirect requires --status (${REDIRECT_STATUS_CODES.join(", ")}).`;if(!REDIRECT_STATUS_CODES.includes(status))return`Invalid redirect status: ${status}. Must be one of: ${REDIRECT_STATUS_CODES.join(", ")}`;break;case"set-status":if(dest)return"--action set-status does not accept --dest.";if(status===void 0)return"--action set-status requires --status.";if(status<100||status>599)return"Status code must be between 100 and 599.";break}return null}async function collectActionDetails(client,actionType,flags){switch(actionType){case"rewrite":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"});Object.assign(flags,{"--dest":dest});break}case"redirect":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"}),status=await client.input.select({message:"Status code:",choices:[{name:"307 - Temporary Redirect",value:307},{name:"308 - Permanent Redirect",value:308},{name:"301 - Moved Permanently",value:301},{name:"302 - Found",value:302},{name:"303 - See Other",value:303}]});Object.assign(flags,{"--dest":dest,"--status":status});break}case"set-status":{let statusCode=await client.input.text({message:"HTTP status code:",validate:val=>{let num=parseInt(val,10);return isNaN(num)||num<100||num>599?"Status code must be between 100 and 599":!0}});Object.assign(flags,{"--status":parseInt(statusCode,10)});break}case"response-headers":{await collectInteractiveHeaders(client,"response",flags);break}case"request-headers":{await collectInteractiveHeaders(client,"request-header",flags);break}case"request-query":{await collectInteractiveHeaders(client,"request-query",flags);break}}}async function collectInteractiveConditions(client,flags){let addMore=!0;for(;addMore;){let currentHas=flags["--has"]||[],currentMissing=flags["--missing"]||[];if(currentHas.length>0||currentMissing.length>0){output_manager_default.log(`
7
+ import{formatCondition,formatTransform,isTargetTransform}from"./chunk-FDAMQA44.js";import{output_manager_default}from"./chunk-XP3FT56R.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";function extractEnvVarNames(value){let names=new Set;for(let m of value.matchAll(/\$\{?([A-Z_][A-Z0-9_]*)\}?/g))names.add(m[1]);return Array.from(names)}function escapeRegex(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function referencesEnvVar(value,name){let escapedName=escapeRegex(name);return new RegExp(`\\$(?:\\{${escapedName}\\}|${escapedName}(?![A-Za-z0-9_]))`).test(value)}function referencesBracedEnvVar(value,name){return new RegExp(`\\$\\{${escapeRegex(name)}\\}`).test(value)}function collectReferencedEnvVars(values,explicitEnv=[],excludedNames=new Set){let names=new Set(explicitEnv.filter(name=>values.some(value=>referencesEnvVar(value,name))));for(let value of values)for(let name of extractEnvVarNames(value))(!excludedNames.has(name)||names.has(name)||referencesBracedEnvVar(value,name))&&names.add(name);return Array.from(names)}function collectNamedRegexCaptures(source){return new Set(Array.from(source.matchAll(/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g),match=>match[1]))}function populateRouteEnv(route,srcSyntax="regex"){let excludedNames=srcSyntax==="regex"&&route.src?collectNamedRegexCaptures(route.src):new Set,routeValues=[...route.dest?[route.dest]:[],...Object.values(route.headers||{})],routeEnv=collectReferencedEnvVars(routeValues,route.env,excludedNames);if(route.env=routeEnv.length>0?routeEnv:void 0,route.transforms)for(let transform of route.transforms){let args=transform.args?Array.isArray(transform.args)?transform.args:[transform.args]:[],names=collectReferencedEnvVars(args,transform.env,excludedNames);transform.env=names.length>0?names:void 0}}async function generateRoute(client,projectId,input,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes/generate${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input)})}function parseTransforms(values,type,op){return values.map(value=>parseTransform(value,type,op))}function parseTransform(input,type,op){if(op==="delete"){let key2=input.trim();if(!key2)throw new Error("Delete operation requires a key");return{type,op,target:{key:key2}}}let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),args=input.slice(eqIndex+1);if(!key)throw new Error("Transform key cannot be empty");return{type,op,target:{key},args}}function collectTransforms(flags){let transforms=[];return flags.setResponseHeader&&transforms.push(...parseTransforms(flags.setResponseHeader,"response.headers","set")),flags.appendResponseHeader&&transforms.push(...parseTransforms(flags.appendResponseHeader,"response.headers","append")),flags.deleteResponseHeader&&transforms.push(...parseTransforms(flags.deleteResponseHeader,"response.headers","delete")),flags.setRequestHeader&&transforms.push(...parseTransforms(flags.setRequestHeader,"request.headers","set")),flags.appendRequestHeader&&transforms.push(...parseTransforms(flags.appendRequestHeader,"request.headers","append")),flags.deleteRequestHeader&&transforms.push(...parseTransforms(flags.deleteRequestHeader,"request.headers","delete")),flags.setRequestQuery&&transforms.push(...parseTransforms(flags.setRequestQuery,"request.query","set")),flags.appendRequestQuery&&transforms.push(...parseTransforms(flags.appendRequestQuery,"request.query","append")),flags.deleteRequestQuery&&transforms.push(...parseTransforms(flags.deleteRequestQuery,"request.query","delete")),transforms}function collectResponseHeaders(setHeaders){let headers={};for(let input of setHeaders){let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid header format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),value=input.slice(eqIndex+1);if(!key)throw new Error("Header key cannot be empty");headers[key]=value}return headers}var MAX_NAME_LENGTH=256,MAX_DESCRIPTION_LENGTH=1024,MAX_CONDITIONS=16,VALID_SYNTAXES=["regex","path-to-regexp","equals"],REDIRECT_STATUS_CODES=[301,302,303,307,308],VALID_ACTION_TYPES=["rewrite","redirect","set-status"],ALL_ACTION_CHOICES=[{name:"Rewrite",value:"rewrite",exclusive:!0},{name:"Redirect",value:"redirect",exclusive:!0},{name:"Set Status Code",value:"set-status",exclusive:!0},{name:"Response Headers",value:"response-headers"},{name:"Request Headers",value:"request-headers"},{name:"Request Query",value:"request-query"}];function stripQuotes(str){return str.startsWith('"')&&str.endsWith('"')&&str.length>=2||str.startsWith("'")&&str.endsWith("'")&&str.length>=2?str.slice(1,-1):str}function extractTransformFlags(flags){return{setResponseHeader:flags["--set-response-header"],appendResponseHeader:flags["--append-response-header"],deleteResponseHeader:flags["--delete-response-header"],setRequestHeader:flags["--set-request-header"],appendRequestHeader:flags["--append-request-header"],deleteRequestHeader:flags["--delete-request-header"],setRequestQuery:flags["--set-request-query"],appendRequestQuery:flags["--append-request-query"],deleteRequestQuery:flags["--delete-request-query"]}}function collectHeadersAndTransforms(transformFlags){let headers=transformFlags.setResponseHeader?collectResponseHeaders(transformFlags.setResponseHeader):{},transforms=collectTransforms({...transformFlags,setResponseHeader:void 0});return{headers,transforms}}function hasAnyTransformFlags(flags){let tf=extractTransformFlags(flags);return!!(tf.setResponseHeader||tf.appendResponseHeader||tf.deleteResponseHeader||tf.setRequestHeader||tf.appendRequestHeader||tf.deleteRequestHeader||tf.setRequestQuery||tf.appendRequestQuery||tf.deleteRequestQuery)}function validateActionFlags(action,dest,status){if(!action)return dest||status!==void 0?"--action is required when using --dest or --status. Use --action rewrite, --action redirect, or --action set-status.":null;if(!VALID_ACTION_TYPES.includes(action))return`Invalid action type: "${action}". Valid types: ${VALID_ACTION_TYPES.join(", ")}`;switch(action){case"rewrite":if(!dest)return"--action rewrite requires --dest.";if(status!==void 0)return"--action rewrite does not accept --status.";break;case"redirect":if(!dest)return"--action redirect requires --dest.";if(status===void 0)return`--action redirect requires --status (${REDIRECT_STATUS_CODES.join(", ")}).`;if(!REDIRECT_STATUS_CODES.includes(status))return`Invalid redirect status: ${status}. Must be one of: ${REDIRECT_STATUS_CODES.join(", ")}`;break;case"set-status":if(dest)return"--action set-status does not accept --dest.";if(status===void 0)return"--action set-status requires --status.";if(status<100||status>599)return"Status code must be between 100 and 599.";break}return null}async function collectActionDetails(client,actionType,flags){switch(actionType){case"rewrite":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"});Object.assign(flags,{"--dest":dest});break}case"redirect":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"}),status=await client.input.select({message:"Status code:",choices:[{name:"307 - Temporary Redirect",value:307},{name:"308 - Permanent Redirect",value:308},{name:"301 - Moved Permanently",value:301},{name:"302 - Found",value:302},{name:"303 - See Other",value:303}]});Object.assign(flags,{"--dest":dest,"--status":status});break}case"set-status":{let statusCode=await client.input.text({message:"HTTP status code:",validate:val=>{let num=parseInt(val,10);return isNaN(num)||num<100||num>599?"Status code must be between 100 and 599":!0}});Object.assign(flags,{"--status":parseInt(statusCode,10)});break}case"response-headers":{await collectInteractiveHeaders(client,"response",flags);break}case"request-headers":{await collectInteractiveHeaders(client,"request-header",flags);break}case"request-query":{await collectInteractiveHeaders(client,"request-query",flags);break}}}async function collectInteractiveConditions(client,flags){let addMore=!0;for(;addMore;){let currentHas=flags["--has"]||[],currentMissing=flags["--missing"]||[];if(currentHas.length>0||currentMissing.length>0){output_manager_default.log(`
8
8
  Current conditions:`);for(let c of currentHas)output_manager_default.print(` has: ${c}
9
9
  `);for(let c of currentMissing)output_manager_default.print(` does not have: ${c}
10
10
  `);output_manager_default.print(`
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{environmentOption,formatOption,jsonOption,projectOption}from"./chunk-ODB7LEAO.js";import{packageName}from"./chunk-JESNVRVR.js";var RULE_ENVIRONMENTS=["any","preview","production"],ruleEnvironmentOption={...environmentOption,description:"Environment the rule applies to (required): production, preview, or any"},lsSubcommand={name:"ls",aliases:["list"],description:"List the Vercel tracing sampling rules for a project",arguments:[],options:[formatOption,jsonOption,projectOption],examples:[{name:"List the sampling rules for the linked project",value:`${packageName} traces config ls`},{name:"List the sampling rules as JSON",value:`${packageName} traces config ls --json`}]},setSubcommand={name:"set",aliases:[],description:"Enable Vercel tracing and add or replace one sampling rule. The rate is a whole percentage from 1 to 100.",arguments:[{name:"rate",required:!0},{name:"requestPath",required:!1}],options:[ruleEnvironmentOption,formatOption,jsonOption,projectOption],examples:[{name:"Trace a quarter of production traffic",value:`${packageName} traces config set 25 --environment production`},{name:"Trace every preview request to one path prefix",value:`${packageName} traces config set 100 /api --environment preview`},{name:"Trace one percent of traffic in every environment",value:`${packageName} traces config set 1 --environment any`}]},rmSubcommand={name:"remove",aliases:["rm","delete"],description:"Remove Vercel tracing sampling rules. Without a path prefix, every rule for the environment is removed. Removing the final rule disables tracing.",arguments:[{name:"requestPath",required:!1}],options:[ruleEnvironmentOption,{name:"default",shorthand:null,type:Boolean,deprecated:!1,description:"Remove only the rule that has no path prefix, keeping the per-path rules"},formatOption,jsonOption,projectOption],examples:[{name:"Remove one rule by environment and path prefix",value:`${packageName} traces config remove /api --environment production`},{name:"Remove every rule for production",value:`${packageName} traces config remove --environment production`},{name:"Remove only the production rule that covers all paths",value:`${packageName} traces config remove --environment production --default`}]},tracesConfigCommand={name:"config",aliases:[],description:"Manage Vercel tracing sampling rules for a project.",arguments:[],subcommands:[lsSubcommand,setSubcommand,rmSubcommand],options:[],examples:[{name:"List the sampling rules for the linked project",value:`${packageName} traces config ls`},{name:"Trace a quarter of production traffic",value:`${packageName} traces config set 25 --environment production`},{name:"Remove every rule for production",value:`${packageName} traces config remove --environment production`}]};export{RULE_ENVIRONMENTS,lsSubcommand,setSubcommand,rmSubcommand,tracesConfigCommand};
7
+ import{environmentOption,formatOption,jsonOption,projectOption}from"./chunk-64XCYUH7.js";import{packageName}from"./chunk-JESNVRVR.js";var RULE_ENVIRONMENTS=["any","preview","production"],ruleEnvironmentOption={...environmentOption,description:"Environment the rule applies to (required): production, preview, or any"},lsSubcommand={name:"ls",aliases:["list"],description:"List the Vercel tracing sampling rules for a project",arguments:[],options:[formatOption,jsonOption,projectOption],examples:[{name:"List the sampling rules for the linked project",value:`${packageName} traces config ls`},{name:"List the sampling rules as JSON",value:`${packageName} traces config ls --json`}]},setSubcommand={name:"set",aliases:[],description:"Enable Vercel tracing and add or replace one sampling rule. The rate is a whole percentage from 1 to 100.",arguments:[{name:"rate",required:!0},{name:"requestPath",required:!1}],options:[ruleEnvironmentOption,formatOption,jsonOption,projectOption],examples:[{name:"Trace a quarter of production traffic",value:`${packageName} traces config set 25 --environment production`},{name:"Trace every preview request to one path prefix",value:`${packageName} traces config set 100 /api --environment preview`},{name:"Trace one percent of traffic in every environment",value:`${packageName} traces config set 1 --environment any`}]},rmSubcommand={name:"remove",aliases:["rm","delete"],description:"Remove Vercel tracing sampling rules. Without a path prefix, every rule for the environment is removed. Removing the final rule disables tracing.",arguments:[{name:"requestPath",required:!1}],options:[ruleEnvironmentOption,{name:"default",shorthand:null,type:Boolean,deprecated:!1,description:"Remove only the rule that has no path prefix, keeping the per-path rules"},formatOption,jsonOption,projectOption],examples:[{name:"Remove one rule by environment and path prefix",value:`${packageName} traces config remove /api --environment production`},{name:"Remove every rule for production",value:`${packageName} traces config remove --environment production`},{name:"Remove only the production rule that covers all paths",value:`${packageName} traces config remove --environment production --default`}]},tracesConfigCommand={name:"config",aliases:[],description:"Manage Vercel tracing sampling rules for a project.",arguments:[],subcommands:[lsSubcommand,setSubcommand,rmSubcommand],options:[],examples:[{name:"List the sampling rules for the linked project",value:`${packageName} traces config ls`},{name:"Trace a quarter of production traffic",value:`${packageName} traces config set 25 --environment production`},{name:"Remove every rule for production",value:`${packageName} traces config remove --environment production`}]};export{RULE_ENVIRONMENTS,lsSubcommand,setSubcommand,rmSubcommand,tracesConfigCommand};
@@ -0,0 +1,12 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import{require_dist as require_dist2,validateConfig}from"./chunk-VPH6RJ5P.js";import{readJSONFile}from"./chunk-WFAZDFAR.js";import{compileVercelConfig}from"./chunk-3PMDNDOO.js";import{init_dist,parse,stringify}from"./chunk-U4Z2MMOF.js";import{require_dist2 as require_dist}from"./chunk-CVDK3IYT.js";import{CantParseJSONFile}from"./chunk-6VH56CX2.js";import{require_build_utils}from"./chunk-XP3FT56R.js";import{__toESM}from"./chunk-BZENIQ7N.js";init_dist();var import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename,join as join2}from"path";var import_build_utils=__toESM(require_build_utils(),1);import{join}from"path";function createDetectEntrypoint(projectRoot){return async({workPath,framework})=>{let absWorkPath=(0,import_build_utils.normalizePath)(join(projectRoot,workPath)),builderName;if((0,import_build_utils.isPythonFramework)(framework))builderName="@vercel/python";else if((0,import_build_utils.isNodeBackendFramework)(framework))builderName="@vercel/backends";else if(framework==="go")builderName="@vercel/go";else if(framework==="rust")builderName="@vercel/rust";else return null;let detectEntrypoint=await loadBuilderDetectEntrypoint(builderName,projectRoot);return detectEntrypoint?detectEntrypoint(builderName==="@vercel/python"?{workPath:absWorkPath,framework}:{workPath:absWorkPath}):null}}async function loadBuilderDetectEntrypoint(name,projectRoot){let{importBuilders}=await import("./import-builders-PK2EHZ43.js"),loaded=(await importBuilders(new Set([name]),projectRoot)).get(name);if(!loaded)return;let detect=loaded.builder.detectEntrypoint;return typeof detect=="function"?detect:void 0}function getServicesConfiguration(config){let configuredServices=config?.services??config?.experimentalServicesV2??config?.experimentalServices,configuredServicesType=config?.services?"services":config?.experimentalServicesV2?"experimentalServicesV2":config?.experimentalServices?"experimentalServices":void 0;return{configuredServices,configuredServicesType}}async function loadVercelConfig(cwd){try{let{configPath}=await compileVercelConfig(cwd);if(!configPath)return null;let config=await readJSONFile(configPath);return config instanceof Error?null:config}catch{return null}}function isServicesEnvEnabled(){let value=process.env.VERCEL_USE_EXPERIMENTAL_SERVICES;return value==="1"||value?.toLowerCase()==="true"}async function isExperimentalServicesEnabled(cwd){let{configuredServices}=getServicesConfiguration(await loadVercelConfig(cwd));return isServicesEnvEnabled()||configuredServices!==void 0}async function tryDetectServices(cwd,config){config===void 0&&(config=await loadVercelConfig(cwd));let configuration=getServicesConfiguration(config);if(!isServicesEnvEnabled()&&!configuration.configuredServices)return null;let fs=new import_fs_detectors.LocalFileSystemDetector(cwd),result=await(0,import_service_topology.detectServices)({fs,configuredServices:configuration.configuredServices,configuredServicesType:configuration.configuredServicesType,detectEntrypoint:createDetectEntrypoint(cwd)});return result.errors.some(e=>e.code==="NO_SERVICES_CONFIGURED")?null:result}async function writeServicesConfig(cwd,config){let prepared=await prepareServicesConfigWrite(cwd,config);return await writeFile(prepared.configPath,prepared.content,"utf8"),{configFileName:basename(prepared.configPath)}}async function getServicesConfigWriteBlocker(cwd,config){try{return await prepareServicesConfigWrite(cwd,config),null}catch(error){return getServicesConfigWriteBlockerFromError(error)}}function toProjectServicesConfigPatch(config){let services={};for(let[name,svc]of Object.entries(config)){let buildCommand=svc.preDeployCommand&&svc.buildCommand?`${svc.buildCommand} && ${svc.preDeployCommand}`:svc.preDeployCommand||svc.buildCommand;services[name]={root:svc.root,...svc.framework?{framework:svc.framework}:{},...svc.entrypoint?{entrypoint:svc.entrypoint}:{},...buildCommand?{buildCommand}:{}}}let rewrites=(0,import_service_topology.generateServiceRewrites)(config);return{services,...rewrites.length>0?{rewrites}:{}}}async function prepareServicesConfigWrite(cwd,config){let compileResult=await compileVercelConfig(cwd),configPath=join2(cwd,"vercel.json");if(compileResult.sourceFile==="vercel.toml")return prepareTomlServicesConfigWrite(join2(cwd,"vercel.toml"),config);if(compileResult.wasCompiled)throw new Error(`Cannot automatically update ${compileResult.sourceFile??"the current Vercel config"}.`);let existingConfig={};if(compileResult.configPath&&basename(compileResult.configPath)==="vercel.json"){let result=await readJSONFile(configPath);if(result instanceof CantParseJSONFile)throw result;existingConfig=result??{}}let patch=toProjectServicesConfigPatch(config),nextConfig={...existingConfig,...patch,...patch.rewrites?{rewrites:[...existingConfig.rewrites??[],...patch.rewrites]}:{}},validationError=validateConfig(nextConfig);if(validationError)throw validationError;return{configPath,content:JSON.stringify(nextConfig,null,2)+`
8
+ `}}async function prepareTomlServicesConfigWrite(configPath,config){let patch=toProjectServicesConfigPatch(config),patchKeys=Object.keys(patch),existingContent;try{existingContent=await readFile(configPath,"utf8")}catch{existingContent=""}if(existingContent.trim()){let existingParsed=parse(existingContent),overlapping=patchKeys.filter(key=>key in existingParsed);if(overlapping.length>0){let plural=overlapping.length>1,keyList=overlapping.map(k=>`"${k}"`).join(", ");throw new Error(`Cannot automatically update vercel.toml: key${plural?"s":""} ${keyList} already exist${plural?"":"s"}.`)}}let patchToml=stringify(patch),content=existingContent.trim()?existingContent.trimEnd()+`
9
+
10
+ `+patchToml+`
11
+ `:patchToml+`
12
+ `;return{configPath,content}}function getServicesConfigWriteBlockerFromError(error){switch(error?.code){case"EXPERIMENTAL_SERVICES_AND_BUILDS":case"SERVICES_AND_BUILDS":return"builds";case"EXPERIMENTAL_SERVICES_AND_FUNCTIONS":case"SERVICES_AND_FUNCTIONS":return"functions";default:return null}}export{createDetectEntrypoint,loadVercelConfig,isExperimentalServicesEnabled,tryDetectServices,writeServicesConfig,getServicesConfigWriteBlocker};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ function isGuidanceEnabled(client,explicit,defaultValue){return explicit!==void 0?explicit:process.env.VERCEL_GUIDANCE_DISABLED?!1:client.config.guidance?.enabled??defaultValue}export{isGuidanceEnabled};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import{AGENT_REASON,AGENT_STATUS,shouldEmitNonInteractiveCommandError,writeAgentError}from"./chunk-GENXRXFN.js";import{output_manager_default}from"./chunk-XP3FT56R.js";function getRenamedOption(flags,name,oldName,{json=!1}={}){let value=flags[name],oldValue=flags[oldName];if(value!==void 0&&oldValue!==void 0)return{error:`Can't use ${name} with ${oldName}.`};if(value!==void 0&&value.trim()==="")return{error:`${name} can't be empty.`};if(oldValue===void 0)return{value};let message=`${oldName} is deprecated. Use ${name}.`;return json?{value:oldValue,warning:{reason:AGENT_REASON.DEPRECATED,message}}:(output_manager_default.warning(message),{value:oldValue})}function reportRenamedOptionError(client,message,{json=!1}={}){return json||shouldEmitNonInteractiveCommandError(client)?writeAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.INVALID_ARGUMENTS,message}):output_manager_default.error(message),2}function renameOptionInArgs(args,oldName,name){let end=args.indexOf("--");return args.map((arg,index)=>(end===-1||index<end)&&(arg===oldName||arg.startsWith(`${oldName}=`))?`${name}${arg.slice(oldName.length)}`:arg)}export{getRenamedOption,reportRenamedOptionError,renameOptionInArgs};