import { createScopedToolId } from "../../services/tool-instance-id.js";
export function createScopedVisibilityBinding(toolId, toolbarContext) {
    const fullToolId = createScopedToolId(toolId, toolbarContext.scope.level, toolbarContext.scope.scopeId);
    return {
        fullToolId,
        isActive: () => toolbarContext.isToolVisible(fullToolId),
        subscribeActive: (callback) => {
            if (!toolbarContext.subscribeVisibility)
                return () => { };
            return toolbarContext.subscribeVisibility(() => {
                callback(toolbarContext.isToolVisible(fullToolId));
            });
        },
    };
}
export function syncButtonAndOverlayVisibility(args) {
    const active = args.isActive();
    args.button.active = active;
    args.overlay.visible = active;
    args.onActiveChange?.(active);
}
export function applyOverlaySurface(overlay, surface) {
    overlay.setAttribute("data-pie-tool-surface", surface);
}
//# sourceMappingURL=toolbar-registration-helpers.js.map