class BjcCov {
    coverage: {
        [key: string]: string | number;
    };
    constructor(covData: object) {
        const gcv = "__coverage__";
        let coverage = globalThis[gcv] || (globalThis[gcv] = /** 线上生产环境。 */ {});
        if (!coverage[covData.path] && true) {
            coverage[covData.path] = covData;
        }
        this.coverage = coverage[covData.path];
    }
    instrumentFunction(func: number) {
        this.coverage.functions[func].count++;
        this.coverage.functions[func].regions[0].count++;
    }
    instrumentRegion(func: number, region: number) {
        this.coverage.functions[func].regions[region].count++;
    }
    instrumentReturn(func: number, retIdx: number) {
        this.coverage.functions[func].returnes[retIdx].count++;
    }
    instrumentBranch(func: number, branch: number, trueOrFalse: boolean) {
        if (trueOrFalse) {
            this.coverage.functions[func].branches[branch].trueCount++;
            for (let r of Object.values(this.coverage.functions[func].branches[branch].group)) {
                if (r !== branch) {
                    this.coverage.functions[func].branches[r as number].falseCount++;
                }
            }
        }
        else {
            this.coverage.functions[func].branches[branch].falseCount++;
        }
    }
}
let bjccovms5u83r8 = new BjcCov({ version: "bjc v1.0.0", versionCode: 10000, path: "tencentqianwebview/src/main/ets/model/PrewarmEnvironment.ets", hash: "00a776bdb85c239ffd36f3f913174cb5bcce7dcd0d9f3390e0c9b5c7e6b47592", lineCnt: 62, count: 0, projectPath: "", functions: { 0: { name: "manifestUrlOf", count: 0, regions: { 0: { startLoc: { line: 19, col: 1 }, endLoc: { line: 29, col: 2 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 21, col: 5 }, endLoc: { line: 22, col: 80 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 23, col: 5 }, endLoc: { line: 24, col: 79 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 25, col: 5 }, endLoc: { line: 25, col: 34 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 26, col: 5 }, endLoc: { line: 27, col: 75 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 21, col: 10 }, endLoc: { line: 21, col: 33 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 }, 1: { startLoc: { line: 23, col: 10 }, endLoc: { line: 23, col: 33 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 }, 2: { startLoc: { line: 25, col: 10 }, endLoc: { line: 25, col: 33 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 }, 3: { startLoc: { line: 26, col: 5 }, endLoc: { line: 26, col: 5 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 } }, ignored: 0, index: 0 }, 1: { name: "knownQuickHostOf", count: 0, regions: { 0: { startLoc: { line: 34, col: 1 }, endLoc: { line: 44, col: 2 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 36, col: 5 }, endLoc: { line: 37, col: 43 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 38, col: 5 }, endLoc: { line: 39, col: 43 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 40, col: 5 }, endLoc: { line: 40, col: 34 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 41, col: 5 }, endLoc: { line: 42, col: 39 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 36, col: 10 }, endLoc: { line: 36, col: 33 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 }, 1: { startLoc: { line: 38, col: 10 }, endLoc: { line: 38, col: 33 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 }, 2: { startLoc: { line: 40, col: 10 }, endLoc: { line: 40, col: 33 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 }, 3: { startLoc: { line: 41, col: 5 }, endLoc: { line: 41, col: 5 }, trueCount: 0, falseCount: 0, group: { 0: 0, 1: 1, 2: 2, 3: 3 }, ignored: 0 } }, ignored: 0, index: 1 }, 2: { name: "environmentOfHost", count: 0, regions: { 0: { startLoc: { line: 49, col: 1 }, endLoc: { line: 61, col: 2 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 51, col: 39 }, endLoc: { line: 53, col: 4 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 54, col: 43 }, endLoc: { line: 56, col: 4 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 57, col: 43 }, endLoc: { line: 59, col: 4 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 60, col: 3 }, endLoc: { line: 61, col: 2 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 51, col: 7 }, endLoc: { line: 51, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 54, col: 7 }, endLoc: { line: 54, col: 41 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 2: { startLoc: { line: 57, col: 7 }, endLoc: { line: 57, col: 41 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 2 } }, exeLine: { 0: 7, 1: 9, 2: 11, 3: 13, 4: 19, 5: 20, 6: 21, 7: 22, 8: 23, 9: 24, 10: 25, 11: 26, 12: 27, 13: 34, 14: 35, 15: 36, 16: 37, 17: 38, 18: 39, 19: 40, 20: 41, 21: 42, 22: 49, 23: 50, 24: 51, 25: 52, 26: 54, 27: 55, 28: 57, 29: 58, 30: 60 } });
/**
 * 预热目标环境（三端统一）。
 *
 * 环境只决定"拉哪个 manifest URL"，下游 hosts / warmupUrl 由 manifest 内容自描述，
 * SDK 不硬编码任何业务 host。`PrewarmConfig.manifestUrl` 若显式传入则优先级更高。
 */
export enum PrewarmEnvironment {
    /** 线上生产环境。 */
    PROD = 0,
    /** 客户联调 beta 环境。 */
    BETA = 1,
    /** 内部开发 test 环境。 */
    TEST = 2
}
/**
 * 各环境内置 manifest URL 映射。
 */
export function manifestUrlOf(env: PrewarmEnvironment): string {
    bjccovms5u83r8.instrumentFunction(0);
    switch (env) {
        case PrewarmEnvironment.BETA:
            bjccovms5u83r8.instrumentBranch(0, 0, true);
            bjccovms5u83r8.instrumentRegion(0, 1);
            return 'https://res.ess.tencent.cn/cdn/h5-std-beta/warmup-manifest.json';
        case PrewarmEnvironment.TEST:
            bjccovms5u83r8.instrumentBranch(0, 1, true);
            bjccovms5u83r8.instrumentRegion(0, 2);
            return 'https://res.ess.tencent.cn/cdn/h5-std-dev/warmup-manifest.json';
        case PrewarmEnvironment.PROD:
            bjccovms5u83r8.instrumentBranch(0, 2, true);
            bjccovms5u83r8.instrumentRegion(0, 3);
        default:
            bjccovms5u83r8.instrumentBranch(0, 3, true);
            bjccovms5u83r8.instrumentRegion(0, 4);
            return 'https://res.ess.tencent.cn/cdn/h5-std/warmup-manifest.json';
    }
}
/**
 * 各环境已知的 `quick.*` 入口 host（用于 `open()` 环境错配检测）。
 */
export function knownQuickHostOf(env: PrewarmEnvironment): string {
    bjccovms5u83r8.instrumentFunction(1);
    switch (env) {
        case PrewarmEnvironment.BETA:
            bjccovms5u83r8.instrumentBranch(1, 0, true);
            bjccovms5u83r8.instrumentRegion(1, 1);
            return 'quick.beta.qian.tencent.cn';
        case PrewarmEnvironment.TEST:
            bjccovms5u83r8.instrumentBranch(1, 1, true);
            bjccovms5u83r8.instrumentRegion(1, 2);
            return 'quick.test.qian.tencent.cn';
        case PrewarmEnvironment.PROD:
            bjccovms5u83r8.instrumentBranch(1, 2, true);
            bjccovms5u83r8.instrumentRegion(1, 3);
        default:
            bjccovms5u83r8.instrumentBranch(1, 3, true);
            bjccovms5u83r8.instrumentRegion(1, 4);
            return 'quick.qian.tencent.com';
    }
}
/**
 * 反查某 host 属于哪个已知环境；非 3 个已知 `quick.*` host 返回 `null`。
 */
export function environmentOfHost(host: string): PrewarmEnvironment | null {
    bjccovms5u83r8.instrumentFunction(2);
    const h: string = host.toLowerCase();
    if (h === 'quick.qian.tencent.com') {
        bjccovms5u83r8.instrumentBranch(2, 0, true);
        bjccovms5u83r8.instrumentRegion(2, 1);
        return PrewarmEnvironment.PROD;
    }
    else {
        bjccovms5u83r8.instrumentBranch(2, 0, false);
    }
    if (h === 'quick.beta.qian.tencent.cn') {
        bjccovms5u83r8.instrumentBranch(2, 1, true);
        bjccovms5u83r8.instrumentRegion(2, 2);
        return PrewarmEnvironment.BETA;
    }
    else {
        bjccovms5u83r8.instrumentBranch(2, 1, false);
    }
    if (h === 'quick.test.qian.tencent.cn') {
        bjccovms5u83r8.instrumentBranch(2, 2, true);
        bjccovms5u83r8.instrumentRegion(2, 3);
        return PrewarmEnvironment.TEST;
    }
    else {
        bjccovms5u83r8.instrumentBranch(2, 2, false);
    }
    bjccovms5u83r8.instrumentRegion(2, 4);
    return null;
}
