"use strict";
/*
 * @poppinss/prompts
 *
 * (c) Harminder Virk <virk@adonisjs.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnquirerPrompt = void 0;
const enquirer_1 = __importDefault(require("enquirer"));
const Base_1 = require("./Base");
/**
 * Since the typings for `enquirer` package is badly broken, we
 * need to cast it to any to make it usable
 */
const enquirer = enquirer_1.default;
/**
 * Uses the `enquirer` package to prompt user for input. The `$prompt`
 * method is invoked by the extended `Prompt` class.
 */
class EnquirerPrompt extends Base_1.Prompt {
    async prompt(options) {
        options = Object.assign({ name: 'prompt' }, options);
        const output = await enquirer.prompt(options);
        return output[options.name];
    }
}
exports.EnquirerPrompt = EnquirerPrompt;
