import "./Disclosure.css";
import {ActionButtonContext as $da878a05ab4a403e$export$2ff682723a46d413} from "./ActionButton.mjs";
import {CenterBaseline as $1f4b04be3f24aae3$export$768dac55bb57081d} from "./CenterBaseline.mjs";
import $4b69f02ec06b9226$export$2e2bcd8739ae039 from "./Chevron.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $7VHtn$jsx, jsxs as $7VHtn$jsxs} from "react/jsx-runtime";
import {Provider as $7VHtn$Provider, Disclosure as $7VHtn$Disclosure, useSlottedContext as $7VHtn$useSlottedContext, useLocale as $7VHtn$useLocale, DisclosureStateContext as $7VHtn$DisclosureStateContext, Heading as $7VHtn$Heading, Button as $7VHtn$Button, DisclosurePanel as $7VHtn$DisclosurePanel} from "react-aria-components";
import {filterDOMProps as $7VHtn$filterDOMProps} from "@react-aria/utils";
import {createContext as $7VHtn$createContext, forwardRef as $7VHtn$forwardRef, useContext as $7VHtn$useContext} from "react";
import {useDOMRef as $7VHtn$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 $cf1d656285911959$export$d665dd135a51b28a = /*#__PURE__*/ (0, $7VHtn$createContext)(null);
const $cf1d656285911959$var$disclosure = function anonymous(props, overrides) {
    let rules = " ";
    let minWidth = 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] === "N") minWidth = true;
        rules += p[0];
    }
    rules += ' po11';
    if (props.isQuiet) rules += ' _ka11';
    else rules += ' _kb11';
    if (props.isInGroup) {
        rules += ' ha11';
        if (props.isQuiet) rules += ' hka11';
        else rules += ' hkb11';
    } else if (props.isQuiet) rules += ' ha11';
    else rules += ' hb11';
    rules += ' ma11';
    rules += ' la11';
    rules += ' _jf11';
    rules += ' ir11';
    if (!minWidth) rules += ' Ng11';
    return rules;
};
const $cf1d656285911959$export$74a362b31437ec83 = /*#__PURE__*/ (0, $7VHtn$forwardRef)(function Disclosure(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $cf1d656285911959$export$d665dd135a51b28a);
    let { size: size = 'M', density: density = 'regular', isQuiet: isQuiet, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
    let domRef = (0, $7VHtn$useDOMRef)(ref);
    let isInGroup = (0, $7VHtn$useContext)($cf1d656285911959$export$d665dd135a51b28a) !== null;
    return /*#__PURE__*/ (0, $7VHtn$jsx)((0, $7VHtn$Provider), {
        values: [
            [
                $cf1d656285911959$export$d665dd135a51b28a,
                {
                    size: size,
                    isQuiet: isQuiet,
                    density: density
                }
            ]
        ],
        children: /*#__PURE__*/ (0, $7VHtn$jsx)((0, $7VHtn$Disclosure), {
            ...props,
            ref: domRef,
            style: UNSAFE_style,
            className: (UNSAFE_className ?? '') + $cf1d656285911959$var$disclosure({
                isQuiet: isQuiet,
                isInGroup: isInGroup
            }, props.styles),
            children: props.children
        })
    });
});
const $cf1d656285911959$var$headingStyle = " Jy11 Gy11 Iy11 Hy11 _ub11 sd11 _vb11 Na11";
const $cf1d656285911959$var$buttonStyles = function anonymous(props) {
    let rules = " ";
    if (props.isFocusVisible) rules += ' _Lf11';
    else rules += ' _Le11';
    rules += ' Oh11';
    rules += ' Olc11';
    rules += ' _Mc11';
    rules += ' _Kb11';
    rules += ' uk11';
    rules += ' ucJ9TBTb11';
    rules += ' ud3Euai11';
    rules += ' uea11';
    rules += ' ugb11';
    rules += ' uhd11';
    rules += ' uje11';
    rules += ' u2NhKxcl11';
    rules += ' uic11';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-f11';
        rules += ' vx11';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-e11';
        rules += ' vx11';
    } else if (props.size === "M") {
        rules += ' -_6BNtrc-d11';
        rules += ' vx11';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-c11';
        rules += ' vx11';
    }
    rules += ' xd11';
    rules += ' _xa11';
    rules += ' xX0cczbc11';
    rules += ' _xX0cczba11';
    rules += ' _Fd11';
    rules += ' _FnuYUweb11';
    if (props.isDisabled) {
        rules += ' pp11';
        rules += ' plc11';
    } else {
        if (props.isPressed) rules += ' po11';
        else if (props.isFocusVisible) rules += ' po11';
        else if (props.isHovered) rules += ' po11';
        else rules += ' pt11';
        rules += ' plb11';
    }
    rules += ' sd11';
    rules += ' _ub11';
    rules += ' ea11';
    rules += ' S6FcKR11';
    rules += ' R6FcKR11';
    rules += ' Tu7Fubd11';
    rules += ' Qu7Fubd11';
    rules += ' U6FcKR11';
    rules += ' q6FcKR11';
    rules += ' MAyFGYc11';
    rules += ' Za11';
    if (props.isPressed) rules += ' gnSjEFb11';
    else if (props.isHovered) rules += ' gabY4te11';
    else if (props.isFocusVisible) rules += ' gabY4te11';
    else rules += ' g911';
    rules += ' Yd11';
    rules += ' Xb11';
    rules += ' _2b11';
    rules += ' _kJ8iPYd11';
    rules += ' hXMFGYc11';
    rules += ' ma11';
    rules += ' la11';
    if (props.isQuiet) rules += ' ob11';
    else if (props.isFocusVisible) rules += ' ob11';
    else rules += ' od11';
    if (props.isQuiet) rules += ' nb11';
    else if (props.isFocusVisible) rules += ' nb11';
    else rules += ' nd11';
    if (props.isQuiet) rules += ' kb11';
    else if (props.isFocusVisible) rules += ' kb11';
    else rules += ' kd11';
    if (props.isQuiet) rules += ' jb11';
    else if (props.isFocusVisible) rules += ' jb11';
    else rules += ' jd11';
    rules += ' _Wd11';
    rules += ' __ca11';
    if (props.size === "XL") {
        if (props.density === "spacious") rules += ' -M_-Mj11';
        else if (props.density === "regular") rules += ' -M_-Mk11';
        else if (props.density === "compact") rules += ' -M_-Mh11';
    } else if (props.size === "L") {
        if (props.density === "spacious") rules += ' -M_-Mk11';
        else if (props.density === "regular") rules += ' -M_-Mh11';
        else if (props.density === "compact") rules += ' -M_-Mi11';
    } else if (props.size === "M") {
        if (props.density === "spacious") rules += ' -M_-Mh11';
        else if (props.density === "regular") rules += ' -M_-Mi11';
        else if (props.density === "compact") rules += ' -M_-Mg11';
    } else if (props.size === "S") {
        if (props.density === "spacious") rules += ' -M_-Mi11';
        else if (props.density === "regular") rules += ' -M_-Mg11';
        else if (props.density === "compact") rules += ' -M_-Me11';
    }
    rules += ' -_k_-_ka11';
    rules += ' -h_-ha11';
    return rules;
};
const $cf1d656285911959$var$chevronStyles = function anonymous(props) {
    let rules = " ";
    if (props.isExpanded) rules += ' _Sd11';
    else if (props.isRTL) rules += ' _Sc11';
    rules += ' Yd11';
    rules += ' Xb11';
    rules += ' _2b11';
    rules += ' -_8sjo0b-t5ZbAob11';
    rules += ' _va11';
    return rules;
};
const $cf1d656285911959$var$InternalDisclosureHeader = /*#__PURE__*/ (0, $7VHtn$createContext)(null);
function $cf1d656285911959$var$DisclosureHeaderWithForwardRef(props, ref) {
    let { UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, children: children } = props;
    let domRef = (0, $7VHtn$useDOMRef)(ref);
    let { size: size, isQuiet: isQuiet, density: density } = (0, $7VHtn$useSlottedContext)($cf1d656285911959$export$d665dd135a51b28a);
    // Shift button size down by 2 for compact density, 1 for regular/spacious to ensure there is space between the top and bottom of the action button and container
    let newSize = size;
    const sizes = [
        'XS',
        'S',
        'M',
        'L',
        'XL'
    ];
    const currentIndex = sizes.indexOf(size ?? 'M');
    const shift = density === 'compact' ? 2 : 1;
    newSize = sizes[Math.max(0, currentIndex - shift)];
    return /*#__PURE__*/ (0, $7VHtn$jsx)((0, $7VHtn$Provider), {
        values: [
            [
                (0, $da878a05ab4a403e$export$2ff682723a46d413),
                {
                    size: newSize,
                    isQuiet: isQuiet
                }
            ],
            [
                $cf1d656285911959$var$InternalDisclosureHeader,
                {}
            ]
        ],
        children: /*#__PURE__*/ (0, $7VHtn$jsx)("div", {
            style: UNSAFE_style,
            className: (UNSAFE_className ?? '') + " sd11 eb11 Ub11 qb11",
            ref: domRef,
            children: children
        })
    });
}
const $cf1d656285911959$export$1e037ddd32f5b8ac = /*#__PURE__*/ (0, $7VHtn$forwardRef)($cf1d656285911959$var$DisclosureHeaderWithForwardRef);
const $cf1d656285911959$export$7843c6a5b3e340a2 = /*#__PURE__*/ (0, $7VHtn$forwardRef)(function DisclosureTitle(props, ref) {
    let { level: level = 3, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', ...otherProps } = props;
    let domRef = (0, $7VHtn$useDOMRef)(ref);
    const domProps = (0, $7VHtn$filterDOMProps)(otherProps);
    let { direction: direction } = (0, $7VHtn$useLocale)();
    let { isExpanded: isExpanded } = (0, $7VHtn$useContext)((0, $7VHtn$DisclosureStateContext));
    let { size: size, density: density, isQuiet: isQuiet } = (0, $7VHtn$useSlottedContext)($cf1d656285911959$export$d665dd135a51b28a);
    let isRTL = direction === 'rtl';
    let buttonTrigger = /*#__PURE__*/ (0, $7VHtn$jsx)((0, $7VHtn$Heading), {
        ...domProps,
        level: level,
        ref: domRef,
        style: UNSAFE_style,
        className: (UNSAFE_className ?? '') + $cf1d656285911959$var$headingStyle,
        children: /*#__PURE__*/ (0, $7VHtn$jsxs)((0, $7VHtn$Button), {
            className: (renderProps)=>$cf1d656285911959$var$buttonStyles({
                    ...renderProps,
                    size: size,
                    density: density,
                    isQuiet: isQuiet
                }),
            slot: "trigger",
            children: [
                /*#__PURE__*/ (0, $7VHtn$jsx)((0, $1f4b04be3f24aae3$export$768dac55bb57081d), {
                    children: /*#__PURE__*/ (0, $7VHtn$jsx)((0, $4b69f02ec06b9226$export$2e2bcd8739ae039), {
                        size: size,
                        className: $cf1d656285911959$var$chevronStyles({
                            isExpanded: isExpanded,
                            isRTL: isRTL
                        }),
                        "aria-hidden": "true"
                    })
                }),
                props.children
            ]
        })
    });
    let ctx = (0, $7VHtn$useContext)($cf1d656285911959$var$InternalDisclosureHeader);
    if (ctx) return buttonTrigger;
    return /*#__PURE__*/ (0, $7VHtn$jsx)($cf1d656285911959$export$1e037ddd32f5b8ac, {
        children: buttonTrigger
    });
});
const $cf1d656285911959$var$panelStyles = " uk11 ucJ9TBTb11 ud3Euai11 uea11 ugb11 uhd11 uje11 u2NhKxcl11 uic11 -_6BNtrc-d11 vx11 xb11 _xa11 _Fb11 _FnuYUwec11 pt11 FfwmW1d11 _Nb11 Pb11 Ysgyfc11 Ydklsgce11 Xb11 Xdklsgcb11 _2b11 _2dklsgcb11";
const $cf1d656285911959$var$panelInner = function anonymous(props) {
    let rules = " ";
    rules += ' Tt11';
    rules += ' Qf11';
    if (props.size === "XL") rules += ' Sz5EUbe11';
    else if (props.size === "L") rules += ' Se11';
    else if (props.size === "M") rules += ' SLabwmd11';
    else if (props.size === "S") rules += ' St11';
    if (props.size === "XL") rules += ' Rz5EUbe11';
    else if (props.size === "L") rules += ' Re11';
    else if (props.size === "M") rules += ' RLabwmd11';
    else if (props.size === "S") rules += ' Rt11';
    return rules;
};
const $cf1d656285911959$export$feabaa331e1d464c = /*#__PURE__*/ (0, $7VHtn$forwardRef)(function DisclosurePanel(props, ref) {
    let { UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', ...otherProps } = props;
    const domProps = (0, $7VHtn$filterDOMProps)(otherProps);
    let { size: size } = (0, $7VHtn$useSlottedContext)($cf1d656285911959$export$d665dd135a51b28a);
    let panelRef = (0, $7VHtn$useDOMRef)(ref);
    return /*#__PURE__*/ (0, $7VHtn$jsx)((0, $7VHtn$DisclosurePanel), {
        ...domProps,
        ref: panelRef,
        style: UNSAFE_style,
        className: (UNSAFE_className ?? '') + $cf1d656285911959$var$panelStyles,
        children: /*#__PURE__*/ (0, $7VHtn$jsx)("div", {
            className: $cf1d656285911959$var$panelInner({
                size: size
            }),
            children: props.children
        })
    });
});


export {$cf1d656285911959$export$d665dd135a51b28a as DisclosureContext, $cf1d656285911959$export$74a362b31437ec83 as Disclosure, $cf1d656285911959$export$1e037ddd32f5b8ac as DisclosureHeader, $cf1d656285911959$export$7843c6a5b3e340a2 as DisclosureTitle, $cf1d656285911959$export$feabaa331e1d464c as DisclosurePanel};
//# sourceMappingURL=Disclosure.mjs.map
