'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var xvfb = require('./xvfb-CqCqXRC-.js');
var minimist = require('minimist');
var Debug = require('debug');
var cli$1 = require('./cli-MLF6G_xs.js');
var spawn = require('./spawn-DB1Wbiwy.js');
var cypress = require('./cypress-9PxR1qmG.js');
require('os');
require('bluebird');
require('@cypress/xvfb');
require('common-tags');
require('chalk');
require('lodash');
require('assert');
require('arch');
require('ospath');
require('hasha');
require('tty');
require('path');
require('ci-info');
require('execa');
require('systeminformation');
require('cachedir');
require('log-symbols');
require('executable');
require('process');
require('supports-color');
require('is-installed-globally');
require('fs-extra');
require('fs');
require('untildify');
require('commander');
require('cli-table3');
require('dayjs');
require('dayjs/plugin/relativeTime');
require('listr2');
require('timers/promises');
require('fs/promises');
require('@cypress/request');
require('request-progress');
require('proxy-from-env');
require('child_process');
require('yauzl');
require('util');
require('stream');
require('readline');
require('pretty-bytes');
require('string_decoder');
require('node:string_decoder');
require('tmp');

const debugCli = Debug('cypress:cli');
const args = minimist(process.argv.slice(2));
// we're being used from the command line
function handleExec() {
    return xvfb.__awaiter(this, void 0, void 0, function* () {
        switch (args.exec) {
            case 'install': {
                debugCli('installing Cypress from NPM');
                cli$1.installModule.start({ force: args.force })
                    .catch(xvfb.util.logErrorExit1);
                break;
            }
            case 'verify': {
                // for simple testing in the monorepo
                debugCli('verifying Cypress');
                spawn.start({ force: true }) // always force verification
                    .catch(xvfb.util.logErrorExit1);
                break;
            }
        }
    });
}
// Execute the async function
if (args.exec) {
    handleExec().catch(xvfb.util.logErrorExit1);
}
else {
    debugCli('exporting Cypress module interface');
}
// this is how the module needs to be exported to avoid a breaking change
// default exports WILL BREAK in a CJS context through a require('cypress') call
const open = cypress.open;
const run = cypress.run;
const cli = cypress.cli;
const defineConfig = cypress.defineConfig;
const defineComponentFramework = cypress.defineComponentFramework;

exports.default = cypress.cypress;
exports.cli = cli;
exports.defineComponentFramework = defineComponentFramework;
exports.defineConfig = defineConfig;
exports.open = open;
exports.run = run;
