import "./Avatar.css";
import {centerBaselineBefore as $1f4b04be3f24aae3$export$179e9489a09b14ac} from "./CenterBaseline.mjs";
import {Image as $dbd6f0b2503b938c$export$3e431a229df88919} from "./Image.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $lGIgj$jsx} from "react/jsx-runtime";
import {createContext as $lGIgj$createContext, forwardRef as $lGIgj$forwardRef} from "react";
import {filterDOMProps as $lGIgj$filterDOMProps} from "@react-aria/utils";
import {useDOMRef as $lGIgj$useDOMRef} from "@react-spectrum/utils";

/*
 * Copyright 2024 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 






const $3ffa2cd930156220$var$imageStyles = function anonymous(props, overrides) {
    let rules = " ";
    let flexShrink = false;
    let flexGrow = false;
    let matches = String(overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "_v") flexShrink = true;
        if (p[1] === "_u") flexGrow = true;
        rules += p[0];
    }
    rules += ' sd12';
    rules += ' eb12';
    rules += ' og12';
    rules += ' ng12';
    rules += ' kg12';
    rules += ' jg12';
    rules += ' Zm12';
    rules += ' Fn12';
    if (!flexShrink) rules += ' _va12';
    if (!flexGrow) rules += ' _ua12';
    rules += ' __ca12';
    if (props.isOverBackground) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' OEzkoQe12';
    if (props.isLarge) rules += ' _Mc12';
    else rules += ' _Mb12';
    return rules;
};
const $3ffa2cd930156220$export$a20dad690e1279e2 = /*#__PURE__*/ (0, $lGIgj$createContext)(null);
const $3ffa2cd930156220$export$e2255cf6045e8d47 = /*#__PURE__*/ (0, $lGIgj$forwardRef)(function Avatar(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $3ffa2cd930156220$export$a20dad690e1279e2);
    let domRef = (0, $lGIgj$useDOMRef)(ref);
    let { alt: alt = '', src: src, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', size: size = 24, isOverBackground: isOverBackground, slot: slot = 'avatar', ...otherProps } = props;
    const domProps = (0, $lGIgj$filterDOMProps)(otherProps);
    // In the docs build, we need to be able to simulate font scaling.
    let remSize = `${size / 16}rem`;
    let isLarge = size >= 64;
    return /*#__PURE__*/ (0, $lGIgj$jsx)((0, $dbd6f0b2503b938c$export$3e431a229df88919), {
        ...domProps,
        ref: domRef,
        slot: slot,
        alt: alt,
        UNSAFE_style: {
            ...UNSAFE_style,
            width: remSize,
            height: remSize
        },
        UNSAFE_className: UNSAFE_className + ' ' + (0, $1f4b04be3f24aae3$export$179e9489a09b14ac),
        styles: $3ffa2cd930156220$var$imageStyles({
            isOverBackground: isOverBackground,
            isLarge: isLarge
        }, props.styles),
        src: src
    });
});


export {$3ffa2cd930156220$export$a20dad690e1279e2 as AvatarContext, $3ffa2cd930156220$export$e2255cf6045e8d47 as Avatar};
//# sourceMappingURL=Avatar.mjs.map
