@vercel/cli-support 65.14.0 → 65.15.0-snapshot-ff25f3f66933

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 (237) hide show
  1. package/dist/chunks/add-63SUIZGX.js +8 -0
  2. package/dist/chunks/add-FTVNBJLV.js +8 -0
  3. package/dist/chunks/add-JJOY2UAF.js +8 -0
  4. package/dist/chunks/alerts-SNR4JKOI.js +8 -0
  5. package/dist/chunks/build-LM2L5H7D.js +7 -0
  6. package/dist/chunks/{chunk-OX5KSZFU.js → chunk-26HI5UUO.js} +1 -1
  7. package/dist/chunks/{chunk-2SVS5PWL.js → chunk-2B6WUOVU.js} +1 -1
  8. package/dist/chunks/{chunk-NR2JDEYD.js → chunk-2ONWHJT5.js} +1 -1
  9. package/dist/chunks/{chunk-4JPTCTBV.js → chunk-3BMYPWEY.js} +1 -1
  10. package/dist/chunks/{chunk-HNLLL52N.js → chunk-3VENFXBY.js} +1 -1
  11. package/dist/chunks/{chunk-QU4WGUNK.js → chunk-44XWDKGK.js} +1 -1
  12. package/dist/chunks/{chunk-RD45QAHF.js → chunk-4A2IRNN5.js} +1 -1
  13. package/dist/chunks/chunk-4KM7OKNQ.js +7 -0
  14. package/dist/chunks/{chunk-QEMYZTK7.js → chunk-4XH7ID62.js} +1 -1
  15. package/dist/chunks/{chunk-SJU4QJVF.js → chunk-5K4JQIXT.js} +1 -1
  16. package/dist/chunks/{chunk-A5UV4EAX.js → chunk-5NI34DGB.js} +1 -1
  17. package/dist/chunks/{chunk-MVOMOVK3.js → chunk-5OQL545S.js} +1 -1
  18. package/dist/chunks/{chunk-D4URLIDE.js → chunk-63FDIHG6.js} +1 -1
  19. package/dist/chunks/{chunk-NNHPXHOT.js → chunk-AMPA7GJJ.js} +1 -1
  20. package/dist/chunks/{chunk-7DT2GH67.js → chunk-AWS3XIC5.js} +1 -1
  21. package/dist/chunks/{chunk-UKBMDOUD.js → chunk-BTFAU5KV.js} +1 -1
  22. package/dist/chunks/chunk-BVIHERDQ.js +10 -0
  23. package/dist/chunks/{chunk-ZRHHEWGW.js → chunk-BVUPKUQX.js} +1 -1
  24. package/dist/chunks/{chunk-V4AZABH6.js → chunk-C5X4AET5.js} +1 -1
  25. package/dist/chunks/{chunk-6CHTRMWQ.js → chunk-C65YPDYZ.js} +1 -1
  26. package/dist/chunks/{chunk-2CMY3JXZ.js → chunk-CINU5WXR.js} +1 -1
  27. package/dist/chunks/{chunk-IWFB7TGB.js → chunk-DNBYNPEQ.js} +1 -1
  28. package/dist/chunks/{chunk-PURYFV4L.js → chunk-EZH3HTOS.js} +1 -1
  29. package/dist/chunks/{chunk-B7SLQSME.js → chunk-F4H6YJ3W.js} +1 -1
  30. package/dist/chunks/{chunk-6FP3V45O.js → chunk-FJTPVWDH.js} +1 -1
  31. package/dist/chunks/{chunk-VTM6RPYS.js → chunk-GD2G4YPE.js} +1 -1
  32. package/dist/chunks/{chunk-76FG2WPQ.js → chunk-GEXD62LF.js} +2 -2
  33. package/dist/chunks/chunk-GK445CTM.js +7 -0
  34. package/dist/chunks/{chunk-E3E7SPFO.js → chunk-GRH3TN3C.js} +1 -1
  35. package/dist/chunks/{chunk-AAD3PR73.js → chunk-HVNHF4YT.js} +1 -1
  36. package/dist/chunks/{chunk-LRBJZNET.js → chunk-I3B46CJP.js} +1 -1
  37. package/dist/chunks/{chunk-QUAIU6FH.js → chunk-I4TWSNQG.js} +1 -1
  38. package/dist/chunks/{chunk-QTTJMXKJ.js → chunk-IGIZBS6R.js} +1 -1
  39. package/dist/chunks/{chunk-FT5IZURV.js → chunk-JNWDS5I5.js} +1 -1
  40. package/dist/chunks/{chunk-BJBJYWAJ.js → chunk-KCLAUWOE.js} +1 -1
  41. package/dist/chunks/{chunk-ZP36CA3U.js → chunk-KLS5OROC.js} +1 -1
  42. package/dist/chunks/chunk-KPDAYSQS.js +10 -0
  43. package/dist/chunks/{chunk-JR3732RL.js → chunk-LJQ6I5U7.js} +1 -1
  44. package/dist/chunks/chunk-LOA7SZWH.js +7 -0
  45. package/dist/chunks/{chunk-E7T3YJRB.js → chunk-LPZDMWAU.js} +1 -1
  46. package/dist/chunks/chunk-LRCAUAEX.js +7 -0
  47. package/dist/chunks/{chunk-WKFLDUTU.js → chunk-M54QGGZY.js} +1 -1
  48. package/dist/chunks/{chunk-MBEYI5HF.js → chunk-MDXQPPAD.js} +1 -1
  49. package/dist/chunks/{chunk-Y6PC5E6Y.js → chunk-NA2URAJP.js} +1 -1
  50. package/dist/chunks/{chunk-N56EMHCO.js → chunk-NA5CGEQQ.js} +1 -1
  51. package/dist/chunks/{chunk-P3JKE7TX.js → chunk-P2DZUXJE.js} +1 -1
  52. package/dist/chunks/{chunk-RJJYX4RA.js → chunk-PM2B26M3.js} +1 -1
  53. package/dist/chunks/{chunk-WE5MHW2O.js → chunk-PTSMCYMO.js} +1 -1
  54. package/dist/chunks/chunk-PV6L7L3M.js +10 -0
  55. package/dist/chunks/{chunk-TEHLABJO.js → chunk-QNOF7F4W.js} +1 -1
  56. package/dist/chunks/chunk-RWPWNYXQ.js +11 -0
  57. package/dist/chunks/{chunk-ZZTIGQXP.js → chunk-TR3VJOOL.js} +1 -1
  58. package/dist/chunks/{chunk-WFH24UO3.js → chunk-UDYXJAKZ.js} +1 -1
  59. package/dist/chunks/{chunk-SAPTIA7Q.js → chunk-UMGS2S22.js} +1 -1
  60. package/dist/chunks/{chunk-25W3CLDF.js → chunk-VMYOYDLM.js} +1 -1
  61. package/dist/chunks/{chunk-BSCJRQ3E.js → chunk-VYR72PE3.js} +1 -1
  62. package/dist/chunks/chunk-W45KFKUW.js +7 -0
  63. package/dist/chunks/{chunk-4L6SITE4.js → chunk-WTCPCQO3.js} +1 -1
  64. package/dist/chunks/{chunk-TF5BOGQN.js → chunk-XNJGNXLC.js} +1 -1
  65. package/dist/chunks/{chunk-WAWNYFSK.js → chunk-XRIGLBI2.js} +1 -1
  66. package/dist/chunks/chunk-XYUCYNGO.js +12 -0
  67. package/dist/chunks/chunk-YE245S4O.js +7 -0
  68. package/dist/chunks/{chunk-5OOWE5CD.js → chunk-YWUDUQVB.js} +1 -1
  69. package/dist/chunks/{chunk-DMPPORR6.js → chunk-YZFIUGQU.js} +2 -2
  70. package/dist/chunks/{chunk-HWUQVJIJ.js → chunk-ZBCSM7TZ.js} +1 -1
  71. package/dist/chunks/{chunk-HDUZSFTK.js → chunk-ZHAPKFVM.js} +8 -8
  72. package/dist/chunks/{chunk-22FAXGPD.js → chunk-ZMDXQDUX.js} +1 -1
  73. package/dist/chunks/chunk-ZZMEF6YW.js +9 -0
  74. package/dist/chunks/clear-RH4DFMFS.js +8 -0
  75. package/dist/chunks/compile-vercel-config-5I2XTLGA.js +7 -0
  76. package/dist/chunks/config-7NAK6ELR.js +8 -0
  77. package/dist/chunks/{config-XH62NJX7.js → config-S7D5SXXX.js} +1 -1
  78. package/dist/chunks/contract-EOQS4PUF.js +11 -0
  79. package/dist/chunks/delete-BW3US2B4.js +9 -0
  80. package/dist/chunks/delete-IXPXDUKM.js +10 -0
  81. package/dist/chunks/{describe-RNFQJQD5.js → describe-CLIYKTIO.js} +1 -1
  82. package/dist/chunks/detect-services-H2CSYD7K.js +7 -0
  83. package/dist/chunks/disable-4CQ364WX.js +7 -0
  84. package/dist/chunks/discard-GM6F2QEE.js +14 -0
  85. package/dist/chunks/edit-CFBF2DHX.js +8 -0
  86. package/dist/chunks/edit-JWZ7JHNG.js +9 -0
  87. package/dist/chunks/enable-POFTCHC3.js +7 -0
  88. package/dist/chunks/{export-TVJDXCZA.js → export-2RBXGWD2.js} +1 -1
  89. package/dist/chunks/future-KRTXP2NN.js +7 -0
  90. package/dist/chunks/generate-cert-for-deploy-XWDWUVOJ.js +7 -0
  91. package/dist/chunks/{image-NFARXO3R.js → image-ZNOJ5BHX.js} +1 -1
  92. package/dist/chunks/import-builders-INOS2CRI.js +7 -0
  93. package/dist/chunks/{inspect-H6LSGCYS.js → inspect-3SYISED5.js} +1 -1
  94. package/dist/chunks/inspect-7Z6NAOEA.js +13 -0
  95. package/dist/chunks/{inspect-RMP4AAQR.js → inspect-BX6N5NGY.js} +1 -1
  96. package/dist/chunks/inspect-PMF2QQNR.js +9 -0
  97. package/dist/chunks/inspect-XWAWYTTM.js +8 -0
  98. package/dist/chunks/{inspect-4RQLEUGZ.js → inspect-Y6B3I7VS.js} +1 -1
  99. package/dist/chunks/{list-6SRUT2BU.js → list-6BM2FFXL.js} +1 -1
  100. package/dist/chunks/list-I33FSRK2.js +8 -0
  101. package/dist/chunks/list-UHGKMLS7.js +12 -0
  102. package/dist/chunks/{list-WEGUICE6.js → list-YB4SK7JQ.js} +1 -1
  103. package/dist/chunks/login-COGUODSF.js +9 -0
  104. package/dist/chunks/{purchase-domain-if-available-66DVKBZ5.js → login-V7NNX7G5.js} +1 -1
  105. package/dist/chunks/logs-6YKT7CLQ.js +7 -0
  106. package/dist/chunks/{ls-PTRVCVXJ.js → ls-GIPBHSUE.js} +1 -1
  107. package/dist/chunks/{ls-7JX4KZXU.js → ls-OPHCNF47.js} +1 -1
  108. package/dist/chunks/{ls-YC4IWYN7.js → ls-S2FS2RJL.js} +1 -1
  109. package/dist/chunks/ls-SSPPCRZA.js +11 -0
  110. package/dist/chunks/{ls-CKOBQXUR.js → ls-Y6RU35DL.js} +1 -1
  111. package/dist/chunks/{ls-7Z5WT5OK.js → ls-YL7CECSE.js} +1 -1
  112. package/dist/chunks/ls-YVI4FS34.js +8 -0
  113. package/dist/chunks/migrate-experimental-services-HHEYJ3EC.js +7 -0
  114. package/dist/chunks/mutate-ZAEQRAJ2.js +9 -0
  115. package/dist/chunks/{notifications-BTVI6EIG.js → notifications-QLQMKDQE.js} +1 -1
  116. package/dist/chunks/open-Y6RMPEQW.js +7 -0
  117. package/dist/chunks/{permissions-JGQHHLCP.js → permissions-MWO4CAST.js} +1 -1
  118. package/dist/chunks/{plugin-offer-OQF2T2HP.js → plugin-offer-F7345TVV.js} +1 -1
  119. package/dist/chunks/prompt-missing-credentials-HMZJOZXY.js +7 -0
  120. package/dist/chunks/publish-5NZFNIHX.js +15 -0
  121. package/dist/chunks/pull-WVZPWJ5E.js +7 -0
  122. package/dist/chunks/purchase-domain-if-available-7NYSS4PT.js +7 -0
  123. package/dist/chunks/push-5KDOQ2KV.js +7 -0
  124. package/dist/chunks/{query-XKNAII7Y.js → query-IMYCCJ7D.js} +1 -1
  125. package/dist/chunks/reauthenticate-KGWNCD4L.js +7 -0
  126. package/dist/chunks/remove-TULHNFGP.js +9 -0
  127. package/dist/chunks/reorder-BD4O4IHH.js +10 -0
  128. package/dist/chunks/reply-DGXOGKDS.js +9 -0
  129. package/dist/chunks/resolve-67YIJ2JQ.js +12 -0
  130. package/dist/chunks/resolve-agent-team-LEWHIJGT.js +7 -0
  131. package/dist/chunks/restore-Z7QQ7FTO.js +16 -0
  132. package/dist/chunks/rm-HTNTY7A7.js +8 -0
  133. package/dist/chunks/rm-MDLFUMTM.js +8 -0
  134. package/dist/chunks/rm-RYJR3Z6Z.js +8 -0
  135. package/dist/chunks/rm-WGTRKNYK.js +8 -0
  136. package/dist/chunks/rm-XADFVFRB.js +8 -0
  137. package/dist/chunks/rule-inspect-TINSZNWB.js +8 -0
  138. package/dist/chunks/{schema-DULOJDLJ.js → schema-32WJMSPO.js} +1 -1
  139. package/dist/chunks/schema-QWMFAIG7.js +14 -0
  140. package/dist/chunks/select-org-MK2XRB5D.js +7 -0
  141. package/dist/chunks/set-B5MARIVL.js +7 -0
  142. package/dist/chunks/set-MMPBGIWR.js +8 -0
  143. package/dist/chunks/setup-and-link-DRFJTYTX.js +7 -0
  144. package/dist/chunks/{tags-FHC6EMQ2.js → tags-CRCAU65V.js} +1 -1
  145. package/dist/chunks/{update-S6EDQLRE.js → update-VVHV2M46.js} +1 -1
  146. package/dist/chunks/usage-OXA6T6IL.js +13 -0
  147. package/dist/chunks/{validate-config-YBBR32MV.js → validate-config-QBDSJCTR.js} +1 -1
  148. package/dist/commands/build/index.js +1 -1
  149. package/dist/commands/deploy/index.js +4 -4
  150. package/dist/commands/dev/index.js +2 -2
  151. package/dist/commands/env/index.js +1 -1
  152. package/dist/commands/link/index.js +1 -1
  153. package/dist/commands/list/index.js +1 -1
  154. package/dist/commands/project/index.js +1 -1
  155. package/dist/commands/tunnel/index.js +1 -1
  156. package/dist/commands-account.js +37 -39
  157. package/dist/commands-ai.js +3 -3
  158. package/dist/commands-blob.js +2 -2
  159. package/dist/commands-core.js +58 -44
  160. package/dist/commands-deployments.js +1 -1
  161. package/dist/commands-flags.js +1 -1
  162. package/dist/commands-integrations.js +30 -17
  163. package/dist/commands-observability.js +8 -7
  164. package/dist/commands-routing.js +44 -27
  165. package/dist/help.js +1 -1
  166. package/dist/index.js +4 -4
  167. package/dist/internal-build.js +1 -1
  168. package/dist/package.json +11 -11
  169. package/dist/root-help-commands.mjs +1 -1
  170. package/dist/version.mjs +1 -1
  171. package/package.json +16 -16
  172. package/dist/chunks/add-BYNKYST2.js +0 -8
  173. package/dist/chunks/add-HXK3HUQG.js +0 -8
  174. package/dist/chunks/add-WTK2AFMX.js +0 -8
  175. package/dist/chunks/alerts-XAOLRZK3.js +0 -8
  176. package/dist/chunks/build-BXCATM4H.js +0 -7
  177. package/dist/chunks/chunk-5YLKPSZI.js +0 -7
  178. package/dist/chunks/chunk-623OWG6A.js +0 -7
  179. package/dist/chunks/chunk-EWHM5VFZ.js +0 -10
  180. package/dist/chunks/chunk-JLURS22G.js +0 -7
  181. package/dist/chunks/chunk-K5Z2NE3P.js +0 -7
  182. package/dist/chunks/chunk-KHXWKYEZ.js +0 -10
  183. package/dist/chunks/chunk-LGN3TASP.js +0 -7
  184. package/dist/chunks/chunk-MGFM2KHC.js +0 -11
  185. package/dist/chunks/chunk-PLGG2AWX.js +0 -10
  186. package/dist/chunks/chunk-TPKFVYL5.js +0 -12
  187. package/dist/chunks/clear-IVHCV4EA.js +0 -8
  188. package/dist/chunks/compile-vercel-config-PYYVTC3B.js +0 -7
  189. package/dist/chunks/config-JUMF25FF.js +0 -8
  190. package/dist/chunks/contract-BLBTK32L.js +0 -10
  191. package/dist/chunks/delete-6FYWPVDH.js +0 -9
  192. package/dist/chunks/delete-PVH4423M.js +0 -10
  193. package/dist/chunks/detect-services-25NRRPII.js +0 -7
  194. package/dist/chunks/disable-HOKABZ7L.js +0 -7
  195. package/dist/chunks/discard-TLBZGTGN.js +0 -14
  196. package/dist/chunks/edit-HSJ4FSZQ.js +0 -8
  197. package/dist/chunks/edit-NNIE7NNF.js +0 -9
  198. package/dist/chunks/enable-TY6QUZWZ.js +0 -7
  199. package/dist/chunks/future-OELW62EE.js +0 -7
  200. package/dist/chunks/generate-cert-for-deploy-HBBZE5NA.js +0 -7
  201. package/dist/chunks/import-builders-ZEJEFXAX.js +0 -7
  202. package/dist/chunks/inspect-HXE2UT6Z.js +0 -8
  203. package/dist/chunks/inspect-OCHE3DVA.js +0 -13
  204. package/dist/chunks/inspect-UTYZYPSK.js +0 -9
  205. package/dist/chunks/list-YYHMAGMG.js +0 -8
  206. package/dist/chunks/list-ZXY2AMNN.js +0 -12
  207. package/dist/chunks/login-DBKNZ6RP.js +0 -7
  208. package/dist/chunks/login-XNS4A4L7.js +0 -9
  209. package/dist/chunks/logs-F7AR7Y5S.js +0 -7
  210. package/dist/chunks/ls-GGIZNTY4.js +0 -11
  211. package/dist/chunks/ls-ISBLA37G.js +0 -8
  212. package/dist/chunks/migrate-experimental-services-XHPJAZFK.js +0 -7
  213. package/dist/chunks/mutate-AQGXSJED.js +0 -9
  214. package/dist/chunks/open-TZLOIAGJ.js +0 -7
  215. package/dist/chunks/prompt-missing-credentials-ATEAZE3Q.js +0 -7
  216. package/dist/chunks/publish-E2QCYVQM.js +0 -15
  217. package/dist/chunks/pull-YEEZTBZB.js +0 -7
  218. package/dist/chunks/push-WT2R2MH2.js +0 -7
  219. package/dist/chunks/reauthenticate-JONKFLTL.js +0 -7
  220. package/dist/chunks/remove-PLSYF2ZB.js +0 -9
  221. package/dist/chunks/reorder-4UCOO5AJ.js +0 -10
  222. package/dist/chunks/reply-B2OCHHMQ.js +0 -9
  223. package/dist/chunks/resolve-PU5UR7JC.js +0 -12
  224. package/dist/chunks/resolve-agent-team-FFV2K42Z.js +0 -7
  225. package/dist/chunks/restore-7AWVT7RT.js +0 -16
  226. package/dist/chunks/rm-523X3JI3.js +0 -8
  227. package/dist/chunks/rm-DTGRJLGC.js +0 -8
  228. package/dist/chunks/rm-GHF2AEO6.js +0 -8
  229. package/dist/chunks/rm-GVFFKCYP.js +0 -8
  230. package/dist/chunks/rm-QXPFFK7Z.js +0 -8
  231. package/dist/chunks/rule-inspect-N3B2737B.js +0 -8
  232. package/dist/chunks/schema-KZ3NXHDV.js +0 -14
  233. package/dist/chunks/select-org-RK3NJUXQ.js +0 -7
  234. package/dist/chunks/set-CYNAACFX.js +0 -7
  235. package/dist/chunks/set-UDHZOYCP.js +0 -8
  236. package/dist/chunks/setup-and-link-BUARMJER.js +0 -7
  237. package/dist/chunks/usage-OZY35PJU.js +0 -13
