import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { Image } from "../../../../components/index.js";
import { getMediaImage } from "../../../../components/Media/Image/utils.js";
import RouterLink from "../../../../components/RouterLink/RouterLink.js";
import { block, getLinkProps, getThemedValue } from "../../../../utils/index.js";
import { LocationContext } from "../../../context/locationContext/index.js";
import { useTheme } from "../../../context/theme/index.js";
import { i18n } from "./i18n/index.js";
import './Logo.css';
const b = block('logo');
export const Logo = ({ alt = i18n('image-alt'), ...restProps }) => {
    const props = { ...restProps, alt };
    const { hostname, Link } = React.useContext(LocationContext);
    const theme = useTheme();
    const themedLogoProps = getThemedValue(props, theme) || props;
    const imageData = getMediaImage(themedLogoProps.icon || props.icon);
    imageData.alt = alt;
    const textData = themedLogoProps.text || props.text;
    const url = themedLogoProps.url || props.url || '/';
    const urlTitle = themedLogoProps.urlTitle || props.urlTitle || textData;
    const linkExtraProps = getLinkProps(url, hostname);
    const content = (_jsxs(React.Fragment, { children: [imageData && _jsx(Image, { className: b('icon'), ...imageData }), _jsx("span", { className: b('text'), children: textData })] }));
    return (_jsx(RouterLink, { href: url, passHref: true, children: Link ? (_jsx("span", { className: b(null, props.className), children: content })) : (_jsx("a", { className: b(null, props.className), href: url, title: urlTitle, ...linkExtraProps, children: content })) }));
};
export default Logo;
//# sourceMappingURL=Logo.js.map
