"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDomain = exports.isCDPDomains = exports.CDP_DOMAIN_LIST = void 0;
/**
 * CDP 缩写: chrome debug protocol
 */
const types_1 = require("tdf-devtools-protocol/dist/types");
const lodash_1 = require("lodash");
exports.CDP_DOMAIN_LIST = lodash_1.uniq(Object.values(types_1.ChromeCommand).map((command) => command.split('.')[0]));
const isCDPDomains = (domain) => exports.CDP_DOMAIN_LIST.indexOf(domain) !== -1;
exports.isCDPDomains = isCDPDomains;
/**
 * 根据调试 command 获取其所属的 domain
 */
const getDomain = (method) => {
    let domain = method;
    const group = method.match(/^(\w+)(\.\w+)?$/);
    if (group) {
        [, domain] = group;
    }
    return domain;
};
exports.getDomain = getDomain;
