import "./Picker.css";
import {AvatarContext as $3ffa2cd930156220$export$a20dad690e1279e2} from "./Avatar.mjs";
import {box as $9b405e0f8095dce0$export$827f4ee28efc37, iconStyles as $9b405e0f8095dce0$export$2c99b98b77550cb4} from "./Checkbox.mjs";
import {centerBaseline as $1f4b04be3f24aae3$export$9d7e2342a7e53afa} from "./CenterBaseline.mjs";
import {checkbox as $13afb0ea5f0ed767$export$b07e517d22efa1ca, checkmark as $13afb0ea5f0ed767$export$292abbf31ed842a, description as $13afb0ea5f0ed767$export$6d59db4903f20f7d, icon as $13afb0ea5f0ed767$export$1ca1ec8b29a4ce27, iconCenterWrapper as $13afb0ea5f0ed767$export$31d1842a0fd736e6, label as $13afb0ea5f0ed767$export$1237798dc640739a, sectionHeading as $13afb0ea5f0ed767$export$300ac6f106ef584d} from "./Menu.mjs";
import $81cf3d4588736e7d$export$2e2bcd8739ae039 from "./Checkmark.mjs";
import $4b69f02ec06b9226$export$2e2bcd8739ae039 from "./Chevron.mjs";
import {Divider as $a2f262fac286a920$export$2e0a83ec2e27ecbb, listbox as $a2f262fac286a920$export$9901d82449b93cea, listboxHeader as $a2f262fac286a920$export$c040ba7a724e8da1, listboxItem as $a2f262fac286a920$export$68265fb354482bae, LOADER_ROW_HEIGHTS as $a2f262fac286a920$export$83379f5245567d78} from "./ComboBox.mjs";
import {FieldErrorIcon as $9afd80978c252040$export$bda0d075e0e342c9, 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 {HeaderContext as $8e847109a6ab556d$export$e0e4026c12a8bdbb, HeadingContext as $8e847109a6ab556d$export$d688439359537581, Text as $8e847109a6ab556d$export$5f1af8db9871e1d6, TextContext as $8e847109a6ab556d$export$9afb8bc826b033ea} from "./Content.mjs";
import {IconContext as $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed} from "../icons/Icon.mjs";
import $c77I5$intlStringsmjs from "./intlStrings.mjs";
import {mergeStyles as $feb886035e0d4633$export$e618dc39ac9ad607} from "../icons/runtime.mjs";
import {Popover as $88b746eba92c8d0d$export$5b6b19405a83ff9d} from "./Popover.mjs";
import {pressScale as $10ea7662e51a285b$export$56e8cba416805d8d} from "./pressScale.mjs";
import {ProgressCircle as $41ddd91dbbf0c389$export$c79b9d6b4cc92af7} from "./ProgressCircle.mjs";
import {useScale as $859432f3b3573fcb$export$a8d2043b2d807f4d} from "./utils.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $c77I5$jsx, jsxs as $c77I5$jsxs, Fragment as $c77I5$Fragment} from "react/jsx-runtime";
import {ListBoxLoadMoreItem as $c77I5$ListBoxLoadMoreItem, Collection as $c77I5$Collection, Select as $c77I5$Select, Virtualizer as $c77I5$Virtualizer, ListLayout as $c77I5$ListLayout, Provider as $c77I5$Provider, ListBox as $c77I5$ListBox, Button as $c77I5$Button, SelectValue as $c77I5$SelectValue, DEFAULT_SLOT as $c77I5$DEFAULT_SLOT, ListBoxItem as $c77I5$ListBoxItem, ListBoxSection as $c77I5$ListBoxSection} from "react-aria-components";
import {createHideableComponent as $c77I5$createHideableComponent} from "@react-aria/collections";
import {PressResponder as $c77I5$PressResponder} from "@react-aria/interactions";
import {createContext as $c77I5$createContext, forwardRef as $c77I5$forwardRef, useContext as $c77I5$useContext, useMemo as $c77I5$useMemo, useState as $c77I5$useState, useRef as $c77I5$useRef} from "react";
import {useFocusableRef as $c77I5$useFocusableRef} from "@react-spectrum/utils";
import {useSlotId as $c77I5$useSlotId, useGlobalListeners as $c77I5$useGlobalListeners} from "@react-aria/utils";
import {useLocalizedStringFormatter as $c77I5$useLocalizedStringFormatter, useLocale as $c77I5$useLocale} from "@react-aria/i18n";


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}
/*
 * 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 $b41c15d27fbaff7d$export$b72b8dade9393cd5 = /*#__PURE__*/ (0, $c77I5$createContext)(null);
