'use strict';

var _extends = require('../../../../../@babel_runtime@7.24.8/node_modules/@babel/runtime/helpers/esm/extends.cjs');
var React = require('react');
var index$6 = require('../../../../../@radix-ui_primitive@1.0.1/node_modules/@radix-ui/primitive/dist/index.cjs');
var index = require('../../../../../@radix-ui_react-context@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.cjs');
var index$1 = require('../../../../../@radix-ui_react-roving-focus@1.0.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18_753i7szl5dwsjermawvfyhbcfq/node_modules/@radix-ui/react-roving-focus/dist/index.cjs');
var index$7 = require('../../../../../@radix-ui_react-presence@1.0.1_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.cjs');
var index$5 = require('../../../../../@radix-ui_react-primitive@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._44pjkdrkjq3hxuh62jsxoggm4e/node_modules/@radix-ui/react-primitive/dist/index.cjs');
var index$2 = require('../../../../../@radix-ui_react-direction@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-direction/dist/index.cjs');
var index$3 = require('../../../../../@radix-ui_react-use-controllable-state@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs');
var index$4 = require('../../../../../@radix-ui_react-id@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.cjs');

/* -------------------------------------------------------------------------------------------------
 * Tabs
 * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TABS_NAME = 'Tabs';
const [$69cb30bb0017df05$var$createTabsContext, $69cb30bb0017df05$export$355f5bd209d7b13a] = index.createContextScope($69cb30bb0017df05$var$TABS_NAME, [
    index$1.createRovingFocusGroupScope
]);
const $69cb30bb0017df05$var$useRovingFocusGroupScope = index$1.createRovingFocusGroupScope();
const [$69cb30bb0017df05$var$TabsProvider, $69cb30bb0017df05$var$useTabsContext] = $69cb30bb0017df05$var$createTabsContext($69cb30bb0017df05$var$TABS_NAME);
const $69cb30bb0017df05$export$b2539bed5023c21c = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { __scopeTabs: __scopeTabs , value: valueProp , onValueChange: onValueChange , defaultValue: defaultValue , orientation: orientation = 'horizontal' , dir: dir , activationMode: activationMode = 'automatic' , ...tabsProps } = props;
    const direction = index$2.useDirection(dir);
    const [value, setValue] = index$3.useControllableState({
        prop: valueProp,
        onChange: onValueChange,
        defaultProp: defaultValue
    });
    return /*#__PURE__*/ React.createElement($69cb30bb0017df05$var$TabsProvider, {
        scope: __scopeTabs,
        baseId: index$4.useId(),
        value: value,
        onValueChange: setValue,
        orientation: orientation,
        dir: direction,
        activationMode: activationMode
    }, /*#__PURE__*/ React.createElement(index$5.Primitive.div, _extends.default({
        dir: direction,
        "data-orientation": orientation
    }, tabsProps, {
        ref: forwardedRef
    })));
});
/* -------------------------------------------------------------------------------------------------
 * TabsList
 * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TAB_LIST_NAME = 'TabsList';
const $69cb30bb0017df05$export$9712d22edc0d78c1 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { __scopeTabs: __scopeTabs , loop: loop = true , ...listProps } = props;
    const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
    const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
    return /*#__PURE__*/ React.createElement(index$1.Root, _extends.default({
        asChild: true
    }, rovingFocusGroupScope, {
        orientation: context.orientation,
        dir: context.dir,
        loop: loop
    }), /*#__PURE__*/ React.createElement(index$5.Primitive.div, _extends.default({
        role: "tablist",
        "aria-orientation": context.orientation
    }, listProps, {
        ref: forwardedRef
    })));
});
/* -------------------------------------------------------------------------------------------------
 * TabsTrigger
 * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TRIGGER_NAME = 'TabsTrigger';
const $69cb30bb0017df05$export$8114b9fdfdf9f3ba = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { __scopeTabs: __scopeTabs , value: value , disabled: disabled = false , ...triggerProps } = props;
    const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TRIGGER_NAME, __scopeTabs);
    const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
    const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
    const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
    const isSelected = value === context.value;
    return /*#__PURE__*/ React.createElement(index$1.Item, _extends.default({
        asChild: true
    }, rovingFocusGroupScope, {
        focusable: !disabled,
        active: isSelected
    }), /*#__PURE__*/ React.createElement(index$5.Primitive.button, _extends.default({
        type: "button",
        role: "tab",
        "aria-selected": isSelected,
        "aria-controls": contentId,
        "data-state": isSelected ? 'active' : 'inactive',
        "data-disabled": disabled ? '' : undefined,
        disabled: disabled,
        id: triggerId
    }, triggerProps, {
        ref: forwardedRef,
        onMouseDown: index$6.composeEventHandlers(props.onMouseDown, (event)=>{
            // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
            // but not when the control key is pressed (avoiding MacOS right click)
            if (!disabled && event.button === 0 && event.ctrlKey === false) context.onValueChange(value);
            else // prevent focus to avoid accidental activation
            event.preventDefault();
        }),
        onKeyDown: index$6.composeEventHandlers(props.onKeyDown, (event)=>{
            if ([
                ' ',
                'Enter'
            ].includes(event.key)) context.onValueChange(value);
        }),
        onFocus: index$6.composeEventHandlers(props.onFocus, ()=>{
            // handle "automatic" activation if necessary
            // ie. activate tab following focus
            const isAutomaticActivation = context.activationMode !== 'manual';
            if (!isSelected && !disabled && isAutomaticActivation) context.onValueChange(value);
        })
    })));
});
/* -------------------------------------------------------------------------------------------------
 * TabsContent
 * -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$CONTENT_NAME = 'TabsContent';
const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { __scopeTabs: __scopeTabs , value: value , forceMount: forceMount , children: children , ...contentProps } = props;
    const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$CONTENT_NAME, __scopeTabs);
    const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
    const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
    const isSelected = value === context.value;
    const isMountAnimationPreventedRef = React.useRef(isSelected);
    React.useEffect(()=>{
        const rAF = requestAnimationFrame(()=>isMountAnimationPreventedRef.current = false
        );
        return ()=>cancelAnimationFrame(rAF)
        ;
    }, []);
    return /*#__PURE__*/ React.createElement(index$7.Presence, {
        present: forceMount || isSelected
    }, ({ present: present  })=>/*#__PURE__*/ React.createElement(index$5.Primitive.div, _extends.default({
            "data-state": isSelected ? 'active' : 'inactive',
            "data-orientation": context.orientation,
            role: "tabpanel",
            "aria-labelledby": triggerId,
            hidden: !present,
            id: contentId,
            tabIndex: 0
        }, contentProps, {
            ref: forwardedRef,
            style: {
                ...props.style,
                animationDuration: isMountAnimationPreventedRef.current ? '0s' : undefined
            }
        }), present && children)
    );
});
/* ---------------------------------------------------------------------------------------------- */ function $69cb30bb0017df05$var$makeTriggerId(baseId, value) {
    return `${baseId}-trigger-${value}`;
}
function $69cb30bb0017df05$var$makeContentId(baseId, value) {
    return `${baseId}-content-${value}`;
}
const $69cb30bb0017df05$export$be92b6f5f03c0fe9 = $69cb30bb0017df05$export$b2539bed5023c21c;
const $69cb30bb0017df05$export$54c2e3dc7acea9f5 = $69cb30bb0017df05$export$9712d22edc0d78c1;
const $69cb30bb0017df05$export$41fb9f06171c75f4 = $69cb30bb0017df05$export$8114b9fdfdf9f3ba;
const $69cb30bb0017df05$export$7c6e2c02157bb7d2 = $69cb30bb0017df05$export$bd905d70e8fd2ebb;

exports.Content = $69cb30bb0017df05$export$7c6e2c02157bb7d2;
exports.List = $69cb30bb0017df05$export$54c2e3dc7acea9f5;
exports.Root = $69cb30bb0017df05$export$be92b6f5f03c0fe9;
exports.Tabs = $69cb30bb0017df05$export$b2539bed5023c21c;
exports.TabsContent = $69cb30bb0017df05$export$bd905d70e8fd2ebb;
exports.TabsList = $69cb30bb0017df05$export$9712d22edc0d78c1;
exports.TabsTrigger = $69cb30bb0017df05$export$8114b9fdfdf9f3ba;
exports.Trigger = $69cb30bb0017df05$export$41fb9f06171c75f4;
exports.createTabsScope = $69cb30bb0017df05$export$355f5bd209d7b13a;
//# sourceMappingURL=index.cjs.map
