import connection from "@ohos:net.connection";
import webview from "@ohos:web.webview";
import type { UIContext } from "@ohos:arkui.UIContext";
import type common from "@ohos:app.ability.common";
import AbilityConstant from "@ohos:app.ability.AbilityConstant";
import type EnvironmentCallback from "@ohos:app.ability.EnvironmentCallback";
import type { Configuration } from "@ohos:app.ability.Configuration";
import { PrewarmLevel } from "@normalized:N&&&tencentqianwebview/src/main/ets/model/PrewarmLevel&1.0.0";
import { manifestUrlOf, environmentOfHost } from "@normalized:N&&&tencentqianwebview/src/main/ets/model/PrewarmEnvironment&1.0.0";
import type { PrewarmEnvironment } from "@normalized:N&&&tencentqianwebview/src/main/ets/model/PrewarmEnvironment&1.0.0";
import { PrewarmConfig } from "@normalized:N&&&tencentqianwebview/src/main/ets/model/PrewarmConfig&1.0.0";
import type { WarmupManifest, WarmupBizType } from './internal/prewarm/WarmupManifest';
import { ManifestStore } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/prewarm/ManifestStore&1.0.0";
import { PrewarmDedup } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/prewarm/PrewarmDedup&1.0.0";
import { HarmonyWebViewPool } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/prewarm/HarmonyWebViewPool&1.0.0";
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 bjccovms5u83p6 = new BjcCov({ version: "bjc v1.0.0", versionCode: 10000, path: "tencentqianwebview/src/main/ets/TencentQianWebViewPrewarmer.ets", hash: "ddb7534191ccc8b55d1e54d8f0b0dcaabbc1e8a2f1aaf19b9da6ffc51c9d94b5", lineCnt: 380, count: 0, projectPath: "", functions: { 0: { name: "TencentQianWebViewPrewarmer.configure", count: 0, regions: { 0: { startLoc: { line: 58, col: 3 }, endLoc: { line: 83, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 61, col: 27 }, endLoc: { line: 64, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 65, col: 5 }, endLoc: { line: 83, col: 4 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 59, col: 32 }, endLoc: { line: 59, col: 102 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 61, col: 9 }, endLoc: { line: 61, col: 25 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 2: { startLoc: { line: 70, col: 25 }, endLoc: { line: 72, col: 39 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 0 }, 1: { name: "anonymous_0", count: 0, regions: { 0: { startLoc: { line: 74, col: 58 }, endLoc: { line: 76, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 75, col: 7 }, endLoc: { line: 76, col: 6 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 1 }, 2: { name: "TencentQianWebViewPrewarmer.prewarm", count: 0, regions: { 0: { startLoc: { line: 92, col: 3 }, endLoc: { line: 107, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 94, col: 50 }, endLoc: { line: 96, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 98, col: 5 }, endLoc: { line: 107, col: 4 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 104, col: 7 }, endLoc: { line: 106, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 94, col: 9 }, endLoc: { line: 94, col: 48 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 98, col: 24 }, endLoc: { line: 98, col: 80 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 2 }, 3: { name: "anonymous_1", count: 0, regions: { 0: { startLoc: { line: 100, col: 51 }, endLoc: { line: 106, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 101, col: 68 }, endLoc: { line: 103, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 101, col: 11 }, endLoc: { line: 101, col: 66 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 3 }, 4: { name: "TencentQianWebViewPrewarmer.release", count: 0, regions: { 0: { startLoc: { line: 110, col: 3 }, endLoc: { line: 112, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 111, col: 5 }, endLoc: { line: 112, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 4 }, 5: { name: "TencentQianWebViewPrewarmer.releaseAll", count: 0, regions: { 0: { startLoc: { line: 115, col: 3 }, endLoc: { line: 118, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 116, col: 5 }, endLoc: { line: 118, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 5 }, 6: { name: "TencentQianWebViewPrewarmer.currentEnvironment", count: 0, regions: { 0: { startLoc: { line: 121, col: 3 }, endLoc: { line: 123, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 122, col: 5 }, endLoc: { line: 123, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 6 }, 7: { name: "TencentQianWebViewPrewarmer.isConfigured", count: 0, regions: { 0: { startLoc: { line: 126, col: 3 }, endLoc: { line: 128, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 127, col: 5 }, endLoc: { line: 128, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 7 }, 8: { name: "TencentQianWebViewPrewarmer.getMenuBizTypes", count: 0, regions: { 0: { startLoc: { line: 142, col: 3 }, endLoc: { line: 152, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 143, col: 50 }, endLoc: { line: 145, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 146, col: 5 }, endLoc: { line: 152, col: 4 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 150, col: 7 }, endLoc: { line: 151, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 143, col: 9 }, endLoc: { line: 143, col: 48 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 8 }, 9: { name: "anonymous_2", count: 0, regions: { 0: { startLoc: { line: 142, col: 43 }, endLoc: { line: 142, col: 71 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 9 }, 10: { name: "anonymous_3", count: 0, regions: { 0: { startLoc: { line: 146, col: 51 }, endLoc: { line: 151, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 147, col: 30 }, endLoc: { line: 149, col: 41 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 10 }, 11: { name: "TencentQianWebViewPrewarmer.warnIfEnvironmentMismatch", count: 0, regions: { 0: { startLoc: { line: 160, col: 3 }, endLoc: { line: 174, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 161, col: 50 }, endLoc: { line: 163, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 166, col: 23 }, endLoc: { line: 168, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 169, col: 65 }, endLoc: { line: 173, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 161, col: 9 }, endLoc: { line: 161, col: 48 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 166, col: 9 }, endLoc: { line: 166, col: 21 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 2: { startLoc: { line: 169, col: 9 }, endLoc: { line: 169, col: 63 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 11 }, 12: { name: "TencentQianWebViewPrewarmer.lazyInit", count: 0, regions: { 0: { startLoc: { line: 178, col: 3 }, endLoc: { line: 185, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 179, col: 5 }, endLoc: { line: 185, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 12 }, 13: { name: "anonymous_4", count: 0, regions: { 0: { startLoc: { line: 182, col: 58 }, endLoc: { line: 184, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 183, col: 7 }, endLoc: { line: 184, col: 6 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 13 }, 14: { name: "TencentQianWebViewPrewarmer.execute", count: 0, regions: { 0: { startLoc: { line: 190, col: 3 }, endLoc: { line: 214, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 196, col: 41 }, endLoc: { line: 198, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 204, col: 39 }, endLoc: { line: 206, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 210, col: 28 }, endLoc: { line: 212, col: 6 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 213, col: 5 }, endLoc: { line: 214, col: 4 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 196, col: 9 }, endLoc: { line: 196, col: 39 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 204, col: 9 }, endLoc: { line: 204, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 2: { startLoc: { line: 210, col: 9 }, endLoc: { line: 210, col: 26 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 14 }, 15: { name: "TencentQianWebViewPrewarmer.warmPool", count: 0, regions: { 0: { startLoc: { line: 220, col: 3 }, endLoc: { line: 244, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 221, col: 83 }, endLoc: { line: 223, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 224, col: 56 }, endLoc: { line: 228, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 233, col: 9 }, endLoc: { line: 241, col: 6 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 241, col: 7 }, endLoc: { line: 243, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 221, col: 9 }, endLoc: { line: 221, col: 81 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 224, col: 9 }, endLoc: { line: 224, col: 54 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 15 }, 16: { name: "TencentQianWebViewPrewarmer.registerMemoryCallbackOnce", count: 0, regions: { 0: { startLoc: { line: 258, col: 3 }, endLoc: { line: 286, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 259, col: 63 }, endLoc: { line: 261, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 262, col: 9 }, endLoc: { line: 282, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 282, col: 7 }, endLoc: { line: 285, col: 6 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 264, col: 62 }, endLoc: { line: 266, col: 8 }, count: 0, ignored: 0 }, 5: { startLoc: { line: 267, col: 7 }, endLoc: { line: 282, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 259, col: 9 }, endLoc: { line: 259, col: 61 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 264, col: 11 }, endLoc: { line: 264, col: 60 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 16 }, 17: { name: "anonymous_5", count: 0, regions: { 0: { startLoc: { line: 269, col: 24 }, endLoc: { line: 275, col: 10 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 270, col: 75 }, endLoc: { line: 274, col: 12 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 271, col: 53 }, endLoc: { line: 273, col: 14 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 270, col: 15 }, endLoc: { line: 270, col: 73 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 271, col: 17 }, endLoc: { line: 271, col: 51 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 17 }, 18: { name: "anonymous_6", count: 0, regions: { 0: { startLoc: { line: 276, col: 33 }, endLoc: { line: 278, col: 10 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 18 }, 19: { name: "TencentQianWebViewPrewarmer.appendLang", count: 0, regions: { 0: { startLoc: { line: 292, col: 3 }, endLoc: { line: 298, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 293, col: 45 }, endLoc: { line: 295, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 296, col: 5 }, endLoc: { line: 298, col: 4 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 293, col: 9 }, endLoc: { line: 293, col: 43 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 296, col: 25 }, endLoc: { line: 296, col: 58 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 19 }, 20: { name: "TencentQianWebViewPrewarmer.ensureWebEngineInitialized", count: 0, regions: { 0: { startLoc: { line: 301, col: 3 }, endLoc: { line: 311, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 302, col: 59 }, endLoc: { line: 304, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 305, col: 9 }, endLoc: { line: 308, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 308, col: 7 }, endLoc: { line: 310, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 302, col: 9 }, endLoc: { line: 302, col: 57 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 20 }, 21: { name: "TencentQianWebViewPrewarmer.prefetchDns", count: 0, regions: { 0: { startLoc: { line: 314, col: 3 }, endLoc: { line: 328, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 315, col: 5 }, endLoc: { line: 328, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 21 }, 22: { name: "anonymous_7", count: 0, regions: { 0: { startLoc: { line: 315, col: 19 }, endLoc: { line: 327, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 317, col: 30 }, endLoc: { line: 319, col: 8 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 320, col: 11 }, endLoc: { line: 324, col: 8 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 324, col: 9 }, endLoc: { line: 326, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 317, col: 11 }, endLoc: { line: 317, col: 28 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 22 }, 23: { name: "anonymous_8", count: 0, regions: { 0: { startLoc: { line: 321, col: 51 }, endLoc: { line: 323, col: 10 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 23 }, 24: { name: "preconnectHosts", count: 0, regions: { 0: { startLoc: { line: 331, col: 3 }, endLoc: { line: 345, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 332, col: 5 }, endLoc: { line: 345, col: 4 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 340, col: 9 }, endLoc: { line: 341, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 24 }, 25: { name: "anonymous_9", count: 0, regions: { 0: { startLoc: { line: 332, col: 19 }, endLoc: { line: 344, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 334, col: 29 }, endLoc: { line: 336, col: 8 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 337, col: 11 }, endLoc: { line: 341, col: 8 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 341, col: 9 }, endLoc: { line: 343, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 334, col: 11 }, endLoc: { line: 334, col: 27 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 25 }, 26: { name: "TencentQianWebViewPrewarmer.hostOf", count: 0, regions: { 0: { startLoc: { line: 348, col: 3 }, endLoc: { line: 363, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 351, col: 25 }, endLoc: { line: 353, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 355, col: 21 }, endLoc: { line: 357, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 359, col: 21 }, endLoc: { line: 361, col: 6 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 362, col: 5 }, endLoc: { line: 363, col: 4 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 351, col: 9 }, endLoc: { line: 351, col: 23 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 355, col: 9 }, endLoc: { line: 355, col: 19 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 2: { startLoc: { line: 359, col: 9 }, endLoc: { line: 359, col: 19 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 26 }, 27: { name: "TencentQianWebViewPrewarmer.rootUrlOf", count: 0, regions: { 0: { startLoc: { line: 366, col: 3 }, endLoc: { line: 375, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 368, col: 25 }, endLoc: { line: 370, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 371, col: 32 }, endLoc: { line: 373, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 374, col: 5 }, endLoc: { line: 375, col: 4 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 368, col: 9 }, endLoc: { line: 368, col: 23 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 371, col: 9 }, endLoc: { line: 371, col: 30 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 27 }, 28: { name: "TencentQianWebViewPrewarmer.constructor", count: 0, regions: { 0: { startLoc: { line: 378, col: 3 }, endLoc: { line: 378, col: 27 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 28 } }, exeLine: { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7, 7: 8, 8: 9, 9: 10, 10: 11, 11: 12, 12: 13, 13: 14, 14: 41, 15: 42, 16: 43, 17: 44, 18: 45, 19: 47, 20: 49, 21: 58, 22: 59, 23: 61, 24: 62, 25: 63, 26: 65, 27: 66, 28: 67, 29: 70, 30: 71, 31: 72, 32: 73, 33: 74, 34: 75, 35: 79, 36: 82, 37: 92, 38: 94, 39: 95, 40: 98, 41: 100, 42: 101, 43: 102, 44: 104, 45: 105, 46: 110, 47: 111, 48: 115, 49: 116, 50: 117, 51: 121, 52: 122, 53: 126, 54: 127, 55: 142, 56: 143, 57: 144, 58: 146, 59: 147, 60: 148, 61: 149, 62: 150, 63: 160, 64: 161, 65: 162, 66: 164, 67: 165, 68: 166, 69: 167, 70: 169, 71: 170, 72: 171, 73: 172, 74: 178, 75: 179, 76: 180, 77: 181, 78: 182, 79: 183, 80: 190, 81: 192, 82: 194, 83: 196, 84: 197, 85: 201, 86: 202, 87: 204, 88: 205, 89: 209, 90: 210, 91: 211, 92: 213, 93: 220, 94: 221, 95: 222, 96: 224, 97: 225, 98: 226, 99: 227, 100: 229, 101: 230, 102: 231, 103: 233, 104: 234, 105: 235, 106: 236, 107: 237, 108: 238, 109: 239, 110: 241, 111: 258, 112: 259, 113: 260, 114: 262, 115: 263, 116: 264, 117: 265, 118: 267, 119: 268, 120: 269, 121: 270, 122: 271, 123: 272, 124: 276, 125: 280, 126: 281, 127: 282, 128: 284, 129: 292, 130: 293, 131: 294, 132: 296, 133: 297, 134: 301, 135: 302, 136: 303, 137: 305, 138: 306, 139: 307, 140: 308, 141: 314, 142: 315, 143: 316, 144: 317, 145: 318, 146: 320, 147: 321, 148: 324, 149: 331, 150: 332, 151: 333, 152: 334, 153: 335, 154: 337, 155: 339, 156: 340, 157: 341, 158: 348, 159: 349, 160: 350, 161: 351, 162: 352, 163: 354, 164: 355, 165: 356, 166: 358, 167: 359, 168: 360, 169: 362, 170: 366, 171: 367, 172: 368, 173: 369, 174: 371, 175: 372, 176: 374, 177: 378 } });
/**
 * **WebView 预热统一入口**（三端对齐）。
 *
 * 两个正交维度：
 * - 网络/内核预热（DNS / 内核初始化 / 连接 / warmupUrl）——省网络与内核首次初始化时间。
 * - 实例池——省 WebView 创建时间（HEAVY 离屏建组件，容器复用）。
 *
 * **档位语义**：
 * - `MINIMAL`：仅 DNS 预解析（三端一致，纯地基）。
 * - `LIGHT`：把内核首次初始化提前——`initializeWebEngine`（幂等/主线程）+ `prepareForPageLoad` 预连接；**不建池**。
 * - `HEAVY`：离屏池（`NodeController`+`BuilderNode`）加载 `warmupUrl` 热网络（**需 `uiContext`**）。
 *
 * 档位叠加：高档位补做未做的低档动作（DNS → 内核预初始化 → warmupUrl），低档动作均幂等。
 *
 * **典型用法**：
 * ```ts
 * // App 启动
 * TencentQianWebViewPrewarmer.configure();
 * TencentQianWebViewPrewarmer.prewarm(PrewarmLevel.MINIMAL);
 * // 列表曝光 / 已知业务
 * TencentQianWebViewPrewarmer.prewarm(PrewarmLevel.LIGHT, 'single-sign');
 * // 强意图（HEAVY 需传 UIContext 以建离屏池）
 * TencentQianWebViewPrewarmer.prewarm(PrewarmLevel.HEAVY, 'single-sign', uiContext);
 * ```
 */
export class TencentQianWebViewPrewarmer {
    private static store: ManifestStore = new ManifestStore();
    private static dedup: PrewarmDedup = new PrewarmDedup();
    private static config: PrewarmConfig = new PrewarmConfig();
    private static configured: boolean = false;
    /** Web 引擎是否已初始化（全局一次，幂等）。 */
    private static webEngineInitialized: boolean = false;
    /** 内存回调是否已注册（幂等守卫，避免多次开池重复注册）。 */
    private static memoryCallbackRegistered: boolean = false;
    /**
     * 全局配置。App 启动时调用；触发 manifest 后台异步拉取（不阻塞）。
     *
     * 可省——未调用时首次 `prewarm` / `getMenuBizTypes` 会以默认配置（PROD）懒初始化。
     *
     * @param config 预热配置，可省
     */
    public static configure(config?: PrewarmConfig): void {
        bjccovms5u83p6.instrumentFunction(0);
        const cfg: PrewarmConfig = config !== undefined && config !== null ? (bjccovms5u83p6.instrumentBranch(0, 0, true), config) : (bjccovms5u83p6.instrumentBranch(0, 0, false), new PrewarmConfig());
        // poolSize clamp（v1 恒为 1）
        if (cfg.poolSize > 1) {
            bjccovms5u83p6.instrumentBranch(0, 1, true);
            bjccovms5u83p6.instrumentRegion(0, 1);
            console.warn('[TencentQianWebViewPrewarmer] poolSize > 1 not supported in v1, clamped to 1');
            cfg.poolSize = 1;
        }
        else {
            bjccovms5u83p6.instrumentBranch(0, 1, false);
        }
        bjccovms5u83p6.instrumentRegion(0, 2);
        TencentQianWebViewPrewarmer.config = cfg;
        TencentQianWebViewPrewarmer.configured = true;
        HarmonyWebViewPool.setEnabled(cfg.enablePool);
        // manifest URL：显式覆盖优先，否则按环境映射
        const url: string = cfg.manifestUrl !== null && cfg.manifestUrl.length > 0
            ? (bjccovms5u83p6.instrumentBranch(0, 2, true), cfg.manifestUrl) : (bjccovms5u83p6.instrumentBranch(0, 2, false), manifestUrlOf(cfg.environment));
        TencentQianWebViewPrewarmer.store.setManifestUrl(url);
        TencentQianWebViewPrewarmer.store.onVersionChanged = (_m: WarmupManifest): void => {
            bjccovms5u83p6.instrumentFunction(1);
            bjccovms5u83p6.instrumentRegion(1, 1);
            TencentQianWebViewPrewarmer.dedup.reset();
        };
        // 初始化 Web 引擎（幂等，主线程；提前到启动空闲，best-effort）
        TencentQianWebViewPrewarmer.ensureWebEngineInitialized();
        // 后台异步拉取 manifest
        TencentQianWebViewPrewarmer.store.ensureFresh();
    }
    /**
     * 按意图档位触发预热，可多次调用（内部单调去重）。
     *
     * @param level 预热档位
     * @param bizType 业务类型；`MINIMAL` 可省，`LIGHT`/`HEAVY` 必填
     * @param uiContext UI 上下文；**仅 `HEAVY` 建离屏池时必需**（`windowStage.getMainWindowSync().getUIContext()` / 页面内 `this.getUIContext()`）
     */
    public static prewarm(level: PrewarmLevel, bizType?: string, uiContext?: UIContext): void {
        bjccovms5u83p6.instrumentFunction(2);
        // 懒初始化（configure 可省）
        if (!TencentQianWebViewPrewarmer.configured) {
            bjccovms5u83p6.instrumentBranch(2, 0, true);
            bjccovms5u83p6.instrumentRegion(2, 1);
            TencentQianWebViewPrewarmer.lazyInit();
        }
        // bizType 允许为空：空时预热公共资源（warmup.html 加载公共部分），去重按空 key 记账
        else {
            bjccovms5u83p6.instrumentBranch(2, 0, false);
        }
        bjccovms5u83p6.instrumentRegion(2, 2);
        // bizType 允许为空：空时预热公共资源（warmup.html 加载公共部分），去重按空 key 记账
        const bt: string = bizType !== undefined && bizType !== null ? (bjccovms5u83p6.instrumentBranch(2, 1, true), bizType) : (bjccovms5u83p6.instrumentBranch(2, 1, false), '');
        // 先用缓存（可能略旧）立即预热；缺失则排队 replay；过期则后台重拉（SWR）
        TencentQianWebViewPrewarmer.store.ensureFresh((manifest: WarmupManifest, _changed: boolean): void => {
            bjccovms5u83p6.instrumentFunction(3);
            if (!TencentQianWebViewPrewarmer.dedup.shouldRun(level, bt)) {
                bjccovms5u83p6.instrumentBranch(3, 0, true);
                bjccovms5u83p6.instrumentRegion(3, 1);
                return;
            }
            else {
                bjccovms5u83p6.instrumentBranch(3, 0, false);
            }
            bjccovms5u83p6.instrumentRegion(2, 3);
            TencentQianWebViewPrewarmer.execute(level, bt, manifest, uiContext);
            TencentQianWebViewPrewarmer.dedup.markDone(level, bt);
        });
    }
    /** 释放预热资源（鸿蒙一次性池：销毁离屏实例）。 */
    public static release(): void {
        bjccovms5u83p6.instrumentFunction(4);
        bjccovms5u83p6.instrumentRegion(4, 1);
        HarmonyWebViewPool.release();
    }
    /** 释放所有预热资源并重置状态。 */
    public static releaseAll(): void {
        bjccovms5u83p6.instrumentFunction(5);
        bjccovms5u83p6.instrumentRegion(5, 1);
        HarmonyWebViewPool.release();
        TencentQianWebViewPrewarmer.dedup.reset();
    }
    /** 当前配置的目标环境（供 open() 环境错配检测）。 */
    public static currentEnvironment(): PrewarmEnvironment {
        bjccovms5u83p6.instrumentFunction(6);
        bjccovms5u83p6.instrumentRegion(6, 1);
        return TencentQianWebViewPrewarmer.config.environment;
    }
    /** 是否已配置（供 open() 判断是否需要做错配检测）。 */
    public static isConfigured(): boolean {
        bjccovms5u83p6.instrumentFunction(7);
        bjccovms5u83p6.instrumentRegion(7, 1);
        return TencentQianWebViewPrewarmer.configured;
    }
    /**
     * 一次性获取 manifest 中的 bizType 列表。
     *
     * - manifest 已缓存 → 立即回调
     * - manifest 拉取中 → 排队，拉取完成后回调一次
     * - 拉取失败 → 不回调（调用方需自行兜底）
     *
     * 未调用 `configure` 时会以默认配置（PROD）懒初始化，确保 manifestUrl 已设置，
     * 避免 callback 滞留在 pending 队列中。
     *
     * @param callback 回调，参数为 manifest 中的 bizType key 列表
     */
    public static getMenuBizTypes(callback: (bizTypes: string[]) => void): void {
        bjccovms5u83p6.instrumentFunction(8);
        if (!TencentQianWebViewPrewarmer.configured) {
            bjccovms5u83p6.instrumentBranch(8, 0, true);
            bjccovms5u83p6.instrumentRegion(8, 1);
            TencentQianWebViewPrewarmer.lazyInit();
        }
        else {
            bjccovms5u83p6.instrumentBranch(8, 0, false);
        }
        bjccovms5u83p6.instrumentRegion(8, 2);
        TencentQianWebViewPrewarmer.store.ensureFresh((manifest: WarmupManifest, _changed: boolean): void => {
            bjccovms5u83p6.instrumentFunction(10);
            const list: string[] = manifest.menuBizTypes !== undefined && manifest.menuBizTypes !== null
                ? (bjccovms5u83p6.instrumentBranch(10, 0, true), manifest.menuBizTypes) : (bjccovms5u83p6.instrumentBranch(10, 0, false), Object.keys(manifest.bizTypes));
            bjccovms5u83p6.instrumentRegion(8, 3);
            callback(list);
        });
    }
    /**
     * `open(url)` 环境错配检测（best-effort，仅告警）。
     *
     * 仅当 url host 命中 3 个已知 `quick.*` 环境之一、且与配置环境不一致时才 log 警告；
     * 非 `quick.*` 域名（客户自有/其他）不告警——`open()` 本就支持任意域名。
     */
    public static warnIfEnvironmentMismatch(url: string): void {
        bjccovms5u83p6.instrumentFunction(11);
        if (!TencentQianWebViewPrewarmer.configured) {
            bjccovms5u83p6.instrumentBranch(11, 0, true);
            bjccovms5u83p6.instrumentRegion(11, 1);
            return;
        }
        else {
            bjccovms5u83p6.instrumentBranch(11, 0, false);
        }
        const host: string = TencentQianWebViewPrewarmer.hostOf(url);
        const env: PrewarmEnvironment | null = environmentOfHost(host);
        if (env === null) {
            bjccovms5u83p6.instrumentBranch(11, 1, true);
            bjccovms5u83p6.instrumentRegion(11, 2);
            return;
        }
        else {
            bjccovms5u83p6.instrumentBranch(11, 1, false);
        }
        if (env !== TencentQianWebViewPrewarmer.config.environment) {
            bjccovms5u83p6.instrumentBranch(11, 2, true);
            bjccovms5u83p6.instrumentRegion(11, 3);
            console.warn('[TencentQianWebViewPrewarmer] environment mismatch: configured='
                + TencentQianWebViewPrewarmer.config.environment + ' but open() host indicates ' + env
                + ' — prewarm cache may miss');
        }
        else // ────────── 内部 ──────────
         {
            bjccovms5u83p6.instrumentBranch(11, 2, false);
        }
    }
    // ────────── 内部 ──────────
    private static lazyInit(): void {
        bjccovms5u83p6.instrumentFunction(12);
        bjccovms5u83p6.instrumentRegion(12, 1);
        TencentQianWebViewPrewarmer.configured = true;
        const url: string = manifestUrlOf(TencentQianWebViewPrewarmer.config.environment);
        TencentQianWebViewPrewarmer.store.setManifestUrl(url);
        TencentQianWebViewPrewarmer.store.onVersionChanged = (_m: WarmupManifest): void => {
            bjccovms5u83p6.instrumentFunction(13);
            bjccovms5u83p6.instrumentRegion(13, 1);
            TencentQianWebViewPrewarmer.dedup.reset();
        };
    }
    /**
     * 执行某档位的实际预热动作（档位叠加：高档补做未做的低档动作，低档动作幂等）。
     */
    private static execute(level: PrewarmLevel, bizType: string, manifest: WarmupManifest, uiContext?: UIContext): void {
        bjccovms5u83p6.instrumentFunction(14);
        // ── 全局层：DNS（所有档位地基）──
        TencentQianWebViewPrewarmer.prefetchDns(manifest.hosts);
        // 任意档位做完全局 DNS 即视为 MINIMAL 已达，避免后续 MINIMAL 重复跑
        TencentQianWebViewPrewarmer.dedup.markDone(PrewarmLevel.MINIMAL, '');
        if (level === PrewarmLevel.MINIMAL) {
            bjccovms5u83p6.instrumentBranch(14, 0, true);
            bjccovms5u83p6.instrumentRegion(14, 1);
            return; // MINIMAL：仅 DNS
        }
        // ── LIGHT 层：内核首次初始化 + 连接预热（HEAVY 叠加）──
        else {
            bjccovms5u83p6.instrumentBranch(14, 0, false);
        }
        // ── LIGHT 层：内核首次初始化 + 连接预热（HEAVY 叠加）──
        TencentQianWebViewPrewarmer.ensureWebEngineInitialized();
        TencentQianWebViewPrewarmer.preconnectHosts(manifest.hosts);
        if (level === PrewarmLevel.LIGHT) {
            bjccovms5u83p6.instrumentBranch(14, 1, true);
            bjccovms5u83p6.instrumentRegion(14, 2);
            return; // LIGHT：不建池
        }
        // ── HEAVY 层：离屏池加载 warmupUrl（需 uiContext）──
        else {
            bjccovms5u83p6.instrumentBranch(14, 1, false);
        }
        // ── HEAVY 层：离屏池加载 warmupUrl（需 uiContext）──
        const biz: WarmupBizType | undefined = manifest.bizTypes[bizType];
        if (biz === undefined) {
            bjccovms5u83p6.instrumentBranch(14, 2, true);
            bjccovms5u83p6.instrumentRegion(14, 3);
            return;
        }
        else {
            bjccovms5u83p6.instrumentBranch(14, 2, false);
        }
        bjccovms5u83p6.instrumentRegion(14, 4);
        TencentQianWebViewPrewarmer.warmPool(biz.warmupUrl, uiContext);
    }
    /**
     * HEAVY：离屏池加载 `warmupUrl`（含语言拼接，与 warmup.html 委托语义一致）。
     * 缺 `uiContext` 时无法建组件 → 降级（仅前面的 DNS/连接预热生效）+ log。
     */
    private static warmPool(warmupUrl: string, uiContext?: UIContext): void {
        bjccovms5u83p6.instrumentFunction(15);
        if (warmupUrl.length === 0 || !TencentQianWebViewPrewarmer.config.enablePool) {
            bjccovms5u83p6.instrumentBranch(15, 0, true);
            bjccovms5u83p6.instrumentRegion(15, 1);
            return;
        }
        else {
            bjccovms5u83p6.instrumentBranch(15, 0, false);
        }
        if (uiContext === undefined || uiContext === null) {
            bjccovms5u83p6.instrumentBranch(15, 1, true);
            bjccovms5u83p6.instrumentRegion(15, 2);
            console.warn('[TencentQianWebViewPrewarmer] HEAVY needs a uiContext to build the off-screen pool; '
                + 'degraded (DNS/preconnect still applied). Pass uiContext via prewarm(HEAVY, bizType, uiContext).');
            return;
        }
        else {
            bjccovms5u83p6.instrumentBranch(15, 1, false);
        }
        const url: string = TencentQianWebViewPrewarmer.appendLang(warmupUrl, TencentQianWebViewPrewarmer.config.preferredLanguage);
        try {
            bjccovms5u83p6.instrumentRegion(15, 3);
            TencentQianWebViewPrewarmer.registerMemoryCallbackOnce(uiContext);
            HarmonyWebViewPool.warm(url, uiContext, TencentQianWebViewPrewarmer.config.injectUserAgent, TencentQianWebViewPrewarmer.config.userAgentExtra);
        }
        catch (_e) {
            bjccovms5u83p6.instrumentRegion(15, 4);
        }
    }
    /**
     * 幂等注册系统内存压力监听。经 `uiContext.getHostContext()` 拿到 `ApplicationContext`
     * （应用级、非页面级，避免随页面销毁而失效）注册 `on('environment', EnvironmentCallback)`，
     * 其 `onMemoryLevel` 即系统内存告警回调。
     *
     * 注册时机放在真正开池处（{@link warmPool}），既保证只有持有池实例时才监听内存，
     * 又天然覆盖 configure/lazyInit 两条路径。
     *
     * **阈值策略**：`MEMORY_LEVEL_MODERATE` 及以上（MODERATE/LOW/CRITICAL）即回收**空闲**池实例
     * （单实例约 200MB，偏积极省内存）；借出中的实例由 {@link HarmonyWebViewPool.releaseIfIdle} 跳过，
     * 不打断签署。真正释放后重置去重状态，使后续 prewarm 可重新预热。
     */
    private static registerMemoryCallbackOnce(uiContext: UIContext): void {
        bjccovms5u83p6.instrumentFunction(16);
        if (TencentQianWebViewPrewarmer.memoryCallbackRegistered) {
            bjccovms5u83p6.instrumentBranch(16, 0, true);
            bjccovms5u83p6.instrumentRegion(16, 1);
            return;
        }
        else {
            bjccovms5u83p6.instrumentBranch(16, 0, false);
        }
        try {
            bjccovms5u83p6.instrumentRegion(16, 2);
            const hostContext: common.Context | undefined = uiContext.getHostContext() as common.Context | undefined;
            if (hostContext === undefined || hostContext === null) {
                bjccovms5u83p6.instrumentBranch(16, 1, true);
                bjccovms5u83p6.instrumentRegion(16, 4);
                return;
            }
            else {
                bjccovms5u83p6.instrumentBranch(16, 1, false);
            }
            bjccovms5u83p6.instrumentRegion(16, 5);
            const appContext: common.ApplicationContext = hostContext.getApplicationContext();
            const callback: EnvironmentCallback = {
                onMemoryLevel: (level: AbilityConstant.MemoryLevel): void => {
                    bjccovms5u83p6.instrumentFunction(17);
                    if (level >= AbilityConstant.MemoryLevel.MEMORY_LEVEL_MODERATE) {
                        bjccovms5u83p6.instrumentBranch(17, 0, true);
                        bjccovms5u83p6.instrumentRegion(17, 1);
                        if (HarmonyWebViewPool.releaseIfIdle()) {
                            bjccovms5u83p6.instrumentBranch(17, 1, true);
                            bjccovms5u83p6.instrumentRegion(17, 2);
                            TencentQianWebViewPrewarmer.dedup.reset();
                        }
                        else {
                            bjccovms5u83p6.instrumentBranch(17, 1, false);
                        }
                    }
                    else {
                        bjccovms5u83p6.instrumentBranch(17, 0, false);
                    }
                },
                onConfigurationUpdated: (_config: Configuration): void => {
                    bjccovms5u83p6.instrumentFunction(18);
                }
            };
            appContext.on('environment', callback);
            TencentQianWebViewPrewarmer.memoryCallbackRegistered = true;
        }
        catch (_e) {
            bjccovms5u83p6.instrumentRegion(16, 3);
            // best-effort：注册失败不影响预热主流程
            console.warn('[TencentQianWebViewPrewarmer] register environment(memoryLevel) callback failed');
        }
    }
    /**
     * 语言拼接（与 Android/iOS L4 对齐）：`preferredLanguage` 非空 → 拼 `&lang=`（warmup.html 内 `?lang` 优先级最高）；
     * 空 → 原样返回，完全委托 warmup.html 自动判定。
     */
    private static appendLang(url: string, lang: string | null): string {
        bjccovms5u83p6.instrumentFunction(19);
        if (lang === null || lang.length === 0) {
            bjccovms5u83p6.instrumentBranch(19, 0, true);
            bjccovms5u83p6.instrumentRegion(19, 1);
            return url;
        }
        else {
            bjccovms5u83p6.instrumentBranch(19, 0, false);
        }
        bjccovms5u83p6.instrumentRegion(19, 2);
        const sep: string = url.indexOf('?') >= 0 ? (bjccovms5u83p6.instrumentBranch(19, 1, true), '&') : (bjccovms5u83p6.instrumentBranch(19, 1, false), '?');
        return url + sep + 'lang=' + encodeURIComponent(lang);
    }
    /** 初始化 Web 引擎（全局一次、主线程、幂等、best-effort）。 */
    private static ensureWebEngineInitialized(): void {
        bjccovms5u83p6.instrumentFunction(20);
        if (TencentQianWebViewPrewarmer.webEngineInitialized) {
            bjccovms5u83p6.instrumentBranch(20, 0, true);
            bjccovms5u83p6.instrumentRegion(20, 1);
            return;
        }
        else {
            bjccovms5u83p6.instrumentBranch(20, 0, false);
        }
        try {
            bjccovms5u83p6.instrumentRegion(20, 2);
            webview.WebviewController.initializeWebEngine();
            TencentQianWebViewPrewarmer.webEngineInitialized = true;
        }
        catch (_e) {
            bjccovms5u83p6.instrumentRegion(20, 3);
        }
    }
    /** MINIMAL：DNS 预解析。 */
    private static prefetchDns(hosts: string[]): void {
        bjccovms5u83p6.instrumentFunction(21);
        bjccovms5u83p6.instrumentRegion(21, 1);
        hosts.forEach((h: string): void => {
            bjccovms5u83p6.instrumentFunction(22);
            const host: string = TencentQianWebViewPrewarmer.hostOf(h);
            if (host.length === 0) {
                bjccovms5u83p6.instrumentBranch(22, 0, true);
                bjccovms5u83p6.instrumentRegion(22, 1);
                return;
            }
            else {
                bjccovms5u83p6.instrumentBranch(22, 0, false);
            }
            try {
                bjccovms5u83p6.instrumentRegion(22, 2);
                connection.getAddressesByName(host).catch((_e: Object): void => {
                    bjccovms5u83p6.instrumentFunction(23);
                });
            }
            catch (_e) {
                bjccovms5u83p6.instrumentRegion(22, 3);
            }
        });
    }
    /** LIGHT：内核级预连接（TLS/TCP，自带 DNS）。 */
    private static preconnectHosts(hosts: string[]): void {
        bjccovms5u83p6.instrumentFunction(24);
        bjccovms5u83p6.instrumentRegion(24, 1);
        hosts.forEach((h: string): void => {
            bjccovms5u83p6.instrumentFunction(25);
            const url: string = TencentQianWebViewPrewarmer.rootUrlOf(h);
            if (url.length === 0) {
                bjccovms5u83p6.instrumentBranch(25, 0, true);
                bjccovms5u83p6.instrumentRegion(25, 1);
                return;
            }
            else {
                bjccovms5u83p6.instrumentBranch(25, 0, false);
            }
            try {
                bjccovms5u83p6.instrumentRegion(25, 2);
                // 通过 ESObject cast 调用静态方法，规避 .d.ts 版本差异
                const ctrl: any = webview.WebviewController as any;
                bjccovms5u83p6.instrumentRegion(24, 2);
                ctrl.prepareForPageLoad(url, true, 2);
            }
            catch (_e) {
                bjccovms5u83p6.instrumentRegion(25, 3);
            }
        });
    }
    /** 提取纯 host（去 scheme / path / 端口）。 */
    private static hostOf(urlOrHost: string): string {
        bjccovms5u83p6.instrumentFunction(26);
        let s: string = urlOrHost.trim();
        const schemeIdx: number = s.indexOf('://');
        if (schemeIdx >= 0) {
            bjccovms5u83p6.instrumentBranch(26, 0, true);
            bjccovms5u83p6.instrumentRegion(26, 1);
            s = s.substring(schemeIdx + 3);
        }
        else {
            bjccovms5u83p6.instrumentBranch(26, 0, false);
        }
        const slash: number = s.indexOf('/');
        if (slash >= 0) {
            bjccovms5u83p6.instrumentBranch(26, 1, true);
            bjccovms5u83p6.instrumentRegion(26, 2);
            s = s.substring(0, slash);
        }
        else {
            bjccovms5u83p6.instrumentBranch(26, 1, false);
        }
        const colon: number = s.indexOf(':');
        if (colon >= 0) {
            bjccovms5u83p6.instrumentBranch(26, 2, true);
            bjccovms5u83p6.instrumentRegion(26, 3);
            s = s.substring(0, colon);
        }
        else {
            bjccovms5u83p6.instrumentBranch(26, 2, false);
        }
        bjccovms5u83p6.instrumentRegion(26, 4);
        return s;
    }
    /** 归一化为带 scheme 的根 URL（preconnect 需要完整 URL）。 */
    private static rootUrlOf(urlOrHost: string): string {
        bjccovms5u83p6.instrumentFunction(27);
        const s: string = urlOrHost.trim();
        if (s.length === 0) {
            bjccovms5u83p6.instrumentBranch(27, 0, true);
            bjccovms5u83p6.instrumentRegion(27, 1);
            return '';
        }
        else {
            bjccovms5u83p6.instrumentBranch(27, 0, false);
        }
        if (s.indexOf('://') >= 0) {
            bjccovms5u83p6.instrumentBranch(27, 1, true);
            bjccovms5u83p6.instrumentRegion(27, 2);
            return s;
        }
        else {
            bjccovms5u83p6.instrumentBranch(27, 1, false);
        }
        bjccovms5u83p6.instrumentRegion(27, 3);
        return 'https://' + s;
    }
    // ArkTS 类禁止实例化
    private constructor() { bjccovms5u83p6.instrumentFunction(28); }
}