const $b41c15d27fbaff7d$var$inputButton = function anonymous(props) {
    let rules = " ";
    if (props.isQuiet) rules += ' _Le1';
    else if (props.isFocusVisible) rules += ' _Lf1';
    else rules += ' _Le1';
    rules += ' Oh1';
    rules += ' Olc1';
    rules += ' _Mc1';
    rules += ' _Kd1';
    if (props.size === "XL") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "L") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "S") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "XS") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e1';
        rules += ' vx1';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d1';
        rules += ' vx1';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b1';
        rules += ' vx1';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a1';
        rules += ' vx1';
    } else {
        rules += ' -_6BNtrc-c1';
        rules += ' vx1';
    }
    if (props.size === "XL") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "L") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "S") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "XS") {
        rules += ' xb1';
        rules += ' _xa1';
    } else {
        rules += ' xb1';
        rules += ' _xa1';
    }
    if (props.size === "XL") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "L") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "S") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "XS") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    }
    if (props.isDisabled) rules += ' pp1';
    else {
        if (props.isPressed) rules += ' po1';
        else if (props.isFocusVisible) rules += ' po1';
        else if (props.isHovered) rules += ' po1';
        else rules += ' pt1';
    }
    rules += ' sd1';
    rules += ' eb1';
    rules += ' _oa1';
    rules += ' SMBFGYc1';
    rules += ' RfBFGYc1';
    if (props.size === "XL") rules += ' Nl1';
    else if (props.size === "L") rules += ' Nj1';
    else if (props.size === "S") rules += ' Nf1';
    else if (props.size === "XS") rules += ' Ne1';
    else rules += ' Nk1';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec1';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn1';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b1';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd1';
    else rules += ' -SFnbic-_Jb1';
    rules += ' -Bu7z1c-ob1';
    rules += ' oj1';
    rules += ' nj1';
    rules += ' kj1';
    rules += ' jj1';
    rules += ' qc1';
    rules += ' qsd1';
    rules += ' -Qg41Lb-IAxCW0c1';
    rules += ' -Qg41Lb-gLWx3bIy1';
    rules += ' FRuFGYc1';
    rules += ' zXcEWr1';
    rules += ' yXcEWr1';
    rules += ' BXcEWr1';
    rules += ' AXcEWr1';
    if (props.isQuiet) rules += ' _qd1';
    else rules += ' _qtb1';
    if (props.size === "XL") rules += ' -Anxdcc-Zt1';
    else if (props.size === "L") rules += ' -Anxdcc-ZStdtne1';
    else if (props.size === "S") rules += ' -Anxdcc-Zr1';
    else rules += ' -Anxdcc-Z3fn9H1';
    rules += ' __v6TNLWb1';
    rules += ' _Pc1';
    rules += ' _Wd1';
    rules += ' _je1';
    rules += ' _jlf1';
    if (props.isDisabled) rules += ' ilc1';
    else rules += ' ilb1';
    rules += ' Yd1';
    rules += ' Xb1';
    rules += ' _2b1';
    if (props.isQuiet) rules += ' g91';
    else if (props.isDisabled) rules += ' gH1';
    else if (props.isOpen) rules += ' gF1';
    else {
        if (props.isPressed) rules += ' gF1';
        else if (props.isFocusVisible) rules += ' gF1';
        else if (props.isHovered) rules += ' gF1';
        else rules += ' gH1';
    }
    if (props.isQuiet) rules += ' Ln1';
    rules += ' __ca1';
    if (props.size === "XL") rules += ' -F_-Fz1';
    else if (props.size === "L") rules += ' -F_-Fv1';
    else if (props.size === "S") rules += ' -F_-Fp1';
    else if (props.size === "XS") rules += ' -F_-Fn1';
    else rules += ' -F_-Fx1';
    if (props.isQuiet) rules += ' -S_-Sd1';
    else rules += ' -S_-Sv1';
    if (props.isQuiet) rules += ' -R_-Rd1';
    else rules += ' -R_-Rv1';
    return rules;
};
const $b41c15d27fbaff7d$var$quietFocusLine = " Za1 FLvNfn1 _Pa1 _lr1 og1 ng1 kg1 jg1 g_h1 gle1";
let $b41c15d27fbaff7d$export$b1e5508a851be14d = function anonymous(props) {
    let rules = " ";
    rules += ' _Le1';
    rules += ' se1';
    rules += ' Za1';
    if (props.size === "XL") rules += ' Dk92HIe1';
    else if (props.size === "L") rules += ' DyaX9Fb1';
    else if (props.size === "M") rules += ' Deb5jcb1';
    else if (props.size === "S") rules += ' DGTLJAe1';
    rules += ' _oa1';
    rules += ' K40ub4c1';
    rules += ' _Na1';
    rules += ' Pa1';
    rules += ' Tt1';
    rules += ' Qt1';
    rules += ' St1';
    rules += ' Rt1';
    rules += ' uk1';
    rules += ' ucJ9TBTb1';
    rules += ' ud3Euai1';
    rules += ' uea1';
    rules += ' ugb1';
    rules += ' uhd1';
    rules += ' uje1';
    rules += ' u2NhKxcl1';
    rules += ' uic1';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e1';
        rules += ' vx1';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d1';
        rules += ' vx1';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b1';
        rules += ' vx1';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a1';
        rules += ' vx1';
    } else {
        rules += ' -_6BNtrc-c1';
        rules += ' vx1';
    }
    rules += ' __ya1';
    return rules;
};
const $b41c15d27fbaff7d$var$invalidBorder = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec1';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn1';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b1';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd1';
    else rules += ' -SFnbic-_Jb1';
    rules += ' -Bu7z1c-ob1';
    rules += ' oj1';
    rules += ' nj1';
    rules += ' kj1';
    rules += ' jj1';
    rules += ' _Pa1';
    rules += ' Wr1';
    rules += ' _Er1';
    rules += ' _lr1';
    rules += ' _Rr1';
    rules += ' _Ob1';
    rules += ' _jf1';
    rules += ' _kc1';
    rules += ' hc1';
    rules += ' mc1';
    rules += ' lc1';
    if (props.isPressed) rules += ' im1';
    else if (props.isFocusVisible) rules += ' im1';
    else if (props.isHovered) rules += ' im1';
    else rules += ' ip1';
    rules += ' Yd1';
    rules += ' Xb1';
    rules += ' _2b1';
    return rules;
};
const $b41c15d27fbaff7d$var$valueStyles = function anonymous(props) {
    let rules = " ";
    if (props.isQuiet) rules += ' _ua1';
    else rules += ' _ub1';
    rules += ' _Nc1';
    rules += ' Pc1';
    rules += ' _Yb1';
    rules += ' _7c1';
    rules += ' sd1';
    rules += ' eb1';
    return rules;
};
const $b41c15d27fbaff7d$var$iconStyles = function anonymous(props) {
    let rules = " ";
    rules += ' _va1';
    rules += ' _Sd1';
    rules += ' -_8sjo0b-t5ZbAob1';
    if (props.isLoading) rules += ' pp1';
    return rules;
};
const $b41c15d27fbaff7d$var$avatar = " z2U5Crc1 y2U5Crc1 B2U5Crc1 A2U5Crc1 Ht1 Hsu1";
const $b41c15d27fbaff7d$var$loadingWrapperStyles = " z2mU1 yzZKy1 sd1 eb1 _Ca1 Jv1 Gv1";
const $b41c15d27fbaff7d$var$progressCircleStyles = function anonymous(props) {
    let rules = " ";
    if (props.size === "XL") rules += ' Zp1';
    else if (props.size === "L") rules += ' Zn1';
    else if (props.size === "M") rules += ' Zm1';
    else if (props.size === "S") rules += ' Zu1';
    if (props.size === "XL") rules += ' Fq1';
    else if (props.size === "L") rules += ' Fo1';
    else if (props.size === "M") rules += ' Fn1';
    else if (props.size === "S") rules += ' Ft1';
    return rules;
};
let $b41c15d27fbaff7d$var$InternalPickerContext = /*#__PURE__*/ (0, $c77I5$createContext)({
    size: 'M'
});
let $b41c15d27fbaff7d$var$InsideSelectValueContext = /*#__PURE__*/ (0, $c77I5$createContext)(false);
const $b41c15d27fbaff7d$export$ba25329847403e11 = /*#__PURE__*/ (0, $c77I5$forwardRef)(function Picker(props1, ref) {
    let stringFormatter = (0, $c77I5$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c77I5$intlStringsmjs))), '@react-spectrum/s2');
    [props1, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props1, ref, $b41c15d27fbaff7d$export$b72b8dade9393cd5);
    let domRef = (0, $c77I5$useFocusableRef)(ref);
    let formContext = (0, $c77I5$useContext)((0, $9b916426527cebe7$export$c24727297075ec6a));
    props1 = (0, $9b916426527cebe7$export$a6b5be5c6b451665)(props1);
    let { direction: direction = 'bottom', align: align = 'start', shouldFlip: shouldFlip = true, menuWidth: menuWidth, label: label, description: descriptionMessage, errorMessage: errorMessage, children: children, items: items, size: size = 'M', labelPosition: labelPosition = 'top', labelAlign: labelAlign = 'start', necessityIndicator: necessityIndicator, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, placeholder: placeholder = stringFormatter.format('picker.placeholder'), isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, ...pickerProps } = props1;
    // Better way to encode this into a style? need to account for flipping
    let menuOffset;
    if (size === 'S') menuOffset = 6;
    else if (size === 'M') menuOffset = 6;
    else if (size === 'L') menuOffset = 7;
    else menuOffset = 8;
    let renderer;
    let showButtonSpinner = (0, $c77I5$useMemo)(()=>loadingState === 'loading', [
        loadingState
    ]);
    let spinnerId = (0, $c77I5$useSlotId)([
        showButtonSpinner
    ]);
    let listBoxLoadingCircle = /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBoxLoadMoreItem), {
        className: $b41c15d27fbaff7d$var$loadingWrapperStyles,
        isLoading: loadingState === 'loadingMore',
        onLoadMore: onLoadMore,
        children: /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$PickerProgressCircle, {
            size: size,
            "aria-label": stringFormatter.format('table.loadingMore')
        })
    });
    if (typeof children === 'function' && items) renderer = /*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
        children: [
            /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Collection), {
                items: items,
                dependencies: props1.dependencies,
                children: children
            }),
            listBoxLoadingCircle
        ]
    });
    else renderer = /*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
        children: [
            children,
            listBoxLoadingCircle
        ]
    });
    let scale = (0, $859432f3b3573fcb$export$a8d2043b2d807f4d)();
    let { direction: dir } = (0, $c77I5$useLocale)();
    let RTLFlipOffset = dir === 'rtl' ? -1 : 1;
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Select), {
        ...pickerProps,
        "aria-describedby": spinnerId,
        placeholder: placeholder,
        style: UNSAFE_style,
        className: UNSAFE_className + function anonymous(props, overrides) {
            let rules = " ";
            let gridColumnStart = false;
            let gridColumnEnd = false;
            let matches = (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 += ' se1';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU1';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG1';
                }
            }
            if (props.isInForm) rules += ' DLwlgod1';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb1';
                else if (props.labelPosition === "top") rules += ' DM8Mfn1';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb1';
            else if (props.labelPosition === "top") rules += ' E4w1sLc1';
            if (props.labelPosition === "side") rules += ' CbRM95c1';
            else if (props.labelPosition === "top") rules += ' Cxaocre1';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e1';
                rules += ' vx1';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d1';
                rules += ' vx1';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b1';
                rules += ' vx1';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a1';
                rules += ' vx1';
            } else {
                rules += ' -_6BNtrc-c1';
                rules += ' vx1';
            }
            rules += ' ea1';
            rules += ' _Fd1';
            rules += ' _FnuYUweb1';
            if (props.size === "XL") rules += ' -BhX7R-Fz1';
            else if (props.size === "L") rules += ' -BhX7R-Fv1';
            else if (props.size === "S") rules += ' -BhX7R-Fp1';
            else if (props.size === "XS") rules += ' -BhX7R-Fn1';
            else rules += ' -BhX7R-Fx1';
            rules += ' -AJjOLd-UVkF0Db1';
            rules += ' qg1';
            rules += ' __ca1';
            return rules;
        }({
            isInForm: !!formContext,
            labelPosition: labelPosition,
            size: size
        }, props1.styles),
        children: ({ isDisabled: isDisabled, isOpen: isOpen, isFocusVisible: isFocusVisible, isInvalid: isInvalid, isRequired: isRequired })=>/*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Fragment), {
                children: /*#__PURE__*/ (0, $c77I5$jsxs)($b41c15d27fbaff7d$var$InternalPickerContext.Provider, {
                    value: {
                        size: size
                    },
                    children: [
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
                            includeNecessityIndicatorInAccessibilityName: true,
                            isDisabled: isDisabled,
                            isRequired: isRequired,
                            size: size,
                            labelPosition: labelPosition,
                            labelAlign: labelAlign,
                            isQuiet: isQuiet,
                            necessityIndicator: necessityIndicator,
                            contextualHelp: props1.contextualHelp,
                            children: label
                        }),
                        /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$PickerButton, {
                            loadingState: loadingState,
                            isOpen: isOpen,
                            isQuiet: isQuiet,
                            isFocusVisible: isFocusVisible,
                            size: size,
                            isInvalid: isInvalid,
                            isDisabled: isDisabled,
                            buttonRef: domRef,
                            loadingCircle: /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$PickerProgressCircle, {
                                id: spinnerId,
                                size: size,
                                "aria-label": stringFormatter.format('table.loading')
                            })
                        }),
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $9afd80978c252040$export$a67c0bc59081311a), {
                            size: size,
                            isDisabled: isDisabled,
                            isInvalid: isInvalid,
                            description: descriptionMessage,
                            children: errorMessage
                        }),
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Virtualizer), {
                            layout: (0, $c77I5$ListLayout),
                            layoutOptions: {
                                estimatedRowHeight: 32,
                                estimatedHeadingHeight: 50,
                                padding: 8,
                                loaderHeight: (0, $a2f262fac286a920$export$83379f5245567d78)[size][scale]
                            },
                            children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $88b746eba92c8d0d$export$5b6b19405a83ff9d), {
                                hideArrow: true,
                                padding: "none",
                                offset: menuOffset,
                                crossOffset: isQuiet ? RTLFlipOffset * -12 : undefined,
                                placement: `${direction} ${align}`,
                                shouldFlip: shouldFlip,
                                UNSAFE_style: {
                                    width: menuWidth && !isQuiet ? `${menuWidth}px` : undefined
                                },
                                styles: function anonymous(props) {
                                    let rules = " ";
                                    if (props.isQuiet) rules += ' Nh1';
                                    else rules += ' NuHSBze1';
                                    if (props.isQuiet) rules += ' ZbWuche1';
                                    else rules += ' ZuHSBze1';
                                    return rules;
                                }(props1),
                                children: /*#__PURE__*/ (0, $c77I5$jsx)("div", {
                                    className: " sd1 Za1 Fb1",
                                    children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Provider), {
                                        values: [
                                            [
                                                (0, $8e847109a6ab556d$export$e0e4026c12a8bdbb),
                                                {
                                                    styles: (0, $a2f262fac286a920$export$c040ba7a724e8da1)({
                                                        size: size
                                                    })
                                                }
                                            ],
                                            [
                                                (0, $8e847109a6ab556d$export$d688439359537581),
                                                {
                                                    // @ts-ignore
                                                    role: 'presentation',
                                                    styles: (0, $13afb0ea5f0ed767$export$300ac6f106ef584d)
                                                }
                                            ],
                                            [
                                                (0, $8e847109a6ab556d$export$9afb8bc826b033ea),
                                                {
                                                    slots: {
                                                        description: {
                                                            styles: (0, $13afb0ea5f0ed767$export$6d59db4903f20f7d)({
                                                                size: size
                                                            })
                                                        }
                                                    }
                                                }
                                            ]
                                        ],
                                        children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBox), {
                                            dependencies: props1.dependencies,
                                            items: items,
                                            className: (0, $a2f262fac286a920$export$9901d82449b93cea)({
                                                size: size
                                            }),
                                            children: renderer
                                        })
                                    })
                                })
                            })
                        })
                    ]
                })
            })
    });
});
function $b41c15d27fbaff7d$var$PickerProgressCircle(props) {
    let { id: id, size: size, 'aria-label': ariaLabel } = props;
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $41ddd91dbbf0c389$export$c79b9d6b4cc92af7), {
        id: id,
        isIndeterminate: true,
        size: "S",
        "aria-label": ariaLabel,
        styles: $b41c15d27fbaff7d$var$progressCircleStyles({
            size: size
        })
    });
}
const $b41c15d27fbaff7d$var$avatarSize = {
    S: 16,
    M: 20,
    L: 22,
    XL: 26
};
// Needs to be hidable component or otherwise the PressResponder throws a warning when rendered in the fake DOM and tries to register
const $b41c15d27fbaff7d$var$PickerButton = (0, $c77I5$createHideableComponent)(function PickerButton(props) {
    let { isOpen: isOpen, isQuiet: isQuiet, isFocusVisible: isFocusVisible, size: size, isInvalid: isInvalid, isDisabled: isDisabled, loadingState: loadingState, loadingCircle: loadingCircle, buttonRef: buttonRef } = props;
    let stringFormatter = (0, $c77I5$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c77I5$intlStringsmjs))), '@react-spectrum/s2');
    // For mouse interactions, pickers open on press start. When the popover underlay appears
    // it covers the trigger button, causing onPressEnd to fire immediately and no press scaling
    // to occur. We override this by listening for pointerup on the document ourselves.
    let [isPressed, setPressed] = (0, $c77I5$useState)(false);
    let { addGlobalListener: addGlobalListener } = (0, $c77I5$useGlobalListeners)();
    let onPressStart = (e)=>{
        if (e.pointerType !== 'mouse') return;
        setPressed(true);
        addGlobalListener(document, 'pointerup', ()=>{
            setPressed(false);
        }, {
            once: true,
            capture: true
        });
    };
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$PressResponder), {
        onPressStart: onPressStart,
        isPressed: isPressed,
        children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Button), {
            ref: buttonRef,
            style: (renderProps)=>(0, $10ea7662e51a285b$export$56e8cba416805d8d)(buttonRef)(renderProps),
            // Prevent press scale from sticking while Picker is open.
            // @ts-ignore
            isPressed: false,
            className: (renderProps)=>$b41c15d27fbaff7d$var$inputButton({
                    ...renderProps,
                    size: size,
                    isOpen: isOpen,
                    isQuiet: isQuiet
                }),
            children: (renderProps)=>/*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
                    children: [
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$SelectValue), {
                            className: $b41c15d27fbaff7d$var$valueStyles({
                                isQuiet: isQuiet
                            }) + ' ' + "pqYuhc",
                            children: ({ selectedItems: selectedItems, defaultChildren: defaultChildren })=>{
                                return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$Provider), {
                                    values: [
                                        [
                                            (0, $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed),
                                            {
                                                slots: {
                                                    icon: {
                                                        render: (0, $1f4b04be3f24aae3$export$9d7e2342a7e53afa)({
                                                            slot: 'icon',
                                                            styles: (0, $13afb0ea5f0ed767$export$31d1842a0fd736e6)
                                                        }),
                                                        styles: (0, $13afb0ea5f0ed767$export$1ca1ec8b29a4ce27)
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            (0, $3ffa2cd930156220$export$a20dad690e1279e2),
                                            {
                                                slots: {
                                                    avatar: {
                                                        size: $b41c15d27fbaff7d$var$avatarSize[size ?? 'M'],
                                                        styles: $b41c15d27fbaff7d$var$avatar
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            (0, $8e847109a6ab556d$export$9afb8bc826b033ea),
                                            {
                                                slots: {
                                                    description: {},
                                                    [(0, $c77I5$DEFAULT_SLOT)]: {
                                                        styles: " sb1 _ub1 _Nc1 Pc1 _Yb1 _7c1",
                                                        // @ts-ignore
                                                        'data-slot': 'label'
                                                    },
                                                    label: {
                                                        styles: " sb1 _ub1 _Nc1 Pc1 _Yb1 _7c1",
                                                        // @ts-ignore not technically necessary, but good for consistency
                                                        'data-slot': 'label'
                                                    }
                                                }
                                            }
                                        ],
                                        [
                                            $b41c15d27fbaff7d$var$InsideSelectValueContext,
                                            true
                                        ]
                                    ],
                                    children: selectedItems.length <= 1 ? defaultChildren : /*#__PURE__*/ (0, $c77I5$jsx)((0, $8e847109a6ab556d$export$5f1af8db9871e1d6), {
                                        slot: "label",
                                        children: stringFormatter.format('picker.selectedCount', {
                                            count: selectedItems.length
                                        })
                                    })
                                });
                            }
                        }),
                        isInvalid && /*#__PURE__*/ (0, $c77I5$jsx)((0, $9afd80978c252040$export$bda0d075e0e342c9), {
                            isDisabled: isDisabled
                        }),
                        loadingState === 'loading' && !isOpen && loadingCircle,
                        /*#__PURE__*/ (0, $c77I5$jsx)((0, $4b69f02ec06b9226$export$2e2bcd8739ae039), {
                            size: size,
                            className: $b41c15d27fbaff7d$var$iconStyles({
                                isLoading: loadingState === 'loading'
                            })
                        }),
                        isFocusVisible && isQuiet && /*#__PURE__*/ (0, $c77I5$jsx)("span", {
                            className: $b41c15d27fbaff7d$var$quietFocusLine
                        }),
                        isInvalid && !isDisabled && !isQuiet && // @ts-ignore known limitation detecting functions from the theme
                        /*#__PURE__*/ (0, $c77I5$jsx)("div", {
                            className: $b41c15d27fbaff7d$var$invalidBorder({
                                ...renderProps,
                                size: size
                            })
                        })
                    ]
                })
        })
    });
});
const $b41c15d27fbaff7d$var$checkmarkIconSize = {
    S: 'XS',
    M: 'M',
    L: 'L',
    XL: 'XL'
};
function $b41c15d27fbaff7d$export$d601881f38163e28(props) {
    let ref = (0, $c77I5$useRef)(null);
    let isLink = props.href != null;
    let { size: size } = (0, $c77I5$useContext)($b41c15d27fbaff7d$var$InternalPickerContext);
    return /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBoxItem), {
        ...props,
        ref: ref,
        textValue: props.textValue || (typeof props.children === 'string' ? props.children : undefined),
        style: (0, $10ea7662e51a285b$export$56e8cba416805d8d)(ref, props.UNSAFE_style),
        className: (renderProps)=>(props.UNSAFE_className || '') + (0, $a2f262fac286a920$export$68265fb354482bae)({
                ...renderProps,
                size: size,
                isLink: isLink
            }, props.styles),
        children: (renderProps)=>{
            let { children: children } = props;
            let checkboxRenderProps = {
                ...renderProps,
                size: size,
                isFocused: false,
                isFocusVisible: false,
                isIndeterminate: false,
                isReadOnly: false,
                isInvalid: false,
                isRequired: false
            };
            return /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$DefaultProvider, {
                context: (0, $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed),
                value: {
                    slots: {
                        icon: {
                            render: (0, $1f4b04be3f24aae3$export$9d7e2342a7e53afa)({
                                slot: 'icon',
                                styles: (0, $13afb0ea5f0ed767$export$31d1842a0fd736e6)
                            }),
                            styles: (0, $13afb0ea5f0ed767$export$1ca1ec8b29a4ce27)
                        }
                    }
                },
                children: /*#__PURE__*/ (0, $c77I5$jsx)($b41c15d27fbaff7d$var$DefaultProvider, {
                    context: (0, $3ffa2cd930156220$export$a20dad690e1279e2),
                    value: {
                        slots: {
                            avatar: {
                                size: $b41c15d27fbaff7d$var$avatarSize[size],
                                styles: $b41c15d27fbaff7d$var$avatar
                            }
                        }
                    },
                    children: /*#__PURE__*/ (0, $c77I5$jsxs)($b41c15d27fbaff7d$var$DefaultProvider, {
                        context: (0, $8e847109a6ab556d$export$9afb8bc826b033ea),
                        value: {
                            slots: {
                                [(0, $c77I5$DEFAULT_SLOT)]: {
                                    styles: (0, $13afb0ea5f0ed767$export$1237798dc640739a)({
                                        size: size
                                    })
                                },
                                label: {
                                    styles: (0, $13afb0ea5f0ed767$export$1237798dc640739a)({
                                        size: size
                                    })
                                },
                                description: {
                                    styles: (0, $13afb0ea5f0ed767$export$6d59db4903f20f7d)({
                                        ...renderProps,
                                        size: size
                                    })
                                }
                            }
                        },
                        children: [
                            renderProps.selectionMode === 'single' && !isLink && /*#__PURE__*/ (0, $c77I5$jsx)((0, $81cf3d4588736e7d$export$2e2bcd8739ae039), {
                                size: $b41c15d27fbaff7d$var$checkmarkIconSize[size],
                                className: (0, $13afb0ea5f0ed767$export$292abbf31ed842a)({
                                    ...renderProps,
                                    size: size
                                })
                            }),
                            renderProps.selectionMode === 'multiple' && !isLink && /*#__PURE__*/ (0, $c77I5$jsx)("div", {
                                className: (0, $feb886035e0d4633$export$e618dc39ac9ad607)((0, $13afb0ea5f0ed767$export$b07e517d22efa1ca), (0, $9b405e0f8095dce0$export$827f4ee28efc37)(checkboxRenderProps)),
                                children: /*#__PURE__*/ (0, $c77I5$jsx)((0, $81cf3d4588736e7d$export$2e2bcd8739ae039), {
                                    size: size,
                                    className: (0, $9b405e0f8095dce0$export$2c99b98b77550cb4)
                                })
                            }),
                            typeof children === 'string' ? /*#__PURE__*/ (0, $c77I5$jsx)((0, $8e847109a6ab556d$export$5f1af8db9871e1d6), {
                                slot: "label",
                                children: children
                            }) : children
                        ]
                    })
                })
            });
        }
    });
}
// A Context.Provider that only sets a value if not inside SelectValue.
function $b41c15d27fbaff7d$var$DefaultProvider({ context: context, value: value, children: children }) {
    let inSelectValue = (0, $c77I5$useContext)($b41c15d27fbaff7d$var$InsideSelectValueContext);
    if (inSelectValue) return children;
    return /*#__PURE__*/ (0, $c77I5$jsx)(context.Provider, {
        value: value,
        children: children
    });
}
function $b41c15d27fbaff7d$export$a340772aca6155cd(props) {
    let { size: size } = (0, $c77I5$useContext)($b41c15d27fbaff7d$var$InternalPickerContext);
    return /*#__PURE__*/ (0, $c77I5$jsxs)((0, $c77I5$Fragment), {
        children: [
            /*#__PURE__*/ (0, $c77I5$jsx)((0, $c77I5$ListBoxSection), {
                ...props,
                children: props.children
            }),
            /*#__PURE__*/ (0, $c77I5$jsx)((0, $a2f262fac286a920$export$2e0a83ec2e27ecbb), {
                size: size
            })
        ]
    });
}


export {$b41c15d27fbaff7d$export$b72b8dade9393cd5 as PickerContext, $b41c15d27fbaff7d$export$b1e5508a851be14d as menu, $b41c15d27fbaff7d$export$ba25329847403e11 as Picker, $b41c15d27fbaff7d$export$d601881f38163e28 as PickerItem, $b41c15d27fbaff7d$export$a340772aca6155cd as PickerSection};
//# sourceMappingURL=Picker.mjs.map
