/**
 * Reads the `rbfb` bootstrap object localized by AdminAssets.
 *
 * The API key is never present here — only the redacted
 * { hasKey, hint, source } connection state.
 */

const FALLBACK = {
	restUrl: '',
	nonce: '',
	adapters: [],
	settings: {},
	connection: { hasKey: false, hint: '', source: 'db', lastVerified: '' },
	dates: { date: 'd-m-Y', time: 'H:i', gmtOffset: 0, timezone: '' },
};

export function getBootstrap() {
	return { ...FALLBACK, ...( window.rbfb || {} ) };
}

export function getAdapters() {
	const { adapters } = getBootstrap();

	return Array.isArray( adapters ) ? adapters : [];
}
