import "./Link.css";
import {SkeletonContext as $5ad421ec19460c48$export$74e166679b1f49ee, useSkeletonText as $5ad421ec19460c48$export$a05a0b8a311cd65f} from "../icons/Skeleton.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $d6Kqa$jsx} from "react/jsx-runtime";
import {Link as $d6Kqa$Link} from "react-aria-components";
import {createContext as $d6Kqa$createContext, forwardRef as $d6Kqa$forwardRef, useContext as $d6Kqa$useContext} from "react";
import {useFocusableRef as $d6Kqa$useFocusableRef} from "@react-spectrum/utils";
import {useLayoutEffect as $d6Kqa$useLayoutEffect} from "@react-aria/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 $f50c78733c21bfe2$export$e2509388b49734e7 = /*#__PURE__*/ (0, $d6Kqa$createContext)(null);
const $f50c78733c21bfe2$var$link = function anonymous(props, overrides) {
    let rules = " ";
    rules += (String(overrides || '').match(/(?:^|\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) || []).join('');
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    if (props.isStaticColor) rules += ' Oe12';
    else rules += ' Oh12';
    rules += ' Olc12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    if (props.staticColor === "white") rules += ' -Ovbhqd-gcwrnr12';
    else if (props.staticColor === "black") rules += ' -Ovbhqd-g4hn3s12';
    rules += ' oa12';
    rules += ' na12';
    rules += ' ka12';
    rules += ' ja12';
    if (props.isStandalone) {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    }
    if (props.isStandalone) {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    if (props.isStandalone) {
        rules += ' xc12';
        rules += ' _xa12';
    }
    if (props.isStandalone) {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    }
    if (props.isStaticColor) rules += ' pl12';
    else if (props.variant === "secondary") {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    } else if (props.variant === "primary") {
        if (props.isPressed) rules += ' ps12';
        else if (props.isFocusVisible) rules += ' ps12';
        else if (props.isHovered) rules += ' ps12';
        else rules += ' pu12';
    }
    rules += ' plf12';
    rules += ' Yd12';
    rules += ' Xb12';
    rules += ' _2b12';
    if (props.isStandalone) {
        if (props.isQuiet) {
            if (props.isFocusVisible) {
                rules += ' _Xb12';
                rules += ' __Va12';
            } else if (props.isHovered) {
                rules += ' _Xb12';
                rules += ' __Va12';
            } else rules += ' _Xa12';
        }
    } else {
        rules += ' _Xb12';
        rules += ' __Va12';
    }
    rules += ' __ca12';
    return rules;
};
const $f50c78733c21bfe2$export$a6c7ac8248d6e38a = /*#__PURE__*/ (0, $d6Kqa$forwardRef)(function Link(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $f50c78733c21bfe2$export$e2509388b49734e7);
    let { variant: variant = 'primary', staticColor: staticColor, isQuiet: isQuiet, isStandalone: isStandalone, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', styles: styles, children: children } = props;
    let domRef = (0, $d6Kqa$useFocusableRef)(ref);
    let isSkeleton = (0, $d6Kqa$useContext)((0, $5ad421ec19460c48$export$74e166679b1f49ee)) || false;
    [children, UNSAFE_style] = (0, $5ad421ec19460c48$export$a05a0b8a311cd65f)(children, UNSAFE_style);
    (0, $d6Kqa$useLayoutEffect)(()=>{
        if (domRef.current) // TODO: should RAC Link pass through inert?
        domRef.current.inert = isSkeleton;
    }, [
        domRef,
        isSkeleton
    ]);
    return /*#__PURE__*/ (0, $d6Kqa$jsx)((0, $d6Kqa$Link), {
        ...props,
        ref: domRef,
        style: UNSAFE_style,
        className: (renderProps)=>UNSAFE_className + $f50c78733c21bfe2$var$link({
                ...renderProps,
                variant: variant,
                staticColor: staticColor,
                isStaticColor: !!staticColor,
                isQuiet: isQuiet,
                isStandalone: isStandalone,
                isSkeleton: isSkeleton
            }, styles),
        children: children
    });
});


export {$f50c78733c21bfe2$export$e2509388b49734e7 as LinkContext, $f50c78733c21bfe2$export$a6c7ac8248d6e38a as Link};
//# sourceMappingURL=Link.mjs.map
