"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
exports.MultiModeTunnelClient = void 0;
const dev_tunnels_contracts_1 = require("@microsoft/dev-tunnels-contracts");
const tunnelConnectionBase_1 = require("./tunnelConnectionBase");
/**
 * Tunnel client implementation that selects one of multiple available connection modes.
 */
class MultiModeTunnelClient extends tunnelConnectionBase_1.TunnelConnectionBase {
    constructor() {
        super(dev_tunnels_contracts_1.TunnelAccessScopes.Connect);
        this.clients = [];
        this.connectionModes = this.clients
            ? [...new Set(...this.clients.map((c) => c.connectionModes))]
            : [];
    }
    /**
     * A value indicating whether local connections for forwarded ports are accepted.
     * Local connections are not accepted if the host process is not NodeJS (e.g. browser).
     */
    get acceptLocalConnectionsForForwardedPorts() {
        return !!this.clients.find((c) => c.acceptLocalConnectionsForForwardedPorts);
    }
    set acceptLocalConnectionsForForwardedPorts(value) {
        this.clients.forEach((c) => (c.acceptLocalConnectionsForForwardedPorts = value));
    }
    get localForwardingHostAddress() {
        var _a;
        return (_a = this.clients[0]) === null || _a === void 0 ? void 0 : _a.localForwardingHostAddress;
    }
    set localForwardingHostAddress(value) {
        this.clients.forEach((c) => (c.localForwardingHostAddress = value));
    }
    connect(tunnel, options, cancellation) {
        if (!tunnel) {
            throw new Error('Tunnel cannot be null');
        }
        return new Promise((resolve) => { });
    }
    get portForwarding() {
        throw new Error('Not supported.');
    }
    connectToForwardedPort(fowardedPort, cancellation) {
        throw new Error('Method not implemented.');
    }
    waitForForwardedPort(forwardedPort, cancellation) {
        throw new Error('Method not implemented.');
    }
    async refreshPorts() {
        throw new Error('Method not implemented.');
    }
    async dispose() {
        await super.dispose();
        await Promise.all(this.clients.map((client) => client.dispose()));
    }
}
exports.MultiModeTunnelClient = MultiModeTunnelClient;
//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/6a44c352bd24569c417e530095901b649960f9f8/node_modules/@microsoft/dev-tunnels-connections/multiModeTunnelClient.js.map