shopify 5.0.2 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (526) hide show
  1. package/dist/analytics-QFDTQYPM.js +1 -0
  2. package/dist/analytics-XADBBHOH.js +1 -0
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/chunk-24Q6X53V.js +1 -0
  5. package/dist/{chunk-LEHBZKK3.js → chunk-25MYHE4W.js} +1 -1
  6. package/dist/{chunk-TODZ3TJR.js → chunk-27JT4NA4.js} +1 -1
  7. package/dist/chunk-2BYW3BYX.js +1 -0
  8. package/dist/chunk-2KFYIYLI.js +1 -0
  9. package/dist/{chunk-D2KIGKBI.js → chunk-2KUM2RU4.js} +60 -60
  10. package/dist/chunk-2PD7TNFS.js +275 -0
  11. package/dist/{chunk-64G5TGFF.js → chunk-3C72S6LO.js} +1 -1
  12. package/dist/chunk-3FZ4LE6A.js +10 -0
  13. package/dist/{chunk-3MYDSQHF.js → chunk-3GD5ESWN.js} +1 -1
  14. package/dist/chunk-3KGN6N7E.js +1 -0
  15. package/dist/{chunk-KNWT7JLL.js → chunk-3MZ7ELHS.js} +2 -2
  16. package/dist/{chunk-PF53E2DC.js → chunk-3PS52ZT4.js} +1 -1
  17. package/dist/chunk-3PYDIBTX.js +1 -0
  18. package/dist/chunk-3Z75BVGJ.js +1 -0
  19. package/dist/chunk-4FWPOGPQ.js +1 -0
  20. package/dist/chunk-4IP37MBX.js +1 -0
  21. package/dist/chunk-4NFX7YCT.js +1 -0
  22. package/dist/chunk-4TCXPHKN.js +1 -0
  23. package/dist/chunk-4WBWZIN5.js +6 -0
  24. package/dist/chunk-5534MHZW.js +97 -0
  25. package/dist/{chunk-UKWIWCOH.js → chunk-5C6CXU74.js} +1 -1
  26. package/dist/{chunk-QEKGGTMN.js → chunk-5HOZDOJ7.js} +1 -1
  27. package/dist/{chunk-ER6C5WS3.js → chunk-5PSQFQL6.js} +1 -1
  28. package/dist/chunk-5T3ZT6CC.js +1 -0
  29. package/dist/chunk-62NW4EPI.js +17 -0
  30. package/dist/chunk-65NCQJYR.js +1 -0
  31. package/dist/{chunk-IHXGZW42.js → chunk-6BYHL3DS.js} +1 -1
  32. package/dist/chunk-6I7DT7QR.js +3 -0
  33. package/dist/chunk-6IMTMS2S.js +3 -0
  34. package/dist/chunk-7A77JCED.js +11 -0
  35. package/dist/chunk-7ART2IKU.js +1 -0
  36. package/dist/{chunk-I4CEH7AK.js → chunk-7BPT5V24.js} +2 -2
  37. package/dist/{chunk-Z2WAW6MM.js → chunk-7CT3NIXI.js} +1 -1
  38. package/dist/chunk-7DBKSSDK.js +1 -0
  39. package/dist/chunk-7HECBXSP.js +1 -0
  40. package/dist/chunk-7KID5BIR.js +4 -0
  41. package/dist/{chunk-2L6AN3QA.js → chunk-7N7KRZOM.js} +1 -1
  42. package/dist/{chunk-W37IFK3P.js → chunk-7NRHZG5Y.js} +102 -102
  43. package/dist/chunk-7PHDEILV.js +1 -0
  44. package/dist/chunk-A2NSORBM.js +2296 -0
  45. package/dist/chunk-A54TADAZ.js +1 -0
  46. package/dist/{chunk-YTUUU33R.js → chunk-AE3IQG7S.js} +1 -1
  47. package/dist/chunk-AGTUAQHX.js +4 -0
  48. package/dist/chunk-AHYI27QL.js +11 -0
  49. package/dist/chunk-ALINJ6J2.js +1 -0
  50. package/dist/chunk-AMVWKHNY.js +1 -0
  51. package/dist/{chunk-NVKJ7ZLP.js → chunk-ASKBYEO7.js} +1 -1
  52. package/dist/{chunk-62EOM3Y2.js → chunk-AVJJGQOP.js} +1 -1
  53. package/dist/{chunk-NXAEBGMO.js → chunk-AY3AAV77.js} +1 -1
  54. package/dist/{chunk-F3CK3EJJ.js → chunk-BFAOTQGH.js} +1 -1
  55. package/dist/{chunk-H6GNKWYM.js → chunk-BPKQA2EO.js} +1 -1
  56. package/dist/{chunk-WESTVWWD.js → chunk-C2HJEGTS.js} +1 -1
  57. package/dist/chunk-C72QNK6O.js +4 -0
  58. package/dist/chunk-CDSDQTNB.js +16 -0
  59. package/dist/chunk-CEQGOCKX.js +1 -0
  60. package/dist/{chunk-WCC52MR2.js → chunk-CIGWIKOW.js} +1 -1
  61. package/dist/chunk-CQAD5WML.js +1 -0
  62. package/dist/chunk-CRQQCT7F.js +1 -0
  63. package/dist/chunk-CZNUBAAG.js +3 -0
  64. package/dist/{chunk-ISKQQXLZ.js → chunk-D7IMC2G4.js} +1 -1
  65. package/dist/{chunk-6ES4KRFW.js → chunk-DC7ITY6T.js} +1 -1
  66. package/dist/{chunk-7GHSE7SG.js → chunk-DDRP6QTC.js} +1 -1
  67. package/dist/{chunk-SLY27GDC.js → chunk-DDZYIC76.js} +2 -2
  68. package/dist/chunk-DGIIUQH3.js +1 -0
  69. package/dist/{chunk-3KM5ZOW2.js → chunk-DMOLPSXF.js} +1 -1
  70. package/dist/{chunk-LHXFTFFM.js → chunk-DOLVBTCB.js} +1 -1
  71. package/dist/{chunk-WBVS5NBV.js → chunk-DTKGI43P.js} +2 -2
  72. package/dist/{chunk-2WJOTJOD.js → chunk-DVD7I2TX.js} +2 -2
  73. package/dist/chunk-DVFVO6ZE.js +2 -0
  74. package/dist/{chunk-3XRI3D44.js → chunk-DXEMSLI6.js} +1 -1
  75. package/dist/chunk-EDWIWZWM.js +15 -0
  76. package/dist/chunk-ELR6AZT4.js +9 -0
  77. package/dist/chunk-EVQPYZ7F.js +5 -0
  78. package/dist/chunk-F5QKMDP3.js +1 -0
  79. package/dist/{chunk-URXM5A2K.js → chunk-F6IQWX2F.js} +1 -1
  80. package/dist/{chunk-SACNUF4I.js → chunk-FAVPTYIR.js} +1 -1
  81. package/dist/{chunk-Q7BOSHWX.js → chunk-FDSNRKGQ.js} +1 -1
  82. package/dist/{chunk-Q4JYAUVL.js → chunk-FHKK3QU7.js} +1 -1
  83. package/dist/chunk-FKKJQGYX.js +7 -0
  84. package/dist/chunk-FQLXQ7WN.js +16 -0
  85. package/dist/{chunk-6PUU6ZNQ.js → chunk-FRWQJAW2.js} +1 -1
  86. package/dist/{chunk-J5ERDFIC.js → chunk-FU7PYW7H.js} +1 -1
  87. package/dist/{chunk-ESFCYB46.js → chunk-FYQE5E6U.js} +1 -1
  88. package/dist/chunk-G3EWGBXR.js +1 -0
  89. package/dist/chunk-G3RNO2TC.js +1 -0
  90. package/dist/{chunk-35XFNKNB.js → chunk-GGCP2TIK.js} +1 -1
  91. package/dist/chunk-GSFWBFFH.js +1 -0
  92. package/dist/{chunk-ZRI3SSLG.js → chunk-H2KGP2FM.js} +2 -2
  93. package/dist/{chunk-GW7YIJPJ.js → chunk-H4K3F7PP.js} +1 -1
  94. package/dist/chunk-HGZ2HRPO.js +13 -0
  95. package/dist/chunk-HMPRWNGG.js +203 -0
  96. package/dist/chunk-HP4QYSBQ.js +1 -0
  97. package/dist/{chunk-RPCIFYCY.js → chunk-HSTZV6H7.js} +2 -2
  98. package/dist/{chunk-N57Y7THE.js → chunk-HVUMVDUG.js} +1 -1
  99. package/dist/{chunk-XWSWXQCC.js → chunk-HYCNYUHW.js} +1 -1
  100. package/dist/{chunk-CXI3RHPW.js → chunk-I3WRA2LH.js} +1 -1
  101. package/dist/{chunk-UUAKOX7E.js → chunk-IRLYC626.js} +2 -2
  102. package/dist/chunk-IWNFPBH2.js +33 -0
  103. package/dist/{chunk-C3RFAKWR.js → chunk-JALDNBTU.js} +1 -1
  104. package/dist/{chunk-QDCLL5OI.js → chunk-JC37YZ4I.js} +1 -1
  105. package/dist/{chunk-QF5WKTPD.js → chunk-JG4FAT2T.js} +1 -1
  106. package/dist/chunk-JGLLABZR.js +8 -0
  107. package/dist/chunk-JIY6XWSC.js +1 -0
  108. package/dist/{chunk-3ODQKAEA.js → chunk-JIYCZXK5.js} +1 -1
  109. package/dist/chunk-JMSAHCBU.js +35 -0
  110. package/dist/{chunk-KZRLZWOU.js → chunk-JNSVKDBY.js} +1 -1
  111. package/dist/chunk-JQU2BJDH.js +3 -0
  112. package/dist/chunk-JVY6CCLE.js +3 -0
  113. package/dist/{chunk-BAHIL37I.js → chunk-K4QJEQI4.js} +1 -1
  114. package/dist/chunk-KCAWHJGF.js +1 -0
  115. package/dist/{chunk-YV2TP44L.js → chunk-KFO2JNF5.js} +1 -1
  116. package/dist/chunk-KFR7HWCG.js +9 -0
  117. package/dist/{chunk-MEYVUHQH.js → chunk-KHZF73BL.js} +1 -1
  118. package/dist/{chunk-LGXI7EGM.js → chunk-KM4LE7K4.js} +2 -2
  119. package/dist/{chunk-IILLQOUC.js → chunk-L2PUDV7Y.js} +1 -1
  120. package/dist/chunk-LFBFPK22.js +1 -0
  121. package/dist/{chunk-BN7ZXAZJ.js → chunk-LG3KEHGD.js} +2 -2
  122. package/dist/chunk-LGDWE3H3.js +1 -0
  123. package/dist/chunk-LPPEAMI6.js +1 -0
  124. package/dist/chunk-LXIWMYM4.js +1 -0
  125. package/dist/chunk-MGWCXTGD.js +1 -0
  126. package/dist/chunk-MGX7UG44.js +1 -0
  127. package/dist/chunk-MKFRKNHF.js +3 -0
  128. package/dist/chunk-MTT6EAQO.js +1 -0
  129. package/dist/{chunk-SIL6HPMK.js → chunk-MU7IVBGI.js} +2 -2
  130. package/dist/{chunk-QEVTBD33.js → chunk-MYMBHVC4.js} +1 -1
  131. package/dist/chunk-MZDBH4XV.js +4 -0
  132. package/dist/{chunk-Q5IC3IYY.js → chunk-NUBJ2HK7.js} +1 -1
  133. package/dist/{chunk-3Z3MADXZ.js → chunk-NY5N4ANL.js} +1 -1
  134. package/dist/{chunk-WRZWHT6M.js → chunk-NYMKGE3J.js} +1 -1
  135. package/dist/{chunk-CX5CC6P5.js → chunk-O472FAYX.js} +1 -1
  136. package/dist/chunk-O7HZ3EIP.js +1 -0
  137. package/dist/chunk-OJOF6IYG.js +9 -0
  138. package/dist/{chunk-UXVXVI6O.js → chunk-ONZULPQH.js} +68 -66
  139. package/dist/chunk-ORMXPSJM.js +1 -0
  140. package/dist/chunk-ORYEDUKM.js +5 -0
  141. package/dist/{chunk-T4XJKM6B.js → chunk-OTMYJWIP.js} +1 -1
  142. package/dist/chunk-OVJVFB5E.js +20 -0
  143. package/dist/chunk-OWQEFORZ.js +1 -0
  144. package/dist/{chunk-UBP3LQFY.js → chunk-OXPEBT4I.js} +2 -2
  145. package/dist/chunk-OXZR2MB4.js +6 -0
  146. package/dist/chunk-OY5M52EF.js +6 -0
  147. package/dist/{chunk-2A2JSAAA.js → chunk-PJZZZNWR.js} +1 -1
  148. package/dist/chunk-Q2LQJYRK.js +16 -0
  149. package/dist/chunk-QBRRFFMZ.js +1 -0
  150. package/dist/{chunk-AQKWPRZE.js → chunk-QCLE5REL.js} +2 -2
  151. package/dist/{chunk-43R5VGKT.js → chunk-QGQWVA7N.js} +1 -1
  152. package/dist/chunk-QKPAB245.js +1 -0
  153. package/dist/chunk-QUPZOBTB.js +1 -0
  154. package/dist/chunk-R4E2E4NN.js +1 -0
  155. package/dist/{chunk-CGVROSPS.js → chunk-R6US7F33.js} +1 -1
  156. package/dist/chunk-RKNVTEO3.js +5 -0
  157. package/dist/{chunk-7CCTPBCT.js → chunk-RLOEI6VE.js} +1 -1
  158. package/dist/chunk-RSZAAN37.js +1 -0
  159. package/dist/{chunk-WBJ6ZHYH.js → chunk-S3RROJGG.js} +37 -37
  160. package/dist/chunk-S4KNPCW3.js +81 -0
  161. package/dist/{chunk-26PWHH3B.js → chunk-SBN3ILXO.js} +1 -1
  162. package/dist/chunk-SCDGLREP.js +1 -0
  163. package/dist/chunk-SHOMIS6Q.js +2 -0
  164. package/dist/chunk-SN3PMWUF.js +6 -0
  165. package/dist/chunk-SODCXZ5U.js +1 -0
  166. package/dist/chunk-SPJM7RTD.js +1 -0
  167. package/dist/chunk-SQL67BKI.js +5 -0
  168. package/dist/{chunk-AQ6EVL73.js → chunk-SURFUFAZ.js} +1 -1
  169. package/dist/{chunk-SNH4XZ6E.js → chunk-SVQDMZJO.js} +1 -1
  170. package/dist/chunk-T4ZOTYOY.js +1 -0
  171. package/dist/chunk-T6C4WC3Z.js +2 -0
  172. package/dist/chunk-TD6JBHUS.js +1 -0
  173. package/dist/chunk-TIM4CIXZ.js +22 -0
  174. package/dist/{chunk-B2O3ANRZ.js → chunk-TP7CTMMT.js} +1 -1
  175. package/dist/chunk-TSPJAMYB.js +1 -0
  176. package/dist/chunk-TSVEV2UD.js +26 -0
  177. package/dist/{chunk-ZBL7XMJ6.js → chunk-TTAT62N3.js} +2 -2
  178. package/dist/{chunk-S5P7KWY4.js → chunk-TUSS6PXB.js} +1 -1
  179. package/dist/chunk-TXP6KFWO.js +5 -0
  180. package/dist/chunk-TZHVCMZN.js +6 -0
  181. package/dist/chunk-UC4TOM36.js +3 -0
  182. package/dist/{chunk-RPVZ2JON.js → chunk-UFY4L5KQ.js} +1 -1
  183. package/dist/chunk-UU6UQ2QY.js +1 -0
  184. package/dist/chunk-V4FC72R6.js +1 -0
  185. package/dist/chunk-VA2S7W7H.js +10 -0
  186. package/dist/chunk-VE3IIC7H.js +1 -0
  187. package/dist/{chunk-PTSCGSQV.js → chunk-VJG7VXFU.js} +2 -2
  188. package/dist/chunk-VQSRU5XL.js +4 -0
  189. package/dist/chunk-VRIFLMA3.js +70 -0
  190. package/dist/chunk-WBJFTCEJ.js +1 -0
  191. package/dist/chunk-WBPP6PO7.js +31 -0
  192. package/dist/chunk-WE5KY6T6.js +1 -0
  193. package/dist/chunk-WFPVT2IY.js +1 -0
  194. package/dist/{chunk-PLSS456F.js → chunk-WLYXBQ2M.js} +1 -1
  195. package/dist/chunk-WNVOEE6T.js +7 -0
  196. package/dist/chunk-WPDJVUTY.js +47 -0
  197. package/dist/chunk-WWCYEZUU.js +1 -0
  198. package/dist/chunk-WWVDZ3GC.js +3 -0
  199. package/dist/{chunk-4KECSZTL.js → chunk-WZBZ7FWP.js} +2 -2
  200. package/dist/chunk-XEZPN5TR.js +22 -0
  201. package/dist/{chunk-QW52RPAU.js → chunk-XLMKHTJ5.js} +1 -1
  202. package/dist/chunk-XRNBCV2B.js +1 -0
  203. package/dist/{chunk-67L7FIB6.js → chunk-XWLNCBAG.js} +1 -1
  204. package/dist/chunk-YF4AXKM4.js +1 -0
  205. package/dist/chunk-YKDRUAY3.js +857 -0
  206. package/dist/{chunk-YSWVYPWR.js → chunk-YNFQBYSL.js} +1 -1
  207. package/dist/{chunk-TFPW2VGN.js → chunk-YNZLLZU2.js} +1 -1
  208. package/dist/chunk-YOYPYB4H.js +1 -0
  209. package/dist/{chunk-HF4NDEX3.js → chunk-YR4J46US.js} +1 -1
  210. package/dist/chunk-YTL45RXR.js +103 -0
  211. package/dist/chunk-YVPB7OT6.js +6 -0
  212. package/dist/chunk-YYWSHRO2.js +89 -0
  213. package/dist/{chunk-DZKFP6H2.js → chunk-Z5QEXS6F.js} +1 -1
  214. package/dist/chunk-Z5WFRYVQ.js +6 -0
  215. package/dist/{chunk-PWAT52M4.js → chunk-Z6ZRS256.js} +1 -1
  216. package/dist/chunk-ZMOW2YZ4.js +18 -0
  217. package/dist/chunk-ZMU4EYXT.js +1 -0
  218. package/dist/{chunk-ACA2BGAD.js → chunk-ZNEPRGFY.js} +1 -1
  219. package/dist/chunk-ZXZWMXXK.js +7 -0
  220. package/dist/cli/commands/app/build.js +1 -1
  221. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  222. package/dist/cli/commands/app/bulk/execute.js +1 -1
  223. package/dist/cli/commands/app/bulk/status.js +1 -1
  224. package/dist/cli/commands/app/config/link.js +1 -1
  225. package/dist/cli/commands/app/config/pull.js +1 -1
  226. package/dist/cli/commands/app/config/use.js +1 -1
  227. package/dist/cli/commands/app/config/validate.js +1 -1
  228. package/dist/cli/commands/app/demo/watcher.js +1 -1
  229. package/dist/cli/commands/app/deploy.js +1 -1
  230. package/dist/cli/commands/app/dev/clean.js +1 -1
  231. package/dist/cli/commands/app/dev.js +1 -1
  232. package/dist/cli/commands/app/env/pull.js +1 -1
  233. package/dist/cli/commands/app/env/show.js +1 -1
  234. package/dist/cli/commands/app/execute.js +1 -1
  235. package/dist/cli/commands/app/function/build.js +1 -1
  236. package/dist/cli/commands/app/function/info.js +1 -1
  237. package/dist/cli/commands/app/function/replay.js +1 -1
  238. package/dist/cli/commands/app/function/run.js +1 -1
  239. package/dist/cli/commands/app/function/schema.js +1 -1
  240. package/dist/cli/commands/app/function/typegen.js +1 -1
  241. package/dist/cli/commands/app/generate/extension.js +1 -1
  242. package/dist/cli/commands/app/graphiql.js +1 -1
  243. package/dist/cli/commands/app/import/channel-config.js +1 -1
  244. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  245. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  246. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  247. package/dist/cli/commands/app/import-extensions.js +1 -1
  248. package/dist/cli/commands/app/info.js +1 -1
  249. package/dist/cli/commands/app/init.js +1 -1
  250. package/dist/cli/commands/app/logs-next.js +1 -0
  251. package/dist/cli/commands/app/logs.js +1 -1
  252. package/dist/cli/commands/app/release.js +1 -1
  253. package/dist/cli/commands/app/security/check.js +1 -1
  254. package/dist/cli/commands/app/security/clean.js +1 -1
  255. package/dist/cli/commands/app/security/instructions.js +1 -1
  256. package/dist/cli/commands/app/security/record.js +1 -1
  257. package/dist/cli/commands/app/security/review.js +1 -1
  258. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  259. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  260. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  261. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  262. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  263. package/dist/cli/commands/app/versions/list.js +1 -1
  264. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  265. package/dist/cli/commands/auth/login.d.ts +10 -10
  266. package/dist/cli/commands/auth/login.js +1 -1
  267. package/dist/cli/commands/auth/logout.d.ts +7 -7
  268. package/dist/cli/commands/auth/logout.js +1 -1
  269. package/dist/cli/commands/cache/clear.js +1 -1
  270. package/dist/cli/commands/config/autoupgrade/off.d.ts +7 -7
  271. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  272. package/dist/cli/commands/config/autoupgrade/on.d.ts +7 -7
  273. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  274. package/dist/cli/commands/config/autoupgrade/status.d.ts +7 -7
  275. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  276. package/dist/cli/commands/debug/command-flags.js +1 -1
  277. package/dist/cli/commands/doc/fetch.d.ts +21 -21
  278. package/dist/cli/commands/doc/fetch.js +1 -1
  279. package/dist/cli/commands/doc/search.d.ts +23 -23
  280. package/dist/cli/commands/doc/search.js +1 -1
  281. package/dist/cli/commands/docs/generate.js +1 -1
  282. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  283. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  284. package/dist/cli/commands/help.d.ts +90 -90
  285. package/dist/cli/commands/help.js +1 -1
  286. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  287. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  288. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  289. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  290. package/dist/cli/commands/notifications/generate.js +1 -1
  291. package/dist/cli/commands/notifications/list.js +1 -1
  292. package/dist/cli/commands/organization/list.js +1 -1
  293. package/dist/cli/commands/search.d.ts +7 -7
  294. package/dist/cli/commands/search.js +1 -1
  295. package/dist/cli/commands/send-analytics.js +1 -1
  296. package/dist/cli/commands/theme/check.js +1 -1
  297. package/dist/cli/commands/theme/console.js +1 -1
  298. package/dist/cli/commands/theme/delete.js +1 -1
  299. package/dist/cli/commands/theme/dev.js +1 -1
  300. package/dist/cli/commands/theme/duplicate.js +1 -1
  301. package/dist/cli/commands/theme/info.js +1 -1
  302. package/dist/cli/commands/theme/init.js +1 -1
  303. package/dist/cli/commands/theme/language-server.js +1 -1
  304. package/dist/cli/commands/theme/list.js +1 -1
  305. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  306. package/dist/cli/commands/theme/open.js +1 -1
  307. package/dist/cli/commands/theme/package.js +1 -1
  308. package/dist/cli/commands/theme/preview.js +1 -1
  309. package/dist/cli/commands/theme/profile.js +1 -1
  310. package/dist/cli/commands/theme/publish.js +1 -1
  311. package/dist/cli/commands/theme/pull.js +1 -1
  312. package/dist/cli/commands/theme/push.js +1 -1
  313. package/dist/cli/commands/theme/rename.js +1 -1
  314. package/dist/cli/commands/theme/share.js +1 -1
  315. package/dist/cli/commands/upgrade.d.ts +24 -24
  316. package/dist/cli/commands/upgrade.js +1 -1
  317. package/dist/cli/commands/version.d.ts +7 -7
  318. package/dist/cli/commands/version.js +1 -1
  319. package/dist/cli/help.js +1 -1
  320. package/dist/cli-version-check-V25AVSZ6.js +1 -0
  321. package/dist/{command-event-context-LFUZ7UCA.js → command-event-context-ILIANB5Q.js} +1 -1
  322. package/dist/command-json-schema-C5UZXP2W.js +1 -0
  323. package/dist/command-registry.js +1 -1
  324. package/dist/conf-store-OCGEEV4U.js +1 -0
  325. package/dist/custom-oclif-loader-ZVUKMRGH.js +1 -0
  326. package/dist/data/filters.json +41 -2
  327. package/dist/data/local_block_entry.json +1 -1
  328. package/dist/data/manifest_theme.json +1 -0
  329. package/dist/data/objects.json +78 -36
  330. package/dist/data/section.json +1 -1
  331. package/dist/data/shopify_system_translations.json +240 -23
  332. package/dist/data/strict_settings.json +24 -0
  333. package/dist/data/tags.json +57 -24
  334. package/dist/data/theme_block.json +1 -1
  335. package/dist/deprecations-A5AXXKIK.js +1 -0
  336. package/dist/dist-NORLLIHQ.js +1 -0
  337. package/dist/dist-XBM4XZS4.js +1 -0
  338. package/dist/environment-5P7JJ3GI.js +1 -0
  339. package/dist/environments-Y5JEI3U3.js +1 -0
  340. package/dist/error-GI4DXVDU.js +1 -0
  341. package/dist/error-handler-BS2ZENQV.js +1 -0
  342. package/dist/fs-UOOLPOHJ.js +1 -0
  343. package/dist/hooks/did-you-mean.js +1 -1
  344. package/dist/hooks/hydrogen-init.js +1 -1
  345. package/dist/hooks/plugin-plugins.js +1 -1
  346. package/dist/hooks/postrun.js +1 -1
  347. package/dist/hooks/prerun.js +2 -2
  348. package/dist/hooks/public-metadata.js +1 -1
  349. package/dist/hooks/sensitive-metadata.js +1 -1
  350. package/dist/hooks/tunnel-provider.js +1 -1
  351. package/dist/hooks/tunnel-start.js +1 -1
  352. package/dist/http-2OXOS2AW.js +1 -0
  353. package/dist/http-proxy-node16-NZZ674YW.js +38 -0
  354. package/dist/index.js +12 -12
  355. package/dist/is-global-CI77T7NE.js +1 -0
  356. package/dist/json-error-6PBUR4LQ.js +1 -0
  357. package/dist/latest-version-75YEFEMK.js +9 -0
  358. package/dist/lib-4JVADMNT.js +1 -0
  359. package/dist/lib-L4STV5B2.js +1 -0
  360. package/dist/lib-LEEN55OD.js +1 -0
  361. package/dist/{local-OKPVB4NH.js → local-5NIWPWDS.js} +1 -1
  362. package/dist/metadata-IXPNNPNJ.js +1 -0
  363. package/dist/{morph-CRY35DIK.js → morph-H7XQP55V.js} +3 -3
  364. package/dist/node-package-manager-ALFEGGD6.js +1 -0
  365. package/dist/notifications-system-FQW3GKH2.js +1 -0
  366. package/dist/{npa-A4YSCQ5Q.js → npa-LVYMN7GE.js} +1 -1
  367. package/dist/os-6TNQTEUN.js +1 -0
  368. package/dist/output-LEOB5LAM.js +1 -0
  369. package/dist/{prettier-EGVCP5CY.js → prettier-VLTY4MIE.js} +1 -1
  370. package/dist/registry-auth-token-EDH77OOW.js +1 -0
  371. package/dist/registry-url-JMNV3LLX.js +1 -0
  372. package/dist/semver-HHZRKD6Y.js +1 -0
  373. package/dist/system-J4CTESP5.js +1 -0
  374. package/dist/tsconfig.tsbuildinfo +1 -1
  375. package/dist/ui-YDUI56E3.js +1 -0
  376. package/dist/upgrade-LBCZORG2.js +1 -0
  377. package/dist/version-2YL4YEQ2.js +1 -0
  378. package/dist/version-X2CPQVWQ.js +1 -0
  379. package/dist/workerd-5UPTEWNI.js +18 -0
  380. package/oclif.manifest.json +25622 -1132
  381. package/package.json +7 -7
  382. package/dist/analytics-NMMVOF4B.js +0 -1
  383. package/dist/analytics-UK77WNLG.js +0 -1
  384. package/dist/chunk-224UPIYS.js +0 -4
  385. package/dist/chunk-27NXPOAS.js +0 -1
  386. package/dist/chunk-2MT3LSMZ.js +0 -1
  387. package/dist/chunk-2T4HDR6R.js +0 -70
  388. package/dist/chunk-2ZBXHCQZ.js +0 -1
  389. package/dist/chunk-335BUVBP.js +0 -1
  390. package/dist/chunk-33ZE3DRQ.js +0 -16
  391. package/dist/chunk-34MOWGRL.js +0 -1
  392. package/dist/chunk-3JSKNXL7.js +0 -1
  393. package/dist/chunk-3MG4MTWQ.js +0 -1
  394. package/dist/chunk-4WYKPIN3.js +0 -1
  395. package/dist/chunk-5AEZJZNQ.js +0 -1
  396. package/dist/chunk-5ED7SOQZ.js +0 -20
  397. package/dist/chunk-5IDJALJH.js +0 -1
  398. package/dist/chunk-66TMIQMB.js +0 -1
  399. package/dist/chunk-74NRFUGQ.js +0 -1
  400. package/dist/chunk-7GUMJ5E4.js +0 -1
  401. package/dist/chunk-7NFTSBHQ.js +0 -10
  402. package/dist/chunk-ACZNWIRY.js +0 -1
  403. package/dist/chunk-AUE7LM32.js +0 -1
  404. package/dist/chunk-AXL2VIWA.js +0 -16
  405. package/dist/chunk-B3ZJGYZY.js +0 -3
  406. package/dist/chunk-BOAGJ6P5.js +0 -1
  407. package/dist/chunk-BWN2QG6D.js +0 -5
  408. package/dist/chunk-CCUQM4FX.js +0 -6
  409. package/dist/chunk-CLUUA3HX.js +0 -3
  410. package/dist/chunk-CYEEGTVZ.js +0 -11
  411. package/dist/chunk-DBDTE3EE.js +0 -5
  412. package/dist/chunk-DLVB3237.js +0 -31
  413. package/dist/chunk-DN6X7SHW.js +0 -2
  414. package/dist/chunk-E5COIKGY.js +0 -5
  415. package/dist/chunk-E6RONHMT.js +0 -1
  416. package/dist/chunk-EAZIQI2D.js +0 -1
  417. package/dist/chunk-EEY4FKAW.js +0 -1
  418. package/dist/chunk-EKFPTBXC.js +0 -1
  419. package/dist/chunk-FEBOZ2XX.js +0 -31
  420. package/dist/chunk-FFSDGRAN.js +0 -1
  421. package/dist/chunk-FZCGRIOM.js +0 -1
  422. package/dist/chunk-GNCVDN7U.js +0 -1
  423. package/dist/chunk-GQLNG537.js +0 -836
  424. package/dist/chunk-GVI3DWSB.js +0 -4
  425. package/dist/chunk-H6GYBLVQ.js +0 -2
  426. package/dist/chunk-HB3MJYBK.js +0 -1
  427. package/dist/chunk-HSKDFEXW.js +0 -1
  428. package/dist/chunk-HTRJU4R4.js +0 -1
  429. package/dist/chunk-HXZAY5OA.js +0 -1
  430. package/dist/chunk-I7PEEJVH.js +0 -1
  431. package/dist/chunk-IHMATNOR.js +0 -1
  432. package/dist/chunk-IJY3RJPJ.js +0 -47
  433. package/dist/chunk-J3JPJCWP.js +0 -1
  434. package/dist/chunk-J55GQLP4.js +0 -1
  435. package/dist/chunk-JLQRDFR5.js +0 -18
  436. package/dist/chunk-JPWRZ5SL.js +0 -16
  437. package/dist/chunk-K7ZSPQKL.js +0 -4
  438. package/dist/chunk-L5TSPCSY.js +0 -26
  439. package/dist/chunk-LUGMXSRI.js +0 -9
  440. package/dist/chunk-M2CWCOFU.js +0 -11
  441. package/dist/chunk-M5VIFG2V.js +0 -1
  442. package/dist/chunk-MADINS4Z.js +0 -1
  443. package/dist/chunk-MGHPF7HU.js +0 -6
  444. package/dist/chunk-MHR5OHT5.js +0 -10
  445. package/dist/chunk-MXEXP3HT.js +0 -15
  446. package/dist/chunk-OJULL7HT.js +0 -1
  447. package/dist/chunk-OMPQ7REW.js +0 -3
  448. package/dist/chunk-OR4IJ4BQ.js +0 -1
  449. package/dist/chunk-P2RMFHQP.js +0 -1
  450. package/dist/chunk-P4VZYOKO.js +0 -15
  451. package/dist/chunk-PDZBKVWL.js +0 -97
  452. package/dist/chunk-Q2KWXZQB.js +0 -12
  453. package/dist/chunk-QFSENE5T.js +0 -3
  454. package/dist/chunk-QFWWCZOI.js +0 -1
  455. package/dist/chunk-QFYLJVJW.js +0 -77
  456. package/dist/chunk-QQJNQNKP.js +0 -6
  457. package/dist/chunk-R4UVIYZP.js +0 -4
  458. package/dist/chunk-RLNIOJH3.js +0 -272
  459. package/dist/chunk-RW6G4ZPU.js +0 -1
  460. package/dist/chunk-S4LOWCGS.js +0 -1
  461. package/dist/chunk-SB27UOXX.js +0 -1
  462. package/dist/chunk-SHD4VV5V.js +0 -3
  463. package/dist/chunk-SK7EPN6C.js +0 -1
  464. package/dist/chunk-TAWCKJKP.js +0 -1
  465. package/dist/chunk-U2T5HPRD.js +0 -319
  466. package/dist/chunk-U6YOP562.js +0 -1
  467. package/dist/chunk-UPPO3BMT.js +0 -7
  468. package/dist/chunk-USXIXANP.js +0 -103
  469. package/dist/chunk-UV5GAGAD.js +0 -1
  470. package/dist/chunk-UY6W2EVZ.js +0 -1
  471. package/dist/chunk-UYELAINQ.js +0 -16
  472. package/dist/chunk-V75WUEFU.js +0 -1
  473. package/dist/chunk-VAVXDIUX.js +0 -6
  474. package/dist/chunk-VEUKT5EI.js +0 -6
  475. package/dist/chunk-VGSH52JM.js +0 -1
  476. package/dist/chunk-VHZ6RL67.js +0 -1
  477. package/dist/chunk-VQA3X7O3.js +0 -1
  478. package/dist/chunk-VZCMJRYV.js +0 -1
  479. package/dist/chunk-W56ZGEQQ.js +0 -2265
  480. package/dist/chunk-WSDKCQH6.js +0 -6
  481. package/dist/chunk-X2PFXSU4.js +0 -1
  482. package/dist/chunk-X5NIAZA4.js +0 -1
  483. package/dist/chunk-XBMD3FEZ.js +0 -3
  484. package/dist/chunk-XDVPIGXE.js +0 -2
  485. package/dist/chunk-XLIJYJ6Q.js +0 -1
  486. package/dist/chunk-XUHGWIWW.js +0 -4
  487. package/dist/chunk-Y55T4IIQ.js +0 -7
  488. package/dist/chunk-Y5CVX5LJ.js +0 -1
  489. package/dist/chunk-Y6J46XYF.js +0 -3
  490. package/dist/chunk-YKMINHYY.js +0 -3
  491. package/dist/chunk-ZDQO6CNY.js +0 -1
  492. package/dist/chunk-ZGASBRSQ.js +0 -5
  493. package/dist/chunk-ZGBTO46A.js +0 -1
  494. package/dist/chunk-ZJOX5HW4.js +0 -22
  495. package/dist/chunk-ZOOT3GBY.js +0 -5
  496. package/dist/command-json-schema-F5XF7XHL.js +0 -1
  497. package/dist/conf-store-5CBLWTOC.js +0 -1
  498. package/dist/custom-oclif-loader-UDVUFKMD.js +0 -1
  499. package/dist/deprecations-EOHPSTCS.js +0 -1
  500. package/dist/dist-RNV3GFZ7.js +0 -1
  501. package/dist/dist-ZFKWJVNB.js +0 -1
  502. package/dist/environment-O7ECODHU.js +0 -1
  503. package/dist/environments-4FLRZW4P.js +0 -1
  504. package/dist/error-JY2ADS6S.js +0 -1
  505. package/dist/error-handler-4GCXKC6I.js +0 -1
  506. package/dist/fs-XS5YF34R.js +0 -1
  507. package/dist/http-proxy-node16-D3JUYA5D.js +0 -38
  508. package/dist/is-global-27MUENOK.js +0 -1
  509. package/dist/json-error-S5XFS3UX.js +0 -1
  510. package/dist/latest-version-LDWU5F7A.js +0 -49
  511. package/dist/lib-PJHT4MKY.js +0 -1
  512. package/dist/lib-VKSQ65BQ.js +0 -1
  513. package/dist/lib-YEZOHXF3.js +0 -1
  514. package/dist/metadata-2YJBAKR7.js +0 -1
  515. package/dist/node-package-manager-B3OW3PFQ.js +0 -1
  516. package/dist/notifications-system-BWTDYBG2.js +0 -1
  517. package/dist/os-F6QKJCFW.js +0 -1
  518. package/dist/output-BRIPK7UC.js +0 -1
  519. package/dist/system-466QKFDI.js +0 -1
  520. package/dist/ui-VJTNGCS6.js +0 -1
  521. package/dist/upgrade-VHVJLXKX.js +0 -1
  522. package/dist/version-FETZRLZO.js +0 -1
  523. package/dist/version-T4XXTJMB.js +0 -1
  524. package/dist/workerd-32DMKLMN.js +0 -18
  525. /package/dist/{chunk-YLQ3LNNY.js → chunk-2S3FHQFS.js} +0 -0
  526. /package/dist/{chunk-YRHFPXC3.js → chunk-Z2AV4BWZ.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as N,b as $,c as g}from"./chunk-URXM5A2K.js";import{j as D}from"./chunk-GQLNG537.js";import{a as b,b as A}from"./chunk-F3CK3EJJ.js";import{T as p,U as k,a as T}from"./chunk-D2KIGKBI.js";import{k as P}from"./chunk-M5VIFG2V.js";import{Bb as u,Ha as I,Ka as O,N as y,Oa as F,Ta as h,wa as _,ya as U}from"./chunk-JLQRDFR5.js";import{g as w}from"./chunk-LHXFTFFM.js";import{c as m,h as l,i as x}from"./chunk-IWTNUJGY.js";import{g as f}from"./chunk-VKWPEFWQ.js";f();f();import{fileURLToPath as q}from"url";import Y from"util";import{pipeline as j}from"stream";import{execFileSync as z}from"child_process";var H="2026.10.3",B=`https://github.com/cloudflare/cloudflared/releases/download/${H}/`,W={arm64:"cloudflared-linux-arm64",arm:"cloudflared-linux-arm",x64:"cloudflared-linux-amd64",ia32:"cloudflared-linux-386"},G={arm64:"cloudflared-darwin-arm64.tgz",x64:"cloudflared-darwin-amd64.tgz"},V={x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe",arm64:"cloudflared-windows-amd64.exe"},v={linux:W,darwin:G,win32:V};function X(r=process.platform,t=process.arch){if(!Object.keys(v).includes(r))throw new Error(`Unsupported system platform: ${r}`);let n=v[r][t];if(n===void 0)throw new Error(`Unsupported system arch: ${t}`);return B+n}function Z(r=process.env,t=process.platform){return r.SHOPIFY_CLI_CLOUDFLARED_PATH?r.SHOPIFY_CLI_CLOUDFLARED_PATH:m(l(q(import.meta.url)),"..","bin",t==="win32"?"cloudflared.exe":"cloudflared")}async function C(r=process.env,t=process.platform,e=process.arch){if(r.SHOPIFY_CLI_IGNORE_CLOUDFLARED){u("Skipping cloudflared installation because SHOPIFY_CLI_IGNORE_CLOUDFLARED is set");return}let n=X(t,e),o=Z(r,t);if(h(o))try{let i=z(o,["--version"],{encoding:"utf8"}).split(" "),a=i.length>2?i[2]:"0.0.0";if(!J(H,a)){u("cloudflared already installed, skipping");return}}catch{u("version check failed, reinstalling")}if(t==="linux")await K(n,o);else if(t==="darwin")await tt(n,o);else if(t==="win32")await Q(n,o);else throw new Error(`Unsupported platform: ${t}`)}function J(r,t){let[e,n,o]=r.split(".").map(Number),[i,a,c]=t.split(".").map(Number);return e!==i?(e??0)>(i??0):n!==a?(n??0)>(a??0):(o??0)>(c??0)}async function K(r,t){await R(r,t),await F(t,"755")}async function Q(r,t){await R(r,t)}async function tt(r,t){await R(r,`${t}.tgz`);let e=x(`${t}.tgz`);await p("tar",["-xzf",e],{cwd:l(t)}),I(`${t}.tgz`),await U(`${l(t)}/cloudflared`,t)}async function R(r,t){h(l(t))||_(l(t));let e=Y.promisify(j),n=await D(r,{redirect:"follow"},"slow-request");if(!n.ok||!n.body)throw new Error(`Couldn't download file ${r} (${n.status} ${n.statusText})`);let o=O(t);return await e(n.body,o),t}import{Writable as rt}from"stream";import{fileURLToPath as et}from"url";var $t=$({provider:g,action:st}),nt=w()?.2:40,ot=5;async function st(r){try{let t=new E(r);return await t.startTunnel(),b(t)}catch(t){let e=new N("unknown",t.message);return A(e)}}var E=class{port;provider=g;currentStatus={status:"not-started"};abortController=void 0;constructor(t){this.port=t}async startTunnel(){try{await C(),this.tunnel()}catch(t){this.currentStatus={status:"error",message:t.message,tryMessage:d()}}}getTunnelStatus(){return this.currentStatus}stopTunnel(){this.abortController?.abort()}tunnel(t=0){this.abortController=new T;let e=!1;if(t>=ot){e=!0,this.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: max retries reached.",tryMessage:d()};return}let n=["tunnel","--url",`http://localhost:${this.port}`,"--no-autoupdate"],o=[],i=!1,a;this.currentStatus={status:"starting"},setTimeout(()=>{if(!e){e=!0;let s=y(o).slice(-5).join(`
1
+ import{a as N,b as $,c as g}from"./chunk-F6IQWX2F.js";import{p as D}from"./chunk-YKDRUAY3.js";import{a as b,b as A}from"./chunk-BFAOTQGH.js";import{R as p,S as k,a as T}from"./chunk-2KUM2RU4.js";import{l as P}from"./chunk-TD6JBHUS.js";import{Eb as u,Ha as I,Ka as O,N as y,Oa as F,Ta as h,wa as _,ya as U}from"./chunk-ZMOW2YZ4.js";import{g as w}from"./chunk-DOLVBTCB.js";import{c as m,h as l,i as x}from"./chunk-IWTNUJGY.js";import{g as f}from"./chunk-VKWPEFWQ.js";f();f();import{fileURLToPath as q}from"url";import Y from"util";import{pipeline as j}from"stream";import{execFileSync as z}from"child_process";var H="2026.10.3",B=`https://github.com/cloudflare/cloudflared/releases/download/${H}/`,W={arm64:"cloudflared-linux-arm64",arm:"cloudflared-linux-arm",x64:"cloudflared-linux-amd64",ia32:"cloudflared-linux-386"},G={arm64:"cloudflared-darwin-arm64.tgz",x64:"cloudflared-darwin-amd64.tgz"},V={x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe",arm64:"cloudflared-windows-amd64.exe"},v={linux:W,darwin:G,win32:V};function X(r=process.platform,t=process.arch){if(!Object.keys(v).includes(r))throw new Error(`Unsupported system platform: ${r}`);let n=v[r][t];if(n===void 0)throw new Error(`Unsupported system arch: ${t}`);return B+n}function Z(r=process.env,t=process.platform){return r.SHOPIFY_CLI_CLOUDFLARED_PATH?r.SHOPIFY_CLI_CLOUDFLARED_PATH:m(l(q(import.meta.url)),"..","bin",t==="win32"?"cloudflared.exe":"cloudflared")}async function C(r=process.env,t=process.platform,e=process.arch){if(r.SHOPIFY_CLI_IGNORE_CLOUDFLARED){u("Skipping cloudflared installation because SHOPIFY_CLI_IGNORE_CLOUDFLARED is set");return}let n=X(t,e),o=Z(r,t);if(h(o))try{let i=z(o,["--version"],{encoding:"utf8"}).split(" "),a=i.length>2?i[2]:"0.0.0";if(!J(H,a)){u("cloudflared already installed, skipping");return}}catch{u("version check failed, reinstalling")}if(t==="linux")await K(n,o);else if(t==="darwin")await tt(n,o);else if(t==="win32")await Q(n,o);else throw new Error(`Unsupported platform: ${t}`)}function J(r,t){let[e,n,o]=r.split(".").map(Number),[i,a,c]=t.split(".").map(Number);return e!==i?(e??0)>(i??0):n!==a?(n??0)>(a??0):(o??0)>(c??0)}async function K(r,t){await R(r,t),await F(t,"755")}async function Q(r,t){await R(r,t)}async function tt(r,t){await R(r,`${t}.tgz`);let e=x(`${t}.tgz`);await p("tar",["-xzf",e],{cwd:l(t)}),I(`${t}.tgz`),await U(`${l(t)}/cloudflared`,t)}async function R(r,t){h(l(t))||_(l(t));let e=Y.promisify(j),n=await D(r,{redirect:"follow"},"slow-request");if(!n.ok||!n.body)throw new Error(`Couldn't download file ${r} (${n.status} ${n.statusText})`);let o=O(t);return await e(n.body,o),t}import{Writable as rt}from"stream";import{fileURLToPath as et}from"url";var $t=$({provider:g,action:st}),nt=w()?.2:40,ot=5;async function st(r){try{let t=new E(r);return await t.startTunnel(),b(t)}catch(t){let e=new N("unknown",t.message);return A(e)}}var E=class{port;provider=g;currentStatus={status:"not-started"};abortController=void 0;constructor(t){this.port=t}async startTunnel(){try{await C(),this.tunnel()}catch(t){this.currentStatus={status:"error",message:t.message,tryMessage:d()}}}getTunnelStatus(){return this.currentStatus}stopTunnel(){this.abortController?.abort()}tunnel(t=0){this.abortController=new T;let e=!1;if(t>=ot){e=!0,this.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: max retries reached.",tryMessage:d()};return}let n=["tunnel","--url",`http://localhost:${this.port}`,"--no-autoupdate"],o=[],i=!1,a;this.currentStatus={status:"starting"},setTimeout(()=>{if(!e){e=!0;let s=y(o).slice(-5).join(`
2
2
  `);s===""?this.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: unknown error.",tryMessage:d()}:this.currentStatus={status:"error",message:s,tryMessage:d()},this.abortController?.abort()}},nt*1e3);let c=this,L=new rt({write(s,ft,M){if(u(s.toString()),e)return;a??=it(s),ut(s)&&(i=!0),i&&(a?(e=!0,c.currentStatus={status:"connected",url:a}):c.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: URL not found."});let S=at(s);S&&o.push(S),M()}});p(ct(),n,{stdout:L,stderr:L,signal:this.abortController.signal,externalErrorHandler:async s=>{if(e)throw new P(`Could not start Cloudflare tunnel: process crashed after stablishing a connection: ${s.message}`,d());u(`Cloudflare tunnel crashed: ${s.message}, restarting...`),w()||await k(1),this.tunnel(t+1)}})}};function d(){return["You can run the command again, or try networking with Shopify via",{command:"--use-localhost"},"or",{command:"--tunnel-url <custom tunnel>"},".",{link:{label:"See documentation for details.",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options"}}]}function it(r){let t=new RegExp(`(https:\\/\\/[^\\s]+\\.${dt()})`),e=r.toString().match(t)??void 0;return e&&e[1]}function at(r){if([/failed to request quick Tunnel/,/failed to unmarshal quick Tunnel/,/failed to parse quick Tunnel ID/,/failed to provision routing/,/ERR Couldn't start tunnel/,/ERR Failed to serve quic connection/,/ERR Failed to create new quic connection error/].some(n=>n.test(r.toString())))return`Could not start Cloudflare tunnel: ${lt(r.toString())}`}function lt(r){let t=/^[0-9TZ:-]+ (ERR )?/g,e=/connIndex.*/g;return r.replace(t,"").replace(e,"")}function ut(r){let t=r.toString().match(/(INF Registered tunnel connection|INF Connection)/)??void 0;return t&&t[0]}function ct(){return process.env.SHOPIFY_CLI_CLOUDFLARED_PATH?process.env.SHOPIFY_CLI_CLOUDFLARED_PATH:m(l(et(import.meta.url)),"..","bin",process.platform==="win32"?"cloudflared.exe":"cloudflared")}function dt(){return process.env.SHOPIFY_CLI_CLOUDFLARED_DOMAIN??"trycloudflare.com"}export{$t as a};
@@ -1 +1 @@
1
- import{d as l}from"./chunk-IJY3RJPJ.js";import{c as t}from"./chunk-YY6TFARF.js";import{f as i,m,n as w,o as d,r as f}from"./chunk-YKMINHYY.js";import{K as n}from"./chunk-D2KIGKBI.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();async function y(o,r,P){i()||f({store:r});let e=o??m()??await p(["Enter your",{link:{label:"store password",url:t(r)}}]),s=!1;for(;!await l(e,r,P);)s||(d(),s=!0),e=await p(["Incorrect",{link:{label:"store password",url:t(r)}},{char:"."},"Please try again"]);return w(e),e}async function p(o){return n({message:o,password:!0})}export{y as a};
1
+ import{e as l}from"./chunk-WPDJVUTY.js";import{c as t}from"./chunk-YY6TFARF.js";import{f as i,m,n as w,o as d,r as f}from"./chunk-CZNUBAAG.js";import{I as n}from"./chunk-2KUM2RU4.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();async function y(o,r,P){i()||f({store:r});let e=o??m()??await p(["Enter your",{link:{label:"store password",url:t(r)}}]),s=!1;for(;!await l(e,r,P);)s||(d(),s=!0),e=await p(["Incorrect",{link:{label:"store password",url:t(r)}},{char:"."},"Please try again"]);return w(e),e}async function p(o){return n({message:o,password:!0})}export{y as a};
@@ -0,0 +1 @@
1
+ import{b as e}from"./chunk-XEZPN5TR.js";import{Ba as r}from"./chunk-YKDRUAY3.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var t=class extends e{static hidden=!0;async run(){await r()}};export{t as a};
@@ -1 +1 @@
1
- import{b as n,c as t,g as s,h as i}from"./chunk-QFWWCZOI.js";import{b as e}from"./chunk-FZCGRIOM.js";import{g as r}from"./chunk-VKWPEFWQ.js";r();var l=e.object({id:e.number(),name:e.string(),role:e.string(),processing:e.boolean(),createdAtRuntime:e.boolean(),src:e.string().optional(),shop:e.string()}),m=t.extend({storeDomain:n,processing:e.boolean(),sourceUrl:e.string().url().nullable()}).strict().describe("The selected theme projection; sourceUrl is null when the upstream source URL is unavailable.");function u(o){return{...i(o),storeDomain:s(o.shop),processing:o.processing,sourceUrl:o.src===""?null:o.src??null}}export{l as a,m as b,u as c};
1
+ import{b as n,c as t,g as s,h as i}from"./chunk-7HECBXSP.js";import{b as e}from"./chunk-3PYDIBTX.js";import{g as r}from"./chunk-VKWPEFWQ.js";r();var l=e.object({id:e.number(),name:e.string(),role:e.string(),processing:e.boolean(),createdAtRuntime:e.boolean(),src:e.string().optional(),shop:e.string()}),m=t.extend({storeDomain:n,processing:e.boolean(),sourceUrl:e.string().url().nullable()}).strict().describe("The selected theme projection; sourceUrl is null when the upstream source URL is unavailable.");function u(o){return{...i(o),storeDomain:s(o.shop),processing:o.processing,sourceUrl:o.src===""?null:o.src??null}}export{l as a,m as b,u as c};
@@ -0,0 +1,103 @@
1
+ import{a as Y,b as _t}from"./chunk-JLGA3B7P.js";import{a as ee,b as Ft,c as Pt,g as Oe,h as ue,i as W,k as pe,l as bt,n as It,q as kt}from"./chunk-WPDJVUTY.js";import{a as G,l as vt,m as $t}from"./chunk-DVFVO6ZE.js";import{s as de,t as J}from"./chunk-CZNUBAAG.js";import{a as B,b as z,f as mt,h as ft,j as ht,k as gt,l as yt,o as Et,q as wt,r as xt,s as le,t as k,v as Tt,x as Rt}from"./chunk-FDSNRKGQ.js";import{da as St}from"./chunk-2PD7TNFS.js";import{Ea as q,Ga as M}from"./chunk-YKDRUAY3.js";import{A as ae,B as ut,S as pt,x as dt,z as j}from"./chunk-2KUM2RU4.js";import{c as lt}from"./chunk-QBRRFFMZ.js";import{i as I}from"./chunk-TD6JBHUS.js";import{Bb as K,Eb as v,Fb as U,O as it,Sa as b,Va as D,Z as qe,ab as He,la as L,na as Ae,ta as Ce,tb as A,va as at,vb as ce,xa as ct}from"./chunk-ZMOW2YZ4.js";import{k as ie}from"./chunk-3PYDIBTX.js";import{c as R,e as nt,f as O,h as rt,i as ot,j as N,n as je}from"./chunk-IWTNUJGY.js";import{e as st,g as m}from"./chunk-VKWPEFWQ.js";m();m();m();var ys=".shopifyignore",jt=/templates\/\*(\.(json|liquid))?$/,Lt=new Set;function me(e,t={}){let s=t.ignoreFromFile??[],n=t.ignore??[],r=t.only??[],[o=[],a=[]]=Ne(s),[i=[],u=[]]=Ne(n),[p=[],c=[]]=Ne(r),l=e.filter(V(o,".shopifyignore"));return l=l.filter(V(i,"--ignore")),l=l.filter(V(p,"--only",!0)),a.length>0&&(l=l.concat(e.filter(V(a,".shopifyignore",!0)))),u.length>0&&(l=l.concat(e.filter(V(u,"--ignore",!0)))),c.length>0&&(l=l.filter(V(c,"--only"))),it(l,w=>w.key)}function V(e,t,s=!1){return({key:n})=>{if(e.length===0)return!0;let r=e.some(a=>Es(n,a)||Ts(a)&&xs(n,Rs(a)));return(s?!r:r)?(v(`Ignoring theme file ${n} via ${t}...`),!1):!0}}async function qt(e){let t=R(e,ys);return await b(t)?(await L(t,{encoding:"utf8"})).split(/(\r\n|\r|\n)/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")):[]}function Ne(e){let t=e.filter(n=>n.startsWith("!")).map(n=>n.slice(1));return[e.filter(n=>!n.startsWith("!")),t]}function Es(e,t){let s={matchBase:!0,noglobstar:!0};return He(e,t,s)?!0:(!t.includes("*")&&t.endsWith("/")&&!Lt.has(t)&&(Lt.add(t),j({headline:"Directory pattern may be misleading.",body:`For more reliable matching, consider using "${t}*" or "${t}*.<file_extension>" instead.`})),ws(t)?He(e,t.replace(jt,"templates/**/*$1"),s):!1)}function ws(e){return jt.test(e)}function xs(e,t){return t.test(e)}function Ts(e){return e.startsWith("/")&&e.endsWith("/")}function Rs(e){return new RegExp(e.slice(1,-1))}m();import At from"fs/promises";var fe=class{notifyPath;isValidUrl;constructor(t){this.notifyPath=t,this.isValidUrl=this.validateUrl(t),this.notifyPath===""&&U("Notification skipped: notifyPath is an empty string")}async notify(t){if(this.notifyPath!=="")try{v(`Notifying filechange listener at ${this.notifyPath}...`),this.isValidUrl?await this.notifyUrl(t):await this.notifyFile(t)}catch(s){q(s);let n=`Failed to notify filechange listener at ${this.notifyPath}`;s instanceof Error&&(n=n.concat(`: ${s.message}`)),U(n)}}async notifyUrl(t){let s=await fetch(this.notifyPath,{method:"POST",body:JSON.stringify({files:[t]}),headers:{"Content-Type":"application/json"}});if(!s.ok)throw new Error(s.statusText)}async notifyFile(t){await At.writeFile(this.notifyPath,t),await At.utimes(this.notifyPath,new Date,new Date)}validateUrl(t){try{let s=new URL(t);return s.protocol==="http:"||s.protocol==="https:"}catch{return!1}}};m();m();m();import Ss from"node:events";var Ct=["assets/**/*.*","locales/**/*.json","blocks/**/*.liquid","snippets/**/*.liquid"];function Ht(e){let t=new Map,s=new Set,n=new Ss,r=(c,l)=>{n.emit(c,l)},o=async c=>{let l=await ge(e,c),f=he(c,l),w=typeof l=="string"?l:"",h=Buffer.isBuffer(l)?l.toString("base64"):"";return t.set(c,G({key:c,checksum:f,value:w,attachment:h})),l},a=D(Ct,{cwd:e,deep:3,ignore:J}).then(c=>Promise.all(c.map(o))),i=(c,l)=>{let f=O(e,l),w=o(f).then(()=>{let h=t.get(f);return s.add(h.key),h.value??h.attachment??""});pt(5).then(()=>{s.delete(f)}).catch(()=>{}),r(c,{fileKey:f,onContent:h=>{w.then(y=>{y&&h(y)}).catch(()=>{})},onSync:h=>{}})},u=c=>{let l=O(e,c);s.delete(l),t.delete(l),r("unlink",{fileKey:l,onSync:f=>f()})},p=new Set(Ct.map(c=>R(e,c.split("/").shift()??"")));return{root:e,files:t,unsyncedFileKeys:s,ready:async()=>a.then(()=>{}),delete:async c=>{t.delete(c)},write:async c=>{t.set(c.key,c)},read:o,addEventListener:(c,l)=>{n.on(c,l)},startWatcher:async()=>{let{default:c}=await import("./chokidar-5RWEYTNQ.js");c.watch([...p],{ignored:J,persistent:!process.env.SHOPIFY_UNIT_TEST,ignoreInitial:!0}).on("add",i.bind(null,"add")).on("change",i.bind(null,"change")).on("unlink",u.bind(null))}}}m();m();var Fs="https://unpkg.com/@shopify/polaris@13.9.2/build/esm/styles.css";function Ot(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Nt(e){return(0,String.raw)`<!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>${e.title}</title>
5
+ <link rel="stylesheet" href="${Fs}" />
6
+ </head>
7
+ <body>
8
+ <div style="display: flex; justify-content: center; padding-top: 2rem;">
9
+ <div style="width: 80%;">
10
+ <div class="Polaris-Banner Polaris-Banner--withinPage" tabindex="0" role="alert" aria-live="polite">
11
+ <div class="Polaris-Box" style="--pc-box-width:100%">
12
+ <div
13
+ class="Polaris-BlockStack"
14
+ style="--pc-block-stack-align:space-between;--pc-block-stack-order:column"
15
+ >
16
+ <div
17
+ class="Polaris-Box"
18
+ style="--pc-box-color: var(--p-color-text-critical-on-bg-fill); --pc-box-background: var(--p-color-bg-fill-critical); --pc-box-padding-block-start-xs: var(--p-space-300); --pc-box-padding-block-end-xs: var(--p-space-300); --pc-box-padding-inline-start-xs: var(--p-space-300); --pc-box-padding-inline-end-xs: var(--p-space-300); --pc-box-border-start-start-radius: var(--p-border-radius-300); --pc-box-border-start-end-radius: var(--p-border-radius-300);"
19
+ >
20
+ <div
21
+ class="Polaris-InlineStack"
22
+ style="--pc-inline-stack-align:space-between;--pc-inline-stack-block-align:center;--pc-inline-stack-wrap:nowrap;--pc-inline-stack-gap-xs:var(--p-space-200);--pc-inline-stack-flex-direction-xs:row"
23
+ >
24
+ <div
25
+ class="Polaris-InlineStack"
26
+ style="--pc-inline-stack-wrap:nowrap;--pc-inline-stack-gap-xs:var(--p-space-100);--pc-inline-stack-flex-direction-xs:row"
27
+ >
28
+ <span class="Polaris-Banner--textCriticalOnBgFill">
29
+ <span class="Polaris-Icon">
30
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
31
+ <path d="M10 6a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5a.75.75 0 0 1 .75-.75Z" />
32
+ <path d="M11 13a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" />
33
+ <path
34
+ fill-rule="evenodd"
35
+ d="M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Zm-1.5 0a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Z"
36
+ />
37
+ </svg>
38
+ </span>
39
+ </span>
40
+ <h2 class="Polaris-Text--root Polaris-Text--headingSm Polaris-Text--break">
41
+ ${e.header}
42
+ </h2>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ <div
47
+ class="Polaris-Box"
48
+ style="--pc-box-padding-block-start-xs:var(--p-space-300);--pc-box-padding-block-end-xs:var(--p-space-300);--pc-box-padding-block-end-md:var(--p-space-400);--pc-box-padding-inline-start-xs:var(--p-space-300);--pc-box-padding-inline-start-md:var(--p-space-400);--pc-box-padding-inline-end-xs:var(--p-space-300);--pc-box-padding-inline-end-md:var(--p-space-400)"
49
+ >
50
+ <div
51
+ class="Polaris-BlockStack"
52
+ style="--pc-block-stack-order:column;--pc-block-stack-gap-xs:var(--p-space-300)"
53
+ >
54
+ ${e.errors.map(s=>`
55
+ <div>
56
+ <span class="Polaris-Text--root Polaris-Text--headingSm">${Ot(s.message)}</span>
57
+ <ul class="Polaris-List">
58
+ <li class="Polaris-List__Item">${Ot(s.code)}</li>
59
+ </ul>
60
+ </div>`).join("")}
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </body>
69
+ </html>`}m();m();var Ps=/<head(\s[^>]*)?>/i,Ue="https://cdn.shopify.com/storefront",vs=`${Ue}/standard-events.js`,$s=`${Ue}/standard-events.dev.js`,Dt=`${Ue}/standard-events-inspector.js`,Ut="shopify-cli-standard-events-inspector",bs=new RegExp(`<script\\b[^>]*(?:\\bid=["']${De(Ut)}["']|\\bsrc=["']${De(Dt)}["'])[^>]*>`,"i"),Is=new RegExp(De(vs),"g");function ye(e){return bs.test(e)?e:e.replace(Ps,t=>`${t}<script id="${Ut}" src="${Dt}" defer></script>`)}function Wt(e){return e.replace(Is,$s)}function De(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}m();var Mt=80;function te(e,t,s){if(!ks(e)||s.type==="theme-extension")return;let r=t.headers.get("server-timing")?.match(/cfRequestDuration;dur=([\d.]+)/)?.[1],o=r?`${Math.round(Number(r))}ms`:"";if(ie()==="json"){K(`Request ${e.method} ${t.status} ${e.path}${o?` ${o}`:""}`);return}let a=e.path.length>Mt?`${e.path.substring(0,Mt)}...`:e.path,i=_s(t.status),u=e.method.padStart(6);K(ce`• ${de.format(new Date)} Request ${A.raw("\xBB")} ${u} ${i(String(t.status))} ${a} ${A.gray(o)}`)}function ks(e){let t=[Z,X,"/checkouts","/payments"],s=[".js",".css",".json",".map"];if(t.some(o=>e.path.startsWith(o)))return!1;let[n]=e.path.split("?"),r=N(n);return!s.includes(r)}function _s(e){return e<300?A.green:e<400?A.yellow:A.errorText}var X="/cdn/",Z="/ext/cdn/",We="/api/collect",Ls=new RegExp(String.raw`^${ee}/cart/`),js=new RegExp(String.raw`^${ee}/cart(/|\.js|\.json|$)`),Ee=/^\/checkouts\/(?!internal\/)/,zt=new RegExp(String.raw`^${ee}/account(/login/multipass(/[^/]+)?|/logout)?/?$`),qs=new RegExp(String.raw`^${ee}/localization(\.json)?/?$`),As=new RegExp(`^${X}`),Cs=new RegExp(`^${Z}`),Hs=/^\/api\/(unstable|\d{4}-\d{2})\/graphql\.json/,Os=["/.well-known","/shopify/monorail","/mini-profiler-resources","/web-pixels-manager","/web-pixels@","/wpm","/services/",We,"/cdn-cgi/challenge-platform"],Jt="_shopify_essential",Ns=new RegExp(`${Jt}=([^;]*)(;|$)`);function Gt(e,t){return k(async s=>{if(Os.some(n=>s.path.startsWith(n)))return null;if(Ds(s)){let n=s.path.split("?")[0]??"";return Be(s,t).then(async r=>{if(te(s,r,t),r.ok){let o=n.split("/").at(-1)??"";if(t.localThemeFileSystem.files.has(`assets/${o}.liquid`)){let a=se(await r.text(),t);return new Response(a,r)}}return r}).catch(async r=>{let{status:o,statusText:a,...i}=W(r,`Failed to proxy request to ${n}`);return o>=500&&!n.endsWith(".js.map")&&j(i),new Response(r.message,{status:o,statusText:a})})}})}function Ds(e){if(e.method!=="GET"||e.path.match(Ls)||e.path.match(Ee)||e.path.match(zt)||e.path.match(As)||e.path.match(Cs))return!0;let[t]=e.path.split("?"),s=N(t),n=e.headers.get("accept")??"*/*";return s===".html"||n.includes("text/html")?!1:!!s||n!=="*/*"}function Us(e){let[t]=e.split("?");return!(js.test(t)||Ee.test(t)||zt.test(t)||qs.test(t))}function we(e){return e.session.storeFqdn.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function Ws(e){return Hs.test(e.path)}function se(e,t){let s=e,n=`(data-shs-beacon-endpoint=["'])https://${we(t)}${We}`,r=new RegExp(n,"g");s=s.replace(r,`$1${We}`);let o=new RegExp(`(https?:)?//${we(t)}${X}`,"g");s=s.replace(o,X);let a=/(?:https?:)?\/\/cdn\.shopify\.com\/(.*?\/(assets\/[^?#"'`>\s]+))/g,i=c=>c.startsWith("assets/"),u=new Set([...t.localThemeFileSystem.files.keys()].filter(i)),p=new Set([...t.localThemeExtensionFileSystem.files.keys()].filter(i));return s=s.replace(a,(c,l,f)=>{let w=f&&u.has(f),h=f&&p.has(f)&&l.startsWith("extensions/");return Y(f).startsWith("image/")?c:h?`${Z}${l}`:w?`${X}${l}`:c}),t.options.standardEventsDevBundle&&(s=Wt(s)),s}function Ms(e,t){let s=`http://${t.options.host}:${t.options.port}`,n=new RegExp(`data-base-url=["']((?:https?:)?//${we(t)})[^"']*?["']`,"g");return e.replace(n,(r,o)=>r.replace(o,s))}function Bs(e,t){let s=new RegExp(`Domain=${we(t)};\\s*`,"gi");return e.map(n=>n.replace(s,""))}async function ne(e,t,s,n){let r=Vt(e,t,n);if(r.status>=300&&r.status<400)return r;t.headers.get("content-type")?.includes("application/json")||r.headers.set("content-type","text/html; charset=utf-8");let i=await r.text();return i=se(i,e),i=Ms(i,e),e.options.standardEventsInspector&&(i=ye(i)),s&&(i=s(i)??i),new Response(i,r)}var Yt=["connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade","expect","content-security-policy","host"];function Vt(e,t,s){let n=new Response(t.body,t);n.headers.delete("content-length"),n.headers.delete("content-encoding");for(let i of Yt)n.headers.delete(i);n.headers.delete("access-control-allow-origin"),n.headers.delete("access-control-allow-credentials"),n.headers.delete("access-control-allow-methods"),n.headers.delete("access-control-allow-headers"),n.headers.delete("access-control-expose-headers"),n.headers.delete("access-control-max-age");let r=n.headers.get("Link");r&&n.headers.set("Link",se(r,e));let o=n.headers.get("Location");o&&n.headers.set("Location",zs(e,o,s));let a=n.headers.getSetCookie();if(a?.length){n.headers.set("Set-Cookie",Bs(a,e).join(","));let i=a.join(",").match(Ns)?.[1];i&&(e.session.sessionCookies[Jt]=i)}return n}function zs(e,t,s){if(!s?.keepExternalRedirects){let a=new URL(t,"https://shopify.dev");return Ee.test(a.pathname)?t:Bt(a)}let n=`https://${e.session.storeFqdn}`,r=new URL(t,n),o=r.host===new URL(n).host;return o&&!Ee.test(r.pathname)?Bt(r):!o&&t.startsWith("//")?r.href:t}function Bt(e){return e.searchParams.delete("_fd"),e.searchParams.delete("pb"),e.href.replace(e.origin,"")}function Me(e){let t=mt(e);for(let n of Yt)delete t[n];delete t["upgrade-insecure-requests"];let s=ft(e);return s&&(t["X-Forwarded-For"]=s),t}function Be(e,t){let s=e.path.replace(new RegExp(Z,"g"),"/"),n=e.path.startsWith(Z)?"cdn.shopify.com":t.session.storeFqdn,r=new URL(s,`https://${n}`);if(r.hostname!==n)return Promise.reject(new Error(`Request failed: Hostname mismatch. Expected host: ${n}. Resulting URL hostname: ${r.hostname}`));let o=ht(e),a=Me(e);return Ws(e)||(/\/assets\/[^/]+\.(css|js)$/.test(r.pathname)&&/\?\d+$/.test(r.search)&&(r.search=`?v=${Date.now()}`),r.searchParams.set("_fd","0"),r.searchParams.set("pb","0"),a=Pt({...a,...Ft(),...n===t.session.storeFqdn?t.session.crawlerSignatureHeaders:{},referer:r.origin,Cookie:It(t.session,{headers:a}),...t.type==="theme"&&Us(e.path)?{Authorization:`Bearer ${t.session.storefrontToken}`}:{}})),fetch(r,{method:e.method,body:o,duplex:o?"half":void 0,redirect:"manual",headers:a}).then(i=>Vt(t,i)).catch(i=>{throw ue(q(i),r)})}var ze=0,Js=5;function Zt(e,t,s){return k(n=>{let[r="/",o=""]=n.path.split("?");return Ys(n)&&(t.lastRequestedPath=n.path),t.options.errorOverlay!=="silent"&&t.localThemeFileSystem.uploadErrors.size>0?Xt(t,{status:500,statusText:"Internal Server Error"},{title:"Failed to Upload Theme Files",header:"Upload Errors",errors:Array.from(t.localThemeFileSystem.uploadErrors.entries()).map(([i,u])=>({message:i,code:u.join(`
70
+ `)}))}):pe(t.session,{method:n.method,path:r,query:[...new URLSearchParams(o)],themeId:String(e.id),sectionId:"",headers:Me(n),replaceExtensionTemplates:Te(t),replaceTemplates:Je(t,r,gt(n,"localization")?.toLowerCase())}).then(async i=>{if(i.status>=400&&i.status<500&&!Gs(n)){let u=await Vs(n,t,i);if(u)return te(n,u,t),u}return te(n,i,t),ne(t,i,u=>(Xs(i,u,String(e.id)),ze=0,Ge(u,t)),{keepExternalRedirects:bt({method:n.method,path:r})})}).catch(async i=>{if(i instanceof xe&&(v(`Theme ID mismatch: expected ${i.getExpectedThemeId()} but got ${i.getActualThemeId()}; refreshing session...`),M("theme-service:error-page:theme-id-mismatch"),t.session.refresh)){if(ze++,ze>Js){let _=new I(i.getMessage());if(s)return s(_),new Response(_.message,{status:502});ut(_),process.exit(1)}await t.session.refresh();let h=new URLSearchParams(o),y=new URLSearchParams([...h].filter(([_])=>!_.startsWith("__sfr"))),_e=r+(y.toString()?`?${y}`:"");return new Response(null,{status:302,headers:{Location:_e}})}let{status:u,statusText:p,cause:c,...l}=W(i,"Failed to render storefront"),[f,...w]=l.headline.split(`
71
+ `);return ae(l),Xt(t,{status:u,statusText:p},{title:f,header:f,errors:[{message:[...w,c.message].join("<br>"),code:c.stack?.replace(`${c.message}
72
+ `,"")??""}]})})})}function Xt(e,t,s){let n=Ge(Nt(s),e);return e.options.standardEventsInspector&&(n=ye(n)),M("theme-service:error-page:rendered"),new Response(n,{...t,headers:t.headers??{"Content-Type":"text/html; charset=utf-8"}})}function Gs(e){let t=new URLSearchParams(e.path.split("?")[1]);return["section_id","sections","app_block_id"].some(s=>t.has(s))}function Ys(e){return e.headers.get("sec-fetch-mode")==="navigate"}async function Vs(e,t,s){v(`Render failed for ${e.path} with ${s.status} (x-request-id: ${s.headers.get("x-request-id")}), trying proxy...`);let n=await Be(e,t).catch(r=>new Response(null,W(r)));if(n.status<400)return v(`Proxy status: ${n.status}. Returning proxy response.`),t.options.standardEventsInspector&&(n.headers.get("content-type")??"").includes("text/html")?ne(t,n):n;v(`Proxy status: ${n.status}. Returning render error.`)}function Xs(e,t,s){let n=t.match(/Shopify\.theme\s*=\s*{[^}]+?"id":\s*"?(\d+)"?(}|,)/)?.[1];if(n&&n!==s)throw new xe(s,n,e)}var xe=class extends Error{response;expectedThemeId;actualThemeId;constructor(t,s,n){super([`Theme ID mismatch: expected ${t} but got ${s}.`,`Request ID: ${n.headers.get("x-request-id")}`,`URL: ${n.url}`,"This is likely related to an issue in upstream Shopify APIs.","Please try again in a few minutes and report this issue:","https://community.shopify.dev/c/shopify-cli-libraries/14"].join(`
73
+ `)),this.response=n,this.expectedThemeId=t,this.actualThemeId=s}getMessage(){return this.message}getResponse(){return this.response}getExpectedThemeId(){return this.expectedThemeId}getActualThemeId(){return this.actualThemeId}};m();m();function Re(e,t){let s=new RegExp(`{%-?\\s*${t}\\s*-?%}`),n=new RegExp(`{%-?\\s*end${t}\\s*-?%}`),r=s.exec(e);if(!r)return;let o=r.index+r[0].length;n.lastIndex=o;let a=n.exec(e);if(!a)return;let i=a.index;return e.slice(o,i)}m();function Se(e){let{pathname:t,search:s,searchParams:n}=new URL(e.path,"http://e.c");return{pathname:t,search:s,searchParams:n}}var Zs={stylesheet:new Map,javascript:new Map};function Qt(e,t){return k(async s=>{if(s.method!=="GET")return;if(tn(s,t))return sn(s,t);let{file:n,fileKey:r,isUnsynced:o}=en(s,t);if(!r)return;let a=Y(r);if(a.startsWith("image/")&&s.path.includes("&")&&!o)return;if(Et(s,"X-Local-Asset","true"),!n){o&&z(s,B({statusCode:404,statusMessage:"Not found"}));return}let i=n.value?Buffer.from(se(n.value,t)):Buffer.from(n.attachment??"","base64");return le(s,{getContents:()=>i,getMeta:()=>({type:a,size:i.length,mtime:n.stats?.mtime})})})}var Qs=/^(?:\/cdn\/(?!extensions\/).*?)?\/assets\/([^?]+)/,Ks=/^(?:\/(?:ext\/)?cdn\/extensions\/.*?)?\/assets\/([^?]+)/;function en(e,t){let s=(n,r)=>{let o=e.path.match(n)?.[1];if(o){let a=R("assets",o),i=r.files.get(a),u=r.unsyncedFileKeys.has(a);if(i||u)return{file:i,isUnsynced:u,fileKey:a}}};return s(Qs,t.localThemeFileSystem)??s(Ks,t.localThemeExtensionFileSystem)??{isUnsynced:!1,fileKey:void 0,file:void 0}}function tn(e,t){return t.type==="theme"&&e.path.includes("/compiled_assets")}function sn(e,t){switch(Se(e).pathname.split("/").at(-1)){case"styles.css":return nn(t,e);case"block-scripts.js":return Ye(t,e,"block");case"snippet-scripts.js":return Ye(t,e,"snippet");case"scripts.js":return Ye(t,e,"section");case void 0:break;default:break}}function nn(e,t){let s=Fe(e,"section"),n=Fe(e,"block"),r=Fe(e,"snippet"),o=[`/*** GENERATED LOCALLY ***/
74
+ `];for(let[,i]of[...s,...n,...r]){let u=Kt(i,"stylesheet");u&&o.push(u)}let a=o.join(`
75
+ `);return le(t,{getContents:()=>a,getMeta:()=>({type:"text/css",size:Buffer.byteLength(a),mtime:new Date})})}function Ye(e,t,s){let n=Fe(e,s),r=`${s}s`,o=[`
76
+ /*** GENERATED LOCALLY ***/
77
+
78
+ (function () {
79
+ var __${r}__ = {};
80
+
81
+ (function () {
82
+ var element = document.getElementById("${r}-script");
83
+ var attribute = element ? element.getAttribute("data-${r}") : "";
84
+ var ${r} = attribute.split(",").filter(Boolean);
85
+
86
+ for (var i = 0; i < ${r}.length; i++) {
87
+ __${r}__[${r}[i]] = true;
88
+ }
89
+ })();`];for(let[i,u]of n){let p=i.split("/").pop()?.replace(".liquid",""),c=Kt(u,"javascript")??"";p&&c&&o.push(`
90
+ (function () {
91
+ if (!__${r}__["${p}"] && !Shopify.designMode) return;
92
+ try {
93
+ ${c}
94
+ } catch (e) {
95
+ console.error(e);
96
+ }
97
+ })();`)}o.push("})();");let a=o.join(`
98
+ `);return le(t,{getContents:()=>a,getMeta:()=>({type:"text/javascript",size:Buffer.byteLength(a),mtime:new Date})})}function Fe(e,t){return[...e.localThemeFileSystem.files.entries()].filter(([s])=>s.endsWith(".liquid")&&s.startsWith(`${t}s/`)).sort(([s],[n])=>s.localeCompare(n))}function Kt(e,t){let s=Zs[t],n=s.get(e.key);if(n?.checksum===e.checksum)return n.content;if(s.delete(e.key),!e.value)return;let r=[`/* ${e.key} */`],o=Re(e.value??"",t)?.trimEnd();if(o&&r.push(o),r.length>1){let a=r.join(`
99
+ `);return s.set(e.key,{checksum:e.checksum,content:a}),a}}m();import*as es from"node:os";function rn(e,t){let s=new Set,n=`:${t}`,r=e.toLowerCase().trim();if(s.add(`${r}${n}`),["localhost","127.0.0.1","::1","0.0.0.0"].includes(r)&&(s.add(`localhost${n}`),s.add(`127.0.0.1${n}`),s.add(`[::1]${n}`)),r==="0.0.0.0"||r==="::")for(let a of Object.values(es.networkInterfaces()))for(let i of a??[]){let u=i.address.toLowerCase().split("%")[0],c=i.family==="IPv6"?`[${u}]`:u;s.add(`${c}${n}`)}return s}function on(e){if(e)return e.toLowerCase().replace(/\.(?=:\d|$)/,"")}function ts(e,t){let s=rn(e,t);return k(n=>{let r=n.node.req.headers.host,o=on(r);if(!o||!s.has(o))return z(n,B({statusCode:400,statusMessage:"Bad Request",message:"Invalid Host header"}))})}m();function ss(){return ns()}function Qr(){return ns()}function ns(){return{root:"",files:new Map,unsyncedFileKeys:new Set,uploadErrors:new Map,ready:()=>Promise.resolve(),delete:async e=>{},read:async e=>"",write:async e=>{},stat:async e=>({mtime:new Date,size:1}),addEventListener:()=>{},startWatcher:async()=>{}}}import{createServer as an}from"node:http";async function po(e,t){let s=await ln(e,t);return await dn(e,s),cn(e,s)}function cn(e,t){let s=Tt();s.use(ts(t.options.host,t.options.port)),s.use(rs(e,t)),s.use(Qt(e,t)),s.use(Gt(e,t)),s.use(Zt(e,t));let n=an(Rt(s));return{dispatch:s.handler.bind(s),start:async()=>new Promise(r=>n.listen({port:t.options.port,host:t.options.host},()=>r({close:async()=>{await Promise.all([new Promise(o=>{n.closeAllConnections(),n.close(o)})])}})))}}async function ln(e,t){let{adminSession:s,storefrontPassword:n,themeExtensionPort:r,themeExtensionDirectory:o,crawlerSignatureHeaders:a}=t,i="127.0.0.1",u=r??9293,p=ss(),c=Ht(o);return await c.ready(),{session:await kt(e.id.toString(),s,void 0,n,a),localThemeFileSystem:p,localThemeExtensionFileSystem:c,directory:o,type:"theme-extension",lastRequestedPath:"",options:{themeEditorSync:!1,noDelete:!1,ignore:[],only:[],host:i,port:u,liveReload:"hot-reload",standardEventsDevBundle:!1,standardEventsInspector:!1,open:!1,errorOverlay:"default"}}}async function dn(e,t){let s=t.localThemeExtensionFileSystem,n=({fileKey:r,onContent:o,onSync:a})=>{o(()=>{Pe(e,t,a,{type:"update",key:r,payload:{isThemeExtension:!0}})})};return s.addEventListener("add",n),s.addEventListener("change",n),s.ready().then(async()=>s.startWatcher())}function Te(e){let t={},s=e.localThemeExtensionFileSystem;for(let n of s.unsyncedFileKeys){let r=s.files.get(n),o=r?.value??r?.attachment;o&&(t[n]=o)}return t}var be=st(St(),1);import un from"node:events";var Ve=new Map,re=new Map;function os(e,t){let s=(0,be.parseJSON)(t,null,!0);if(!s)return;let n=s?.sections;n&&!e.startsWith("locales/")?re.set(e,Object.entries(n||{}).map(([r,{type:o}])=>[o,r])):re.delete(e)}function Xe(e){return!e.startsWith("assets/")&&[".liquid",".json"].includes(N(e))}function Je(e,t,s){let n={},r=/^templates\/.+\.json$/,o=t?`${R("templates",t.replace(/^\//,"").replace(/\.html$/,"")||"index")}.json`:"",a=!!t&&e.localThemeFileSystem.files.has(o),i=/^locales\/.+\.json$/,u=!!s&&(e.localThemeFileSystem.files.has(`locales/${s}.json`)||e.localThemeFileSystem.files.has(`locales/${s}.default.json`));for(let p of e.localThemeFileSystem.unsyncedFileKeys)if(Xe(p)){if(a&&r.test(p)){if(p!==o)continue}else if(i.test(p)){if(u){if(!p.startsWith(`locales/${s}.`))continue}else if(!p.includes(".default."))continue}n[p]=e.localThemeFileSystem.files.get(p)?.value??""}return n}function bo(e,t){let s=({fileKey:r,onContent:o,onSync:a})=>{let i=N(r);o(u=>{!gn(r)&&Xe(r)&&i===".json"&&os(r,u),Pe(e,t,a,{type:"update",key:r,payload:fn(r,t)})})},n=({fileKey:r,onSync:o})=>{re.delete(r),Pe(e,t,o,{type:"delete",key:r})};return t.localThemeFileSystem.addEventListener("add",s),t.localThemeFileSystem.addEventListener("change",s),t.localThemeFileSystem.addEventListener("unlink",n),t.localThemeFileSystem.ready().then(async()=>{let r=[...t.localThemeFileSystem.files];return Promise.allSettled(r.map(async([o,a])=>{if(o.endsWith(".json")){let i=a.value??await t.localThemeFileSystem.read(o);i&&typeof i=="string"&&os(o,i)}else o.endsWith(".liquid")&&ls(a)}))})}var pn="1",as=new un;function $e(e){as.emit("hot-reload",{...e,version:pn})}function rs(e,t){return k(s=>{let n=s.headers.get("accept")==="text/event-stream",r=Se(s).searchParams;if(n){let o=xt(s);return as.on("hot-reload",a=>{o.push(JSON.stringify(a)).catch(i=>{j({headline:"Failed to send HotReload event.",body:i.stack})})}),$e({type:"open",pid:String(process.pid),themeId:String(e.id)}),o.send().then(()=>o.flush())}if(r.has("hr-log")){let o=(0,be.parseJSON)(r.get("hr-log")??"",null);return o&&(o.headline=`[HotReload] ${o.headline}`,o.type==="error"?ae(o):o.type==="warn"?j(o):o.type==="info"?dt(o):j({headline:`Unknown HotReload log type: ${o.type}`})),null}if(s.path===cs)return L(Ie()).then(o=>yt(s,o,"application/javascript")).catch(o=>z(s,B({cause:o})));if(r.has("section_id")||r.has("app_block_id")){let o=r.get("section_key")??"",a=r.get("section_id")??"",i=r.get("app_block_id")??"",u=s.path.split("?")[0]??"",p=new URLSearchParams(r);if(p.delete("section_key"),p.delete("section_id"),p.delete("app_block_id"),p.delete("_fd"),p.delete("pb"),a===""&&i==="")return;let c={};if(a){let l=t.localThemeFileSystem.unsyncedFileKeys;if(l.has(o)){let f=t.localThemeFileSystem.files.get(o)?.value;if(!f)return"";c[o]=f}for(let f of l)if(f.endsWith(".json")){for(let[w,h]of re.get(f)??[])if(a.endsWith(`__${h}`)){let y=t.localThemeFileSystem.files.get(f)?.value;y&&(c[f]=y);continue}}}return pe(t.session,{method:s.method,path:u??"/",query:[...p.entries()],themeId:String(e.id),sectionId:a,appBlockId:i,replaceTemplates:c,headers:wt(s),replaceExtensionTemplates:Te(t)}).then(async l=>{if(!l.ok)throw M("theme-service:hot-reload:section:render-failed"),ue(l);return ne(t,l)}).catch(async l=>{let{status:f,statusText:w,...h}=W(q(l),"Failed to render section on Hot Reload");return M("theme-service:hot-reload:section:render-error"),i||j(h),new Response(null,{status:f,statusText:w})})}})}var oe=(e,t)=>$e({themeId:String(e),type:"full",key:t});function Pe(e,t,s,n){let r=()=>oe(e.id,n.key);if(t.options.liveReload==="off")return;if(t.options.liveReload==="full-page"){s(r);return}let o=String(e.id);$e({sync:"local",themeId:o,...n}),s(()=>$e({sync:"remote",themeId:o,...n}),r)}function mn(e,t){let s=new Set;if(e.endsWith(".json")){let n=t.localThemeFileSystem.files.get(e)?.value;if(n){let r=(0,be.parseJSON)(n,null,!0)?.sections;for(let o of Object.keys(r??{}))s.add(o)}}else{let n=e.match(/^sections\/(.+)\.liquid$/)?.[1];if(n)for(let[r,o]of re)for(let[a,i]of o)a===n&&s.add(i)}return[...s]}function fn(e,t){let[s]=e.split("/"),n=t.localThemeFileSystem.files.get(e);return{sectionNames:s==="sections"?mn(e,t):[],replaceTemplates:Xe(e)?Je(t):{},updatedFileParts:n&&ls(n)}}var ve="hot-reload-client",hn="/cdn/shopifycloud/theme-hot-reload/theme-hot-reload.js",is=new RegExp(`<script id="${ve}"[^>]*>[^<]*</script>`),cs="/@shopify/theme-hot-reload";function Ge(e,t){return t.options.liveReload==="off"?e.replace(is,""):process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD?e.replace(is,"").replace(/<\/head>/,`<script id="${ve}" src="${cs}" defer></script></head>`):e.includes(`<script id="${ve}"`)?e:e.replace(/<\/head>/,`<script id="${ve}" src="${hn}" defer></script></head>`)}function gn(e){return e.startsWith("assets/")}function ls(e){if(!(["sections/","snippets/","blocks/"].some(c=>e.key.startsWith(c))&&e.key.endsWith(".liquid")))return;let n={stylesheetTag:!1,javascriptTag:!1,schemaTag:!1,liquid:!1},r={checksum:e.checksum,liquid:"",stylesheetTag:"",javascriptTag:"",schemaTag:""},o=Ve.get(e.key);if(o?.checksum===e.checksum||(Ve.delete(e.key),!e.value))return n;let a=["stylesheet","javascript","schema"],i=c=>c?.replace(/\s+/g," ").trim(),u=e.value,p=(c,l)=>{u=u.replace(l,"");let f=i(l),w=`${c}Tag`;n[w]=!o||f!==o[w],r[w]=f};for(let c of a){let l=Re(e.value??"",c);l&&p(c,l)}return u=i(u.replace(/<!--[\s\S]*?-->/g,"").replace(/{%\s*comment\s*%}[\s\S]*?{%\s*endcomment\s*%}/g,"").replace(/{%\s*doc\s*%}[\s\S]*?{%\s*enddoc\s*%}/g,"")),r.liquid=u,n.liquid=!o||u!==o.liquid,Ve.set(e.key,r),n}m();m();import{lstat as yn}from"node:fs/promises";async function Ze(e){try{return await yn(e),!0}catch(t){if(t instanceof Error&&"code"in t&&(t.code==="ENOENT"||t.code==="ENOTDIR"))return!1;throw t}}async function ds(e,t){return e===t||await Ze(e)?e:ds(rt(e),t)}function Q(e){if(!e||e==="."||e===".."||/[\\/]/.test(e)||/^[a-z]:/i.test(e))throw new I(`Unsafe listing name: ${e}`)}async function P(e,t){let s=t.replace(/\\/g,"/");if(!t||/^[\\/]/.test(t)||/^[a-z]:/i.test(t)||s.split("/").includes(".."))throw new I(`Unsafe theme file key: ${t}`);let n=nt(e),r=R(n,s);if(O(n,r)===""||!je(n,r,{native:!0}))throw new I(`Unsafe theme file key: ${t}`);let o=await ds(r,n);try{let a=await Ae(n),i=await Ae(o);if(!je(a,i,{native:!0}))throw new I(`Unsafe theme file key: ${t}`)}catch{throw new I(`Unsafe theme file key: ${t}`)}return r}var us=st(St(),1);function En(e){return(e.startsWith("templates/")||e.startsWith("sections/"))&&e.endsWith(".json")}async function ps(e,t,s){if(Q(t),En(s)){await P(e,s);let n=await P(e,R("listings",t,s));if(await b(n))return n}}async function ms(e,t){Q(t);let s=await P(e,"config/settings_data.json"),n=await L(s,{encoding:"utf8"}),r=(0,us.parseJSON)(n,null,!0);return r?(r.current=qe(t),JSON.stringify(r,null,2)):n}async function Wo(e,t){Q(t);let s=R(e,"listings"),n=R(s,t);if(await Ze(e)&&(await P(e,"listings"),await P(e,R("listings",t))),await b(n))return;let o=[];await b(s)&&(o=await D("*",{cwd:s,onlyDirectories:!0,deep:1}));let a=o.length>0?`Available presets: ${o.map(i=>`"${qe(i)}"`).join(", ")}`:'No presets found under "listings/"';throw new I(`Listing preset "${t}" was not found. ${a}.`,`Add the preset to config/settings_data.json and its corresponding "listings/${t}" folder, or remove the --listing flag to use the default theme settings.`)}import wn from"node:events";import{fileURLToPath as xn}from"node:url";var Tn=250,fs=["AGENTS.md","DESIGN.md","assets/**/*.*","config/**/*.json","config/styles.css","layout/**/*.liquid","locales/**/*.json","sections/**/*.{liquid,json}","blocks/**/*.liquid","snippets/**/*.liquid","templates/**/*.{liquid,json}","templates/customers/**/*.{liquid,json}"],$={documentationFilesRegex:/^(AGENTS|DESIGN)\.md$/,layoutLiquidRegex:/^layout\/.+\.liquid$/,sectionLiquidRegex:/^sections\/.+\.liquid$/,blockLiquidRegex:/^blocks\/.+\.liquid$/,configSchemaRegex:/^config\/settings_schema\.json$/,configDataRegex:/^config\/settings_data\.json$/,configStylesheetRegex:/^config\/styles\.css$/,sectionJsonRegex:/^sections\/.+\.json$/,templateJsonRegex:/^templates\/.+\.json$/,jsonRegex:/^(?!config\/).*\.json$/,contextualizedJsonRegex:/\.context\.[^.]+\.json$/i,staticAssetRegex:/^assets\/(?!.*\.liquid$)/};function li(e,t){t?.listing!==void 0&&Q(t.listing);let s=new Map,n=new Map,r=new Set,o={ignoreFromFile:[],ignore:t?.filters?.ignore??[],only:t?.filters?.only??[]},a=new wn,i=(d,E)=>{a.emit(d,E)},u=t?.notify?new fe(t.notify):void 0,p=async d=>{let E=t?.listing?await Sn(e,d,t.listing):await ge(e,d),g=he(d,E);return s.set(d,G({key:d,checksum:g,value:typeof E=="string"?E:"",attachment:Buffer.isBuffer(E)?E.toString("base64"):""})),E},c=D(fs,{cwd:e,deep:3,ignore:J}).then(async d=>{o.ignoreFromFile.push(...await qt(e));let E=me(d.map(g=>({key:g})),o);await Promise.all(E.map(({key:g})=>p(g)))}),l=d=>O(e,d),f=d=>me([{key:d}],o).length===0;function w(d,E,g,x){if(process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD&&x===Ie()){oe(E,x);return}let S=l(x);if(t?.listing&&S.startsWith(`listings/${t.listing}/`)){let F=S.replace(`listings/${t.listing}/`,"");if(F.startsWith("templates/")||F.startsWith("sections/"))S=F;else return}h(S).then(()=>{switch(d){case"add":case"change":return y(d,E,g,S);case"unlink":return _e(E,g,S,n)}}).catch(F=>{U(`Error handling file event for ${S}: ${F}`)})}function h(d){return u?.notify(d)??Promise.resolve()}let y=(d,E,g,x)=>{if(f(x))return;let S=s.get(x)?.checksum,F=p(x).then(async()=>{let T=s.get(x);if(T)return T.checksum!==S&&r.add(x),{value:T.value||void 0,attachment:T.attachment}}),C=F.then(T=>{if(T)return Rn(r,n,x,E,g)(T)}).catch(Oe(x,"upload"));i(d,{fileKey:x,onContent:T=>{F.then(H=>{r.has(x)&&T(H?.value??H?.attachment??"")}).catch(()=>{})},onSync:(T,H)=>{C.then(et=>{et?T():H?.()}).catch(()=>{})}})},_e=(d,E,g,x)=>{if(f(g))return;x.delete(g),s.delete(g),r.add(g);let S=t?.noDelete?Promise.resolve():vt(Number(d),[g],E).then(async F=>{if(!F[0]?.success)throw new Error(`Failed to delete file "${g}" from remote theme.`);return r.delete(g),hs("delete",g),!0}).catch(F=>(Oe(g,"delete")(F),!1));i("unlink",{fileKey:g,onSync:F=>{S.then(C=>{C&&F()}).catch(()=>{})}})},_=new Set(fs.map(d=>R(e,d.split("/").shift()??"")));return t?.listing&&_.add(R(e,"listings",t.listing)),process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD&&_.add(Ie()),{root:e,files:s,unsyncedFileKeys:r,uploadErrors:n,ready:()=>c,delete:async d=>{await P(e,d),s.delete(d),await Fn(e,d)},write:async d=>{await P(e,d.key);let E=(d.key.startsWith("templates/")||d.key.startsWith("sections/"))&&d.key.endsWith(".json");if(t?.listing&&E){let g=R("listings",t.listing,d.key),x=await P(e,g),S=await b(x);s.set(d.key,G({key:d.key,checksum:d.checksum,value:d.value??"",attachment:d.attachment??""})),S?await Qe(e,{...d,key:g}):await Qe(e,d);return}s.set(d.key,G({key:d.key,checksum:d.checksum,value:d.value??"",attachment:d.attachment??""})),await Qe(e,d)},read:p,applyIgnoreFilters:d=>me(d,o),addEventListener:(d,E)=>{a.on(d,E)},startWatcher:async(d,E)=>{let{default:g}=await import("./chokidar-5RWEYTNQ.js");if(t?.signal?.aborted)return;let x=g.watch([..._],{ignored:J,persistent:!process.env.SHOPIFY_UNIT_TEST,ignoreInitial:!0}),S=new Map,F=()=>{for(let T of S.values())clearTimeout(T);S.clear(),x.close().catch(T=>U(`Error closing file watcher: ${T.message}`))};t?.signal?.addEventListener("abort",F,{once:!0}),x.once("close",()=>t?.signal?.removeEventListener("abort",F));let C=(T,H)=>{if(t?.signal?.aborted)return;let Le=`${l(H)}:${T}`,tt=S.get(Le);tt&&clearTimeout(tt);let gs=setTimeout(()=>{S.delete(Le),w(T,d,E,H)},Tn);S.set(Le,gs)};x.on("add",C.bind(null,"add")).on("change",C.bind(null,"change")).on("unlink",C.bind(null,"unlink")).on("error",T=>{U(`File watcher error: ${T}`),q("theme-service:file-watcher:error")})}}}function Rn(e,t,s,n,r){return async o=>{if(!e.has(s))return!1;let[a]=await $t(Number(n),[{key:s,...o}],r);if(!a?.success){let i=a?.errors?.asset??["Response was not successful."];throw t.set(s,i),oe(n,s),new Error(i.join(`
100
+ `))}return t.delete(s)&&oe(n,s),e.delete(s),hs("update",s),!0}}async function Qe(e,{key:t,attachment:s,value:n}){let r=await P(e,t);if(await Pn(r),s){let o=Buffer.from(s,"base64");await Ce(r,o,{encoding:"base64"})}else await Ce(r,n??"")}async function ge(e,t){let s=ke(t)?{encoding:"utf8"}:{},n=await P(e,t);if(!await b(n)){v(`File ${n} can't be read because it doesn't exist...`);return}return L(n,s)}async function Sn(e,t,s){if(t==="config/settings_data.json")return ms(e,s);let n=await ps(e,s,t);if(n){let r=ke(t)?{encoding:"utf8"}:{};return L(n,r)}return ge(e,t)}async function Fn(e,t){let s=await P(e,t);if(!await b(s)){v(`File ${s} can't be removed because it doesn't exist...`);return}await ct(s)}function di(e){let t=[],s=[],n=[],r=[],o=[],a=[],i=[],u=[],p=[],c=[],l=[],f=[],w=[];return e.forEach(h=>{let y=h.key;$.documentationFilesRegex.test(y)?w.push(h):y.endsWith(".liquid")?$.sectionLiquidRegex.test(y)?t.push(h):$.blockLiquidRegex.test(y)?l.push(h):$.layoutLiquidRegex.test(y)?f.push(h):s.push(h):$.configSchemaRegex.test(y)?i.push(h):$.configDataRegex.test(y)?u.push(h):$.configStylesheetRegex.test(y)?p.push(h):$.jsonRegex.test(y)?$.contextualizedJsonRegex.test(y)?a.push(h):$.sectionJsonRegex.test(y)?n.push(h):$.templateJsonRegex.test(y)?r.push(h):o.push(h):$.staticAssetRegex.test(y)&&c.push(h)}),{sectionLiquidFiles:t,otherLiquidFiles:s,sectionJsonFiles:n,templateJsonFiles:r,contextualizedJsonFiles:a,otherJsonFiles:o,configSchemaFile:i,configDataFile:u,configStylesheetFiles:p,staticAssetFiles:c,blockLiquidFiles:l,layoutFiles:f,documentationFiles:w}}function ke(e){return _t({liquid:"application/liquid",sass:"text/x-sass",scss:"text/x-scss"}),["application/javascript","application/json","application/liquid","text/css","text/x-sass","text/x-scss","image/svg+xml","text/markdown"].includes(Y(e))}async function ui(e){let t=new Set(await D("*",{cwd:e,deep:1,onlyDirectories:!0}));return["config","layout","templates"].every(n=>t.has(n))}async function Pn(e){let t=vn(e);await b(t)||await at(t)}function vn(e){let t=ot(e),s=e.lastIndexOf(t);return e.substring(0,s)}function hs(e,t){K(ie()==="json"?`Synced ${e} ${t}`:ce`• ${de.format(new Date)} Synced ${A.raw("\xBB")} ${e} ${t}`)}function Ie(){let e=process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD;return!e||e==="true"?R(xn(import.meta.url.split("/cli/")[0]??""),"theme-hot-reload/dist/theme-hot-reload.js"):e}function he(e,t){return t?Buffer.isBuffer(t)?Ke(t):kn(e)?$n(t):bn(e,t):""}function $n(e){let t=e;return t=t.replace(/\r\n/g,`
101
+ `),t=t.replace(/\/\*[\s\S]*?\*\//,""),t=In(t),Ke(t)}function bn(e,t){let s=t;return ke(e)&&(s=s.replace(/\r\n/g,`
102
+ `)),Ke(s)}function In(e){let t=!1,s=!1,n="";for(let r of e)r==='"'&&!s&&(t=!t),!(!t&&(r===" "||r===`
103
+ `))&&(n+=r,s=r==="\\"&&!s);return n}function Ke(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);return lt(t)}function gi(e){let t=new Set(e.filter(({key:s})=>s.startsWith("assets/")&&s.endsWith(".liquid")).map(({key:s})=>s));return e.filter(({key:s})=>s.startsWith("assets/")?!t.has(`${s}.liquid`):!0)}function kn(e){return e.endsWith("/settings_data.json")}export{gi as a,Gt as b,Zt as c,Qt as d,ts as e,Qr as f,po as g,bo as h,rs as i,oe as j,ps as k,Wo as l,li as m,di as n,ui as o};
@@ -0,0 +1,6 @@
1
+ import{b as r,c as i,d as p}from"./chunk-HYCNYUHW.js";import{b as o}from"./chunk-XEZPN5TR.js";import{b as e,c as s}from"./chunk-DMOLPSXF.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var t=class n extends o{static summary="Enable automatic upgrades for Shopify CLI.";static descriptionWithMarkdown=`Enable automatic upgrades for Shopify CLI.
2
+
3
+ When auto-upgrade is enabled, Shopify CLI automatically updates to the latest version once per day. Major version upgrades are skipped and must be done manually.
4
+
5
+ To disable auto-upgrade, run \`shopify config autoupgrade off\`.
6
+ `;static jsonOutputSchema=i;static description=this.descriptionForHelp();static flags={...e,...s};async run(){let{flags:u}=await this.parse(n),d=r(!0);p(d,u.json?"json":"text")}};export{t as a};
@@ -0,0 +1,89 @@
1
+ import{a as Zn}from"./chunk-DC7ITY6T.js";import{a as Kr}from"./chunk-VJEKDBGZ.js";import{D as Fe,E as $e,H as ct,I as nt,K as ti,P as ei,Q as ni,T as ii,W as ri,Z as Ie,fa as oi,q as Kn,r as Yn,s as Qn,t as Se,u as J,v as at,z as Ht}from"./chunk-OJOF6IYG.js";import{a as Gr}from"./chunk-7DBKSSDK.js";import{a as Xn}from"./chunk-KFO2JNF5.js";import{da as zr}from"./chunk-2PD7TNFS.js";import{c as xt,d as H}from"./chunk-27JT4NA4.js";import{a as $n,b as In}from"./chunk-F5QKMDP3.js";import{a as Gn}from"./chunk-OTMYJWIP.js";import{a as qt}from"./chunk-HVUMVDUG.js";import{b as qr,fa as Mt,ga as Wt,ja as Q,p as Pn,s as Cn,v as En}from"./chunk-YKDRUAY3.js";import{m as Bt,n as kn,s as Dn,t as jn,w as Vt,x as Jt}from"./chunk-4WBWZIN5.js";import{e as Sn,q as Fn}from"./chunk-3FZ4LE6A.js";import{a as he}from"./chunk-JIY6XWSC.js";import{a as tt,b as Lt}from"./chunk-BFAOTQGH.js";import{C as Rn,D as et,E as _e,G as Tn,I as bt,R as X,U as Mn,x as Un,y as ve,z as Nn}from"./chunk-2KUM2RU4.js";import{b as wt,d as _n,e as Tt}from"./chunk-QBRRFFMZ.js";import{a as an}from"./chunk-LG3KEHGD.js";import{f as xe}from"./chunk-I3WRA2LH.js";import{i as v,k as Ln,l as Pe}from"./chunk-TD6JBHUS.js";import{Aa as mn,Da as K,Db as Jn,Ea as gn,Eb as _,Fb as Hn,Hb as qn,Ib as zn,Ja as yn,Ka as wn,L as st,N as B,Na as bn,Oa as xn,Q as Jr,R as Hr,Sa as x,Ta as L,Va as k,Wa as vn,X as z,Y as ge,_ as ye,_a as Y,aa as ln,ab as Nt,cb as Rt,da as pn,ja as we,kb as An,la as N,ma as Ot,na as yt,oa as V,pa as Ut,ta as T,tb as D,ua as fn,ub as Bn,va as M,vb as U,xa as dn,ya as hn,zb as Vn}from"./chunk-ZMOW2YZ4.js";import{i as On}from"./chunk-B4OMIONW.js";import{b as g,k as be}from"./chunk-3PYDIBTX.js";import{l as Ce,m as Ee,n as Wn}from"./chunk-DOLVBTCB.js";import{a as mt}from"./chunk-JD5P5RAJ.js";import{c as u,d as Z,e as gt,f as F,g as Dt,h as E,i as $,j as jt,k as cn,m as un,s as me}from"./chunk-IWTNUJGY.js";import{a as ht,c as de,e as kt,f as Vr,g as f}from"./chunk-VKWPEFWQ.js";var wi=de((Gt,yi)=>{f();(function(t,e){typeof Gt=="object"&&typeof yi<"u"?e(Gt,(Hr(),Vr(Jr)),qr()):typeof define=="function"&&define.amd?define(["exports","tslib","graphql"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t["graphql-tag"]={},t.tslib,t.graphql))})(Gt,(function(t,e,n){"use strict";var i=new Map,r=new Map,o=!0,s=!1;function a(C){return C.replace(/[\s,]+/g," ").trim()}function c(C){return a(C.source.body.substring(C.start,C.end))}function l(C){var A=new Set,S=[];return C.definitions.forEach(function(I){if(I.kind==="FragmentDefinition"){var j=I.name.value,W=c(I.loc),dt=r.get(j);dt&&!dt.has(W)?o&&console.warn("Warning: fragment with name "+j+` already exists.
2
+ graphql-tag enforces all fragment names across your application to be unique; read more about
3
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):dt||r.set(j,dt=new Set),dt.add(W),A.has(W)||(A.add(W),S.push(I))}else S.push(I)}),e.__assign(e.__assign({},C),{definitions:S})}function p(C){var A=new Set(C.definitions);A.forEach(function(I){I.loc&&delete I.loc,Object.keys(I).forEach(function(j){var W=I[j];W&&typeof W=="object"&&A.add(W)})});var S=C.loc;return S&&(delete S.startToken,delete S.endToken),C}function d(C){var A=a(C);if(!i.has(A)){var S=n.parse(C,{experimentalFragmentVariables:s,allowLegacyFragmentVariables:s,experimentalFragmentArguments:s});if(!S||S.kind!=="Document")throw new Error("Not a valid GraphQL document.");i.set(A,p(l(S)))}return i.get(A)}function m(C){for(var A=[],S=1;S<arguments.length;S++)A[S-1]=arguments[S];typeof C=="string"&&(C=[C]);var I=C[0];return A.forEach(function(j,W){j&&j.kind==="Document"?I+=j.loc.source.body:I+=j,I+=C[W+1]}),d(I)}function h(){i.clear(),r.clear()}function y(){o=!1}function P(){s=!0}function b(){s=!1}var w={gql:m,resetCaches:h,disableFragmentWarnings:y,enableExperimentalFragmentVariables:P,disableExperimentalFragmentVariables:b};(function(C){C.gql=w.gql,C.resetCaches=w.resetCaches,C.disableFragmentWarnings=w.disableFragmentWarnings,C.enableExperimentalFragmentVariables=w.enableExperimentalFragmentVariables,C.disableExperimentalFragmentVariables=w.disableExperimentalFragmentVariables})(m||(m={})),m.default=m;var R=m;t.default=R,t.disableExperimentalFragmentVariables=b,t.disableFragmentWarnings=y,t.enableExperimentalFragmentVariables=P,t.gql=m,t.resetCaches=h,Object.defineProperty(t,"__esModule",{value:!0})}))});var xi=de((Ta,bi)=>{f();bi.exports=wi().gql});var $i=de(Fi=>{f();var uo=Object.create,Kt=Object.defineProperty,lo=Object.getPrototypeOf,po=Object.prototype.hasOwnProperty,fo=Object.getOwnPropertyNames,ho=Object.getOwnPropertyDescriptor,_i=t=>Kt(t,"__esModule",{value:!0}),mo=(t,e)=>{_i(t);for(var n in e)Kt(t,n,{get:e[n],enumerable:!0})},go=(t,e,n)=>{if(_i(t),e&&typeof e=="object"||typeof e=="function")for(let i of fo(e))!po.call(t,i)&&i!=="default"&&Kt(t,i,{get:()=>e[i],enumerable:!(n=ho(e,i))||n.enumerable});return t},Yt=t=>t&&t.__esModule?t:go(Kt(t!=null?uo(lo(t)):{},"default",{value:t,enumerable:!0}),t);mo(Fi,{default:()=>Eo,generateContentsFromGraphqlString:()=>Si,generateGraphQLString:()=>Ci});var yo=Yt(ht("fs")),wo=Yt(xi()),bo=Yt(ht("readline")),vi=Yt(ht("path")),Pi=(t,e)=>{let n=e?e(t):t;return JSON.stringify(n,(i,r)=>r===void 0?"__undefined":r).replace(/"__undefined"/g,"undefined")},xo=(t,e)=>{let n=new Set,i=[],r=o=>{n.has(o)||(n.add(o),o.imports.forEach(s=>{let a=e[s.absolutePath];r(a)}),i.unshift(o))};return t.forEach(r),i},vo=t=>new Promise(e=>{let n=bo.default.createInterface({input:yo.default.createReadStream(t)}),i="",r=[],o=!1,s=(a,c)=>{let l=c.replace(a,""),p=l.replace(/"|'/g,""),d=vi.default.join(vi.default.dirname(t),p);r.push({absolutePath:d,relativePath:l})};n.on("line",a=>{a.startsWith("#import ")?s("#import ",a):a.startsWith("# import ")?s("# import ",a):o?i+=a+`
4
+ `:a[0]!=="#"&&a!==""&&(o=!0,i+=a+`
5
+ `)}),n.on("close",()=>{e({body:i.trim(),filePath:t,imports:r})})}),Ci=t=>{let e={},n=[],i=new Set,r=o=>e[o]?Promise.resolve(null):new Promise(s=>{vo(o).then(a=>{e[a.filePath]=a,a.imports.forEach(l=>{i.has(l.absolutePath)||(i.add(l.absolutePath),n.push(r(l.absolutePath)))});let c=n.shift();return c?c.then(s):s(null)})});return r(t).then(()=>xo(Object.values(e),e).reduce((a,c)=>c.body+`
6
+
7
+ `+a,""))},_o=(t,e,n)=>{let i={kind:"Document",definitions:[t,...e]};return Pi(i,n)},Po=t=>((n,i)=>(n.forEach(r=>{r.kind==="FragmentDefinition"&&(i[r.name.value]=r)}),i))(t.definitions,{}),Ei=(t,e)=>{let n=[],i=r=>{if(r.kind==="FragmentSpread"){let o=e[r.name.value],s=Ei(o,e);n.push(...s,r.name.value)}};return t.kind==="OperationDefinition"?t.selectionSet.selections.forEach(r=>{var o;r.kind==="Field"&&((o=r.selectionSet)==null||o.selections.forEach(i))}):t.selectionSet.selections.forEach(i),n},Si=(t,e)=>{let n=wo.default(t),i=Pi(n,e),r=Po(n),o=n.definitions.reduce((s,a)=>{if(a.kind==="OperationDefinition"&&a.name&&a.name.value){let c=a.name.value,p=Ei(a,r).map(m=>{let h=r[m];if(!h)throw new Error(`Expected to find fragment definition for ${m}`);return h}),d=_o(a,p,e);s.push(`export const ${c} = ${d};`)}return s},[`const documentNode = ${i};`]);return o.push("export default documentNode;"),o.join(`
8
+ `)},Co=(t={})=>({name:"graphql-loader",setup(e){e.onLoad({filter:t.filterRegex||/\.graphql$|\.gql$/},n=>Ci(n.path).then(i=>({contents:Si(i,t.mapDocumentNode)})))}}),Eo=Co});f();f();async function Ae(t,e,n=1){let i;try{return i=await t(),i}catch(r){if(n>0)return await e(),Ae(t,e,n-1);throw r}}import{pipeline as Yr}from"stream/promises";import si from"node:stream/promises";import*as ai from"node:zlib";import{fileURLToPath as Oe}from"node:url";var ci="9.2.3",ui="9.1.0",li="4",Qr="123.0.0",pi="1.0.2",fi="2.0.1";function di(t){return t==="0"||t==="1"?{functionRunner:"7.0.1",javy:"4.0.0",javyPlugin:"1"}:t==="2"?{functionRunner:ci,javy:ui,javyPlugin:li}:null}var vt=class{name;version;path;release;gitHubRepo;supportsWindowsOnArm;constructor(e,n,i,r,o=`v${n}`){this.name=e,this.version=n,this.release=o,this.supportsWindowsOnArm=r;let s;s=`${e}-${n}`,s=process.platform==="win32"?`${s}.exe`:s,this.path=u(E(Oe(import.meta.url)),"..","bin",s),this.gitHubRepo=i}downloadUrl(e,n){let i,r;switch(e.toLowerCase()){case"darwin":i="macos";break;case"linux":i="linux";break;case"win32":i="windows";break;default:throw Error(`Unsupported platform ${e}`)}switch(n.toLowerCase()){case"arm":case"arm64":r="arm";break;case"ia32":case"x64":r="x86_64";break;default:throw Error(`Unsupported architecture ${n}`)}let o=`${r}-${i}`,s=["arm-linux","arm-macos","x86_64-macos","x86_64-windows","x86_64-linux"];if(this.supportsWindowsOnArm&&s.push("arm-windows"),!s.includes(o))throw Error(`Unsupported platform/architecture combination ${e}/${n}`);return`https://github.com/${this.gitHubRepo}/releases/download/${this.release}/${this.name}-${o}-v${this.version}.gz`}async processResponse(e,n){return to(e,n)}},De=class{name;version;path;constructor(e){this.name=`shopify_functions_javy_v${e}`,this.version=e,this.path=u(E(Oe(import.meta.url)),"..","bin",`shopify_functions_javy_v${e}.wasm`)}downloadUrl(e,n){return`https://cdn.shopify.com/shopifycloud/shopify-functions-javy-plugin/shopify_functions_javy_v${this.version}.wasm`}async processResponse(e,n){return Yr(e,n)}},je=class{name;version;path;constructor(e,n){this.name=e,this.version=n,this.path=u(E(Oe(import.meta.url)),"..","bin",e)}downloadUrl(e,n){return`https://cdn.jsdelivr.net/npm/binaryen@${this.version}/bin/wasm-opt`}async processResponse(e,n){await si.pipeline(e,n)}},ke;function Ue(t=ui){return new vt("javy",t,"bytecodealliance/javy",Vt(t,">=7.0.0"))}function Ne(t=li){return new De(t)}function xa(t=ci){return new vt("function-runner",t,"Shopify/function-runner",Vt(t,">=9.1.1"))}function _t(){return ke||(ke=new je("wasm-opt.cjs",Qr)),ke}function hi(t){return new vt("shopify-function-trampoline",t,"Shopify/shopify-function-wasm-api",Vt(t,">=2.0.1"),`shopify_function_trampoline/v${t}`)}var zt=new Map;async function it(t){if(await x(t.path)&&!zt.has(t.path))return;let n=zt.get(t.path);if(n){await n;return}let i=Xr(t);zt.set(t.path,i);try{await i}finally{zt.delete(t.path)}}async function Xr(t){let e=t.downloadUrl(process.platform,process.arch);_(`Downloading ${t.name} ${t.version} from ${e} to ${t.path}`);let n=E(t.path);await x(n)||await M(n),await Ae(async()=>{let i=await Pn(e,void 0,"slow-request");if(i.status!==200)throw new Error(`Downloading ${t.name} failed with status code of ${i.status}`);let r=i.body;if(r===null)throw new Error(`Downloading ${t.name} failed with empty response body`);let o=`${t.path}.${_n()}.download`;try{let s=wn(o);await t.processResponse(r,s),await xn(o,509),await Zr(t,o)}finally{await dn(o)}},async()=>{},2)}async function Zr(t,e){try{await hn(e,t.path)}catch(n){if(await x(t.path)){_(`Using the ${t.name} binary that another process downloaded to ${t.path}`);return}throw n}}async function to(t,e){let n=ai.createGunzip();await si.pipeline(t,n,e)}f();f();import{brotliCompress as eo,constants as no}from"node:zlib";import{promisify as io}from"node:util";var ro=io(eo);async function oo(t){let e=await N(t),n=Buffer.byteLength(e),r=(await ro(Buffer.from(e),{params:{[no.BROTLI_PARAM_QUALITY]:11}})).byteLength;return{path:t,rawBytes:n,compressedBytes:r}}function mi(t){return t>=1024*1024?`${(t/(1024*1024)).toFixed(2)} MB`:`${(t/1024).toFixed(1)} KB`}async function gi(t){try{let{rawBytes:e,compressedBytes:n}=await oo(t);return` (${mi(e)} original, ~${mi(n)} compressed)`}catch(e){return _(`Failed to get bundle size for ${t}: ${e}`),""}}f();var ut=class extends v{constructor(e){super(`Couldn't find the build output at ${e}`,"If you passed --no-build, build the app first. Otherwise check that building the extension produces files at that path.")}};f();f();import{createInterface as so}from"readline";var ao=[".git",".hg",".bzr",".svn","_darcs","CVS",".sublime-(project|workspace)",".DS_Store",".sass-cache","Thumbs.db","desktop.ini","config.yml","node_modules",".gitkeep",".shopifyignore","*.toml"];async function Re(t){let n=u(t.directory,".shopifyignore"),i=ao.map(r=>u("*",r));if(L(n)){let r=await co(n);i.push(...r)}return k("*/*",{absolute:!0,cwd:t.directory,ignore:i})}function co(t){return new Promise((e,n)=>{let i=[],r=so({input:yn(t),crlfDelay:1/0});r.on("line",o=>{let s=o.trim();s.length>0&&!s.startsWith("#")&&i.push(s)}),r.on("close",()=>{e(i)}),r.on("error",o=>{n(o)})})}import{context as So,formatMessagesSync as Ii}from"esbuild";var Ai=kt($i(),1);async function Te(t,e=process.env){let n=Io(t,e),i=await So(n);try{let r=await i.rebuild();$o(r,t),await Fo(r,t.outputPath)}catch(r){throw be()==="json"&&r instanceof Error&&t.stderr.write(`${r.message}
9
+ `),r}finally{await i.dispose()}}async function Fo(t,e){if(!t?.metafile)return;let{dir:n,name:i}=cn(e),r=u(n,`${i}.metafile.json`);try{await T(r,JSON.stringify(t.metafile))}catch(o){Hn(`Failed to write metafile to ${r}: ${o}`)}}function $o(t,e){let n=t?.warnings??[],i=t?.errors??[];n.length>0&&Ii(n,{kind:"warning"}).forEach(o=>{e.stdout.write(o)}),i.length>0&&Ii(i,{kind:"error"}).forEach(o=>{e.stderr.write(o)})}function Io(t,e=process.env){let n=Wt(e,(s,a)=>Ht.test(a)&&s),i={...t.env,...n},r=Object.keys(i||{}).reduce((s,a)=>({...s,[`process.env.${a}`]:JSON.stringify(i[a])}),{"process.env.NODE_ENV":JSON.stringify(t.environment)}),o={outfile:t.outputPath,stdin:t.stdin,bundle:!0,define:r,jsx:"automatic",logLevel:be()==="json"?"silent":t.logLevel??"error",loader:{".esnext":"ts",".js":"jsx"},legalComments:"none",minify:t.minify,plugins:Ao(t.stdin.resolveDir,e),target:"es6",resolveExtensions:[".tsx",".ts",".js",".json",".esnext",".mjs",".ejs"]};if(t.sourceMaps&&(o.sourcemap=!0,o.sourceRoot=`${t.stdin.resolveDir}/src`),t.environment==="production"&&(o.metafile=!0),t.environment==="development"){let s=i[Se.disableMinificationOnDev];o.minify=!mt(s),o.logLevel="silent"}return o}function Ao(t,e=process.env){let n=[Ai.default.default()],i=mt(e[Se.skipEsbuildReactDedeuplication]);if(t&&!i){let r;try{r=ht.resolve("react",{paths:[t]})}catch{_(`Unable to load React in ${t}, skipping React de-duplication`)}r&&(_(`Deduplicating React dependency for ${t}, using ${r}`),n.push(ko(r)))}return n}function ko(t){return{name:"shopify:deduplicate-react",setup({onResolve:e}){e({filter:/^react$/},n=>({path:t}))}}}f();import{build as ji}from"esbuild";var Do="2",ki={defaultScalarType:"unknown",scalars:{Date:"string",DateTime:"string",DateTimeWithoutTimezone:"string",Decimal:"string",Handle:"string",ID:"string",JSON:"unknown",TimeWithoutTimezone:"string",URL:"string",Void:"null"}},Pt=class extends v{constructor(e){super(e,U`Make sure you have a compatible version of the ${D.yellow("@shopify/shopify_function")} library installed.`,[U`Add ${D.green(`"@shopify/shopify_function": "~${Do}.0.0"`)} to the dependencies section of the package.json file in your function's directory, if not already present.`.value,"Run your package manager's install command to update dependencies."])}};async function Oi(t,e){let n=To(t),i=n.length===0?Ro:new Me(n),r=await Ni(t);return e.useTasks?Oo(t,e,i,r):jo(t,e,i,r)}async function jo(t,e,n,i){e.signal?.aborted||(e.stdout.write(`Building function ${t.localIdentifier}...`),e.stdout.write(`Building GraphQL types...
10
+ `),await Ct(t,e)),e.signal?.aborted||(e.stdout.write(`Bundling JS function...
11
+ `),await n.bundle(t,e)),e.signal?.aborted||(e.stdout.write(`Running javy...
12
+ `),await n.compile(t,e,i)),e.signal?.aborted||e.stdout.write(`Done!
13
+ `)}async function Oo(t,e,n,i){await Tn([{title:"Building GraphQL types",task:async()=>{await Ct(t,e)}},{title:"Bundling JS function",task:async()=>{await n.bundle(t,e)}},{title:"Running javy",task:async()=>{await n.compile(t,e,i)}}])}async function Ct(t,e){if(t.typegenCommand){let o=t.typegenCommand.split(" ");return xe("cmd_all_timing_network_ms")(async()=>X(o[0],o.slice(1),{cwd:t.directory,stdout:e.stdout,stderr:e.stderr,signal:e.signal}))}if(!t.isJavaScript)throw new v("No typegen_command specified. Set build.typegen_command in your function extension TOML to generate GraphQL types for non-JavaScript functions.");let n=u(t.directory,"package.json");if(!await x(n))return Le(t,e,"package.json");let i=await Jt(n);if(!i.codegen)return Le(t,e,"package.json");let r={...i.codegen,config:{...ki,...i.codegen.config??{},scalars:{...ki.scalars,...i.codegen.config?.scalars??{}}}};return we(async o=>{let s=u(o,"codegen.json");return await T(s,JSON.stringify(r)),Le(t,e,s)})}async function Le(t,e,n){let i=await kn(t.directory,"graphql-code-generator","--config",n);return xe("cmd_all_timing_network_ms")(async()=>X(i.command,i.args,{cwd:t.directory,stderr:e.stderr,signal:e.signal}))}async function Ui(t){let e=await Y("node_modules/@shopify/shopify_function/index.ts",{type:"file",cwd:t.directory}),n=await Y("node_modules/@shopify/shopify_function/run.ts",{type:"file",cwd:t.directory});if(!e||!n)throw new Pt("Could not find the Shopify Functions JavaScript library.");if(!t.entrySourceFilePath)throw new v("Could not find your function entry point. It must be in src/index.js or src/index.ts");return e}async function Ni(t){let e=await Y("node_modules/@shopify/shopify_function/package.json",{type:"file",cwd:t.directory});if(!e)throw new Pt("Could not find the Shopify Functions JavaScript library.");let i=JSON.parse(await N(e)).version.split(".")[0],r=di(i);if(r===null)throw new Pt("The installed version of the Shopify Functions JavaScript library is not compatible with this version of Shopify CLI.");return r}async function Uo(t,e,n=process.env){let i=await Ui(t),r={...Ri(t.directory,t.entrySourceFilePath,e.app.dotenv?.variables??{},n),entryPoints:[i]};return ji(r)}function Ri(t,e,n,i=process.env){let r=Wt(i,(c,l)=>Ht.test(l)&&c),o={...n,...r},s=Object.keys(o||{}).reduce((c,l)=>({...c,[`process.env.${l}`]:JSON.stringify(o[l])}),{});return{outfile:u(t,"dist/function.js"),alias:{"user-function":e},define:s,logLevel:"silent",bundle:!0,legalComments:"none",target:"es2022",format:"esm"}}async function Ti(t){let e=_t();await it(e);let n=E(_t().path),i="node",r=[_t().name,t,"-Oz","--enable-bulk-memory","--enable-multimemory","--enable-nontrapping-float-to-int","--strip-debug","-o",t];_(`Wasm binary: ${_t().name}`),_("Optimizing this wasm binary using wasm-opt."),await X(i,r,{cwd:n})}async function Li(t){let e,n=await No(t);if(n.includes("shopify_function_v1")?e=pi:n.includes("shopify_function_v2")&&(e=fi),!e)return;let i=hi(e);await it(i);let r=i.path,o=["-i",t,"-o",t];_(`Applying trampoline to the wasm binary with command: ${r} ${o.join(" ")}`),await X(r,o)}async function No(t){let e=new Uint8Array(Ot(t));if(!WebAssembly.validate(e))return[];let i=new WebAssembly.Module(e),r=WebAssembly.Module.imports(i);return B(r.map(o=>o.module))}async function Mi(t,e,n,i=[]){let r=Ue(n.javy),o=Ne(n.javyPlugin);await Promise.all([it(r),it(o)]);let s=["build","-C","dynamic","-C",`plugin=${o.path}`,...i,"-o",t.outputPath,"dist/function.js"];return X(r.path,s,{cwd:t.directory,stdout:e.stdout,stderr:e.stderr,signal:e.signal})}async function hc(t){let n=t.allExtensions.filter(a=>a.features.includes("function")&&a.isJavaScript).map(a=>Ni(a)),i=await Promise.all(n),r=new Set,o=new Set;i.forEach(a=>{r.add(a.javy),o.add(a.javyPlugin)});let s=[];r.forEach(a=>{s.push(it(Ue(a)))}),o.forEach(a=>{s.push(it(Ne(a)))}),await Promise.all(s)}var Ro={async bundle(t,e){return Uo(t,e)},async compile(t,e,n){return Mi(t,e,n)}},Di="shopify-function",Me=class{exports;constructor(e){this.exports=e}async bundle(e,n,i=process.env){await Ui(e);let r=this.entrypointContents;_("Generating dist/function.js using generated module:"),_(r);let o={...Ri(e.directory,e.entrySourceFilePath,n.app.dotenv?.variables??{},i),stdin:{contents:r,loader:"ts",resolveDir:e.directory}};return ji(o)}async compile(e,n,i){let r=this.wit;return _("Generating world to use with Javy:"),_(r),we(async o=>{let s=u(o,"javy-world.wit");return await T(s,r),Mi(e,n,i,["-C",`wit=${s}`,"-C",`wit-world=${Di}`])})}get wit(){let e=this.exports.map(n=>`export %${ye(n)}: func();`);return`package function:impl;
14
+
15
+ world ${Di} {
16
+ ${e.join(`
17
+ `)}
18
+ }`}get entrypointContents(){let e=`
19
+ import __runFunction from "@shopify/shopify_function/run"`,n=this.exports.map(i=>{let r=ge(i),o=ge(`run-${i}`);return`
20
+ import { ${r} as ${o} } from "user-function"
21
+ export function ${r}() { return __runFunction(${o}) }`});return`${e}
22
+ ${n.join(`
23
+ `)}`}};function To(t){let e=t.configuration.targeting??[],n=e.filter(o=>!o.export),i=e.filter(o=>!!o.export);if(e.length>1&&n.length>0)throw new Error(`Can't infer export name for targets:
24
+ ${n.map(({target:o})=>`- '${o}'`).join(`
25
+ `)}
26
+ All targets must have an export when multiple targets are present.`);let r=i.filter(o=>!o.export.match(/^[a-z0-9-]+$/));if(r.length>0){let o=[],s=r.map(a=>`'${a.export}'`);throw o.push(`Invalid export names: ${s.join(", ")}.
27
+
28
+ The TOML's exports must be kebab-case (lowercase, hyphen or numbers) to comply with WebAssembly's Component Model.
29
+
30
+ JavaScript exports with camelCase names are automatically mapped to kebab-case Wasm exports.
31
+ `),o.push("Suggested TOML changes:"),r.forEach(a=>{let c=a.export;o.push(`- Change export for '${a.target}' to '${ye(c)}'.`)}),new Error(o.join(`
32
+ `))}return i.map(o=>o.export)}f();var Qt="# api_version: ";function vc(t,e){return`${Qt}${e}
33
+
34
+ ${t}`}async function Lo(t){if(!await x(t)){_(`Could not determine api_version: schema file not found at ${t}.`);return}let n=(await N(t)).split(`
35
+ `,1)[0];if(n.startsWith(Qt))return n.slice(Qt.length).trim();_(`Could not determine api_version from ${t}: missing '${Qt}' marker on the first line.`)}async function Wi({directory:t,localIdentifier:e,apiVersion:n}){let i=u(t,"schema.graphql"),r=await Lo(i);if(r!==void 0&&r!==n)throw new v(U`The ${D.cyan("schema.graphql")} file for ${D.cyan(e)} was generated for api_version ${D.yellow(r)} but your function is now on api_version ${D.yellow(n)}.`,U`Run ${D.genericShellCommand("shopify app function schema")} to refresh it.`)}var Vi=kt(Gr(),1);import{resolve as Bi}from"node:path";async function Ji(t,e){e.stdout.write(`Bundling UI extension ${t.localIdentifier}...`);let n=e.app.dotenv?.variables??{};e.appURL&&(n.APP_URL=e.appURL);let i=e.buildDirectory??"",r=u(t.directory,i,t.outputRelativePath),{main:o,assets:s}=t.getBundleExtensionStdinContent(),a=performance.now();if(!e.skipBuild)try{await Te({minify:!0,outputPath:r,stdin:{contents:o,resolveDir:t.directory,loader:"tsx"},environment:e.environment,env:n,stderr:e.stderr,stdout:e.stdout,sourceMaps:t.isSourceMapGeneratingExtension}),s&&await Promise.all(s.map(async p=>{await Te({minify:!0,outputPath:u(E(r),p.outputFileName),stdin:{contents:p.content,resolveDir:t.directory,loader:"tsx"},environment:e.environment,env:n,stderr:e.stderr,stdout:e.stdout})}))}catch(p){let d=p.message??"Unknown error occurred",m=new v(`Failed to bundle extension ${t.localIdentifier}. Please check the extension source code for errors.`,d);throw m.errors=p.errors,m}if(e.skipBuild&&!await x(r))throw new ut(r);await t.buildValidation({outputPath:r});let c=Math.round(performance.now()-a),l=await gi(r);return e.stdout.write(`${t.localIdentifier} successfully built in ${c}ms${l}`),r}async function Hi(t,e){let n=u(t.directory,".build-lock"),i;try{i=await Vi.default.lock(t.directory,{retries:20,lockfilePath:n,onCompromised:r=>_(`The function build lock was compromised: ${r.message}`)})}catch(r){throw _(`Failed to acquire function build lock: ${r.message}`),new v("Failed to build function.","This is likely due to another in-progress build.",["Ensure there are no other function builds in-progress.","Delete the `.build-lock` file in your function directory."])}try{let r=t.configuration,o=t.outputPath,s=r.build?.path??t.outputRelativePath;if(t.outputPath=u(t.directory,s),await Wi({directory:t.directory,localIdentifier:t.localIdentifier,apiVersion:r.api_version}),!e.skipBuild){t.isJavaScript?await Wo(t,e):await Bo(t,e);let c=t.configuration.build?.wasm_opt;L(t.outputPath)&&c&&await Ti(t.outputPath),L(t.outputPath)&&await Li(t.outputPath)}let a=u(t.directory,t.outputRelativePath);return L(t.outputPath)&&o!==t.outputPath&&o!==a&&E(o)!==E(t.outputPath)&&await Mo(t.outputPath,o),{status:"success",function:{handle:r.handle??null,name:t.name,directory:Bi(t.directory),wasmPath:L(t.outputPath)?Bi(t.outputPath):null}}}catch(r){if(r instanceof v)throw r;let o=r.message??"Unknown error occurred",s=new v("Failed to build function.",o);throw s.errors=r.errors,s}finally{await i().catch(r=>_(`Failed to release the function build lock: ${r.message}`))}}async function Mo(t,e){_(`Converting WASM from ${t} to base64 in ${e}`);let n=await N(t,{encoding:"base64"});await Ut(e),await T(e,n)}async function Wo(t,e){return t.buildCommand?(t.typegenCommand&&await Ct(t,e),qi(t.buildCommand,t,e)):Oi(t,e)}async function Bo(t,e){if(!t.buildCommand)throw e.stderr.write(`The function extension ${t.localIdentifier} doesn't have a build command or it's empty`),e.stderr.write(`
36
+ Edit the shopify.function.extension.toml configuration file and set how to build the extension.
37
+
38
+ [build]
39
+ command = "{COMMAND}"
40
+
41
+ Note that the command must output a dist/index.wasm file.
42
+ `),new Ln;return t.typegenCommand&&await Ct(t,e),qi(t.buildCommand,t,e)}async function qi(t,e,n){let i=t.split(" ");n.stdout.write(`Building function ${e.localIdentifier}...`),await X(i[0],i.slice(1),{stdout:n.stdout,stderr:n.stderr,cwd:e.directory,signal:n.signal})}f();var zi;function We(){return zi??=new Sn({projectName:"shopify-cli-app"}),zi}function Xt(t,e=We()){let n=Z(t);return _(U`Reading cached app information for directory ${D.path(n)}...`),e.get(n)}function Zt(t,e=We()){t.directory=Z(t.directory),_(U`Storing app information for directory ${D.path(t.directory)}:${D.json(t)}`);let n=e.get(t.directory);n?e.set(t.directory,{...n,...t}):e.set(t.directory,t)}function Gi(t,e=We()){let n=Z(t),i=e.get(n);i&&e.set(n,{...i,configFile:void 0})}f();f();var Ki=/^shopify\.app(\.[-\w]+)?\.toml$/,Et="shopify.app*.toml";function rt(t){return t?G(t)?t:`shopify.app.${z(t)}.toml`:J.app}function St(t){return $(t).match(Ki)?.[1]?.slice(1)}function G(t){return!!Ki.test(t)}var Vo="*.extension.toml",Jo="shopify.web.toml",Yi="extensions/*",Qi="**/node_modules/**",Ho=".env*",Ft=class t{static async load(e){let n=await qo(e),i=[],r=await zo(n,i);if(r.length===0)throw new v(`Could not find a Shopify app TOML file in ${n}`);let o=new Set;for(let b of r){let w=b.content.extension_directories;if(Array.isArray(w))for(let R of w)o.add(R);else o.add(Yi)}let s=await Go(n,[...o],i),a=new Set;for(let b of r){let w=b.content.web_directories;if(Array.isArray(w))for(let R of w)a.add(R)}let c=await Ko(n,a.size>0?[...a]:void 0,i),l=u(n,"package.json"),p=await x(l),d=p?await Bt(n):"unknown",m=p?await Dn(l):{},h=p?await jn(n):!1,y=await Yo(n),P=await Qo(n);return new t({directory:n,packageManager:d,nodeDependencies:m,usesWorkspaces:h,appConfigFiles:r,extensionConfigFiles:s,webConfigFiles:c,dotenvFiles:y,hiddenConfigRaw:P,errors:i})}directory;packageManager;nodeDependencies;usesWorkspaces;appConfigFiles;extensionConfigFiles;webConfigFiles;dotenvFiles;hiddenConfigRaw;errors;constructor(e){this.directory=e.directory,this.packageManager=e.packageManager,this.nodeDependencies=e.nodeDependencies,this.usesWorkspaces=e.usesWorkspaces,this.appConfigFiles=e.appConfigFiles,this.extensionConfigFiles=e.extensionConfigFiles,this.webConfigFiles=e.webConfigFiles,this.dotenvFiles=e.dotenvFiles,this.hiddenConfigRaw=e.hiddenConfigRaw,this.errors=e.errors}appConfigByName(e){return this.appConfigFiles.find(n=>$(n.path)===e)}appConfigByClientId(e){return this.appConfigFiles.find(n=>n.content.client_id===e)}get defaultAppConfig(){return this.appConfigByName(J.app)}},Be=class extends v{};async function qo(t){let e=await Y(async n=>{if((await k(u(n,Et))).some(r=>G($(r))))return n},{cwd:t,type:"directory"});if(!e)throw new Be(`Could not find a Shopify app configuration file. Looked in ${t} and parent directories.`);return e}async function zo(t,e){let n=u(t,Et),r=(await k(n)).filter(o=>G($(o)));return Ve(r,e)}async function Go(t,e,n){let r=(e.length>0?e:[Yi]).map(s=>u(t,s,Vo));r.push(`!${u(t,Qi)}`);let o=await k(r);return Ve(o,n)}async function Ko(t,e,n){let r=(e??["**"]).map(s=>u(t,s,Jo));r.push(`!${u(t,Qi)}`);let o=await k(r);return Ve(o,n)}async function Ve(t,e){let n=[];return await Promise.all(t.map(async i=>{try{n.push(await H.read(i))}catch(r){let o=r instanceof xt?r:new xt(i,`Failed to read ${i}`),s=new H(i,{});s.errors.push(o),n.push(s),e.push(o)}})),n}async function Yo(t){let e=u(t,Ho),i=(await k(e,{dot:!0})).filter(s=>{let a=$(s);return a===".env"||/^\.env\.[\w-]+$/.test(a)}),r=await Promise.all(i.map(async s=>{try{let a=await Zn(s);return[$(s),a]}catch{return}})),o=new Map;for(let s of r)s&&o.set(s[0],s[1]);return o}async function Qo(t){let e=u(t,J.hiddenFolder,J.hiddenConfig);try{if(await x(e)){let n=await N(e);return JSON.parse(n)}}catch{}return{}}f();f();f();f();f();function Xi(t,e){let n=t;if(!n.events?.subscription)return t;let i;e&&"application_url"in e&&(i=e?.application_url);let{handle:r,...o}=n,s=n.events.subscription,a=!Array.isArray(s),c=Zo(s).map(l=>{let{handle:p,...d}=l,m=a?d:l;return typeof m.uri=="string"?{...m,uri:ct(m.uri,i)}:m});return{...o,events:{...n.events,subscription:Array.isArray(s)?c:c[0]}}}function Zi(t,e){let{api_version:n,subscription:i}=Q(t,"events")??{},r=a=>{let{identifier:c,api_version:l,...p}=a;return l!==void 0&&l!==n?{...p,api_version:l}:p},o;if(Array.isArray(i))o=i.map(r);else if(i){let a=e?.handle??i.handle??Xo(i);o=[r({...i,handle:a})]}let s={};return n!==void 0&&(s.api_version=n),o!==void 0&&(s.subscription=o),{events:s}}function Xo(t){return z([t.topic,...t.actions].join("-")).slice(0,nt).replace(/-$/,"")}function Zo(t){return Array.isArray(t)?t:[t]}var $t="events",ts={forward:Xi,reverse:Zi},tr=g.string().trim().nonempty("Handle can't be empty").max(nt,`Handle can't exceed ${nt} characters`).regex(/^[a-zA-Z0-9_-]*$/,"Handle can only contain alphanumeric characters, underscores and hyphens").refine(t=>t!==$t,'The handle "events" is reserved for the legacy events module. Choose a different subscription handle.'),es=g.object({subscription:g.unknown().optional()}).passthrough(),ns=ei.extend({handle:tr.optional(),events:es.optional()}).superRefine((t,e)=>{let n=t.events?.subscription;if(n===void 0||Array.isArray(n))return;let i=tr.safeParse(t.handle);i.success||i.error.issues.forEach(r=>e.addIssue({...r,path:["handle"]}))}),is=g.preprocess(t=>{if(typeof t!="object"||t===null||Array.isArray(t)||!("handle"in t))return t;let e=Q(t,"events.subscription");if(e!==void 0&&!Array.isArray(e))return t;let{handle:n,...i}=t;return i},ns),rs=ri({identifier:$t,schema:is,transformConfig:ts,expandConfig:t=>{let e=t.events?.subscription;return Array.isArray(e)?e.map(n=>{let{handle:i,...r}=n;return{handle:i,events:{...t.events,subscription:r}}}):[t]},getIdentity:t=>{if(t.handle)return{handle:t.handle,uid:t.handle}},getTarget:t=>{let e=t.events?.subscription?.topic;return typeof e=="string"?e:void 0}}),hu=rs;f();function os(t,e){return e}async function te(t,e,n){let i={};try{let s=await N(t);i=JSON.parse(s)}catch{}let r={[e]:n},o=Mt(i,r,os);await T(t,JSON.stringify(o,null,2))}var ss=g.array(g.string()).optional().transform(as).transform(cs);function as(t){return t?.map(e=>e.replace(/[\/\\]+$/,""))}function cs(t){return t?.map(e=>e.replace(/([^\*])\*$/,"$1**"))}var ne=g.object({client_id:g.string(),build:g.object({automatically_update_urls_on_dev:g.boolean().optional(),dev_store_url:g.string().optional(),include_config_on_deploy:g.boolean().optional()}).optional(),extension_directories:ss,web_directories:g.array(g.string()).optional()}).passthrough();function rr(t,e=!0){let n=t.reduce((i,r)=>r.contributeToAppConfigurationSchema(i),ne);return e?n.passthrough():t.length>0?n.strict():n}function us(t){return t.access_scopes?.scopes??""}function ie(t){let e=us(t);return e.length?e.split(",").map(n=>n.trim()):[]}function ls(t){return u(t,J.hiddenFolder,J.hiddenConfig)}var O;(function(t){t.Frontend="frontend",t.Backend="backend",t.Background="background"})(O||(O={}));var er=g.preprocess(Fe,g.string()),nr=g.object({auth_callback_path:g.union([er,er.array()]).optional(),webhooks_path:g.preprocess(Fe,g.string()).optional(),port:g.number().max(65536).min(0).optional(),commands:g.object({build:g.string().optional(),predev:g.string().optional(),dev:g.string()}),name:g.string().optional(),hmr_server:g.object({http_paths:g.string().array()}).optional()}),ir=g.enum([O.Frontend,O.Backend,O.Background]).default(O.Frontend),or=g.union([nr.extend({roles:g.array(ir)}),nr.extend({type:ir})]),ee=class{name;idEnvironmentVariableName="SHOPIFY_API_KEY";directory;configPath;configuration;clientIdOverride;webs;dotenv;errors;specifications;configSchema;remoteFlags;realExtensions;devApplicationURLs;_hiddenConfig;constructor({name:e,directory:n,configPath:i,configuration:r,clientIdOverride:o,webs:s,modules:a,dotenv:c,errors:l,specifications:p,configSchema:d,remoteFlags:m,hiddenConfig:h,devApplicationURLs:y}){this.name=e,this.directory=n,this.configPath=i,this.configuration=r,this.clientIdOverride=o,this.webs=s,this.dotenv=c,this.realExtensions=a,this.errors=l??new It,this.specifications=p,this.configSchema=d??ne,this.remoteFlags=m??[],this._hiddenConfig=h,y&&this.setDevApplicationURLs(y)}get allExtensions(){return this.includeConfigOnDeploy===!1?this.nonConfigExtensions:this.realExtensions}get nonConfigExtensions(){return this.realExtensions.filter(e=>!e.isAppConfigExtension)}setDevApplicationURLs(e){this.patchAppConfiguration(e),this.realExtensions.forEach(n=>n.patchWithAppDevURLs(e))}async manifest(e){let n=await Promise.all(this.realExtensions.map(async i=>{let r=await i.deployConfig({apiKey:String(this.configuration.client_id??""),appConfiguration:this.configuration});return{type:i.externalType,handle:i.handle,uid:i.uid,uuid:e?.[i.localIdentifier],assets:i.uid,target:i.contextValue,config:r??{}}}));return{name:this.name,handle:"",modules:st(n)}}get hiddenConfig(){return this._hiddenConfig}getLogsDir(){return u(this.directory,".shopify","logs")}async updateHiddenConfig(e){if(!this.configuration.client_id)return;this._hiddenConfig=Mt(this.hiddenConfig,e);let n=ls(this.directory);await te(n,String(this.configuration.client_id),this.hiddenConfig)}async preDeployValidation(){this.validateWebhookLegacyFlowCompatibility(),this.validateEventsLegacyFlowCompatibility();let e=this.allExtensions.filter(i=>i.isFunctionExtension&&i.configuration.ui?.handle);if(e.length>0){let i=ps(e,this.allExtensions);if(i)throw new v("Invalid function configuration",i.join(`
43
+ `))}let n=this.allExtensions.filter(i=>i.isEditorExtensionCollection);if(n.length>0){let i=fs(n,this.allExtensions);if(i)throw new v("Invalid editor extension collection configuration",i.join(`
44
+
45
+ `))}await Promise.all(this.allExtensions.map(i=>i.preDeployValidation()))}extensionsForType(e){return this.allExtensions.filter(n=>n.type===e.identifier||n.type===e.externalIdentifier)}updateExtensionUUIDS(e){this.allExtensions.forEach(n=>{n.devUUID=e[n.localIdentifier]??n.devUUID})}appIsLaunchable(){let e=this.webs.find(i=>q(i,O.Frontend)),n=this.webs.find(i=>q(i,O.Backend));return!!(e??n)}get appIsEmbedded(){return this.configuration.embedded}creationDefaultOptions(){return{isLaunchable:this.appIsLaunchable(),scopesArray:ie(this.configuration),name:this.name,isEmbedded:this.appIsEmbedded,directory:this.directory}}removeExtension(e){this.realExtensions=this.realExtensions.filter(n=>n.uid!==e)}async generateExtensionTypes(){let e=new Map;await Promise.all(this.allExtensions.map(n=>n.contributeToSharedTypeFile(e))),e.forEach((n,i)=>{let r=L(i);if(n.size===0){r&&mn(i);return}let o=r?Ot(i).toString():"",s=[`import '@shopify/ui-extensions';
46
+ `,...Array.from(n)].join(`
47
+ `);o!==s&&fn(i,s)})}get includeConfigOnDeploy(){return this.configuration.build?.include_config_on_deploy}patchAppConfiguration(e){this.devApplicationURLs=e,this.configuration.application_url=e.applicationUrl,e.appProxy&&(this.configuration.app_proxy={url:e.appProxy.proxyUrl,subpath:e.appProxy.proxySubPath,prefix:e.appProxy.proxySubPathPrefix}),this.configuration.auth?.redirect_urls&&(this.configuration.auth.redirect_urls=e.redirectUrlWhitelist)}validateEventsLegacyFlowCompatibility(){if(this.configuration.access_scopes?.use_legacy_install_flow!==!0)return;if(this.extensionsForType({identifier:$t,externalIdentifier:$t}).some(n=>{let i=Q(n.configuration,"events.subscription");return Array.isArray(i)?i.length>0:typeof i=="object"&&i!==null}))throw new v("Events subscriptions are not supported when use_legacy_install_flow is enabled.",`Migrate to Shopify-managed installation before using Events subscriptions.
48
+ Scopes in your TOML configuration are not managed by Shopify while 'use_legacy_install_flow = true'.
49
+
50
+ Learn more: https://shopify.dev/docs/apps/build/authentication-authorization/app-installation`)}validateWebhookLegacyFlowCompatibility(){let e=this.configuration.webhooks?.subscriptions?.some(i=>i.topics&&i.topics.length>0)??!1,n=this.configuration.access_scopes?.use_legacy_install_flow===!0;if(e&&n)throw new v("App-specific webhook subscriptions are not supported when use_legacy_install_flow is enabled.",`To use app-specific webhooks, you need to:
51
+ 1. Remove 'use_legacy_install_flow = true' from your configuration
52
+ 2. Run 'shopify app deploy' to sync your scopes with the Developer Dashboard
53
+
54
+ Alternatively, continue using shop-specific webhooks with the legacy install flow.
55
+
56
+ Learn more: https://shopify.dev/docs/apps/build/authentication-authorization/app-installation`)}};function ps(t,e){let n=[];return t.forEach(i=>{let r=i.configuration.ui.handle,o=sr(e,r);o?o.type!=="ui_extension"&&n.push(`[${i.name}] - Local app must contain one extension of type 'ui_extension' and handle '${r}'`):n.push(`[${i.name}] - Local app must contain a ui_extension with handle '${r}'`)}),n.length>0?n:void 0}function fs(t,e){let n=[],i=["ui_extension"];return t.forEach(r=>{r.configuration.inCollection.forEach(o=>{let s=sr(e,o.handle);s?i.includes(s.specification.identifier)?s.specification.identifier==="ui_extension"&&s.configuration.extension_points.forEach(c=>{c.target.startsWith("admin.")&&n.push(`[${r.handle}] editor extension collection: Remove extension '${s.configuration.handle}' with target '${c.target}' from this collection. This extension target is not supported in collections.`)}):n.push(`[${r.handle}] editor extension collection: Remove extension of type '${s.specification.identifier}' from this collection. This extension type is not supported in collections.`):n.push(`[${r.handle}] editor extension collection: Add extension with handle '${o.handle}' to local app. Local app must include extension with handle '${o.handle}'.`)})}),n.length>0?n:void 0}function sr(t,e){return t.find(n=>n.handle===e)}async function ju(t){let e=t.dependency;if(e)return ds(e,t.directory)}async function ds(t,e){let n=t.replace("-react","").split("/"),i=u("node_modules",n[0],n[1],"package.json"),r=await Y(i,{cwd:e,type:"file",allowSymlinks:!0});if(!r)return"not_found";r=await yt(r);let o=await Jt(r);return o.version?{name:t,version:o.version}:"not_found"}f();function hs(t){if(!t?.length)return null;let e=null,n=-1;for(let i of t){if(!i.issues?.length)continue;let r=0,o=0,s=0;for(let c of i.issues)c.message?.includes("Required")||c.message?.includes("required")?r++:c.message?.includes("Expected")&&c.message?.includes("received")?o++:s++;let a;r>0?a=1e3-r*10-o-s:o>0?a=100-o*5-s:a=50-s,a>n&&(n=a,e=i)}return e}function ar(t){let e=[];for(let n of t)if(n.code==="invalid_union"&&n.unionErrors){let i=hs(n.unionErrors);if(i?.issues?.length)for(let r of i.issues)e.push({path:r.path,message:r.message,code:n.code});else e.push({path:n.path,message:n.message??"Configuration doesn't match any expected format",code:n.code})}else e.push({path:n.path,message:n.message??"Unknown error",code:n.code});return e}f();f();f();f();f();f();f();async function lt(t,e,n){let[i,r]=await Promise.all([yt(t),yt(e)]),o=F(r,i);if(o.split(/[/\\]/,1)[0]===".."||Dt(o))throw new v(`Asset path '${n}' resolves outside the app directory.`,`Asset sources must be inside the app folder. Resolved to: ${i}`)}async function ur(t){let{key:e,baseDir:n,outputDir:i,context:r,appDirectory:o,destination:s,usedBasenames:a=new Set,preserveFilePaths:c=!1}=t,{stdout:l}=r.options,p=re(r.extension.configuration,e),d;typeof p=="string"?d=[p]:Array.isArray(p)?d=p.filter(b=>typeof b=="string"):d=[];for(let b of d)if(b.trim()==="")throw new v(`'${e}' can't be empty.`);if(d.length===0)return _(`No value for configKey '${e}', skipping
57
+ `,l),{filesCopied:0,pathMap:new Map};let m=s?u(i,s):i,h=B(d),y=new Map,P=0;for(let b of h){let w=u(n,b);if(!await x(w))throw new v(U`Couldn't find ${D.path(w)}\n Please check the path '${b}' in your configuration`.value);await lt(w,o,b);let C=await K(w),A=m;if(C){let S=await k(["**/*"],{cwd:w,absolute:!1}),I=S.map(j=>F(i,u(A,j)));if(c)for(let j of S)cr($(j),b,a);await Rt(w,A),l.write(`Included '${b}'
58
+ `);for(let j of S)a.add($(j));y.set(b,I),P+=S.length}else{await M(A);let S=$(w),I;c?(cr(S,b,a),I=S):I=ms(S,a),a.add(I);let j=F(i,u(A,I)),W=u(A,I);await V(w,W),l.write(`Included '${b}'
59
+ `),y.set(b,j),P+=1}}return{filesCopied:P,pathMap:y}}function cr(t,e,n){if(n.has(t))throw new v(`File collision: '${t}' from '${e}' would overwrite a file copied from a different source. Rename or relocate the conflicting file.`)}function ms(t,e){if(!e.has(t))return t;let n=jt(t),i=n?t.slice(0,-n.length):t,r=1e3,o=1;for(;e.has(`${i}-${o}${n}`);)if(o++,o>r)throw new Error(`Unable to find unique basename for '${t}' after ${r} attempts`);return`${i}-${o}${n}`}function Je(t){return t.split(".").map(e=>{let n=e.endsWith("[]");return{name:n?e.slice(0,-2):e,flatten:n}})}function re(t,e){let n=t;for(let{name:i,flatten:r}of Je(e)){if(n==null)return;if(Array.isArray(n)){let o=n.map(s=>s!==null&&typeof s=="object"?s[i]:void 0).filter(s=>s!==void 0);n=o.length>0?o:void 0}else if(typeof n=="object")n=n[i];else return;if(r){if(!Array.isArray(n))return;n=n.flat(1)}}return n}function ze(t){return jt(t)?E(t):t}async function lr(t,e,n,i){let{extension:r,options:o}=e,s=[],a=[];for(let p of t)typeof p.anchor=="string"&&typeof p.groupBy=="string"?s.push(p):a.push(p);if(s.length===0&&a.length===0&&i.length===0)return;let c={};for(let p of a){let d=ws(p.key),m=re(r.configuration,p.key);m!=null&&(c[d]=oe(m,n))}let l=new Map;for(let p of s){let d=`${p.anchor}||${p.groupBy}`,m=l.get(d);m?m.push(p):l.set(d,[p])}for(let p of l.values()){let{anchor:d,groupBy:m}=p[0],h=re(r.configuration,d);if(Array.isArray(h))for(let y of h){if(y===null||typeof y!="object"||Array.isArray(y))continue;let P=y,b=P[m];if(typeof b!="string")continue;let w=p.map(A=>{let S=gs(A.key,d),I=He(P,S);return oe(I,n)});w.some(qe)&&o.stdout.write(`Warning: manifest entry '${b}' contains unresolved paths \u2014 source files may be missing
60
+ `);let C=c[b]??{};c[b]=ys([C,...w])}}if(i.length>0&&(c.files=i),Object.keys(c).length===0){o.stdout.write(`Warning: no manifest entries produced \u2014 skipping manifest.json
61
+ `);return}await Ge(e,c)}async function Ge(t,e){let n=ze(t.extension.outputPath),i=u(n,"manifest.json");await x(n)||await M(n);let r={};if(await x(i))try{let o=await N(i);r=JSON.parse(o)}catch{_(`Warning: could not parse existing manifest.json, starting fresh
62
+ `,t.options.stdout)}for(let[o,s]of Object.entries(e)){let a=r[o];a&&typeof a=="object"&&!Array.isArray(a)&&typeof s=="object"&&!Array.isArray(s)?r[o]={...a,...s}:r[o]=s}await T(i,JSON.stringify(r,null,2)),_(`Updated manifest.json in ${n}
63
+ `,t.options.stdout)}function gs(t,e){if(e===t)return"";let n=`${e}.`;return t.startsWith(n)?t.slice(n.length):t}function He(t,e){if(e==="")return t;let n=Je(e),[i,...r]=n;if(!i)return t;let o=r.map(a=>`${a.name}${a.flatten?"[]":""}`).join("."),s=t[i.name];if(i.flatten){if(!Array.isArray(s))return{[i.name]:s};let a=s.map(c=>o?He(c,o):c);return{[i.name]:a}}return o&&s!==null&&s!==void 0&&typeof s=="object"&&!Array.isArray(s)?{[i.name]:He(s,o)}:{[i.name]:s}}function ys(t){return Object.assign({},...t)}function oe(t,e){if(typeof t=="string")return(t.startsWith(".")||t.includes("/")||t.includes("\\")||e.has(t)?e.get(t):void 0)??t;if(Array.isArray(t))return t.map(n=>oe(n,e));if(t!==null&&typeof t=="object"){let n={};for(let[i,r]of Object.entries(t))n[i]=oe(r,e);return n}return t}function ws(t){let e=t.split(".").at(-1)??t;return e.endsWith("[]")?e.slice(0,-2):e}function qe(t){return typeof t=="string"?t.startsWith("./")||t.startsWith("../"):Array.isArray(t)?t.some(qe):t!==null&&typeof t=="object"?Object.values(t).some(qe):!1}f();async function pr(t,e){let{sourceDir:n,outputDir:i,patterns:r,ignore:o,appDirectory:s,sourceDirConfigValue:a}=t;if(!await x(n))return{filesCopied:0,outputPaths:[]};await lt(n,s,a);let c=await k(r,{absolute:!0,cwd:n,ignore:o});if(c.length===0)return{filesCopied:0,outputPaths:[]};await M(i);let l=c,p=await Promise.all(l.map(async h=>{let y=F(n,h),P=u(i,y);return F(i,P).startsWith("..")?(e.stdout.write(`Warning: skipping '${h}' - resolved destination is outside the output directory
64
+ `),{count:0,path:null}):h===P?{count:0,path:null}:(await M(E(P)),await V(h,P),{count:1,path:y})})),d=p.reduce((h,y)=>h+y.count,0),m=p.flatMap(h=>h.path===null?[]:[h.path]);return e.stdout.write(`Included ${d} file(s)
65
+ `),{filesCopied:d,outputPaths:m}}f();async function fr(t,e){let{source:n,destination:i,baseDir:r,outputDir:o,appDirectory:s}=t,a=u(r,n);if(!await x(a))throw new Error(`Source does not exist: ${a}`);await lt(a,s,n);let c=await K(a),l,p;if(i===void 0?(l=u(o,$(a)),p=`Included ${n}
66
+ `):(l=u(o,i),p=`Included ${n}
67
+ `),c){let d=await k(["**/*"],{cwd:a,absolute:!1});await Rt(a,l),e.stdout.write(p);let m=F(o,l),h=m?d.map(y=>u(m,y)):d;return{filesCopied:d.length,outputPaths:h}}return await M(E(l)),await V(a,l),e.stdout.write(p),{filesCopied:1,outputPaths:[F(o,l)]}}var bs=g.object({type:g.literal("pattern"),baseDir:g.string().optional(),include:g.array(g.string()).default(["**/*"]),ignore:g.array(g.string()).optional(),destination:g.string().optional()}),xs=g.object({type:g.literal("static"),source:g.string(),destination:g.string().optional()}),vs=g.object({type:g.literal("configKey"),key:g.string(),destination:g.string().optional(),anchor:g.string().optional(),groupBy:g.string().optional(),preserveFilePaths:g.boolean().default(!1)}),_s=g.discriminatedUnion("type",[bs,xs,vs]),Ps=g.object({inclusions:g.array(_s),generatesAssetsManifest:g.boolean().default(!1)}).strict().superRefine((t,e)=>{for(let[n,i]of t.inclusions.entries())if(i.type==="configKey"){let r=i.anchor!==void 0,o=i.groupBy!==void 0;r!==o&&e.addIssue({code:g.ZodIssueCode.custom,message:"`anchor` and `groupBy` must both be set or both be omitted",path:["inclusions",n]})}});async function dr(t,e){let n=Ps.parse(t.config),{extension:i,options:r}=e,o=ze(i.outputPath),s=r.app.directory,a=new Map,c=new Set,l=0;for(let h of n.inclusions){if(h.type!=="configKey")continue;let y=R=>r.stdout.write(R),P=h.destination?me(h.destination,y):void 0,b=P===""?void 0:P,w=await ur({key:h.key,baseDir:i.directory,outputDir:o,context:e,appDirectory:s,destination:b,usedBasenames:c,preserveFilePaths:h.preserveFilePaths});w.pathMap.forEach((R,C)=>a.set(C,R)),l+=w.filesCopied}let p=await Promise.all(n.inclusions.filter(h=>h.type!=="configKey").map(async h=>{let y=w=>r.stdout.write(w),P=h.destination?me(h.destination,y):void 0,b=P===""?void 0:P;if(h.type==="pattern"){let w=h.baseDir?u(i.directory,h.baseDir):i.directory,R=b?u(o,b):o,C=await pr({sourceDir:w,outputDir:R,patterns:h.include,ignore:h.ignore??[],appDirectory:s,sourceDirConfigValue:h.baseDir??"."},r),A=b?C.outputPaths.map(S=>u(b,S)):C.outputPaths;return{filesCopied:C.filesCopied,outputPaths:A}}if(h.type==="static")return fr({source:h.source,destination:b,baseDir:i.directory,outputDir:o,appDirectory:s},r)})),d=n.generatesAssetsManifest?p.flatMap(h=>h?.outputPaths??[]):[],m=[l,...p.map(h=>h?.filesCopied??0)];if(n.generatesAssetsManifest){let h=n.inclusions.filter(y=>y.type==="configKey");await lr(h,e,a,d)}return{filesCopied:m.reduce((h,y)=>h+(y??0),0)}}f();f();var pt=kt(zr(),1);function Cs(t){return new Map(t.map(e=>[e.uri,e.source]))}function Es(t,e,n){let r=t.split(`
68
+ `).slice(e,n+1),o=r.length===1;return r.map((s,a)=>{let c=e+a+1,l=o?s.trim():s;return`${c} ${l}`}).join(`
69
+ `)}function Ss(t){switch(t){case pt.Severity.ERROR:return{error:`
70
+ [error]:`};case pt.Severity.WARNING:return{warn:`
71
+ [warning]:`};case pt.Severity.INFO:return{info:`
72
+ [info]:`}}}function Fs(t,e){return t.map((i,r)=>{let{message:o,uri:s,start:a,end:c,check:l,severity:p}=i,d=e.get(s),m=d===void 0?[]:[`
73
+
74
+ ${Es(d,a.line,c.line)}`],h=r===t.length-1?"":`
75
+
76
+ `;return[Ss(p),{bold:l},{subdued:`
77
+ ${o}`},...m,h]}).flat()}async function hr(t){let n=await x(u(t,".theme-check.yml"))?void 0:"theme-check:theme-app-extension",{offenses:i,theme:r}=await(0,pt.themeCheckRun)(t,n),o=Fs(i,Cs(r));return zn(o)}async function mr(t,e){let{extension:n,options:i}=e;i.stdout.write("Running theme check on your Theme app extension...");let r=await hr(n.directory);r&&i.stdout.write(r)}f();async function gr(t,e){let{extension:n,options:i}=e;i.stdout.write(`Bundling theme extension ${n.localIdentifier}...`);let r=await Re(n);return await Promise.all(r.map(async o=>{let s=F(n.directory,o),a=u(n.outputPath,s);o!==a&&await V(o,a)})),{filesCopied:r.length}}f();async function yr(t,e){let n=e.extension.configuration;e.options.buildDirectory=t.config?.bundleFolder??void 0;let i=await Ji(e.extension,e.options),r=E(i),o=t.config?.bundleFolder?u(E(e.extension.outputPath),t.config.bundleFolder):E(e.extension.outputPath);if(gt(r)===gt(o))return;if(!await x(r))throw new ut(r);let s=await k("**/*",{cwd:r,absolute:!0,ignore:["**/*.js.map"]});if(await Promise.all(s.map(async l=>{let p=u(o,F(r,l));await M(E(p)),await V(l,p)})),!t.config?.generatesAssetsManifest||!Array.isArray(n.extension_points))return;let a=n.extension_points.filter(l=>typeof l=="object"&&l.build_manifest),c=$s(a,t.config?.bundleFolder);Object.keys(c).length>0&&await Ge(e,c)}function $s(t,e){let n={};for(let{target:i,build_manifest:r}of t){if(!r?.assets)continue;let o={};for(let[s,a]of Object.entries(r.assets))a?.filepath&&(o[s]=e?u(e,a.filepath):a.filepath);Object.keys(o).length>0&&(n[i]=o)}return n}f();async function wr(t,e){await Hi(e.extension,e.options)}f();async function br(t,e){let{extension:n}=e;if(await x(n.outputPath)&&await K(n.outputPath))throw new Error(`outputPath '${n.outputPath}' is a directory \u2014 expected a file path for the tax stub`);await Ut(n.outputPath),await T(n.outputPath,"(()=>{})();")}async function xr(t,e){switch(t.type){case"include_assets":return dr(t,e);case"build_theme":return mr(t,e);case"bundle_theme":return gr(t,e);case"bundle_ui":return yr(t,e);case"build_function":return wr(t,e);case"create_tax_stub":return br(t,e);default:throw new Error(`Unknown build step type: ${t.type}`)}}async function vr(t,e){let n=Date.now();try{let i=await xr(t,e);return{id:t.id,success:!0,duration:Date.now()-n,output:i}}catch(i){let r=i;if(t.continueOnError)return e.options.stderr.write(`Warning: Step "${t.name}" failed but continuing: ${r.message}
78
+ `),{id:t.id,success:!1,duration:Date.now()-n,error:r};throw r.message=`Build step "${t.name}" failed: ${r.message}`,r}}f();import{openSync as Is,readSync as As,closeSync as ks}from"fs";var _r=128*1024,se=new Map,ae=new Map,ce=new Map;function ot(t){let e=ae.get(t);if(e!==void 0)return e;let n=L(t);return ae.set(t,n),n}function At(t){let e=ce.get(t);if(e!==void 0)return e;let n=gn(t);return ce.set(t,n),n}function Ds(t){let e=Is(t,"r");try{let n=Buffer.alloc(_r),i=As(e,n,0,_r,0);return n.subarray(0,i).toString()}finally{ks(e)}}function Pr(){se.clear(),ae.clear(),ce.clear()}function js(t){let e=se.get(t);if(e)return e;let n=Ds(t),i=t.substring(t.lastIndexOf(".")),r;switch(i){case".js":case".mjs":case".cjs":case".ts":case".tsx":case".jsx":r=Er(n,t);break;case".rs":r=Os(n,t);break;default:r=[]}return se.set(t,r),r}function Ke(t,e=new Set){if(e.has(t))return[];e.add(t);let n=js(t),i=[t,...n];for(let r of n)try{if(ot(r)&&!At(r)){let o=Ke(r,e);i.push(...o)}}catch(o){if(o instanceof Error&&o.message.includes("ENOENT"))continue;throw o}return B(i)}function Cr(){return{directImports:se.size,fileExists:ae.size,isDir:ce.size}}function Ye(t,e){return Er(t,e)}function Er(t,e){let n=[],i=[/import\s+(?:[\s\S]*?)\s+from\s+['"](\.\.?\/[^'"]+)['"]/gm,/import\s+['"](\.\.?\/[^'"]+)['"]/g,/export\s+(?:[\s\S]*?)\s+from\s+['"](\.\.?\/[^'"]+)['"]/gm,/import\s*\(\s*['"](\.\.?\/[^'"]+)['"]\s*\)/g,/require\s*\(\s*['"](\.\.?\/[^'"]+)['"]\s*\)/g];for(let r of i){let o;for(;(o=r.exec(t))!==null;){let s=o[1];if(s&&s.startsWith(".")){let a=Us(s,e);a&&n.push(a)}}}return B(n)}function Os(t,e){let n=[],i=/^\s*(?:pub\s+)?mod\s+([a-z_][a-z0-9_]*)\s*;/gm,r;for(;(r=i.exec(t))!==null;){let s=r[1];if(s){let a=Ns(s,e);a&&n.push(a)}}let o=/#\[path\s*=\s*"([^"]+)"\]/g;for(;(r=o.exec(t))!==null;){let s=r[1];if(s){let a=u(E(e),s);ot(a)&&n.push(a)}}return B(n)}function Us(t,e){let n=ot(e)&&At(e)?e:E(e),i=u(n,t);if(ot(i)&&At(i)){let o=[u(i,"index.js"),u(i,"index.ts"),u(i,"index.tsx"),u(i,"index.jsx")];for(let s of o)if(ot(s)&&!At(s))return s;return null}let r=[i,`${i}.js`,`${i}.ts`,`${i}.tsx`,`${i}.jsx`];for(let o of r)if(ot(o)&&!At(o))return o;return null}function Ns(t,e){let n=E(e),i=[u(n,`${t}.rs`),u(n,t,"mod.rs")];for(let r of i)if(ot(r))return r;return null}var Rs=250,Ts=["**/node_modules/**","**/.git/**","**/*.test.*","**/dist/**","**/*.swp","**/generated/**","**/.gitignore"],Ls="Extension initialized",ue=class{entrySourceFilePath;devUUID;localIdentifier;idEnvironmentVariableName;directory;configuration;configurationPath;outputPath;handle;specification;uid;cachedImportPaths;get graphQLType(){return(this.specification.graphQLType??this.specification.identifier).toUpperCase()}get type(){return this.specification.identifier}get humanName(){return this.specification.externalName}get name(){return this.configuration.name??this.specification.externalName}get dependency(){return this.specification.dependency}get externalType(){return this.specification.externalIdentifier}get surface(){return this.specification.surface}get isPreviewable(){return this.features.includes("ui_preview")}get isThemeExtension(){return this.features.includes("theme")}get isFunctionExtension(){return this.features.includes("function")}get isESBuildExtension(){return this.features.includes("esbuild")}get isSourceMapGeneratingExtension(){return this.features.includes("generates_source_maps")}get isAppConfigExtension(){return this.specification.experience==="configuration"}get isFlow(){return this.specification.identifier.includes("flow")}get isEditorExtensionCollection(){return this.specification.identifier==="editor_extension_collection"}get hasDeploySteps(){return this.specification.clientSteps?.some(e=>e.lifecycle==="deploy"&&e.steps.length>0)??!1}get features(){return this.specification.appModuleFeatures(this.configuration)}get outputFileName(){return $(this.outputRelativePath)}get outputRelativePath(){return this.specification.getOutputRelativePath?.(this)??""}get hasNoLocalDevOutput(){return this.features.length===0&&!this.hasDeploySteps&&this.outputRelativePath===""}constructor(e){this.configuration=e.configuration,this.configurationPath=e.configurationPath,this.entrySourceFilePath=e.entryPath??"",this.directory=e.directory,this.specification=e.specification;let n=this.specification.getIdentity?.(this.configuration);this.handle=n?.handle??this.buildHandle(),this.localIdentifier=this.handle,this.idEnvironmentVariableName=`SHOPIFY_${ln(this.localIdentifier)}_ID`,this.outputPath=u(this.directory,this.outputRelativePath),this.uid=n?.uid??this.buildUIDFromStrategy(),this.devUUID=`dev-${this.uid}`}get isUUIDStrategyExtension(){return this.specification.uidStrategy==="uuid"}get isSingleStrategyExtension(){return this.specification.uidStrategy==="single"}get isDynamicStrategyExtension(){return this.specification.uidStrategy==="dynamic"}get outputPrefix(){return this.handle}isSentToMetrics(){return!this.isAppConfigExtension}isReturnedAsInfo(){return!this.isAppConfigExtension}async deployConfig({apiKey:e,appConfiguration:n}){let i=await this.specification.deployConfig?.(this.configuration,this.directory,e,void 0,{appConfiguration:n}),r=this.specification.transformLocalToRemote?.(this.configuration,n),o=i??r??void 0;return o&&Object.keys(o).length>0?o:void 0}validate(){return this.specification.validate?this.specification.validate(this.configuration,this.configurationPath,this.directory):Promise.resolve(tt(void 0))}preDeployValidation(){return this.specification.preDeployValidation?this.specification.preDeployValidation(this):Promise.resolve()}buildValidation({outputPath:e}){return this.specification.buildValidation?this.specification.buildValidation(this,e):Promise.resolve()}async keepBuiltSourcemapsLocally(e){if(!this.isSourceMapGeneratingExtension)return Promise.resolve();let i=(await k(`**/${this.handle}.js.map`,{cwd:e,absolute:!0,followSymbolicLinks:!1}))[0];if(i===void 0)return Promise.resolve();let r=u(this.directory,F(e,i));await bn(i,r,{overwrite:!0}),_(`Source map for ${this.localIdentifier} created: ${r}`)}async publishURL(e){let n=await En(),i=this.specification.partnersWebIdentifier;return`https://${n}/${e.orgId}/apps/${e.appId}/extensions/${i}/${e.extensionId}`}getOutputFolderId(){return this.uid}getBundleExtensionStdinContent(){return this.specification.getBundleExtensionStdinContent?this.specification.getBundleExtensionStdinContent(this.configuration):{main:`import '.${this.entrySourceFilePath.replace(this.directory,"")}';`}}shouldFetchCartUrl(){return this.features.includes("cart_url")}hasExtensionPointTarget(e){return this.specification.hasExtensionPointTarget?.(this.configuration,e)??!1}get buildCommand(){return this.configuration.build?.command}get typegenCommand(){return this.configuration.build?.typegen_command}devSessionDefaultWatchPaths(){if(this.specification.identifier==="ui_extension"){let{main:e,assets:n}=this.getBundleExtensionStdinContent(),i=Ye(e,this.directory),r=n?.flatMap(o=>Ye(o.content,this.directory))??[];return i.concat(...r)}return[this.entrySourceFilePath]}get devSessionWatchConfig(){return this.specification.devSessionWatchConfig?this.specification.devSessionWatchConfig(this):this.isAppConfigExtension?{paths:[]}:void 0}async watchConfigurationPaths(){if(this.isAppConfigExtension)return[this.configurationPath];{let e=[];return await x(u(this.directory,"locales"))&&e.push(u(this.directory,"locales","**.json")),e.push(u(this.directory,"**.toml")),e}}get inputQueryPath(){return u(this.directory,"input.graphql")}get isJavaScript(){return!!(this.entrySourceFilePath.endsWith(".js")||this.entrySourceFilePath.endsWith(".ts"))}async build(e){let{clientSteps:n=[]}=this.specification,i={extension:this,options:e,stepResults:new Map},r=n.find(o=>o.lifecycle==="deploy")?.steps??[];for(let o of r){let s=await vr(o,i);i.stepResults.set(o.id,s)}}async buildForBundle(e,n){this.outputPath=this.getOutputPathForDirectory(n),await this.build(e);let i=u(n,this.getOutputFolderId());await this.keepBuiltSourcemapsLocally(i)}getOutputPathForDirectory(e){return u(e,this.getOutputFolderId(),this.outputRelativePath)}get singleTarget(){let e=Q(this.configuration,"targeting")??[];if(e.length===1)return e[0]?.target}get contextValue(){let e=this.specification.getTarget?.(this.configuration);if(e!==void 0)return e;let n=this.singleTarget??"";return this.isFlow&&(n=this.configuration.handle??""),n}async bundleConfig({appModuleUuids:e,developerPlatformClient:n,apiKey:i,appConfiguration:r}){let o=await this.deployConfig({apiKey:i,appConfiguration:r});if(!o)return;let s={config:JSON.stringify(o),context:this.contextValue,handle:this.handle},a=e[this.localIdentifier];return{...s,uid:this.uid,uuid:a,specificationIdentifier:n.toExtensionGraphQLType(this.graphQLType)}}async getDevSessionUpdateMessages(e){if(this.specification.getDevSessionUpdateMessages)return this.specification.getDevSessionUpdateMessages(this.configuration,e);if(e.status==="created"&&!this.isAppConfigExtension&&this.hasNoLocalDevOutput)return[Ls]}patchWithAppDevURLs(e){this.specification.patchWithAppDevURLs?.(this.configuration,e),this.resolveUIDWithApplicationUrl(e.applicationUrl)}resolveUIDWithApplicationUrl(e){this.isDynamicStrategyExtension&&(this.uid=this.buildUIDFromStrategy(e))}async contributeToSharedTypeFile(e){await this.specification.contributeToSharedTypeFile?.(this,e)}watchPatterns(){let e=this.devSessionWatchConfig;return{paths:e?.paths??["**/*"],ignore:e?.ignore??Ts}}watchedFiles(){let e=[],{paths:n,ignore:i}=this.watchPatterns(),r=n.flatMap(o=>vn(o,{cwd:this.directory,absolute:!0,followSymbolicLinks:!1,ignore:i}));if(e.push(...r.flat()),!this.devSessionWatchConfig){let o=this.scanImports();e.push(...o)}return B(e.map(o=>Z(o)))}async rescanImports(){let e=this.cachedImportPaths;return this.cachedImportPaths=void 0,Pr(),this.scanImports(),e!==this.cachedImportPaths}scanImports(){if(this.cachedImportPaths!==void 0)return this.cachedImportPaths;if(mt(process.env.SHOPIFY_CLI_DISABLE_IMPORT_SCANNING))return this.cachedImportPaths=[],this.cachedImportPaths;try{let e=performance.now(),n=this.devSessionDefaultWatchPaths(),i=n.flatMap(a=>Ke(a).map(c=>Z(gt(c))));this.cachedImportPaths=B(i)??[];let r=Math.round(performance.now()-e),o=Cr(),s=o?` (cache: ${o.directImports} parsed, ${o.fileExists} stats)`:"";return _(`Import scan for "${this.handle}": ${n.length} entries, ${this.cachedImportPaths.length} files, ${r}ms${s}`),this.cachedImportPaths}catch(e){return _(`Failed to scan imports for extension ${this.handle}: ${e}`),this.cachedImportPaths=[],this.cachedImportPaths}}buildHandle(){switch(this.specification.uidStrategy){case"single":return this.specification.identifier;case"uuid":return this.configuration.handle??z(this.name??"");case"dynamic":if("topic"in this.configuration&&"uri"in this.configuration){let e=this.configuration,n=`${e.topic}${e.uri}${e.filter}`;return wt(n).substring(0,nt)}else return Tt(JSON.stringify(this.configuration))}}buildUIDFromStrategy(e){switch(this.specification.uidStrategy){case"single":return this.specification.identifier;case"uuid":return this.configuration.uid??Tt(this.handle);case"dynamic":if("topic"in this.configuration&&"uri"in this.configuration){let n=this.configuration,i=ct(n.uri,e).substring(0,Rs);return`${n.topic}::${n.filter??""}::${i}`}else return Tt(JSON.stringify(this.configuration))}}};f();async function Op(t,e=""){let n=Ms(e),i=await bt(n);for(;await x(u(t,le(i)))&&await et({message:`Configuration file ${le(i)} already exists. Do you want to choose a different configuration name?`,confirmationMessage:"Yes, I'll choose a different name",cancellationMessage:"No, overwrite my existing configuration file"});)i=await bt(n);return le(i)}function le(t,e=!1){let n=z(t);return n===""?"shopify.app.toml":`shopify.app.${e?On.cyan(n):n}.toml`}async function Qe(t){return(await k(u(t,Et))).filter(n=>G($(n)))}async function Sr(t){let e=(await Qe(t)).map(i=>$(i));if(e.length===0)return Lt("Could not find any shopify.app.toml file in the directory.");if(e.length===1)return tt(e[0]);let n=await Rn({message:"Configuration file",choices:e.map(i=>({label:i,value:i}))});return tt(n)}function Ms(t){return{message:"Configuration file name:",initialAnswer:t,validate:Ws,preview:e=>`${le(e,!0)} will be generated in your root directory`}}function Ws(t){if(z(t).length>238)return"The file name is too long."}f();f();f();import{readdirSync as Bs}from"fs";async function Fr(t){if(!t||!await K(t))return{};let e={},n=Bs(t);return await Promise.all(n.map(async i=>{if(G(i)){let r=u(t,i),s=(await H.read(r)).content;s.client_id&&(e[s.client_id]=i)}})),e}function Kp(){return Kn()}function Yp(){return Yn()}function Qp(){return Qn()}async function Xp(t,e,n,i){let r=await Fr(i?.directory),o=c=>r[c?.apiKey]?{label:`${c.title} (${r[c.apiKey]})`,value:c.apiKey}:{label:c.title,value:c.apiKey},s=e,a=await _e({message:"Which existing app is this for?",choices:s.map(o),hasMorePages:n,search:async c=>{let l=await t(c);return s=l.apps,{data:s.map(o),meta:{hasNextPage:l.hasMorePages}}}});return s.find(c=>c.apiKey===a)}async function Zp({stores:t,hasMorePages:e=!1,onSearchForStoresByName:n,showDomainOnPrompt:i=!0,onCreateStoreWhenEmpty:r,onCreateStore:o}){if(t.length===0)return r?.();if(t.length===1&&!e&&!o)return Jn(`Using your default dev store, ${t[0].shopName}, to preview your project.`),t[0];let s=h=>{let y=h.shopName;return i&&h.shopDomain&&(y=`${h.shopName} (${h.shopDomain})`),{label:y,value:h.shopId}},a=t,c=new Map(t.map(h=>[h.shopId,h])),l="__create_new_dev_store__",p=()=>[...a.map(s),...o?[{label:"Create a new dev store",value:l}]:[]],d={};n&&(d.search=async h=>{let y=await n(h);return a=y.stores,a.length>0&&a.forEach(P=>c.set(P.shopId,P)),{data:p(),meta:{hasNextPage:y.hasMorePages}}});let m=await _e({message:"Which store would you like to use to view your project?",choices:p(),hasMorePages:e,...d});return m===l?o?.():c.get(m)}async function tf(t){return bt({message:"App name",defaultValue:t,validate:e=>{if(e.length===0)return"App name can't be empty";if(e.length>$e)return`Enter a shorter name (${$e} character max.)`;if(e.includes("shopify"))return`Name can't contain "shopify." Enter another name.`}})}async function ef(t){return et({message:"Finished creating a dev store?",confirmationMessage:`Yes, ${t.businessName} has a new dev store`,cancellationMessage:"No, cancel dev"})}async function nf(){return et({message:"Create this project as a new app on Shopify?",confirmationMessage:"Yes, create it as a new app",cancellationMessage:"No, connect it to an existing app"})}function $r(t,e){let n=["application_url","redirect_urls"];e.appProxy?.proxyUrl&&n.push("app_proxy");let i={"Currently released app URL":[t],"=> Dev URL":[e.applicationUrl],"Affected configurations":n};return et({message:"Have Shopify override your app URLs when running `app dev` against your dev store? This won't affect your app on other stores",confirmationMessage:"Yes, automatically update",cancellationMessage:"No, never",infoTable:i})}function rf(){return et({message:"--use-localhost requires a certificate for `localhost`. Generate it now?",confirmationMessage:"Yes, use mkcert to generate it",cancellationMessage:"No, I'll run `app dev` again without `--use-localhost`"})}async function gf(t){if(t.noTunnelUseLocalhost)return{frontendUrl:"https://localhost",frontendPort:t.port,usingLocalhost:!0};let e=4040,n="",i=t.noTunnelUseLocalhost;if(Ee())return n=`https://${Ee()}-${e}.${Wn()}`,{frontendUrl:n,frontendPort:e,usingLocalhost:i};if(Ce()){let r=Ce()?.replace("https://","");return n=`https://${e}-${r}`,{frontendUrl:n,frontendPort:e,usingLocalhost:i}}if(t.tunnelUrl){let r=t.tunnelUrl.match(/(https:\/\/[^:]+):([0-9]+)/);if(!r)throw new v(`Invalid tunnel URL: ${t.tunnelUrl}`,'Valid format: "https://my-tunnel-url:port"');return e=Number(r[2]),n=r[1],{frontendUrl:n,frontendPort:e,usingLocalhost:i}}return t.tunnelClient&&(e=t.tunnelClient.port,n=await Vs(t.tunnelClient)),{frontendUrl:n,frontendPort:e,usingLocalhost:i}}async function Vs(t){return new Promise((e,n)=>{let i=0,r=async()=>{let s=t.getTunnelStatus();if(_(`Polling tunnel status for ${t.provider} (attempt ${i}): ${s.status}`),s.status==="error")return n(new v(s.message,s.tryMessage));s.status==="connected"?e(s.url):(i+=1,o())},o=()=>{setTimeout(r,500)};r()})}function Ir(t,e,n){let i;e&&e.length>0?i=(Array.isArray(e)?e:[e]).reduce((s,a)=>(a&&a.length>0&&s.push(`${t}${a}`),s),[]):i=[`${t}/auth/callback`,`${t}/auth/shopify/callback`,`${t}/api/auth/callback`];let r=n?{appProxy:{proxyUrl:Js(ct(n.url,t),t),proxySubPath:n.subpath,proxySubPathPrefix:n.prefix}}:{};return{applicationUrl:t,redirectUrlWhitelist:i,...r}}function Js(t,e){let n=new URL(t),i=new URL(e);return n.host=i.host,n.toString().replace(/\/$/,"")}async function yf(t){let e={applicationUrl:t?.application_url??"",redirectUrlWhitelist:t?.auth?.redirect_urls??[]};return t?.app_proxy&&(e.appProxy={proxyUrl:t?.app_proxy.url,proxySubPath:t?.app_proxy.subpath,proxySubPathPrefix:t?.app_proxy.prefix}),e}async function wf(t){if(t.localApp&&t.localApp.configuration.client_id!==t.apiKey||(t.newApp??!Mn()))return!0;let e=t.cachedUpdateURLs===!0;if(t.cachedUpdateURLs===void 0)if(e=await $r(t.currentURLs.applicationUrl,t.newURLs),t.localApp){let n=t.localApp.configuration;n.build={...n.build,automatically_update_urls_on_dev:e},await(await H.read(t.localApp.configPath)).patch({build:{automatically_update_urls_on_dev:e}})}else Zt({directory:t.appDirectory,updateURLs:e});return e}async function bf(t,e,n){let i=await Cn(t,"tunnel_start",{port:e,provider:n}),r=Object.values(i).filter(s=>!s?.isErr()||s.error.type!=="invalid-provider");if(r.length>1)throw new Pe(`Multiple tunnel plugins for ${n} found`);let o=r[0];if(!o)throw new Pe(`We couldn't find the ${n} tunnel plugin`);if(o.isErr())throw new v(`${n} failed to start the tunnel.
79
+ ${o.error.message}`,["What to try:",{list:{items:[["Try to run the command again"],["Add the flag",{command:"--tunnel-url {URL}"},"to use a custom tunnel URL"]]}}]);return o.value}f();f();f();f();var Ar=an({name:"AppConfigUseResult",schema:g.object({status:g.literal("success"),changed:g.boolean().describe("Whether the preferred configuration changed."),path:g.string().refine(Dt,"Expected an absolute filesystem path.").nullable().describe("The preferred configuration file, or null after clearing the preference."),clientId:g.string().min(1).nullable().describe("The public OAuth client identifier, or null after clearing the preference.")}).strict()});async function kr(t,e,n){if(n==="json"){Vn(Ar.encode(t));return}if(t.path===null){let i=await Bt(e);ve({headline:"Cleared current configuration.",body:["In order to set a new current configuration, please run",{command:Bn(i,"shopify app config use CONFIG_NAME")},{char:"."}]})}else ve({headline:`Using configuration file ${$(t.path)}`})}import{resolve as Hs}from"node:path";async function Xe({directory:t,configName:e,warningContent:n,shouldRenderSuccess:i=!0,reset:r=!1}){n&&!r&&Nn(n);let o=await qs({directory:t,configName:e,reset:r});return(r||i)&&await kr(o,t,"text"),o.path===null?void 0:$(o.path)}async function qs({directory:t,configName:e,reset:n=!1,previousConfigFile:i=Xt(t)?.configFile??null}){if(n)return Gi(t),{status:"success",changed:i!==null,path:null,clientId:null};let r=(await Gs(t,e)).valueOrAbort(),{activeConfig:o}=await ft(t,r);return zs(o.file.content,{configFileName:r,directory:t}),{status:"success",changed:i!==r,path:Hs(t,r),clientId:o.file.content.client_id}}function zs(t,e){let{configFileName:n,directory:i}=e;if(t.client_id)Zt({directory:i,configFile:n});else throw new v(`Configuration file ${n} needs a client_id.`)}async function Gs(t,e){if(e){let n=rt(e);return await x(u(t,n))?tt(n):Lt(`Could not find configuration file ${n}`)}return Sr(t)}async function jr(t,e,n){let i=e,r=n?.clientId?t.appConfigByClientId(n.clientId):void 0,o=Xt(t.directory)?.configFile,s=o?u(t.directory,o):null,a=!!(!i&&s&&!L(s));if(a&&!n?.skipPrompts){let m={headline:`Couldn't find ${o}`,body:["If you have multiple config files, select a new one. If you only have one config file, it's been selected as your default."]};i=await Xe({directory:t.directory,warningContent:m,shouldRenderSuccess:!1})}if(!i&&r)return Dr(t,r,"flag");if(!i&&n?.clientId)throw new v("The specified client ID couldn't be found in any TOML file, or the matching TOML file is malformed.");let c=i??(a?void 0:o),l;e?l="flag":c?l="cached":l="default";let p=rt(c),d=t.appConfigByName(p);if(!d)throw new v(U`Couldn't find ${p} in ${D.path(t.directory)}.`);return Dr(t,d,l)}async function Dr(t,e,n){let i=typeof e.content.client_id=="string"?e.content.client_id:void 0,r=!!i&&i!=="",o=pe(t,e.path),s=await fe(t,i);return{file:e,source:n,isLinked:r,dotenv:o,hiddenConfig:s}}f();async function Or(t,e){await Fn("warn-on-multiple-versions",{days:1},async()=>{if(!e["@shopify/cli"])return;let n=An(),i=n?he:await In();if(!i)return;let r=n?await $n(t):he;if(!r)return;let s={headline:`Two Shopify CLI installations found \u2013 using ${n?"global installation":"local dependency"}`,body:[`A global installation (v${i}) and a local dependency (v${r}) were detected.
80
+ We recommend removing the @shopify/cli and @shopify/app dependencies from your package.json, unless you want to use different versions across multiple apps.`],link:{label:"See Shopify CLI documentation.",url:"https://shopify.dev/docs/apps/build/cli-for-apps#switch-to-a-global-executable-or-local-dependency"}};Un(s)})}f();import{existsSync as Ks,readFileSync as Ys}from"fs";var Qs=[{name:"remix",detectors:{every:[{path:"package.json",matchContent:'"(dev)?(d|D)ependencies":\\s*{[^}]*"@remix-run\\/.*":\\s*".+?"[^}]*}'},{path:"package.json",matchContent:'"(dev)?(d|D)ependencies":\\s*{[^}]*"react":\\s*".+?"[^}]*}'}]}},{name:"nextjs",detectors:{every:[{path:"package.json",matchContent:'"(dev)?(d|D)ependencies":\\s*{[^}]*"next":\\s*".+?"[^}]*}'},{path:"package.json",matchContent:'"(dev)?(d|D)ependencies":\\s*{[^}]*"react":\\s*".+?"[^}]*}'}]}},{name:"express",detectors:{every:[{path:"package.json",matchContent:'"(dev)?(d|D)ependencies":\\s*{[^}]*"express":\\s*".+?"[^}]*}'}]}},{name:"rails",detectors:{every:[{path:"Gemfile",matchContent:'gem "rails"'}]}},{name:"flask",detectors:{every:[{path:"Pipfile",matchContent:"flask"}]}},{name:"django",detectors:{every:[{path:"Pipfile",matchContent:"django"}]}},{name:"laravel",detectors:{every:[{path:"composer.json",matchContent:'"require":\\s*{[^}]*"laravel/framework":\\s*".+?"[^}]*}'}]}},{name:"symfony",detectors:{every:[{path:"composer.json",matchContent:'"require":\\s*{[^}]*"symfony\\/.*":\\s*".+?"[^}]*}'}]}}];async function Rr(t){let e={},n=Qs.find(i=>(!i.detectors.some||i.detectors.some.reduce((r,o)=>Ur(o,Nr(t,o.path,e)),!1))&&(!i.detectors.every||i.detectors.every.reduce((r,o)=>r?Ur(o,Nr(t,o.path,e)):!1,!0)));return n?n.name:"unknown"}function Ur(t,e={}){return e[t.path]?!t.matchContent||new RegExp(t.matchContent).test(e[t.path]):!1}function Nr(t,e,n={}){if(n[e])return n;let i=u(t,e);if(!Ks(i))return n;let r=Ys(i,{encoding:"utf8"});return n[e]=r,n}var Mr=kt(Kr(),1),Ze=class extends v{configurationPath;errors;constructor(e,n){super(`Validation errors in ${e}:
81
+
82
+ ${n.map(nn).join(`
83
+ `)}`),this.configurationPath=e,this.errors=n}};function Xs(t){if(t.file.endsWith(".toml")&&t.message==="Expected object, received array")return"Use a TOML table instead of an array. [table] defines a single table; [[table]] defines an array of tables."}function nn(t){let e=Xs(t),n=e?`${t.message}. ${e}`:t.message;return t.path?.length?`[${t.path.join(".")}]: ${n}`:n}async function rn(t,e,n){let i=n;if(!i)try{i=(await H.read(e)).content}catch(r){if(r instanceof xt)return{errors:[{file:e,message:r.message}]};throw r}return Wr(t,e,i)}function Wr(t,e,n){let i=t.safeParse(n);return i.success?{data:i.data}:{errors:ar(i.error.issues).map(r=>({file:e,message:r.message,path:r.path,code:r.code}))}}function Tr(t,e,n){let i=t.parseConfigurationObject(n);switch(i.state){case"ok":return{data:i.data};case"error":return{errors:i.errors.map(r=>({file:e,message:r.message??"Unknown error",path:r.path}))}}}var It=class{errors=[];addError(e){this.errors.push(e)}addErrors(e){this.errors.push(...e)}getErrors(e){return e?this.errors.filter(n=>n.file===e):[...this.errors]}isEmpty(){return this.errors.length===0}};async function Ld(t){if(!((await Qe(t)).length>0))throw new v(U`Couldn't find an app toml file at ${D.path(t)}, is this an app directory?`)}async function Md(t,e){let{project:n,activeConfig:i}=await ft(t),r=i.file.content,o=en(n,i.file),s=await Promise.all(o.map(d=>Br(d.path,d.content))),a=s.flatMap(d=>d.errors??[]);if(a.length>0)throw new v(a.map(nn).join(`
84
+ `));let l=s.filter(d=>"web"in d).map(d=>d.web).some(d=>q(d,O.Frontend)||q(d,O.Backend)),p=ie(r);return{isLaunchable:l,scopesArray:p,name:e,directory:n.directory,isEmbedded:l}}async function Br(t,e){let n=await rn(or,t,e);if(n.errors)return{errors:n.errors};let i=n.data,r=new Set("roles"in i?i.roles:[]);"type"in i&&r.add(i.type);let{type:o,...s}={...i,roles:Array.from(r),type:void 0};return{web:{directory:E(t),configuration:s,framework:await Rr(E(t))}}}async function Wd(t){let{project:e,activeConfig:n}=await ft(t.directory,t.userProvidedConfigName,t.skipPrompts?{skipPrompts:!0}:void 0);return on({project:e,activeConfig:n,specifications:t.specifications,remoteFlags:t.remoteFlags,ignoreUnknownExtensions:t.ignoreUnknownExtensions})}async function on(t){let{project:e,activeConfig:n,specifications:i,remoteFlags:r=[],ignoreUnknownExtensions:o,reloadState:s,clientIdOverride:a}=t,c={...n.file.content};a&&(c.client_id=a);let p=rr(i),d=n.file.path,m=$(d),h=await rn(p,d,c);if(h.errors)throw new Ze(d,h.errors);let y=h.data,P=na(e.appConfigFiles,{[m]:y.client_id}),b=!1;try{b=await ta(e.directory,d)}catch{}let w={allClientIdsByConfigName:P,usesLinkedConfig:!0,name:m,gitTracked:b,source:n.source,usesCliManagedUrls:y.build?.automatically_update_urls_on_dev},R={directory:e.directory,configPath:d,configuration:y,configurationLoadResultMetadata:w,clientIdOverride:a,configSchema:p,specifications:i,remoteFlags:r};return new tn({ignoreUnknownExtensions:o,loadedConfiguration:R,project:e,reloadState:s}).loaded()}function Zs(t){return t.access_scopes?.scopes??""}async function Bd(t){try{let{project:e,activeConfig:n}=await ft(t.directory,t.configName,t.skipPrompts?{skipPrompts:!0}:void 0),i=await on({project:e,activeConfig:n,specifications:t.specifications,remoteFlags:t.remoteFlags});return{state:"loaded-app",app:i,configuration:i.configuration,packageManager:e.packageManager}}catch{try{let e=await Ft.load(t.directory),{configurationPath:n}=await ea(e.directory,t.configName),r=(await H.read(n)).content;return{state:"loaded-template",rawConfig:r,scopes:Zs(r),appDirectory:e.directory,packageManager:e.packageManager}}catch{return{state:"error"}}}}async function Vd(t){let{project:e,activeConfig:n}=await ft(t.directory,$(t.configPath)),i={extensionDevUUIDs:new Map(t.allExtensions.map(o=>[o.handle,o.devUUID])),previousDevURLs:t.devApplicationURLs},r=await on({project:e,activeConfig:n,specifications:t.specifications,remoteFlags:t.remoteFlags??[],reloadState:i,clientIdOverride:t.clientIdOverride});if(!r.errors.isEmpty()){let o=r.errors.getErrors();throw new v(U`${D.errorText("Validation errors")}:\n\n${o.map(nn).join(`
85
+ `)}`)}return r}function Jd(t){let e=St(t);return e?`${at.production}.${e}`:at.production}var tn=class{ignoreUnknownExtensions;errors=new It;specifications;remoteFlags;loadedConfiguration;reloadState;project;constructor({ignoreUnknownExtensions:e,loadedConfiguration:n,reloadState:i,project:r}){this.ignoreUnknownExtensions=e??!1,this.specifications=n.specifications,this.remoteFlags=n.remoteFlags,this.loadedConfiguration=n,this.reloadState=i,this.project=r}get activeConfigFile(){let e=this.loadedConfiguration.configPath;return this.project.appConfigFiles.find(n=>n.path===e)}async loaded(){let{configuration:e,directory:n,configPath:i,configurationLoadResultMetadata:r,configSchema:o}=this.loadedConfiguration;await sa(r);let s=pe(this.project,i),a=await this.loadExtensions(n,e),c=e.name,p=e.handle??c??"",d=await fe(this.project,e.client_id);this.reloadState||await Or(n,this.project.nodeDependencies);let{webs:m,usedCustomLayout:h}=await this.loadWebs(n,e.web_directories),y=new ee({name:p,directory:n,configPath:i,configuration:e,clientIdOverride:this.loadedConfiguration.clientIdOverride,webs:m,modules:a,dotenv:s,errors:this.errors,specifications:this.specifications,configSchema:o,remoteFlags:this.remoteFlags,hiddenConfig:d,devApplicationURLs:this.getDevApplicationURLs(e,m)}),P=y.realExtensions.map(b=>b.type);return await Gn(P),await ra(y,this.project.usesWorkspaces,{usedCustomLayoutForWeb:h,usedCustomLayoutForExtensions:e.extension_directories!==void 0}),await y.generateExtensionTypes(),y}async loadWebs(e,n){let i=this.activeConfigFile,r=i?en(this.project,i):this.project.webConfigFiles,o=r.map(p=>p.path),s=await Promise.all(r.map(p=>Br(p.path,p.content))),a=[];for(let p of s)p.errors?this.errors.addErrors(p.errors):a.push(p.web);this.validateWebs(a);let c=o.every(p=>F(e,p).startsWith("web/"));return{webs:a,usedCustomLayout:n!==void 0||!c}}findSpecificationForType(e){return this.specifications.find(n=>n.identifier===e||n.externalIdentifier===e||n.additionalIdentifiers?.includes(e))}validateWebs(e){[O.Backend,O.Frontend].forEach(n=>{let i=e.filter(r=>r.configuration.roles.includes(n));if(i.length>1){let r=i.map(a=>u(a.directory,J.web)),o=r.map(a=>` ${a}`).join(`
86
+ `),s=r[r.length-1];this.errors.addError({file:s,message:`You can only have one "web" configuration file with the ${n} role in your app.
87
+
88
+ Conflicting configurations found at:
89
+ ${o}`})}})}async createExtensionInstance(e,n,i,r){let o=this.findSpecificationForType(e),s,a=!1;if(o)a=!0;else{if(this.ignoreUnknownExtensions)return;this.errors.addError({file:i,message:`Invalid extension type "${e}" in "${un(i)}"`});return}let c=Tr(o,i,n);if(c.errors){this.errors.addErrors(c.errors);return}let l=c.data;a&&(s=await this.findEntryPath(r,o));let p=new ue({configuration:l,configurationPath:i,entryPath:s,directory:r,specification:o});if(this.reloadState&&l.handle){let d=this.reloadState.extensionDevUUIDs.get(l.handle);d&&(p.devUUID=d)}if(a){let d=await p.validate();d.isErr()&&this.errors.addError({file:i,message:qn(d.error).trim()})}return p}async loadExtensions(e,n){if(this.specifications.length===0)return[];let i=await this.createExtensionInstances(e),r=await this.createConfigExtensionInstances(e,n),o=this.createWebhookSubscriptionInstances(e,n),s=await Promise.all([...i,...r,...o]),a=st(s.flat()),c=new Set;return a.forEach(l=>{if(l.handle&&c.has(l.handle)){let p=a.filter(m=>m.handle===l.handle),d=pn(p.map(m=>m.name));this.errors.addError({file:l.configurationPath,message:`Duplicated handle "${l.handle}" in extensions ${d}. Handle needs to be unique per extension.`})}else l.handle&&c.add(l.handle)}),a}async createExtensionInstances(e){let n=this.activeConfigFile;return(n?Lr(this.project,n):this.project.extensionConfigFiles).map(async r=>{let o=r.path,s=E(o),a=r.content,c=ti.safeParse(a);if(!c.success)return this.errors.addError({file:o,message:`Invalid extension configuration at ${F(e,o)}`}),[];let{extensions:l,type:p}=c.data;if(l){let d=await rn(ni,o,r.content);if(d.errors)return this.errors.addErrors(d.errors),[];let m=d.data,h=m.extensions.map(async y=>{let P={...m,...y};return P.handle||(this.errors.addError({file:o,message:`Missing handle for extension "${P.name}" at ${F(e,o)}`}),P.handle="unknown-handle"),this.createExtensionInstance(P.type,P,o,s)});return Promise.all(h)}else{if(p)return this.createExtensionInstance(p,a,o,s);this.errors.addError({file:o,message:`Invalid extension type at "${F(e,o)}". Please specify a type.`});return}})}createWebhookSubscriptionInstances(e,n){let i=this.loadedConfiguration.configPath,r=this.findSpecificationForType(Ie);if(!r)return[];let o=Wr(oi,i,n);if(o.errors)return this.errors.addErrors(o.errors),[];let{api_version:s,subscriptions:a=[]}=o.data.webhooks;return st(a.flatMap(p=>{let{uri:d,topics:m,compliance_topics:h,...y}=p;return m?.map(P=>({api_version:s,uri:d,topic:P,...y}))})).map(async p=>{let d=await this.createExtensionInstance(r.identifier,p,i,e);return d?.resolveUIDWithApplicationUrl(n.application_url),d})}async createConfigExtensionInstances(e,n){let i=this.loadedConfiguration.configPath,r=await Promise.all(this.specifications.filter(s=>ii(s)).filter(s=>s.identifier!==Ie).map(async s=>{let a=Tr(s,i,n);if(a.errors)return this.errors.addErrors(a.errors),[[],[]];let c=a.data;if(Object.keys(c).length===0)return[[],Object.keys(c)];let l=s.expandConfig?.(c,{flags:this.remoteFlags})??[c];return[await Promise.all(l.map(async d=>{let m=await this.createExtensionInstance(s.identifier,d,i,e);return this.validateConfigurationExtensionInstance(n.client_id,n,m)})),Object.keys(c)]})),o=Object.keys(n).filter(s=>!r.some(([a,c])=>c.includes(s))).filter(s=>![...Object.keys(ne.shape),"organization_id"].includes(s));return o.length>0&&!this.ignoreUnknownExtensions&&this.errors.addError({file:i,message:`Unsupported section(s) in app configuration: ${o.sort().join(", ")}`}),st(r.flatMap(([s])=>s))}async validateConfigurationExtensionInstance(e,n,i){return i&&await i.deployConfig({apiKey:e,appConfiguration:n})?i:void 0}async findEntryPath(e,n){let i;return n.appModuleFeatures().includes("single_js_entry_path")?(i=(await Promise.all(["index"].flatMap(r=>[`${r}.js`,`${r}.jsx`,`${r}.ts`,`${r}.tsx`]).flatMap(r=>[`src/${r}`,r]).map(r=>u(e,r)).map(async r=>await x(r)?r:void 0))).find(r=>r!==void 0),i||this.errors.addError({file:e,message:`Couldn't find an index.{js,jsx,ts,tsx} file in the directories ${e} or ${u(e,"src")}`})):n.identifier==="function"&&(i=(await Promise.all(["src/index.js","src/index.ts","src/main.rs"].map(r=>u(e,r)).map(async r=>await x(r)?r:void 0))).find(r=>r!==void 0)),i}getDevApplicationURLs(e,n){let i=this.reloadState?.previousDevURLs;return i&&Ir(i.applicationUrl,n.map(({configuration:r})=>r.auth_callback_path).find(r=>r),e.app_proxy)}};async function ft(t,e,n){let i=await Ft.load(t),r=await jr(i,e,n);return{project:i,activeConfig:r}}async function ta(t,e){let n=u(t,".gitignore");if(!L(n))return!0;let i=await N(n),r=Mr.default.default().add(i),o=F(t,e);return!r.ignores(o)}async function ea(t,e){let n=rt(e),i=u(t,n);if(await x(i))return{configurationPath:i,configurationFileName:n};throw new v(U`Couldn't find ${n} in ${D.path(t)}.`)}function na(t,e){let n=t.map(i=>{let r=$(i.path);if(e[r]!==void 0&&typeof e[r]=="string")return[r,e[r]];let o=i.content.client_id;if(typeof o=="string"&&o!=="")return[r,o]}).filter(i=>i!==void 0);return Object.fromEntries(n)}async function ia(t){let e=t.filter(a=>q(a,O.Backend)),n=t.filter(a=>q(a,O.Frontend));if(e.length>1){_("Unable to decide project type as multiple web backends");return}else{if(e.length===0&&n.length>0)return"frontend";if(!e[0]){_("Unable to decide project type as no web backend");return}}let{directory:i}=e[0],r=u(i,"package.json"),o=u(i,"Gemfile"),s=u(i,"composer.json");if(await x(r))return"node";if(await x(o))return"ruby";if(await x(s))return"php"}function q(t,e){return t.configuration.roles.includes(e)}async function ra(t,e,n){let i=t.webs,r=t.allExtensions.filter(l=>l.isSentToMetrics()),o=t.name,s=t.directory,a=t.configuration.client_id,c=ie(t.configuration).sort();await oa(i,r,n,o,s,a,c,e)}async function oa(t,e,n,i,r,o,s,a){await qt.addPublicMetadata(async()=>{let c=await ia(t),l=e.filter(w=>w.isFunctionExtension).length,p=e.filter(w=>w.isESBuildExtension).length,d=e.filter(w=>w.isThemeExtension).length,m=e.length,h=t.filter(w=>q(w,O.Backend)).length,y=h===1?t.find(w=>q(w,O.Backend))?.framework:void 0,P=t.filter(w=>q(w,O.Frontend)).length,b={};for(let w of e)b[w.type]===void 0?b[w.type]=1:b[w.type]++;return{api_key:o,project_type:c,app_extensions_any:m>0,app_extensions_breakdown:JSON.stringify(b),app_extensions_count:m,app_extensions_custom_layout:n.usedCustomLayoutForExtensions,app_extensions_function_any:l>0,app_extensions_function_count:l,app_extensions_theme_any:d>0,app_extensions_theme_count:d,app_extensions_ui_any:p>0,app_extensions_ui_count:p,app_name_hash:wt(i),app_path_hash:wt(r),app_scopes:JSON.stringify(s),app_web_backend_any:h>0,app_web_backend_count:h,app_web_custom_layout:n.usedCustomLayoutForWeb,app_web_framework:y,app_web_frontend_any:P>0,app_web_frontend_count:P,env_package_manager_workspaces:a}}),await qt.addSensitiveMetadata(async()=>({app_name:i}))}async function sa(t){await qt.addPublicMetadata(async()=>({cmd_app_all_configs_any:Object.keys(t.allClientIdsByConfigName).length>0,cmd_app_all_configs_clients:JSON.stringify(t.allClientIdsByConfigName),cmd_app_linked_config_used:t.usesLinkedConfig,...t.usesLinkedConfig?{cmd_app_linked_config_name:t.name,cmd_app_linked_config_git_tracked:t.gitTracked,cmd_app_linked_config_source:t.source,cmd_app_linked_config_uses_cli_managed_urls:t.usesCliManagedUrls}:{}}))}f();var aa="project.json";async function sn(t){let e=await Xn(t),n=u(e,aa);return await x(n)||await T(n,JSON.stringify({})),n}function pe(t,e){let n=St(e);if(n){let i=`${at.production}.${n}`;return t.dotenvFiles.get(i)}return t.dotenvFiles.get(at.production)}async function fe(t,e){if(!e||typeof e!="string")return{};await sn(t.directory);let n=t.hiddenConfigRaw,i=n[e];if(i&&typeof i=="object")return i;if(typeof n.dev_store_url=="string"){try{let r=await sn(t.directory);await te(r,e,{dev_store_url:n.dev_store_url})}catch{}return{dev_store_url:n.dev_store_url}}return{}}function Lr(t,e){let n=e.content.extension_directories,r=(Array.isArray(n)&&n.length>0?n:["extensions/*"]).map(o=>`${o}/*.extension.toml`);return t.extensionConfigFiles.filter(o=>{let s=F(t.directory,o.path).replace(/\\/g,"/");return r.some(a=>Nt(s,a))})}function en(t,e){let n=e.content.web_directories;if(!Array.isArray(n)||n.length===0)return t.webConfigFiles;let i=n.map(r=>`${r}/shopify.web.toml`);return t.webConfigFiles.filter(r=>{let o=F(t.directory,r.path).replace(/\\/g,"/");return i.some(s=>Nt(o,s))})}function oh(t,e){let n=e.content.extension_directories,i=(Array.isArray(n)&&n.length>0?n:["extensions/*"]).map(a=>`${a}/*.extension.toml`),r=e.content.web_directories,o=Array.isArray(r)&&r.length>0?r.map(a=>`${a}/shopify.web.toml`):["**/shopify.web.toml"],s=[...i,...o];return t.errors.filter(a=>{if(a.path===e.path)return!0;let c=F(t.directory,a.path).replace(/\\/g,"/");return s.some(l=>Nt(c,l))})}export{Ae as a,xa as b,it as c,Do as d,Ct as e,Ni as f,hc as g,$t as h,hu as i,us as j,O as k,ju as l,ds as m,rt as n,St as o,G as p,ze as q,Re as r,vc as s,Hi as t,Op as u,Qe as v,Sr as w,Xt as x,Zt as y,gf as z,Ir as A,yf as B,wf as C,bf as D,Ft as E,Be as F,Lr as G,en as H,oh as I,Ar as J,kr as K,qs as L,zs as M,jr as N,Ze as O,nn as P,Ld as Q,Md as R,Wd as S,on as T,Bd as U,Vd as V,Jd as W,ft as X,q as Y,Fr as Z,Kp as _,Yp as $,Qp as aa,Xp as ba,Zp as ca,tf as da,ef as ea,nf as fa,rf as ga};