/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import _extends from "@babel/runtime/helpers/extends";
import "./index.compiled.css";
import { ax, ix } from "@compiled/react/runtime";
import React from 'react';
import { InternalActionName } from '../../../../../constants';
import { useFlexibleCardContext } from '../../../../../state/flexible-ui-context';
import { BaseTextElement } from '../common';
const baseStyle = null;
const isMessageDescriptor = x => ! /*#__PURE__*/React.isValidElement(x);
const fontOverrideStyleMap = {
  'font.body': "_11c8fhey",
  'font.body.large': "_11c81d4k",
  'font.body.small': "_11c8wadc"
};
const maxLinesCss = null;

/**
 * Public API — exported externally. Do not add props without external support intent.
 */
const CustomElementByAccessType = ({
  className,
  testId = 'custom-by-access-type-element',
  ...props
}) => {
  var _context$data, _context$data$meta, _props, _context$data2, _context$data2$action, _context$data2$action2;
  const context = useFlexibleCardContext();
  const accessType = context === null || context === void 0 ? void 0 : (_context$data = context.data) === null || _context$data === void 0 ? void 0 : (_context$data$meta = _context$data.meta) === null || _context$data$meta === void 0 ? void 0 : _context$data$meta.accessType;
  const contentForAccessType = (_props = props[accessType]) !== null && _props !== void 0 ? _props : props.fallback;
  if (!contentForAccessType) {
    return null;
  }
  const values = context === null || context === void 0 ? void 0 : (_context$data2 = context.data) === null || _context$data2 === void 0 ? void 0 : (_context$data2$action = _context$data2.actions) === null || _context$data2$action === void 0 ? void 0 : (_context$data2$action2 = _context$data2$action[InternalActionName.UnresolvedAction]) === null || _context$data2$action2 === void 0 ? void 0 : _context$data2$action2.values;
  if (isMessageDescriptor(contentForAccessType)) {
    return /*#__PURE__*/React.createElement(BaseTextElement, _extends({}, props, {
      message: {
        descriptor: contentForAccessType,
        values
      }
      // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
      ,
      className: className,
      testId: testId,
      hideFormat: true
    }));
  }
  return /*#__PURE__*/React.createElement("span", {
    style: {
      color: props.color
    },
    "data-separator": true,
    "data-smart-element-text": true,
    "data-testid": testId
    // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
    ,
    className: ax(["_11c8wadc _1reo15vq _18m915vq _syazazsu _o5724jg8 _1e0ccj1k _1ul9idpf _1bto1l2s _1nmz1hna _sudp1e54", props.fontSize !== undefined && fontOverrideStyleMap[props.fontSize], "_1yyjkb7n _102k1j6v", className])
  }, contentForAccessType);
};
export default CustomElementByAccessType;