public function prompt(string $text, $default = null, callable $fn = null, int $retry = 3)
    {
        $error = 'Invalid value. Please try again!';

        $this->writer->yellow($text)->comment(null !== $default ? " [$default]: " : ': ');

        try {
            $input = $this->reader->read($default, $fn);
        } catch (\Exception $e) {
            $error = $e->getMessage();
        }

        if ($retry > 0 && (isset($e) || \strlen($input ?? '') === 0)) {
            $this->writer->bgRed($error, true);

            return $this->prompt($text, $default, $fn, $retry - 1);
        }

        return $input ?? $default;
    }