import "./RadioGroup.css";
import {CenterBaseline as $1f4b04be3f24aae3$export$768dac55bb57081d} from "./CenterBaseline.mjs";
import {FieldLabel as $9afd80978c252040$export$1acdcf5a973a8414, HelpText as $9afd80978c252040$export$a67c0bc59081311a} from "./Field.mjs";
import {FormContext as $9b916426527cebe7$export$c24727297075ec6a, useFormProps as $9b916426527cebe7$export$a6b5be5c6b451665} from "./Form.mjs";
import {pressScale as $10ea7662e51a285b$export$56e8cba416805d8d} from "./pressScale.mjs";
import {useDOMRef as $80ecb974df713a30$export$c2c55ef9111cafd8, useFocusableRef as $80ecb974df713a30$export$96a734597687c040} from "./useDOMRef.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../../icons/useSpectrumContextProps.mjs";
import {jsx as $fZVHt$jsx, jsxs as $fZVHt$jsxs, Fragment as $fZVHt$Fragment} from "react/jsx-runtime";
import {RadioGroup as $fZVHt$RadioGroup, Radio as $fZVHt$Radio} from "react-aria-components/RadioGroup";
import {createContext as $fZVHt$createContext, forwardRef as $fZVHt$forwardRef, useContext as $fZVHt$useContext, useRef as $fZVHt$useRef} from "react";

/*
 * 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 $9a2afae66771094f$export$a79eda4ff50e30b6 = /*#__PURE__*/ (0, $fZVHt$createContext)(null);
