"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useProvideUnstableContext = exports.useProvideKeysState = exports.useInjectUnstableContext = exports.useInjectTreeContext = exports.useInjectKeysState = exports.TreeContext = void 0;
var _vue = require("vue");
/**
 * Webpack has bug for import loop, which is not the same behavior as ES module.
 * When util.js imports the TreeNode for tree generate will cause treeContextTypes be empty.
 */

const TreeContextKey = Symbol('TreeContextKey');
const TreeContext = exports.TreeContext = (0, _vue.defineComponent)({
  compatConfig: {
    MODE: 3
  },
  name: 'TreeContext',
  props: {
    value: {
      type: Object
    }
  },
  setup(props, {
    slots
  }) {
    (0, _vue.provide)(TreeContextKey, (0, _vue.computed)(() => props.value));
    return () => {
      var _a;
      return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
    };
  }
});
const useInjectTreeContext = () => {
  return (0, _vue.inject)(TreeContextKey, (0, _vue.computed)(() => ({})));
};
exports.useInjectTreeContext = useInjectTreeContext;
const KeysStateKey = Symbol('KeysStateKey');
const useProvideKeysState = state => {
  (0, _vue.provide)(KeysStateKey, state);
};
exports.useProvideKeysState = useProvideKeysState;
const useInjectKeysState = () => {
  return (0, _vue.inject)(KeysStateKey, {
    expandedKeys: (0, _vue.shallowRef)([]),
    selectedKeys: (0, _vue.shallowRef)([]),
    loadedKeys: (0, _vue.shallowRef)([]),
    loadingKeys: (0, _vue.shallowRef)([]),
    checkedKeys: (0, _vue.shallowRef)([]),
    halfCheckedKeys: (0, _vue.shallowRef)([]),
    expandedKeysSet: (0, _vue.computed)(() => new Set()),
    selectedKeysSet: (0, _vue.computed)(() => new Set()),
    loadedKeysSet: (0, _vue.computed)(() => new Set()),
    loadingKeysSet: (0, _vue.computed)(() => new Set()),
    checkedKeysSet: (0, _vue.computed)(() => new Set()),
    halfCheckedKeysSet: (0, _vue.computed)(() => new Set()),
    flattenNodes: (0, _vue.shallowRef)([])
  });
};
exports.useInjectKeysState = useInjectKeysState;
const UnstableContextKey = Symbol('UnstableContextKey');
const useProvideUnstableContext = state => {
  (0, _vue.provide)(UnstableContextKey, state);
};
exports.useProvideUnstableContext = useProvideUnstableContext;
const useInjectUnstableContext = () => {
  return (0, _vue.inject)(UnstableContextKey, {});
};
exports.useInjectUnstableContext = useInjectUnstableContext;