"use client";
import { useCallback } from "react";
import { usePersistedBooleanFlag } from "./usePersistedBooleanFlag.js";
function getStorageKey(pageType, groupId) {
  return `om:collapsible:${pageType}:${groupId}`;
}
function useGroupCollapse(pageType, groupId, defaultExpanded = true) {
  const { value: expanded, toggle, setValue, isHydrated } = usePersistedBooleanFlag(
    getStorageKey(pageType, groupId),
    defaultExpanded
  );
  const setExpanded = useCallback((next) => {
    if (typeof next === "function") {
      setValue((prev) => next(prev));
    } else {
      setValue(next);
    }
  }, [setValue]);
  return { expanded, toggle, setExpanded, isHydrated };
}
export {
  useGroupCollapse
};
//# sourceMappingURL=useGroupCollapse.js.map
