"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const core_1 = require("@bluebase/core");
const components_1 = require("@bluebase/components");
const react_1 = tslib_1.__importDefault(require("react"));
class PluginList extends react_1.default.PureComponent {
    render() {
        const BB = this.context;
        const plugins = BB.Plugins.filter(p => !!p);
        return (react_1.default.createElement(components_1.View, null, Object.values(plugins).map((plugin, index) => (react_1.default.createElement(react_1.default.Fragment, null,
            react_1.default.createElement(components_1.ListItem, { left: !!plugin.icon
                    ? react_1.default.createElement(components_1.PluginIcon, { id: plugin.key, size: 24 })
                    : react_1.default.createElement(components_1.DynamicIcon, { type: "icon", name: "build", size: 24 }), title: plugin.name, description: plugin.key, right: react_1.default.createElement(components_1.Switch, { checked: BB.Plugins.isEnabled(plugin.key), onValueChange: 
                    // tslint:disable-next-line: jsx-no-lambda
                    (value) => !!value
                        ? BB.Plugins.enable(plugin.key)
                        : BB.Plugins.disable(plugin.key) }) }),
            (index < Object.keys(plugins).length - 1) && react_1.default.createElement(components_1.Divider, { inset: true }))))));
    }
}
PluginList.contextType = core_1.BlueBaseContext;
exports.PluginList = PluginList;
