var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
import { Fragment as _Fragment, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
import { ProProvider } from "@antdv/pro-provider";
import { classNames, omit } from "@antdv/pro-utils";
import { Drawer } from "ant-design-vue";
import { useConfigContextInject } from "ant-design-vue/lib/config-provider/context";
import { computed, defineComponent, watchEffect } from "vue";
import { privateSiderMenuProps, SiderMenu, siderMenuProps } from "./SiderMenu.mjs";
import { useStyle } from "./style/index.mjs";
const SiderMenuWrapper = defineComponent({
  name: "SiderMenuWrapper",
  inheritAttrs: false,
  props: __spreadValues(__spreadValues({}, siderMenuProps), privateSiderMenuProps()),
  setup(props) {
    const {
      token
    } = ProProvider.useContext();
    const {
      direction
    } = useConfigContextInject();
    watchEffect(() => {
      var _a;
      if (props.isMobile === true) {
        (_a = props.onCollapse) == null ? void 0 : _a.call(props, true);
      }
    });
    const {
      wrapSSR,
      hashId
    } = useStyle(computed(() => `${props.prefixCls}-sider`), {
      proLayoutCollapsedWidth: 64
    });
    return () => {
      var _a, _b, _c;
      const {
        isMobile,
        siderWidth,
        collapsed,
        onCollapse,
        style,
        className,
        hide,
        prefixCls,
        getContainer
      } = props;
      const siderClassName = classNames(`${prefixCls}-sider`, className, hashId.value);
      const omitProps = __spreadProps(__spreadValues({}, omit(props, ["className", "style"])), {
        originCollapsed: (_a = props.originCollapsed) != null ? _a : collapsed
      });
      if (hide) {
        return null;
      }
      return wrapSSR(isMobile ? _createVNode(_Fragment, null, [_createVNode(Drawer, {
        "placement": (direction == null ? void 0 : direction.value) === "rtl" ? "right" : "left",
        "class": classNames(`${prefixCls}-drawer-sider`, className),
        "open": !collapsed,
        "onUpdate:open": () => {
          onCollapse == null ? void 0 : onCollapse(true);
        },
        "style": __spreadValues({
          padding: 0,
          height: "100vh"
        }, style),
        "onClose": () => {
          onCollapse == null ? void 0 : onCollapse(true);
        },
        "maskClosable": true,
        "closable": false,
        "getContainer": getContainer || false,
        "width": siderWidth,
        "bodyStyle": {
          height: "100vh",
          padding: 0,
          display: "flex",
          flexDirection: "row",
          backgroundColor: (_c = (_b = token == null ? void 0 : token.layout) == null ? void 0 : _b.sider) == null ? void 0 : _c.colorMenuBackground
        }
      }, {
        default: () => [_createVNode(SiderMenu, _mergeProps(omitProps, {
          "isMobile": true,
          "className": siderClassName,
          "collapsed": isMobile ? false : collapsed,
          "splitMenus": false
        }), null)]
      })]) : _createVNode(SiderMenu, _mergeProps({
        "className": siderClassName
      }, omitProps, {
        "style": style
      }), null));
    };
  }
});
export {
  SiderMenuWrapper as SiderMenu
};