const $9a2afae66771094f$export$a98f0dcb43a68a25 = /*#__PURE__*/ (0, $fZVHt$forwardRef)(function RadioGroup(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $9a2afae66771094f$export$a79eda4ff50e30b6);
    let formContext = (0, $fZVHt$useContext)((0, $9b916426527cebe7$export$c24727297075ec6a));
    props = (0, $9b916426527cebe7$export$a6b5be5c6b451665)(props);
    let domRef = (0, $80ecb974df713a30$export$c2c55ef9111cafd8)(ref);
    let { label: label, description: description, errorMessage: errorMessage, children: children, isEmphasized: isEmphasized, labelPosition: labelPosition = 'top', labelAlign: labelAlign = 'start', necessityIndicator: necessityIndicator = 'icon', size: size = 'M', orientation: orientation = 'vertical', UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, ...groupProps } = props;
    return /*#__PURE__*/ (0, $fZVHt$jsx)((0, $fZVHt$RadioGroup), {
        ...groupProps,
        orientation: orientation,
        ref: domRef,
        style: UNSAFE_style,
        className: UNSAFE_className + function anonymous(props, overrides) {
            let rules = " ";
            let gridColumnStart = false;
            let gridColumnEnd = 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] === "z") gridColumnStart = true;
                if (p[1] === "y") gridColumnEnd = true;
                rules += p[0];
            }
            rules += ' se12';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU12';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG12';
                }
            }
            if (props.isInForm) rules += ' DLwlgod12';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb12';
                else if (props.labelPosition === "top") rules += ' DM8Mfn12';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb12';
            else if (props.labelPosition === "top") rules += ' E4w1sLc12';
            if (props.labelPosition === "side") rules += ' CbRM95c12';
            else if (props.labelPosition === "top") rules += ' Cxaocre12';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e12';
                rules += ' vx12';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d12';
                rules += ' vx12';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b12';
                rules += ' vx12';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a12';
                rules += ' vx12';
            } else {
                rules += ' -_6BNtrc-c12';
                rules += ' vx12';
            }
            rules += ' ea12';
            rules += ' _Fd12';
            rules += ' _FnuYUweb12';
            if (props.size === "XL") rules += ' -BhX7R-Fz12';
            else if (props.size === "L") rules += ' -BhX7R-Fv12';
            else if (props.size === "S") rules += ' -BhX7R-Fp12';
            else if (props.size === "XS") rules += ' -BhX7R-Fn12';
            else rules += ' -BhX7R-Fx12';
            rules += ' -AJjOLd-UVxyPec12';
            rules += ' qg12';
            rules += ' __ca12';
            return rules;
        }({
            size: size,
            labelPosition: labelPosition,
            isInForm: !!formContext
        }, props.styles),
        children: ({ isDisabled: isDisabled, isInvalid: isInvalid })=>/*#__PURE__*/ (0, $fZVHt$jsxs)((0, $fZVHt$Fragment), {
                children: [
                    /*#__PURE__*/ (0, $fZVHt$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
                        isDisabled: isDisabled,
                        isRequired: props.isRequired,
                        size: size,
                        labelPosition: labelPosition,
                        labelAlign: labelAlign,
                        necessityIndicator: necessityIndicator,
                        contextualHelp: props.contextualHelp,
                        children: label
                    }),
                    /*#__PURE__*/ (0, $fZVHt$jsx)("div", {
                        className: function anonymous(props) {
                            let rules = " ";
                            rules += ' zXcEWr12';
                            rules += ' yXcEWr12';
                            rules += ' BXcEWr12';
                            rules += ' AXcEWr12';
                            rules += ' sd12';
                            if (props.orientation === "horizontal") rules += ' _tc12';
                            else if (props.orientation === "vertical") rules += ' _ta12';
                            rules += ' _wb12';
                            rules += ' ql12';
                            rules += ' UgOnRt12';
                            return rules;
                        }({
                            orientation: orientation
                        }),
                        children: /*#__PURE__*/ (0, $fZVHt$jsx)((0, $9b916426527cebe7$export$c24727297075ec6a).Provider, {
                            value: {
                                ...formContext,
                                size: size,
                                isEmphasized: isEmphasized
                            },
                            children: children
                        })
                    }),
                    /*#__PURE__*/ (0, $fZVHt$jsx)((0, $9afd80978c252040$export$a67c0bc59081311a), {
                        size: size,
                        isDisabled: isDisabled,
                        isInvalid: isInvalid,
                        description: description,
                        showErrorIcon: true,
                        children: errorMessage
                    })
                ]
            })
    });
});
const $9a2afae66771094f$var$wrapper = function anonymous(props, overrides) {
    let rules = " ";
    let position = false;
    let gridColumnStart = 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;
        if (p[1] === "z") gridColumnStart = true;
        rules += p[0];
    }
    rules += ' sd12';
    if (!position) rules += ' _Pc12';
    rules += ' qf12';
    rules += ' ea12';
    if (props.size === "XL") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "L") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "S") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "XS") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    if (props.size === "XL") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "L") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "S") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "XS") {
        rules += ' xb12';
        rules += ' _xa12';
    } else {
        rules += ' xb12';
        rules += ' _xa12';
    }
    if (props.size === "XL") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "L") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "S") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "XS") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    }
    if (props.isDisabled) {
        rules += ' pp12';
        rules += ' plc12';
    } else {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    }
    rules += ' Yc12';
    rules += ' Xb12';
    rules += ' _2b12';
    if (props.isInForm) {
        if (!gridColumnStart) rules += ' zhJUGr12';
    }
    rules += ' __ca12';
    return rules;
};
const $9a2afae66771094f$var$circle = function anonymous(props) {
    let rules = " ";
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' Olc12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    if (props.size === "XL") rules += ' Zm12';
    else if (props.size === "L") rules += ' Zl12';
    else if (props.size === "S") rules += ' Zk12';
    else rules += ' Zu12';
    rules += ' FRuFGYc12';
    rules += ' _va12';
    rules += ' sd12';
    rules += ' eb12';
    rules += ' _Ca12';
    rules += ' Yd12';
    rules += ' Xb12';
    rules += ' _2b12';
    rules += ' og12';
    rules += ' ng12';
    rules += ' kg12';
    rules += ' jg12';
    rules += ' _jf12';
    rules += ' _oa12';
    if (props.isSelected) rules += ' _kUXU7p12';
    else rules += ' _k7m7Gv12';
    if (props.isSelected) rules += ' hUXU7p12';
    else rules += ' h7m7Gv12';
    if (props.isSelected) rules += ' mUXU7p12';
    else rules += ' m7m7Gv12';
    if (props.isSelected) rules += ' lUXU7p12';
    else rules += ' l7m7Gv12';
    rules += ' _yb12';
    rules += ' gX12';
    if (props.isDisabled) {
        rules += ' io12';
        rules += ' ilc12';
    } else if (props.isInvalid) {
        if (props.isPressed) rules += ' im12';
        else if (props.isFocusVisible) rules += ' im12';
        else if (props.isHovered) rules += ' im12';
        else rules += ' ip12';
        rules += ' ile12';
    } else if (props.isSelected) {
        if (props.isEmphasized) {
            if (props.isPressed) rules += ' iu12';
            else if (props.isFocusVisible) rules += ' iu12';
            else if (props.isHovered) rules += ' iu12';
            else rules += ' iw12';
        }
        rules += ' ild12';
    } else {
        if (props.isPressed) rules += ' in12';
        else if (props.isFocusVisible) rules += ' in12';
        else if (props.isHovered) rules += ' in12';
        else rules += ' iv12';
        rules += ' ila12';
    }
    if (props.size === "XL") rules += ' -F_-Fn12';
    else if (props.size === "L") rules += ' -F_-Fm12';
    else if (props.size === "S") rules += ' -F_-Fl12';
    else rules += ' -F_-Ft12';
    return rules;
};
const $9a2afae66771094f$export$d7b12c4107be0d61 = /*#__PURE__*/ (0, $fZVHt$forwardRef)(function Radio(props, ref) {
    let { children: children, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style } = props;
    let circleRef = (0, $fZVHt$useRef)(null);
    let inputRef = (0, $fZVHt$useRef)(null);
    let domRef = (0, $80ecb974df713a30$export$96a734597687c040)(ref, inputRef);
    let isInForm = !!(0, $fZVHt$useContext)((0, $9b916426527cebe7$export$c24727297075ec6a));
    let { size: size = 'M', ...allProps } = (0, $9b916426527cebe7$export$a6b5be5c6b451665)(props);
    return /*#__PURE__*/ (0, $fZVHt$jsx)((0, $fZVHt$Radio), {
        ...allProps,
        ref: domRef,
        inputRef: inputRef,
        style: UNSAFE_style,
        className: (renderProps)=>UNSAFE_className + $9a2afae66771094f$var$wrapper({
                ...renderProps,
                isInForm: isInForm,
                size: size
            }, allProps.styles),
        children: (renderProps)=>/*#__PURE__*/ (0, $fZVHt$jsxs)((0, $fZVHt$Fragment), {
                children: [
                    /*#__PURE__*/ (0, $fZVHt$jsx)((0, $1f4b04be3f24aae3$export$768dac55bb57081d), {
                        children: /*#__PURE__*/ (0, $fZVHt$jsx)("div", {
                            ref: circleRef,
                            style: (0, $10ea7662e51a285b$export$56e8cba416805d8d)(circleRef)(renderProps),
                            className: $9a2afae66771094f$var$circle({
                                ...renderProps,
                                isEmphasized: allProps.isEmphasized,
                                isSelected: renderProps.isSelected,
                                size: size
                            })
                        })
                    }),
                    children
                ]
            })
    });
});


export {$9a2afae66771094f$export$a79eda4ff50e30b6 as RadioGroupContext, $9a2afae66771094f$export$a98f0dcb43a68a25 as RadioGroup, $9a2afae66771094f$export$d7b12c4107be0d61 as Radio};
//# sourceMappingURL=RadioGroup.mjs.map
