"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    AutopilotChatActionButton: ()=>AutopilotChatActionButton
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const material_namespaceObject = require("@mui/material");
const apollo_core_namespaceObject = require("@uipath/apollo-core");
var apollo_core_default = /*#__PURE__*/ __webpack_require__.n(apollo_core_namespaceObject);
const external_index_cjs_namespaceObject = require("../../../index.cjs");
const external_react_namespaceObject = require("react");
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
const chat_state_provider_cjs_namespaceObject = require("../../providers/chat-state-provider.cjs");
const index_cjs_namespaceObject = require("../../service/index.cjs");
const external_icon_button_cjs_namespaceObject = require("./icon-button.cjs");
const external_tooltip_cjs_namespaceObject = require("./tooltip.cjs");
const StyledButtonContainer = (0, material_namespaceObject.styled)('div')(()=>({
        '& .MuiButton-root': {
            background: 'transparent',
            color: 'var(--color-foreground)',
            fontFamily: apollo_core_default().FontFamily.FontLFamily,
            fontWeight: apollo_core_default().FontFamily.FontWeightDefault,
            fontSize: apollo_core_default().FontFamily.FontSSize,
            lineHeight: apollo_core_default().FontFamily.FontSLineHeight,
            fontStyle: 'normal',
            minWidth: '78px',
            '&:active': {
                backgroundColor: 'transparent !important'
            },
            '&:hover, &:focus': {
                color: 'var(--color-foreground-emp)',
                backgroundColor: 'var(--color-icon-button-hover) !important'
            }
        }
    }));
const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default().forwardRef(({ iconName, disabled, iconSize, preventHover, overrideColor, variant = 'outlined', text, tooltip, tooltipPlacement = 'bottom', ariaLabel, ariaDescribedby, ariaPressed, title, tabIndex, onClick, onMouseEnter, onMouseLeave, onFocus, onBlur, onMouseDown, onMouseUp, onKeyDown, disableInteractiveTooltip = false, 'data-testid': dataTestId }, ref)=>{
    const [iconColor, setIconColor] = external_react_default().useState('var(--color-icon-default)');
    const { chatMode } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
    const showTooltip = tooltip && chatMode !== index_cjs_namespaceObject.AutopilotChatMode.Closed && !disabled;
    const button = text ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StyledButtonContainer, {
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Button, {
            ref: ref,
            onMouseEnter: (event)=>{
                onMouseEnter?.(event);
                if (!preventHover) setIconColor('var(--color-foreground-emp)');
            },
            onMouseLeave: (event)=>{
                onMouseLeave?.(event);
                if (!preventHover) setIconColor('var(--color-icon-default)');
            },
            startIcon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ApIcon, {
                name: iconName,
                variant: variant,
                size: iconSize || apollo_core_default().Icon.IconS,
                color: overrideColor ?? iconColor
            }),
            "aria-label": ariaLabel,
            "aria-describedby": ariaDescribedby,
            "aria-pressed": ariaPressed,
            title: showTooltip ? void 0 : title,
            variant: "text",
            size: "small",
            disabled: disabled,
            onClick: onClick,
            onFocus: onFocus,
            onBlur: onBlur,
            onMouseDown: onMouseDown,
            onMouseUp: onMouseUp,
            tabIndex: tabIndex,
            onKeyDown: onKeyDown,
            "data-testid": dataTestId,
            children: text
        })
    }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_icon_button_cjs_namespaceObject.AutopilotChatIconButton, {
        ref: ref,
        disabled: disabled,
        color: "secondary",
        onClick: onClick,
        onFocus: onFocus,
        onBlur: onBlur,
        onMouseDown: onMouseDown,
        onMouseUp: onMouseUp,
        tabIndex: tabIndex,
        onKeyDown: onKeyDown,
        "aria-label": ariaLabel,
        "aria-describedby": ariaDescribedby,
        "aria-pressed": ariaPressed,
        title: showTooltip ? void 0 : title,
        onMouseEnter: (event)=>{
            onMouseEnter?.(event);
            if (!preventHover) setIconColor('var(--color-foreground-emp)');
        },
        onMouseLeave: (event)=>{
            onMouseLeave?.(event);
            if (!preventHover) setIconColor('var(--color-icon-default)');
        },
        "data-testid": dataTestId,
        sx: 'custom' === variant ? {
            padding: '8px 6px 6px 8px'
        } : void 0,
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ApIcon, {
            name: iconName,
            variant: variant,
            size: iconSize || ('custom' === variant ? '20px' : apollo_core_default().Icon.IconS),
            color: overrideColor ?? iconColor
        })
    });
    return showTooltip ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.AutopilotChatTooltip, {
        title: tooltip,
        placement: tooltipPlacement,
        disableInteractive: disableInteractiveTooltip,
        children: button
    }) : button;
});
const AutopilotChatActionButton = /*#__PURE__*/ external_react_default().memo(AutopilotChatActionButtonComponent);
exports.AutopilotChatActionButton = __webpack_exports__.AutopilotChatActionButton;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "AutopilotChatActionButton"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
