import{a as h}from"./chunk-JOYM7AEQ.js";import{a as v}from"./chunk-6ZRHK4ON.js";import{a as m}from"./chunk-7XQDZF73.js";import{Fa as c}from"./chunk-UZ7U322K.js";import{z as n}from"./chunk-2HZMOK4U.js";import{b as l}from"./chunk-Q6LCSRIW.js";import{v as d}from"./chunk-E24W34C4.js";import{d as a}from"./chunk-ELIH6GCC.js";import{r as x}from"./chunk-T6CC5WUU.js";import{e as S,g as p}from"./chunk-VKWPEFWQ.js";p();p();async function f(o){let e=o.appContextResult.developerPlatformClient,r=o.appContextResult.remoteApp;if(!e.supportsDevSessions)throw new a("Dev preview is not supported for this app. It's valid only for apps created on the Next-Gen Dev Platform.");let s=await e.devSessionDelete({shopFqdn:o.store.shopDomain,appId:r.id});if(s.devSessionDelete?.userErrors.length){let u=s.devSessionDelete.userErrors.map(g=>g.message).join(`
`);throw new a(`Failed to stop the dev preview: ${u}`)}d({headline:"Dev preview stopped.",body:[`The dev preview has been stopped on ${o.store.shopDomain} and the app's active version has been restored.`,"You can start it again with",{command:"shopify app dev"}]})}var w=S(x(),1);var i,t=class extends v{async run(){let{flags:e}=await this.parse(i),r=await c({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),s=await h({appContextResult:r,storeFqdn:e.store,forceReselectStore:e.reset});return await f({appContextResult:r,store:s}),{app:r.app}}};i=t;t.summary="Cleans up the dev preview from the selected store.";t.descriptionWithMarkdown=`Stop the dev preview that was started with \`shopify app dev\`.

  It restores the app's active version to the selected development store.
  `;t.description=i.descriptionWithoutMarkdown();t.flags={...l,...m,store:w.Flags.string({hidden:!1,char:"s",description:"Store URL. Must be an existing development store.",env:"SHOPIFY_FLAG_STORE",parse:async o=>n(o)})};var q=t;export{q as a};
