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 bjccovms5u83lq = new BjcCov({ version: "bjc v1.0.0", versionCode: 10000, path: "tencentqianwebview/src/main/ets/TencentQianWebViewComponent.ets", hash: "e02a35f43bcfc170d60d651c4a774f075d87cc3b65f409e963ab86c35befa94e", lineCnt: 322, count: 0, projectPath: "", functions: { 0: { name: "anonymous_1", count: 0, regions: { 0: { startLoc: { line: 70, col: 32 }, endLoc: { line: 72, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 0 }, 1: { name: "setInitiallyProvidedValue", count: 0, regions: { 0: { startLoc: { line: 64, col: 23 }, endLoc: { line: 64, col: 25 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 1 }, 2: { name: "updateStateVars", count: 0, regions: { 0: { startLoc: { line: 64, col: 9 }, endLoc: { line: 64, col: 12 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 2 }, 3: { name: "url", count: 0, regions: { 0: { startLoc: { line: 64, col: 9 }, endLoc: { line: 64, col: 12 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 3 }, 4: { name: "url", count: 0, regions: { 0: { startLoc: { line: 64, col: 9 }, endLoc: { line: 64, col: 20 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 4 }, 5: { name: "handlers", count: 0, regions: { 0: { startLoc: { line: 108, col: 18 }, endLoc: { line: 108, col: 26 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 5 }, 6: { name: "handlers", count: 0, regions: { 0: { startLoc: { line: 108, col: 18 }, endLoc: { line: 108, col: 61 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 6 }, 7: { name: "nodeController", count: 0, regions: { 0: { startLoc: { line: 110, col: 18 }, endLoc: { line: 110, col: 32 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 7 }, 8: { name: "nodeController", count: 0, regions: { 0: { startLoc: { line: 110, col: 18 }, endLoc: { line: 110, col: 58 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 8 }, 9: { name: "aboutToAppear", count: 0, regions: { 0: { startLoc: { line: 114, col: 3 }, endLoc: { line: 130, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 115, col: 32 }, endLoc: { line: 118, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 121, col: 32 }, endLoc: { line: 128, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 124, col: 58 }, endLoc: { line: 127, col: 8 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 129, col: 5 }, endLoc: { line: 130, col: 4 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 115, col: 9 }, endLoc: { line: 115, col: 30 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 121, col: 9 }, endLoc: { line: 121, col: 30 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 2: { startLoc: { line: 124, col: 11 }, endLoc: { line: 124, col: 56 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 9 }, 10: { name: "aboutToDisappear", count: 0, regions: { 0: { startLoc: { line: 132, col: 3 }, endLoc: { line: 162, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 134, col: 68 }, endLoc: { line: 136, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 137, col: 33 }, endLoc: { line: 143, col: 6 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 138, col: 11 }, endLoc: { line: 140, col: 8 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 140, col: 9 }, endLoc: { line: 142, col: 8 }, count: 0, ignored: 0 }, 5: { startLoc: { line: 145, col: 39 }, endLoc: { line: 150, col: 6 }, count: 0, ignored: 0 }, 6: { startLoc: { line: 147, col: 27 }, endLoc: { line: 149, col: 8 }, count: 0, ignored: 0 }, 7: { startLoc: { line: 151, col: 24 }, endLoc: { line: 155, col: 6 }, count: 0, ignored: 0 }, 8: { startLoc: { line: 155, col: 12 }, endLoc: { line: 161, col: 6 }, count: 0, ignored: 0 }, 9: { startLoc: { line: 157, col: 41 }, endLoc: { line: 160, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 134, col: 9 }, endLoc: { line: 134, col: 66 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 137, col: 9 }, endLoc: { line: 137, col: 31 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 2: { startLoc: { line: 145, col: 9 }, endLoc: { line: 145, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 3: { startLoc: { line: 147, col: 11 }, endLoc: { line: 147, col: 25 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 4: { startLoc: { line: 151, col: 9 }, endLoc: { line: 151, col: 22 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 5: { startLoc: { line: 157, col: 11 }, endLoc: { line: 157, col: 39 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 10 }, 11: { name: "reusePooled", count: 0, regions: { 0: { startLoc: { line: 165, col: 3 }, endLoc: { line: 217, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 178, col: 23 }, endLoc: { line: 184, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 179, col: 11 }, endLoc: { line: 181, col: 8 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 181, col: 9 }, endLoc: { line: 183, col: 8 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 205, col: 9 }, endLoc: { line: 207, col: 6 }, count: 0, ignored: 0 }, 5: { startLoc: { line: 207, col: 7 }, endLoc: { line: 209, col: 6 }, count: 0, ignored: 0 }, 6: { startLoc: { line: 212, col: 9 }, endLoc: { line: 214, col: 6 }, count: 0, ignored: 0 }, 7: { startLoc: { line: 214, col: 7 }, endLoc: { line: 216, col: 6 }, count: 0, ignored: 0 }, 8: { startLoc: { line: 198, col: 7 }, endLoc: { line: 199, col: 6 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 178, col: 9 }, endLoc: { line: 178, col: 21 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 11 }, 12: { name: "anonymous_2", count: 0, regions: { 0: { startLoc: { line: 193, col: 37 }, endLoc: { line: 199, col: 6 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 12 }, 13: { name: "buildOwnNode", count: 0, regions: { 0: { startLoc: { line: 220, col: 3 }, endLoc: { line: 240, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 222, col: 5 }, endLoc: { line: 240, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 13 }, 14: { name: "bindModelListeners", count: 0, regions: { 0: { startLoc: { line: 248, col: 3 }, endLoc: { line: 264, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 249, col: 5 }, endLoc: { line: 264, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 14 }, 15: { name: "anonymous_3", count: 0, regions: { 0: { startLoc: { line: 249, col: 31 }, endLoc: { line: 253, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 250, col: 49 }, endLoc: { line: 252, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 250, col: 11 }, endLoc: { line: 250, col: 47 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 15 }, 16: { name: "anonymous_4", count: 0, regions: { 0: { startLoc: { line: 254, col: 28 }, endLoc: { line: 258, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 255, col: 46 }, endLoc: { line: 257, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 255, col: 11 }, endLoc: { line: 255, col: 44 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 16 }, 17: { name: "anonymous_5", count: 0, regions: { 0: { startLoc: { line: 259, col: 35 }, endLoc: { line: 263, col: 6 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 260, col: 53 }, endLoc: { line: 262, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 260, col: 11 }, endLoc: { line: 260, col: 51 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 17 }, 18: { name: "attachController", count: 0, regions: { 0: { startLoc: { line: 272, col: 3 }, endLoc: { line: 301, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 273, col: 68 }, endLoc: { line: 275, col: 6 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 276, col: 5 }, endLoc: { line: 301, col: 4 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 273, col: 9 }, endLoc: { line: 273, col: 66 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 18 }, 19: { name: "anonymous_6", count: 0, regions: { 0: { startLoc: { line: 277, col: 7 }, endLoc: { line: 283, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 278, col: 13 }, endLoc: { line: 280, col: 10 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 280, col: 11 }, endLoc: { line: 282, col: 10 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 19 }, 20: { name: "anonymous_7", count: 0, regions: { 0: { startLoc: { line: 284, col: 7 }, endLoc: { line: 292, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 285, col: 13 }, endLoc: { line: 289, col: 10 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 289, col: 11 }, endLoc: { line: 291, col: 10 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 286, col: 56 }, endLoc: { line: 288, col: 12 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 286, col: 15 }, endLoc: { line: 286, col: 54 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 20 }, 21: { name: "anonymous_8", count: 0, regions: { 0: { startLoc: { line: 293, col: 7 }, endLoc: { line: 299, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 294, col: 13 }, endLoc: { line: 296, col: 10 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 296, col: 11 }, endLoc: { line: 298, col: 10 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 21 }, 22: { name: "initialRender", count: 0, regions: { 0: { startLoc: { line: 303, col: 3 }, endLoc: { line: 320, col: 4 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 22 }, 23: { name: "anonymous_9", count: 0, regions: { 0: { startLoc: { line: 304, col: 5 }, endLoc: { line: 319, col: 19 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 23 }, 24: { name: "anonymous_10", count: 0, regions: { 0: { startLoc: { line: 305, col: 7 }, endLoc: { line: 316, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 305, col: 41 }, endLoc: { line: 312, col: 8 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 312, col: 14 }, endLoc: { line: 316, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 305, col: 11 }, endLoc: { line: 305, col: 39 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 24 }, 25: { name: "anonymous_11", count: 0, regions: { 0: { startLoc: { line: 306, col: 9 }, endLoc: { line: 306, col: 13 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 25 }, 26: { name: "anonymous_12", count: 0, regions: { 0: { startLoc: { line: 306, col: 9 }, endLoc: { line: 311, col: 38 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 26 }, 27: { name: "anonymous_13", count: 0, regions: { 0: { startLoc: { line: 313, col: 9 }, endLoc: { line: 315, col: 25 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 27 }, 28: { name: "anonymous_14", count: 0, regions: { 0: { startLoc: { line: 313, col: 9 }, endLoc: { line: 315, col: 25 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 28 } }, exeLine: { 0: 1, 1: 2, 2: 3, 3: 5, 4: 6, 5: 7, 6: 8, 7: 9, 8: 10, 9: 11, 10: 12, 11: 13, 12: 14, 13: 15, 14: 16, 15: 17, 16: 18, 17: 62, 18: 64, 19: 66, 20: 68, 21: 70, 22: 74, 23: 81, 24: 87, 25: 91, 26: 98, 27: 104, 28: 107, 29: 108, 30: 110, 31: 112, 32: 114, 33: 115, 34: 116, 35: 117, 36: 121, 37: 122, 38: 123, 39: 124, 40: 125, 41: 126, 42: 129, 43: 132, 44: 134, 45: 135, 46: 137, 47: 138, 48: 139, 49: 140, 50: 145, 51: 146, 52: 147, 53: 148, 54: 151, 55: 153, 56: 154, 57: 155, 58: 157, 59: 158, 60: 159, 61: 165, 62: 166, 63: 167, 64: 169, 65: 170, 66: 171, 67: 172, 68: 173, 69: 174, 70: 177, 71: 178, 72: 179, 73: 180, 74: 181, 75: 185, 76: 186, 77: 189, 78: 192, 79: 193, 80: 197, 81: 198, 82: 201, 83: 202, 84: 203, 85: 205, 86: 206, 87: 207, 88: 210, 89: 212, 90: 213, 91: 214, 92: 220, 93: 222, 94: 223, 95: 224, 96: 225, 97: 226, 98: 227, 99: 229, 100: 230, 101: 231, 102: 233, 103: 234, 104: 235, 105: 236, 106: 237, 107: 239, 108: 248, 109: 249, 110: 250, 111: 251, 112: 254, 113: 255, 114: 256, 115: 259, 116: 260, 117: 261, 118: 272, 119: 273, 120: 274, 121: 276, 122: 277, 123: 278, 124: 279, 125: 280, 126: 281, 127: 284, 128: 285, 129: 286, 130: 287, 131: 289, 132: 293, 133: 294, 134: 295, 135: 296, 136: 303, 137: 304, 138: 305, 139: 306, 140: 307, 141: 308, 142: 309, 143: 310, 144: 311, 145: 312, 146: 313, 147: 314, 148: 315, 149: 318, 150: 319 } });
if (!("finalizeConstruction" in ViewPU.prototype)) {
    Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
}
interface TencentQianWebViewComponent_Params {
    url?: string;
    /** UIAbility/页面 context。必填。 */
    context?: common.UIAbilityContext | null;
    /** 容器配置。可省,使用默认值。 */
    config?: TencentQianWebViewConfig;
    /** 签署结果回调。必填。 */
    onSignResult?: OnSignResult;
    /** SDK 事件回调。可选。 */
    onSdkEvent?: OnSdkEvent;
    /**
     * 渲染进程连续崩溃且 SDK 放弃自动恢复（永久白屏终态）时触发。可选。
     *
     * 宿主据此显示错误页 / 返回上级 / 提示重试（配合 `controller.reload()`）。
     * 与 `onSdkEvent` 的 `RenderProcessGoneEvent`（每次崩溃）语义互补。
     */
    onRenderUnrecoverable?: OnRenderUnrecoverable;
    /**
     * H5 标题 / 可后退状态变化（`onPageEnd` 快照）。可选。
     *
     * 供宿主自绘顶栏更新标题与返回按钮禁用态。实时可后退值请用 `controller.canGoBack()`。
     */
    onTitleChanged?: OnTitleChanged;
    /**
     * 加载进度变化（`progress` 0~100；`visible` 是否应显示）。可选。供宿主自绘进度条。
     */
    onProgressChanged?: OnProgressChanged;
    /**
     * 嵌入模式 Web 控制器。可选。
     *
     * 宿主创建 `TencentQianWebViewController` 实例传入后，可在自绘的返回按钮 / 重试按钮里主动
     * 操控内部 WebView（`canGoBack` / `goBack` / `handleBack` / `reload`）。不传则无法主动控制。
     */
    controller?: TencentQianWebViewController;
    /**
     * 是否复用 `prewarm(HEAVY)` 预热的池实例。默认 false（自建自管）。
     *
     * ⚠️ 仅建议在「一次性、非缓存」的主签署入口场景开启（见类文档风险说明）。
     */
    reusePrewarmPool?: boolean;
    webviewController?: webview.WebviewController;
    handlers?: TencentQianWebViewHandlers | null;
    nodeController?: WebNodeController | null;
    fromPool?: boolean;
}
import webview from "@ohos:web.webview";
import type common from "@ohos:app.ability.common";
import { TencentQianWebViewConfig } from "@normalized:N&&&tencentqianwebview/src/main/ets/model/TencentQianWebViewConfig&1.0.0";
import type { OnSignResult, OnSdkEvent, OnRenderUnrecoverable, OnTitleChanged, OnProgressChanged } from './model/SignCallback';
import { TencentQianWebViewConfigurator } from "@normalized:N&&&tencentqianwebview/src/main/ets/TencentQianWebViewConfigurator&1.0.0";
import type { TencentQianWebViewHandlers } from "@normalized:N&&&tencentqianwebview/src/main/ets/TencentQianWebViewConfigurator&1.0.0";
import type { TencentQianWebViewController } from './TencentQianWebViewController';
import { WebHostModel } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/prewarm/WebHostModel&1.0.0";
import { WebNodeController } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/prewarm/TencentQianWebNode&1.0.0";
import { HarmonyWebViewPool } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/prewarm/HarmonyWebViewPool&1.0.0";
export class TencentQianWebViewComponent extends ViewPU {
    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
        super(parent, __localStorage, elmtId, extraInfo);
        if (typeof paramsLambda === "function") {
            this.paramsGenerator_ = paramsLambda;
        }
        this.__url = new SynchedPropertySimpleOneWayPU(params.url, this, "url");
        this.context = null;
        this.config = new TencentQianWebViewConfig();
        this.onSignResult = (_r): void => {
            bjccovms5u83lq.instrumentFunction(0);
        };
        this.onSdkEvent = undefined;
        this.onRenderUnrecoverable = undefined;
        this.onTitleChanged = undefined;
        this.onProgressChanged = undefined;
        this.controller = undefined;
        this.reusePrewarmPool = false;
        this.webviewController = new webview.WebviewController();
        this.__handlers = new ObservedPropertyObjectPU(null, this, "handlers");
        this.__nodeController = new ObservedPropertyObjectPU(null, this, "nodeController");
        this.fromPool = false;
        this.setInitiallyProvidedValue(params);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(params: TencentQianWebViewComponent_Params) {
        bjccovms5u83lq.instrumentFunction(1);
        if (params.url === undefined) {
            this.__url.set('');
        }
        else {
        }
        if (params.context !== undefined) {
            this.context = params.context;
        }
        else {
        }
        if (params.config !== undefined) {
            this.config = params.config;
        }
        else {
        }
        if (params.onSignResult !== undefined) {
            this.onSignResult = params.onSignResult;
        }
        else {
        }
        if (params.onSdkEvent !== undefined) {
            this.onSdkEvent = params.onSdkEvent;
        }
        else {
        }
        if (params.onRenderUnrecoverable !== undefined) {
            this.onRenderUnrecoverable = params.onRenderUnrecoverable;
        }
        else {
        }
        if (params.onTitleChanged !== undefined) {
            this.onTitleChanged = params.onTitleChanged;
        }
        else {
        }
        if (params.onProgressChanged !== undefined) {
            this.onProgressChanged = params.onProgressChanged;
        }
        else {
        }
        if (params.controller !== undefined) {
            this.controller = params.controller;
        }
        else {
        }
        if (params.reusePrewarmPool !== undefined) {
            this.reusePrewarmPool = params.reusePrewarmPool;
        }
        else {
        }
        if (params.webviewController !== undefined) {
            this.webviewController = params.webviewController;
        }
        else {
        }
        if (params.handlers !== undefined) {
            this.handlers = params.handlers;
        }
        else {
        }
        if (params.nodeController !== undefined) {
            this.nodeController = params.nodeController;
        }
        else {
        }
        if (params.fromPool !== undefined) {
            this.fromPool = params.fromPool;
        }
        else {
        }
    }
    updateStateVars(params: TencentQianWebViewComponent_Params) {
        bjccovms5u83lq.instrumentFunction(2);
        this.__url.reset(params.url);
    }
    purgeVariableDependenciesOnElmtId(rmElmtId) {
        this.__url.purgeDependencyOnElmtId(rmElmtId);
        this.__handlers.purgeDependencyOnElmtId(rmElmtId);
        this.__nodeController.purgeDependencyOnElmtId(rmElmtId);
    }
    aboutToBeDeleted() {
        this.__url.aboutToBeDeleted();
        this.__handlers.aboutToBeDeleted();
        this.__nodeController.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    /** 目标 H5 URL。必填。 */
    private __url: SynchedPropertySimpleOneWayPU<string>;
    get url() {
        bjccovms5u83lq.instrumentFunction(3);
        return this.__url.get();
    }
    set url(newValue: string) {
        bjccovms5u83lq.instrumentFunction(4);
        this.__url.set(newValue);
    }
    /** UIAbility/页面 context。必填。 */
    private context: common.UIAbilityContext | null;
    /** 容器配置。可省,使用默认值。 */
    private config: TencentQianWebViewConfig;
    /** 签署结果回调。必填。 */
    private onSignResult: OnSignResult;
    /** SDK 事件回调。可选。 */
    private onSdkEvent?: OnSdkEvent;
    /**
     * 渲染进程连续崩溃且 SDK 放弃自动恢复（永久白屏终态）时触发。可选。
     *
     * 宿主据此显示错误页 / 返回上级 / 提示重试（配合 `controller.reload()`）。
     * 与 `onSdkEvent` 的 `RenderProcessGoneEvent`（每次崩溃）语义互补。
     */
    private onRenderUnrecoverable?: OnRenderUnrecoverable;
    /**
     * H5 标题 / 可后退状态变化（`onPageEnd` 快照）。可选。
     *
     * 供宿主自绘顶栏更新标题与返回按钮禁用态。实时可后退值请用 `controller.canGoBack()`。
     */
    private onTitleChanged?: OnTitleChanged;
    /**
     * 加载进度变化（`progress` 0~100；`visible` 是否应显示）。可选。供宿主自绘进度条。
     */
    private onProgressChanged?: OnProgressChanged;
    /**
     * 嵌入模式 Web 控制器。可选。
     *
     * 宿主创建 `TencentQianWebViewController` 实例传入后，可在自绘的返回按钮 / 重试按钮里主动
     * 操控内部 WebView（`canGoBack` / `goBack` / `handleBack` / `reload`）。不传则无法主动控制。
     */
    private controller?: TencentQianWebViewController;
    /**
     * 是否复用 `prewarm(HEAVY)` 预热的池实例。默认 false（自建自管）。
     *
     * ⚠️ 仅建议在「一次性、非缓存」的主签署入口场景开启（见类文档风险说明）。
     */
    private reusePrewarmPool: boolean;
    // —— internal state ——
    private webviewController: webview.WebviewController;
    private __handlers: ObservedPropertyObjectPU<TencentQianWebViewHandlers | null>;
    get handlers() {
        bjccovms5u83lq.instrumentFunction(5);
        return this.__handlers.get();
    }
    set handlers(newValue: TencentQianWebViewHandlers | null) {
        bjccovms5u83lq.instrumentFunction(6);
        this.__handlers.set(newValue);
    }
    /** 承载离线 Web 组件的 NodeController（null 表示尚未初始化 / 缺 context）。 */
    private __nodeController: ObservedPropertyObjectPU<WebNodeController | null>;
    get nodeController() {
        bjccovms5u83lq.instrumentFunction(7);
        return this.__nodeController.get();
    }
    set nodeController(newValue: WebNodeController | null) {
        bjccovms5u83lq.instrumentFunction(8);
        this.__nodeController.set(newValue);
    }
    /** 本组件 Web 实例是否借自预热池（决定关闭时归还还是销毁）。 */
    private fromPool: boolean;
    aboutToAppear(): void {
        bjccovms5u83lq.instrumentFunction(9);
        if (this.context === null) {
            bjccovms5u83lq.instrumentBranch(9, 0, true);
            bjccovms5u83lq.instrumentRegion(9, 1);
            console.error('[TencentQianWebViewComponent] context is null, please pass the UIAbilityContext');
            return;
        }
        // 仅当客户显式开启 reusePrewarmPool 时尝试复用池实例（UA 配置匹配）；否则自建自管
        else {
            bjccovms5u83lq.instrumentBranch(9, 0, false);
        }
        // 仅当客户显式开启 reusePrewarmPool 时尝试复用池实例（UA 配置匹配）；否则自建自管
        if (this.reusePrewarmPool) {
            bjccovms5u83lq.instrumentBranch(9, 1, true);
            bjccovms5u83lq.instrumentRegion(9, 2);
            const pooled: WebNodeController | null = HarmonyWebViewPool.obtain(this.config.injectUserAgent, this.config.userAgentExtra);
            if (pooled !== null && pooled.getModel() !== null) {
                bjccovms5u83lq.instrumentBranch(9, 2, true);
                bjccovms5u83lq.instrumentRegion(9, 3);
                this.reusePooled(pooled);
                return;
            }
            else {
                bjccovms5u83lq.instrumentBranch(9, 2, false);
            }
        }
        else {
            bjccovms5u83lq.instrumentBranch(9, 1, false);
        }
        bjccovms5u83lq.instrumentRegion(9, 4);
        this.buildOwnNode();
    }
    aboutToDisappear(): void {
        bjccovms5u83lq.instrumentFunction(10);
        // 复位宿主控制器为 no-op，防止组件销毁后宿主误调用命令触及已销毁/已归还的 controller。
        if (this.controller !== undefined && this.controller !== null) {
            bjccovms5u83lq.instrumentBranch(10, 0, true);
            bjccovms5u83lq.instrumentRegion(10, 1);
            this.controller.detachInternal();
        }
        else {
            bjccovms5u83lq.instrumentBranch(10, 0, false);
        }
        if (this.handlers !== null) {
            bjccovms5u83lq.instrumentBranch(10, 1, true);
            bjccovms5u83lq.instrumentRegion(10, 2);
            try {
                bjccovms5u83lq.instrumentRegion(10, 3);
                this.handlers.networkStateInjector.detach();
            }
            catch (_e) {
                bjccovms5u83lq.instrumentRegion(10, 4);
            }
        }
        // 断开 model 对本组件的联动回调，防止池 model 长期持有已销毁组件引用（内存泄漏）。
        else {
            bjccovms5u83lq.instrumentBranch(10, 1, false);
        }
        // 断开 model 对本组件的联动回调，防止池 model 长期持有已销毁组件引用（内存泄漏）。
        if (this.nodeController !== null) {
            bjccovms5u83lq.instrumentBranch(10, 2, true);
            bjccovms5u83lq.instrumentRegion(10, 5);
            const model: WebHostModel | null = this.nodeController.getModel();
            if (model !== null) {
                bjccovms5u83lq.instrumentBranch(10, 3, true);
                bjccovms5u83lq.instrumentRegion(10, 6);
                model.clearContainerListeners();
            }
            else {
                bjccovms5u83lq.instrumentBranch(10, 3, false);
            }
        }
        else {
            bjccovms5u83lq.instrumentBranch(10, 2, false);
        }
        if (this.fromPool) {
            bjccovms5u83lq.instrumentBranch(10, 4, true);
            bjccovms5u83lq.instrumentRegion(10, 7);
            // 借还池（同 Page/Android）：先解绑 NodeContainer，再归还（about:blank + clearHistory，不销毁）
            this.nodeController = null;
            HarmonyWebViewPool.recycle();
        }
        else {
            bjccovms5u83lq.instrumentBranch(10, 4, false);
            bjccovms5u83lq.instrumentRegion(10, 8);
            // 自建：销毁离线节点（一次性，不归还池）
            if (this.nodeController !== null) {
                bjccovms5u83lq.instrumentBranch(10, 5, true);
                bjccovms5u83lq.instrumentRegion(10, 9);
                this.nodeController.disposeNode();
                this.nodeController = null;
            }
            else {
                bjccovms5u83lq.instrumentBranch(10, 5, false);
            }
        }
    }
    /** 复用预热池实例：用池 controller 生成真实 handlers，热替换 model.handlers/url 并重新激活。 */
    private reusePooled(pooled: WebNodeController): void {
        bjccovms5u83lq.instrumentFunction(11);
        const model: WebHostModel = pooled.getModel()!;
        this.webviewController = model.controller;
        // aboutToAppear 已保证 context 非 null 才会走到复用/自建分支
        this.handlers = TencentQianWebViewConfigurator.apply(this.webviewController, this.context!, this.config, this.onSignResult, this.onSdkEvent);
        // detach 预热 handlers 的网络监听，切到真实 handlers
        const old: TencentQianWebViewHandlers | null = model.handlers;
        if (old !== null) {
            bjccovms5u83lq.instrumentBranch(11, 0, true);
            bjccovms5u83lq.instrumentRegion(11, 1);
            try {
                bjccovms5u83lq.instrumentRegion(11, 2);
                old.networkStateInjector.detach();
            }
            catch (_e) {
                bjccovms5u83lq.instrumentRegion(11, 3);
            }
        }
        else {
            bjccovms5u83lq.instrumentBranch(11, 0, false);
        }
        model.handlers = this.handlers;
        model.url = this.url;
        // 池实例已在预热时加载过 warmupUrl（历史栈残留）；标记首个 onPageEnd 清历史，
        // 使 signingUrl 成为唯一历史项，避免第一次返回退回预热页。
        model.clearHistoryOnce = true;
        // 标记来自池 + 绑定作废回调：借出态渲染进程崩溃时作废池实例（避免僵尸复用），
        // 并同步组件 fromPool=false（后续销毁不再走归还）。对齐 Android。
        model.fromPool = true;
        model.onPoolInvalidateRequest = (): void => {
            bjccovms5u83lq.instrumentFunction(12);
            // 借出态崩溃：只脱池（不再被 obtain 复用 / 不再被 recycle 收回），**不销毁正在显示的活节点**。
            // controller 崩溃后仍有效，容器在同一 controller 上 refresh() 原地恢复（鸿蒙无需分离节点/重建）；
            // 活节点由容器继续持有，关闭时（fromPool=false → disposeNode）再销毁收口。对齐 Android invalidateIfPooled。
            HarmonyWebViewPool.unpoolBorrowed();
            bjccovms5u83lq.instrumentRegion(11, 8);
            this.fromPool = false;
        };
        // 绑定进度 / 标题 / 不可恢复联动回调到 model（转发给宿主 props），并把命令注入宿主控制器。
        this.bindModelListeners(model);
        this.nodeController = pooled;
        this.fromPool = true;
        // controller 已 attach（预热时），手动执行真实 handlers 的 attach（UA + 网络监听）
        try {
            bjccovms5u83lq.instrumentRegion(11, 4);
            this.handlers.onControllerAttached();
        }
        catch (_e) {
            bjccovms5u83lq.instrumentRegion(11, 5);
        }
        this.attachController();
        // 加载真实签署页（命中预热热身的连接/内核缓存）
        try {
            bjccovms5u83lq.instrumentRegion(11, 6);
            this.webviewController.loadUrl(this.url);
        }
        catch (_e) {
            bjccovms5u83lq.instrumentRegion(11, 7);
        }
    }
    /** 自建离线组件（无池可复用 / 未开启复用时）。 */
    private buildOwnNode(): void {
        bjccovms5u83lq.instrumentFunction(13);
        bjccovms5u83lq.instrumentRegion(13, 1);
        // aboutToAppear 已保证 context 非 null 才会走到复用/自建分支
        this.handlers = TencentQianWebViewConfigurator.apply(this.webviewController, this.context!, this.config, this.onSignResult, this.onSdkEvent);
        const model: WebHostModel = new WebHostModel(this.webviewController);
        model.url = this.url;
        model.handlers = this.handlers;
        // 绑定进度 / 标题 / 不可恢复联动回调到 model（转发给宿主 props）。
        this.bindModelListeners(model);
        const ctrl: WebNodeController = new WebNodeController();
        ctrl.init(this.getUIContext(), model);
        this.nodeController = ctrl;
        this.fromPool = false;
        // 把命令注入宿主控制器（controller 已就绪）。
        this.attachController();
    }
    /**
     * 绑定进度 / 标题 / 不可恢复联动回调到 model，转发给宿主对应 props。
     *
     * 与 Page 模式 `bindModelListeners` 同构，区别在于嵌入模式无内置顶栏 / 进度条，
     * 联动信号直接透传给宿主自绘 UI（宿主未传对应 prop 时静默忽略）。
     */
    private bindModelListeners(model: WebHostModel): void {
        bjccovms5u83lq.instrumentFunction(14);
        bjccovms5u83lq.instrumentRegion(14, 1);
        model.onProgressChanged = (progress: number, visible: boolean): void => {
            bjccovms5u83lq.instrumentFunction(15);
            if (this.onProgressChanged !== undefined) {
                bjccovms5u83lq.instrumentBranch(15, 0, true);
                bjccovms5u83lq.instrumentRegion(15, 1);
                this.onProgressChanged(progress, visible);
            }
            else {
                bjccovms5u83lq.instrumentBranch(15, 0, false);
            }
        };
        model.onTitleChanged = (title: string, canGoBack: boolean): void => {
            bjccovms5u83lq.instrumentFunction(16);
            if (this.onTitleChanged !== undefined) {
                bjccovms5u83lq.instrumentBranch(16, 0, true);
                bjccovms5u83lq.instrumentRegion(16, 1);
                this.onTitleChanged(title, canGoBack);
            }
            else {
                bjccovms5u83lq.instrumentBranch(16, 0, false);
            }
        };
        model.onRenderUnrecoverable = (): void => {
            bjccovms5u83lq.instrumentFunction(17);
            if (this.onRenderUnrecoverable !== undefined) {
                bjccovms5u83lq.instrumentBranch(17, 0, true);
                bjccovms5u83lq.instrumentRegion(17, 1);
                this.onRenderUnrecoverable();
            }
            else {
                bjccovms5u83lq.instrumentBranch(17, 0, false);
            }
        };
    }
    /**
     * 把内部 WebView 命令（后退查询 / 后退 / 重载）注入宿主控制器。
     *
     * 宿主未传 `controller` 时为 no-op。命令实时走 `webviewController`：`canGoBack` 用
     * `accessBackward()` 覆盖 SPA 软路由的历史深度；`goBack` 前置判断避免首屏无历史时报错。
     */
    private attachController(): void {
        bjccovms5u83lq.instrumentFunction(18);
        if (this.controller === undefined || this.controller === null) {
            bjccovms5u83lq.instrumentBranch(18, 0, true);
            bjccovms5u83lq.instrumentRegion(18, 1);
            return;
        }
        else {
            bjccovms5u83lq.instrumentBranch(18, 0, false);
        }
        bjccovms5u83lq.instrumentRegion(18, 2);
        this.controller.attachInternal((): boolean => {
            bjccovms5u83lq.instrumentFunction(19);
            try {
                bjccovms5u83lq.instrumentRegion(19, 1);
                return this.webviewController.accessBackward();
            }
            catch (_e) {
                bjccovms5u83lq.instrumentRegion(19, 2);
                return false;
            }
        }, (): void => {
            bjccovms5u83lq.instrumentFunction(20);
            try {
                bjccovms5u83lq.instrumentRegion(20, 1);
                if (this.webviewController.accessBackward()) {
                    bjccovms5u83lq.instrumentBranch(20, 0, true);
                    bjccovms5u83lq.instrumentRegion(20, 3);
                    this.webviewController.backward();
                }
                else {
                    bjccovms5u83lq.instrumentBranch(20, 0, false);
                }
            }
            catch (_e) {
                bjccovms5u83lq.instrumentRegion(20, 2);
            }
        }, (): void => {
            bjccovms5u83lq.instrumentFunction(21);
            try {
                bjccovms5u83lq.instrumentRegion(21, 1);
                this.webviewController.refresh();
            }
            catch (_e) {
                bjccovms5u83lq.instrumentRegion(21, 2);
            }
        });
    }
    initialRender() {
        bjccovms5u83lq.instrumentFunction(22);
        this.observeComponentCreation2((elmtId, isInitialRender) => {
            bjccovms5u83lq.instrumentFunction(23);
            Column.create();
            Column.width('100%');
            Column.height('100%');
        }, Column);
        this.observeComponentCreation2((elmtId, isInitialRender) => {
            bjccovms5u83lq.instrumentFunction(24);
            If.create();
            if (this.nodeController === null) {
                bjccovms5u83lq.instrumentBranch(24, 0, true);
                bjccovms5u83lq.instrumentRegion(24, 1);
                this.ifElseBranchUpdateFunction(0, () => {
                    bjccovms5u83lq.instrumentFunction(25);
                    this.observeComponentCreation2((elmtId, isInitialRender) => {
                        bjccovms5u83lq.instrumentFunction(26);
                        Text.create('TencentQianWebView: missing context');
                        Text.fontSize(14);
                        Text.fontColor('#ff0000');
                        Text.width('100%');
                        Text.height('100%');
                        Text.textAlign(TextAlign.Center);
                    }, Text);
                    Text.pop();
                });
            }
            else {
                bjccovms5u83lq.instrumentBranch(24, 0, false);
                bjccovms5u83lq.instrumentRegion(24, 2);
                this.ifElseBranchUpdateFunction(1, () => {
                    bjccovms5u83lq.instrumentFunction(27);
                    this.observeComponentCreation2((elmtId, isInitialRender) => {
                        bjccovms5u83lq.instrumentFunction(28);
                        NodeContainer.create(this.nodeController);
                        NodeContainer.width('100%');
                        NodeContainer.height('100%');
                    }, NodeContainer);
                });
            }
        }, If);
        If.pop();
        Column.pop();
    }
    rerender() {
        this.updateDirtyElements();
    }
}
