// muse-ui v4.0.0-alpha.1
// © 2024 kjxbyz. All Rights Reserved.
"use client";
"use strict";
function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
function _array_without_holes(arr) {
    if (Array.isArray(arr)) return _array_like_to_array(arr);
}
function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _iterable_to_array(iter) {
    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _non_iterable_spread() {
    throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
function _object_without_properties(source, excluded) {
    if (source == null) return {};
    var target = _object_without_properties_loose(source, excluded);
    var key, i;
    if (Object.getOwnPropertySymbols) {
        var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
        for(i = 0; i < sourceSymbolKeys.length; i++){
            key = sourceSymbolKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
    }
    return target;
}
function _object_without_properties_loose(source, excluded) {
    if (source == null) return {};
    var target = {};
    var sourceKeys = Object.keys(source);
    var key, i;
    for(i = 0; i < sourceKeys.length; i++){
        key = sourceKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        target[key] = source[key];
    }
    return target;
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _to_consumable_array(arr) {
    return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = function(target, all) {
    for(var name in all)__defProp(target, name, {
        get: all[name],
        enumerable: true
    });
};
var __copyProps = function(to, from, except, desc) {
    if (from && typeof from === "object" || typeof from === "function") {
        var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
        try {
            var _loop = function() {
                var key = _step.value;
                if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
                    get: function() {
                        return from[key];
                    },
                    enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
                });
            };
            for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally{
            try {
                if (!_iteratorNormalCompletion && _iterator.return != null) {
                    _iterator.return();
                }
            } finally{
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }
    }
    return to;
};
var __toESM = function(mod, isNodeMode, target) {
    return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
    // file that has been converted to a CommonJS file using a Babel-
    // compatible transform (i.e. "__esModule" has not been set), then set
    // "default" to the CommonJS "module.exports" for node compatibility.
    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
        value: mod,
        enumerable: true
    }) : target, mod);
};
var __toCommonJS = function(mod) {
    return __copyProps(__defProp({}, "__esModule", {
        value: true
    }), mod);
};
// registry/default/ui/scroll-area.tsx
var scroll_area_exports = {};
__export(scroll_area_exports, {
    ScrollArea: function() {
        return ScrollArea;
    },
    ScrollBar: function() {
        return ScrollBar;
    }
});
module.exports = __toCommonJS(scroll_area_exports);
var React = __toESM(require("react"));
// ../../node_modules/.pnpm/@babel+runtime@7.22.3/node_modules/@babel/runtime/helpers/esm/extends.js
function _extends() {
    _extends = Object.assign ? Object.assign.bind() : function _extends(target) {
        for(var i = 1; i < arguments.length; i++){
            var source = arguments[i];
            for(var key in source){
                if (Object.prototype.hasOwnProperty.call(source, key)) {
                    target[key] = source[key];
                }
            }
        }
        return target;
    };
    return _extends.apply(this, arguments);
}
// ../../node_modules/.pnpm/@radix-ui+react-scroll-area@1.0.4_@types+react-dom@18.2.22_@types+react@18.2.65_react-dom@18.2.0_react@18.2.0/node_modules/@radix-ui/react-scroll-area/dist/index.mjs
var import_react9 = require("react");
// ../../node_modules/.pnpm/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/extends.js
function _extends2() {
    _extends2 = Object.assign ? Object.assign.bind() : function _extends2(target) {
        for(var i = 1; i < arguments.length; i++){
            var source = arguments[i];
            for(var key in source){
                if (Object.prototype.hasOwnProperty.call(source, key)) {
                    target[key] = source[key];
                }
            }
        }
        return target;
    };
    return _extends2.apply(this, arguments);
}
// ../../node_modules/.pnpm/@radix-ui+react-primitive@1.0.3_@types+react-dom@18.2.22_@types+react@18.2.65_react-dom@18.2.0_react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.mjs
var import_react3 = require("react");
var import_react_dom = require("react-dom");
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.0.2_@types+react@18.2.65_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.mjs
var import_react2 = require("react");
// ../../node_modules/.pnpm/@radix-ui+react-compose-refs@1.0.1_@types+react@18.2.65_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
var import_react = require("react");
function $6ed0406888f73fc4$var$setRef(ref, value) {
    if (typeof ref === "function") ref(value);
    else if (ref !== null && ref !== void 0) ref.current = value;
}
function $6ed0406888f73fc4$export$43e446d32b3d21af() {
    for(var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++){
        refs[_key] = arguments[_key];
    }
    return function(node) {
        return refs.forEach(function(ref) {
            return $6ed0406888f73fc4$var$setRef(ref, node);
        });
    };
}
function $6ed0406888f73fc4$export$c7b2cbe3552a0d05() {
    for(var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++){
        refs[_key] = arguments[_key];
    }
    return (0, import_react.useCallback)($6ed0406888f73fc4$export$43e446d32b3d21af.apply(void 0, _to_consumable_array(refs)), refs);
}
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.0.2_@types+react@18.2.65_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.mjs
var $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ (0, import_react2.forwardRef)(function(props, forwardedRef) {
    var children = props.children, slotProps = _object_without_properties(props, [
        "children"
    ]);
    var childrenArray = import_react2.Children.toArray(children);
    var slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
    if (slottable) {
        var newElement = slottable.props.children;
        var newChildren = childrenArray.map(function(child) {
            if (child === slottable) {
                if (import_react2.Children.count(newElement) > 1) return import_react2.Children.only(null);
                return /* @__PURE__ */ (0, import_react2.isValidElement)(newElement) ? newElement.props.children : null;
            } else return child;
        });
        return /* @__PURE__ */ (0, import_react2.createElement)($5e63c961fc1ce211$var$SlotClone, _extends2({}, slotProps, {
            ref: forwardedRef
        }), /* @__PURE__ */ (0, import_react2.isValidElement)(newElement) ? /* @__PURE__ */ (0, import_react2.cloneElement)(newElement, void 0, newChildren) : null);
    }
    return /* @__PURE__ */ (0, import_react2.createElement)($5e63c961fc1ce211$var$SlotClone, _extends2({}, slotProps, {
        ref: forwardedRef
    }), children);
});
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot";
var $5e63c961fc1ce211$var$SlotClone = /* @__PURE__ */ (0, import_react2.forwardRef)(function(props, forwardedRef) {
    var children = props.children, slotProps = _object_without_properties(props, [
        "children"
    ]);
    if (/* @__PURE__ */ (0, import_react2.isValidElement)(children)) return /* @__PURE__ */ (0, import_react2.cloneElement)(children, _object_spread_props(_object_spread({}, $5e63c961fc1ce211$var$mergeProps(slotProps, children.props)), {
        ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref
    }));
    return import_react2.Children.count(children) > 1 ? import_react2.Children.only(null) : null;
});
$5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone";
var $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = function(param) {
    var children = param.children;
    return /* @__PURE__ */ (0, import_react2.createElement)(import_react2.Fragment, null, children);
};
function $5e63c961fc1ce211$var$isSlottable(child) {
    return /* @__PURE__ */ (0, import_react2.isValidElement)(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
}
function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
    var _loop = function(propName) {
        var slotPropValue = slotProps[propName];
        var childPropValue = childProps[propName];
        var isHandler = /^on[A-Z]/.test(propName);
        if (isHandler) {
            if (slotPropValue && childPropValue) overrideProps[propName] = function() {
                for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
                    args[_key] = arguments[_key];
                }
                childPropValue.apply(void 0, _to_consumable_array(args));
                slotPropValue.apply(void 0, _to_consumable_array(args));
            };
            else if (slotPropValue) overrideProps[propName] = slotPropValue;
        } else if (propName === "style") overrideProps[propName] = _object_spread({}, slotPropValue, childPropValue);
        else if (propName === "className") overrideProps[propName] = [
            slotPropValue,
            childPropValue
        ].filter(Boolean).join(" ");
    };
    var overrideProps = _object_spread({}, childProps);
    for(var propName in childProps)_loop(propName);
    return _object_spread({}, slotProps, overrideProps);
}
// ../../node_modules/.pnpm/@radix-ui+react-primitive@1.0.3_@types+react-dom@18.2.22_@types+react@18.2.65_react-dom@18.2.0_react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.mjs
var $8927f6f2acc4f386$var$NODES = [
    "a",
    "button",
    "div",
    "form",
    "h2",
    "h3",
    "img",
    "input",
    "label",
    "li",
    "nav",
    "ol",
    "p",
    "span",
    "svg",
    "ul"
];
var $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce(function(primitive, node) {
    var Node = /* @__PURE__ */ (0, import_react3.forwardRef)(function(props, forwardedRef) {
        var asChild = props.asChild, primitiveProps = _object_without_properties(props, [
            "asChild"
        ]);
        var Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
        (0, import_react3.useEffect)(function() {
            window[Symbol.for("radix-ui")] = true;
        }, []);
        return /* @__PURE__ */ (0, import_react3.createElement)(Comp, _extends2({}, primitiveProps, {
            ref: forwardedRef
        }));
    });
    Node.displayName = "Primitive.".concat(node);
    return _object_spread_props(_object_spread({}, primitive), _define_property({}, node, Node));
}, {});
// ../../node_modules/.pnpm/@radix-ui+react-presence@1.0.1_@types+react-dom@18.2.22_@types+react@18.2.65_react-dom@18.2.0_react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.mjs
var import_react5 = require("react");
var import_react_dom2 = require("react-dom");
// ../../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.0.1_@types+react@18.2.65_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
var import_react4 = require("react");
var $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? import_react4.useLayoutEffect : function() {};
// ../../node_modules/.pnpm/@radix-ui+react-presence@1.0.1_@types+react-dom@18.2.22_@types+react@18.2.65_react-dom@18.2.0_react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.mjs
function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
    return (0, import_react5.useReducer)(function(state, event) {
        var nextState = machine[state][event];
        return nextState !== null && nextState !== void 0 ? nextState : state;
    }, initialState);
}
var $921a889cee6df7e8$export$99c2b779aa4e8b8b = function(props) {
    var present = props.present, children = props.children;
    var presence = $921a889cee6df7e8$var$usePresence(present);
    var child = typeof children === "function" ? children({
        present: presence.isPresent
    }) : import_react5.Children.only(children);
    var ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
    var forceMount = typeof children === "function";
    return forceMount || presence.isPresent ? /* @__PURE__ */ (0, import_react5.cloneElement)(child, {
        ref: ref
    }) : null;
};
$921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = "Presence";
function $921a889cee6df7e8$var$usePresence(present) {
    var _ref = _sliced_to_array((0, import_react5.useState)(), 2), node1 = _ref[0], setNode = _ref[1];
    var stylesRef = (0, import_react5.useRef)({});
    var prevPresentRef = (0, import_react5.useRef)(present);
    var prevAnimationNameRef = (0, import_react5.useRef)("none");
    var initialState = present ? "mounted" : "unmounted";
    var _$fe963b355347cc68$export$3e6543de14f8614f = _sliced_to_array($fe963b355347cc68$export$3e6543de14f8614f(initialState, {
        mounted: {
            UNMOUNT: "unmounted",
            ANIMATION_OUT: "unmountSuspended"
        },
        unmountSuspended: {
            MOUNT: "mounted",
            ANIMATION_END: "unmounted"
        },
        unmounted: {
            MOUNT: "mounted"
        }
    }), 2), state = _$fe963b355347cc68$export$3e6543de14f8614f[0], send = _$fe963b355347cc68$export$3e6543de14f8614f[1];
    (0, import_react5.useEffect)(function() {
        var currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
        prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
    }, [
        state
    ]);
    $9f79659886946c16$export$e5c5a5f917a5871c(function() {
        var styles = stylesRef.current;
        var wasPresent = prevPresentRef.current;
        var hasPresentChanged = wasPresent !== present;
        if (hasPresentChanged) {
            var prevAnimationName = prevAnimationNameRef.current;
            var currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
            if (present) send("MOUNT");
            else if (currentAnimationName === "none" || (styles === null || styles === void 0 ? void 0 : styles.display) === "none") send("UNMOUNT");
            else {
                var isAnimating = prevAnimationName !== currentAnimationName;
                if (wasPresent && isAnimating) send("ANIMATION_OUT");
                else send("UNMOUNT");
            }
            prevPresentRef.current = present;
        }
    }, [
        present,
        send
    ]);
    $9f79659886946c16$export$e5c5a5f917a5871c(function() {
        if (node1) {
            var handleAnimationEnd = function(event) {
                var currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
                var isCurrentAnimation = currentAnimationName.includes(event.animationName);
                if (event.target === node1 && isCurrentAnimation) (0, import_react_dom2.flushSync)(function() {
                    return send("ANIMATION_END");
                });
            };
            var handleAnimationStart = function(event) {
                if (event.target === node1) prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
            };
            node1.addEventListener("animationstart", handleAnimationStart);
            node1.addEventListener("animationcancel", handleAnimationEnd);
            node1.addEventListener("animationend", handleAnimationEnd);
            return function() {
                node1.removeEventListener("animationstart", handleAnimationStart);
                node1.removeEventListener("animationcancel", handleAnimationEnd);
                node1.removeEventListener("animationend", handleAnimationEnd);
            };
        } else send("ANIMATION_END");
    }, [
        node1,
        send
    ]);
    return {
        isPresent: [
            "mounted",
            "unmountSuspended"
        ].includes(state),
        ref: (0, import_react5.useCallback)(function(node) {
            if (node) stylesRef.current = getComputedStyle(node);
            setNode(node);
        }, [])
    };
}
function $921a889cee6df7e8$var$getAnimationName(styles) {
    return (styles === null || styles === void 0 ? void 0 : styles.animationName) || "none";
}
// ../../node_modules/.pnpm/@radix-ui+react-context@1.0.1_@types+react@18.2.65_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.mjs
var import_react6 = require("react");
function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName) {
    var createContextScopeDeps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
    var defaultContexts = [];
    function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
        var BaseContext = /* @__PURE__ */ (0, import_react6.createContext)(defaultContext);
        var index = defaultContexts.length;
        defaultContexts = _to_consumable_array(defaultContexts).concat([
            defaultContext
        ]);
        function Provider(props) {
            var scope = props.scope, children = props.children, context = _object_without_properties(props, [
                "scope",
                "children"
            ]);
            var Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
            var value = (0, import_react6.useMemo)(function() {
                return context;
            }, Object.values(context));
            return /* @__PURE__ */ (0, import_react6.createElement)(Context.Provider, {
                value: value
            }, children);
        }
        function useContext(consumerName, scope) {
            var Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
            var context = (0, import_react6.useContext)(Context);
            if (context) return context;
            if (defaultContext !== void 0) return defaultContext;
            throw new Error("`".concat(consumerName, "` must be used within `").concat(rootComponentName, "`"));
        }
        Provider.displayName = rootComponentName + "Provider";
        return [
            Provider,
            useContext
        ];
    }
    var createScope = function() {
        var scopeContexts = defaultContexts.map(function(defaultContext) {
            return /* @__PURE__ */ (0, import_react6.createContext)(defaultContext);
        });
        return function useScope(scope) {
            var contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
            return (0, import_react6.useMemo)(function() {
                return _define_property({}, "__scope".concat(scopeName), _object_spread_props(_object_spread({}, scope), _define_property({}, scopeName, contexts)));
            }, [
                scope,
                contexts
            ]);
        };
    };
    createScope.scopeName = scopeName;
    return [
        $c512c27ab02ef895$export$fd42f52fd3ae1109,
        $c512c27ab02ef895$var$composeContextScopes.apply(void 0, [
            createScope
        ].concat(_to_consumable_array(createContextScopeDeps)))
    ];
}
function $c512c27ab02ef895$var$composeContextScopes() {
    for(var _len = arguments.length, scopes = new Array(_len), _key = 0; _key < _len; _key++){
        scopes[_key] = arguments[_key];
    }
    var baseScope = scopes[0];
    if (scopes.length === 1) return baseScope;
    var createScope1 = function() {
        var scopeHooks = scopes.map(function(createScope) {
            return {
                useScope: createScope(),
                scopeName: createScope.scopeName
            };
        });
        return function useComposedScopes(overrideScopes) {
            var nextScopes1 = scopeHooks.reduce(function(nextScopes, param) {
                var useScope = param.useScope, scopeName = param.scopeName;
                var scopeProps = useScope(overrideScopes);
                var currentScope = scopeProps["__scope".concat(scopeName)];
                return _object_spread({}, nextScopes, currentScope);
            }, {});
            return (0, import_react6.useMemo)(function() {
                return _define_property({}, "__scope".concat(baseScope.scopeName), nextScopes1);
            }, [
                nextScopes1
            ]);
        };
    };
    createScope1.scopeName = baseScope.scopeName;
    return createScope1;
}
// ../../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.0.1_@types+react@18.2.65_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
var import_react7 = require("react");
function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
    var callbackRef = (0, import_react7.useRef)(callback);
    (0, import_react7.useEffect)(function() {
        callbackRef.current = callback;
    });
    return (0, import_react7.useMemo)(function() {
        return function() {
            for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
                args[_key] = arguments[_key];
            }
            var _callbackRef$current;
            var _callbackRef$current1;
            return (_callbackRef$current1 = callbackRef.current) === null || _callbackRef$current1 === void 0 ? void 0 : (_callbackRef$current = _callbackRef$current1).call.apply(_callbackRef$current, [
                callbackRef
            ].concat(_to_consumable_array(args)));
        };
    }, []);
}
// ../../node_modules/.pnpm/@radix-ui+react-direction@1.0.1_@types+react@18.2.65_react@18.2.0/node_modules/@radix-ui/react-direction/dist/index.mjs
var import_react8 = require("react");
var $f631663db3294ace$var$DirectionContext = /* @__PURE__ */ (0, import_react8.createContext)(void 0);
function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
    var globalDir = (0, import_react8.useContext)($f631663db3294ace$var$DirectionContext);
    return localDir || globalDir || "ltr";
}
// ../../node_modules/.pnpm/@radix-ui+number@1.0.1/node_modules/@radix-ui/number/dist/index.mjs
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, param) {
    var _param = _sliced_to_array(param, 2), min = _param[0], max = _param[1];
    return Math.min(max, Math.max(min, value));
}
// ../../node_modules/.pnpm/@radix-ui+primitive@1.0.1/node_modules/@radix-ui/primitive/dist/index.mjs
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler) {
    var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, _ref_checkForDefaultPrevented = _ref.checkForDefaultPrevented, checkForDefaultPrevented = _ref_checkForDefaultPrevented === void 0 ? true : _ref_checkForDefaultPrevented;
    return function handleEvent(event) {
        originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
        if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
    };
}
// ../../node_modules/.pnpm/@radix-ui+react-scroll-area@1.0.4_@types+react-dom@18.2.22_@types+react@18.2.65_react-dom@18.2.0_react@18.2.0/node_modules/@radix-ui/react-scroll-area/dist/index.mjs
function $6c2e24571c90391f$export$3e6543de14f8614f(initialState, machine) {
    return (0, import_react9.useReducer)(function(state, event) {
        var nextState = machine[state][event];
        return nextState !== null && nextState !== void 0 ? nextState : state;
    }, initialState);
}
var $57acba87d6e25586$var$SCROLL_AREA_NAME = "ScrollArea";
var _$c512c27ab02ef895$export$50c7b4e9d9f19c1 = _sliced_to_array($c512c27ab02ef895$export$50c7b4e9d9f19c1($57acba87d6e25586$var$SCROLL_AREA_NAME), 2), $57acba87d6e25586$var$createScrollAreaContext = _$c512c27ab02ef895$export$50c7b4e9d9f19c1[0], $57acba87d6e25586$export$488468afe3a6f2b1 = _$c512c27ab02ef895$export$50c7b4e9d9f19c1[1];
var _$57acba87d6e25586$var$createScrollAreaContext = _sliced_to_array($57acba87d6e25586$var$createScrollAreaContext($57acba87d6e25586$var$SCROLL_AREA_NAME), 2), $57acba87d6e25586$var$ScrollAreaProvider = _$57acba87d6e25586$var$createScrollAreaContext[0], $57acba87d6e25586$var$useScrollAreaContext = _$57acba87d6e25586$var$createScrollAreaContext[1];
var $57acba87d6e25586$export$ccf8d8d7bbf3c2cc = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var __scopeScrollArea = props.__scopeScrollArea, _props_type = props.type, type = _props_type === void 0 ? "hover" : _props_type, dir = props.dir, _props_scrollHideDelay = props.scrollHideDelay, scrollHideDelay = _props_scrollHideDelay === void 0 ? 600 : _props_scrollHideDelay, scrollAreaProps = _object_without_properties(props, [
        "__scopeScrollArea",
        "type",
        "dir",
        "scrollHideDelay"
    ]);
    var _ref = _sliced_to_array((0, import_react9.useState)(null), 2), scrollArea = _ref[0], setScrollArea = _ref[1];
    var _ref1 = _sliced_to_array((0, import_react9.useState)(null), 2), viewport = _ref1[0], setViewport = _ref1[1];
    var _ref2 = _sliced_to_array((0, import_react9.useState)(null), 2), content = _ref2[0], setContent = _ref2[1];
    var _ref3 = _sliced_to_array((0, import_react9.useState)(null), 2), scrollbarX = _ref3[0], setScrollbarX = _ref3[1];
    var _ref4 = _sliced_to_array((0, import_react9.useState)(null), 2), scrollbarY = _ref4[0], setScrollbarY = _ref4[1];
    var _ref5 = _sliced_to_array((0, import_react9.useState)(0), 2), cornerWidth = _ref5[0], setCornerWidth = _ref5[1];
    var _ref6 = _sliced_to_array((0, import_react9.useState)(0), 2), cornerHeight = _ref6[0], setCornerHeight = _ref6[1];
    var _ref7 = _sliced_to_array((0, import_react9.useState)(false), 2), scrollbarXEnabled = _ref7[0], setScrollbarXEnabled = _ref7[1];
    var _ref8 = _sliced_to_array((0, import_react9.useState)(false), 2), scrollbarYEnabled = _ref8[0], setScrollbarYEnabled = _ref8[1];
    var composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, function(node) {
        return setScrollArea(node);
    });
    var direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
    var _obj;
    return /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaProvider, {
        scope: __scopeScrollArea,
        type: type,
        dir: direction,
        scrollHideDelay: scrollHideDelay,
        scrollArea: scrollArea,
        viewport: viewport,
        onViewportChange: setViewport,
        content: content,
        onContentChange: setContent,
        scrollbarX: scrollbarX,
        onScrollbarXChange: setScrollbarX,
        scrollbarXEnabled: scrollbarXEnabled,
        onScrollbarXEnabledChange: setScrollbarXEnabled,
        scrollbarY: scrollbarY,
        onScrollbarYChange: setScrollbarY,
        scrollbarYEnabled: scrollbarYEnabled,
        onScrollbarYEnabledChange: setScrollbarYEnabled,
        onCornerWidthChange: setCornerWidth,
        onCornerHeightChange: setCornerHeight
    }, /* @__PURE__ */ (0, import_react9.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
        dir: direction
    }, scrollAreaProps, {
        ref: composedRefs,
        style: _object_spread((_obj = {
            position: "relative"
        }, // Pass corner sizes as CSS vars to reduce re-renders of context consumers
        _define_property(_obj, "--radix-scroll-area-corner-width", cornerWidth + "px"), _define_property(_obj, "--radix-scroll-area-corner-height", cornerHeight + "px"), _obj), props.style)
    })));
});
var $57acba87d6e25586$var$VIEWPORT_NAME = "ScrollAreaViewport";
var $57acba87d6e25586$export$a21cbf9f11fca853 = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var __scopeScrollArea = props.__scopeScrollArea, children = props.children, viewportProps = _object_without_properties(props, [
        "__scopeScrollArea",
        "children"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$VIEWPORT_NAME, __scopeScrollArea);
    var ref = (0, import_react9.useRef)(null);
    var composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref, context.onViewportChange);
    return /* @__PURE__ */ (0, import_react9.createElement)(import_react9.Fragment, null, /* @__PURE__ */ (0, import_react9.createElement)("style", {
        dangerouslySetInnerHTML: {
            __html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
        }
    }), /* @__PURE__ */ (0, import_react9.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
        "data-radix-scroll-area-viewport": ""
    }, viewportProps, {
        ref: composedRefs,
        style: _object_spread({
            /**
      * We don't support `visible` because the intention is to have at least one scrollbar
      * if this component is used and `visible` will behave like `auto` in that case
      * https://developer.mozilla.org/en-US/docs/Web/CSS/overflowed#description
      *
      * We don't handle `auto` because the intention is for the native implementation
      * to be hidden if using this component. We just want to ensure the node is scrollable
      * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
      * the browser from having to work out whether to render native scrollbars or not,
      * we tell it to with the intention of hiding them in CSS.
      */ overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
            overflowY: context.scrollbarYEnabled ? "scroll" : "hidden"
        }, props.style)
    }), /* @__PURE__ */ (0, import_react9.createElement)("div", {
        ref: context.onContentChange,
        style: {
            minWidth: "100%",
            display: "table"
        }
    }, children)));
});
var $57acba87d6e25586$var$SCROLLBAR_NAME = "ScrollAreaScrollbar";
var $57acba87d6e25586$export$2fabd85d0eba3c57 = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var forceMount = props.forceMount, scrollbarProps = _object_without_properties(props, [
        "forceMount"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
    var onScrollbarXEnabledChange = context.onScrollbarXEnabledChange, onScrollbarYEnabledChange = context.onScrollbarYEnabledChange;
    var isHorizontal = props.orientation === "horizontal";
    (0, import_react9.useEffect)(function() {
        isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
        return function() {
            isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
        };
    }, [
        isHorizontal,
        onScrollbarXEnabledChange,
        onScrollbarYEnabledChange
    ]);
    return context.type === "hover" ? /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends({}, scrollbarProps, {
        ref: forwardedRef,
        forceMount: forceMount
    })) : context.type === "scroll" ? /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends({}, scrollbarProps, {
        ref: forwardedRef,
        forceMount: forceMount
    })) : context.type === "auto" ? /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({}, scrollbarProps, {
        ref: forwardedRef,
        forceMount: forceMount
    })) : context.type === "always" ? /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({}, scrollbarProps, {
        ref: forwardedRef
    })) : null;
});
var $57acba87d6e25586$var$ScrollAreaScrollbarHover = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var forceMount = props.forceMount, scrollbarProps = _object_without_properties(props, [
        "forceMount"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
    var _ref = _sliced_to_array((0, import_react9.useState)(false), 2), visible = _ref[0], setVisible = _ref[1];
    (0, import_react9.useEffect)(function() {
        var scrollArea = context.scrollArea;
        var hideTimer = 0;
        if (scrollArea) {
            var handlePointerEnter = function() {
                window.clearTimeout(hideTimer);
                setVisible(true);
            };
            var handlePointerLeave = function() {
                hideTimer = window.setTimeout(function() {
                    return setVisible(false);
                }, context.scrollHideDelay);
            };
            scrollArea.addEventListener("pointerenter", handlePointerEnter);
            scrollArea.addEventListener("pointerleave", handlePointerLeave);
            return function() {
                window.clearTimeout(hideTimer);
                scrollArea.removeEventListener("pointerenter", handlePointerEnter);
                scrollArea.removeEventListener("pointerleave", handlePointerLeave);
            };
        }
    }, [
        context.scrollArea,
        context.scrollHideDelay
    ]);
    return /* @__PURE__ */ (0, import_react9.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
        present: forceMount || visible
    }, /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({
        "data-state": visible ? "visible" : "hidden"
    }, scrollbarProps, {
        ref: forwardedRef
    })));
});
var $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var forceMount = props.forceMount, scrollbarProps = _object_without_properties(props, [
        "forceMount"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
    var isHorizontal = props.orientation === "horizontal";
    var debounceScrollEnd = $57acba87d6e25586$var$useDebounceCallback(function() {
        return send("SCROLL_END");
    }, 100);
    var _$6c2e24571c90391f$export$3e6543de14f8614f = _sliced_to_array($6c2e24571c90391f$export$3e6543de14f8614f("hidden", {
        hidden: {
            SCROLL: "scrolling"
        },
        scrolling: {
            SCROLL_END: "idle",
            POINTER_ENTER: "interacting"
        },
        interacting: {
            SCROLL: "interacting",
            POINTER_LEAVE: "idle"
        },
        idle: {
            HIDE: "hidden",
            SCROLL: "scrolling",
            POINTER_ENTER: "interacting"
        }
    }), 2), state = _$6c2e24571c90391f$export$3e6543de14f8614f[0], send = _$6c2e24571c90391f$export$3e6543de14f8614f[1];
    (0, import_react9.useEffect)(function() {
        if (state === "idle") {
            var hideTimer = window.setTimeout(function() {
                return send("HIDE");
            }, context.scrollHideDelay);
            return function() {
                return window.clearTimeout(hideTimer);
            };
        }
    }, [
        state,
        context.scrollHideDelay,
        send
    ]);
    (0, import_react9.useEffect)(function() {
        var viewport = context.viewport;
        var scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
        if (viewport) {
            var prevScrollPos = viewport[scrollDirection];
            var handleScroll = function() {
                var scrollPos = viewport[scrollDirection];
                var hasScrollInDirectionChanged = prevScrollPos !== scrollPos;
                if (hasScrollInDirectionChanged) {
                    send("SCROLL");
                    debounceScrollEnd();
                }
                prevScrollPos = scrollPos;
            };
            viewport.addEventListener("scroll", handleScroll);
            return function() {
                return viewport.removeEventListener("scroll", handleScroll);
            };
        }
    }, [
        context.viewport,
        isHorizontal,
        send,
        debounceScrollEnd
    ]);
    return /* @__PURE__ */ (0, import_react9.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
        present: forceMount || state !== "hidden"
    }, /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
        "data-state": state === "hidden" ? "hidden" : "visible"
    }, scrollbarProps, {
        ref: forwardedRef,
        onPointerEnter: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerEnter, function() {
            return send("POINTER_ENTER");
        }),
        onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, function() {
            return send("POINTER_LEAVE");
        })
    })));
});
var $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
    var forceMount = props.forceMount, scrollbarProps = _object_without_properties(props, [
        "forceMount"
    ]);
    var _ref = _sliced_to_array((0, import_react9.useState)(false), 2), visible = _ref[0], setVisible = _ref[1];
    var isHorizontal = props.orientation === "horizontal";
    var handleResize = $57acba87d6e25586$var$useDebounceCallback(function() {
        if (context.viewport) {
            var isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
            var isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
            setVisible(isHorizontal ? isOverflowX : isOverflowY);
        }
    }, 10);
    $57acba87d6e25586$var$useResizeObserver(context.viewport, handleResize);
    $57acba87d6e25586$var$useResizeObserver(context.content, handleResize);
    return /* @__PURE__ */ (0, import_react9.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
        present: forceMount || visible
    }, /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
        "data-state": visible ? "visible" : "hidden"
    }, scrollbarProps, {
        ref: forwardedRef
    })));
});
var $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var getScrollPosition = function getScrollPosition(pointerPos, dir) {
        return $57acba87d6e25586$var$getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
    };
    var _props_orientation = props.orientation, orientation = _props_orientation === void 0 ? "vertical" : _props_orientation, scrollbarProps = _object_without_properties(props, [
        "orientation"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
    var thumbRef = (0, import_react9.useRef)(null);
    var pointerOffsetRef = (0, import_react9.useRef)(0);
    var _ref = _sliced_to_array((0, import_react9.useState)({
        content: 0,
        viewport: 0,
        scrollbar: {
            size: 0,
            paddingStart: 0,
            paddingEnd: 0
        }
    }), 2), sizes = _ref[0], setSizes = _ref[1];
    var thumbRatio = $57acba87d6e25586$var$getThumbRatio(sizes.viewport, sizes.content);
    var commonProps = _object_spread_props(_object_spread({}, scrollbarProps), {
        sizes: sizes,
        onSizesChange: setSizes,
        hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
        onThumbChange: function(thumb) {
            return thumbRef.current = thumb;
        },
        onThumbPointerUp: function() {
            return pointerOffsetRef.current = 0;
        },
        onThumbPointerDown: function(pointerPos) {
            return pointerOffsetRef.current = pointerPos;
        }
    });
    if (orientation === "horizontal") return /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends({}, commonProps, {
        ref: forwardedRef,
        onThumbPositionChange: function() {
            if (context.viewport && thumbRef.current) {
                var scrollPos = context.viewport.scrollLeft;
                var offset = $57acba87d6e25586$var$getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
                thumbRef.current.style.transform = "translate3d(".concat(offset, "px, 0, 0)");
            }
        },
        onWheelScroll: function(scrollPos) {
            if (context.viewport) context.viewport.scrollLeft = scrollPos;
        },
        onDragScroll: function(pointerPos) {
            if (context.viewport) context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
        }
    }));
    if (orientation === "vertical") return /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends({}, commonProps, {
        ref: forwardedRef,
        onThumbPositionChange: function() {
            if (context.viewport && thumbRef.current) {
                var scrollPos = context.viewport.scrollTop;
                var offset = $57acba87d6e25586$var$getThumbOffsetFromScroll(scrollPos, sizes);
                thumbRef.current.style.transform = "translate3d(0, ".concat(offset, "px, 0)");
            }
        },
        onWheelScroll: function(scrollPos) {
            if (context.viewport) context.viewport.scrollTop = scrollPos;
        },
        onDragScroll: function(pointerPos) {
            if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
        }
    }));
    return null;
});
var $57acba87d6e25586$var$ScrollAreaScrollbarX = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var sizes = props.sizes, onSizesChange = props.onSizesChange, scrollbarProps = _object_without_properties(props, [
        "sizes",
        "onSizesChange"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
    var _ref = _sliced_to_array((0, import_react9.useState)(), 2), computedStyle = _ref[0], setComputedStyle = _ref[1];
    var ref = (0, import_react9.useRef)(null);
    var composeRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref, context.onScrollbarXChange);
    (0, import_react9.useEffect)(function() {
        if (ref.current) setComputedStyle(getComputedStyle(ref.current));
    }, [
        ref
    ]);
    return /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
        "data-orientation": "horizontal"
    }, scrollbarProps, {
        ref: composeRefs,
        sizes: sizes,
        style: _object_spread(_define_property({
            bottom: 0,
            left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
            right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0
        }, "--radix-scroll-area-thumb-width", $57acba87d6e25586$var$getThumbSize(sizes) + "px"), props.style),
        onThumbPointerDown: function(pointerPos) {
            return props.onThumbPointerDown(pointerPos.x);
        },
        onDragScroll: function(pointerPos) {
            return props.onDragScroll(pointerPos.x);
        },
        onWheelScroll: function(event, maxScrollPos) {
            if (context.viewport) {
                var scrollPos = context.viewport.scrollLeft + event.deltaX;
                props.onWheelScroll(scrollPos);
                if ($57acba87d6e25586$var$isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
            }
        },
        onResize: function() {
            if (ref.current && context.viewport && computedStyle) onSizesChange({
                content: context.viewport.scrollWidth,
                viewport: context.viewport.offsetWidth,
                scrollbar: {
                    size: ref.current.clientWidth,
                    paddingStart: $57acba87d6e25586$var$toInt(computedStyle.paddingLeft),
                    paddingEnd: $57acba87d6e25586$var$toInt(computedStyle.paddingRight)
                }
            });
        }
    }));
});
var $57acba87d6e25586$var$ScrollAreaScrollbarY = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var sizes = props.sizes, onSizesChange = props.onSizesChange, scrollbarProps = _object_without_properties(props, [
        "sizes",
        "onSizesChange"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
    var _ref = _sliced_to_array((0, import_react9.useState)(), 2), computedStyle = _ref[0], setComputedStyle = _ref[1];
    var ref = (0, import_react9.useRef)(null);
    var composeRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref, context.onScrollbarYChange);
    (0, import_react9.useEffect)(function() {
        if (ref.current) setComputedStyle(getComputedStyle(ref.current));
    }, [
        ref
    ]);
    return /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
        "data-orientation": "vertical"
    }, scrollbarProps, {
        ref: composeRefs,
        sizes: sizes,
        style: _object_spread(_define_property({
            top: 0,
            right: context.dir === "ltr" ? 0 : void 0,
            left: context.dir === "rtl" ? 0 : void 0,
            bottom: "var(--radix-scroll-area-corner-height)"
        }, "--radix-scroll-area-thumb-height", $57acba87d6e25586$var$getThumbSize(sizes) + "px"), props.style),
        onThumbPointerDown: function(pointerPos) {
            return props.onThumbPointerDown(pointerPos.y);
        },
        onDragScroll: function(pointerPos) {
            return props.onDragScroll(pointerPos.y);
        },
        onWheelScroll: function(event, maxScrollPos) {
            if (context.viewport) {
                var scrollPos = context.viewport.scrollTop + event.deltaY;
                props.onWheelScroll(scrollPos);
                if ($57acba87d6e25586$var$isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
            }
        },
        onResize: function() {
            if (ref.current && context.viewport && computedStyle) onSizesChange({
                content: context.viewport.scrollHeight,
                viewport: context.viewport.offsetHeight,
                scrollbar: {
                    size: ref.current.clientHeight,
                    paddingStart: $57acba87d6e25586$var$toInt(computedStyle.paddingTop),
                    paddingEnd: $57acba87d6e25586$var$toInt(computedStyle.paddingBottom)
                }
            });
        }
    }));
});
var _$57acba87d6e25586$var$createScrollAreaContext1 = _sliced_to_array($57acba87d6e25586$var$createScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME), 2), $57acba87d6e25586$var$ScrollbarProvider = _$57acba87d6e25586$var$createScrollAreaContext1[0], $57acba87d6e25586$var$useScrollbarContext = _$57acba87d6e25586$var$createScrollAreaContext1[1];
var $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var handleDragScroll = function handleDragScroll(event) {
        if (rectRef.current) {
            var x = event.clientX - rectRef.current.left;
            var y = event.clientY - rectRef.current.top;
            onDragScroll({
                x: x,
                y: y
            });
        }
    };
    var __scopeScrollArea = props.__scopeScrollArea, sizes = props.sizes, hasThumb = props.hasThumb, onThumbChange = props.onThumbChange, onThumbPointerUp = props.onThumbPointerUp, onThumbPointerDown = props.onThumbPointerDown, onThumbPositionChange = props.onThumbPositionChange, onDragScroll = props.onDragScroll, onWheelScroll = props.onWheelScroll, onResize = props.onResize, scrollbarProps = _object_without_properties(props, [
        "__scopeScrollArea",
        "sizes",
        "hasThumb",
        "onThumbChange",
        "onThumbPointerUp",
        "onThumbPointerDown",
        "onThumbPositionChange",
        "onDragScroll",
        "onWheelScroll",
        "onResize"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, __scopeScrollArea);
    var _ref = _sliced_to_array((0, import_react9.useState)(null), 2), scrollbar = _ref[0], setScrollbar = _ref[1];
    var composeRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, function(node) {
        return setScrollbar(node);
    });
    var rectRef = (0, import_react9.useRef)(null);
    var prevWebkitUserSelectRef = (0, import_react9.useRef)("");
    var viewport = context.viewport;
    var maxScrollPos = sizes.content - sizes.viewport;
    var handleWheelScroll = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onWheelScroll);
    var handleThumbPositionChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPositionChange);
    var handleResize = $57acba87d6e25586$var$useDebounceCallback(onResize, 10);
    (0, import_react9.useEffect)(function() {
        var handleWheel = function(event) {
            var element = event.target;
            var isScrollbarWheel = scrollbar === null || scrollbar === void 0 ? void 0 : scrollbar.contains(element);
            if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos);
        };
        document.addEventListener("wheel", handleWheel, {
            passive: false
        });
        return function() {
            return document.removeEventListener("wheel", handleWheel, {
                passive: false
            });
        };
    }, [
        viewport,
        scrollbar,
        maxScrollPos,
        handleWheelScroll
    ]);
    (0, import_react9.useEffect)(handleThumbPositionChange, [
        sizes,
        handleThumbPositionChange
    ]);
    $57acba87d6e25586$var$useResizeObserver(scrollbar, handleResize);
    $57acba87d6e25586$var$useResizeObserver(context.content, handleResize);
    return /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollbarProvider, {
        scope: __scopeScrollArea,
        scrollbar: scrollbar,
        hasThumb: hasThumb,
        onThumbChange: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbChange),
        onThumbPointerUp: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerUp),
        onThumbPositionChange: handleThumbPositionChange,
        onThumbPointerDown: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerDown)
    }, /* @__PURE__ */ (0, import_react9.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, scrollbarProps, {
        ref: composeRefs,
        style: _object_spread({
            position: "absolute"
        }, scrollbarProps.style),
        onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDown, function(event) {
            var mainPointer = 0;
            if (event.button === mainPointer) {
                var element = event.target;
                element.setPointerCapture(event.pointerId);
                rectRef.current = scrollbar.getBoundingClientRect();
                prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
                document.body.style.webkitUserSelect = "none";
                handleDragScroll(event);
            }
        }),
        onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerMove, handleDragScroll),
        onPointerUp: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerUp, function(event) {
            var element = event.target;
            if (element.hasPointerCapture(event.pointerId)) element.releasePointerCapture(event.pointerId);
            document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
            rectRef.current = null;
        })
    })));
});
var $57acba87d6e25586$var$THUMB_NAME = "ScrollAreaThumb";
var $57acba87d6e25586$export$9fba1154677d7cd2 = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var forceMount = props.forceMount, thumbProps = _object_without_properties(props, [
        "forceMount"
    ]);
    var scrollbarContext = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, props.__scopeScrollArea);
    return /* @__PURE__ */ (0, import_react9.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
        present: forceMount || scrollbarContext.hasThumb
    }, /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends({
        ref: forwardedRef
    }, thumbProps)));
});
var $57acba87d6e25586$var$ScrollAreaThumbImpl = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var __scopeScrollArea = props.__scopeScrollArea, style = props.style, thumbProps = _object_without_properties(props, [
        "__scopeScrollArea",
        "style"
    ]);
    var scrollAreaContext = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$THUMB_NAME, __scopeScrollArea);
    var scrollbarContext = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, __scopeScrollArea);
    var onThumbPositionChange = scrollbarContext.onThumbPositionChange;
    var composedRef = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, function(node) {
        return scrollbarContext.onThumbChange(node);
    });
    var removeUnlinkedScrollListenerRef = (0, import_react9.useRef)();
    var debounceScrollEnd = $57acba87d6e25586$var$useDebounceCallback(function() {
        if (removeUnlinkedScrollListenerRef.current) {
            removeUnlinkedScrollListenerRef.current();
            removeUnlinkedScrollListenerRef.current = void 0;
        }
    }, 100);
    (0, import_react9.useEffect)(function() {
        var viewport = scrollAreaContext.viewport;
        if (viewport) {
            var handleScroll = function() {
                debounceScrollEnd();
                if (!removeUnlinkedScrollListenerRef.current) {
                    var listener = $57acba87d6e25586$var$addUnlinkedScrollListener(viewport, onThumbPositionChange);
                    removeUnlinkedScrollListenerRef.current = listener;
                    onThumbPositionChange();
                }
            };
            onThumbPositionChange();
            viewport.addEventListener("scroll", handleScroll);
            return function() {
                return viewport.removeEventListener("scroll", handleScroll);
            };
        }
    }, [
        scrollAreaContext.viewport,
        debounceScrollEnd,
        onThumbPositionChange
    ]);
    return /* @__PURE__ */ (0, import_react9.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
        "data-state": scrollbarContext.hasThumb ? "visible" : "hidden"
    }, thumbProps, {
        ref: composedRef,
        style: _object_spread({
            width: "var(--radix-scroll-area-thumb-width)",
            height: "var(--radix-scroll-area-thumb-height)"
        }, style),
        onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, function(event) {
            var thumb = event.target;
            var thumbRect = thumb.getBoundingClientRect();
            var x = event.clientX - thumbRect.left;
            var y = event.clientY - thumbRect.top;
            scrollbarContext.onThumbPointerDown({
                x: x,
                y: y
            });
        }),
        onPointerUp: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerUp, scrollbarContext.onThumbPointerUp)
    }));
});
var $57acba87d6e25586$var$CORNER_NAME = "ScrollAreaCorner";
var $57acba87d6e25586$export$56969d565df7cc4b = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, props.__scopeScrollArea);
    var hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
    var hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
    return hasCorner ? /* @__PURE__ */ (0, import_react9.createElement)($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends({}, props, {
        ref: forwardedRef
    })) : null;
});
var $57acba87d6e25586$var$ScrollAreaCornerImpl = /* @__PURE__ */ (0, import_react9.forwardRef)(function(props, forwardedRef) {
    var __scopeScrollArea = props.__scopeScrollArea, cornerProps = _object_without_properties(props, [
        "__scopeScrollArea"
    ]);
    var context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, __scopeScrollArea);
    var _ref = _sliced_to_array((0, import_react9.useState)(0), 2), width1 = _ref[0], setWidth = _ref[1];
    var _ref1 = _sliced_to_array((0, import_react9.useState)(0), 2), height1 = _ref1[0], setHeight = _ref1[1];
    var hasSize = Boolean(width1 && height1);
    $57acba87d6e25586$var$useResizeObserver(context.scrollbarX, function() {
        var _context$scrollbarX;
        var height = ((_context$scrollbarX = context.scrollbarX) === null || _context$scrollbarX === void 0 ? void 0 : _context$scrollbarX.offsetHeight) || 0;
        context.onCornerHeightChange(height);
        setHeight(height);
    });
    $57acba87d6e25586$var$useResizeObserver(context.scrollbarY, function() {
        var _context$scrollbarY;
        var width = ((_context$scrollbarY = context.scrollbarY) === null || _context$scrollbarY === void 0 ? void 0 : _context$scrollbarY.offsetWidth) || 0;
        context.onCornerWidthChange(width);
        setWidth(width);
    });
    return hasSize ? /* @__PURE__ */ (0, import_react9.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, cornerProps, {
        ref: forwardedRef,
        style: _object_spread({
            width: width1,
            height: height1,
            position: "absolute",
            right: context.dir === "ltr" ? 0 : void 0,
            left: context.dir === "rtl" ? 0 : void 0,
            bottom: 0
        }, props.style)
    })) : null;
});
function $57acba87d6e25586$var$toInt(value) {
    return value ? parseInt(value, 10) : 0;
}
function $57acba87d6e25586$var$getThumbRatio(viewportSize, contentSize) {
    var ratio = viewportSize / contentSize;
    return isNaN(ratio) ? 0 : ratio;
}
function $57acba87d6e25586$var$getThumbSize(sizes) {
    var ratio = $57acba87d6e25586$var$getThumbRatio(sizes.viewport, sizes.content);
    var scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
    var thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
    return Math.max(thumbSize, 18);
}
function $57acba87d6e25586$var$getScrollPositionFromPointer(pointerPos, pointerOffset, sizes) {
    var dir = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "ltr";
    var thumbSizePx = $57acba87d6e25586$var$getThumbSize(sizes);
    var thumbCenter = thumbSizePx / 2;
    var offset = pointerOffset || thumbCenter;
    var thumbOffsetFromEnd = thumbSizePx - offset;
    var minPointerPos = sizes.scrollbar.paddingStart + offset;
    var maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
    var maxScrollPos = sizes.content - sizes.viewport;
    var scrollRange = dir === "ltr" ? [
        0,
        maxScrollPos
    ] : [
        maxScrollPos * -1,
        0
    ];
    var interpolate = $57acba87d6e25586$var$linearScale([
        minPointerPos,
        maxPointerPos
    ], scrollRange);
    return interpolate(pointerPos);
}
function $57acba87d6e25586$var$getThumbOffsetFromScroll(scrollPos, sizes) {
    var dir = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "ltr";
    var thumbSizePx = $57acba87d6e25586$var$getThumbSize(sizes);
    var scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
    var scrollbar = sizes.scrollbar.size - scrollbarPadding;
    var maxScrollPos = sizes.content - sizes.viewport;
    var maxThumbPos = scrollbar - thumbSizePx;
    var scrollClampRange = dir === "ltr" ? [
        0,
        maxScrollPos
    ] : [
        maxScrollPos * -1,
        0
    ];
    var scrollWithoutMomentum = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(scrollPos, scrollClampRange);
    var interpolate = $57acba87d6e25586$var$linearScale([
        0,
        maxScrollPos
    ], [
        0,
        maxThumbPos
    ]);
    return interpolate(scrollWithoutMomentum);
}
function $57acba87d6e25586$var$linearScale(input, output) {
    return function(value) {
        if (input[0] === input[1] || output[0] === output[1]) return output[0];
        var ratio = (output[1] - output[0]) / (input[1] - input[0]);
        return output[0] + ratio * (value - input[0]);
    };
}
function $57acba87d6e25586$var$isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
    return scrollPos > 0 && scrollPos < maxScrollPos;
}
var $57acba87d6e25586$var$addUnlinkedScrollListener = function(node) {
    var handler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {};
    var prevPosition = {
        left: node.scrollLeft,
        top: node.scrollTop
    };
    var rAF = 0;
    (function loop() {
        var position = {
            left: node.scrollLeft,
            top: node.scrollTop
        };
        var isHorizontalScroll = prevPosition.left !== position.left;
        var isVerticalScroll = prevPosition.top !== position.top;
        if (isHorizontalScroll || isVerticalScroll) handler();
        prevPosition = position;
        rAF = window.requestAnimationFrame(loop);
    })();
    return function() {
        return window.cancelAnimationFrame(rAF);
    };
};
function $57acba87d6e25586$var$useDebounceCallback(callback, delay) {
    var handleCallback = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback);
    var debounceTimerRef = (0, import_react9.useRef)(0);
    (0, import_react9.useEffect)(function() {
        return function() {
            return window.clearTimeout(debounceTimerRef.current);
        };
    }, []);
    return (0, import_react9.useCallback)(function() {
        window.clearTimeout(debounceTimerRef.current);
        debounceTimerRef.current = window.setTimeout(handleCallback, delay);
    }, [
        handleCallback,
        delay
    ]);
}
function $57acba87d6e25586$var$useResizeObserver(element, onResize) {
    var handleResize = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onResize);
    $9f79659886946c16$export$e5c5a5f917a5871c(function() {
        var rAF = 0;
        if (element) {
            var resizeObserver = new ResizeObserver(function() {
                cancelAnimationFrame(rAF);
                rAF = window.requestAnimationFrame(handleResize);
            });
            resizeObserver.observe(element);
            return function() {
                window.cancelAnimationFrame(rAF);
                resizeObserver.unobserve(element);
            };
        }
    }, [
        element,
        handleResize
    ]);
}
var $57acba87d6e25586$export$be92b6f5f03c0fe9 = $57acba87d6e25586$export$ccf8d8d7bbf3c2cc;
var $57acba87d6e25586$export$d5c6c08dc2d3ca7 = $57acba87d6e25586$export$a21cbf9f11fca853;
var $57acba87d6e25586$export$ac61190d9fc311a9 = $57acba87d6e25586$export$56969d565df7cc4b;
// lib/utils.ts
var import_clsx = require("clsx");
var import_tailwind_merge = require("tailwind-merge");
function cn() {
    for(var _len = arguments.length, inputs = new Array(_len), _key = 0; _key < _len; _key++){
        inputs[_key] = arguments[_key];
    }
    return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
}
// registry/default/ui/scroll-area.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var ScrollArea = React.forwardRef(function(_param, ref) {
    var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
        "className",
        "children"
    ]);
    return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)($57acba87d6e25586$export$be92b6f5f03c0fe9, _object_spread_props(_object_spread({
        ref: ref,
        className: cn("relative overflow-hidden", className)
    }, props), {
        children: [
            /* @__PURE__ */ (0, import_jsx_runtime.jsx)($57acba87d6e25586$export$d5c6c08dc2d3ca7, {
                className: "h-full w-full rounded-[inherit]",
                children: children
            }),
            /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollBar, {}),
            /* @__PURE__ */ (0, import_jsx_runtime.jsx)($57acba87d6e25586$export$ac61190d9fc311a9, {})
        ]
    }));
});
ScrollArea.displayName = $57acba87d6e25586$export$be92b6f5f03c0fe9.displayName;
var ScrollBar = React.forwardRef(function(_param, ref) {
    var className = _param.className, _param_orientation = _param.orientation, orientation = _param_orientation === void 0 ? "vertical" : _param_orientation, props = _object_without_properties(_param, [
        "className",
        "orientation"
    ]);
    return /* @__PURE__ */ (0, import_jsx_runtime.jsx)($57acba87d6e25586$export$2fabd85d0eba3c57, _object_spread_props(_object_spread({
        ref: ref,
        orientation: orientation,
        className: cn("flex touch-none select-none transition-colors", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]", className)
    }, props), {
        children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)($57acba87d6e25586$export$9fba1154677d7cd2, {
            className: "relative flex-1 rounded-full bg-border"
        })
    }));
});
ScrollBar.displayName = $57acba87d6e25586$export$2fabd85d0eba3c57.displayName;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
    ScrollArea: ScrollArea,
    ScrollBar: ScrollBar
});
//# sourceMappingURL=scroll-area.js.map