import { jsxs, jsx } from "react/jsx-runtime";
import * as React from "react";
import { cn } from "../../lib/utils.js";
const HEADER_TABS_SLOT_WRAPPER_CLASS = "[&>[role=tablist]]:w-full [&>[role=tablist]]:px-[var(--layout-space-loose)]";
const ChromeHeader = React.forwardRef(
  ({ className, withTabs, tabsSlot, lockDensity = "inherit", leadingRail, children, ...props }, ref) => {
    const hasTabs = tabsSlot != null || withTabs === true;
    if (tabsSlot != null) {
      return /* @__PURE__ */ jsxs(
        "header",
        {
          ref,
          "data-density": lockDensity === "lg" ? "lg" : void 0,
          className: cn("flex flex-col shrink-0", className),
          ...props,
          children: [
            /* @__PURE__ */ jsx(
              "div",
              {
                className: cn(
                  "flex items-center gap-2",
                  "h-[var(--chrome-header-height)]",
                  "px-[var(--layout-space-loose)]"
                ),
                children
              }
            ),
            /* @__PURE__ */ jsx("div", { className: HEADER_TABS_SLOT_WRAPPER_CLASS, children: tabsSlot })
          ]
        }
      );
    }
    if (leadingRail != null) {
      return /* @__PURE__ */ jsxs(
        "header",
        {
          ref,
          "data-density": lockDensity === "lg" ? "lg" : void 0,
          className: cn(
            "flex items-center shrink-0",
            "h-[var(--chrome-header-height)]",
            !hasTabs && "border-b border-divider",
            className
          ),
          ...props,
          children: [
            /* @__PURE__ */ jsx("div", { className: "flex w-[var(--sidebar-width-icon)] shrink-0 items-center justify-center border-r border-divider", children: leadingRail }),
            /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center gap-2 min-w-0 px-[var(--layout-space-loose)]", children })
          ]
        }
      );
    }
    return /* @__PURE__ */ jsx(
      "header",
      {
        ref,
        "data-density": lockDensity === "lg" ? "lg" : void 0,
        className: cn(
          "flex items-center gap-2 shrink-0",
          "h-[var(--chrome-header-height)]",
          "px-[var(--layout-space-loose)]",
          // W1:無 tabs 自畫 border;withTabs=true(無 tabsSlot)consumer 自畫
          !hasTabs && "border-b border-divider",
          className
        ),
        ...props,
        children
      }
    );
  }
);
ChromeHeader.displayName = "ChromeHeader";
export {
  ChromeHeader,
  HEADER_TABS_SLOT_WRAPPER_CLASS
};
//# sourceMappingURL=chrome-header.js.map
