import { mapValues } from "@makeswift/controls";
function serializeState(state) {
  if (state instanceof Map) {
    return serializeState(Object.fromEntries(state.entries()));
  }
  if (state instanceof Set)
    return serializeState([...state.values()]);
  if (Array.isArray(state))
    return state.map(serializeState);
  if (state !== null && typeof state === "object") {
    return mapValues(state, serializeState);
  }
  return state;
}
export {
  serializeState
};
//# sourceMappingURL=serializeState.js.map