"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_2HCAA4GX_exports = {};
__export(chunk_2HCAA4GX_exports, {
  DbCommand: () => DbCommand
});
module.exports = __toCommonJS(chunk_2HCAA4GX_exports);
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
var import_internals = require("@prisma/internals");
var DbCommand = class _DbCommand {
  constructor(cmds) {
    this.cmds = cmds;
  }
  static new(cmds) {
    return new _DbCommand(cmds);
  }
  static help = (0, import_internals.format)(`
${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F  "}Manage your database schema and lifecycle during development.

${(0, import_chunk_SKRR5WT4.bold)("Usage")}

  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db [command] [options]

${(0, import_chunk_SKRR5WT4.bold)("Options")}

  -h, --help   Display this help message
    --config   Custom path to your Prisma config file
    --schema   Custom path to your Prisma schema

${(0, import_chunk_SKRR5WT4.bold)("Commands")}
     pull   Pull the state from the database to the Prisma schema using introspection
     push   Push the state from Prisma schema to the database during prototyping
     seed   Seed your database
  execute   Execute native commands to your database

${(0, import_chunk_SKRR5WT4.bold)("Examples")}

  Run \`prisma db pull\`
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull

  Run \`prisma db push\`
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db push

  Run \`prisma db seed\`
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed

  Run \`prisma db execute\`
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
`);
  async parse(argv, config, baseDir) {
    const args = (0, import_internals.arg)(argv, {
      "--help": Boolean,
      "-h": "--help",
      "--config": String,
      "--preview-feature": Boolean,
      "--telemetry-information": String
    });
    if ((0, import_internals.isError)(args)) {
      return this.help(args.message);
    }
    if (args._.length === 0 || args["--help"]) {
      return this.help();
    }
    const cmd = this.cmds[args._[0]];
    if (cmd) {
      const argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
      return cmd.parse(argsForCmd, config, baseDir);
    }
    return (0, import_internals.unknownCommand)(_DbCommand.help, args._[0]);
  }
  help(error) {
    if (error) {
      return new import_internals.HelpError(`
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
${_DbCommand.help}`);
    }
    return _DbCommand.help;
  }
};
