"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ModuleIDP = void 0;
var _reactNative = require("react-native");
var _context = require("../../context");
var _core = require("../../core");
var _image = require("../../utils/image");
var _typography = require("../typography");
var _PressableModuleBase = require("./PressableModuleBase");
var _jsxRuntime = require("react/jsx-runtime");
const styles = _reactNative.StyleSheet.create({
  idpLogo: {
    marginStart: _core.IOListItemLogoMargin,
    width: 120,
    height: 30,
    resizeMode: "contain"
  }
});
const useIDPLogo = logo => {
  const {
    themeType
  } = (0, _context.useIOThemeContext)();
  const logoIDPLightMode = (0, _image.addCacheTimestampToUri)(logo.light);
  if (!logo.dark) {
    return logoIDPLightMode;
  }
  const logoIDPDarkMode = (0, _image.addCacheTimestampToUri)(logo.dark);
  return themeType === "dark" ? logoIDPDarkMode : logoIDPLightMode;
};
const ModuleIDP = ({
  name,
  logo,
  withLooseSpacing = false,
  onPress,
  testID,
  accessibilityLabel
}) => {
  const theme = (0, _context.useIOTheme)();
  const IDPLogoSource = useIDPLogo(logo);
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PressableModuleBase.PressableModuleBase, {
    onPress: onPress,
    testID: testID,
    withLooseSpacing: withLooseSpacing,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.IOText, {
      weight: "Semibold",
      size: 12,
      lineHeight: 16,
      color: theme["textBody-tertiary"],
      textStyle: {
        alignSelf: "center",
        textTransform: "uppercase",
        letterSpacing: 0.5,
        flexShrink: 1
      },
      accessibilityLabel: accessibilityLabel ?? name,
      children: name
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
      accessibilityIgnoresInvertColors: true,
      source: IDPLogoSource,
      style: styles.idpLogo
    })]
  });
};
exports.ModuleIDP = ModuleIDP;
//# sourceMappingURL=ModuleIDP.js.map