/**
 * TUI component for managing package resources (enable/disable)
 */
import { Container, Spacer } from "@earendil-works/pi-tui";
import { DynamicBorder } from "./dynamic-border.js";
import { ConfigSelectorHeader, ResourceList, buildGroups } from "./config-selector-list.js";
export class ConfigSelectorComponent extends Container {
    get focused() {
        return this._focused;
    }
    set focused(value) {
        this._focused = value;
        this.resourceList.focused = value;
    }
    constructor(resolvedPaths, settingsManager, cwd, agentDir, onClose, onExit, requestRender) {
        super();
        this._focused = false;
        const groups = buildGroups(resolvedPaths, agentDir);
        // Add header
        this.addChild(new Spacer(1));
        this.addChild(new DynamicBorder());
        this.addChild(new Spacer(1));
        this.addChild(new ConfigSelectorHeader());
        this.addChild(new Spacer(1));
        // Resource list
        this.resourceList = new ResourceList(groups, settingsManager, cwd, agentDir);
        this.resourceList.onCancel = onClose;
        this.resourceList.onExit = onExit;
        this.resourceList.onToggle = () => requestRender();
        this.addChild(this.resourceList);
        // Bottom border
        this.addChild(new Spacer(1));
        this.addChild(new DynamicBorder());
    }
    getResourceList() {
        return this.resourceList;
    }
}
//# sourceMappingURL=config-selector.js.map