import { defineComponent as v, defineAsyncComponent as _, ref as y, computed as w, watch as x, createElementBlock as h, openBlock as C, createElementVNode as t, createVNode as r, unref as u, normalizeClass as o, toDisplayString as V } from "vue";
const P = { class: "flex items-center justify-center gap-2 px-2" }, k = { class: "flex items-center gap-0.5" }, z = ["value", "size", "disabled"], B = { class: "leading-none" }, N = /* @__PURE__ */ v({
  __name: "pager",
  props: {
    modelValue: { default: 1 },
    pages: { default: 0 },
    disabled: { type: Boolean, default: !1 },
    mode: {}
  },
  emits: ["update:modelValue"],
  setup(p, { emit: c }) {
    const s = _(() => import("./DN-aONkm.js")), a = p, i = c, n = y(a.modelValue), g = w(() => Math.max(`${a.pages}`.length, 3)), m = (e) => e % 1 === 0, f = (e) => {
      const l = e.target;
      m(+l.value) && +l.value <= a.pages ? (n.value = +l.value, i("update:modelValue", n.value)) : l.value = n.value.toString();
    }, d = (e) => {
      let l = Math.max(Math.min(a.modelValue + e, a.pages), 1);
      i("update:modelValue", l);
    };
    return x(
      () => a.modelValue,
      (e) => {
        n.value = e;
      }
    ), (e, l) => (C(), h("div", P, [
      t("div", k, [
        r(u(s), {
          onClick: l[0] || (l[0] = (b) => d(-1)),
          icon: "arrow_circle_up",
          class: "group rounded-lg px-1 py-0.5 text-2xl",
          iconClass: {
            "transition-transform": !0,
            "-rotate-90": e.mode != "vertical"
          },
          disabled: e.disabled
        }, null, 8, ["iconClass", "disabled"]),
        r(u(s), {
          onClick: l[1] || (l[1] = (b) => d(1)),
          icon: "arrow_circle_down",
          class: "group rounded-lg px-1 py-0.5 text-2xl",
          iconClass: {
            "transition-transform": !0,
            "-rotate-90": e.mode != "vertical"
          },
          disabled: e.disabled
        }, null, 8, ["iconClass", "disabled"])
      ]),
      t("div", {
        class: o(["hidden select-none items-center justify-stretch gap-1 md:flex", {
          "text-gray-400": e.disabled
        }])
      }, [
        t("label", {
          for: "__PDF__PAGER_INPUT__",
          class: o(["group relative max-w-10 bg-foreground/10 leading-none before:absolute before:inset-x-0 before:top-full before:h-0.5 before:bg-gray-400/25", { "cursor-not-allowed opacity-50": e.disabled }])
        }, [
          t("input", {
            id: "__PDF__PAGER_INPUT__",
            value: n.value,
            size: g.value,
            class: o(["w-full select-none bg-transparent px-1 text-center leading-none outline-none", { "aria-disabled pointer-events-none": e.disabled }]),
            disabled: e.disabled,
            onChange: f
          }, null, 42, z),
          l[2] || (l[2] = t("div", { class: "absolute left-1/2 top-full h-0.5 w-0 -translate-x-1/2 bg-blue-600 opacity-0 transition-all group-focus-within:w-full group-focus-within:opacity-100" }, null, -1))
        ], 2),
        l[3] || (l[3] = t("span", { class: "leading-none" }, "/", -1)),
        t("span", B, V(e.pages), 1)
      ], 2)
    ]));
  }
});
export {
  N as default
};
//# sourceMappingURL=B4x2hpbc.js.map
