/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import "./index.compiled.css";
import { ax, ix } from "@compiled/react/runtime";
import React, { useCallback } from 'react';
import { useIntl } from "react-intl";
import { cx } from '@atlaskit/css';
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
import { Box, Text } from '@atlaskit/primitives/compiled';
import useRovoChat from "../../../../state/hooks/use-rovo-chat";
import { getPromptAction, RovoChatPromptKey } from "../../../common/rovo-chat-utils";
import { ActionButton } from "../action-button";
const styles = {
  innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _19bv12x7 _u5f312x7",
  rovoIcon: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _ca0qv77o _n3tdv77o",
  text: "_1e0c1nu9 _19bv12x7"
};
export const RovoActionsCta = ({
  testId
}) => {
  return /*#__PURE__*/React.createElement(Box, {
    xcss: cx(styles.innerContainer, styles.rovoIcon),
    testId: testId
  }, /*#__PURE__*/React.createElement(RovoChatIcon, {
    label: "Rovo",
    color: "var(--ds-icon-inverse, #FFFFFF)",
    size: "small"
  }));
};
export const InlineRovoActionButton = ({
  testId,
  url
}) => {
  const {
    sendPromptMessage,
    isRovoChatEnabled
  } = useRovoChat();
  const intl = useIntl();

  // TODO: NAVX-5109 implement tailored rovo chat actions here
  const {
    data: promptData,
    content
  } = getPromptAction(RovoChatPromptKey.SUMMARIZE_LINK, intl, url) || {};
  const handleClick = useCallback(event => {
    event.preventDefault();
    event.stopPropagation();
    if (isRovoChatEnabled && promptData) {
      sendPromptMessage(promptData);
    }
  }, [sendPromptMessage, isRovoChatEnabled, promptData]);
  return promptData && content ? /*#__PURE__*/React.createElement(ActionButton, {
    onClick: handleClick,
    testId: testId
  }, /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
    label: "Rovo",
    color: "var(--ds-icon, #292A2E)",
    size: "small"
  }), /*#__PURE__*/React.createElement(Box, {
    xcss: styles.text
  }, /*#__PURE__*/React.createElement(Text, {
    size: "small"
  }, content))) : null;
};