"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useConfigImageUri = void 0;
var _reactNative = require("react-native");
var _assets = require("../../core/assets");
var _react = require("react");
var _useConfig = _interopRequireDefault(require("./useConfig"));
var _useDarkMode = require("./useDarkMode");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const useConfigImageUri = ({
  configPath,
  configKey
}) => {
  const {
    getUiKitConfig
  } = (0, _useConfig.default)();
  const {
    isDarkTheme
  } = (0, _useDarkMode.useDarkMode)();
  const configImageUri = (0, _react.useMemo)(() => {
    var _getUiKitConfig;
    if (!configPath || !configKey) return _assets.defaultAvatarUri;
    const fileUri = (_getUiKitConfig = getUiKitConfig(configPath)) === null || _getUiKitConfig === void 0 ? void 0 : _getUiKitConfig[configKey];
    if (!fileUri) return _assets.defaultAvatarUri;
    if (fileUri.includes('http')) return fileUri;
    let image = _assets.defaultAvatarUri;
    if (fileUri === 'mute.png') {
      image = require('../../core/assets/configs/mute.png');
    }
    if (fileUri === 'unmute.png') {
      image = require('../../core/assets/configs/unmute.png');
    }
    if (fileUri === 'aspect_ratio.png') {
      image = require('../../core/assets/configs/aspect_ratio.png');
    }
    if (fileUri === 'hyperlink_button.png') {
      image = require('../../core/assets/configs/hyperlink_button.png');
    }
    if (fileUri === 'searchButtonIcon') {
      image = require('../../core/assets/configs/search.png');
    }
    if (fileUri === 'postCreationIcon') {
      image = require('../../core/assets/configs/plus.png');
    }
    if (fileUri === 'search') {
      image = require('../../core/assets/configs/search.png');
    }
    if (fileUri === 'clear') {
      image = require('../../core/assets/configs/clear.png');
    }
    if (fileUri === 'lockIcon') {
      image = require('../../core/assets/configs/lockIcon.png');
    }
    if (fileUri === 'officialBadgeIcon') {
      image = require('../../core/assets/configs/officialBadgeIcon.png');
    }
    if (fileUri === 'emptyFeedIcon') {
      image = isDarkTheme ? require('../../core/assets/configs/emptyFeedIcon_dark.png') : require('../../core/assets/configs/emptyFeedIcon_light.png');
    }
    if (fileUri === 'exploreCommunityIcon') {
      image = require('../../core/assets/configs/exploreCommunityIcon.png');
    }
    if (fileUri === 'badgeIcon') {
      image = require('../../core/assets/configs/badgeIcon.png');
    }
    if (fileUri === 'backButtonIcon') {
      image = require('../../core/assets/configs/backButtonIcon.png');
    }
    if (fileUri === 'menuIcon') {
      image = require('../../core/assets/configs/menuIcon.png');
    }
    if (fileUri === 'likeButtonIcon') {
      image = require('../../core/assets/configs/likeButtonIcon.png');
    }
    if (fileUri === 'commentButtonIcon') {
      image = require('../../core/assets/configs/commentButtonIcon.png');
    }
    if (fileUri === 'shareButtonIcon') {
      image = require('../../core/assets/configs/shareButtonIcon.png');
    }
    if (fileUri === 'create_post_button') {
      image = require('../../core/assets/configs/create_post_button.png');
    }
    if (fileUri === 'create_story_button') {
      image = require('../../core/assets/configs/create_story_button.png');
    }
    if (fileUri === 'create_poll_button') {
      image = require('../../core/assets/configs/create_poll_button.png');
    }
    if (fileUri === 'create_livestream_button') {
      image = require('../../core/assets/configs/create_livestream_button.png');
    }
    if (fileUri === 'close_button') {
      image = isDarkTheme ? require('../../core/assets/configs/close_button_dark.png') : require('../../core/assets/configs/close_button_light.png');
    }
    if (fileUri === 'image_button') {
      image = require('../../core/assets/configs/image_button.png');
    }
    if (fileUri === 'video_button') {
      image = require('../../core/assets/configs/video_button.png');
    }
    if (fileUri === 'camera_button') {
      image = require('../../core/assets/configs/camera_button.png');
    }
    if (fileUri === 'file_button') {
      image = require('../../core/assets/configs/file_button.png');
    }
    if (fileUri === 'empty_list_icon') {
      image = require('../../core/assets/configs/empty_list_icon.png');
    }
    if (fileUri === 'search_light') {
      image = require('../../core/assets/configs/search_light.png');
    }
    if (typeof image === 'number') {
      var _Image$resolveAssetSo;
      return ((_Image$resolveAssetSo = _reactNative.Image.resolveAssetSource(image)) === null || _Image$resolveAssetSo === void 0 ? void 0 : _Image$resolveAssetSo.uri) ?? _assets.defaultAvatarUri;
    }
    return image;
  }, [configPath, configKey, getUiKitConfig, isDarkTheme]);
  return {
    uri: configImageUri
  };
};
exports.useConfigImageUri = useConfigImageUri;
//# sourceMappingURL=useConfigImageUri.js.map