/**
 * Read-only access to the server-resolved capability map.
 *
 * The map is authoritative on the server (Feature_Gate); this composable is
 * UX only — never a security boundary. Reads the same boot object the rest of
 * the builder uses (window.formatrica.builder). Unknown keys return false.
 */
export function useCapabilities() {
    const builder = (typeof window !== 'undefined' && window.formatrica?.builder) || {};
    const map =
        builder.capabilities && typeof builder.capabilities === 'object'
            ? builder.capabilities
            : {};

    const has = (key) => map[key] === true;
    const all = () => ({ ...map });

    return { has, all };
}
