shopify 4.9.5 → 4.9.6

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 (331) hide show
  1. package/dist/analytics-BTM7UNF6.js +1 -0
  2. package/dist/analytics-KFRP2KGG.js +1 -0
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/{chunk-KDV4WR5A.js → chunk-242NOO4T.js} +1 -1
  5. package/dist/{chunk-Z6Z5DPKS.js → chunk-27WWE5QN.js} +1 -1
  6. package/dist/{chunk-32NWVYUC.js → chunk-2EFFU2J3.js} +1 -1
  7. package/dist/{chunk-HB4YI2PF.js → chunk-2TCPTRLF.js} +5 -5
  8. package/dist/{chunk-CEQ5S3HH.js → chunk-36TJJREK.js} +1 -1
  9. package/dist/{chunk-FVTP7EO4.js → chunk-3CSRZM3Q.js} +1 -1
  10. package/dist/{chunk-RW3P3UMU.js → chunk-3EY3ULS6.js} +2 -2
  11. package/dist/{chunk-K4AF7A25.js → chunk-3LR3IQRE.js} +1 -1
  12. package/dist/chunk-3OSGEQWG.js +4 -0
  13. package/dist/{chunk-EDRCFY3K.js → chunk-3QBQSNON.js} +1 -1
  14. package/dist/chunk-3WNWP3ZV.js +20 -0
  15. package/dist/{chunk-4VS7YD53.js → chunk-3XFVLDKZ.js} +1 -1
  16. package/dist/{chunk-LQSD25YS.js → chunk-43RTNZ6T.js} +1 -1
  17. package/dist/{chunk-UEQT7TA4.js → chunk-4CH5XVYP.js} +1 -1
  18. package/dist/{chunk-TBNEN73P.js → chunk-4GD2RMV4.js} +1 -1
  19. package/dist/{chunk-KN3MUEWA.js → chunk-4LUOXUQX.js} +1 -1
  20. package/dist/{chunk-K6FH5JSY.js → chunk-4MLDRZ3X.js} +2 -2
  21. package/dist/{chunk-Z4DESIR5.js → chunk-4SOWK7OZ.js} +1 -1
  22. package/dist/{chunk-YIZAQABE.js → chunk-4UROHXMF.js} +1 -1
  23. package/dist/{chunk-7DSH4CRU.js → chunk-4XDMN6DI.js} +1 -1
  24. package/dist/{chunk-JPFHPVIO.js → chunk-4XVDLMXZ.js} +1 -1
  25. package/dist/{chunk-YN4FSUFF.js → chunk-5EVQSYMN.js} +1 -1
  26. package/dist/chunk-5IQ42V5M.js +11 -0
  27. package/dist/{chunk-MZL6VM3W.js → chunk-5K7B3MYY.js} +1 -1
  28. package/dist/chunk-5LDJ4CAJ.js +3 -0
  29. package/dist/{chunk-3N6NKC2U.js → chunk-5W3YFFC2.js} +1 -1
  30. package/dist/{chunk-7Q4EKY3E.js → chunk-5WN5FGRS.js} +1 -1
  31. package/dist/{chunk-32RRWGNS.js → chunk-5YMLUN2H.js} +1 -1
  32. package/dist/{chunk-VNG2I7NM.js → chunk-6AFURA34.js} +1 -1
  33. package/dist/{chunk-VTOPYXHO.js → chunk-6ALQJACW.js} +1 -1
  34. package/dist/{chunk-FYIC4JHB.js → chunk-6HC6JBXZ.js} +1 -1
  35. package/dist/{chunk-BD2L6YE5.js → chunk-6I5ATJK6.js} +1 -1
  36. package/dist/{chunk-H7YSZKZ2.js → chunk-6KWTCDUU.js} +1 -1
  37. package/dist/{chunk-C6HGU77I.js → chunk-6LHYAB44.js} +1 -1
  38. package/dist/{chunk-IUYVJJKE.js → chunk-6M36S2RZ.js} +1 -1
  39. package/dist/{chunk-MWWULCLD.js → chunk-6MELTJU3.js} +1 -1
  40. package/dist/{chunk-QBJ74XPX.js → chunk-6R4CZJEP.js} +1 -1
  41. package/dist/{chunk-OWK2RI4O.js → chunk-6XKLKUE3.js} +1 -1
  42. package/dist/chunk-77G2GTZU.js +1 -0
  43. package/dist/{chunk-VG5ZDVDQ.js → chunk-7JAZMNHL.js} +1 -1
  44. package/dist/{chunk-7HZU7CYS.js → chunk-7VH257QN.js} +1 -1
  45. package/dist/{chunk-7Z6IX7MU.js → chunk-7VHNMRXX.js} +1 -1
  46. package/dist/{chunk-MQ4WV4B6.js → chunk-7XGP35CV.js} +1 -1
  47. package/dist/{chunk-XVFQ6CNO.js → chunk-A5RXJNQ5.js} +1 -1
  48. package/dist/{chunk-S6A7TMR4.js → chunk-A7KQUQLZ.js} +1 -1
  49. package/dist/{chunk-FHV2H3Z2.js → chunk-AQRJ76WH.js} +1 -1
  50. package/dist/{chunk-BAP2CHI2.js → chunk-AY5OUOJX.js} +1 -1
  51. package/dist/{chunk-AJMJQA4J.js → chunk-B6BTX7WU.js} +1 -1
  52. package/dist/{chunk-SEXH4EP5.js → chunk-BAAM465I.js} +1 -1
  53. package/dist/{chunk-34RFTE5T.js → chunk-BAPGKXWM.js} +1 -1
  54. package/dist/chunk-BSNPN72J.js +5 -0
  55. package/dist/{chunk-YNJIDLI3.js → chunk-BUERBYLS.js} +1 -1
  56. package/dist/{chunk-65GNYRYR.js → chunk-BYZU7YS7.js} +2 -2
  57. package/dist/{chunk-EO422KZZ.js → chunk-CNHSSTET.js} +1 -1
  58. package/dist/{chunk-7BWSN3SG.js → chunk-CUKGLLVJ.js} +1 -1
  59. package/dist/{chunk-EYKXHMEJ.js → chunk-CYXIVHAF.js} +1 -1
  60. package/dist/{chunk-LMQOFVRC.js → chunk-D2XXDJOB.js} +1 -1
  61. package/dist/{chunk-5APLAJCB.js → chunk-D65CUTKT.js} +1 -1
  62. package/dist/{chunk-JM2CQP64.js → chunk-DP64USHX.js} +1 -1
  63. package/dist/{chunk-SUTVPAJF.js → chunk-DWMRVMKX.js} +1 -1
  64. package/dist/{chunk-SYCN2GT2.js → chunk-DXDKHVOZ.js} +1 -1
  65. package/dist/{chunk-EAVD3OH2.js → chunk-DXVMT37F.js} +1 -1
  66. package/dist/{chunk-762IKULK.js → chunk-EBAV3Z54.js} +1 -1
  67. package/dist/{chunk-OOKTWSGP.js → chunk-ECUMY7EP.js} +1 -1
  68. package/dist/{chunk-N47RQHEI.js → chunk-EDUQUCXK.js} +1 -1
  69. package/dist/chunk-EGWRLGF4.js +1 -0
  70. package/dist/{chunk-T3UCIWRH.js → chunk-FASYFQVN.js} +1 -1
  71. package/dist/{chunk-MF7IHOM5.js → chunk-FJUE4LQ6.js} +1 -1
  72. package/dist/{chunk-V5FZRNXI.js → chunk-FLKGDGRR.js} +1 -1
  73. package/dist/{chunk-M5WBYWSQ.js → chunk-FMFU75ON.js} +1 -1
  74. package/dist/{chunk-DO5YFMTJ.js → chunk-FMT52ZOY.js} +1 -1
  75. package/dist/{chunk-32VQQ6EU.js → chunk-FRHB4IFP.js} +1 -1
  76. package/dist/{chunk-DCKRQZLE.js → chunk-FSWOB535.js} +3 -3
  77. package/dist/{chunk-RIO5HKD5.js → chunk-FUJAJKL2.js} +1 -1
  78. package/dist/{chunk-HNSRF4SQ.js → chunk-FX27WXGC.js} +1 -1
  79. package/dist/{chunk-5OM72O4N.js → chunk-G73DLMVM.js} +1 -1
  80. package/dist/{chunk-2II4W4ZF.js → chunk-G76W6NZP.js} +1 -1
  81. package/dist/{chunk-5VRB3FBD.js → chunk-G7HOEDC3.js} +1 -1
  82. package/dist/{chunk-LJAU6YHF.js → chunk-GAWWWWUZ.js} +1 -1
  83. package/dist/{chunk-XRCAUZAZ.js → chunk-GB3AA3X5.js} +1 -1
  84. package/dist/{chunk-SJ2ROSXG.js → chunk-GDNCENVE.js} +1 -1
  85. package/dist/{chunk-PIGERIRY.js → chunk-HCKLWXCL.js} +1 -1
  86. package/dist/{chunk-BQWK222Q.js → chunk-HK3GFNMW.js} +1 -1
  87. package/dist/{chunk-XAQUXFN5.js → chunk-HP4GSH4V.js} +1 -1
  88. package/dist/{chunk-CSWDRG3E.js → chunk-HUWP2XMA.js} +1 -1
  89. package/dist/{chunk-YFJELEVH.js → chunk-HYLSV7GC.js} +1 -1
  90. package/dist/{chunk-EO3S2TFI.js → chunk-I3QLXR5S.js} +1 -1
  91. package/dist/{chunk-O2CP7DQE.js → chunk-IAFTSCIL.js} +1 -1
  92. package/dist/{chunk-72CBJYAG.js → chunk-ICRQVAFM.js} +1 -1
  93. package/dist/{chunk-YRX4E67D.js → chunk-IRF43DMG.js} +1 -1
  94. package/dist/{chunk-WGO2GC6I.js → chunk-ITO5UZMZ.js} +1 -1
  95. package/dist/{chunk-KOS53Z7E.js → chunk-J47LE4T7.js} +1 -1
  96. package/dist/{chunk-7YXHILW4.js → chunk-J6XOTLT5.js} +2 -2
  97. package/dist/{chunk-COP2Q2YT.js → chunk-JDAQL76H.js} +1 -1
  98. package/dist/{chunk-GJ3QUZO6.js → chunk-JNHEAOMV.js} +1 -1
  99. package/dist/{chunk-PT3OZEBI.js → chunk-JTEP5MP2.js} +1 -1
  100. package/dist/{chunk-42DMJGOW.js → chunk-KACAGYNQ.js} +1 -1
  101. package/dist/{chunk-PFXDXD5O.js → chunk-KCO5GEOP.js} +1 -1
  102. package/dist/{chunk-VSFZEGIK.js → chunk-KK6PJIJT.js} +1 -1
  103. package/dist/{chunk-AODTY2BL.js → chunk-KW5SQ6PG.js} +1 -1
  104. package/dist/{chunk-5GFVMGAZ.js → chunk-LXCVWQK4.js} +1 -1
  105. package/dist/{chunk-P2UEQJJ4.js → chunk-MEWNJLRS.js} +1 -1
  106. package/dist/{chunk-5NCWBBRW.js → chunk-MJIGXNI3.js} +1 -1
  107. package/dist/{chunk-4BXQTW5G.js → chunk-MKNCBJVY.js} +1 -1
  108. package/dist/{chunk-4CTTWXUX.js → chunk-MLZAI55C.js} +1 -1
  109. package/dist/{chunk-S7EKUSO6.js → chunk-MNYLFNXN.js} +1 -1
  110. package/dist/{chunk-KMJTO7CU.js → chunk-N5YS4PAM.js} +1 -1
  111. package/dist/{chunk-A4XREDFZ.js → chunk-NB2KT7G6.js} +1 -1
  112. package/dist/{chunk-CVBWEUWX.js → chunk-NLXVPUOO.js} +1 -1
  113. package/dist/{chunk-GF36WNMH.js → chunk-NQ5PKMPV.js} +1 -1
  114. package/dist/{chunk-EBX6DYDX.js → chunk-NQVG4W5U.js} +1 -1
  115. package/dist/{chunk-LCMDVUVO.js → chunk-NY5ESCDK.js} +1 -1
  116. package/dist/{chunk-NRG2WPSM.js → chunk-O4Q3UXIN.js} +1 -1
  117. package/dist/{chunk-WJJXJNNP.js → chunk-ON4RFEHN.js} +1 -1
  118. package/dist/{chunk-G362JEAV.js → chunk-OPIEU37B.js} +1 -1
  119. package/dist/{chunk-KF7NL5YM.js → chunk-OTQUZLAC.js} +1 -1
  120. package/dist/{chunk-2EC5SUGK.js → chunk-OYMJI3MD.js} +1 -1
  121. package/dist/{chunk-4MQXMIWQ.js → chunk-PCWXGO4K.js} +1 -1
  122. package/dist/{chunk-OONMCK7X.js → chunk-PDAOTRLF.js} +1 -1
  123. package/dist/{chunk-QBIYAMSH.js → chunk-PI6M7EZF.js} +1 -1
  124. package/dist/{chunk-ND6O6KT6.js → chunk-PJ273A7N.js} +1 -1
  125. package/dist/{chunk-XFEJS652.js → chunk-PUMOQZDB.js} +1 -1
  126. package/dist/{chunk-2WDJXERZ.js → chunk-PZA7BBAC.js} +4 -4
  127. package/dist/{chunk-4HBKQUKY.js → chunk-QF453PH7.js} +1 -1
  128. package/dist/{chunk-YLCYRG2T.js → chunk-QFMATBKM.js} +1 -1
  129. package/dist/chunk-QG3GJSLN.js +15 -0
  130. package/dist/{chunk-H3ZPYOQV.js → chunk-QMFD6EWX.js} +1 -1
  131. package/dist/{chunk-HMWQOQAQ.js → chunk-QREFTU4W.js} +1 -1
  132. package/dist/{chunk-62GA7XR3.js → chunk-QY73XOBU.js} +3 -3
  133. package/dist/{chunk-BAHM64B4.js → chunk-QYV5QN44.js} +1 -1
  134. package/dist/{chunk-7LB6DPB6.js → chunk-ROUPL6WR.js} +1 -1
  135. package/dist/{chunk-C3PXIZY3.js → chunk-RV54HI5A.js} +1 -1
  136. package/dist/{chunk-3Q5BAPQK.js → chunk-S43YCHAN.js} +1 -1
  137. package/dist/chunk-SAA32TAK.js +5 -0
  138. package/dist/{chunk-ANG44FIF.js → chunk-SBVYAGNC.js} +1 -1
  139. package/dist/{chunk-2QENUJVG.js → chunk-SFQGGQDB.js} +1 -1
  140. package/dist/{chunk-D3NVUE65.js → chunk-SM3X5GTB.js} +1 -1
  141. package/dist/{chunk-XTOOTN4P.js → chunk-SNBJDHF2.js} +1 -1
  142. package/dist/{chunk-HTODXNY6.js → chunk-SPWX6OQR.js} +1 -1
  143. package/dist/{chunk-35NTERVR.js → chunk-ST75AW7Z.js} +1 -1
  144. package/dist/{chunk-LG6DGIFX.js → chunk-SUIVO7GI.js} +1 -1
  145. package/dist/{chunk-5O7JTVO2.js → chunk-T2RE2K3N.js} +1 -1
  146. package/dist/{chunk-WEICJ4GW.js → chunk-TC63IUVI.js} +1 -1
  147. package/dist/{chunk-MTBABHUB.js → chunk-TFVIG4I7.js} +1 -1
  148. package/dist/{chunk-UUM367NR.js → chunk-TJ2QQ2YQ.js} +1 -1
  149. package/dist/{chunk-EZG5EB7D.js → chunk-TM3PHZKF.js} +1 -1
  150. package/dist/{chunk-QGFJOTOH.js → chunk-TV37VCLT.js} +1 -1
  151. package/dist/{chunk-EJMLNBZA.js → chunk-TYBZNIRM.js} +2 -2
  152. package/dist/{chunk-M2HQFHNO.js → chunk-U5U5E7K5.js} +1 -1
  153. package/dist/chunk-UPAV44WQ.js +1 -0
  154. package/dist/{chunk-62LMVFR7.js → chunk-UQPAHTBH.js} +1 -1
  155. package/dist/{chunk-35VQQKVX.js → chunk-UZR3JSH2.js} +1 -1
  156. package/dist/{chunk-ZOE6WXW6.js → chunk-V2XUMMTV.js} +1 -1
  157. package/dist/{chunk-XPDHT3Z4.js → chunk-VEYIT46B.js} +1 -1
  158. package/dist/{chunk-EOIGDOUD.js → chunk-VI7XF2HZ.js} +1 -1
  159. package/dist/{chunk-Z2NL6XQK.js → chunk-VMMPBOTN.js} +1 -1
  160. package/dist/{chunk-RUDHGUIM.js → chunk-VOVBMABU.js} +1 -1
  161. package/dist/{chunk-2RONPKOD.js → chunk-VVHUYIID.js} +1 -1
  162. package/dist/{chunk-2VGPNRHH.js → chunk-VWKMTYCN.js} +1 -1
  163. package/dist/{chunk-O6FXUKI2.js → chunk-VYEPVORB.js} +1 -1
  164. package/dist/{chunk-XSRZWJIJ.js → chunk-W2PLTMI4.js} +1 -1
  165. package/dist/{chunk-3XAD2E55.js → chunk-WPVPRCCD.js} +1 -1
  166. package/dist/{chunk-QUO4RD3W.js → chunk-WQG4QDC5.js} +1 -1
  167. package/dist/{chunk-LLNUIGHP.js → chunk-WYAOSSZV.js} +1 -1
  168. package/dist/{chunk-EEAY7HFW.js → chunk-X4767EMJ.js} +1 -1
  169. package/dist/chunk-X5VPFSL3.js +16 -0
  170. package/dist/{chunk-SNTRSP5K.js → chunk-XAATRAER.js} +1 -1
  171. package/dist/{chunk-KYB4JX76.js → chunk-XEL7K7VT.js} +1 -1
  172. package/dist/chunk-XUZXQC5H.js +1 -0
  173. package/dist/{chunk-WKVFVT3H.js → chunk-XWQIX3T7.js} +1 -1
  174. package/dist/{chunk-GXSF6NCR.js → chunk-Y4USH7MD.js} +1 -1
  175. package/dist/{chunk-XE6EUHSS.js → chunk-Y54LCKE7.js} +1 -1
  176. package/dist/{chunk-GW424AJO.js → chunk-YMB7HPMN.js} +1 -1
  177. package/dist/{chunk-XP63T4KZ.js → chunk-Z5RA2TNT.js} +1 -1
  178. package/dist/{chunk-5AQNISGC.js → chunk-Z6TXDTXR.js} +1 -1
  179. package/dist/{chunk-5XTJ4OL4.js → chunk-ZG4M63GT.js} +1 -1
  180. package/dist/chunk-ZHTG2T5Y.js +1 -0
  181. package/dist/{chunk-4IAGBAQD.js → chunk-ZY353ZNN.js} +1 -1
  182. package/dist/{chunk-Y5VFOLNQ.js → chunk-ZYZU37KT.js} +1 -1
  183. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  184. package/dist/cli/commands/app/build.js +1 -1
  185. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  186. package/dist/cli/commands/app/bulk/execute.js +1 -1
  187. package/dist/cli/commands/app/bulk/status.js +1 -1
  188. package/dist/cli/commands/app/config/link.js +1 -1
  189. package/dist/cli/commands/app/config/pull.js +1 -1
  190. package/dist/cli/commands/app/config/use.js +1 -1
  191. package/dist/cli/commands/app/config/validate.js +1 -1
  192. package/dist/cli/commands/app/demo/watcher.js +1 -1
  193. package/dist/cli/commands/app/deploy.js +1 -1
  194. package/dist/cli/commands/app/dev/clean.js +1 -1
  195. package/dist/cli/commands/app/dev.js +1 -1
  196. package/dist/cli/commands/app/env/pull.js +1 -1
  197. package/dist/cli/commands/app/env/show.js +1 -1
  198. package/dist/cli/commands/app/execute.js +1 -1
  199. package/dist/cli/commands/app/function/build.js +1 -1
  200. package/dist/cli/commands/app/function/info.js +1 -1
  201. package/dist/cli/commands/app/function/replay.js +1 -1
  202. package/dist/cli/commands/app/function/run.js +1 -1
  203. package/dist/cli/commands/app/function/schema.js +1 -1
  204. package/dist/cli/commands/app/function/typegen.js +1 -1
  205. package/dist/cli/commands/app/generate/extension.js +1 -1
  206. package/dist/cli/commands/app/graphiql.js +1 -1
  207. package/dist/cli/commands/app/import/channel-config.js +1 -1
  208. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  209. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  210. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  211. package/dist/cli/commands/app/import-extensions.js +1 -1
  212. package/dist/cli/commands/app/info.js +1 -1
  213. package/dist/cli/commands/app/init.js +1 -1
  214. package/dist/cli/commands/app/logs.js +1 -1
  215. package/dist/cli/commands/app/release.js +1 -1
  216. package/dist/cli/commands/app/security/check.js +1 -1
  217. package/dist/cli/commands/app/security/clean.js +1 -1
  218. package/dist/cli/commands/app/security/instructions.js +1 -1
  219. package/dist/cli/commands/app/security/record.js +1 -1
  220. package/dist/cli/commands/app/security/review.js +1 -1
  221. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  222. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  223. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  224. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  225. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  226. package/dist/cli/commands/app/versions/list.js +1 -1
  227. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  228. package/dist/cli/commands/auth/login.js +1 -1
  229. package/dist/cli/commands/auth/logout.js +1 -1
  230. package/dist/cli/commands/cache/clear.js +1 -1
  231. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  232. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  233. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  234. package/dist/cli/commands/debug/command-flags.js +1 -1
  235. package/dist/cli/commands/doc/fetch.js +1 -1
  236. package/dist/cli/commands/doc/search.js +1 -1
  237. package/dist/cli/commands/docs/generate.js +1 -1
  238. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  239. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  240. package/dist/cli/commands/help.js +1 -1
  241. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  242. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  243. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  244. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  245. package/dist/cli/commands/notifications/generate.js +1 -1
  246. package/dist/cli/commands/notifications/list.js +1 -1
  247. package/dist/cli/commands/organization/list.js +1 -1
  248. package/dist/cli/commands/search.js +1 -1
  249. package/dist/cli/commands/send-analytics.js +1 -1
  250. package/dist/cli/commands/theme/check.js +1 -1
  251. package/dist/cli/commands/theme/console.js +1 -1
  252. package/dist/cli/commands/theme/delete.js +1 -1
  253. package/dist/cli/commands/theme/dev.js +1 -1
  254. package/dist/cli/commands/theme/duplicate.js +1 -1
  255. package/dist/cli/commands/theme/info.js +1 -1
  256. package/dist/cli/commands/theme/init.js +1 -1
  257. package/dist/cli/commands/theme/language-server.js +1 -1
  258. package/dist/cli/commands/theme/list.js +1 -1
  259. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  260. package/dist/cli/commands/theme/open.js +1 -1
  261. package/dist/cli/commands/theme/package.js +1 -1
  262. package/dist/cli/commands/theme/preview.js +1 -1
  263. package/dist/cli/commands/theme/profile.js +1 -1
  264. package/dist/cli/commands/theme/publish.js +1 -1
  265. package/dist/cli/commands/theme/pull.js +1 -1
  266. package/dist/cli/commands/theme/push.js +1 -1
  267. package/dist/cli/commands/theme/rename.js +1 -1
  268. package/dist/cli/commands/theme/share.js +1 -1
  269. package/dist/cli/commands/upgrade.js +1 -1
  270. package/dist/cli/commands/version.js +1 -1
  271. package/dist/cli/help.js +1 -1
  272. package/dist/{command-json-schema-3RP5P43D.js → command-json-schema-V4OTY4MX.js} +1 -1
  273. package/dist/command-registry.js +1 -1
  274. package/dist/{conf-store-XORTWCKZ.js → conf-store-LWBJNYPC.js} +1 -1
  275. package/dist/{custom-oclif-loader-ZRYPPYIP.js → custom-oclif-loader-KS3MBI4W.js} +1 -1
  276. package/dist/{deprecations-AZDMCRNN.js → deprecations-NAJ4JNON.js} +1 -1
  277. package/dist/dist-HTXIQ6TQ.js +1 -0
  278. package/dist/dist-XYFXZS4I.js +1 -0
  279. package/dist/environments-65BJOXLA.js +1 -0
  280. package/dist/{error-H6B5BHYC.js → error-TTZRUUUI.js} +1 -1
  281. package/dist/error-handler-TJG7IDLT.js +1 -0
  282. package/dist/{fs-XHZY6MNM.js → fs-VHUA5OHC.js} +1 -1
  283. package/dist/hooks/did-you-mean.js +1 -1
  284. package/dist/hooks/hydrogen-init.js +1 -1
  285. package/dist/hooks/postrun.js +1 -1
  286. package/dist/hooks/prerun.js +1 -1
  287. package/dist/hooks/public-metadata.js +1 -1
  288. package/dist/hooks/sensitive-metadata.js +1 -1
  289. package/dist/hooks/tunnel-provider.js +1 -1
  290. package/dist/hooks/tunnel-start.js +1 -1
  291. package/dist/index.js +1 -1
  292. package/dist/{is-global-2NBDZWLC.js → is-global-7BDGLRND.js} +1 -1
  293. package/dist/{json-error-OHV2KQFY.js → json-error-OSDR2S56.js} +1 -1
  294. package/dist/{local-ZZGRGYUP.js → local-BQ5FJYX6.js} +1 -1
  295. package/dist/{metadata-YQNVKC2R.js → metadata-GFLDQ2I7.js} +1 -1
  296. package/dist/{node-package-manager-LN2Y7FQ2.js → node-package-manager-FQZ7XFU4.js} +1 -1
  297. package/dist/notifications-system-BESW6Q65.js +1 -0
  298. package/dist/{os-MHOCCDIB.js → os-GPZXOHDI.js} +1 -1
  299. package/dist/{output-GILH4S6M.js → output-TLYSXAUL.js} +1 -1
  300. package/dist/{system-6WYK24ET.js → system-KVPOFMPA.js} +1 -1
  301. package/dist/tsconfig.tsbuildinfo +1 -1
  302. package/dist/{ui-RP6SVJUK.js → ui-CM3VQLC2.js} +1 -1
  303. package/dist/upgrade-CPOWDAOD.js +1 -0
  304. package/dist/version-ILYYDNX7.js +1 -0
  305. package/dist/version-SN7J7ZYL.js +1 -0
  306. package/dist/{workerd-ARH2OCYL.js → workerd-SBI5B2H5.js} +1 -1
  307. package/oclif.manifest.json +1 -1
  308. package/package.json +7 -7
  309. package/dist/analytics-PBZEKUGU.js +0 -1
  310. package/dist/analytics-WVGBNFGK.js +0 -1
  311. package/dist/chunk-5SLKHURV.js +0 -1
  312. package/dist/chunk-AHNLGCHF.js +0 -5
  313. package/dist/chunk-ARRRFY6S.js +0 -4
  314. package/dist/chunk-CBFAU5AF.js +0 -5
  315. package/dist/chunk-DYH3ZXJS.js +0 -15
  316. package/dist/chunk-GJZVUEMP.js +0 -11
  317. package/dist/chunk-GP6O7YRO.js +0 -20
  318. package/dist/chunk-GYVQIRBD.js +0 -1
  319. package/dist/chunk-HY6EXJBZ.js +0 -1
  320. package/dist/chunk-NHE46R6C.js +0 -3
  321. package/dist/chunk-OHJUEUSA.js +0 -1
  322. package/dist/chunk-TVI7TQ4C.js +0 -16
  323. package/dist/chunk-XI4QEULN.js +0 -1
  324. package/dist/dist-DTBXLVHF.js +0 -1
  325. package/dist/dist-SOYIDACZ.js +0 -1
  326. package/dist/environments-L42SEHB4.js +0 -1
  327. package/dist/error-handler-JB752NKM.js +0 -1
  328. package/dist/notifications-system-HWJ3F44U.js +0 -1
  329. package/dist/upgrade-5G7FBJJV.js +0 -1
  330. package/dist/version-TOBC7X2C.js +0 -1
  331. package/dist/version-UIRCT6RC.js +0 -1