@@ -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{require_cjs}from"./chunk-QUAIU6FH.js";import{CONTACT_FIELDS,billingFieldsUsed,collectContactInformation,getBillingContact,getDomainPrice,getDomainStatus,isPurchasedSince,mergeContact,missingContactFields,purchaseDomain,readContactFlags}from"./chunk-SJU4QJVF.js";import{amountMatchesPrice,canPromptForCharge,chargeFailureReason,chargeFlagWithValue,formatAmountArg,formatTerm,orderStatusStep,parseAmount,parseOrderWait,printChargeRecovery,refuseUnnamedTeam,reportChargeFailure,reportOrderPending,reportPriceChanged,reportUnknownOutcome,reportUsageError,writeChargeAction}from"./chunk-RJJYX4RA.js";import{formatUsd}from"./chunk-JLURS22G.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import{buySubcommand}from"./chunk-TPKFVYL5.js";import{printError}from"./chunk-ZMT7EYYL.js";import{param}from"./chunk-3G3FQYMW.js";import{getScope}from"./chunk-4JPTCTBV.js";import{TelemetryClient}from"./chunk-KDCODXVL.js";import{AGENT_ACTION,AGENT_REASON,AGENT_STATUS,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-IRNQJ6ZX.js";import{parseArguments}from"./chunk-NHB43235.js";import{validateJsonOutput}from"./chunk-6GKP6VUF.js";import{DomainChargeOutcomeUnknown,DomainPaymentAuthenticationRequired,DomainPriceChanged,DomainPurchaseInProgress,isAPIError}from"./chunk-GOI2VVI7.js";import{getCommandName,getCommandNamePlain}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-AP6DZGTK.js";import{require_dist}from"./chunk-MCYG7CCE.js";import{getFlagsSpecification,getGlobalFlagsFromArgs,quoteArg}from"./chunk-EZVNGJN5.js";import{require_source}from"./chunk-NB2WLB3J.js";import{require_strip_ansi}from"./chunk-BULSRTQE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_strip_ansi=__toESM(require_strip_ansi(),1),import_tldts=__toESM(require_cjs(),1),import_error_utils=__toESM(require_dist(),1);var DomainsBuyTelemetryClient=class extends TelemetryClient{trackCliArgumentDomain(v){v&&this.trackCliArgument({arg:"domain",value:this.redactedValue})}trackCliOptionAmount(v){this.trackRedactedCliOption("amount",v)}trackCliFlagUseBillingDetails(v){v&&this.trackCliFlag("use-billing-details")}trackCliOptionFirstName(v){this.trackRedactedCliOption("first-name",v)}trackCliOptionLastName(v){this.trackRedactedCliOption("last-name",v)}trackCliOptionEmail(v){this.trackRedactedCliOption("email",v)}trackCliOptionPhone(v){this.trackRedactedCliOption("phone",v)}trackCliOptionAddress(v){this.trackRedactedCliOption("address",v)}trackCliOptionCity(v){this.trackRedactedCliOption("city",v)}trackCliOptionState(v){this.trackRedactedCliOption("state",v)}trackCliOptionZip(v){this.trackRedactedCliOption("zip",v)}trackCliOptionCountry(v){this.trackRedactedCliOption("country",v)}trackCliOptionCompany(v){this.trackRedactedCliOption("company",v)}trackCliFlagAutoRenew(v){v&&this.trackCliFlag("auto-renew")}trackCliFlagNoAutoRenew(v){v&&this.trackCliFlag("no-auto-renew")}trackCliFlagJson(v){v&&this.trackCliFlag("json")}trackCliOptionTimeout(timeout){timeout&&this.trackCliOption({option:"timeout",value:"[TIME]"})}trackCliFlagNoWait(noWait){noWait&&this.trackCliFlag("no-wait")}};function buildBuyCommand(client,domain,opts){let parts=[`domains buy ${domain}`];opts.team&&parts.push(`--scope ${opts.team}`),opts.amount!==void 0&&parts.push(`--amount ${formatAmountArg(opts.amount)}`),opts.useBilling&&parts.push("--use-billing-details");for(let{field,flag}of CONTACT_FIELDS){let value=opts.contact[field];value!==void 0?parts.push(`${flag} ${quoteArg(value)}`):opts.missing.includes(field)&&parts.push(`${flag} <${flag.slice(2)}>`)}return opts.autoRenew===!0&&parts.push("--auto-renew"),opts.autoRenew===!1&&parts.push("--no-auto-renew"),opts.wait?.noWait?parts.push("--no-wait"):opts.wait?.timeout&&parts.push(`--timeout ${quoteArg(opts.wait.timeout)}`),opts.json&&parts.push("--json"),buildCommandWithGlobalFlags(client.argv,parts.join(" "))}function flagFor(field){return CONTACT_FIELDS.find(f=>f.field===field).flag}function usageError(client,message){return reportUsageError(client,AGENT_REASON.INVALID_ARGUMENTS,message)}async function buy(client,argv){let telemetry=new DomainsBuyTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArgs,flagsSpecification=getFlagsSpecification(buySubcommand.options);try{parsedArgs=parseArguments(argv,flagsSpecification)}catch(error){return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message:error instanceof Error?error.message:String(error)},2),printError(error),2}let{args,flags}=parsedArgs,[domainName]=args;if(telemetry.trackCliArgumentDomain(domainName),telemetry.trackCliOptionAmount(flags["--amount"]),telemetry.trackCliFlagUseBillingDetails(flags["--use-billing-details"]),telemetry.trackCliOptionFirstName(flags["--first-name"]),telemetry.trackCliOptionLastName(flags["--last-name"]),telemetry.trackCliOptionEmail(flags["--email"]),telemetry.trackCliOptionPhone(flags["--phone"]),telemetry.trackCliOptionAddress(flags["--address"]),telemetry.trackCliOptionCity(flags["--city"]),telemetry.trackCliOptionState(flags["--state"]),telemetry.trackCliOptionZip(flags["--zip"]),telemetry.trackCliOptionCountry(flags["--country"]),telemetry.trackCliOptionCompany(flags["--company"]),telemetry.trackCliFlagAutoRenew(flags["--auto-renew"]),telemetry.trackCliFlagNoAutoRenew(flags["--no-auto-renew"]),telemetry.trackCliOptionTimeout(flags["--timeout"]),telemetry.trackCliFlagNoWait(flags["--no-wait"]),telemetry.trackCliOptionFormat(flags["--format"]),telemetry.trackCliFlagJson(flags["--json"]),!domainName){if(client.nonInteractive){let globalFlags=getGlobalFlagsFromArgs(client.argv.slice(2)),cmd=getCommandNamePlain(`domains buy <domain> ${globalFlags.join(" ")}`.trim());outputAgentError(client,{status:"error",reason:"missing_arguments",message:`Missing domain name. Run: ${cmd}`,next:[{command:cmd,when:"Replace <domain> with the domain to buy"}]},2)}return output_manager_default.error(`Missing domain name. Run ${getCommandName("domains --help")}`),2}if(args.length>1){let extra=args[1].toLowerCase();return usageError(client,extra==="true"||extra==="false"?"Unexpected extra argument. On/off options like --auto-renew don't take a value: pass --auto-renew or --no-auto-renew.":'Unexpected extra argument. domains buy takes one domain; quote option values that contain spaces, like --address "1 Main St".')}let formatResult=validateJsonOutput(flags);if(!formatResult.valid)return usageError(client,formatResult.error);let asJson=formatResult.jsonOutput,{domain:rootDomain,subdomain}=(0,import_tldts.parse)(domainName);if(subdomain||!rootDomain)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_domain",message:`Invalid domain name '${domainName}'. Use a registrable root domain (no subdomain).`},1),output_manager_default.error(`Invalid domain name "${domainName}". Run ${getCommandName("domains --help")}`),1;let amount=parseAmount(flags["--amount"]);if(amount instanceof Error)return usageError(client,amount.message);let wait=parseOrderWait(flags);if(typeof wait=="string")return usageError(client,wait);let fromFlags=readContactFlags(flags);if(typeof fromFlags=="string")return usageError(client,fromFlags);let valuedFlag=chargeFlagWithValue(argv,["--auto-renew","--no-auto-renew","--use-billing-details"]);if(valuedFlag)return usageError(client,valuedFlag);let useBilling=!!flags["--use-billing-details"];if(flags["--auto-renew"]&&flags["--no-auto-renew"])return usageError(client,"Can't use --auto-renew with --no-auto-renew.");let autoRenewChoice=flags["--auto-renew"]?!0:flags["--no-auto-renew"]?!1:void 0,{contextName,team}=await getScope(client),commandOptions={team:team?.slug,useBilling,contact:fromFlags,autoRenew:autoRenewChoice,wait:{noWait:wait.noWait,timeout:flags["--timeout"]===void 0?void 0:wait.timeout},json:asJson},availableStamp=stamp_default(),[domainPrice,domainStatus]=await Promise.all([getDomainPrice(client,domainName),getDomainStatus(client,domainName)]);if(!domainStatus.available){if(await isPurchasedSince(client,domainName,0)){if(!canPromptForCharge(client,asJson)&&team){let refused=refuseUnnamedTeam(client,asJson,{verb:"buy",domain:domainName,team,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,amount,missing:[]})});if(refused!==void 0)return refused}return reportAlreadyOwned(client,asJson,domainName,contextName,{autoRenew:autoRenewChoice})}return reportChargeFailure(client,asJson,{reason:AGENT_REASON.DOMAIN_NOT_AVAILABLE,message:`The domain ${domainName} is unavailable.`})}if(domainPrice instanceof Error)return reportChargeFailure(client,asJson,{reason:chargeFailureReason(domainPrice),message:domainPrice.message});let{years,purchasePrice,renewalPrice}=domainPrice;if(purchasePrice===null||renewalPrice===null)return reportChargeFailure(client,asJson,{reason:AGENT_REASON.API_ERROR,message:`The price of ${domainName} was not found.`});output_manager_default.log(`The domain ${param(domainName)} is ${import_chalk.default.underline("available")} to buy under ${import_chalk.default.bold(contextName)}! ${availableStamp()}`);let billing=getBillingContact(team),contact=mergeContact(fromFlags,useBilling?billing:{});if(amount!==void 0&&!amountMatchesPrice(amount,purchasePrice))return reportPriceChanged(client,{verb:"buy",domain:domainName,amount,price:purchasePrice,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,amount:purchasePrice,missing:missingContactFields(contact)}),json:asJson});let autoRenew,contactInformation;if(canPromptForCharge(client,asJson)){if(amount===void 0&&!await client.input.confirm(`Buy now for ${import_chalk.default.bold(formatUsd(purchasePrice))} (${formatTerm(years)})?`,!1))return 0;autoRenew=autoRenewChoice??await client.input.confirm(years===1?`Auto renew yearly for ${import_chalk.default.bold(formatUsd(renewalPrice))}?`:`Auto renew every ${years} years for ${import_chalk.default.bold(formatUsd(renewalPrice))}?`,!0),contactInformation=await collectContactInformation(client,{provided:contact,defaults:mergeContact(fromFlags,billing)})}else{let missing=missingContactFields(contact);if(amount===void 0||missing.length>0||autoRenewChoice===void 0)return requireApproval(client,{domain:domainName,team:team?.slug,contextName,price:purchasePrice,renewalPrice,years,amount,fromFlags,billing,useBilling,autoRenew:autoRenewChoice,wait:commandOptions.wait,json:asJson});if(team){let refused=refuseUnnamedTeam(client,asJson,{verb:"buy",domain:domainName,team,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,amount,missing:[]})});if(refused!==void 0)return refused}autoRenew=autoRenewChoice,contactInformation={...contact,companyName:contact.companyName||void 0}}let inspectCommand=buildCommandWithGlobalFlags(client.argv,`domains inspect ${domainName}`),buyResult,purchaseStamp=stamp_default();output_manager_default.spinner("Purchasing");try{buyResult=await purchaseDomain(client,domainName,purchasePrice,years,autoRenew,contactInformation,{waitMs:wait.waitMs,onOrderAccepted:orderId=>{asJson||wait.noWait||(output_manager_default.stopSpinner(),output_manager_default.log(`Order ${orderId} accepted.`),output_manager_default.spinner(`Waiting on the registrar to register ${domainName}`))}})}catch(err){output_manager_default.stopSpinner(),output_manager_default.debug(`Server response: ${(0,import_error_utils.errorToString)(err)}`);let apiError=isAPIError(err)?err:void 0;return reportChargeFailure(client,asJson,{reason:AGENT_REASON.API_ERROR,message:apiError?`Couldn't buy ${domainName}. The API returned an error (${apiError.code}). Nothing was charged.`:`Couldn't buy ${domainName}. The order wasn't sent, so nothing was charged.`},{apiMessage:apiError?.serverMessage})}if(output_manager_default.stopSpinner(),buyResult instanceof DomainPriceChanged)return reportPriceChanged(client,{verb:"buy",domain:domainName,amount:purchasePrice,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,missing:[]}),json:asJson});if(buyResult instanceof DomainChargeOutcomeUnknown)return reportUnknownOutcome(client,asJson,{verb:"buy",domain:domainName,inspectCommand,orderId:buyResult.meta.orderId});if(buyResult instanceof DomainPurchaseInProgress){let{orderId}=buyResult.meta;return reportChargeFailure(client,asJson,{reason:AGENT_REASON.PURCHASE_IN_PROGRESS,message:buyResult.message,retryable:!1,data:{domain:domainName,remote:"none",...orderId&&{orderId}},next:[...orderId?[orderStatusStep(client,{verb:"buy",domain:domainName,orderId})]:[],{command:inspectCommand,when:"Once that order finishes, see the domain"}]})}return buyResult instanceof DomainPaymentAuthenticationRequired?reportChargeFailure(client,asJson,{reason:AGENT_REASON.PAYMENT_AUTHENTICATION_REQUIRED,message:buyResult.message,userActionRequired:!0,verification_uri:buyResult.meta.url}):buyResult instanceof Error?reportChargeFailure(client,asJson,{reason:chargeFailureReason(buyResult),message:buyResult.message}):buyResult.status==="already_owned"?reportAlreadyOwned(client,asJson,domainName,contextName,{autoRenew,duplicate:{orderId:buyResult.orderId,orderOutcome:buyResult.orderOutcome}}):buyResult.status==="pending"?reportOrderPending(client,asJson,{verb:"buy",domain:domainName,orderId:buyResult.orderId,lastStatus:buyResult.lastStatus,readError:buyResult.readError,inspectCommand,wait}):asJson?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,domain:domainName,years,charge:{amount:purchasePrice,currency:"USD"},orderId:buyResult.orderId,autoRenew,renewalPrice,message:`Domain ${domainName} purchased.`},null,2)}
7
+ import{require_cjs}from"./chunk-I4TWSNQG.js";import{CONTACT_FIELDS,billingFieldsUsed,collectContactInformation,getBillingContact,getDomainPrice,getDomainStatus,isPurchasedSince,mergeContact,missingContactFields,purchaseDomain,readContactFlags}from"./chunk-5K4JQIXT.js";import{amountMatchesPrice,canPromptForCharge,chargeFailureReason,chargeFlagWithValue,formatAmountArg,formatTerm,orderStatusStep,parseAmount,parseOrderWait,printChargeRecovery,refuseUnnamedTeam,reportChargeFailure,reportOrderPending,reportPriceChanged,reportUnknownOutcome,reportUsageError,writeChargeAction}from"./chunk-PM2B26M3.js";import{formatUsd}from"./chunk-W45KFKUW.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import{buySubcommand}from"./chunk-XYUCYNGO.js";import{printError}from"./chunk-ZMT7EYYL.js";import{param}from"./chunk-3G3FQYMW.js";import{getScope}from"./chunk-3BMYPWEY.js";import{TelemetryClient}from"./chunk-KDCODXVL.js";import{AGENT_ACTION,AGENT_REASON,AGENT_STATUS,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-IRNQJ6ZX.js";import{parseArguments}from"./chunk-NHB43235.js";import{validateJsonOutput}from"./chunk-6GKP6VUF.js";import{DomainChargeOutcomeUnknown,DomainPaymentAuthenticationRequired,DomainPriceChanged,DomainPurchaseInProgress,isAPIError}from"./chunk-GOI2VVI7.js";import{getCommandName,getCommandNamePlain}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-AP6DZGTK.js";import{require_dist}from"./chunk-MCYG7CCE.js";import{getFlagsSpecification,getGlobalFlagsFromArgs,quoteArg}from"./chunk-EZVNGJN5.js";import{require_source}from"./chunk-NB2WLB3J.js";import{require_strip_ansi}from"./chunk-BULSRTQE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_strip_ansi=__toESM(require_strip_ansi(),1),import_tldts=__toESM(require_cjs(),1),import_error_utils=__toESM(require_dist(),1);var DomainsBuyTelemetryClient=class extends TelemetryClient{trackCliArgumentDomain(v){v&&this.trackCliArgument({arg:"domain",value:this.redactedValue})}trackCliOptionAmount(v){this.trackRedactedCliOption("amount",v)}trackCliFlagUseBillingDetails(v){v&&this.trackCliFlag("use-billing-details")}trackCliOptionFirstName(v){this.trackRedactedCliOption("first-name",v)}trackCliOptionLastName(v){this.trackRedactedCliOption("last-name",v)}trackCliOptionEmail(v){this.trackRedactedCliOption("email",v)}trackCliOptionPhone(v){this.trackRedactedCliOption("phone",v)}trackCliOptionAddress(v){this.trackRedactedCliOption("address",v)}trackCliOptionCity(v){this.trackRedactedCliOption("city",v)}trackCliOptionState(v){this.trackRedactedCliOption("state",v)}trackCliOptionZip(v){this.trackRedactedCliOption("zip",v)}trackCliOptionCountry(v){this.trackRedactedCliOption("country",v)}trackCliOptionCompany(v){this.trackRedactedCliOption("company",v)}trackCliFlagAutoRenew(v){v&&this.trackCliFlag("auto-renew")}trackCliFlagNoAutoRenew(v){v&&this.trackCliFlag("no-auto-renew")}trackCliFlagJson(v){v&&this.trackCliFlag("json")}trackCliOptionTimeout(timeout){timeout&&this.trackCliOption({option:"timeout",value:"[TIME]"})}trackCliFlagNoWait(noWait){noWait&&this.trackCliFlag("no-wait")}};function buildBuyCommand(client,domain,opts){let parts=[`domains buy ${domain}`];opts.team&&parts.push(`--scope ${opts.team}`),opts.amount!==void 0&&parts.push(`--amount ${formatAmountArg(opts.amount)}`),opts.useBilling&&parts.push("--use-billing-details");for(let{field,flag}of CONTACT_FIELDS){let value=opts.contact[field];value!==void 0?parts.push(`${flag} ${quoteArg(value)}`):opts.missing.includes(field)&&parts.push(`${flag} <${flag.slice(2)}>`)}return opts.autoRenew===!0&&parts.push("--auto-renew"),opts.autoRenew===!1&&parts.push("--no-auto-renew"),opts.wait?.noWait?parts.push("--no-wait"):opts.wait?.timeout&&parts.push(`--timeout ${quoteArg(opts.wait.timeout)}`),opts.json&&parts.push("--json"),buildCommandWithGlobalFlags(client.argv,parts.join(" "))}function flagFor(field){return CONTACT_FIELDS.find(f=>f.field===field).flag}function usageError(client,message){return reportUsageError(client,AGENT_REASON.INVALID_ARGUMENTS,message)}async function buy(client,argv){let telemetry=new DomainsBuyTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArgs,flagsSpecification=getFlagsSpecification(buySubcommand.options);try{parsedArgs=parseArguments(argv,flagsSpecification)}catch(error){return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message:error instanceof Error?error.message:String(error)},2),printError(error),2}let{args,flags}=parsedArgs,[domainName]=args;if(telemetry.trackCliArgumentDomain(domainName),telemetry.trackCliOptionAmount(flags["--amount"]),telemetry.trackCliFlagUseBillingDetails(flags["--use-billing-details"]),telemetry.trackCliOptionFirstName(flags["--first-name"]),telemetry.trackCliOptionLastName(flags["--last-name"]),telemetry.trackCliOptionEmail(flags["--email"]),telemetry.trackCliOptionPhone(flags["--phone"]),telemetry.trackCliOptionAddress(flags["--address"]),telemetry.trackCliOptionCity(flags["--city"]),telemetry.trackCliOptionState(flags["--state"]),telemetry.trackCliOptionZip(flags["--zip"]),telemetry.trackCliOptionCountry(flags["--country"]),telemetry.trackCliOptionCompany(flags["--company"]),telemetry.trackCliFlagAutoRenew(flags["--auto-renew"]),telemetry.trackCliFlagNoAutoRenew(flags["--no-auto-renew"]),telemetry.trackCliOptionTimeout(flags["--timeout"]),telemetry.trackCliFlagNoWait(flags["--no-wait"]),telemetry.trackCliOptionFormat(flags["--format"]),telemetry.trackCliFlagJson(flags["--json"]),!domainName){if(client.nonInteractive){let globalFlags=getGlobalFlagsFromArgs(client.argv.slice(2)),cmd=getCommandNamePlain(`domains buy <domain> ${globalFlags.join(" ")}`.trim());outputAgentError(client,{status:"error",reason:"missing_arguments",message:`Missing domain name. Run: ${cmd}`,next:[{command:cmd,when:"Replace <domain> with the domain to buy"}]},2)}return output_manager_default.error(`Missing domain name. Run ${getCommandName("domains --help")}`),2}if(args.length>1){let extra=args[1].toLowerCase();return usageError(client,extra==="true"||extra==="false"?"Unexpected extra argument. On/off options like --auto-renew don't take a value: pass --auto-renew or --no-auto-renew.":'Unexpected extra argument. domains buy takes one domain; quote option values that contain spaces, like --address "1 Main St".')}let formatResult=validateJsonOutput(flags);if(!formatResult.valid)return usageError(client,formatResult.error);let asJson=formatResult.jsonOutput,{domain:rootDomain,subdomain}=(0,import_tldts.parse)(domainName);if(subdomain||!rootDomain)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_domain",message:`Invalid domain name '${domainName}'. Use a registrable root domain (no subdomain).`},1),output_manager_default.error(`Invalid domain name "${domainName}". Run ${getCommandName("domains --help")}`),1;let amount=parseAmount(flags["--amount"]);if(amount instanceof Error)return usageError(client,amount.message);let wait=parseOrderWait(flags);if(typeof wait=="string")return usageError(client,wait);let fromFlags=readContactFlags(flags);if(typeof fromFlags=="string")return usageError(client,fromFlags);let valuedFlag=chargeFlagWithValue(argv,["--auto-renew","--no-auto-renew","--use-billing-details"]);if(valuedFlag)return usageError(client,valuedFlag);let useBilling=!!flags["--use-billing-details"];if(flags["--auto-renew"]&&flags["--no-auto-renew"])return usageError(client,"Can't use --auto-renew with --no-auto-renew.");let autoRenewChoice=flags["--auto-renew"]?!0:flags["--no-auto-renew"]?!1:void 0,{contextName,team}=await getScope(client),commandOptions={team:team?.slug,useBilling,contact:fromFlags,autoRenew:autoRenewChoice,wait:{noWait:wait.noWait,timeout:flags["--timeout"]===void 0?void 0:wait.timeout},json:asJson},availableStamp=stamp_default(),[domainPrice,domainStatus]=await Promise.all([getDomainPrice(client,domainName),getDomainStatus(client,domainName)]);if(!domainStatus.available){if(await isPurchasedSince(client,domainName,0)){if(!canPromptForCharge(client,asJson)&&team){let refused=refuseUnnamedTeam(client,asJson,{verb:"buy",domain:domainName,team,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,amount,missing:[]})});if(refused!==void 0)return refused}return reportAlreadyOwned(client,asJson,domainName,contextName,{autoRenew:autoRenewChoice})}return reportChargeFailure(client,asJson,{reason:AGENT_REASON.DOMAIN_NOT_AVAILABLE,message:`The domain ${domainName} is unavailable.`})}if(domainPrice instanceof Error)return reportChargeFailure(client,asJson,{reason:chargeFailureReason(domainPrice),message:domainPrice.message});let{years,purchasePrice,renewalPrice}=domainPrice;if(purchasePrice===null||renewalPrice===null)return reportChargeFailure(client,asJson,{reason:AGENT_REASON.API_ERROR,message:`The price of ${domainName} was not found.`});output_manager_default.log(`The domain ${param(domainName)} is ${import_chalk.default.underline("available")} to buy under ${import_chalk.default.bold(contextName)}! ${availableStamp()}`);let billing=getBillingContact(team),contact=mergeContact(fromFlags,useBilling?billing:{});if(amount!==void 0&&!amountMatchesPrice(amount,purchasePrice))return reportPriceChanged(client,{verb:"buy",domain:domainName,amount,price:purchasePrice,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,amount:purchasePrice,missing:missingContactFields(contact)}),json:asJson});let autoRenew,contactInformation;if(canPromptForCharge(client,asJson)){if(amount===void 0&&!await client.input.confirm(`Buy now for ${import_chalk.default.bold(formatUsd(purchasePrice))} (${formatTerm(years)})?`,!1))return 0;autoRenew=autoRenewChoice??await client.input.confirm(years===1?`Auto renew yearly for ${import_chalk.default.bold(formatUsd(renewalPrice))}?`:`Auto renew every ${years} years for ${import_chalk.default.bold(formatUsd(renewalPrice))}?`,!0),contactInformation=await collectContactInformation(client,{provided:contact,defaults:mergeContact(fromFlags,billing)})}else{let missing=missingContactFields(contact);if(amount===void 0||missing.length>0||autoRenewChoice===void 0)return requireApproval(client,{domain:domainName,team:team?.slug,contextName,price:purchasePrice,renewalPrice,years,amount,fromFlags,billing,useBilling,autoRenew:autoRenewChoice,wait:commandOptions.wait,json:asJson});if(team){let refused=refuseUnnamedTeam(client,asJson,{verb:"buy",domain:domainName,team,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,amount,missing:[]})});if(refused!==void 0)return refused}autoRenew=autoRenewChoice,contactInformation={...contact,companyName:contact.companyName||void 0}}let inspectCommand=buildCommandWithGlobalFlags(client.argv,`domains inspect ${domainName}`),buyResult,purchaseStamp=stamp_default();output_manager_default.spinner("Purchasing");try{buyResult=await purchaseDomain(client,domainName,purchasePrice,years,autoRenew,contactInformation,{waitMs:wait.waitMs,onOrderAccepted:orderId=>{asJson||wait.noWait||(output_manager_default.stopSpinner(),output_manager_default.log(`Order ${orderId} accepted.`),output_manager_default.spinner(`Waiting on the registrar to register ${domainName}`))}})}catch(err){output_manager_default.stopSpinner(),output_manager_default.debug(`Server response: ${(0,import_error_utils.errorToString)(err)}`);let apiError=isAPIError(err)?err:void 0;return reportChargeFailure(client,asJson,{reason:AGENT_REASON.API_ERROR,message:apiError?`Couldn't buy ${domainName}. The API returned an error (${apiError.code}). Nothing was charged.`:`Couldn't buy ${domainName}. The order wasn't sent, so nothing was charged.`},{apiMessage:apiError?.serverMessage})}if(output_manager_default.stopSpinner(),buyResult instanceof DomainPriceChanged)return reportPriceChanged(client,{verb:"buy",domain:domainName,amount:purchasePrice,nextCommand:buildBuyCommand(client,domainName,{...commandOptions,missing:[]}),json:asJson});if(buyResult instanceof DomainChargeOutcomeUnknown)return reportUnknownOutcome(client,asJson,{verb:"buy",domain:domainName,inspectCommand,orderId:buyResult.meta.orderId});if(buyResult instanceof DomainPurchaseInProgress){let{orderId}=buyResult.meta;return reportChargeFailure(client,asJson,{reason:AGENT_REASON.PURCHASE_IN_PROGRESS,message:buyResult.message,retryable:!1,data:{domain:domainName,remote:"none",...orderId&&{orderId}},next:[...orderId?[orderStatusStep(client,{verb:"buy",domain:domainName,orderId})]:[],{command:inspectCommand,when:"Once that order finishes, see the domain"}]})}return buyResult instanceof DomainPaymentAuthenticationRequired?reportChargeFailure(client,asJson,{reason:AGENT_REASON.PAYMENT_AUTHENTICATION_REQUIRED,message:buyResult.message,userActionRequired:!0,verification_uri:buyResult.meta.url}):buyResult instanceof Error?reportChargeFailure(client,asJson,{reason:chargeFailureReason(buyResult),message:buyResult.message}):buyResult.status==="already_owned"?reportAlreadyOwned(client,asJson,domainName,contextName,{autoRenew,duplicate:{orderId:buyResult.orderId,orderOutcome:buyResult.orderOutcome}}):buyResult.status==="pending"?reportOrderPending(client,asJson,{verb:"buy",domain:domainName,orderId:buyResult.orderId,lastStatus:buyResult.lastStatus,readError:buyResult.readError,inspectCommand,wait}):asJson?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,domain:domainName,years,charge:{amount:purchasePrice,currency:"USD"},orderId:buyResult.orderId,autoRenew,renewalPrice,message:`Domain ${domainName} purchased.`},null,2)}
8
8
  `),0):(client.stdout.write(`${domainName}
