"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Icon = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_native_1 = require("react-native");
const FontAwesome5_1 = tslib_1.__importDefault(require("react-native-vector-icons/FontAwesome5"));
const MaterialCommunityIcons_1 = tslib_1.__importDefault(require("react-native-vector-icons/MaterialCommunityIcons"));
const SvgIcons = tslib_1.__importStar(require("../../assets/svg"));
const enums_1 = require("../../enums");
const Touchable_1 = tslib_1.__importDefault(require("../Touchable"));
const FontAwesomeProIcons_1 = require("./FontAwesomeProIcons");
const Icon = ({ id, accessibility, accessibilityLabel, testID, name = '', touchable = true, isEmoji = false, size = 20, color = undefined, style = [{}], onPress = () => { }, borderColor = 'transparent', backgroundColor = 'transparent', type = enums_1.IconFonts.FontAwesome, iconSets, width, height, ...rest }) => {
    const iconName = name?.charAt(0).toUpperCase() + name?.slice(1);
    const bundleName = `Icon${iconName}`;
    const svgIcons = SvgIcons[bundleName];
    const Svg = iconSets ? iconSets[bundleName] : svgIcons;
    const iconSet = {
        [enums_1.IconFonts.FontAwesome]: FontAwesome5_1.default,
        [enums_1.IconFonts.Material]: MaterialCommunityIcons_1.default,
        [enums_1.IconFonts.FABrands]: FontAwesomeProIcons_1.FaBrands,
        [enums_1.IconFonts.FALight]: FontAwesomeProIcons_1.FaLight,
        [enums_1.IconFonts.FARegular]: FontAwesomeProIcons_1.FaRegular,
        [enums_1.IconFonts.FASolid]: FontAwesomeProIcons_1.FaSolid,
    };
    const IconComponent = iconSet[type];
    return (<react_native_1.Animated.View style={style}>
      <Touchable_1.default id={id || accessibility} accessibility={accessibility || iconName} accessibilityLabel={accessibilityLabel || accessibility} testID={testID || id || accessibility} disabled={!touchable} onPress={onPress} {...rest}>
        <react_native_1.View>
          {isEmoji && (<react_native_1.Animated.Text style={{
                fontSize: size,
                color,
                borderColor,
                backgroundColor,
                width,
                height,
            }}>
              {name}
            </react_native_1.Animated.Text>)}
          {Svg && (<Svg width={width || size} height={height || size} color={color} borderColor={borderColor} backgroundColor={backgroundColor}/>)}
          {!isEmoji && !Svg && (<IconComponent name={name} color={color} size={size}/>)}
        </react_native_1.View>
      </Touchable_1.default>
    </react_native_1.Animated.View>);
};
exports.Icon = Icon;
exports.default = exports.Icon;
//# sourceMappingURL=index.js.map