import { useMemo as c, useCallback as u } from "react";
import { usePagesRotateContext as f } from "../../contexts/PagesRotateContext.js";
import { useLicenseContext as m } from "../../contexts/LicenseContext.js";
import { LicenseType as p } from "../types.js";
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as R } from "../const.js";
const y = () => {
  const { setSinglePageRotate: n } = f(), { type: r, validating: s } = m(), a = c(() => r !== p.Developer, [r]), i = u(
    (l, e) => {
      n((t) => {
        const o = typeof e == "function" ? e(t[l] || 0) : e;
        return o % 90 !== 0 ? (console.warn("rotationDegree must be a multiple of 90 got", o), t) : {
          ...t,
          [l]: o
        };
      });
    },
    [n]
  );
  return { rotate: c(() => s !== !1 ? () => {
  } : a ? i : () => {
    console.error(R);
  }, [s, a, i]) };
};
export {
  y as usePageRotateContext
};