9
9
  `),output_manager_default.success(`Domain ${param(domainName)} purchased ${purchaseStamp()}`),output_manager_default.log(`Charged ${formatUsd(purchasePrice)} for ${formatTerm(years)}. Registered to ${contactInformation.firstName} ${contactInformation.lastName} (${contactInformation.email}).`),output_manager_default.note(`You may now use your domain as an alias to your deployments. Run ${getCommandName("alias --help")}`),0)}function reportAlreadyOwned(client,json,domain,contextName,opts={}){let{duplicate,autoRenew}=opts,autoRenewCommand=autoRenew===void 0?void 0:buildCommandWithGlobalFlags(client.argv,`domains auto-renew ${autoRenew?"enable":"disable"} ${domain}`),message=[duplicate?`${domain} is already registered to ${contextName} by an earlier purchase. This run's order ${duplicate.orderId} ${duplicate.orderOutcome==="refunded"?"failed, and its charge was refunded":"failed"}.`:`${domain} is already registered to ${contextName}. Nothing was charged.`,autoRenewCommand?`This run didn't change its auto-renew setting; to turn it ${autoRenew?"on":"off"}, run ${autoRenewCommand}.`:""].filter(Boolean).join(" ");return json?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,domain,outcome:"unchanged",...duplicate&&{orderId:duplicate.orderId,orderStatus:duplicate.orderOutcome},message,...autoRenewCommand&&{next:[{command:autoRenewCommand,when:`To turn auto-renew ${autoRenew?"on":"off"} for the existing registration`}]}},null,2)}
10
10
  `),0):(client.stdout.write(`${domain}
@@ -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{require_json_parse_better_errors}from"./chunk-25565AGS.js";import{require_lib}from"./chunk-HDUZSFTK.js";import{CantParseJSONFile}from"./chunk-GOI2VVI7.js";import{require_dist}from"./chunk-MCYG7CCE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_extra=__toESM(require_lib(),1);var import_json_parse_better_errors=__toESM(require_json_parse_better_errors(),1),import_error_utils=__toESM(require_dist(),1);async function readJSONFile(file){let content=await readFileSafe(file);if(content===null)return content;try{return(0,import_json_parse_better_errors.default)(content)}catch(error){return new CantParseJSONFile(file,(0,import_error_utils.errorToString)(error))}}async function readFileSafe(file){try{return await import_fs_extra.default.readFile(file,"utf8")}catch{return null}}export{readJSONFile};
7
+ import{require_json_parse_better_errors}from"./chunk-25565AGS.js";import{require_lib}from"./chunk-ZHAPKFVM.js";import{CantParseJSONFile}from"./chunk-GOI2VVI7.js";import{require_dist}from"./chunk-MCYG7CCE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_extra=__toESM(require_lib(),1);var import_json_parse_better_errors=__toESM(require_json_parse_better_errors(),1),import_error_utils=__toESM(require_dist(),1);async function readJSONFile(file){let content=await readFileSafe(file);if(content===null)return content;try{return(0,import_json_parse_better_errors.default)(content)}catch(error){return new CantParseJSONFile(file,(0,import_error_utils.errorToString)(error))}}async function readFileSafe(file){try{return await import_fs_extra.default.readFile(file,"utf8")}catch{return null}}export{readJSONFile};