/* @oracle/oraclejet-preact: undefined */
'use strict';

var jsxRuntime = require('preact/jsx-runtime');
var useTooltipOnTruncation = require('./useTooltipOnTruncation-cea31e18.js');
require('./TabbableModeContext-e99d527e.js');
var useTabbableMode = require('./useTabbableMode-5c8fd9e5.js');
var classNames = require('./classNames-c14c6ef3.js');
var mergeInterpolations = require('./mergeInterpolations-6727b536.js');
var UNSAFE_Text_themes_TextStyles_css = require('./UNSAFE_Text/themes/TextStyles.css.js');
var clientHints = require('./clientHints-89c01238.js');

const interpolations = [
    ({ lineClamp }) => !lineClamp ? {} : { class: UNSAFE_Text_themes_TextStyles_css.styles.lineClamp, webkitLineClamp: lineClamp }
];
const styleInterpolations = mergeInterpolations.mergeInterpolations(interpolations);
function TruncatingText({ children, hyphens, size, truncation, variant = 'inherit', weight, overflowWrap = 'anywhere', ...props }) {
    const clientHints$1 = clientHints.getClientHints();
    const variantClasses = UNSAFE_Text_themes_TextStyles_css.multiVariantStyles({
        hyphens,
        size,
        truncation,
        variant,
        weight,
        overflowWrap,
        safariStyles: clientHints$1.browser === 'safari' ? 'needs' : 'noNeed'
    });
    const { class: interpolatedClasses, ...styles } = styleInterpolations(props);
    const classes = classNames.classNames([variantClasses, interpolatedClasses]);
    const { isTabbable } = useTabbableMode.useTabbableMode();
    const { tooltipOnTruncationProps, tooltipContent, isTextTruncated } = useTooltipOnTruncation.useTooltipOnTruncation(children, variant === 'disabled');
    return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { ...tooltipOnTruncationProps, tabIndex: isTextTruncated && isTabbable ? 0 : -1, class: classes, style: styles, id: props.id, children: children }), tooltipContent] }));
}

exports.TruncatingText = TruncatingText;
//# sourceMappingURL=TruncatingText-c6b19242.js.map
