require("./TagGroup.css");
var $6e265ff388155b91$exports = require("./ActionButton.cjs");
var $7e7cdbd2b8ae2467$exports = require("../icons/AlertTriangle.cjs");
var $38071d9ce246d4cf$exports = require("./Avatar.cjs");
var $e991cbcdf82ced71$exports = require("./CenterBaseline.cjs");
var $4fb579ecc195bd2b$exports = require("./ClearButton.cjs");
var $a0b996a550bb0891$exports = require("./Field.cjs");
var $bfa4962d90c8af48$exports = require("./Form.cjs");
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
var $053b76ed3d29e13b$exports = require("./Image.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $2061c83559b50a66$exports = require("./pressScale.cjs");
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $chbGa$reactjsxruntime = require("react/jsx-runtime");
var $chbGa$reactariacomponents = require("react-aria-components");
var $chbGa$reactariacollections = require("@react-aria/collections");
var $chbGa$react = require("react");
var $chbGa$reactdom = require("react-dom");
var $chbGa$reactariautils = require("@react-aria/utils");
var $chbGa$reactspectrumutils = require("@react-spectrum/utils");
var $chbGa$reactariai18n = require("@react-aria/i18n");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "TagGroupContext", () => $2e3ddd7543f4a901$export$5b07b5dd2cbd96e3);
$parcel$export(module.exports, "TagGroup", () => $2e3ddd7543f4a901$export$67ea30858aaf75e3);
$parcel$export(module.exports, "Tag", () => $2e3ddd7543f4a901$export$3288d34c523a1192);
/*
 * 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 $2e3ddd7543f4a901$export$5b07b5dd2cbd96e3 = /*#__PURE__*/ (0, $chbGa$react.createContext)(null);
