1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getRootViewBackgroundColor = exports.withRootViewBackgroundColorStyles = exports.withRootViewBackgroundColorColors = exports.withAndroidRootViewBackgroundColor = void 0;
4const config_plugins_1 = require("expo/config-plugins");
5const { assignColorValue } = config_plugins_1.AndroidConfig.Colors;
6const { assignStylesValue, getAppThemeLightNoActionBarGroup } = config_plugins_1.AndroidConfig.Styles;
7const ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';
8const WINDOW_BACKGROUND_COLOR = 'activityBackground';
9const withAndroidRootViewBackgroundColor = (config) => {
10    config = (0, exports.withRootViewBackgroundColorColors)(config);
11    config = (0, exports.withRootViewBackgroundColorStyles)(config);
12    return config;
13};
14exports.withAndroidRootViewBackgroundColor = withAndroidRootViewBackgroundColor;
15const withRootViewBackgroundColorColors = (config) => {
16    return (0, config_plugins_1.withAndroidColors)(config, async (config) => {
17        config.modResults = assignColorValue(config.modResults, {
18            value: getRootViewBackgroundColor(config),
19            name: WINDOW_BACKGROUND_COLOR,
20        });
21        return config;
22    });
23};
24exports.withRootViewBackgroundColorColors = withRootViewBackgroundColorColors;
25const withRootViewBackgroundColorStyles = (config) => {
26    return (0, config_plugins_1.withAndroidStyles)(config, async (config) => {
27        config.modResults = assignStylesValue(config.modResults, {
28            add: !!getRootViewBackgroundColor(config),
29            parent: getAppThemeLightNoActionBarGroup(),
30            name: ANDROID_WINDOW_BACKGROUND,
31            value: `@color/${WINDOW_BACKGROUND_COLOR}`,
32        });
33        return config;
34    });
35};
36exports.withRootViewBackgroundColorStyles = withRootViewBackgroundColorStyles;
37function getRootViewBackgroundColor(config) {
38    return config.android?.backgroundColor || config.backgroundColor || null;
39}
40exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
41