import "./TimeField.css";
import {DateInput as $0e78e2b1ea2e947e$export$7edc06cf1783b30f, DateInputContainer as $0e78e2b1ea2e947e$export$3f08d3c48fa697, InvalidIndicator as $0e78e2b1ea2e947e$export$19696856283ab185} from "./DateField.mjs";
import {FieldGroup as $9afd80978c252040$export$f0fe469072bc6950, FieldLabel as $9afd80978c252040$export$1acdcf5a973a8414, HelpText as $9afd80978c252040$export$a67c0bc59081311a} from "./Field.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $2nExR$jsx, jsxs as $2nExR$jsxs, Fragment as $2nExR$Fragment} from "react/jsx-runtime";
import {FormContext as $2nExR$FormContext, TimeField as $2nExR$TimeField} from "react-aria-components";
import {createContext as $2nExR$createContext, forwardRef as $2nExR$forwardRef, useContext as $2nExR$useContext} 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 $a4c1b812c7e17006$export$8e17ddc448e87c1e = /*#__PURE__*/ (0, $2nExR$createContext)(null);
const $a4c1b812c7e17006$export$5eaee2322dd727eb = /*#__PURE__*/ (0, $2nExR$forwardRef)(function TimeField(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $a4c1b812c7e17006$export$8e17ddc448e87c1e);
    let { label: label, contextualHelp: contextualHelp, description: descriptionMessage, errorMessage: errorMessage, isRequired: isRequired, size: size = 'M', labelPosition: labelPosition = 'top', necessityIndicator: necessityIndicator, labelAlign: labelAlign = 'start', UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className, styles: styles, ...timeFieldProps } = props;
    let formContext = (0, $2nExR$useContext)((0, $2nExR$FormContext));
    return /*#__PURE__*/ (0, $2nExR$jsx)((0, $2nExR$TimeField), {
        ref: ref,
        isRequired: isRequired,
        ...timeFieldProps,
        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;
        }({
            isInForm: !!formContext,
            labelPosition: labelPosition,
            size: size
        }, styles),
        children: ({ isDisabled: isDisabled, isInvalid: isInvalid })=>{
            return /*#__PURE__*/ (0, $2nExR$jsxs)((0, $2nExR$Fragment), {
                children: [
                    /*#__PURE__*/ (0, $2nExR$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
                        isDisabled: isDisabled,
                        isRequired: isRequired,
                        size: size,
                        labelPosition: labelPosition,
                        labelAlign: labelAlign,
                        necessityIndicator: necessityIndicator,
                        contextualHelp: contextualHelp,
                        children: label
                    }),
                    /*#__PURE__*/ (0, $2nExR$jsxs)((0, $9afd80978c252040$export$f0fe469072bc6950), {
                        role: "presentation",
                        isDisabled: isDisabled,
                        isInvalid: isInvalid,
                        size: size,
                        styles: function anonymous(props) {
                            let rules = " ";
                            rules += ' zXcEWr12';
                            rules += ' yXcEWr12';
                            rules += ' BXcEWr12';
                            rules += ' AXcEWr12';
                            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.isQuiet) rules += ' _qd12';
                            else rules += ' _qtb12';
                            if (props.size === "XL") rules += ' -Anxdcc-Zt12';
                            else if (props.size === "L") rules += ' -Anxdcc-ZStdtne12';
                            else if (props.size === "S") rules += ' -Anxdcc-Zr12';
                            else rules += ' -Anxdcc-Z3fn9H12';
                            rules += ' __v6TNLWb12';
                            rules += ' SMBFGYc12';
                            rules += ' RfBFGYc12';
                            rules += ' -S_-Sv12';
                            rules += ' -R_-Rv12';
                            return rules;
                        }({
                            size: size
                        }),
                        children: [
                            /*#__PURE__*/ (0, $2nExR$jsx)((0, $0e78e2b1ea2e947e$export$3f08d3c48fa697), {
                                children: /*#__PURE__*/ (0, $2nExR$jsx)((0, $0e78e2b1ea2e947e$export$7edc06cf1783b30f), {})
                            }),
                            /*#__PURE__*/ (0, $2nExR$jsx)((0, $0e78e2b1ea2e947e$export$19696856283ab185), {
                                isInvalid: isInvalid,
                                isDisabled: isDisabled
                            })
                        ]
                    }),
                    /*#__PURE__*/ (0, $2nExR$jsx)((0, $9afd80978c252040$export$a67c0bc59081311a), {
                        size: size,
                        isDisabled: isDisabled,
                        isInvalid: isInvalid,
                        description: descriptionMessage,
                        children: errorMessage
                    })
                ]
            });
        }
    });
});


export {$a4c1b812c7e17006$export$8e17ddc448e87c1e as TimeFieldContext, $a4c1b812c7e17006$export$5eaee2322dd727eb as TimeField};
//# sourceMappingURL=TimeField.mjs.map
