import { Slot } from '@radix-ui/react-slot';
import { pick, omit } from 'lodash-es';
import { forwardRef, useCallback } from 'react';
import ReactVirtualizedAutoSizer from 'react-virtualized-auto-sizer';
import { extendTailwindMerge } from 'tailwind-merge';
import { createClassed } from '@tw-classed/react';
import { createClassed as createClassed$1 } from '@tw-classed/core';
import 'clsx';
import createVariatGroupTransfomer from 'tailwind-group-variant';
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
import { jsx } from 'react/jsx-runtime';

// src/components/AutoSizer/AutoSizer.tsx
var twMerge = extendTailwindMerge({
  classGroups: {
    "font-size": [
      {
        // Fixes incorect merging of text size
        text: ["h1", "h2", "h3", "h4", "h5", "h6"]
      }
    ]
  }
});
var { classed } = createClassed({ merger: twMerge });
createClassed$1({ merger: twMerge });
createVariatGroupTransfomer({});
var AutoSizer = ({
  children,
  autoSizerClassName,
  ...props
}) => {
  const element = useCallback(
    ({ width, height }) => {
      if (typeof children === "function") {
        return children({ height, width });
      }
      const { style, ...rest } = props;
      return /* @__PURE__ */ jsx(
        Slot,
        {
          ...rest,
          style: {
            ...style,
            width,
            height
          },
          children
        }
      );
    },
    [children, props]
  );
  return /* @__PURE__ */ jsx(ReactVirtualizedAutoSizer, { className: autoSizerClassName, children: ({ width, height }) => element({ width, height }) });
};
var pickedScrollAreaProps = {
  scrollHideDelay: true,
  type: true,
  dir: true
};
var ScrollerContainerElementWrapper = classed("div", "w-full", {
  variants: {
    grow: {
      true: "grow"
    }
  }
});
var ScrollArea = forwardRef(
  ({ children, ...props }, forwardedRef) => {
    return /* @__PURE__ */ jsx(ScrollerContainer, { ...props, children: /* @__PURE__ */ jsx(ScrollAreaViewport, { ref: forwardedRef, children }) });
  }
);
var ScrollerContainer = (props) => {
  const scrollAreaProps = pick(props, Object.keys(pickedScrollAreaProps));
  const { children, className, ...rest } = omit(props, Object.keys(pickedScrollAreaProps));
  return /* @__PURE__ */ jsx(ScrollerContainerElementWrapper, { className, ...rest, children: /* @__PURE__ */ jsx(AutoSizer, { children: /* @__PURE__ */ jsx(ScrollerContainerElement, { ...scrollAreaProps, children }) }) });
};
var ScrollAreaViewport = classed(ScrollAreaPrimitive.Viewport, "w-full h-full");
var ScrollerContainerElement = classed(ScrollAreaPrimitive.Root, "w-full bg-danger", {
  variants: {}
});
var Container = classed("div", "grow flex flex-col");
var Header = classed("div", "shrink-0");
var Footer = classed("div", "shrink-0");

export { AutoSizer, Container, Footer, Header, ScrollArea, ScrollAreaViewport, ScrollerContainer };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map