import "./InlineAlert.css";
import $e17a4836f4b6cc28$export$2e2bcd8739ae039 from "../icons/AlertTriangle.mjs";
import $22a7d72fc05e138d$export$2e2bcd8739ae039 from "../icons/CheckmarkCircle.mjs";
import {ContentContext as $8e847109a6ab556d$export$1cbdd774077931b4, HeadingContext as $8e847109a6ab556d$export$d688439359537581} from "./Content.mjs";
import {IconContext as $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed} from "../icons/Icon.mjs";
import $4c8f17dac3ecefd9$export$2e2bcd8739ae039 from "../icons/InfoCircle.mjs";
import $7sfGs$intlStringsmjs from "./intlStrings.mjs";
import $a951460932d22d7b$export$2e2bcd8739ae039 from "../icons/AlertDiamond.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $7sfGs$jsx, jsxs as $7sfGs$jsxs} from "react/jsx-runtime";
import {createContext as $7sfGs$createContext, forwardRef as $7sfGs$forwardRef, useRef as $7sfGs$useRef, useEffect as $7sfGs$useEffect} from "react";
import {Provider as $7sfGs$Provider} from "react-aria-components";
import {filterDOMProps as $7sfGs$filterDOMProps} from "@react-aria/utils";
import {useDOMRef as $7sfGs$useDOMRef} from "@react-spectrum/utils";
import {useFocusRing as $7sfGs$useFocusRing} from "react-aria";
import {useLocalizedStringFormatter as $7sfGs$useLocalizedStringFormatter} from "@react-aria/i18n";


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}
/*
 * Copyright 2023 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 $fc2cf6b397804b9c$export$c0de4eca0a8bf011 = /*#__PURE__*/ (0, $7sfGs$createContext)(null);