const $2e3ddd7543f4a901$var$InternalTagGroupContext = /*#__PURE__*/ (0, $chbGa$react.createContext)({});
const $2e3ddd7543f4a901$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $chbGa$react.forwardRef)(function TagGroup(props, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $2e3ddd7543f4a901$export$5b07b5dd2cbd96e3);
    props = (0, $bfa4962d90c8af48$exports.useFormProps)(props);
    let { onRemove: onRemove } = props;
    return /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)($2e3ddd7543f4a901$var$InternalTagGroupContext.Provider, {
        value: {
            onRemove: onRemove
        },
        children: /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $chbGa$reactariacollections.CollectionBuilder), {
            content: /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $chbGa$reactariacollections.Collection), {
                ...props
            }),
            children: (collection)=>/*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)($2e3ddd7543f4a901$var$TagGroupInner, {
                    props: props,
                    forwardedRef: ref,
                    collection: collection
                })
        })
    });
});
function $2e3ddd7543f4a901$var$TagGroupInner({ props: { label: label, description: description, labelPosition: labelPosition = 'top', labelAlign: labelAlign = 'start', isEmphasized: isEmphasized, isInvalid: isInvalid, errorMessage: errorMessage, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, size: size = 'M', ...props }, forwardedRef: ref, collection: collection }) {
    let stringFormatter = (0, $chbGa$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    let { maxRows: maxRows, groupActionLabel: groupActionLabel, onGroupAction: onGroupAction, renderEmptyState: renderEmptyState = ()=>stringFormatter.format('tag.noTags'), ...otherProps } = props;
    let { direction: direction } = (0, $chbGa$reactariacomponents.useLocale)();
    let containerRef = (0, $chbGa$react.useRef)(null);
    let tagsRef = (0, $chbGa$react.useRef)(null);
    let actionsRef = (0, $chbGa$react.useRef)(null);
    let hiddenTagsRef = (0, $chbGa$react.useRef)(null);
    let [tagState, setTagState] = (0, $chbGa$react.useState)({
        visibleTagCount: collection.size,
        showCollapseButton: false
    });
    let [isCollapsed, setIsCollapsed] = (0, $chbGa$react.useState)(maxRows != null);
    let { onRemove: onRemove } = (0, $chbGa$react.useContext)($2e3ddd7543f4a901$var$InternalTagGroupContext);
    let isEmpty = collection.size === 0;
    let showCollapseToggleButton = tagState.showCollapseButton || tagState.visibleTagCount < collection.size;
    let formContext = (0, $chbGa$react.useContext)((0, $bfa4962d90c8af48$exports.FormContext));
    let domRef = (0, $chbGa$reactspectrumutils.useDOMRef)(ref);
    let allItems = (0, $chbGa$react.useMemo)(()=>Array.from(collection), [
        collection
    ]);
    let items = (0, $chbGa$react.useMemo)(()=>Array.from(collection).slice(0, !isCollapsed ? collection.size : tagState.visibleTagCount), [
        collection,
        tagState.visibleTagCount,
        isCollapsed
    ]);
    let updateVisibleTagCount = ()=>{
        if (maxRows == null) setTagState({
            visibleTagCount: collection.size,
            showCollapseButton: false
        });
        if (maxRows != null && maxRows > 0) {
            let computeVisibleTagCount = ()=>{
                let currContainerRef = hiddenTagsRef.current;
                let currTagsRef = hiddenTagsRef.current;
                let currActionsRef = actionsRef.current;
                if (!currContainerRef || !currTagsRef || collection.size === 0 || currContainerRef.parentElement == null) return {
                    visibleTagCount: 0,
                    showCollapseButton: false
                };
                // Count rows and show tags until we hit the maxRows.
                // I think this is still a safe assumption, and we don't need to queryAll for role=tag
                let tags = [
                    ...currTagsRef.children
                ];
                let currY = -Infinity;
                let rowCount = 0;
                let index = 0;
                let tagWidths = [];
                for (let tag of tags){
                    let { width: width, y: y } = tag.getBoundingClientRect();
                    if (y !== currY) {
                        currY = y;
                        rowCount++;
                    }
                    if (rowCount > maxRows) break;
                    tagWidths.push(width);
                    index++;
                }
                // Remove tags until there is space for the collapse button and action button (if present) on the last row.
                let buttons = currActionsRef ? [
                    ...currActionsRef.children
                ] : [];
                if (buttons.length > 0 && rowCount >= maxRows) {
                    let buttonsWidth = buttons.reduce((acc, curr)=>acc += curr.getBoundingClientRect().width, 0);
                    let margins = parseFloat(getComputedStyle(buttons[0]).marginInlineStart);
                    buttonsWidth += margins * 2;
                    let end = direction === 'ltr' ? 'right' : 'left';
                    let containerEnd = currContainerRef.parentElement?.getBoundingClientRect()[end] - margins;
                    let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];
                    lastTagEnd += margins;
                    let availableWidth = containerEnd - lastTagEnd;
                    while(availableWidth <= buttonsWidth && index > 0){
                        let tagWidth = tagWidths.pop();
                        if (tagWidth != null) availableWidth += tagWidth;
                        index--;
                    }
                }
                return {
                    visibleTagCount: Math.max(index, 1),
                    showCollapseButton: index < collection.size
                };
            };
            let result = computeVisibleTagCount();
            (0, $chbGa$reactdom.flushSync)(()=>{
                setTagState(result);
            });
        }
    };
    let updateVisibleTagCountEffect = (0, $chbGa$reactariautils.useEffectEvent)(updateVisibleTagCount);
    (0, $chbGa$reactariautils.useResizeObserver)({
        ref: maxRows != null ? containerRef : undefined,
        onResize: updateVisibleTagCount
    });
    (0, $chbGa$reactariautils.useLayoutEffect)(()=>{
        if (collection.size > 0 && maxRows != null && maxRows > 0) queueMicrotask(updateVisibleTagCountEffect);
    }, [
        collection.size,
        maxRows
    ]);
    (0, $chbGa$react.useEffect)(()=>{
        // Recalculate visible tags when fonts are loaded.
        document.fonts?.ready.then(()=>updateVisibleTagCountEffect());
    }, []);
    let handlePressCollapse = ()=>{
        setIsCollapsed((prevCollapsed)=>!prevCollapsed);
    };
    let helpText = null;
    if (!isInvalid && description) helpText = /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
        slot: "description",
        styles: (0, $a0b996a550bb0891$exports.helpTextStyles)({
            size: size
        }),
        children: description
    });
    else if (isInvalid) helpText = /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsxs)("div", {
        className: (0, $a0b996a550bb0891$exports.helpTextStyles)({
            size: size,
            isInvalid: isInvalid
        }),
        children: [
            /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $e991cbcdf82ced71$exports.CenterBaseline), {
                children: /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $7e7cdbd2b8ae2467$exports.default), {})
            }),
            /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
                slot: "errorMessage",
                children: errorMessage
            })
        ]
    });
    return /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsxs)((0, $chbGa$reactariacomponents.TagGroup), {
        ...otherProps,
        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-UVkF0Db12';
            rules += ' qg12';
            rules += ' __ca12';
            return rules;
        }({
            size: size,
            labelPosition: labelPosition,
            isInForm: !!formContext
        }, props.styles),
        children: [
            /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldLabel), {
                size: size,
                labelPosition: labelPosition,
                labelAlign: labelAlign,
                contextualHelp: props.contextualHelp,
                children: label
            }),
            /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)("div", {
                ref: containerRef,
                className: function anonymous(props) {
                    let rules = " ";
                    rules += ' zXcEWr12';
                    rules += ' yXcEWr12';
                    rules += ' BXcEWr12';
                    rules += ' AXcEWr12';
                    rules += ' Nb12';
                    if (props.isEmpty) rules += ' Iy12';
                    else rules += ' Ib12';
                    if (props.isEmpty) rules += ' Hy12';
                    else rules += ' Hs12';
                    rules += ' _Pc12';
                    return rules;
                }({
                    isEmpty: isEmpty
                }),
                children: /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $bfa4962d90c8af48$exports.FormContext).Provider, {
                    value: {
                        ...formContext,
                        size: size
                    },
                    children: /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsxs)((0, $chbGa$reactariacomponents.Provider), {
                        values: [
                            [
                                (0, $chbGa$reactariacomponents.TextContext),
                                undefined
                            ],
                            [
                                (0, $chbGa$reactariacomponents.ButtonContext),
                                undefined
                            ],
                            [
                                $2e3ddd7543f4a901$export$5b07b5dd2cbd96e3,
                                {
                                    size: size,
                                    isEmphasized: isEmphasized
                                }
                            ]
                        ],
                        children: [
                            maxRows != null && /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)("div", {
                                // @ts-ignore
                                inert: (0, $chbGa$reactariautils.inertValue)(true),
                                ref: hiddenTagsRef,
                                className: " sf12 _wb12 uk12 ucJ9TBTb12 ud3Euai12 uea12 ugb12 uhd12 uje12 u2NhKxcl12 uic12 _Pa12 Wr12 _lr12 _6b12 _Nc12 Pc12 _Ia12",
                                children: allItems.map((item)=>{
                                    // pull off individual props as an allow list, don't want refs or other props getting through
                                    // eslint-disable-next-line @typescript-eslint/no-unused-vars
                                    let { ref: ref, ...itemProps } = item.props;
                                    return /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)("div", {
                                        style: itemProps.UNSAFE_style,
                                        className: itemProps.className({
                                            size: size,
                                            allowsRemoving: Boolean(onRemove)
                                        }),
                                        children: /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)($2e3ddd7543f4a901$var$TagWrapper, {
                                            id: item.key,
                                            textValue: item.textValue,
                                            isInRealDOM: true,
                                            size: size,
                                            allowsRemoving: !!onRemove,
                                            ...itemProps,
                                            children: itemProps.children({
                                                size: size,
                                                allowsRemoving: Boolean(onRemove),
                                                isInCtx: true
                                            })
                                        }, item.key)
                                    }, item.key);
                                })
                            }),
                            /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $chbGa$reactariacomponents.TagList), {
                                ref: tagsRef,
                                items: items,
                                renderEmptyState: renderEmptyState,
                                className: " sf12 Nb12 uk12 ucJ9TBTb12 ud3Euai12 uea12 ugb12 uhd12 uje12 u2NhKxcl12 uic12 -_6BNtrc-c12 vx12 xb12 _xa12 _Fd12 _FnuYUweb12 pt12",
                                children: (item)=>/*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)($2e3ddd7543f4a901$export$3288d34c523a1192, {
                                        ...item.props,
                                        id: item.key,
                                        textValue: item.textValue
                                    })
                            }),
                            !isEmpty && (showCollapseToggleButton || groupActionLabel) && /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)($2e3ddd7543f4a901$var$ActionGroup, {
                                collection: collection,
                                "aria-label": props['aria-label'],
                                "aria-labelledby": props['aria-labelledby'],
                                actionsRef: actionsRef,
                                tagState: tagState,
                                size: size,
                                isCollapsed: isCollapsed,
                                handlePressCollapse: handlePressCollapse,
                                onGroupAction: onGroupAction,
                                groupActionLabel: groupActionLabel
                            })
                        ]
                    })
                })
            }),
            helpText
        ]
    });
}
function $2e3ddd7543f4a901$var$ActionGroup(props) {
    let stringFormatter = (0, $chbGa$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    let { actionsRef: actionsRef, tagState: tagState, size: size, isCollapsed: isCollapsed, handlePressCollapse: handlePressCollapse, onGroupAction: onGroupAction, groupActionLabel: groupActionLabel, collection: collection, // directly use aria-labelling from the TagGroup because we can't use the id from the TagList
    // and we can't supply an id to the TagList because it'll cause an issue where all the tag ids flip back
    // and forth with their prefix in an infinite loop
    'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
    let actionsId = (0, $chbGa$reactariautils.useId)();
    // might need to localize the aria-label which concatenates with this label
    let actionGroupLabel = stringFormatter.format('tag.actions');
    return /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsxs)("div", {
        role: "group",
        ref: actionsRef,
        id: actionsId,
        "aria-label": ariaLabel ? `${ariaLabel} ${actionGroupLabel}` : actionGroupLabel,
        "aria-labelledby": ariaLabelledBy ? ariaLabelledBy : undefined,
        className: " sf12",
        children: [
            tagState.showCollapseButton && /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $6e265ff388155b91$exports.ActionButton), {
                isQuiet: true,
                size: size,
                styles: " Js12 Gs12 Is12 Hs12",
                UNSAFE_style: {
                    display: 'inline-flex'
                },
                onPress: handlePressCollapse,
                children: isCollapsed ? stringFormatter.format('tag.showAllButtonLabel', {
                    tagCount: collection.size
                }) : stringFormatter.format('tag.hideButtonLabel')
            }),
            groupActionLabel && onGroupAction && /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $6e265ff388155b91$exports.ActionButton), {
                isQuiet: true,
                size: size,
                styles: " Js12 Gs12 Is12 Hs12",
                UNSAFE_style: {
                    display: 'inline-flex'
                },
                onPress: ()=>onGroupAction?.(),
                children: groupActionLabel
            })
        ]
    });
}
const $2e3ddd7543f4a901$var$tagStyles = 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 += ' 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';
    else if (props.isSelected) {
        if (props.isEmphasized) rules += ' px12';
        else rules += ' pr12';
    } else {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    }
    if (props.isDisabled) rules += ' plc12';
    else if (props.isSelected) rules += ' ple12';
    else rules += ' plb12';
    rules += ' sh12';
    rules += ' eb12';
    rules += ' _oa12';
    rules += ' Sv12';
    rules += ' SgLWx3bd12';
    if (props.allowsRemoving) rules += ' Rd12';
    else rules += ' Rv12';
    if (props.size === "XL") rules += ' Nl12';
    else if (props.size === "L") rules += ' Nj12';
    else if (props.size === "S") rules += ' Nf12';
    else if (props.size === "XS") rules += ' Ne12';
    else rules += ' Nk12';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec12';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn12';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b12';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd12';
    else rules += ' -SFnbic-_Jb12';
    rules += ' -Bu7z1c-ob12';
    rules += ' oj12';
    rules += ' nj12';
    rules += ' kj12';
    rules += ' jj12';
    rules += ' qc12';
    rules += ' qsd12';
    rules += ' -Qg41Lb-IAxCW0c12';
    rules += ' -Qg41Lb-gLWx3bIy12';
    rules += ' FRuFGYc12';
    rules += ' La12';
    rules += ' _5c12';
    rules += ' _Ca12';
    rules += ' Yd12';
    rules += ' Xb12';
    rules += ' _2b12';
    if (props.isDisabled) rules += ' gH12';
    else if (props.isSelected) {
        if (props.isEmphasized) {
            if (props.isFocusVisible) rules += ' gUgARdd12';
            else if (props.isPressed) rules += ' gUgARdd12';
            else if (props.isHovered) rules += ' gUgARdd12';
            else rules += ' g5qAiPc12';
        } else {
            if (props.isPressed) rules += ' gu12';
            else if (props.isFocusVisible) rules += ' gu12';
            else if (props.isHovered) rules += ' gu12';
            else rules += ' g012';
        }
    } else if (props.isFocusVisible) rules += ' gF12';
    else if (props.isHovered) rules += ' gF12';
    else rules += ' gH12';
    if (props.isSelected) rules += ' gle12';
    else rules += ' glb12';
    rules += ' _je12';
    rules += ' Js12';
    rules += ' Gs12';
    rules += ' Is12';
    rules += ' Hs12';
    if (props.isLink) rules += ' ry12';
    else rules += ' ri12';
    rules += ' -_8sjo0b-t5ZbAob12';
    if (props.size === "XL") rules += ' -F_-Fz12';
    else if (props.size === "L") rules += ' -F_-Fv12';
    else if (props.size === "S") rules += ' -F_-Fp12';
    else if (props.size === "XS") rules += ' -F_-Fn12';
    else rules += ' -F_-Fx12';
    return rules;
};
const $2e3ddd7543f4a901$var$avatarSize = {
    S: 16,
    M: 20,
    L: 24
};
const $2e3ddd7543f4a901$export$3288d34c523a1192 = /*#__PURE__*/ (0, $chbGa$react.forwardRef)(function Tag({ children: children, textValue: textValue, ...props }, ref) {
    textValue ||= typeof children === 'string' ? children : undefined;
    let ctx = (0, $chbGa$reactariacomponents.useSlottedContext)($2e3ddd7543f4a901$export$5b07b5dd2cbd96e3);
    let isInRealDOM = Boolean(ctx?.size);
    let { size: size, isEmphasized: isEmphasized } = ctx ?? {};
    let domRef = (0, $chbGa$reactspectrumutils.useDOMRef)(ref);
    let backupRef = (0, $chbGa$react.useRef)(null);
    domRef = domRef || backupRef;
    let isLink = props.href != null;
    return /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $chbGa$reactariacomponents.Tag), {
        textValue: textValue,
        ...props,
        ref: domRef,
        style: (0, $2061c83559b50a66$exports.pressScale)(domRef),
        className: (renderProps)=>$2e3ddd7543f4a901$var$tagStyles({
                size: size,
                isEmphasized: isEmphasized,
                isLink: isLink,
                ...renderProps
            }),
        children: (0, $chbGa$reactariacomponents.composeRenderProps)(children, (children, renderProps)=>/*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)($2e3ddd7543f4a901$var$TagWrapper, {
                isInRealDOM: isInRealDOM,
                isEmphasized: isEmphasized,
                ...renderProps,
                children: typeof children === 'string' ? /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
                    children: children
                }) : children
            }))
    });
});
function $2e3ddd7543f4a901$var$TagWrapper({ children: children, isDisabled: isDisabled, allowsRemoving: allowsRemoving, isInRealDOM: isInRealDOM, isEmphasized: isEmphasized, isSelected: isSelected }) {
    let { size: size = 'M' } = (0, $chbGa$reactariacomponents.useSlottedContext)($2e3ddd7543f4a901$export$5b07b5dd2cbd96e3) ?? {};
    return /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsxs)((0, $chbGa$reactjsxruntime.Fragment), {
        children: [
            isInRealDOM && /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)("div", {
                className: " sd12 Na12 eb12 Uc12 Usd12 qc12 qsd12 _yb12 g912",
                children: /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $chbGa$reactariacomponents.Provider), {
                    values: [
                        [
                            (0, $6367bc87eb7d24ad$exports.TextContext),
                            {
                                styles: " _Jb12 _Nc12 Pc12 _Yb12 _7c12"
                            }
                        ],
                        [
                            (0, $bde97c91243ed164$exports.IconContext),
                            {
                                render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
                                    slot: 'icon',
                                    styles: " _Ja12"
                                }),
                                styles: " ZuUmpre12 FuUmpre12 I67logd12 _va12"
                            }
                        ],
                        [
                            (0, $38071d9ce246d4cf$exports.AvatarContext),
                            {
                                size: $2e3ddd7543f4a901$var$avatarSize[size],
                                styles: " _Ja12"
                            }
                        ],
                        [
                            (0, $053b76ed3d29e13b$exports.ImageContext),
                            {
                                styles: " ZuUmpre12 FuUmpre12 _va12 _Ja12 fa12 _Ha12 oa12 na12 ka12 ja12"
                            }
                        ]
                    ],
                    children: children
                })
            }),
            !isInRealDOM && children,
            allowsRemoving && isInRealDOM && /*#__PURE__*/ (0, $chbGa$reactjsxruntime.jsx)((0, $4fb579ecc195bd2b$exports.ClearButton), {
                slot: "remove",
                size: size,
                isStaticColor: isEmphasized && isSelected,
                isDisabled: isDisabled
            })
        ]
    });
}


//# sourceMappingURL=TagGroup.cjs.map
