'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var useMenuContext = require('./hooks/useMenuContext.cjs');
var SubMenuList = require('./SubMenuList.cjs');

var InlineSubMenuList = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "InlineSubMenuList",
  inheritAttrs: false,
  props: {
    id: String,
    open: Boolean,
    keyPath: Array
  },
  setup(props, {
    slots
  }) {
    const fixedMode = vue.computed(() => "inline");
    const {
      motion,
      mode,
      defaultMotions
    } = useMenuContext.useInjectMenu();
    const sameModeRef = vue.computed(() => mode.value === fixedMode.value);
    const destroy = vue.ref(!sameModeRef.value);
    const mergedOpen = vue.computed(() => sameModeRef.value ? props.open : false);
    vue.watch(mode, () => {
      if (sameModeRef.value)
        destroy.value = false;
    }, {
      flush: "post"
    });
    const mergedMotion = vue.computed(() => {
      var _a, _b;
      const m = motion.value || ((_a = defaultMotions.value) == null ? void 0 : _a[fixedMode.value]) || ((_b = defaultMotions.value) == null ? void 0 : _b.other);
      const res = typeof m === "function" ? m() : m;
      return {
        ...res,
        appear: props.keyPath.length <= 1
      };
    });
    return () => {
      if (destroy.value)
        return null;
      return vue.createVNode(useMenuContext.MenuContextProvider, {
        "mode": fixedMode.value
      }, {
        default: () => [vue.createVNode(vue.Transition, mergedMotion.value, {
          default: () => [vue.withDirectives(vue.createVNode(SubMenuList.default, {
            "id": props.id
          }, {
            default: () => {
              var _a;
              return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
            }
          }), [[vue.vShow, mergedOpen.value]])]
        })]
      });
    };
  }
});

exports.default = InlineSubMenuList;
//# sourceMappingURL=InlineSubMenuList.cjs.map
