"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar(require("react"));
var ConnectedDevice_1 = require("./ConnectedDevice");
var ConfirmationsEdit_1 = require("./ConfirmationsEdit");
var FeatureFlag_1 = require("../../commons/FeatureFlag");
exports.ConnectedDevices = function (_a) {
    var devicesList = _a.devicesList, deployedWallet = _a.deployedWallet, devicesBasePath = _a.devicesBasePath;
    var _b = __read(react_1.useState(''), 2), confirmationsCount = _b[0], setConfirmationsCount = _b[1];
    return (react_1.default.createElement("div", { className: "connected-devices" },
        react_1.default.createElement("div", { className: "connected-devices-header" },
            react_1.default.createElement("h2", { className: "connected-devices-title" },
                devicesList.length,
                " connected devices"),
            react_1.default.createElement(FeatureFlag_1.FeatureFlag, { sdk: deployedWallet.sdk, feature: "requiredConfirmations" },
                react_1.default.createElement(ConfirmationsEdit_1.ConfirmationsEdit, { confirmationsCount: confirmationsCount, setConfirmationsCount: function (confirmations) { return setConfirmationsCount(confirmations); }, deployedWallet: deployedWallet, devicesAmount: devicesList.length }))),
        react_1.default.createElement("ul", { className: "connected-devices-list" }, devicesList.map(function (device) {
            return (react_1.default.createElement(ConnectedDevice_1.ConnectedDevice, __assign({ key: device.publicKey, confirmationsCount: confirmationsCount, devicesAmount: devicesList.length, deployedWallet: deployedWallet, devicesBasePath: devicesBasePath }, device)));
        }))));
};
//# sourceMappingURL=ConnectedDevices.js.map