@@ -0,0 +1,20 @@
1
+ import{a as Dt}from"./chunk-UOHNRH6E.js";import{a as Ar}from"./chunk-S43YCHAN.js";import{b as Cr}from"./chunk-D65CUTKT.js";import{a as Ir}from"./chunk-A5RXJNQ5.js";import{a as kr}from"./chunk-VMMPBOTN.js";import{a as Lr}from"./chunk-SPWX6OQR.js";import{a as yr}from"./chunk-RV54HI5A.js";import{a as vr}from"./chunk-LXCVWQK4.js";import{a as Pr,b as xr,c as Er,d as br}from"./chunk-FX27WXGC.js";import{a as Tr}from"./chunk-5WN5FGRS.js";import{a as Sr}from"./chunk-OTQUZLAC.js";import{a as Ur}from"./chunk-VI7XF2HZ.js";import{a as _r}from"./chunk-27WWE5QN.js";import{a as Rr}from"./chunk-ON4RFEHN.js";import{a as cr}from"./chunk-OYMJI3MD.js";import{a as ur}from"./chunk-5EVQSYMN.js";import{a as dr}from"./chunk-PCWXGO4K.js";import{a as mr}from"./chunk-6HC6JBXZ.js";import{g as fr}from"./chunk-N5YS4PAM.js";import{a as tt}from"./chunk-A7KQUQLZ.js";import{c as et,m as rt}from"./chunk-3CSRZM3Q.js";import{a as hr}from"./chunk-MLZAI55C.js";import{a as gr}from"./chunk-Y4USH7MD.js";import{a as pr}from"./chunk-ZYZU37KT.js";import{b as lr,g as ke,j as Ze}from"./chunk-4GD2RMV4.js";import{a as mo,b as ho,c as go,d as wo}from"./chunk-QYV5QN44.js";import{d as wr}from"./chunk-6I5ATJK6.js";import{a as ar,b as ir,c as po,d as uo,e as st,f as fo,g as yo}from"./chunk-NY5ESCDK.js";import{a as M,b as Xe}from"./chunk-VEYIT46B.js";import{a as er,b as tr,d as Ce,f as rr,m as Ie,n as H,s as N,u as or,v as nr,w as sr}from"./chunk-Q7BOSHWX.js";import{a as Zt}from"./chunk-3EY3ULS6.js";import{a as oo,b as nt,c as oe,d as no}from"./chunk-IRF43DMG.js";import{a as vo,f as Po,g as xo,h as at,i as Eo,j as bo,k as So,l as Uo,m as Ro,n as Ao,o as To,p as _o,q as Co,v as Io,x as ko,z as it}from"./chunk-NQ5PKMPV.js";import{a as so,b as ao,c as io,d as co,e as lo}from"./chunk-V2XUMMTV.js";import{a as Mr}from"./chunk-WQG4QDC5.js";import{a as ro}from"./chunk-6AFURA34.js";import{a as to}from"./chunk-XUZXQC5H.js";import{a as $r}from"./chunk-TFVIG4I7.js";import{Ha as eo,I as jr,K as Vr,M as re,W as zr,X as Xr,ha as Zr,i as Fr,j as q,k as Dr,o as Nr,t as ot,u as qr,v as Wr,w as Hr,x as Gr,y as Br,ya as $e,z as Kr,za as Me}from"./chunk-X4767EMJ.js";import{B as Or,aa as Yr,ba as Le,ca as Qr,p as te,pa as Jr,u as le}from"./chunk-X5VPFSL3.js";import{d as Jt}from"./chunk-BYZU7YS7.js";import{a as V}from"./chunk-SUIVO7GI.js";import{b as Xt,e as _e}from"./chunk-DWMRVMKX.js";import{J as Lt,V as Z,X as $t,c as Tt,h as _t,j as Ct,m as It,na as Mt,o as kt,p as Pe,u as xe}from"./chunk-2TCPTRLF.js";import{A as ie,H as Re,L as jt,N as Ae,S as Te,T as ce,U as Je,V as Vt,X as zt,a as At,d as Ee,e as k,f as $,h as be,i as Se,j as Ot,k as Nt,l as qt,m as Wt,n as Ht,o as F,p as Gt,q as Ye,r as Qe,s as Bt,t as Kt,y as Ue}from"./chunk-J6XOTLT5.js";import{b as ze,d as Ut,f as ve,i as Rt}from"./chunk-HILYTMVA.js";import{a as Mn}from"./chunk-7UNQOKZW.js";import{d as Ft}from"./chunk-6MELTJU3.js";import{i as A,l as ee}from"./chunk-QF453PH7.js";import{a as Lo}from"./chunk-QFMATBKM.js";import{Aa as ge,Cb as x,Eb as b,Ia as Et,Kb as j,Nb as g,Ob as _,Ra as we,T as Ve,Xa as D,_a as ye,db as bt,gb as St,qa as L,ya as he}from"./chunk-QY73XOBU.js";import{e as Yt,g as Qt}from"./chunk-JTEP5MP2.js";import{b as $n}from"./chunk-I3J63RFV.js";import{a as de}from"./chunk-JD5P5RAJ.js";import{c as U,e as je,f as yt,h as fe,i as vt,j as me,n as Pt,o as xt}from"./chunk-6IDEDOXW.js";import{e as X,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var Fn=300*1e3,Dn='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function $o(t,e,r=Date.now()){for(;await On(t,e,r););}async function On(t,e,r){let o=await ke(t,e);if(!o||Nn(o,r))throw new A(Dn);return await ce(3),o.processing}function Nn(t,e){return t.processing&&Date.now()-e>=Fn}var qn="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",Wn="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",ct=3,Fe=class extends pr{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=Pr(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??=this.devPreview?await this.createHostTheme():await this.create(),e}setTheme(e){xr(this.adminSession.storeFqdn,e)}removeTheme(){Er(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:lr,name:this.generateThemeName(this.context),src:qn};for(let o=0;o<ct;o++){g(`Attempt ${o}/${ct}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await Ze(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),g(`Waiting for theme with id "${n.id}" to be processed`),await $o(n.id,this.adminSession),n;throw new Error}catch{g(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}g(`Theme creation failed after ${ct} retries. Creating theme using fallback theme zip`);let r=await Ze({...e,src:Wn},this.adminSession);if(!r)throw g("Theme creation failed. Exiting process."),new ee(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var Hn={"theme:init":yr,"theme:check":cr,"theme:console":ur,"theme:delete":dr,"theme:dev":mr,"theme:duplicate":hr,"theme:info":gr,"theme:language-server":vr,"theme:list":br,"theme:metafields:pull":Tr,"theme:open":Sr,"theme:package":Ur,"theme:profile":Rr,"theme:publish":Ar,"theme:preview":_r,"theme:pull":Cr,"theme:push":Ir,"theme:rename":kr,"theme:share":Lr},Fa=Hn;async function Mo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(R=>R.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,f]=await Promise.all([Lt(t.storeFqdn),Kn(e)]),l=c.storeFqdn,[u,h]=await Promise.all([rt(c),et(c)]),y=h?await tt(t.storePassword,l,u):void 0,d=await Bn(c,t.theme),m=d.id.toString();return Ue({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:f}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${m}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:Gn,options:{theme:d,adminSession:c,storefrontPassword:y,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var Gn=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await fr(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function Bn(t,e){let r;if(e)g(`Fetching theme with provided id ${e}`),r=await ke(parseInt(e,10),t);else{let o=new Fe(t,{devPreview:!0});await Re([{title:"Configuring host theme for theme app extension",task:async()=>{g("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new A("Could not find or create a host theme for theme app extensions");return r}async function Kn(t){return t.developerPlatformClient?.clientName===Jr.AppManagement?`https://${await Pe()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await kt()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function jn(t){let e=U(t.directory,"locales");return ye([U(e,"*.json")])}async function Fo(t,e){let r=await jn(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),Vn(a,s,o,t,e)})),o.lastUpdated=Date.now(),g(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function Vn(t,e,r,o,n){let s;try{s=await L(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw _(i,n.stderr),new Error(i)}}p();function De(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}var lt=".js.map";async function ne(t,e,r,o){return F({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await Fo(t,r),c=await Dr(t),f=t.outputRelativePath?fe(n):n,l=await zn(t,s,f,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=Do(t.configuration.metafields)),{assets:{main:pe(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await we(n)??0}},supportedFeatures:{runsOffline:t.configuration.supported_features?.runs_offline??!1},capabilities:{blockProgress:t.configuration.capabilities?.block_progress??!1,networkAccess:t.configuration.capabilities?.network_access??!1,apiAccess:t.configuration.capabilities?.api_access??!1,collectBuyerConsent:{smsMarketing:t.configuration.capabilities?.collect_buyer_consent?.sms_marketing??!1,customerPrivacy:t.configuration.capabilities?.collect_buyer_consent?.customer_privacy??!1},iframe:{sources:t.configuration.capabilities?.iframe?.sources??[]}},development:{...r.currentDevelopmentPayload,resource:De(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:l,localization:a??null,metafields:u,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:c?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function zn(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),pe(s)){let a=await Yn(r);return Promise.all(s.map(async i=>{let{target:c,resource:f}=i,l="metafields"in i?Do(i.metafields??[]):void 0,u={...i,...l?{metafields:l}:{},surface:Me(c),root:{url:`${e}/${c}`},resource:f||{url:""}},h=a?.[c];if(!h)return u;let d=await ts(h,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...u,...d}}))}return s}async function Yn(t){try{let e=U(t,"manifest.json"),r=await L(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function Qn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,c=e[s];if(typeof c=="string"){let y=await Oe(s,i,typeof a=="string"?a:c,r,o,n,typeof a=="string"?c:void 0);return{assets:{[y.name]:y}}}let l=e.build_manifest?.assets?.[s];if(l?.filepath){let u=await Oe(s,i,l.filepath,r,o,n,l.module);return{assets:{[u.name]:u}}}return{}}async function Jn({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await we(U(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function Xn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,c)=>{let f=i.schema,l=s[c]?.schema,u=typeof l=="string"?l:f,h=typeof l=="string"?f:void 0;return{...i,schema:await Oe("schema",`${t}/intents/${c}/schema`,u,r,o,n,h)}}))}:{}}async function Zn({target:t,url:e,extension:r,resolver:o},n,s){let a=await Oe(n,`${t}/${n}`,s,e,r,o);return await es(t,s,r,o),{assets:{[a.name]:a}}}async function es(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(lt)&&await D(U(r.directory,n))&&o.set(`${t}/${vt(n)}`,n)}async function ts(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return rs(o,n)?Xn(e,n):os(o,n)?Zn(e,o,n):ns(o,n)?Jn(e,o,n):Qn(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Do(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function pe(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Oe(t,e,r,o,n,s,a){let i=`${e}${me(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await we(U(n.directory,a??r))??0}}function rs(t,e){return t==="intents"&&Array.isArray(e)}function os(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function ns(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as ss}from"events";var ue;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(ue||(ue={}));async function Oo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:po(t.storeFqdn,t.apiKey),mobileUrl:fo(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>ne(n,e,t,r&&pt(r,n.devUUID))))}}function pt(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var Ne=class extends ss{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=Z(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(pe(n.extensionPoints)&&pe(o.extensionPoints)){let s=n.extensionPoints.reduce((c,f)=>({...c,[f.target]:f}),{});o.extensionPoints=Z(o.extensionPoints,n.extensionPoints,c=>c.map(f=>{let l=s[f.target];return l?Z(f,l,(u,h)=>h):f}));let{extensionPoints:a,...i}=n;return Z(o,i)}return Z(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){g(b`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await ne(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},pt(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await ne(e,r,this.options,pt(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(ue.Update,e)}};p();p();var z;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(z||(z={}));function No(t,e){return(r,o,n)=>{r.url==="/extensions"&&(g("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,as(t,e)))}}function as(t,e){return r=>{g("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};g(b`Sending connected payload: ${x.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",us(t,e))}}function is(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?x.json(o).output():String(o)).join(" ");return b`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var cs={debug:t=>x.gray(t),warn:t=>x.yellow(t),error:t=>x.errorText(t)};function ls({type:t,message:e}){let r=is(e);switch(t){case"debug":case"warn":case"error":return b`${cs[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function ps(t,e){F({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(ls(t))})}function us(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(g(b`Received websocket message with event type ${n} and data:
2
+ ${x.json(s)}
3
+ `,e.stdout),n===z.Update){let a=e.payloadStore.getRawPayload().app.apiKey,i=s.app?.apiKey;if(s.app){if(a!==i)return;e.payloadStore.updateApp(s.app)}s.extensions&&e.payloadStore.updateExtensions(s.extensions)}else if(n===z.Dispatch){let a=ds(o,e);Wo(t,a,e)}else n===z.Log&&ps(s,e)}}function qo(t,e){return r=>{let o={event:z.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};g(b`Sending websocket update event to the websocket clients:
4
+ ${x.json(o)}
5
+ `,e.stdout),Wo(t,o,e)}}function Wo(t,e,r){g(b`Sending websocket with event type ${e.event} and data:
6
+ ${x.json(e.data)}
7
+ `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function ds(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var fs=10;function Ho(t){let e=new Dt.default({noServer:!0,clientTracking:!0}),r=ms(e);return t.httpServer.on("upgrade",No(e,t)),t.payloadStore.on(ue.Update,qo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function ms(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},fs*1e3)}p();p();p();function Go(t,e){let{url:r}=De(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",qe(t,e)),o.toString()}}function Bo(t,e,r){let o=Me(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(n.pathname=r.checkoutCartUrl,n.searchParams.set("script_url",`${r.url}/extensions/${e.devUUID}/assets/${e.localIdentifier}.js`),n.searchParams.set("post_purchase_dev_api_key",r.apiKey),e.devUUID&&r.websocketURL&&(n.searchParams.set("uuid",e.devUUID),n.searchParams.set("socket_url",r.websocketURL)),"metafields"in e.configuration){let s={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(s))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",qe(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=hs(e,r,t);break;default:return}return n.toString()}function hs(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function qe(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function O(t,e){tr(t,er(e))}p();var ut=class extends ee{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function Ko(t){let e=await gs(t),r=await L(e);return Zt(r,t.data)}async function gs(t){let e=await ws(),r=[];t.extensionSurface&&r.push(U(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(U(e,`${t.template}.html.liquid`));let o=await ye(r);if(o.length===0)throw new ut(t);return o[0]}async function ws(){return await bt("templates/ui-extensions/html",{type:"directory",cwd:xt(import.meta.url)})}var jo=N(t=>{H(t,"Access-Control-Allow-Origin","*"),H(t,"Access-Control-Allow-Methods","GET, OPTIONS"),H(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),Vo=N(t=>{H(t,"Cache-Control","no-cache")}),dt=N(async t=>Ie(t,"/extensions",307));async function ys(t,e){let{filePath:r}=e;if(!await D(r))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Et(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await D(r)))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await L(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".map":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},s=me(r),a=n[s]||"text/plain";return H(t,"Content-Type",a),o}function zo({getExtensions:t,payloadStore:e}){return N(async r=>{let{extensionId:o,assetPath:n=""}=Ce(r),s=t().find(h=>h.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),c=i??n,f=c.endsWith(lt);if(f&&i===void 0)return O(r,{statusCode:404,statusMessage:"Not Found"});let l=je(f?s.directory:Nr(s.outputPath)),u=je(U(l,c));return Pt(l,u)?ys(r,{filePath:u}):O(r,{statusCode:404,statusMessage:"Not Found"})})}function ft({payloadStore:t}){return N(e=>(H(e,"content-type","application/json"),t.getRawPayload()))}function Yo({devOptions:t}){return N(e=>{g(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function mt({devOptions:t,getExtensions:e}){return N(async r=>{let{extensionId:o}=Ce(r),n=e().find(i=>i.devUUID===o);if(!n)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(rr(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return Ko({data:{url:qe(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=Go(n,t);return Ie(r,i,307)}}let a=t.appWatcher.buildOutputPath;return H(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:se(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await ne(n,a,t)}})}function Qo({devOptions:t,getExtensions:e}){return N(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ce(r),s=e().find(i=>i.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return O(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=Bo(n,s,t);return a?Ie(r,a,307):O(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as vs}from"http";function Jo(t){let e=or(),r=nr();e.use(Yo(t)),e.use(jo),e.use(Vo),r.use("/extensions/dev-console",dt),r.use("/extensions/:extensionId",mt(t)),r.use("/extensions/:extensionId/",mt(t)),r.use("/extensions/:extensionId/:extensionPointTarget",Qo(t)),r.use("/extensions/:extensionId/assets/**:assetPath",zo(t)),r.use("/extensions",ft(t)),r.use("/extensions/",ft(t)),r.use("/",dt),e.use(r);let o=vs(sr(e));return o.listen(t.devOptions.port,"localhost"),o}async function Xo(t){let e={...t,websocketURL:se(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Oo(e,r,o),s=new Ne(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;g("Setting up the UI extensions HTTP server...",e.stdout);let c=Jo({devOptions:e,payloadStore:s,getExtensions:i});g("Setting up the UI extensions Websocket server...",e.stdout);let f=Ho({...e,httpServer:c,payloadStore:s});g("Setting up the UI extensions bundler and file watching...",e.stdout);let l=async({appWasReloaded:u,app:h,extensionEvents:y})=>{u&&(a=h.allExtensions.filter(d=>d.isPreviewable));for(let d of y){if(!d.extension.isPreviewable)continue;let m=d.buildResult?.status==="ok"?"success":"error",R=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case oe.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let E=await $e(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(d.extension,r);break;case oe.Updated:await s.updateExtension(d.extension,e,r,{status:m,error:R});break;case oe.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{g("Closing the UI extensions dev server..."),f.close(),c.close()})}function se(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Ps="3",xs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:f,appName:l,appDotEnvFile:u,appId:h,grantedScopes:y,allExtensions:d,appDirectory:m,appWatcher:R})=>{await Xo({appName:l,appDotEnvFile:u,appDirectory:m,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:f,port:i,storeFqdn:xe(n),storeId:s,apiKey:o,grantedScopes:y,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:Ps,appWatcher:R})};async function Zo({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await $e(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:xs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function Y(t){let e=t.find(o=>re(o,q.Frontend)),r=t.find(o=>re(o,q.Backend));return{frontendConfig:e,backendConfig:r}}p();async function en(t){let r={topic:"app/uninstalled",api_version:(await mo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:wo.LOCALHOST,shared_secret:t.sharedSecret},o=await ho(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ce(3);let n=await Es(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Es(t,e){let r=0;for(;r<3;){try{return await go(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof _t&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ce(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var bs=async({stdout:t},e)=>{await en({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function tn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=Y(t),c=t.map(({configuration:l})=>l.webhooks_path).find(l=>l)??"/api/webhooks";if(c&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:bs,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}p();async function rn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ss}}var Ss=async({stdout:t,abortSignal:e},r)=>{let o=yo({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=ir({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",()=>{n.close()})};p();async function nn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=Y(t),c=i?.configuration.hmr_server?await M():void 0,f=void 0,l=t.map(async u=>{let h=await Us({web:u,frontendPort:r,backendPort:o}),y=c&&u.configuration.roles.includes(q.Frontend)?{port:c,httpPaths:u.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:u.configuration.name??["web",...u.configuration.roles].join("-"),function:Rs,options:{port:h,portFromConfig:u.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:u.directory,devCommand:u.configuration.commands.dev,preDevCommand:u.configuration.commands.predev,scopes:a,shopCustomDomain:f,hmrServerOptions:y,roles:u.configuration.roles}}});return Promise.all(l)}async function Us({web:t,frontendPort:e,backendPort:r}){return re(t,q.Frontend)?e:re(t,q.Backend)?r:M()}async function Rs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:f,devCommand:l,preDevCommand:u,scopes:h,shopCustomDomain:y,hmrServerOptions:d}){let m=d?.port,R={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...y&&{SHOP_CUSTOM_DOMAIN:y},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${c}`,...m&&{HMR_SERVER_PORT:`${m}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:f,port:o,env:R,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await on({...E,command:u,showOutput:Yt()})),await on({...E,command:l,showOutput:!0})}async function on({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(f=>f.trim())??[];for(let f of c){let[l,...u]=f.split(" ");l?.length!==0&&await Te(l,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var We=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(b`${x.yellow(e)}`.value)}async success(e){await this.log(b`${x.green(e)}`.value)}async debug(e){g(e,this.stdout)}async error(e,r){let o=x.errorText("\u274C Error"),n=x.errorText(`\u2514 ${e}`);await this.log(b`${o}`.value,r),await this.log(b`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],a=(await Promise.all(n.map(async c=>c.type===oe.Deleted?[]:(await c.extension.getDevSessionUpdateMessages(o))?.map(l=>({message:l,prefix:c.extension.handle}))??[]))).flat(),i=a.map((c,f)=>{let l=b`${x.gray(f===a.length-1?"\u2514 ":"\u2502 ")}${c.message}`.value;return this.log(l,c.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=x.errorText("\u274C Error");await this.log(b`${r}`.value,"app-preview");let o=e.map(n=>{let s=x.errorText(`\u2514 ${n.error}`);return this.log(b`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await F({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(e)})}};p();var He=class{processBatch;queue=[];processingPromise=void 0;constructor(e){this.processBatch=e}enqueue(e){this.queue.push(e),this.processingPromise??=this.startProcessing()}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var Ge=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}statusManager;logger;options;appWatcher;bundlePath;appEventsProcessor;failedEvents=[];currentSessionState=null;constructor(e,r){this.statusManager=e.devSessionStatusManager,this.logger=new We(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new He(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=oo(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${nt(n)}ms - Total: ${nt(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let a of e)for(let i of a.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new A(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR"),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){e.status==="updated"?(await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage()):e.status==="created"?(this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY")):(e.status==="remote-error"||e.status==="unknown-error")&&(await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR"):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR"))),!this.statusManager.status.isReady&&!Qt()&&setImmediate(()=>{throw new A("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=se(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new Error("Unauthorized");if(r instanceof Tt)throw r.response.status===401||r.response.status===403?new A("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new A("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await so(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await St(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=U(fe(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...ao];r&&n.push("manifest.json"),await io(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await co(s,o),s}async getSignedURLWithRetry(){return lo(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],s=r.devSessionUpdate?.devSession;if(s&&this.currentSessionState){let a=se(this.options.url),i=this.currentSessionState?.userId;if(s.websocketUrl!==a||s.user?.id!==i){let c=s.user?.email;await this.logger.error(`Another developer ${c?`(${c}) `:""}has taken ownership of this dev preview.`);let f=`Another user${c?` (${c})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,l=["You can restart by running",{command:"shopify app dev"},"again."];throw new A(f,l)}this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function sn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:As,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var As=async({stdout:t},e)=>{await Ge.start(e,t)};p();p();p();var an=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=Ut().substring(0,6),i=`${Ts(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=ko({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),f=U(n,i);try{return await ge(n),await he(f,c),{fullOutputPath:f,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
8
+ `),l}};function Ts(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),c=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${c}Z`}var Be=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:f=0})=>{if(!i?.aborted)try{let l=e,u=xo,h=f,y=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:m}=y;if(m===200){h=0;let{app_logs:E}=y;for(let S of E){let P=JSON.parse(S.payload);await F({outputPrefix:S.source,stripAnsi:!1},async()=>{S.log_type===So?(_s(S,P,t),P=new vo(Po(P))):S.log_type.startsWith(Uo)?Cs(S,P,t):t.write(JSON.stringify(P));let C=await an({appLog:S,appLogPayload:P,stdout:t,storeName:s,logsDir:c});t.write(b`${x.gray("\u2514 ")}${x.link("Open log file",`file://${C.fullOutputPath}`,`Log: ${C.fullOutputPath}`)} ${x.gray(`(${C.identifier})`)}\n`.value)})}}else{let E={errors:d.map(P=>({message:P,status:m}))},S=await Io({response:E,onThrottle:P=>{_("Request throttled while polling app logs.",t),_(`Retrying in ${P/1e3} seconds.`,t)},onUnknownError:P=>{_("Error while polling app logs.",t),_(`Retrying in ${P/1e3} seconds.`,t)},onResubscribe:()=>n()});if(S.resubscribeResult==="failed"){if(h+=1,h>=Eo){_("App log streaming session has expired. Please restart your dev session.",t);return}}else S.resubscribeResult==="succeeded"&&(h=0);S.nextJwtToken&&(l=S.nextJwtToken),u=S.retryIntervalMs}let{cursor:R}=y;setTimeout(()=>{Be({stdout:t,appLogsFetchInput:{jwtToken:l,cursor:R??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:h}).catch(E=>{g(`Unexpected error during polling: ${E}}
9
+ `)})},u)}catch(l){_("Error while polling app logs.",t),_(`Retrying in ${at/1e3} seconds.`,t),g(`${l}}
10
+ `),setTimeout(()=>{Be({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c}).catch(u=>{g(`Unexpected error during polling: ${u}}
11
+ `)})},at)}};function _s(t,e,r){let o=(e.fuel_consumed/bo).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
12
+ `).filter(Boolean).map(s=>b`${x.gray("\u2502 ")}${s}`.value).join(`
13
+ `))}function Cs(t,e,r){t.log_type===Ro?r.write("Function network access response retrieved from cache."):t.log_type===Ao?e.reason===_o?r.write("Function network access request executing in background because there is no cached response."):e.reason===Co&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===To&&(t.status==="success"?r.write("Function network access request executed successfully."):t.status==="failure"&&r.write(`\u274C Function network access request failed to execute with error: ${e.error}.`))}function Is(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function cn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:ks,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var ks=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:c})=>{async function f(l){let u=await it(o,n,a,t),h=c.getLogsDir();await ge(h),await Be({stdout:t,appLogsFetchInput:{jwtToken:u},resubscribeCallback:()=>it(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:l,logsDir:h})}try{let l=!1,u,h=async y=>{let d=Is(y.app);if(d&&!l){g("Function extensions detected, starting logs polling"),l=!0,u=new AbortController;try{await f(u.signal)}catch(m){g(`Failed to start function logs: ${m}`,e)}}else!d&&l&&(g("No function extensions detected, stopping logs polling"),l=!1,u?.abort(),u=void 0)};i.onStart(h).onEvent(h)}catch{}};p();async function ln(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:Ls}}var Ls=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};p();import{EventEmitter as $s}from"events";var Ms={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},Ke=class extends $s{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};$t(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e){this.updateStatus({statusMessage:Ms[e]})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as pn from"http";import*as un from"https";function dn(t){return"errors"in t&&Array.isArray(t.errors)}async function fn(t,e,r,o){let s=(await import("./http-proxy-node16-D3JUYA5D.js")).default.createProxyServer(),a=Ds(t,s,o),i=r?un.createServer(r,a):pn.createServer(a);return i.on("upgrade",Fs(t,s,o)),e.addEventListener("abort",()=>{g("Closing reverse HTTP proxy"),i.close()}),{server:i}}function Fs(t,e,r){return function(o,n,s){let a=mn(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let f=(dn(i)?i.errors[i.errors.length-1]:void 0)??i;_(`Error forwarding websocket request: ${f.message}`,r),_(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function Ds(t,e,r){return function(o,n){let s=mn(t,o);if(s)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:s},a=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let c=(dn(a)?a.errors[a.errors.length-1]:void 0)??a;_(`Error forwarding web request: ${c.message}`,r),_(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});g(b`
14
+ Reverse HTTP proxy error - Invalid path: ${o.url??""}
15
+ These are the allowed paths:
16
+ ${x.json(JSON.stringify(t))}
17
+ `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function mn(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}async function hn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:c,graphiqlKey:f,apiSecret:l}){let u=o.apiKey,h=ve(),y=!de(h[te.disableGraphiQLExplorer]),d=await Vr(t),m=l??(d.webs.length>0?await Le(o):void 0),R=y&&m!==void 0,E=new no(d,i.proxyUrl),S=await Pe(),P=uo(n,u,S),C=P,G=m===void 0?void 0:ar(f,m,n),B=R&&G?`http://localhost:${c}/graphiql?key=${encodeURIComponent(G)}`:void 0,W=d.configuration.embedded,K=d.nonConfigExtensions.length>0,v=new Ke({isReady:!1,previewURL:C,graphiqlURL:B,appEmbedded:W,hasExtensions:K}),J=[...m===void 0?[]:await nn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:u,apiSecret:m,scopes:Fr(d.configuration)}),R&&m!==void 0?await rn({appName:o.title,appUrl:P,port:c,apiKey:u,apiSecret:m,key:G,storeFqdn:n}):void 0,await Zo({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:u,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:E}),await sn({app:d,apiKey:u,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:E,appPreviewURL:P,devSessionStatusManager:v,unsafeValidation:a.unsafeValidation}),await Mo({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),m===void 0?void 0:tn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:m,remoteAppUpdated:e}),await cn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:u},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:E}),await ln({appWatcher:E})].filter(Os);return{processes:await Ns(J,i.proxyPort,i.reverseProxyCert),previewUrl:C,graphiqlUrl:B,devSessionStatusManager:v}}var Os=t=>t!==void 0&&t!==!1;async function Ns(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(q.Frontend)){let c=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${c}`;let f=a.options.hmrServerOptions;f&&(i.websocket=`http://localhost:${f.port}`,f.httpPaths.forEach(l=>i[l]=`http://localhost:${f.port}`)),a.options.port=c}else if(a.type==="previewable-extension"){let c=await M();i[a.options.pathPrefix]=`http://localhost:${c}`,a.options.port=c}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:qs,options:{port:e,rules:s,localhostCert:r}}),n}var qs=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await fn(o,t,n,e);j(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();async function gn({remoteApp:t,hasWebs:e,graphiqlEnabled:r}){if(e)return Le(t);if(!r)return;let o=await Yr(t);return o||_(`GraphiQL isn't available because the App Management API didn't return the app's client secret for your credentials. ${Qr()}`),o}p();p();p();var ae=X(Ee(),1);var wn=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function yn(){let[t,e]=(0,ae.useState)(0);return(0,ae.useEffect)(()=>{let r=setInterval(()=>{e(o=>(o+1)%wn.length)},70);return()=>clearInterval(r)},[]),ae.default.createElement($,null,wn[t])}p();var T=X(Ee(),1);var vn=.9,Pn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Ot(),{isRawModeSupported:o}=be(),[n,s]=(0,T.useState)(e),[a,i]=(0,T.useState)(Math.floor(r.columns*vn)),[c,f]=(0,T.useState)(!0),l=(0,T.useRef)(null);if(!n)throw new Error("No tabs provided");Se((d,m)=>{(async()=>{if(m?.leftArrow||m?.rightArrow||m?.tab){let P=Object.entries(t).filter(([K,v])=>v.content),C=P.findIndex(([K])=>K===n);if(C===-1)return;let G=m?.leftArrow?-1:1,B=(C+G+P.length)%P.length,W=P[B];W&&s(W[0])}let E=t[d];if(E){E.action?await E.action():s(d);return}let S=t[n];if(S?.shortcuts){let P=S.shortcuts.find(C=>C.key===d);P&&(!P.condition||P.condition())&&await P.action()}})()},{isActive:!!o}),(0,T.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*vn)),!l.current)return;let m=Nt(l.current);f(m.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let u=Object.entries(t).map(([d,m])=>({...m,inputKey:d,header:` (${d}) ${m.label} `})),h=u.filter(d=>!d.action),y=u.filter(d=>d.action);return T.default.createElement(T.default.Fragment,null,T.default.createElement(k,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},T.default.createElement(k,{ref:l,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},T.default.createElement($,{wrap:"truncate-end"},"\u2502",h.map(d=>T.default.createElement(T.default.Fragment,{key:d.inputKey},T.default.createElement($,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),c&&T.default.createElement(k,{flexGrow:1,justifyContent:"flex-end"},y.map((d,m)=>T.default.createElement($,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,m<y.length-1&&" \u2502 ")))),T.default.createElement(k,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var w=X(Ee(),1);var xn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:c,onAbort:f})=>{let{isRawModeSupported:l}=be(),[u,h]=(0,w.useState)(void 0),[y,d]=(0,w.useState)(void 0),[m,R]=(0,w.useState)(r.status),[E,S]=(0,w.useState)(!1),{isAborted:P}=Kt(t.signal,async v=>{v&&d(typeof v=="string"?v:v.message),r.status.isReady?S(!0):(h("Shutting down dev ..."),await f()),Lo()}),C=(0,w.useMemo)(()=>e.map(v=>({...v,action:async(J,wt,kn)=>{try{return await v.action(J,wt,kn)}catch(Ln){t.abort(Ln)}}})),[e,t]);(0,w.useEffect)(()=>(r.on("dev-session-update",R),()=>{r.off("dev-session-update",R)}),[]),Se((v,J)=>{Wt(v,J,()=>t.abort())},{isActive:!!l});let G=v=>{switch(v){case"loading":return w.default.createElement(yn,null);case"success":return"\u2705";case"error":return"\u274C"}},B=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:m.previewURL,condition:()=>!!(m.isReady&&m.previewURL),action:async()=>{await V.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),m.previewURL&&await Ae(m.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:st(o),condition:()=>!!(m.isReady&&m.appEmbedded===!1&&m.hasExtensions),action:async()=>{await V.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Ae(st(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:m.graphiqlURL,condition:()=>!!(m.isReady&&m.graphiqlURL),action:async()=>{await V.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),m.graphiqlURL&&await Ae(m.graphiqlURL)}}],W=B.filter(v=>v.condition?.()??!0),K={d:{label:"Dev status",shortcuts:B,content:w.default.createElement(w.default.Fragment,null,m.statusMessage&&w.default.createElement($,null,G(m.statusMessage.type)," ",m.statusMessage.message),l&&W.length>0&&w.default.createElement(k,{marginTop:1,flexDirection:"column"},W.map(v=>w.default.createElement($,{key:v.key},Ht.pointerSmall," ",w.default.createElement($,{bold:!0},"(",v.key,")")," ",Je()&&v.url?w.default.createElement(Ye,{url:v.url,label:v.shortcutLabel}):v.shortcutLabel))),w.default.createElement(k,{marginTop:l?1:0,flexDirection:"column"},u?w.default.createElement($,null,u):w.default.createElement(w.default.Fragment,null,m.isReady&&!(l&&Je())&&w.default.createElement(w.default.Fragment,null,W.filter(v=>v.url).map(v=>w.default.createElement($,{key:v.key},v.linkLabel," URL: ",w.default.createElement(Ye,{url:v.url})))))))},a:{label:"App info",content:w.default.createElement(k,{flexDirection:"column"},w.default.createElement(Qe,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":c??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,v])=>v)}))},s:{label:"Store info",content:w.default.createElement(k,{flexDirection:"column"},w.default.createElement(Qe,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,v])=>v)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return w.default.createElement(w.default.Fragment,null,w.default.createElement(Gt,{processes:C,prefixColumnSize:Or,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&w.default.createElement(k,{marginTop:1,flexDirection:"column"},w.default.createElement(Bt,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),P?null:w.default.createElement(k,{paddingTop:1,flexDirection:"column",flexGrow:1},l?w.default.createElement(Pn,{tabs:K,initialActiveTab:"d"}):w.default.createElement(k,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},K.d?.content)),y?w.default.createElement(k,{marginTop:1,flexDirection:"column"},w.default.createElement($,{color:"red"},y)):null)};var En=X(Ee(),1);async function bn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:c,organizationName:f,configPath:l,localURL:u}){if(Vt())return qt(En.default.createElement(xn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:c,organizationName:f,configPath:l,localURL:u,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await Ws({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o})}async function Ws({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){return process.stdout.write(`
18
+ Preview URL: ${e}
19
+ `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
20
+ `),Promise.all(t.map(async n=>{await n.action(process.stdout,process.stderr,o.signal)}))}p();function Sn(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];ie({headline:[`A random port will be used for ${n.for} because ${n?.requested} is not available.`],body:["If you want to use a specific port, you can choose a different one by setting the ",{command:n?.flagToRemedy}," flag."]});return}let r=Ve(e.map(n=>n.for)).join(" "),o=Ve(e.map(n=>({command:n.flagToRemedy})));ie({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}p();async function Un(t,e){return e?e.includes("localhost")?"localhost":(await It(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var Rn=X(Mn(),1);var Q="v1.4.4",An="FiloSottile/mkcert",ht=x.genericShellCommand("mkcert");async function Hs(t,e,r,o){let n=e[te.mkcertBinaryPath];if(n)return n;let a=U(t,r==="win32"?"mkcert.exe":"mkcert");if(await D(a))return a;let i=await(0,Rn.default)("mkcert",{nothrow:!0});return i?(g(b`Found ${ht} at ${x.path(i)}`),i):(await Gs(a,r,o),a)}async function Gs(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Q}-darwin-arm64`:`mkcert-${Q}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Q}-linux-arm64`:`mkcert-${Q}-linux-amd64`;break;case"win32":o=`mkcert-${Q}-windows-amd64.exe`;break;default:throw new ee(`Unsupported platform: ${e}`)}await wr(An,Q,o,t),g(b`${ht} saved to ${x.path(t)}`)}async function Bs(t){let e=U(t,"mkcert-LICENSE");if(await D(e))return;let r=`https://raw.githubusercontent.com/${An}/refs/tags/${Q}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await Ct(r),!n.ok)return o}catch{return o}let s=await n.text();await he(e,s)}async function Tn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=U(".shopify","localhost-key.pem"),a=U(".shopify","localhost.pem"),i=U(t,s),c=U(t,a);if(await D(i)&&await D(c))return{keyContent:await L(i),certContent:await L(c),certPath:a};if(!(e??await zr()))throw new A(`Localhost certificate and key are required at ${a} and ${s}`);let l="",u;return await Re([{title:"Finding or downloading mkcert binary",task:async()=>{let y=U(t,".shopify");l=await Hs(y,r,o,n),u=await Bs(y),g(b`${ht} found at: ${x.path(l)}`)}}]),u&&Ue(u),j(b`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Te(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),j(b`${x.successIcon()} Certificate generated at ${a}\n`),await zt()&&(ie({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),j("\u{1F449} Press any key to continue"),await jt(),j("")),{keyContent:await L(i),certContent:await L(c),certPath:yt(t,c)}}p();function _n(){let t=["Your app has extensions which need to be assigned",{command:"uid"},"identifiers."],e=["You must first map IDs to your existing extensions by running",{command:"shopify app deploy"},"interactively, without",{command:"--allow-updates"},"or",{command:"--allow-deletes"},", to finish the migration."],r={title:"Reference",body:{list:{items:[{link:{label:"Migrating from the Partner Dashboard",url:"https://shopify.dev/docs/apps/build/dev-dashboard/migrate-from-partners"}}]}}};throw new A(t,void 0,[e],[r])}async function Cn(t){let e=await Ks(t);await js(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await hn(e);await zs(e),await Js({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function Ks(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let S=await M();i=await Kr(t.commandConfig,S,"cloudflare")}let c=await Xr(r,o,s,r.flags);r.configuration=c;let f=await gn({remoteApp:r,hasWebs:e.webs.length>0,graphiqlEnabled:!de(ve()[te.disableGraphiQLExplorer])});Zr({app:e,remoteApp:r,selectedStore:n,cachedInfo:ot(t.directory),organization:t.organization,tunnelMode:a.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await Jt.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Mr(t.project);let l=t.graphiqlPort??await M(le.graphiql),u=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??le.graphiql,actual:l}];a.mode==="use-localhost"&&u.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),Sn(u);let{webs:h,...y}=await Qs(e.directory,e.webs,l,a,i,r.configuration,t.installMkcert);e.webs=h;let d=e.configuration.build?.automatically_update_urls_on_dev,m=ot(t.directory)?.previousAppId,R=r.apiKey,E=await Ys(h,t.update,y,e,d,r,R);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==m,localApp:e,developerPlatformClient:o,commandOptions:t,network:y,partnerUrlsUpdated:E,graphiqlPort:l,graphiqlKey:t.graphiqlKey,apiSecret:f}}async function js(t){await Vs(t)}async function Vs(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||_n()}async function zs(t){qr({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await Xs({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Mt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Ys(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=Y(t),f=!1;if((c??i)&&e){let l=Hr(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);f=await Br({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),f&&o.setDevApplicationURLs(l)}return f}async function Qs(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=Y(e);await Zs(e,r);let f=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:u,usingLocalhost:h},y,d]=await Promise.all([Wr(f),Rt()??i?.configuration.port??M(),Gr(s)]),m=h?`${l}:${u}`:l,R=c?.configuration.port;c&&(R??=c===i?y:await M(),c.configuration.port=R),R=R??await M();let E;if(o.mode==="use-localhost"){let{keyContent:S,certContent:P,certPath:C}=await Tn({appDirectory:t,forceInstall:a});E={key:S,cert:P,certPath:C,port:o.actualPort}}return{proxyUrl:m,proxyPort:u,frontendPort:R,backendPort:y,currentUrls:d,webs:e,reverseProxyCert:E}}async function Js({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new At,a=t.map(f=>({prefix:f.prefix,action:async(u,h,y)=>{let d=f.function;return d({stdout:u,stderr:h,abortSignal:y},f.options)}})),i=o.developerPlatformClient,c={id:o.remoteApp.id,developerPlatformClient:i};return bn({processes:a,previewUrl:e,graphiqlUrl:r,app:c,abortController:s,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl})}async function Xs(t){let e=await Un(t.devOptions.commandConfig,t.tunnelUrl);await V.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?ze(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:ze(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await V.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function Zs(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new A(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await Xe(n))throw new A(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await Xe(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new A(s,a)}})()])}p();async function In({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??le.localhost,n=await M(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new A(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var I=X($n(),1);var gt=class t extends to{static get requiresSyncAnalytics(){return!0}static summary="Run the app.";static descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";static description=this.descriptionForHelp();static flags={...Xt,...$r,"client-id":I.Flags.string({hidden:!1,description:"The Client ID of your app. Use with --config to run dev with that configuration for a different app than the one it is linked to.",env:"SHOPIFY_FLAG_CLIENT_ID"}),store:I.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>xe(e)}),"skip-dependencies-installation":I.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":I.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"unsafe-validation":I.Flags.boolean({description:"Allow app dev to continue with warnings for eligible app version validation failures.",env:"SHOPIFY_FLAG_UNSAFE_VALIDATION",default:!1}),"subscription-product-url":I.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":I.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":I.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":I.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",exclusive:["tunnel-url"]}),"install-mkcert":I.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":_e({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:I.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":_e({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":I.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:I.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":_e({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":I.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(t),r=await In({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Ft(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await jr(e.path);let o=await eo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await ro({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option"}),s={...o,store:n,directory:e.path,update:!e["no-update"],unsafeValidation:e["unsafe-validation"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"],tunnel:r};return await Cn(s),{app:o.app}}};export{Fa as a,gt as b};
@@ -1 +1 @@
1
- import{b as n}from"./chunk-DCKRQZLE.js";import{y as t}from"./chunk-7YXHILW4.js";import{k as r}from"./chunk-PT3OZEBI.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var e=class extends n{static description="Run CLI doctor-release tests";static hidden=!0;async run(){r()&&t({headline:"Shopify CLI Doctor Release.",body:["Available doctor-release commands:",""," shopify doctor-release theme -e <environment> Run all theme command tests","","The -e/--environment flag is required to specify the store configuration.","Use --help with any command for more options."]})}};export{e as a};
1
+ import{b as n}from"./chunk-FSWOB535.js";import{y as t}from"./chunk-J6XOTLT5.js";import{k as r}from"./chunk-JTEP5MP2.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var e=class extends n{static description="Run CLI doctor-release tests";static hidden=!0;async run(){r()&&t({headline:"Shopify CLI Doctor Release.",body:["Available doctor-release commands:",""," shopify doctor-release theme -e <environment> Run all theme command tests","","The -e/--environment flag is required to specify the store configuration.","Use --help with any command for more options."]})}};export{e as a};
@@ -1,3 +1,3 @@
1
- import{a as ne}from"./chunk-5O7JTVO2.js";import{d as ie}from"./chunk-SUTVPAJF.js";import{a as se,b as q}from"./chunk-DCKRQZLE.js";import{B as C,K as L,pa as V,ra as U,sa as X,u as w}from"./chunk-HB4YI2PF.js";import{e as x}from"./chunk-AODTY2BL.js";import{A as N,B as I,E as re,a as Q,x as te}from"./chunk-7YXHILW4.js";import{b as K}from"./chunk-HILYTMVA.js";import{d as Z,e as ee}from"./chunk-MWWULCLD.js";import{i as F,l as oe}from"./chunk-4HBKQUKY.js";import{Cb as R,Eb as l,Ja as W,Nb as h,Ya as _}from"./chunk-62GA7XR3.js";import{b as Ie}from"./chunk-I3J63RFV.js";import{c as Y,e as k,h as J,p as $}from"./chunk-6IDEDOXW.js";import{e as Te,g as f}from"./chunk-VKWPEFWQ.js";f();var T=Te(Ie(),1);var O={path:T.Flags.string({description:"The path where you want to run the command. Defaults to the current working directory.",env:"SHOPIFY_FLAG_PATH",parse:async t=>{let e=k(t);return _(e)?W(e)?e:(I({headline:"The path must be a directory, not a file.",body:[`The provided path is not a directory: ${e}`,`Did you mean: ${J(e)}`]}),process.exit(1)):(I({headline:"A path was explicitly provided but doesn't exist.",body:[`Please check the path and try again: ${e}`]}),process.exit(1))},default:async()=>$(),noCacheDefault:!0}),password:T.Flags.string({description:"Password generated from the Theme Access app or an Admin API token.",env:"SHOPIFY_CLI_THEME_TOKEN"}),store:T.Flags.string({char:"s",description:"Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).",env:"SHOPIFY_FLAG_STORE",parse:async t=>w(t)}),environment:T.Flags.string({char:"e",description:"The environment to apply to the current command.",env:"SHOPIFY_FLAG_ENVIRONMENT",multiple:!0})},ae="Wrap the value in double quotes if you're using wildcards.",qe=t=>({only:T.Flags.string({char:"o",multiple:!0,description:`${t.charAt(0).toUpperCase()+t.slice(1)} only the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_ONLY"}),ignore:T.Flags.string({char:"x",multiple:!0,description:`Skip ${t}ing the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_IGNORE"})});f();f();import{AsyncLocalStorage as _e}from"node:async_hooks";var pe=new _e,ce,ue,me,de;function S(){return ce??=new x({projectName:"shopify-cli-theme-conf"}),ce}function j(){return ue??=new x({projectName:"shopify-cli-development-theme-config"}),ue}function D(){return me??=new x({projectName:"shopify-cli-repl-theme-config"}),me}function M(){return de??=new x({projectName:"shopify-cli-theme-store-password"}),de}function B(t=S()){return pe.getStore()?.store??t.get("themeStore")}function fe(t,e=S()){e.set("themeStore",t)}function He(t=S()){return h(l`Getting development theme...`),j().get(v(t))}function ze(t,e=S()){h(l`Setting development theme...`),j().set(v(e),t)}function Ye(t=S()){h(l`Removing development theme...`),j().delete(v(t))}function Je(t=S()){return h(l`Getting REPL theme...`),D().get(v(t))}function We(t,e=S()){h(l`Setting REPL theme to ${t}...`),D().set(v(e),t)}function Ke(t=S()){h(l`Removing REPL theme...`),D().delete(v(t))}function Qe(t=S()){let e=v(t);return h(l`Getting storefront password for shop ${e}...`),M().get(e)}function Ve(t,e=S()){let o=v(e);h(l`Setting storefront password for shop ${o}...`),M().set(o,t)}function Xe(t=S()){let e=v(t);h(l`Removing storefront password for ${e}...`),M().delete(e)}function v(t=S()){let e=B(t);if(!e)throw new oe("Theme store is not set. This indicates an unexpected issue with the CLI. Please report this to the Shopify CLI team.",["It may be possible to recover by running",{command:"shopify theme list --store <store>"},"(setting the store flag to the store you wish to use) and then running the command again."]);return e}async function he(t,e){return pe.run({store:t},e)}function le(t){let e=t.store??B();if(!e)throw V(new F("A store is required",`Specify the store passing ${l`${R.genericShellCommand(`--${O.store.name}=example.myshopify.com`)}`.value} or set the ${l`${R.genericShellCommand(O.store.env)}`.value} environment variable.`));return fe(e),e}f();f();var Se="shopify.theme.toml",ct=new Intl.DateTimeFormat(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),ut=["**/.git","**/.vscode","**/.hg","**/.bzr","**/.svn","**/_darcs","**/CVS","**/*.sublime-(project|workspace)","**/.DS_Store","**/.sass-cache","**/Thumbs.db","**/desktop.ini","**/config.yml","**/node_modules/",".prettierrc.json","**/{blocks,layout,snippets}/**/*.liquid.tmp.*","**/{config,locales}/**/*.json.tmp.*","**/{sections,templates}/**/*.{liquid,json}.tmp.*"],mt=50;f();f();var G="7e9cb568cfd431c538f36d1ad3f2b4f6";var Fe="shopify-cli-store",be=240*1e3,ge;function P(){return ge??=new x({projectName:Fe}),ge}function b(t){return`${G}::${Ee(t)}`}function Ee(t){return t.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function d(t){return typeof t=="string"}function ke(t){if(!t||typeof t!="object")return;let e=t;if(typeof e.id=="number")return{id:e.id,...d(e.email)?{email:e.email}:{},...d(e.firstName)?{firstName:e.firstName}:{},...d(e.lastName)?{lastName:e.lastName}:{},...typeof e.accountOwner=="boolean"?{accountOwner:e.accountOwner}:{}}}function $e(t){if(!t||typeof t!="object")return;let e=t;if(!(!d(e.shopId)||!d(e.name)||!d(e.createdAt)))return{shopId:e.shopId,name:e.name,createdAt:e.createdAt,...d(e.placeholderAccountUuid)?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...d(e.country)?{country:e.country}:{},...d(e.accessUrl)?{accessUrl:e.accessUrl}:{}}}function Pe(t){if(!t||typeof t!="object")return;let e=t;if(!d(e.store)||!d(e.clientId)||!d(e.userId)||!d(e.accessToken)||!Array.isArray(e.scopes)||!e.scopes.every(d)||!d(e.acquiredAt))return;let o=ke(e.associatedUser),r=e.kind==="preview"?"preview":"standard",n=r==="preview"?$e(e.preview):void 0;if(!(r==="preview"&&!n))return{store:e.store,clientId:e.clientId,userId:e.userId,accessToken:e.accessToken,scopes:e.scopes,acquiredAt:e.acquiredAt,...d(e.refreshToken)?{refreshToken:e.refreshToken}:{},...d(e.expiresAt)?{expiresAt:e.expiresAt}:{},...d(e.refreshTokenExpiresAt)?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...o?{associatedUser:o}:{},...r==="preview"?{kind:r}:{},...n?{preview:n}:{}}}function ye(t,e,o){if(!e||typeof e!="object")return;let{sessionsByUserId:r,currentUserId:n}=e;if(!(r!==void 0||n!==void 0))return;let s=b(t);if(!r||typeof r!="object"||Array.isArray(r)||typeof n!="string"){o.delete(s);return}let a=Object.fromEntries(Object.entries(r).flatMap(([u,c])=>{let p=Pe(c);return p?[[u,p]]:[]}));if(Object.keys(a).length!==Object.keys(r).length)if(a[n])o.set(s,{currentUserId:n,sessionsByUserId:a});else{o.delete(s);return}return{currentUserId:n,sessionsByUserId:a}}function H(t,e){return ye(t,e.get(b(t)),e)}function Ce(t){return t.config?.store??{}}function we(t=P()){let e=[],o=`${G}::`;for(let[r,n]of Object.entries(Ce(t))){if(!r.startsWith(o))continue;let i=ye(r.slice(o.length),n,t),s=i?.sessionsByUserId[i.currentUserId];s&&e.push(s)}return e}function Ae(t,e=P()){let o=w(t),r=H(o,e);if(!r)return;let n=r.sessionsByUserId[r.currentUserId];if(!n){e.delete(b(o));return}return n}function wt(t,e=P()){let o=b(t.store),r=H(t.store,e),n={currentUserId:t.userId,sessionsByUserId:{...r?.sessionsByUserId??{},[t.userId]:t}};e.set(o,n)}function At(t,e,o){let r=w(t),n=typeof e=="string"?e:void 0,i=(typeof e=="string"?o:e)??P(),s=b(r);if(!n){i.delete(s);return}let a=H(r,i);if(!a)return;let{[n]:u,...c}=a.sessionsByUserId,p=Object.keys(c);if(p.length===0){i.delete(s);return}i.set(s,{currentUserId:a.currentUserId===n?p[0]:a.currentUserId,sessionsByUserId:c})}function ve(t){if(!t.expiresAt)return!1;let e=new Date(t.expiresAt).getTime();return Number.isNaN(e)?!0:e-be<Date.now()}var z=class extends q{static baseFlags={...q.baseFlags,...ie};environmentsFilename(){return Se}async command(e,o,r=!1,n,i){}async run(e){let o=this.constructor,r=o.multiEnvironmentsFlags,{args:n,flags:i}=await this.parse(o),s="password"in o.flags,a=(Array.isArray(i.environment)?i.environment:[i.environment]).filter(Boolean),u=r!==null&&r.some(m=>Array.isArray(m)?m.includes("store"):m==="store");if(a.length<=1){if(a[0]&&!i.store&&u)throw new F("Please provide a valid environment.");let m=s?await this.createSession(i):void 0,A=this.constructor.name.toLowerCase();if(U(`theme-command:${A}:single-env:authenticated`),i.path&&!_(i.path))throw new F(`Path does not exist: ${i.path}`);try{await this.command(i,m,!1,n)}finally{await this.logAnalyticsData(m)}return}if(r===null){N({body:"This command does not support multiple environments."});return}let{flags:c}=await this.parse(se(o),this.argv);if("path"in c){this.errorOnGlobalPath();return}let p=await this.loadEnvironments(a,i,c),g=await this.validateEnvironments(p,r,s);"force"in o.flags&&!i.force&&!await this.showConfirmation(this.constructor.name,r,g)||await this.runConcurrent(g.valid)}storeAuthScopes(){}async loadEnvironments(e,o,r){let n=new Map;for(let i of e){let s=await ne(i,"shopify.theme.toml",{from:o.path,silent:!0});s?.store&&typeof s.store=="string"&&(s.store=w(s.store)),s?.path&&typeof s.path=="string"&&(s.path=k(s.path)),n.set(i,{flags:{...o,...s,...r,environment:[i]},validationFlags:{...s,...r}})}return n}async validateEnvironments(e,o,r){let n=[],i=[],s=r?this.storeAuthSessionsForTheme(Array.from(e.values()).map(({validationFlags:u})=>u)):new Map,a=Array.from(e.entries()).map(([u,{flags:c,validationFlags:p}])=>({environmentName:u,flags:c,validationFlags:p,storeAuthSession:this.storeAuthSessionFromCache(p,s)}));for(let{environmentName:u,flags:c,validationFlags:p,storeAuthSession:g}of a){let y=this.validConfig(p,o,u,g);if(y!==!0){let m=y.join(", ");i.push({environment:u,reason:`Missing flags: ${m}`});continue}n.push({environment:u,flags:c,requiresAuth:r,storeAuthSession:g})}return{valid:n,invalid:i}}async showConfirmation(e,o,r){let s={message:[`Run ${e.toLowerCase()} in the following environments?`],confirmationMessage:"Yes, proceed",cancellationMessage:"Cancel"},a=[...r.valid.map(({environment:u,flags:c})=>{let p=o.map(g=>{let y=Array.isArray(g)?g.find(m=>c[m]):g;if(y==="password")return"password";if(y==="path"&&typeof c.path=="string"){let m=c.path.split(/[/\\]/);if(m.length===1)return`path: ${c.path}`;let A=m[0]===""?`/${m[1]}`:m[0],E=m.at(-1);return`path: ${A}/.../${E}`}return y&&`${y}: ${c[y]}`}).join(", ");return[u,{subdued:p||"No flags required"}]}),...r.invalid.map(({environment:u,reason:c})=>[u,{error:`Skipping | ${c}`}])];return s.infoTable={Environment:a},r.invalid.length>0&&(s.confirmationMessage="Proceed anyway (will skip invalid environments)"),re(s)}async runConcurrent(e){let o=new Q,r=e.map(s=>s.flags.store),n=new Set(r),i=r.length===n.size?[e]:this.createSequentialGroups(e);for(let s of i)await te({processes:s.map(({environment:a,flags:u,requiresAuth:c,storeAuthSession:p})=>({prefix:a,action:async(g,y,m)=>{try{let A=u.store;await he(A,async()=>{let E=c?await this.createSession(u,p):void 0,xe=this.constructor.name.toLowerCase();U(`theme-command:${xe}:multi-env:authenticated`);try{await this.command(u,E,!0,{},{stdout:g,stderr:y})}finally{await this.logAnalyticsData(E)}})}catch(A){A instanceof Error&&(A.message=`Environment ${a} failed:
1
+ import{a as ne}from"./chunk-T2RE2K3N.js";import{d as ie}from"./chunk-DWMRVMKX.js";import{a as se,b as q}from"./chunk-FSWOB535.js";import{B as C,K as L,pa as V,ra as U,sa as X,u as w}from"./chunk-2TCPTRLF.js";import{e as x}from"./chunk-KW5SQ6PG.js";import{A as N,B as I,E as re,a as Q,x as te}from"./chunk-J6XOTLT5.js";import{b as K}from"./chunk-HILYTMVA.js";import{d as Z,e as ee}from"./chunk-6MELTJU3.js";import{i as F,l as oe}from"./chunk-QF453PH7.js";import{Cb as R,Eb as l,Ja as W,Nb as h,Ya as _}from"./chunk-QY73XOBU.js";import{b as Ie}from"./chunk-I3J63RFV.js";import{c as Y,e as k,h as J,p as $}from"./chunk-6IDEDOXW.js";import{e as Te,g as f}from"./chunk-VKWPEFWQ.js";f();var T=Te(Ie(),1);var O={path:T.Flags.string({description:"The path where you want to run the command. Defaults to the current working directory.",env:"SHOPIFY_FLAG_PATH",parse:async t=>{let e=k(t);return _(e)?W(e)?e:(I({headline:"The path must be a directory, not a file.",body:[`The provided path is not a directory: ${e}`,`Did you mean: ${J(e)}`]}),process.exit(1)):(I({headline:"A path was explicitly provided but doesn't exist.",body:[`Please check the path and try again: ${e}`]}),process.exit(1))},default:async()=>$(),noCacheDefault:!0}),password:T.Flags.string({description:"Password generated from the Theme Access app or an Admin API token.",env:"SHOPIFY_CLI_THEME_TOKEN"}),store:T.Flags.string({char:"s",description:"Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).",env:"SHOPIFY_FLAG_STORE",parse:async t=>w(t)}),environment:T.Flags.string({char:"e",description:"The environment to apply to the current command.",env:"SHOPIFY_FLAG_ENVIRONMENT",multiple:!0})},ae="Wrap the value in double quotes if you're using wildcards.",qe=t=>({only:T.Flags.string({char:"o",multiple:!0,description:`${t.charAt(0).toUpperCase()+t.slice(1)} only the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_ONLY"}),ignore:T.Flags.string({char:"x",multiple:!0,description:`Skip ${t}ing the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_IGNORE"})});f();f();import{AsyncLocalStorage as _e}from"node:async_hooks";var pe=new _e,ce,ue,me,de;function S(){return ce??=new x({projectName:"shopify-cli-theme-conf"}),ce}function j(){return ue??=new x({projectName:"shopify-cli-development-theme-config"}),ue}function D(){return me??=new x({projectName:"shopify-cli-repl-theme-config"}),me}function M(){return de??=new x({projectName:"shopify-cli-theme-store-password"}),de}function B(t=S()){return pe.getStore()?.store??t.get("themeStore")}function fe(t,e=S()){e.set("themeStore",t)}function He(t=S()){return h(l`Getting development theme...`),j().get(v(t))}function ze(t,e=S()){h(l`Setting development theme...`),j().set(v(e),t)}function Ye(t=S()){h(l`Removing development theme...`),j().delete(v(t))}function Je(t=S()){return h(l`Getting REPL theme...`),D().get(v(t))}function We(t,e=S()){h(l`Setting REPL theme to ${t}...`),D().set(v(e),t)}function Ke(t=S()){h(l`Removing REPL theme...`),D().delete(v(t))}function Qe(t=S()){let e=v(t);return h(l`Getting storefront password for shop ${e}...`),M().get(e)}function Ve(t,e=S()){let o=v(e);h(l`Setting storefront password for shop ${o}...`),M().set(o,t)}function Xe(t=S()){let e=v(t);h(l`Removing storefront password for ${e}...`),M().delete(e)}function v(t=S()){let e=B(t);if(!e)throw new oe("Theme store is not set. This indicates an unexpected issue with the CLI. Please report this to the Shopify CLI team.",["It may be possible to recover by running",{command:"shopify theme list --store <store>"},"(setting the store flag to the store you wish to use) and then running the command again."]);return e}async function he(t,e){return pe.run({store:t},e)}function le(t){let e=t.store??B();if(!e)throw V(new F("A store is required",`Specify the store passing ${l`${R.genericShellCommand(`--${O.store.name}=example.myshopify.com`)}`.value} or set the ${l`${R.genericShellCommand(O.store.env)}`.value} environment variable.`));return fe(e),e}f();f();var Se="shopify.theme.toml",ct=new Intl.DateTimeFormat(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),ut=["**/.git","**/.vscode","**/.hg","**/.bzr","**/.svn","**/_darcs","**/CVS","**/*.sublime-(project|workspace)","**/.DS_Store","**/.sass-cache","**/Thumbs.db","**/desktop.ini","**/config.yml","**/node_modules/",".prettierrc.json","**/{blocks,layout,snippets}/**/*.liquid.tmp.*","**/{config,locales}/**/*.json.tmp.*","**/{sections,templates}/**/*.{liquid,json}.tmp.*"],mt=50;f();f();var G="7e9cb568cfd431c538f36d1ad3f2b4f6";var Fe="shopify-cli-store",be=240*1e3,ge;function P(){return ge??=new x({projectName:Fe}),ge}function b(t){return`${G}::${Ee(t)}`}function Ee(t){return t.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function d(t){return typeof t=="string"}function ke(t){if(!t||typeof t!="object")return;let e=t;if(typeof e.id=="number")return{id:e.id,...d(e.email)?{email:e.email}:{},...d(e.firstName)?{firstName:e.firstName}:{},...d(e.lastName)?{lastName:e.lastName}:{},...typeof e.accountOwner=="boolean"?{accountOwner:e.accountOwner}:{}}}function $e(t){if(!t||typeof t!="object")return;let e=t;if(!(!d(e.shopId)||!d(e.name)||!d(e.createdAt)))return{shopId:e.shopId,name:e.name,createdAt:e.createdAt,...d(e.placeholderAccountUuid)?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...d(e.country)?{country:e.country}:{},...d(e.accessUrl)?{accessUrl:e.accessUrl}:{}}}function Pe(t){if(!t||typeof t!="object")return;let e=t;if(!d(e.store)||!d(e.clientId)||!d(e.userId)||!d(e.accessToken)||!Array.isArray(e.scopes)||!e.scopes.every(d)||!d(e.acquiredAt))return;let o=ke(e.associatedUser),r=e.kind==="preview"?"preview":"standard",n=r==="preview"?$e(e.preview):void 0;if(!(r==="preview"&&!n))return{store:e.store,clientId:e.clientId,userId:e.userId,accessToken:e.accessToken,scopes:e.scopes,acquiredAt:e.acquiredAt,...d(e.refreshToken)?{refreshToken:e.refreshToken}:{},...d(e.expiresAt)?{expiresAt:e.expiresAt}:{},...d(e.refreshTokenExpiresAt)?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...o?{associatedUser:o}:{},...r==="preview"?{kind:r}:{},...n?{preview:n}:{}}}function ye(t,e,o){if(!e||typeof e!="object")return;let{sessionsByUserId:r,currentUserId:n}=e;if(!(r!==void 0||n!==void 0))return;let s=b(t);if(!r||typeof r!="object"||Array.isArray(r)||typeof n!="string"){o.delete(s);return}let a=Object.fromEntries(Object.entries(r).flatMap(([u,c])=>{let p=Pe(c);return p?[[u,p]]:[]}));if(Object.keys(a).length!==Object.keys(r).length)if(a[n])o.set(s,{currentUserId:n,sessionsByUserId:a});else{o.delete(s);return}return{currentUserId:n,sessionsByUserId:a}}function H(t,e){return ye(t,e.get(b(t)),e)}function Ce(t){return t.config?.store??{}}function we(t=P()){let e=[],o=`${G}::`;for(let[r,n]of Object.entries(Ce(t))){if(!r.startsWith(o))continue;let i=ye(r.slice(o.length),n,t),s=i?.sessionsByUserId[i.currentUserId];s&&e.push(s)}return e}function Ae(t,e=P()){let o=w(t),r=H(o,e);if(!r)return;let n=r.sessionsByUserId[r.currentUserId];if(!n){e.delete(b(o));return}return n}function wt(t,e=P()){let o=b(t.store),r=H(t.store,e),n={currentUserId:t.userId,sessionsByUserId:{...r?.sessionsByUserId??{},[t.userId]:t}};e.set(o,n)}function At(t,e,o){let r=w(t),n=typeof e=="string"?e:void 0,i=(typeof e=="string"?o:e)??P(),s=b(r);if(!n){i.delete(s);return}let a=H(r,i);if(!a)return;let{[n]:u,...c}=a.sessionsByUserId,p=Object.keys(c);if(p.length===0){i.delete(s);return}i.set(s,{currentUserId:a.currentUserId===n?p[0]:a.currentUserId,sessionsByUserId:c})}function ve(t){if(!t.expiresAt)return!1;let e=new Date(t.expiresAt).getTime();return Number.isNaN(e)?!0:e-be<Date.now()}var z=class extends q{static baseFlags={...q.baseFlags,...ie};environmentsFilename(){return Se}async command(e,o,r=!1,n,i){}async run(e){let o=this.constructor,r=o.multiEnvironmentsFlags,{args:n,flags:i}=await this.parse(o),s="password"in o.flags,a=(Array.isArray(i.environment)?i.environment:[i.environment]).filter(Boolean),u=r!==null&&r.some(m=>Array.isArray(m)?m.includes("store"):m==="store");if(a.length<=1){if(a[0]&&!i.store&&u)throw new F("Please provide a valid environment.");let m=s?await this.createSession(i):void 0,A=this.constructor.name.toLowerCase();if(U(`theme-command:${A}:single-env:authenticated`),i.path&&!_(i.path))throw new F(`Path does not exist: ${i.path}`);try{await this.command(i,m,!1,n)}finally{await this.logAnalyticsData(m)}return}if(r===null){N({body:"This command does not support multiple environments."});return}let{flags:c}=await this.parse(se(o),this.argv);if("path"in c){this.errorOnGlobalPath();return}let p=await this.loadEnvironments(a,i,c),g=await this.validateEnvironments(p,r,s);"force"in o.flags&&!i.force&&!await this.showConfirmation(this.constructor.name,r,g)||await this.runConcurrent(g.valid)}storeAuthScopes(){}async loadEnvironments(e,o,r){let n=new Map;for(let i of e){let s=await ne(i,"shopify.theme.toml",{from:o.path,silent:!0});s?.store&&typeof s.store=="string"&&(s.store=w(s.store)),s?.path&&typeof s.path=="string"&&(s.path=k(s.path)),n.set(i,{flags:{...o,...s,...r,environment:[i]},validationFlags:{...s,...r}})}return n}async validateEnvironments(e,o,r){let n=[],i=[],s=r?this.storeAuthSessionsForTheme(Array.from(e.values()).map(({validationFlags:u})=>u)):new Map,a=Array.from(e.entries()).map(([u,{flags:c,validationFlags:p}])=>({environmentName:u,flags:c,validationFlags:p,storeAuthSession:this.storeAuthSessionFromCache(p,s)}));for(let{environmentName:u,flags:c,validationFlags:p,storeAuthSession:g}of a){let y=this.validConfig(p,o,u,g);if(y!==!0){let m=y.join(", ");i.push({environment:u,reason:`Missing flags: ${m}`});continue}n.push({environment:u,flags:c,requiresAuth:r,storeAuthSession:g})}return{valid:n,invalid:i}}async showConfirmation(e,o,r){let s={message:[`Run ${e.toLowerCase()} in the following environments?`],confirmationMessage:"Yes, proceed",cancellationMessage:"Cancel"},a=[...r.valid.map(({environment:u,flags:c})=>{let p=o.map(g=>{let y=Array.isArray(g)?g.find(m=>c[m]):g;if(y==="password")return"password";if(y==="path"&&typeof c.path=="string"){let m=c.path.split(/[/\\]/);if(m.length===1)return`path: ${c.path}`;let A=m[0]===""?`/${m[1]}`:m[0],E=m.at(-1);return`path: ${A}/.../${E}`}return y&&`${y}: ${c[y]}`}).join(", ");return[u,{subdued:p||"No flags required"}]}),...r.invalid.map(({environment:u,reason:c})=>[u,{error:`Skipping | ${c}`}])];return s.infoTable={Environment:a},r.invalid.length>0&&(s.confirmationMessage="Proceed anyway (will skip invalid environments)"),re(s)}async runConcurrent(e){let o=new Q,r=e.map(s=>s.flags.store),n=new Set(r),i=r.length===n.size?[e]:this.createSequentialGroups(e);for(let s of i)await te({processes:s.map(({environment:a,flags:u,requiresAuth:c,storeAuthSession:p})=>({prefix:a,action:async(g,y,m)=>{try{let A=u.store;await he(A,async()=>{let E=c?await this.createSession(u,p):void 0,xe=this.constructor.name.toLowerCase();U(`theme-command:${xe}:multi-env:authenticated`);try{await this.command(u,E,!0,{},{stdout:g,stderr:y})}finally{await this.logAnalyticsData(E)}})}catch(A){A instanceof Error&&(A.message=`Environment ${a} failed:
2
2
 
3
3
  ${A.message}`,I({body:[A.message]}))}}})),abortSignal:o.signal,showTimestamps:!0,renderOptions:{stdout:process.stderr}})}createSequentialGroups(e){let o=[];return e.forEach(r=>{let n=o.find(i=>!i.some(s=>s.flags.store===r.flags.store));n?n.push(r):o.push([r])}),o}async createSession(e,o){let r=le({store:e.store}),n=e.password;return n?await L(r,n):o??await this.storeAuthSessionForTheme({store:r})??await L(r,n)}async storeAuthSessionForTheme(e){let o=this.storeAuthScopes();if(!o)return;let r=typeof e.store=="string"?e.store:void 0,n=e.password;if(!r||n)return;let i=w(r),s=Ae(i);if(s)return this.adminSessionFromStoreAuthSession(s,i,o)}storeAuthSessionsForTheme(e){let o=this.storeAuthScopes();if(!o)return new Map;let r=new Set(e.filter(({store:n,password:i})=>typeof n=="string"&&!i).map(({store:n})=>w(n)));return r.size===0?new Map:new Map(we().map(n=>{let i=w(n.store);if(!r.has(i))return;let s=this.adminSessionFromStoreAuthSession(n,i,o);return s?[i,s]:void 0}).filter(n=>n!==void 0))}storeAuthSessionFromCache(e,o){let r=typeof e.store=="string"?e.store:void 0,n=e.password;if(!(!r||n))return o.get(w(r))}adminSessionFromStoreAuthSession(e,o,r){if(ve(e)){h(`Ignoring stored store auth session for ${o}: it expired at ${e.expiresAt??"unknown"}.`);return}if(!this.hasRequiredStoreAuthScopes(e.scopes,r)){h(`Ignoring stored store auth session for ${o}: it is missing required scopes (has: ${e.scopes.join(", ")}; needs: ${r.join(", ")}).`);return}return h(`Using stored store auth session for ${o} (scopes: ${e.scopes.join(", ")}).`),C(e.userId),{token:e.accessToken,storeFqdn:o}}expandImpliedStoreAuthScopes(e){let o=new Set(e);for(let r of e){let n=r.match(/^(unauthenticated_)?write_(.*)$/);n&&o.add(`${n[1]??""}read_${n[2]}`)}return o}hasRequiredStoreAuthScopes(e,o){let r=this.expandImpliedStoreAuthScopes(e);return o.every(n=>r.has(n))}validConfig(e,o,r,n){let i=o.filter(s=>Array.isArray(s)?!s.some(a=>this.hasRequiredFlag(e,a,n)):!this.hasRequiredFlag(e,s,n)).map(s=>Array.isArray(s)?s.join(" or "):s);return i.length>0?(N({body:[`Missing required flags in environment configuration${r?` for ${r}`:""}:`,{list:{items:i}}]}),i):!0}hasRequiredFlag(e,o,r){return o==="password"&&r?!0:!!e[o]}errorOnGlobalPath(){let e=Y($(),"shopify.theme.toml"),o=_(e);I({body:["Can't use `--path` flag with multiple environments.",...o?["Configure each environment's theme path in your shopify.theme.toml file instead."]:["Run this command from the directory containing shopify.theme.toml.","No shopify.theme.toml found in current directory."]]})}async logAnalyticsData(e){if(!e)return;let o=X();await Z(()=>({store_fqdn_hash:K(e.storeFqdn),store_domain:e.storeFqdn,cmd_theme_timings:JSON.stringify(o.timings),cmd_theme_errors:JSON.stringify(o.errors),cmd_theme_retries:JSON.stringify(o.retries),cmd_theme_events:JSON.stringify(o.events)})),await ee(()=>({store_fqdn:e.storeFqdn}))}};export{G as a,we as b,Ae as c,wt as d,At as e,B as f,He as g,ze as h,Ye as i,Je as j,We as k,Ke as l,Qe as m,Ve as n,Xe as o,O as p,qe as q,le as r,ct as s,ut as t,mt as u,z as v};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-OHJUEUSA.js";import{a as y}from"./chunk-QUO4RD3W.js";import{a as h}from"./chunk-MTBABHUB.js";import{Ia as b,g}from"./chunk-EEAY7HFW.js";import{b as u}from"./chunk-SUTVPAJF.js";import{S as f,x as d,z as m}from"./chunk-7YXHILW4.js";import{d as l}from"./chunk-MWWULCLD.js";import{b as A}from"./chunk-I3J63RFV.js";import{e as _,g as s}from"./chunk-VKWPEFWQ.js";s();s();s();async function o(e,{web:i,stdout:t,stderr:a,signal:n,env:p={}}){let c=i.configuration.commands[e];if(!c)return;let[I,...v]=c.split(" ");await f(I,v,{cwd:i.directory,stdout:t,stderr:a,signal:n,env:p}),t.write("Web successfully built.")}async function S(e){!e.skipDependenciesInstallation&&!e.project.usesWorkspaces&&await y(e.project);let i={};e.apiKey&&(i.SHOPIFY_API_KEY=e.apiKey),await g(e.app),await d({processes:[...e.app.webs.map(t=>({prefix:["web",...t.configuration.roles].join("-"),action:async(a,n,p)=>{await o("build",{web:t,stdout:a,stderr:n,signal:p,env:i})}})),...e.app.allExtensions.map(t=>({prefix:t.localIdentifier,action:async(a,n,p)=>{await t.build({stdout:a,stderr:n,signal:p,app:e.app,environment:"production"})}}))],showTimestamps:!1}),m({headline:[{userInput:e.app.name},"built!"]})}var k=S;var x=_(A(),1);var r=class e extends w{static summary="Build the app, including extensions.";static descriptionWithMarkdown="This command executes the build script specified in the element's TOML file. You can specify a custom script in the file. To learn about configuration files in Shopify apps, refer to [App configuration](https://shopify.dev/docs/apps/tools/cli/configuration).\n\n If you're building a [theme app extension](https://shopify.dev/docs/apps/online-store/theme-app-extensions), then running the `build` command runs [Theme Check](https://shopify.dev/docs/themes/tools/theme-check) against your extension to ensure that it's valid.";static description=this.descriptionForHelp();static flags={...u,...h,"skip-dependencies-installation":x.Flags.boolean({hidden:!1,description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1})};async run(){let{flags:i}=await this.parse(e),t=i["client-id"];await l(()=>({cmd_app_dependency_installation_skipped:i["skip-dependencies-installation"]}));let{app:a,project:n}=await b({directory:i.path,userProvidedConfigName:i.config});return await k({app:a,project:n,skipDependenciesInstallation:i["skip-dependencies-installation"],apiKey:t}),{app:a}}};export{r as a};
1
+ import{a as w}from"./chunk-77G2GTZU.js";import{a as y}from"./chunk-WQG4QDC5.js";import{a as h}from"./chunk-TFVIG4I7.js";import{Ia as b,g}from"./chunk-X4767EMJ.js";import{b as u}from"./chunk-DWMRVMKX.js";import{S as f,x as d,z as m}from"./chunk-J6XOTLT5.js";import{d as l}from"./chunk-6MELTJU3.js";import{b as A}from"./chunk-I3J63RFV.js";import{e as _,g as s}from"./chunk-VKWPEFWQ.js";s();s();s();async function o(e,{web:i,stdout:t,stderr:a,signal:n,env:p={}}){let c=i.configuration.commands[e];if(!c)return;let[I,...v]=c.split(" ");await f(I,v,{cwd:i.directory,stdout:t,stderr:a,signal:n,env:p}),t.write("Web successfully built.")}async function S(e){!e.skipDependenciesInstallation&&!e.project.usesWorkspaces&&await y(e.project);let i={};e.apiKey&&(i.SHOPIFY_API_KEY=e.apiKey),await g(e.app),await d({processes:[...e.app.webs.map(t=>({prefix:["web",...t.configuration.roles].join("-"),action:async(a,n,p)=>{await o("build",{web:t,stdout:a,stderr:n,signal:p,env:i})}})),...e.app.allExtensions.map(t=>({prefix:t.localIdentifier,action:async(a,n,p)=>{await t.build({stdout:a,stderr:n,signal:p,app:e.app,environment:"production"})}}))],showTimestamps:!1}),m({headline:[{userInput:e.app.name},"built!"]})}var k=S;var x=_(A(),1);var r=class e extends w{static summary="Build the app, including extensions.";static descriptionWithMarkdown="This command executes the build script specified in the element's TOML file. You can specify a custom script in the file. To learn about configuration files in Shopify apps, refer to [App configuration](https://shopify.dev/docs/apps/tools/cli/configuration).\n\n If you're building a [theme app extension](https://shopify.dev/docs/apps/online-store/theme-app-extensions), then running the `build` command runs [Theme Check](https://shopify.dev/docs/themes/tools/theme-check) against your extension to ensure that it's valid.";static description=this.descriptionForHelp();static flags={...u,...h,"skip-dependencies-installation":x.Flags.boolean({hidden:!1,description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1})};async run(){let{flags:i}=await this.parse(e),t=i["client-id"];await l(()=>({cmd_app_dependency_installation_skipped:i["skip-dependencies-installation"]}));let{app:a,project:n}=await b({directory:i.path,userProvidedConfigName:i.config});return await k({app:a,project:n,skipDependenciesInstallation:i["skip-dependencies-installation"],apiKey:t}),{app:a}}};export{r as a};
@@ -1 +1 @@
1
- import{b as p}from"./chunk-62LMVFR7.js";import{c as E,oa as b,pa as k,ra as s}from"./chunk-HB4YI2PF.js";import{J as w}from"./chunk-7YXHILW4.js";import{i as N}from"./chunk-4HBKQUKY.js";import{Nb as V,W as _}from"./chunk-62GA7XR3.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();var j=/gid:\/\/shopify\/\w*\/(\d+)/,g="development",ie="live",ae="unpublished";function te(e){return e.role===g}async function de(e){let n=await _("creative");return w({message:e,defaultValue:n})}function S(e){return`gid://shopify/OnlineStoreTheme/${e}`}function f(e){let n=j.exec(e);if(n&&n[1]!==void 0)return parseInt(n[1],10);throw new Error(`Invalid GID: ${e}`)}l();l();var F;(function(e){e.Delete="DELETE",e.Upload="UPLOAD"})(F||(F={}));l();function y(e){if(!e)return;e.processing??=!1,e.createdAtRuntime??=!1;let{id:n,name:a,role:i,processing:t,createdAtRuntime:d}=e;return{id:n,name:a,processing:t,createdAtRuntime:d,role:i==="main"?"live":i}}function se(e){if(!e)return;let{key:n,checksum:a,attachment:i,value:t}=e,d={size:(t||i||"").length,mtime:Date.now()};return{key:n,checksum:a,attachment:i,value:t,stats:d}}l();var A={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeUpdate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeUpdate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var x={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeDelete"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeDelete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deletedThemeId"}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var I={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeDuplicate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeDuplicate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"newTheme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var O={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themePublish"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themePublish"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var B={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeCreate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"source"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"URL"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"role"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ThemeRole"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeCreate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"source"},value:{kind:"Variable",name:{kind:"Name",value:"source"}}},{kind:"Argument",name:{kind:"Name",value:"role"},value:{kind:"Variable",name:{kind:"Name",value:"role"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var C={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getThemeFileBodies"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"filenames"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"files"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"250"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}},{kind:"Argument",name:{kind:"Name",value:"filenames"},value:{kind:"Variable",name:{kind:"Name",value:"filenames"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"checksumMd5"}},{kind:"Field",name:{kind:"Name",value:"body"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFileBodyText"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFileBodyBase64"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"contentBase64"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFileBodyUrl"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getThemeFileChecksums"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"files"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"250"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"checksumMd5"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeFilesUpsert"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"files"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFilesUpsertFileInput"}}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"themeId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeFilesUpsert"},arguments:[{kind:"Argument",name:{kind:"Name",value:"files"},value:{kind:"Variable",name:{kind:"Name",value:"files"}}},{kind:"Argument",name:{kind:"Name",value:"themeId"},value:{kind:"Variable",name:{kind:"Name",value:"themeId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"upsertedThemeFiles"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var U={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeFilesDelete"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"themeId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"files"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeFilesDelete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"themeId"},value:{kind:"Variable",name:{kind:"Name",value:"themeId"}}},{kind:"Argument",name:{kind:"Name",value:"files"},value:{kind:"Variable",name:{kind:"Name",value:"files"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deletedThemeFiles"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"metafieldDefinitionsByOwnerType"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ownerType"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"MetafieldOwnerType"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metafieldDefinitions"},arguments:[{kind:"Argument",name:{kind:"Name",value:"ownerType"},value:{kind:"Variable",name:{kind:"Name",value:"ownerType"}}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"250"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"type"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"category"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getThemes"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themes"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"50"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"processing"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var M={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getTheme"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"processing"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"findDevelopmentThemeByName"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themes"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"2"}},{kind:"Argument",name:{kind:"Name",value:"names"},value:{kind:"ListValue",values:[{kind:"Variable",name:{kind:"Name",value:"name"}}]}},{kind:"Argument",name:{kind:"Name",value:"roles"},value:{kind:"ListValue",values:[{kind:"EnumValue",value:"DEVELOPMENT"}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"processing"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var $={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"OnlineStorePasswordProtection"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"onlineStore"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"passwordProtection"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var Q="https://cdn.shopify.com/static/online-store/theme-skeleton.zip",c={useNetworkLevelRetry:!0,useAbortSignal:!1,maxRetryTimeMs:90*1e3,recordCommandRetries:!0},z="the required theme access scope";async function sn(e,n){let a=S(e);s("theme-api:fetch-theme");try{let{theme:i}=await p({query:M,session:n,variables:{id:a},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(i)return y({id:f(i.id),processing:i.processing,role:i.role.toLowerCase(),name:i.name})}catch(i){H(i),k(i),V(`Error fetching theme with ID: ${e}`)}}async function un(e){let n=[],a=null;for(s("theme-api:fetch-themes");;){let i=await T({query:R,session:e,variables:{after:a},responseOptions:{handleErrors:!1},preferredBehaviour:c});i.themes||r("Failed to fetch themes");let{nodes:t,pageInfo:d}=i.themes;if(t.forEach(m=>{let o=y({id:f(m.id),processing:m.processing,role:m.role.toLowerCase(),name:m.name});o&&n.push(o)}),!d.hasNextPage)return n;a=d.endCursor}}async function kn(e,n){s("theme-api:find-development-theme-by-name");let{themes:a}=await T({query:G,session:n,variables:{name:e},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(a||r("Failed to fetch themes"),a.nodes.length>1)throw k(new N(`More than one development theme is named "${e}"`));if(a.nodes.length===1){let{id:i,processing:t,role:d,name:m}=a.nodes[0];return y({id:f(i),processing:t,role:d.toLowerCase(),name:m})}}async function cn(e,n){let a=e.src??Q;s("theme-api:create-theme");let{themeCreate:i}=await T({query:B,session:n,variables:{name:e.name??"",source:a,role:(e.role??g).toUpperCase()},responseOptions:{handleErrors:!1},preferredBehaviour:c});i||r("Failed to create theme");let{theme:t,userErrors:d}=i;if(d.length){let m=i.userErrors.map(o=>o.message).join(", ");throw k(new N(m))}return t||r("Failed to create theme"),y({id:f(t.id),name:t.name,role:t.role.toLowerCase()})}async function pn(e,n,a){let i=[],t=null;for(s("theme-api:fetch-assets");;){let d=await T({query:C,session:a,variables:{id:D(e),filenames:n,after:t},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(!d.theme?.files?.nodes||!d.theme?.files?.pageInfo){let u=d.theme?.files?.userErrors.map(h=>h.filename).join(", ");r(`Error fetching assets: ${u}`)}let{nodes:m,pageInfo:o}=d.theme.files;if(i.push(...await Promise.all(m.map(async u=>{let{attachment:h,value:v}=await J(u.body);return{attachment:h,key:u.filename,checksum:u.checksumMd5,value:v}}))),!o.hasNextPage)return i;t=o.endCursor}}async function vn(e,n,a){let t=[];s("theme-api:delete-assets");for(let d=0;d<n.length;d+=50){let m=n.slice(d,d+50),{themeFilesDelete:o}=await p({query:U,session:a,variables:{themeId:S(e),files:m},preferredBehaviour:c});o||r("Failed to delete theme assets");let{deletedThemeFiles:u,userErrors:h}=o;u&&u.forEach(v=>{t.push({key:v.filename,success:!0,operation:F.Delete})}),h.length>0&&h.forEach(v=>{v.filename?(k(`Asset deletion failed for ${v.filename}: ${v.message}`),t.push({key:v.filename,success:!1,operation:F.Delete,errors:{asset:[v.message]}})):r(`Failed to delete theme assets: ${v.message}`)})}return t}async function Nn(e,n,a){let i=[];s("theme-api:bulk-upload-assets");for(let t=0;t<n.length;t+=50){let d=n.slice(t,t+50),m=X(d);b("theme-api:upload-files");let o=await K(e,m,a);b("theme-api:upload-files"),i.push(...W(o))}return i}function X(e){return e.map(n=>n.attachment?{filename:n.key,body:{type:"BASE64",value:n.attachment}}:{filename:n.key,body:{type:"TEXT",value:n.value??""}})}async function K(e,n,a){return p({query:P,session:a,variables:{themeId:D(e),files:n},preferredBehaviour:c})}function W(e){let{themeFilesUpsert:n}=e;n||r("Failed to upload theme files");let{upsertedThemeFiles:a,userErrors:i}=n,t=[];return a?.forEach(d=>{t.push({key:d.filename,success:!0,operation:F.Upload})}),i.forEach(d=>{d.filename||r(`Error uploading theme files: ${d.message}`),k(`Asset upload failed for ${d.filename}: ${d.message}`),t.push({key:d.filename,success:!1,operation:F.Upload,errors:{asset:[d.message]}})}),t}async function hn(e,n){let a=[],i=null;for(s("theme-api:fetch-checksums");;){let t=await T({query:q,session:n,variables:{id:D(e),after:i},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(!t?.theme?.files?.nodes||!t?.theme?.files?.pageInfo){let o=t.theme?.files?.userErrors.map(u=>u.filename).join(", ");throw k(new N(`Failed to fetch checksums for: ${o}`))}let{nodes:d,pageInfo:m}=t.theme.files;if(a.push(...d.map(o=>({key:o.filename,checksum:o.checksumMd5}))),!m.hasNextPage)return a;i=m.endCursor}}async function fn(e,n,a){let i=n.name,t={};i&&(t.name=i),s("theme-api:update-theme");let{themeUpdate:d}=await p({query:A,session:a,variables:{id:S(e),input:t},preferredBehaviour:c});d||r("Failed to update theme");let{theme:m,userErrors:o}=d;if(o.length){let u=d.userErrors.map(h=>h.message).join(", ");throw k(new N(u))}return m||r("Failed to update theme"),y({id:f(m.id),name:m.name,role:m.role.toLowerCase()})}async function yn(e,n){s("theme-api:publish-theme");let{themePublish:a}=await p({query:O,session:n,variables:{id:S(e)},preferredBehaviour:c});a||r("Failed to update theme");let{theme:i,userErrors:t}=a;if(t.length){let d=a.userErrors.map(m=>m.message).join(", ");throw k(new N(d))}return i||r("Failed to update theme"),y({id:f(i.id),name:i.name,role:i.role.toLowerCase()})}async function Sn(e,n){s("theme-api:delete-theme");let{themeDelete:a}=await p({query:x,session:n,variables:{id:S(e)},preferredBehaviour:c});a||r("Failed to update theme");let{deletedThemeId:i,userErrors:t}=a;if(t.length){let d=a.userErrors.map(m=>m.message).join(", ");throw k(new N(d))}return i||r("Failed to update theme"),!0}async function Fn(e,n,a){let i;s("theme-api:duplicate-theme");let{themeDuplicate:t}=await p({query:I,session:a,variables:{id:S(e),name:n},preferredBehaviour:c,responseOptions:{onResponse:u=>{i=u.headers.get("x-request-id")??void 0}}});if(!t)return k("Failed to duplicate theme"),{theme:void 0,userErrors:[{message:"Failed to duplicate theme"}],requestId:i};let{newTheme:d,userErrors:m}=t;return m.length>0?{theme:void 0,userErrors:m,requestId:i}:d?{theme:y({id:f(d.id),name:d.name,role:d.role.toLowerCase()}),userErrors:[],requestId:i}:{theme:void 0,userErrors:[{message:"Failed to duplicate theme"}],requestId:i}}async function Tn(e,n){s("theme-api:fetch-metafield-definitions");let{metafieldDefinitions:a}=await p({query:L,session:n,variables:{ownerType:e}});return a.nodes.map(i=>({key:i.key,namespace:i.namespace,name:i.name,description:i.description,type:{name:i.type.name,category:i.type.category}}))}async function bn(e){s("theme-api:check-password-protection");let{onlineStore:n}=await p({query:$,session:e});n||r("Unable to get details about the storefront's password protection");let{passwordProtection:a}=n;return a.enabled}function r(e){throw k(new N(e))}async function T(e){try{return await p(e)}catch(n){throw H(n),n}}function H(e){if(!(e instanceof E))return;let n=Y(e);if(!n)return;let a=[["If you authenticated with an Admin API access token, update the app or integration that issued the token to include the required theme access scopes, then reauthorize it or generate a new token."],["For",{command:"theme pull"},{char:","},{command:"theme list"},{char:","},"and",{command:"theme info"},{char:","},"add the",{command:"read_themes"},"scope",{char:"."}],["For",{command:"theme push"},"and",{command:"theme dev"},{char:","},"add both the",{command:"read_themes"},"and",{command:"write_themes"},"scopes",{char:"."}],["If you authenticated with your Shopify account, make sure your staff or collaborator account can access Online Store themes, then run",{command:"shopify auth logout"},"and try again",{char:"."}],["See",{link:{label:"Shopify access scopes",url:"https://shopify.dev/api/usage/access-scopes"}},{char:"."}]];throw k(new N(`The authenticated account or access token is missing ${n}.`,void 0,a))}function Y(e){let n=e.response.errors;if(!Array.isArray(n))return;let a=n.find(t=>t.extensions?.code==="ACCESS_DENIED");if(!a)return;let i=a.extensions?.requiredAccess;return typeof i!="string"?z:Z(i)}function Z(e){return e.trim().replace(/\.$/,"").replace(/^The user needs\s+/i,"")||z}function D(e){return`gid://shopify/OnlineStoreTheme/${e}`}async function J(e){switch(e.__typename){case"OnlineStoreThemeFileBodyText":return{value:e.content};case"OnlineStoreThemeFileBodyBase64":return{attachment:e.contentBase64};case"OnlineStoreThemeFileBodyUrl":try{let a=await(await fetch(e.url)).arrayBuffer();return{attachment:Buffer.from(a).toString("base64")}}catch{throw k(new N(`Error downloading content from URL: ${e.url}`))}}}export{se as a,g as b,ie as c,ae as d,te as e,de as f,sn as g,un as h,kn as i,cn as j,pn as k,vn as l,Nn as m,hn as n,fn as o,yn as p,Sn as q,Fn as r,Tn as s,bn as t};
1
+ import{b as p}from"./chunk-UQPAHTBH.js";import{c as E,oa as b,pa as k,ra as s}from"./chunk-2TCPTRLF.js";import{J as w}from"./chunk-J6XOTLT5.js";import{i as N}from"./chunk-QF453PH7.js";import{Nb as V,W as _}from"./chunk-QY73XOBU.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();var j=/gid:\/\/shopify\/\w*\/(\d+)/,g="development",ie="live",ae="unpublished";function te(e){return e.role===g}async function de(e){let n=await _("creative");return w({message:e,defaultValue:n})}function S(e){return`gid://shopify/OnlineStoreTheme/${e}`}function f(e){let n=j.exec(e);if(n&&n[1]!==void 0)return parseInt(n[1],10);throw new Error(`Invalid GID: ${e}`)}l();l();var F;(function(e){e.Delete="DELETE",e.Upload="UPLOAD"})(F||(F={}));l();function y(e){if(!e)return;e.processing??=!1,e.createdAtRuntime??=!1;let{id:n,name:a,role:i,processing:t,createdAtRuntime:d}=e;return{id:n,name:a,processing:t,createdAtRuntime:d,role:i==="main"?"live":i}}function se(e){if(!e)return;let{key:n,checksum:a,attachment:i,value:t}=e,d={size:(t||i||"").length,mtime:Date.now()};return{key:n,checksum:a,attachment:i,value:t,stats:d}}l();var A={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeUpdate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeUpdate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var x={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeDelete"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeDelete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deletedThemeId"}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var I={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeDuplicate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeDuplicate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"newTheme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var O={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themePublish"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themePublish"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var B={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeCreate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"source"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"URL"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"role"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ThemeRole"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeCreate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"source"},value:{kind:"Variable",name:{kind:"Name",value:"source"}}},{kind:"Argument",name:{kind:"Name",value:"role"},value:{kind:"Variable",name:{kind:"Name",value:"role"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var C={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getThemeFileBodies"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"filenames"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"files"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"250"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}},{kind:"Argument",name:{kind:"Name",value:"filenames"},value:{kind:"Variable",name:{kind:"Name",value:"filenames"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"checksumMd5"}},{kind:"Field",name:{kind:"Name",value:"body"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFileBodyText"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFileBodyBase64"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"contentBase64"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFileBodyUrl"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getThemeFileChecksums"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"files"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"250"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"checksumMd5"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeFilesUpsert"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"files"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"OnlineStoreThemeFilesUpsertFileInput"}}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"themeId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeFilesUpsert"},arguments:[{kind:"Argument",name:{kind:"Name",value:"files"},value:{kind:"Variable",name:{kind:"Name",value:"files"}}},{kind:"Argument",name:{kind:"Name",value:"themeId"},value:{kind:"Variable",name:{kind:"Name",value:"themeId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"upsertedThemeFiles"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var U={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"themeFilesDelete"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"themeId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"files"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themeFilesDelete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"themeId"},value:{kind:"Variable",name:{kind:"Name",value:"themeId"}}},{kind:"Argument",name:{kind:"Name",value:"files"},value:{kind:"Variable",name:{kind:"Name",value:"files"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deletedThemeFiles"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filename"}},{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"metafieldDefinitionsByOwnerType"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ownerType"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"MetafieldOwnerType"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metafieldDefinitions"},arguments:[{kind:"Argument",name:{kind:"Name",value:"ownerType"},value:{kind:"Variable",name:{kind:"Name",value:"ownerType"}}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"250"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"type"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"category"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getThemes"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themes"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"50"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"processing"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var M={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getTheme"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"theme"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"processing"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"findDevelopmentThemeByName"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"themes"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"2"}},{kind:"Argument",name:{kind:"Name",value:"names"},value:{kind:"ListValue",values:[{kind:"Variable",name:{kind:"Name",value:"name"}}]}},{kind:"Argument",name:{kind:"Name",value:"roles"},value:{kind:"ListValue",values:[{kind:"EnumValue",value:"DEVELOPMENT"}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"role"}},{kind:"Field",name:{kind:"Name",value:"processing"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};l();var $={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"OnlineStorePasswordProtection"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"onlineStore"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"passwordProtection"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var Q="https://cdn.shopify.com/static/online-store/theme-skeleton.zip",c={useNetworkLevelRetry:!0,useAbortSignal:!1,maxRetryTimeMs:90*1e3,recordCommandRetries:!0},z="the required theme access scope";async function sn(e,n){let a=S(e);s("theme-api:fetch-theme");try{let{theme:i}=await p({query:M,session:n,variables:{id:a},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(i)return y({id:f(i.id),processing:i.processing,role:i.role.toLowerCase(),name:i.name})}catch(i){H(i),k(i),V(`Error fetching theme with ID: ${e}`)}}async function un(e){let n=[],a=null;for(s("theme-api:fetch-themes");;){let i=await T({query:R,session:e,variables:{after:a},responseOptions:{handleErrors:!1},preferredBehaviour:c});i.themes||r("Failed to fetch themes");let{nodes:t,pageInfo:d}=i.themes;if(t.forEach(m=>{let o=y({id:f(m.id),processing:m.processing,role:m.role.toLowerCase(),name:m.name});o&&n.push(o)}),!d.hasNextPage)return n;a=d.endCursor}}async function kn(e,n){s("theme-api:find-development-theme-by-name");let{themes:a}=await T({query:G,session:n,variables:{name:e},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(a||r("Failed to fetch themes"),a.nodes.length>1)throw k(new N(`More than one development theme is named "${e}"`));if(a.nodes.length===1){let{id:i,processing:t,role:d,name:m}=a.nodes[0];return y({id:f(i),processing:t,role:d.toLowerCase(),name:m})}}async function cn(e,n){let a=e.src??Q;s("theme-api:create-theme");let{themeCreate:i}=await T({query:B,session:n,variables:{name:e.name??"",source:a,role:(e.role??g).toUpperCase()},responseOptions:{handleErrors:!1},preferredBehaviour:c});i||r("Failed to create theme");let{theme:t,userErrors:d}=i;if(d.length){let m=i.userErrors.map(o=>o.message).join(", ");throw k(new N(m))}return t||r("Failed to create theme"),y({id:f(t.id),name:t.name,role:t.role.toLowerCase()})}async function pn(e,n,a){let i=[],t=null;for(s("theme-api:fetch-assets");;){let d=await T({query:C,session:a,variables:{id:D(e),filenames:n,after:t},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(!d.theme?.files?.nodes||!d.theme?.files?.pageInfo){let u=d.theme?.files?.userErrors.map(h=>h.filename).join(", ");r(`Error fetching assets: ${u}`)}let{nodes:m,pageInfo:o}=d.theme.files;if(i.push(...await Promise.all(m.map(async u=>{let{attachment:h,value:v}=await J(u.body);return{attachment:h,key:u.filename,checksum:u.checksumMd5,value:v}}))),!o.hasNextPage)return i;t=o.endCursor}}async function vn(e,n,a){let t=[];s("theme-api:delete-assets");for(let d=0;d<n.length;d+=50){let m=n.slice(d,d+50),{themeFilesDelete:o}=await p({query:U,session:a,variables:{themeId:S(e),files:m},preferredBehaviour:c});o||r("Failed to delete theme assets");let{deletedThemeFiles:u,userErrors:h}=o;u&&u.forEach(v=>{t.push({key:v.filename,success:!0,operation:F.Delete})}),h.length>0&&h.forEach(v=>{v.filename?(k(`Asset deletion failed for ${v.filename}: ${v.message}`),t.push({key:v.filename,success:!1,operation:F.Delete,errors:{asset:[v.message]}})):r(`Failed to delete theme assets: ${v.message}`)})}return t}async function Nn(e,n,a){let i=[];s("theme-api:bulk-upload-assets");for(let t=0;t<n.length;t+=50){let d=n.slice(t,t+50),m=X(d);b("theme-api:upload-files");let o=await K(e,m,a);b("theme-api:upload-files"),i.push(...W(o))}return i}function X(e){return e.map(n=>n.attachment?{filename:n.key,body:{type:"BASE64",value:n.attachment}}:{filename:n.key,body:{type:"TEXT",value:n.value??""}})}async function K(e,n,a){return p({query:P,session:a,variables:{themeId:D(e),files:n},preferredBehaviour:c})}function W(e){let{themeFilesUpsert:n}=e;n||r("Failed to upload theme files");let{upsertedThemeFiles:a,userErrors:i}=n,t=[];return a?.forEach(d=>{t.push({key:d.filename,success:!0,operation:F.Upload})}),i.forEach(d=>{d.filename||r(`Error uploading theme files: ${d.message}`),k(`Asset upload failed for ${d.filename}: ${d.message}`),t.push({key:d.filename,success:!1,operation:F.Upload,errors:{asset:[d.message]}})}),t}async function hn(e,n){let a=[],i=null;for(s("theme-api:fetch-checksums");;){let t=await T({query:q,session:n,variables:{id:D(e),after:i},responseOptions:{handleErrors:!1},preferredBehaviour:c});if(!t?.theme?.files?.nodes||!t?.theme?.files?.pageInfo){let o=t.theme?.files?.userErrors.map(u=>u.filename).join(", ");throw k(new N(`Failed to fetch checksums for: ${o}`))}let{nodes:d,pageInfo:m}=t.theme.files;if(a.push(...d.map(o=>({key:o.filename,checksum:o.checksumMd5}))),!m.hasNextPage)return a;i=m.endCursor}}async function fn(e,n,a){let i=n.name,t={};i&&(t.name=i),s("theme-api:update-theme");let{themeUpdate:d}=await p({query:A,session:a,variables:{id:S(e),input:t},preferredBehaviour:c});d||r("Failed to update theme");let{theme:m,userErrors:o}=d;if(o.length){let u=d.userErrors.map(h=>h.message).join(", ");throw k(new N(u))}return m||r("Failed to update theme"),y({id:f(m.id),name:m.name,role:m.role.toLowerCase()})}async function yn(e,n){s("theme-api:publish-theme");let{themePublish:a}=await p({query:O,session:n,variables:{id:S(e)},preferredBehaviour:c});a||r("Failed to update theme");let{theme:i,userErrors:t}=a;if(t.length){let d=a.userErrors.map(m=>m.message).join(", ");throw k(new N(d))}return i||r("Failed to update theme"),y({id:f(i.id),name:i.name,role:i.role.toLowerCase()})}async function Sn(e,n){s("theme-api:delete-theme");let{themeDelete:a}=await p({query:x,session:n,variables:{id:S(e)},preferredBehaviour:c});a||r("Failed to update theme");let{deletedThemeId:i,userErrors:t}=a;if(t.length){let d=a.userErrors.map(m=>m.message).join(", ");throw k(new N(d))}return i||r("Failed to update theme"),!0}async function Fn(e,n,a){let i;s("theme-api:duplicate-theme");let{themeDuplicate:t}=await p({query:I,session:a,variables:{id:S(e),name:n},preferredBehaviour:c,responseOptions:{onResponse:u=>{i=u.headers.get("x-request-id")??void 0}}});if(!t)return k("Failed to duplicate theme"),{theme:void 0,userErrors:[{message:"Failed to duplicate theme"}],requestId:i};let{newTheme:d,userErrors:m}=t;return m.length>0?{theme:void 0,userErrors:m,requestId:i}:d?{theme:y({id:f(d.id),name:d.name,role:d.role.toLowerCase()}),userErrors:[],requestId:i}:{theme:void 0,userErrors:[{message:"Failed to duplicate theme"}],requestId:i}}async function Tn(e,n){s("theme-api:fetch-metafield-definitions");let{metafieldDefinitions:a}=await p({query:L,session:n,variables:{ownerType:e}});return a.nodes.map(i=>({key:i.key,namespace:i.namespace,name:i.name,description:i.description,type:{name:i.type.name,category:i.type.category}}))}async function bn(e){s("theme-api:check-password-protection");let{onlineStore:n}=await p({query:$,session:e});n||r("Unable to get details about the storefront's password protection");let{passwordProtection:a}=n;return a.enabled}function r(e){throw k(new N(e))}async function T(e){try{return await p(e)}catch(n){throw H(n),n}}function H(e){if(!(e instanceof E))return;let n=Y(e);if(!n)return;let a=[["If you authenticated with an Admin API access token, update the app or integration that issued the token to include the required theme access scopes, then reauthorize it or generate a new token."],["For",{command:"theme pull"},{char:","},{command:"theme list"},{char:","},"and",{command:"theme info"},{char:","},"add the",{command:"read_themes"},"scope",{char:"."}],["For",{command:"theme push"},"and",{command:"theme dev"},{char:","},"add both the",{command:"read_themes"},"and",{command:"write_themes"},"scopes",{char:"."}],["If you authenticated with your Shopify account, make sure your staff or collaborator account can access Online Store themes, then run",{command:"shopify auth logout"},"and try again",{char:"."}],["See",{link:{label:"Shopify access scopes",url:"https://shopify.dev/api/usage/access-scopes"}},{char:"."}]];throw k(new N(`The authenticated account or access token is missing ${n}.`,void 0,a))}function Y(e){let n=e.response.errors;if(!Array.isArray(n))return;let a=n.find(t=>t.extensions?.code==="ACCESS_DENIED");if(!a)return;let i=a.extensions?.requiredAccess;return typeof i!="string"?z:Z(i)}function Z(e){return e.trim().replace(/\.$/,"").replace(/^The user needs\s+/i,"")||z}function D(e){return`gid://shopify/OnlineStoreTheme/${e}`}async function J(e){switch(e.__typename){case"OnlineStoreThemeFileBodyText":return{value:e.content};case"OnlineStoreThemeFileBodyBase64":return{attachment:e.contentBase64};case"OnlineStoreThemeFileBodyUrl":try{let a=await(await fetch(e.url)).arrayBuffer();return{attachment:Buffer.from(a).toString("base64")}}catch{throw k(new N(`Error downloading content from URL: ${e.url}`))}}}export{se as a,g as b,ie as c,ae as d,te as e,de as f,sn as g,un as h,kn as i,cn as j,pn as k,vn as l,Nn as m,hn as n,fn as o,yn as p,Sn as q,Fn as r,Tn as s,bn as t};
@@ -1,4 +1,4 @@
1
- import{b as U,c as w}from"./chunk-762IKULK.js";import{c as O,e as T}from"./chunk-XTOOTN4P.js";import{B as y,m as E,t as N,u as R,v as g,z as _}from"./chunk-5VRB3FBD.js";import{q as S,s as h}from"./chunk-AODTY2BL.js";import{a as s}from"./chunk-GYVQIRBD.js";import{S as F,W as C,z as x}from"./chunk-7YXHILW4.js";import{i as v}from"./chunk-4HBKQUKY.js";import{Cb as c,Eb as p,Kb as d,Nb as u,Ob as M,tb as D,wb as V,xb as P}from"./chunk-62GA7XR3.js";import{d as J}from"./chunk-PT3OZEBI.js";import{o as $,p as A,q as L}from"./chunk-6IDEDOXW.js";import{a as H}from"./chunk-CX5CC6P5.js";import{e as B,g as I}from"./chunk-VKWPEFWQ.js";I();var Y=B(H());function j(){let e=V();if(!(!e||e==="unknown"))return e==="homebrew"?"brew upgrade shopify-cli":e==="yarn"?`${e} global add @shopify/cli@latest`:`${e} ${e==="pnpm"?"add":"install"} -g @shopify/cli@latest`}async function fe(e={}){let n=L()??A(),o=P(n),t=D();if(J()){d("Skipping upgrade in development mode.");return}if(!(e.autoupgrade&&!t))if(t){let r=j();if(!r)throw new Error("Could not determine the package manager");let[a,...i]=r.split(" ");if(!a)throw new Error("Could not determine the command to run");let l=g("@shopify/cli",s),q=l?`\u2728 New version of Shopify CLI available! (${s} \u2192 ${l})`:"\u2728 New version of Shopify CLI available!";d(p`${q}
1
+ import{b as U,c as w}from"./chunk-EBAV3Z54.js";import{c as O,e as T}from"./chunk-SNBJDHF2.js";import{B as y,m as E,t as N,u as R,v as g,z as _}from"./chunk-G7HOEDC3.js";import{q as S,s as h}from"./chunk-KW5SQ6PG.js";import{a as s}from"./chunk-EGWRLGF4.js";import{S as F,W as C,z as x}from"./chunk-J6XOTLT5.js";import{i as v}from"./chunk-QF453PH7.js";import{Cb as c,Eb as p,Kb as d,Nb as u,Ob as M,tb as D,wb as V,xb as P}from"./chunk-QY73XOBU.js";import{d as J}from"./chunk-JTEP5MP2.js";import{o as $,p as A,q as L}from"./chunk-6IDEDOXW.js";import{a as H}from"./chunk-CX5CC6P5.js";import{e as B,g as I}from"./chunk-VKWPEFWQ.js";I();var Y=B(H());function j(){let e=V();if(!(!e||e==="unknown"))return e==="homebrew"?"brew upgrade shopify-cli":e==="yarn"?`${e} global add @shopify/cli@latest`:`${e} ${e==="pnpm"?"add":"install"} -g @shopify/cli@latest`}async function fe(e={}){let n=L()??A(),o=P(n),t=D();if(J()){d("Skipping upgrade in development mode.");return}if(!(e.autoupgrade&&!t))if(t){let r=j();if(!r)throw new Error("Could not determine the package manager");let[a,...i]=r.split(" ");if(!a)throw new Error("Could not determine the command to run");let l=g("@shopify/cli",s),q=l?`\u2728 New version of Shopify CLI available! (${s} \u2192 ${l})`:"\u2728 New version of Shopify CLI available!";d(p`${q}
2
2
  Now upgrading by running: ${c.genericShellCommand(r)}...`),await F(a,i,{stdio:"inherit"});let f=await U();if(!f)throw new v("Couldn't verify the Shopify CLI version after upgrading.",p`Check the installed version by running ${c.genericShellCommand("shopify version")}.`);let k=l??s;if((0,Y.lt)(f,k))throw new v(`Failed to upgrade Shopify CLI. Expected to be on version ${k}, but version ${f} is now installed.`,"Your package manager may be resolving @shopify/cli from a registry with outdated versions. Check your npm registry configuration and try again.");x({headline:"Shopify CLI upgraded.",body:`You're now on version ${f}.`})}else if(o)await z(o,s);else throw new Error("Could not determine the local project directory")}function ge(){let e=s,n=g("@shopify/cli",e);if(!n){u("Auto-upgrade: No newer version available.");return}if(process.env.SHOPIFY_CLI_FORCE_AUTO_UPGRADE==="1")return u("Auto-upgrade: Forcing auto-upgrade because of SHOPIFY_CLI_FORCE_AUTO_UPGRADE."),n;if(!h()){u("Auto-upgrade: Skipping because auto-upgrade is not enabled.");return}if(C()){u("Auto-upgrade: Skipping auto-upgrade in CI.");return}if(w(e)){u("Auto-upgrade: Skipping auto-upgrade for pre-release version.");return}return n}async function me(){try{let{notifications:e}=await O();return T(e,"",["autoupgrade"]).some(o=>o.type==="error")}catch{return!1}}async function he(){if(C()||w(s)||h())return;let e=g("@shopify/cli",s);e&&await S("warn-on-available-upgrade",{days:1},async()=>{M(K(e))})}function K(e,n=!1){let o=j(),t=o?p`💡 Version ${e} available! Run ${c.genericShellCommand(o)}`.value:p`💡 Version ${e} available!`.value;if(n){let r=`https://github.com/Shopify/cli/releases/tag/${e}`,a=p`⚠️ This is a major version — review breaking changes before upgrading:\n ${c.link(r,r)}`.value;return`${t}
3
3
 
4
4
  ${a}`}return t}async function z(e,n){let o=(await y(e)).content,t=o.dependencies??{},r=o.devDependencies??{},i={...t,...r}[await b()];if(!i){u("Auto-upgrade: CLI dependency not found in project dependencies, skipping local upgrade.");return}i.slice(0,1).match(/[\^~]/)&&(i=n);let l=await R(await b(),i);l?Z(i,l):X(i),await G("prod",t,e),await G("dev",r,e)}async function G(e,n,o){let t=[await b(),...await Q()].filter(a=>!!n[a]).map(a=>({name:a,version:"latest"})),r=await N(o);t.length>0&&await _(t,{packageManager:await E(o),type:e,directory:o,stdout:process.stdout,stderr:process.stderr,addToRootDirectory:r})}async function b(){return(await W()).name}async function Q(){return(await W())?.oclif?.plugins??[]}var m;async function W(){if(!m){let e=await y($(import.meta.url));m=m??e.content}return m}function X(e){d(p`You're on the latest version, ${c.yellow(e)}, no need to upgrade!`)}function Z(e,n){d(p`Upgrading CLI from ${c.yellow(e)} to ${c.yellow(n)}...`)}export{j as a,fe as b,ge as c,me as d,he as e,K as f};
@@ -1,3 +1,3 @@
1
- import{a as S}from"./chunk-VJEKDBGZ.js";import{b as f}from"./chunk-2VGPNRHH.js";import{f as k}from"./chunk-MWWULCLD.js";import{i}from"./chunk-4HBKQUKY.js";import{Cb as o,Eb as a,Ia as v,Nb as d,Xa as I,_a as E,oa as C}from"./chunk-62GA7XR3.js";import{a as D,r as m}from"./chunk-PT3OZEBI.js";import{p}from"./chunk-6IDEDOXW.js";import{a as T}from"./chunk-CX5CC6P5.js";import{e as G,g as b}from"./chunk-VKWPEFWQ.js";b();var A=G(T()),O=G(S());async function s(t,e){try{return(await f("git",t,{cwd:e})).stdout}catch(r){if(r instanceof Error){let n=new i(r.message);throw n.stack=r.stack,"exitCode"in r&&Object.assign(n,{exitCode:r.exitCode}),n}throw r}}async function Z(t,e="main"){if(e.startsWith("-"))throw new i(`Invalid initial branch name: ${e}. Branch names can't start with a hyphen.`);d(a`Initializing git repository at ${o.path(t)}...`),await w(),await s(["init"],t),await s(["checkout","-b",e],t)}async function V(t,e){try{return(await s(["check-ignore",...e],t)).split(`
2
- `).filter(Boolean)}catch(r){if(r instanceof i&&"exitCode"in r&&r.exitCode===1)return[];throw r}}async function tt(t){return k("cmd_all_timing_network_ms")(async()=>{let{repoUrl:e,destination:r,shallow:n,latestTag:c}=t;if(d(a`Git-cloning repository ${e} into ${o.path(r)}...`),await w(),await I(r)){if(!await v(r))throw new i(a`Can't clone to ${o.path(r)}`,"The path exists but isn't a directory.");if((await E(["*",".*"],{cwd:r,deep:1,onlyFiles:!1})).length>0)throw new i(a`Directory ${o.path(r)} already exists and is not empty`,a`Choose a different name or remove the existing directory first.`)}let[h,g]=e.split("#");if(g&&c)throw new i("Error cloning the repository. Git can't clone the latest release with a 'branch'.");if(n&&c)throw new i("Error cloning the repository. Git can't clone the latest release with the 'shallow' property.");let l=["clone","--recurse-submodules"];g&&l.push("--branch",g),n&&l.push("--depth","1"),D()||l.push("-c","core.askpass=true"),l.push(h,r);try{if(await f("git",l),c){let u=await _(r,e);await s(["checkout",u],r)}}catch(u){if(u instanceof i)throw u;if(u instanceof Error){let $=new i(u.message);throw $.stack=u.stack,$}throw u}})}async function _(t,e){let r=await L(t);if(!r)throw new i(`Couldn't obtain the most recent tag of the repository ${e}`);return r}async function et(t){let r=await s(["log","-1","--format=%H%x00%ai%x00%s%x00%D%x00%b%x00%an%x00%ae"],t);if(!r.trim())throw new i("Must have at least one commit to run command",a`Run ${o.genericShellCommand("git commit -m 'Initial commit'")} to create your first commit.`);let n=r.split("\0");return{hash:n[0],date:n[1],message:n[2],refs:n[3],body:n[4],author_name:n[5],author_email:n[6]}}async function rt(t){await s(["add","--all"],t)}async function nt(t,e){let r=["commit","-m",t];if(e?.author){if(e.author.startsWith("-"))throw new i(`Invalid commit author: ${e.author}. Author name/email can't start with a hyphen.`);r.push("--author",e.author)}return await s(r,e?.directory),(await s(["rev-parse","HEAD"],e?.directory)).trim()}async function w(){if(!await m())throw new i("Git is necessary in the environment to continue",a`Install ${o.link("git","https://git-scm.com/book/en/v2/Getting-Started-Installing-Git")}`)}function F(t){let e=/^git version (?<version>\d+\.\d+\.\d+)(?<suffix>[.\s-].*)?$/.exec(t.trim()),r=e?.groups?.version;if(!r)return;let c=/^(?:\.rc|-rc\.?)(?<number>\d+)(?:[.\s-].*)?$/.exec(e.groups?.suffix??"")?.groups?.number;return c?`${r}-rc.${c}`:r}async function it(t,e={}){let r=await C(c=>H(t,{cwd:e.cwd,env:{GIT_DIR:c}})),n=F(r);if(!n)throw d(a`Unrecognized git --version output: ${o.raw(JSON.stringify(r.slice(0,200)))}`),new i("Couldn't determine the installed Git version.",`Install Git ${t} or later, then try again.`);if((0,A.lt)(n,t))throw new i(`Git ${t} or later is required, but version ${n} is installed.`,`Upgrade Git to version ${t} or later, then try again.`)}async function H(t,e){let{captureOutput:r}=await import("./system-6WYK24ET.js");try{return await r("git",["--version"],e)}catch(n){if(n instanceof i)throw n;if(n instanceof Error&&"code"in n&&n.code==="ENOENT")throw new i(`Git ${t} or later is required, but Git isn't installed.`,`Install Git ${t} or later, then try again.`);let c=n instanceof Error?n.message:String(n);d(a`Couldn't run git --version: ${o.raw(c)}`);let h=n instanceof Error&&"stderr"in n&&typeof n.stderr=="string"?n.stderr.trim():"";throw new i(h?`Couldn't run Git to check its version: ${h}`:"Couldn't run Git to check its version.",`Check that Git ${t} or later is installed and can run, then try again.`)}}var y=class extends i{};async function ot(t){if(await w(),!await R(t))throw new y(`${o.path(t??p())} is not a Git directory`)}async function at(t){return await m()?R(t):!1}async function R(t){try{return await f("git",["rev-parse","--git-dir"],{cwd:t}),!0}catch(e){if(e instanceof Error&&"exitCode"in e&&e.exitCode===128)return!1;throw e}}var x=class extends i{};async function st(t){if(!await j(t))throw new x(`${o.path(t??p())} is not a clean Git directory`)}async function j(t){return(await s(["status","--porcelain"],t)).trim()===""}async function L(t){try{return(await s(["describe","--tags","--abbrev=0"],t)).trim()||void 0}catch(e){if(e instanceof i&&"exitCode"in e&&e.exitCode===128)return;throw e}}async function ct(t,e="origin"){if(d(a`Removing git remote ${e} from ${o.path(t)}...`),await w(),!(await s(["remote"],t)).split(`
1
+ import{a as S}from"./chunk-VJEKDBGZ.js";import{b as f}from"./chunk-VWKMTYCN.js";import{f as k}from"./chunk-6MELTJU3.js";import{i}from"./chunk-QF453PH7.js";import{Cb as o,Eb as a,Ia as v,Nb as d,Xa as I,_a as E,oa as C}from"./chunk-QY73XOBU.js";import{a as D,r as m}from"./chunk-JTEP5MP2.js";import{p}from"./chunk-6IDEDOXW.js";import{a as T}from"./chunk-CX5CC6P5.js";import{e as G,g as b}from"./chunk-VKWPEFWQ.js";b();var A=G(T()),O=G(S());async function s(t,e){try{return(await f("git",t,{cwd:e})).stdout}catch(r){if(r instanceof Error){let n=new i(r.message);throw n.stack=r.stack,"exitCode"in r&&Object.assign(n,{exitCode:r.exitCode}),n}throw r}}async function Z(t,e="main"){if(e.startsWith("-"))throw new i(`Invalid initial branch name: ${e}. Branch names can't start with a hyphen.`);d(a`Initializing git repository at ${o.path(t)}...`),await w(),await s(["init"],t),await s(["checkout","-b",e],t)}async function V(t,e){try{return(await s(["check-ignore",...e],t)).split(`
2
+ `).filter(Boolean)}catch(r){if(r instanceof i&&"exitCode"in r&&r.exitCode===1)return[];throw r}}async function tt(t){return k("cmd_all_timing_network_ms")(async()=>{let{repoUrl:e,destination:r,shallow:n,latestTag:c}=t;if(d(a`Git-cloning repository ${e} into ${o.path(r)}...`),await w(),await I(r)){if(!await v(r))throw new i(a`Can't clone to ${o.path(r)}`,"The path exists but isn't a directory.");if((await E(["*",".*"],{cwd:r,deep:1,onlyFiles:!1})).length>0)throw new i(a`Directory ${o.path(r)} already exists and is not empty`,a`Choose a different name or remove the existing directory first.`)}let[h,g]=e.split("#");if(g&&c)throw new i("Error cloning the repository. Git can't clone the latest release with a 'branch'.");if(n&&c)throw new i("Error cloning the repository. Git can't clone the latest release with the 'shallow' property.");let l=["clone","--recurse-submodules"];g&&l.push("--branch",g),n&&l.push("--depth","1"),D()||l.push("-c","core.askpass=true"),l.push(h,r);try{if(await f("git",l),c){let u=await _(r,e);await s(["checkout",u],r)}}catch(u){if(u instanceof i)throw u;if(u instanceof Error){let $=new i(u.message);throw $.stack=u.stack,$}throw u}})}async function _(t,e){let r=await L(t);if(!r)throw new i(`Couldn't obtain the most recent tag of the repository ${e}`);return r}async function et(t){let r=await s(["log","-1","--format=%H%x00%ai%x00%s%x00%D%x00%b%x00%an%x00%ae"],t);if(!r.trim())throw new i("Must have at least one commit to run command",a`Run ${o.genericShellCommand("git commit -m 'Initial commit'")} to create your first commit.`);let n=r.split("\0");return{hash:n[0],date:n[1],message:n[2],refs:n[3],body:n[4],author_name:n[5],author_email:n[6]}}async function rt(t){await s(["add","--all"],t)}async function nt(t,e){let r=["commit","-m",t];if(e?.author){if(e.author.startsWith("-"))throw new i(`Invalid commit author: ${e.author}. Author name/email can't start with a hyphen.`);r.push("--author",e.author)}return await s(r,e?.directory),(await s(["rev-parse","HEAD"],e?.directory)).trim()}async function w(){if(!await m())throw new i("Git is necessary in the environment to continue",a`Install ${o.link("git","https://git-scm.com/book/en/v2/Getting-Started-Installing-Git")}`)}function F(t){let e=/^git version (?<version>\d+\.\d+\.\d+)(?<suffix>[.\s-].*)?$/.exec(t.trim()),r=e?.groups?.version;if(!r)return;let c=/^(?:\.rc|-rc\.?)(?<number>\d+)(?:[.\s-].*)?$/.exec(e.groups?.suffix??"")?.groups?.number;return c?`${r}-rc.${c}`:r}async function it(t,e={}){let r=await C(c=>H(t,{cwd:e.cwd,env:{GIT_DIR:c}})),n=F(r);if(!n)throw d(a`Unrecognized git --version output: ${o.raw(JSON.stringify(r.slice(0,200)))}`),new i("Couldn't determine the installed Git version.",`Install Git ${t} or later, then try again.`);if((0,A.lt)(n,t))throw new i(`Git ${t} or later is required, but version ${n} is installed.`,`Upgrade Git to version ${t} or later, then try again.`)}async function H(t,e){let{captureOutput:r}=await import("./system-KVPOFMPA.js");try{return await r("git",["--version"],e)}catch(n){if(n instanceof i)throw n;if(n instanceof Error&&"code"in n&&n.code==="ENOENT")throw new i(`Git ${t} or later is required, but Git isn't installed.`,`Install Git ${t} or later, then try again.`);let c=n instanceof Error?n.message:String(n);d(a`Couldn't run git --version: ${o.raw(c)}`);let h=n instanceof Error&&"stderr"in n&&typeof n.stderr=="string"?n.stderr.trim():"";throw new i(h?`Couldn't run Git to check its version: ${h}`:"Couldn't run Git to check its version.",`Check that Git ${t} or later is installed and can run, then try again.`)}}var y=class extends i{};async function ot(t){if(await w(),!await R(t))throw new y(`${o.path(t??p())} is not a Git directory`)}async function at(t){return await m()?R(t):!1}async function R(t){try{return await f("git",["rev-parse","--git-dir"],{cwd:t}),!0}catch(e){if(e instanceof Error&&"exitCode"in e&&e.exitCode===128)return!1;throw e}}var x=class extends i{};async function st(t){if(!await j(t))throw new x(`${o.path(t??p())} is not a clean Git directory`)}async function j(t){return(await s(["status","--porcelain"],t)).trim()===""}async function L(t){try{return(await s(["describe","--tags","--abbrev=0"],t)).trim()||void 0}catch(e){if(e instanceof i&&"exitCode"in e&&e.exitCode===128)return;throw e}}async function ct(t,e="origin"){if(d(a`Removing git remote ${e} from ${o.path(t)}...`),await w(),!(await s(["remote"],t)).split(`
3
3
  `).filter(Boolean).includes(e)){d(a`Remote ${e} does not exist, no action needed`);return}await s(["remote","remove",e],t)}export{Z as a,V as b,tt as c,et as d,rt as e,nt as f,it as g,ot as h,at as i,x as j,st as k,j as l,ct as m};
@@ -1,4 +1,4 @@
1
- import{b as i,c as r,d as p}from"./chunk-3N6NKC2U.js";import{b as s,c as e}from"./chunk-SUTVPAJF.js";import{b as o}from"./chunk-DCKRQZLE.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var t=class u extends o{static summary="Disable automatic upgrades for Shopify CLI.";static descriptionWithMarkdown=`Disable automatic upgrades for Shopify CLI.
1
+ import{b as i,c as r,d as p}from"./chunk-5W3YFFC2.js";import{b as s,c as e}from"./chunk-DWMRVMKX.js";import{b as o}from"./chunk-FSWOB535.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var t=class u extends o{static summary="Disable automatic upgrades for Shopify CLI.";static descriptionWithMarkdown=`Disable automatic upgrades for Shopify CLI.
2
2
 
3
3
  When auto-upgrade is disabled, Shopify CLI won't automatically update. Run \`shopify upgrade\` to update manually.
4
4
 
@@ -1,4 +1,4 @@
1
- import{b as h}from"./chunk-DCKRQZLE.js";import{Aa as c,Ga as g,ya as u}from"./chunk-62GA7XR3.js";import{c as f,p}from"./chunk-6IDEDOXW.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();var d=f(p(),"/docs-shopify.dev/commands"),m=class extends h{static description="Generate CLI commands documentation";static hidden=!0;async run(){let a=this.config.commands;await g(d),await c(d);let o=a.sort((e,i)=>e.id.length-i.id.length).filter(e=>!b(e)).map(e=>{let i=k(e);return N(e,i)});await Promise.all(o)}},C=["commands","help","plugins"];function b(t){return t.hidden?(C.push(t.id),!0):t.pluginType==="user"?!0:C.some(a=>t.id.startsWith(`${a}:`))}function k(t){let a=t.id.replace(/[:]/g," "),s=t.id.replace(/[:]/g,"-"),o=t.id.replace(/[:-]/g,"");return{commandName:a,fileName:s,interfaceName:o}}async function N(t,{commandName:a,fileName:s,interfaceName:o}){let e=Object.keys(t.flags).map(r=>{let n=t.flags[r];if(!n||n.hidden)return;let $=n.description??"",w=n.char?`-${n.char}, `:"",y=n.type==="option"?"string":"''",v=n.type==="option"?" <value>":"",x=n.required?"":"?",D=n.env!==void 0?` @environment ${n.env}`:"";return` /**
1
+ import{b as h}from"./chunk-FSWOB535.js";import{Aa as c,Ga as g,ya as u}from"./chunk-QY73XOBU.js";import{c as f,p}from"./chunk-6IDEDOXW.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();var d=f(p(),"/docs-shopify.dev/commands"),m=class extends h{static description="Generate CLI commands documentation";static hidden=!0;async run(){let a=this.config.commands;await g(d),await c(d);let o=a.sort((e,i)=>e.id.length-i.id.length).filter(e=>!b(e)).map(e=>{let i=k(e);return N(e,i)});await Promise.all(o)}},C=["commands","help","plugins"];function b(t){return t.hidden?(C.push(t.id),!0):t.pluginType==="user"?!0:C.some(a=>t.id.startsWith(`${a}:`))}function k(t){let a=t.id.replace(/[:]/g," "),s=t.id.replace(/[:]/g,"-"),o=t.id.replace(/[:-]/g,"");return{commandName:a,fileName:s,interfaceName:o}}async function N(t,{commandName:a,fileName:s,interfaceName:o}){let e=Object.keys(t.flags).map(r=>{let n=t.flags[r];if(!n||n.hidden)return;let $=n.description??"",w=n.char?`-${n.char}, `:"",y=n.type==="option"?"string":"''",v=n.type==="option"?" <value>":"",x=n.required?"":"?",D=n.env!==void 0?` @environment ${n.env}`:"";return` /**
2
2
  * ${$}
3
3
  *${D}
4
4
  */
@@ -1 +1 @@
1
- import{a as t}from"./chunk-LG6DGIFX.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();async function r(d){await t.addPublicMetadata(()=>d)}export{r as a};
1
+ import{a as t}from"./chunk-SUIVO7GI.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();async function r(d){await t.addPublicMetadata(()=>d)}export{r as a};
@@ -1 +1 @@
1
- import{a as r}from"./chunk-5NCWBBRW.js";import{a as t}from"./chunk-ARRRFY6S.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();var a=class extends t{static hidden=!0;static flags={...t.flags};static baseFlags={...t.baseFlags};async run(){return r({from:"app import-custom-data-definitions",to:"app import custom-data-definitions"}),super.run()}};export{a};
1
+ import{a as r}from"./chunk-MJIGXNI3.js";import{a as t}from"./chunk-3OSGEQWG.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();var a=class extends t{static hidden=!0;static flags={...t.flags};static baseFlags={...t.baseFlags};async run(){return r({from:"app import-custom-data-definitions",to:"app import custom-data-definitions"}),super.run()}};export{a};