import { handlePromptCancel } from './chunk-Z2MJFYY7.js';
import { loadToken, createInternalClientContext, widget_registry_exports } from './chunk-EEVVG764.js';
import './chunk-VI2PPUJW.js';
import './chunk-ESVT7U37.js';
import { init_esm_shims } from './chunk-RBJBODXB.js';
import { consola } from 'consola';
import { colorize } from 'consola/utils';

// src/commands/widgetset/version/delete/versionDeleteCommand.mts
init_esm_shims();
async function versionDeleteCommand({
  version,
  yes,
  widgetSet,
  foundryUrl,
  token,
  tokenFile
}) {
  if (!yes) {
    const confirmed = await consola.prompt(`Are you sure you want to delete the version ${version}?
${colorize("bold", "This action cannot be undone.")}`, {
      type: "confirm",
      cancel: "symbol"
    });
    handlePromptCancel(confirmed);
  }
  consola.start(`Deleting version ${version}`);
  const loadedToken = await loadToken(token, tokenFile);
  const tokenProvider = () => loadedToken;
  const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
  await widget_registry_exports.deleteRelease(clientCtx, widgetSet, version);
  consola.success(`Deleted version ${version}`);
}

export { versionDeleteCommand as default };
//# sourceMappingURL=versionDeleteCommand-55E6COZR.js.map
//# sourceMappingURL=versionDeleteCommand-55E6COZR.js.map