import { ref as m, watch as u } from "vue";
import "../../config-provider/index.mjs";
import "../../utils/index.mjs";
import { pickColumnConfig as c } from "../utils.mjs";
import { useGlobalConfig as f } from "../../config-provider/hooks/use-global-config.mjs";
import { isDef as k } from "../../utils/is.mjs";
const V = (i, t) => {
  const s = m({}), r = f("maskVisible");
  u(
    () => i.value,
    (e) => {
      const l = {
        ...c(
          e,
          "defaultMaskVisible",
          r.value ?? !1
        ),
        ...s.value
      };
      s.value = l;
    },
    {
      immediate: !0
    }
  ), u(
    () => r.value,
    (e) => {
      if (!k(e))
        return;
      const o = s.value;
      Object.keys(o).forEach((n) => {
        a(n, e);
      });
    }
  );
  function a(e, o) {
    s.value[e] = o, t.value && t.value.refreshCells({ columns: [e], force: !0 });
  }
  return {
    masks: s,
    setMaskVisible: a
  };
};
export {
  V as useMask
};
