require("./ColorArea.css");
var $5b07976eb9e358fe$exports = require("./ColorHandle.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $lfrPf$reactjsxruntime = require("react/jsx-runtime");
var $lfrPf$reactariacomponents = require("react-aria-components");
var $lfrPf$react = require("react");
var $lfrPf$reactspectrumutils = require("@react-spectrum/utils");


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

$parcel$export(module.exports, "ColorAreaContext", () => $4c6639e34959fe36$export$ebe63fadcdce34ed);
$parcel$export(module.exports, "ColorArea", () => $4c6639e34959fe36$export$b2103f68a961418e);
/*
 * 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 $4c6639e34959fe36$export$ebe63fadcdce34ed = /*#__PURE__*/ (0, $lfrPf$react.createContext)(null);
const $4c6639e34959fe36$export$b2103f68a961418e = /*#__PURE__*/ (0, $lfrPf$react.forwardRef)(function ColorArea(props, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $4c6639e34959fe36$export$ebe63fadcdce34ed);
    let { UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, styles: styles } = props;
    let containerRef = (0, $lfrPf$reactspectrumutils.useDOMRef)(ref);
    let { direction: direction } = (0, $lfrPf$reactariacomponents.useLocale)();
    return /*#__PURE__*/ (0, $lfrPf$reactjsxruntime.jsx)((0, $lfrPf$reactariacomponents.ColorArea), {
        ...props,
        ref: containerRef,
        style: ({ defaultStyle: defaultStyle, isDisabled: isDisabled })=>({
                ...defaultStyle,
                background: isDisabled ? undefined : defaultStyle.background,
                // Move position: relative to style macro so it can be overridden.
                position: undefined,
                ...UNSAFE_style
            }),
        className: (renderProps)=>UNSAFE_className + function anonymous(props, overrides) {
                let rules = " ";
                let position = false;
                let width = false;
                let height = false;
                let minWidth = false;
                let minHeight = 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|F|M|K)[^\s]+/g);
                for (let p of matches){
                    if (p[1] === "_P") position = true;
                    if (p[1] === "Z") width = true;
                    if (p[1] === "F") height = true;
                    if (p[1] === "N") minWidth = true;
                    if (p[1] === "M") minHeight = true;
                    rules += p[0];
                }
                if (!position) rules += ' _Pc1';
                if (!width) rules += ' Zr1';
                if (!height) rules += ' Fs1';
                if (!minWidth) rules += ' Nm1';
                if (!minHeight) rules += ' Ml1';
                rules += ' ob1';
                rules += ' nb1';
                rules += ' kb1';
                rules += ' jb1';
                rules += ' Oi1';
                rules += ' Ola1';
                rules += ' _Mb1';
                rules += ' _Ka1';
                if (props.isDisabled) rules += ' _Le1';
                else rules += ' _Lf1';
                if (props.isDisabled) rules += ' gH1';
                return rules;
            }(renderProps, styles),
        children: ({ state: state })=>/*#__PURE__*/ (0, $lfrPf$reactjsxruntime.jsx)((0, $5b07976eb9e358fe$exports.ColorHandle), {
                containerRef: containerRef,
                getPosition: ()=>{
                    let { x: x, y: y } = state.getThumbPosition();
                    return {
                        x: direction === 'ltr' ? x : 1 - x,
                        y: y
                    };
                }
            })
    });
});


//# sourceMappingURL=ColorArea.cjs.map
