"use strict";
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 __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (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 import_jsx_runtime = require("react/jsx-runtime");
var import_react2 = require("@testing-library/react");
var import_yoga_icons = require("@gympass/yoga-icons");
var import_Theme = __toESM(require("../../Theme"));
var import_AvatarCircle = __toESM(require("../../Avatar/web/AvatarCircle"));
var import_Icon = __toESM(require("../../Icon"));
var import_NavigationMenu = __toESM(require("./NavigationMenu"));
describe("<NavigationMenu />", () => {
  describe("Snapshots", () => {
    it("should match NavigationMenu", () => {
      const renderWrapper = ({ children }) => {
        return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://www.gympass.com", children });
      };
      const IconComponent = ({ icon }) => {
        return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.default, { as: icon });
      };
      const itemMainGroup = [
        {
          expanded: true,
          icon: import_yoga_icons.Doc,
          label: "Subscription",
          tag: "new",
          subitems: [{ label: "Details" }]
        },
        {
          active: true,
          icon: import_yoga_icons.Doc,
          label: "Billing"
        }
      ];
      const itemGroups = [
        [...itemMainGroup],
        [
          {
            icon: import_yoga_icons.Help,
            label: "Help"
          }
        ]
      ];
      const bottomItems = [
        ...itemMainGroup.slice(0, 2).map(({ active, icon, label }) => ({
          active,
          icon,
          label,
          wrapper: renderWrapper
        })),
        {
          active: false,
          icon: import_yoga_icons.MenuMore,
          label: "More",
          wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children })
        }
      ];
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Theme.default, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
            import_NavigationMenu.default,
            {
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                  import_NavigationMenu.default.Menu,
                  {
                    avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
                    title: "Company",
                    subtitle: "Reseller"
                  }
                ) }),
                /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Items, { children: itemGroups.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.ItemsGroup, { children: group.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                  import_NavigationMenu.default.Item,
                  {
                    active: item.active,
                    expanded: item.expanded,
                    icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconComponent, { icon: item.icon }),
                    label: item.label,
                    wrapper: renderWrapper,
                    tag: item.tag,
                    children: item.subitems && item.subitems.map(({ label }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                      import_NavigationMenu.default.Subitem,
                      {
                        label,
                        wrapper: renderWrapper
                      },
                      label
                    ))
                  },
                  item.label
                )) }, index)) }),
                /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                  import_NavigationMenu.default.Switcher,
                  {
                    avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
                    title: "User",
                    subtitle: "Admin, Supervisor"
                  }
                ) })
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.BottomItems, { children: bottomItems.map(({ active, icon, label, wrapper }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
            import_NavigationMenu.default.BottomItem,
            {
              active,
              icon,
              label,
              wrapper
            },
            label
          )) })
        ] })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match NavigationMenu.Menu with an action", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default, { responsive: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_NavigationMenu.default.Menu,
          {
            avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
            title: "Company",
            subtitle: "Reseller",
            onClick: () => null
          }
        ) }) }) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match NavigationMenu.Switcher with actions", () => {
      const actions = [
        {
          id: "Action 1",
          label: "Action 1",
          onClick: () => null
        },
        {
          id: "Action 2",
          label: "Action 2",
          onClick: () => null
        }
      ];
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default, { responsive: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_NavigationMenu.default.Switcher,
          {
            actions,
            avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
            sideOffset: 36,
            subtitle: "Admin, Supervisor",
            title: "User"
          }
        ) }) }) })
      );
      expect(container).toMatchSnapshot();
    });
  });
});