const $fc2cf6b397804b9c$var$inlineAlert = function anonymous(props, overrides) {
    let rules = " ";
    let position = 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|Z|N|L)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "_P") position = true;
        rules += p[0];
    }
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' Olc12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    rules += ' sg12';
    if (!position) rules += ' _Pc12';
    rules += ' _oa12';
    rules += ' Th12';
    rules += ' Qh12';
    rules += ' Sh12';
    rules += ' Rh12';
    rules += ' oc12';
    rules += ' nc12';
    rules += ' kc12';
    rules += ' jc12';
    rules += ' _jf12';
    rules += ' _kc12';
    rules += ' hc12';
    rules += ' mc12';
    rules += ' lc12';
    if (props.fillStyle === "boldFill") rules += ' iA12';
    else if (props.fillStyle === "subtleFill") rules += ' iA12';
    else if (props.fillStyle === "border") {
        if (props.variant === "neutral") rules += ' iy12';
        else if (props.variant === "negative") rules += ' it12';
        else if (props.variant === "notice") rules += ' is12';
        else if (props.variant === "positive") rules += ' il12';
        else if (props.variant === "informative") rules += ' ix12';
    }
    if (props.variant === "neutral") {
        if (props.fillStyle === "boldFill") rules += ' g612';
        else if (props.fillStyle === "subtleFill") rules += ' gI12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "negative") {
        if (props.fillStyle === "boldFill") rules += ' gB12';
        else if (props.fillStyle === "subtleFill") rules += ' gU12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "notice") {
        if (props.fillStyle === "boldFill") rules += ' gQ12';
        else if (props.fillStyle === "subtleFill") rules += ' gV12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "positive") {
        if (props.fillStyle === "boldFill") rules += ' g112';
        else if (props.fillStyle === "subtleFill") rules += ' gA12';
        else if (props.fillStyle === "border") rules += ' gX12';
    } else if (props.variant === "informative") {
        if (props.fillStyle === "boldFill") rules += ' g212';
        else if (props.fillStyle === "subtleFill") rules += ' gG12';
        else if (props.fillStyle === "border") rules += ' gX12';
    }
    return rules;
};
const $fc2cf6b397804b9c$var$icon = function anonymous(props) {
    let rules = " ";
    rules += ' __wa12';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' -_8sjo0b-tcwrnr12';
        else rules += ' -_8sjo0b-tw12';
    } else if (props.fillStyle === "subtleFill") {
        if (props.variant === "neutral") rules += ' -_8sjo0b-tf12';
        else if (props.variant === "negative") rules += ' -_8sjo0b-tq12';
        else if (props.variant === "notice") rules += ' -_8sjo0b-tq12';
        else if (props.variant === "positive") rules += ' -_8sjo0b-tt12';
        else if (props.variant === "informative") rules += ' -_8sjo0b-tu12';
    } else if (props.fillStyle === "border") {
        if (props.variant === "neutral") rules += ' -_8sjo0b-tf12';
        else if (props.variant === "negative") rules += ' -_8sjo0b-tq12';
        else if (props.variant === "notice") rules += ' -_8sjo0b-tm12';
        else if (props.variant === "positive") rules += ' -_8sjo0b-tt12';
        else if (props.variant === "informative") rules += ' -_8sjo0b-tu12';
    }
    return rules;
};
let $fc2cf6b397804b9c$var$ICONS = {
    informative: (0, $4c8f17dac3ecefd9$export$2e2bcd8739ae039),
    positive: (0, $22a7d72fc05e138d$export$2e2bcd8739ae039),
    notice: (0, $a951460932d22d7b$export$2e2bcd8739ae039),
    negative: (0, $e17a4836f4b6cc28$export$2e2bcd8739ae039),
    neutral: undefined
};
const $fc2cf6b397804b9c$var$heading = function anonymous(props) {
    let rules = " ";
    rules += ' Jy12';
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' -_6BNtrc-c12';
    rules += ' vx12';
    rules += ' xd12';
    rules += ' _xa12';
    rules += ' xX0cczbc12';
    rules += ' _xX0cczba12';
    rules += ' xfd12';
    rules += ' _xfa12';
    rules += ' xfX0cczbc12';
    rules += ' _xfX0cczba12';
    rules += ' _Fd12';
    rules += ' _FnuYUweb12';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' pg12';
        else rules += ' px12';
    } else rules += ' po12';
    return rules;
};
const $fc2cf6b397804b9c$var$content = function anonymous(props) {
    let rules = " ";
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' -_6BNtrc-c12';
    rules += ' vx12';
    rules += ' xb12';
    rules += ' _xa12';
    rules += ' _Fb12';
    rules += ' _FnuYUwec12';
    if (props.fillStyle === "boldFill") {
        if (props.variant === "notice") rules += ' pg12';
        else rules += ' px12';
    } else rules += ' pt12';
    return rules;
};
const $fc2cf6b397804b9c$export$a3b2c96db9b0eb71 = /*#__PURE__*/ (0, $7sfGs$forwardRef)(function InlineAlert(props, ref) {
    let stringFormatter = (0, $7sfGs$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7sfGs$intlStringsmjs))), '@react-spectrum/s2');
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $fc2cf6b397804b9c$export$c0de4eca0a8bf011);
    let { children: children, variant: variant = 'neutral', fillStyle: fillStyle = 'border', autoFocus: autoFocus } = props;
    let domRef = (0, $7sfGs$useDOMRef)(ref);
    let Icon = null;
    let iconAlt = '';
    if (variant in $fc2cf6b397804b9c$var$ICONS) {
        Icon = $fc2cf6b397804b9c$var$ICONS[variant];
        if (Icon) iconAlt = stringFormatter.format(`inlinealert.${variant}`);
    }
    let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $7sfGs$useFocusRing)({
        autoFocus: props.autoFocus
    });
    let autoFocusRef = (0, $7sfGs$useRef)(props.autoFocus);
    (0, $7sfGs$useEffect)(()=>{
        if (autoFocusRef.current && domRef.current) domRef.current.focus();
        autoFocusRef.current = false;
    }, [
        domRef
    ]);
    return /*#__PURE__*/ (0, $7sfGs$jsx)("div", {
        ...(0, $7sfGs$filterDOMProps)(props),
        ...focusProps,
        ref: domRef,
        tabIndex: autoFocus ? -1 : undefined,
        autoFocus: autoFocus,
        role: "alert",
        style: props.UNSAFE_style,
        className: (props.UNSAFE_className || '') + $fc2cf6b397804b9c$var$inlineAlert({
            variant: variant,
            fillStyle: fillStyle,
            isFocusVisible: isFocusVisible
        }, props.styles),
        children: /*#__PURE__*/ (0, $7sfGs$jsxs)((0, $7sfGs$Provider), {
            values: [
                [
                    (0, $8e847109a6ab556d$export$d688439359537581),
                    {
                        styles: $fc2cf6b397804b9c$var$heading({
                            fillStyle: fillStyle
                        })
                    }
                ],
                [
                    (0, $8e847109a6ab556d$export$1cbdd774077931b4),
                    {
                        styles: $fc2cf6b397804b9c$var$content({
                            fillStyle: fillStyle
                        })
                    }
                ],
                [
                    (0, $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed),
                    {
                        styles: $fc2cf6b397804b9c$var$icon({
                            variant: variant,
                            fillStyle: fillStyle
                        })
                    }
                ]
            ],
            children: [
                Icon && /*#__PURE__*/ (0, $7sfGs$jsx)(Icon, {
                    "aria-label": iconAlt
                }),
                children
            ]
        })
    });
});


export {$fc2cf6b397804b9c$export$c0de4eca0a8bf011 as InlineAlertContext, $fc2cf6b397804b9c$export$a3b2c96db9b0eb71 as InlineAlert};
//# sourceMappingURL=InlineAlert.mjs.map
