import{a as T}from"./chunk-2GDACKZF.js";import{b as P,c as w,d as v}from"./chunk-2MNOWKMI.js";import{a as F}from"./chunk-YB3SGPFF.js";import{a as x}from"./chunk-7XQDZF73.js";import{Ga as y}from"./chunk-UZ7U322K.js";import{b as h,c as m}from"./chunk-Q6LCSRIW.js";import{B as d,I as l}from"./chunk-E24W34C4.js";import{Pb as r}from"./chunk-EYDNSYYE.js";import{r as N}from"./chunk-T6CC5WUU.js";import{e as A,g}from"./chunk-VKWPEFWQ.js";g();var s=A(N(),1);var p,a="_start",e=class extends F{async run(){let{flags:t}=await this.parse(p),n=a,{app:c}=await y({directory:t.path,userProvidedConfigName:t.config}),o=await w(c,t.path);if(t.export!==void 0)r(`Using export ${t.export} from the --export flag.`),n=t.export;else if(o.configuration.targeting!==void 0&&o.configuration.targeting.length>0){let i=o.configuration.targeting;if(i.length>1&&l({})){let b=i.map(f=>({label:f.target,value:f.export||a}));n=await d({message:"Which target would you like to execute?",choices:b})}else n=i?.[0]?.export||a,r(`Using export '${n}'. Use the --export flag or an interactive terminal to select a different export.`)}else r(`No targeting information found. Using the default export '${n}'. Use the --export flag or an interactive terminal to select a different export.`);let u=o?.configuration.targeting?.[0]?.input_query,U=u&&`${o?.directory}/${u}`,_=await v(o,t.path,t["client-id"],t.reset,t.config);return await T({functionExtension:o,json:t.json,inputPath:t.input,export:n,stdin:"inherit",schemaPath:_,queryPath:U}),{app:c}}};p=e;e.summary="Run a function locally for testing.";e.descriptionWithMarkdown="Runs the function from your current directory for [testing purposes](https://shopify.dev/docs/apps/functions/testing-and-debugging). To learn how you can monitor and debug functions when errors occur, refer to [Shopify Functions error handling](https://shopify.dev/docs/api/functions/errors).";e.description=p.descriptionWithoutMarkdown();e.flags={...h,...x,...P,...m,input:s.Flags.string({char:"i",description:"The input JSON to pass to the function. If omitted, standard input is used.",env:"SHOPIFY_FLAG_INPUT"}),export:s.Flags.string({char:"e",hidden:!1,description:"Name of the WebAssembly export to invoke.",env:"SHOPIFY_FLAG_EXPORT"})};var G=e;export{G as a};
