import { defineComponent as N, createBlock as W, openBlock as c, mergeProps as Se, withCtx as ae, renderSlot as Be, computed as S, ref as O, resolveComponent as K, createVNode as q, createTextVNode as Ie, createElementVNode as p, createCommentVNode as Q, toDisplayString as F, h as je, watch as me, createElementBlock as $, withDirectives as ra, withKeys as Ca, vModelText as Aa, Fragment as re, renderList as ve, normalizeStyle as ze, resolveDynamicComponent as Te, normalizeClass as Me, withModifiers as ue, Teleport as Sa, createSlots as ka, onMounted as la, vModelSelect as Da, onBeforeUnmount as Ma } from "vue";
import { VBtn as Ba } from "vuetify/components/VBtn";
import { VBadge as Ta } from "vuetify/components/VBadge";
import { VTextField as He } from "vuetify/components/VTextField";
import { VCard as ia, VCardTitle as sa, VCardText as ua, VCardActions as ca } from "vuetify/components/VCard";
import { VContainer as wa } from "vuetify/components/VGrid";
import { VChip as Pa, VTextarea as Oa, VSelect as Fa } from "vuetify/components";
import { VChip as Va } from "vuetify/components/VChip";
import { VTextarea as Ia } from "vuetify/components/VTextarea";
import { VSelect as qa } from "vuetify/components/VSelect";
const Na = N({
  name: "EliBotao",
  inheritAttrs: !1,
  props: {
    color: {
      type: String,
      default: "primary"
    },
    variant: {
      type: String,
      default: "elevated"
    },
    size: {
      type: String,
      default: "default"
    },
    disabled: {
      type: Boolean,
      default: !1
    },
    loading: {
      type: Boolean,
      default: !1
    }
  }
}), L = (e, a) => {
  const o = e.__vccOpts || e;
  for (const [r, i] of a)
    o[r] = i;
  return o;
};
function La(e, a, o, r, i, f) {
  return c(), W(Ba, Se({
    color: e.color,
    variant: e.variant,
    size: e.size,
    disabled: e.disabled,
    loading: e.loading
  }, e.$attrs, { class: "eli-botao text-none pt-1" }), {
    default: ae(() => [
      Be(e.$slots, "default")
    ]),
    _: 3
  }, 16, ["color", "variant", "size", "disabled", "loading"]);
}
const da = /* @__PURE__ */ L(Na, [["render", La]]), Je = {
  suave: "4px",
  pill: "10px"
}, ja = N({
  name: "EliBadge",
  inheritAttrs: !1,
  props: {
    color: {
      type: String,
      default: "primary"
    },
    location: {
      type: String,
      default: "top right"
    },
    offsetX: {
      type: String,
      default: "0"
    },
    offsetY: {
      type: String,
      default: "0"
    },
    dot: {
      type: Boolean,
      default: !1
    },
    visible: {
      type: Boolean,
      default: !0
    },
    badge: {
      type: [String, Number],
      default: void 0
    },
    /** 🔥 NOVO: controla só o radius */
    radius: {
      type: String,
      default: "suave"
    }
  },
  setup(e) {
    const a = S(() => e.radius in Je ? Je[e.radius] : e.radius), o = S(() => e.dot || e.badge !== void 0 ? e.visible : !1), r = S(() => ({
      "--eli-badge-radius": a.value
    }));
    return { showBadge: o, badgeStyle: r };
  }
});
function za(e, a, o, r, i, f) {
  return e.showBadge ? (c(), W(Ta, Se({
    key: 0,
    color: e.color
  }, e.$attrs, {
    location: e.location,
    "offset-x": e.offsetX,
    "offset-y": e.offsetY,
    dot: e.dot,
    content: e.badge,
    style: e.badgeStyle,
    class: "eli-badge"
  }), {
    default: ae(() => [
      Be(e.$slots, "default", {}, void 0, !0)
    ]),
    _: 3
  }, 16, ["color", "location", "offset-x", "offset-y", "dot", "content", "style"])) : Be(e.$slots, "default", { key: 1 }, void 0, !0);
}
const Ue = /* @__PURE__ */ L(ja, [["render", za], ["__scopeId", "data-v-371c8db4"]]);
function Ha(e) {
  return e.replace(/\D+/g, "");
}
function Ua(e) {
  const a = Ha(e);
  return a.length <= 11 ? a.replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2").slice(0, 14) : a.replace(/^(\d{2})(\d)/, "$1.$2").replace(/^(\d{2})\.(\d{3})(\d)/, "$1.$2.$3").replace(/\.(\d{3})(\d)/, ".$1/$2").replace(/(\d{4})(\d)/, "$1-$2").slice(0, 18);
}
function Ya(e) {
  return e.replace(/\D+/g, "");
}
function Ra(e) {
  const a = Ya(e);
  return a ? a.length <= 10 ? a.replace(/^(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2").slice(0, 14) : a.replace(/^(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").slice(0, 15) : "";
}
function Ja(e) {
  return e.replace(/\D+/g, "");
}
function Wa(e) {
  const a = Ja(e);
  return a ? a.replace(/^(\d{5})(\d)/, "$1-$2").slice(0, 9) : "";
}
const Za = N({
  name: "EliEntradaTexto",
  inheritAttrs: !1,
  props: {
    /** Interface padrão (EliEntrada): value + opcoes. */
    value: {
      type: [String, null],
      default: void 0
    },
    opcoes: {
      type: Object,
      required: !0
    }
  },
  emits: {
    "update:value": (e) => !0,
    /** Compat Vue2 (v-model padrão: value + input) */
    input: (e) => !0,
    change: (e) => !0,
    focus: () => !0,
    blur: () => !0
  },
  setup(e, { attrs: a, emit: o }) {
    const r = S(() => {
      var l;
      return ((l = e.opcoes) == null ? void 0 : l.formato) ?? "texto";
    }), i = S({
      get: () => e.value,
      set: (l) => {
        o("update:value", l), o("input", l), o("change", l);
      }
    }), f = S(() => r.value === "email" ? "email" : r.value === "url" ? "url" : "text"), t = S(() => {
      if (r.value === "telefone") return "tel";
      if (r.value === "cpfCnpj" || r.value === "cep") return "numeric";
    });
    function n(l) {
      switch (r.value) {
        case "telefone":
          return Ra(l);
        case "cpfCnpj":
          return Ua(l);
        case "cep":
          return Wa(l);
        default:
          return l;
      }
    }
    function d(l) {
      const u = l.target, b = n(u.value);
      u.value = b, i.value = b;
    }
    return { attrs: a, emit: o, localValue: i, inputHtmlType: f, inputMode: t, onInput: d };
  }
});
function Xa(e, a, o, r, i, f) {
  var t, n, d, l;
  return c(), W(He, Se({
    modelValue: e.localValue,
    "onUpdate:modelValue": a[0] || (a[0] = (u) => e.localValue = u),
    type: e.inputHtmlType,
    inputmode: e.inputMode,
    label: (t = e.opcoes) == null ? void 0 : t.rotulo,
    placeholder: (n = e.opcoes) == null ? void 0 : n.placeholder,
    counter: (d = e.opcoes) == null ? void 0 : d.limiteCaracteres,
    maxlength: (l = e.opcoes) == null ? void 0 : l.limiteCaracteres
  }, e.attrs, {
    onFocus: a[1] || (a[1] = () => e.emit("focus")),
    onBlur: a[2] || (a[2] = () => e.emit("blur")),
    onInput: e.onInput
  }), null, 16, ["modelValue", "type", "inputmode", "label", "placeholder", "counter", "maxlength", "onInput"]);
}
const Ye = /* @__PURE__ */ L(Za, [["render", Xa]]), Ga = N({
  name: "EliOlaMundo",
  components: {
    EliBotao: da,
    EliBadge: Ue,
    EliEntradaTexto: Ye
  },
  setup() {
    const e = O(""), a = O(""), o = O(""), r = O(""), i = O("");
    return {
      nome: e,
      email: r,
      documento: i,
      telefone: o,
      cep: a
    };
  }
}), Ka = { class: "grid-example" };
function Qa(e, a, o, r, i, f) {
  const t = K("EliBadge"), n = K("EliEntradaTexto"), d = K("EliBotao");
  return c(), W(wa, null, {
    default: ae(() => [
      q(ia, {
        class: "mx-auto",
        max_width: "400"
      }, {
        default: ae(() => [
          q(sa, null, {
            default: ae(() => [
              q(t, {
                badge: "Novo",
                "offset-x": "-15",
                location: "right center"
              }, {
                default: ae(() => [...a[5] || (a[5] = [
                  Ie(" Olá Mundo! ", -1)
                ])]),
                _: 1
              })
            ]),
            _: 1
          }),
          q(ua, null, {
            default: ae(() => [
              a[6] || (a[6] = Ie(" Este é um componente de exemplo integrado com Vuetify. ", -1)),
              p("div", Ka, [
                q(n, {
                  value: e.nome,
                  "onUpdate:value": a[0] || (a[0] = (l) => e.nome = l),
                  opcoes: { rotulo: "Nome", placeholder: "Digite o nome" },
                  density: "compact"
                }, null, 8, ["value"]),
                q(n, {
                  value: e.telefone,
                  "onUpdate:value": a[1] || (a[1] = (l) => e.telefone = l),
                  opcoes: { rotulo: "Telefone", formato: "telefone" }
                }, null, 8, ["value"]),
                q(n, {
                  value: e.cep,
                  "onUpdate:value": a[2] || (a[2] = (l) => e.cep = l),
                  opcoes: { rotulo: "CEP", placeholder: "00000-000", formato: "cep" }
                }, null, 8, ["value"]),
                q(n, {
                  value: e.documento,
                  "onUpdate:value": a[3] || (a[3] = (l) => e.documento = l),
                  opcoes: { rotulo: "CPF / CNPJ", formato: "cpfCnpj" }
                }, null, 8, ["value"]),
                q(n, {
                  value: e.email,
                  "onUpdate:value": a[4] || (a[4] = (l) => e.email = l),
                  opcoes: { rotulo: "Email", placeholder: "email@exemplo.com", formato: "email" }
                }, null, 8, ["value"])
              ])
            ]),
            _: 1
          }),
          q(ca, null, {
            default: ae(() => [
              q(d, {
                color: "primary",
                variant: "elevated",
                block: ""
              }, {
                default: ae(() => [...a[7] || (a[7] = [
                  Ie(" Botão Vuetify ", -1)
                ])]),
                _: 1
              })
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]),
    _: 1
  });
}
const xa = /* @__PURE__ */ L(Ga, [["render", Qa]]), et = N({
  name: "EliCartao",
  components: { EliBadge: Ue },
  inheritAttrs: !1,
  props: {
    /** Título de fallback caso o slot `titulo` não seja usado. */
    titulo: {
      type: String,
      default: ""
    },
    /**
     * Status semântico do cartão.
     * Usado para cor/label e para permitir filtros por status.
     */
    status: {
      type: String,
      required: !0
    },
    /** Variante visual do v-card (Vuetify). */
    variant: {
      type: String,
      default: "outlined"
    }
  },
  emits: {
    /** Emit opcional para padronizar clique no cartão. */
    clicar: (e) => !0
  },
  setup(e, { emit: a }) {
    const o = S(() => e.status), r = S(() => {
      switch (e.status) {
        case "novo":
          return "primary";
        case "rascunho":
          return "secondary";
        case "vendido":
          return "success";
        case "cancelado":
          return "error";
      }
    }), i = S(() => `eli-cartao--${e.status}`);
    function f() {
      a("clicar", e.status);
    }
    return {
      rotuloStatus: o,
      corStatus: r,
      classeStatus: i,
      onClick: f
    };
  }
}), at = { class: "eli-cartao__titulo-texto" }, tt = { class: "eli-cartao__status" };
function ot(e, a, o, r, i, f) {
  const t = K("EliBadge");
  return c(), W(ia, Se({
    class: ["eli-cartao", e.classeStatus],
    variant: e.variant
  }, e.$attrs), {
    default: ae(() => [
      q(sa, { class: "eli-cartao__titulo" }, {
        default: ae(() => [
          p("div", at, [
            Be(e.$slots, "titulo", {}, () => [
              Ie(F(e.titulo), 1)
            ], !0)
          ]),
          p("div", tt, [
            q(t, {
              badge: e.rotuloStatus,
              radius: "pill",
              color: e.corStatus
            }, {
              default: ae(() => [...a[0] || (a[0] = [
                p("span", null, null, -1)
              ])]),
              _: 1
            }, 8, ["badge", "color"])
          ])
        ]),
        _: 3
      }),
      q(ua, { class: "eli-cartao__conteudo" }, {
        default: ae(() => [
          Be(e.$slots, "default", {}, void 0, !0)
        ]),
        _: 3
      }),
      e.$slots.acoes ? (c(), W(ca, {
        key: 0,
        class: "eli-cartao__acoes"
      }, {
        default: ae(() => [
          Be(e.$slots, "acoes", {}, void 0, !0)
        ]),
        _: 3
      })) : Q("", !0)
    ]),
    _: 3
  }, 16, ["variant", "class"]);
}
const nt = /* @__PURE__ */ L(et, [["render", ot], ["__scopeId", "data-v-6c492bd9"]]);
var fa = ((e) => (e[e.sucesso = 200] = "sucesso", e[e.erroConhecido = 400] = "erroConhecido", e[e.erroPermissao = 401] = "erroPermissao", e[e.erroNaoEncontrado = 404] = "erroNaoEncontrado", e[e.erroDesconhecido = 500] = "erroDesconhecido", e[e.tempoEsgotado = 504] = "tempoEsgotado", e))(fa || {});
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const rt = (e) => {
  for (const a in e)
    if (a.startsWith("aria-") || a === "role" || a === "title")
      return !0;
  return !1;
};
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const We = (e) => e === "";
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const lt = (...e) => e.filter((a, o, r) => !!a && a.trim() !== "" && r.indexOf(a) === o).join(" ").trim();
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ze = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const it = (e) => e.replace(
  /^([A-Z])|[\s-_]+(\w)/g,
  (a, o, r) => r ? r.toUpperCase() : o.toLowerCase()
);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const st = (e) => {
  const a = it(e);
  return a.charAt(0).toUpperCase() + a.slice(1);
};
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
var Fe = {
  xmlns: "http://www.w3.org/2000/svg",
  width: 24,
  height: 24,
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": 2,
  "stroke-linecap": "round",
  "stroke-linejoin": "round"
};
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ut = ({
  name: e,
  iconNode: a,
  absoluteStrokeWidth: o,
  "absolute-stroke-width": r,
  strokeWidth: i,
  "stroke-width": f,
  size: t = Fe.width,
  color: n = Fe.stroke,
  ...d
}, { slots: l }) => je(
  "svg",
  {
    ...Fe,
    ...d,
    width: t,
    height: t,
    stroke: n,
    "stroke-width": We(o) || We(r) || o === !0 || r === !0 ? Number(i || f || Fe["stroke-width"]) * 24 / Number(t) : i || f || Fe["stroke-width"],
    class: lt(
      "lucide",
      d.class,
      ...e ? [`lucide-${Ze(st(e))}-icon`, `lucide-${Ze(e)}`] : ["lucide-icon"]
    ),
    ...!l.default && !rt(d) && { "aria-hidden": "true" }
  },
  [...a.map((u) => je(...u)), ...l.default ? [l.default()] : []]
);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const we = (e, a) => (o, { slots: r, attrs: i }) => je(
  ut,
  {
    ...i,
    ...o,
    iconNode: a,
    name: e
  },
  r
);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Xe = we("arrow-down", [
  ["path", { d: "M12 5v14", key: "s699le" }],
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
]);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ge = we("arrow-up", [
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
]);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ke = we("chevron-down", [
  ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
]);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Qe = we("chevron-right", [
  ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
]);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ct = we("ellipsis-vertical", [
  ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
  ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
  ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
]);
/**
 * @license lucide-vue-next v0.563.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const dt = we("search", [
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
]), ft = N({
  name: "EliTabelaCaixaDeBusca",
  components: { Search: dt },
  props: {
    modelo: {
      type: String,
      required: !1,
      default: ""
    }
  },
  emits: {
    buscar(e) {
      return typeof e == "string";
    }
  },
  setup(e, { emit: a }) {
    const o = O(e.modelo ?? "");
    me(
      () => e.modelo,
      (i) => {
        i !== void 0 && i !== o.value && (o.value = i);
      }
    );
    function r() {
      a("buscar", o.value.trim());
    }
    return { texto: o, emitirBusca: r };
  }
}), vt = { class: "eli-tabela__busca" }, pt = { class: "eli-tabela__busca-input-wrapper" };
function mt(e, a, o, r, i, f) {
  const t = K("Search");
  return c(), $("div", vt, [
    p("div", pt, [
      ra(p("input", {
        id: "eli-tabela-busca",
        "onUpdate:modelValue": a[0] || (a[0] = (n) => e.texto = n),
        type: "search",
        class: "eli-tabela__busca-input",
        placeholder: "Digite termos para filtrar",
        onKeyup: a[1] || (a[1] = Ca((...n) => e.emitirBusca && e.emitirBusca(...n), ["enter"]))
      }, null, 544), [
        [Aa, e.texto]
      ]),
      p("button", {
        type: "button",
        class: "eli-tabela__busca-botao",
        "aria-label": "Buscar",
        title: "Buscar",
        onClick: a[2] || (a[2] = (...n) => e.emitirBusca && e.emitirBusca(...n))
      }, [
        q(t, {
          class: "eli-tabela__busca-botao-icone",
          size: 16,
          "stroke-width": 2,
          "aria-hidden": "true"
        })
      ])
    ])
  ]);
}
const bt = /* @__PURE__ */ L(ft, [["render", mt], ["__scopeId", "data-v-341415d1"]]), ht = N({
  name: "EliTabelaCabecalho",
  components: { EliTabelaCaixaDeBusca: bt },
  props: {
    exibirBusca: {
      type: Boolean,
      required: !0
    },
    exibirBotaoColunas: {
      type: Boolean,
      required: !1,
      default: !0
    },
    exibirBotaoFiltroAvancado: {
      type: Boolean,
      required: !1,
      default: !1
    },
    valorBusca: {
      type: String,
      required: !0
    },
    acoesCabecalho: {
      type: Array,
      required: !0
    }
  },
  emits: {
    buscar(e) {
      return typeof e == "string";
    },
    colunas() {
      return !0;
    },
    filtroAvancado() {
      return !0;
    }
  },
  setup(e, { emit: a }) {
    const o = S(() => e.acoesCabecalho.length > 0);
    function r(t) {
      a("buscar", t);
    }
    function i() {
      a("colunas");
    }
    function f() {
      a("filtroAvancado");
    }
    return { temAcoesCabecalho: o, emitBuscar: r, emitColunas: i, emitFiltroAvancado: f };
  }
}), gt = { class: "eli-tabela__cabecalho" }, $t = {
  key: 0,
  class: "eli-tabela__busca-grupo"
}, yt = {
  key: 1,
  class: "eli-tabela__acoes-cabecalho"
}, _t = ["onClick"], Et = { class: "eli-tabela__acoes-cabecalho-rotulo" };
function Ct(e, a, o, r, i, f) {
  const t = K("EliTabelaCaixaDeBusca");
  return c(), $("div", gt, [
    e.exibirBusca ? (c(), $("div", $t, [
      e.exibirBotaoColunas ? (c(), $("button", {
        key: 0,
        type: "button",
        class: "eli-tabela__acoes-cabecalho-botao eli-tabela__acoes-cabecalho-botao--colunas",
        onClick: a[0] || (a[0] = (...n) => e.emitColunas && e.emitColunas(...n))
      }, " Colunas ")) : Q("", !0),
      e.exibirBotaoFiltroAvancado ? (c(), $("button", {
        key: 1,
        type: "button",
        class: "eli-tabela__acoes-cabecalho-botao eli-tabela__acoes-cabecalho-botao--filtro",
        onClick: a[1] || (a[1] = (...n) => e.emitFiltroAvancado && e.emitFiltroAvancado(...n))
      }, " Filtro ")) : Q("", !0),
      q(t, {
        modelo: e.valorBusca,
        onBuscar: e.emitBuscar
      }, null, 8, ["modelo", "onBuscar"])
    ])) : Q("", !0),
    e.temAcoesCabecalho ? (c(), $("div", yt, [
      (c(!0), $(re, null, ve(e.acoesCabecalho, (n, d) => (c(), $("button", {
        key: `${n.rotulo}-${d}`,
        type: "button",
        class: "eli-tabela__acoes-cabecalho-botao",
        style: ze(n.cor ? { backgroundColor: n.cor, color: "#fff" } : void 0),
        onClick: n.acao
      }, [
        n.icone ? (c(), W(Te(n.icone), {
          key: 0,
          class: "eli-tabela__acoes-cabecalho-icone",
          size: 16,
          "stroke-width": 2
        })) : Q("", !0),
        p("span", Et, F(n.rotulo), 1)
      ], 12, _t))), 128))
    ])) : Q("", !0)
  ]);
}
const At = /* @__PURE__ */ L(ht, [["render", Ct], ["__scopeId", "data-v-17166105"]]), St = N({
  name: "EliTabelaEstados",
  props: {
    carregando: {
      type: Boolean,
      required: !0
    },
    erro: {
      type: String,
      required: !0
    },
    mensagemVazio: {
      type: String,
      required: !1,
      default: void 0
    }
  }
}), kt = {
  key: 0,
  class: "eli-tabela eli-tabela--carregando",
  "aria-busy": "true"
}, Dt = {
  key: 1,
  class: "eli-tabela eli-tabela--erro",
  role: "alert"
}, Mt = { class: "eli-tabela__erro-mensagem" }, Bt = {
  key: 2,
  class: "eli-tabela eli-tabela--vazio"
};
function Tt(e, a, o, r, i, f) {
  return e.carregando ? (c(), $("div", kt, " Carregando... ")) : e.erro ? (c(), $("div", Dt, [
    a[0] || (a[0] = p("div", { class: "eli-tabela__erro-titulo" }, "Erro", -1)),
    p("div", Mt, F(e.erro), 1)
  ])) : (c(), $("div", Bt, F(e.mensagemVazio ?? "Nenhum registro encontrado."), 1));
}
const wt = /* @__PURE__ */ L(St, [["render", Tt]]), Pt = N({
  name: "EliTabelaDebug",
  props: {
    isDev: {
      type: Boolean,
      required: !0
    },
    menuAberto: {
      type: Number,
      required: !0
    },
    menuPopupPos: {
      type: Object,
      required: !0
    }
  }
}), Ot = {
  key: 0,
  style: { position: "fixed", left: "8px", bottom: "8px", "z-index": "999999", background: "rgba(185,28,28,0.9)", color: "#fff", padding: "6px 10px", "border-radius": "8px", "font-size": "12px", "max-width": "500px" }
};
function Ft(e, a, o, r, i, f) {
  return e.isDev ? (c(), $("div", Ot, [
    a[0] || (a[0] = p("div", null, [
      p("b", null, "EliTabela debug")
    ], -1)),
    p("div", null, "menuAberto: " + F(e.menuAberto), 1),
    p("div", null, "menuPos: top=" + F(e.menuPopupPos.top) + ", left=" + F(e.menuPopupPos.left), 1),
    Be(e.$slots, "default")
  ])) : Q("", !0);
}
const Vt = /* @__PURE__ */ L(Pt, [["render", Ft]]), It = N({
  name: "EliTabelaHead",
  components: { ArrowUp: Ge, ArrowDown: Xe },
  props: {
    colunas: {
      type: Array,
      required: !0
    },
    temAcoes: {
      type: Boolean,
      required: !0
    },
    temColunasInvisiveis: {
      type: Boolean,
      required: !0
    },
    colunaOrdenacao: {
      type: String,
      required: !0
    },
    direcaoOrdenacao: {
      type: String,
      required: !0
    }
  },
  emits: {
    alternarOrdenacao(e) {
      return typeof e == "string" && e.length > 0;
    }
  },
  setup(e, { emit: a }) {
    function o(i) {
      return (i == null ? void 0 : i.coluna_ordem) !== void 0 && (i == null ? void 0 : i.coluna_ordem) !== null;
    }
    function r(i) {
      a("alternarOrdenacao", i);
    }
    return {
      ArrowUp: Ge,
      ArrowDown: Xe,
      isOrdenavel: o,
      emitAlternarOrdenacao: r
    };
  }
}), qt = { class: "eli-tabela__thead" }, Nt = { class: "eli-tabela__tr eli-tabela__tr--header" }, Lt = {
  key: 0,
  class: "eli-tabela__th eli-tabela__th--expander",
  scope: "col"
}, jt = ["onClick"], zt = { class: "eli-tabela__th-texto" }, Ht = {
  key: 1,
  class: "eli-tabela__th-label"
}, Ut = {
  key: 1,
  class: "eli-tabela__th eli-tabela__th--acoes",
  scope: "col"
};
function Yt(e, a, o, r, i, f) {
  const t = K("ArrowUp");
  return c(), $("thead", qt, [
    p("tr", Nt, [
      e.temColunasInvisiveis ? (c(), $("th", Lt)) : Q("", !0),
      (c(!0), $(re, null, ve(e.colunas, (n, d) => (c(), $("th", {
        key: `th-${d}`,
        class: Me(["eli-tabela__th", [e.isOrdenavel(n) ? "eli-tabela__th--ordenavel" : void 0]]),
        scope: "col"
      }, [
        e.isOrdenavel(n) ? (c(), $("button", {
          key: 0,
          type: "button",
          class: Me(["eli-tabela__th-botao", [
            e.colunaOrdenacao === String(n.coluna_ordem) ? "eli-tabela__th-botao--ativo" : void 0
          ]]),
          onClick: (l) => e.emitAlternarOrdenacao(String(n.coluna_ordem))
        }, [
          p("span", zt, F(n.rotulo), 1),
          e.colunaOrdenacao === String(n.coluna_ordem) ? (c(), W(Te(e.direcaoOrdenacao === "asc" ? e.ArrowUp : e.ArrowDown), {
            key: 0,
            class: "eli-tabela__th-icone",
            size: 16,
            "stroke-width": 2,
            "aria-hidden": "true"
          })) : (c(), W(t, {
            key: 1,
            class: "eli-tabela__th-icone eli-tabela__th-icone--oculto",
            size: 16,
            "stroke-width": 2,
            "aria-hidden": "true"
          }))
        ], 10, jt)) : (c(), $("span", Ht, F(n.rotulo), 1))
      ], 2))), 128)),
      e.temAcoes ? (c(), $("th", Ut, " Ações ")) : Q("", !0)
    ])
  ]);
}
const Rt = /* @__PURE__ */ L(It, [["render", Yt]]), Jt = N({
  name: "EliTabelaCelulaTextoSimples",
  components: {},
  props: {
    dados: {
      type: Object
    }
  },
  data() {
    return {};
  },
  methods: {},
  setup({ dados: e }) {
    return { dados: e };
  }
}), Wt = { key: 1 };
function Zt(e, a, o, r, i, f) {
  var t, n, d;
  return (t = e.dados) != null && t.acao ? (c(), $("button", {
    key: 0,
    type: "button",
    class: "eli-tabela__celula-link",
    onClick: a[0] || (a[0] = ue((l) => e.dados.acao(), ["stop", "prevent"]))
  }, F((n = e.dados) == null ? void 0 : n.texto), 1)) : (c(), $("span", Wt, F((d = e.dados) == null ? void 0 : d.texto), 1));
}
const Xt = /* @__PURE__ */ L(Jt, [["render", Zt], ["__scopeId", "data-v-7a629ffa"]]), Gt = N({
  name: "EliTabelaCelulaTextoTruncado",
  props: {
    dados: {
      type: Object
    }
  },
  setup({ dados: e }) {
    return { dados: e };
  }
}), Kt = ["title"], Qt = ["title"];
function xt(e, a, o, r, i, f) {
  var t, n, d, l, u;
  return (t = e.dados) != null && t.acao ? (c(), $("button", {
    key: 0,
    type: "button",
    class: "eli-tabela__texto-truncado eli-tabela__celula-link",
    title: (n = e.dados) == null ? void 0 : n.texto,
    onClick: a[0] || (a[0] = ue((b) => {
      var k, D;
      return (D = (k = e.dados) == null ? void 0 : k.acao) == null ? void 0 : D.call(k);
    }, ["stop", "prevent"]))
  }, F((d = e.dados) == null ? void 0 : d.texto), 9, Kt)) : (c(), $("span", {
    key: 1,
    class: "eli-tabela__texto-truncado",
    title: (l = e.dados) == null ? void 0 : l.texto
  }, F((u = e.dados) == null ? void 0 : u.texto), 9, Qt));
}
const eo = /* @__PURE__ */ L(Gt, [["render", xt], ["__scopeId", "data-v-20b03658"]]), ao = N({
  name: "EliTabelaCelulaNumero",
  components: {},
  props: {
    dados: {
      type: Object
    }
  },
  setup({ dados: e }) {
    const a = S(() => {
      var n, d;
      const o = String(e == null ? void 0 : e.numero).replace(".", ","), r = (n = e == null ? void 0 : e.prefixo) == null ? void 0 : n.trim(), i = (d = e == null ? void 0 : e.sufixo) == null ? void 0 : d.trim(), f = r ? `${r} ` : "", t = i ? ` ${i}` : "";
      return `${f}${o}${t}`;
    });
    return { dados: e, textoNumero: a };
  }
}), to = { key: 1 };
function oo(e, a, o, r, i, f) {
  var t;
  return (t = e.dados) != null && t.acao ? (c(), $("button", {
    key: 0,
    type: "button",
    class: "eli-tabela__celula-link",
    onClick: a[0] || (a[0] = ue((n) => e.dados.acao(), ["stop", "prevent"]))
  }, F(e.textoNumero), 1)) : (c(), $("span", to, F(e.textoNumero), 1));
}
const no = /* @__PURE__ */ L(ao, [["render", oo], ["__scopeId", "data-v-69c890c4"]]), ro = N({
  name: "EliTabelaCelulaTags",
  components: { VChip: Pa },
  props: {
    dados: {
      type: Object,
      required: !1
    }
  },
  setup({ dados: e }) {
    return { dados: e };
  }
}), lo = { class: "eli-tabela__celula-tags" };
function io(e, a, o, r, i, f) {
  var t;
  return c(), $("div", lo, [
    (c(!0), $(re, null, ve(((t = e.dados) == null ? void 0 : t.opcoes) ?? [], (n, d) => (c(), W(Va, {
      key: d,
      class: "eli-tabela__celula-tag",
      size: "small",
      variant: "tonal",
      color: n.cor,
      clickable: !!n.acao,
      onClick: ue((l) => {
        var u;
        return (u = n.acao) == null ? void 0 : u.call(n);
      }, ["stop", "prevent"])
    }, {
      default: ae(() => [
        n.icone ? (c(), W(Te(n.icone), {
          key: 0,
          class: "eli-tabela__celula-tag-icone",
          size: 14
        })) : Q("", !0),
        p("span", null, F(n.rotulo), 1)
      ]),
      _: 2
    }, 1032, ["color", "clickable", "onClick"]))), 128))
  ]);
}
const so = /* @__PURE__ */ L(ro, [["render", io], ["__scopeId", "data-v-a9c83dbe"]]);
function va(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var qe = { exports: {} }, uo = qe.exports, xe;
function co() {
  return xe || (xe = 1, (function(e, a) {
    (function(o, r) {
      e.exports = r();
    })(uo, (function() {
      var o = 1e3, r = 6e4, i = 36e5, f = "millisecond", t = "second", n = "minute", d = "hour", l = "day", u = "week", b = "month", k = "quarter", D = "year", y = "date", s = "Invalid Date", _ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, g = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, E = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(M) {
        var h = ["th", "st", "nd", "rd"], v = M % 100;
        return "[" + M + (h[(v - 20) % 10] || h[v] || h[0]) + "]";
      } }, Z = function(M, h, v) {
        var C = String(M);
        return !C || C.length >= h ? M : "" + Array(h + 1 - C.length).join(v) + M;
      }, oe = { s: Z, z: function(M) {
        var h = -M.utcOffset(), v = Math.abs(h), C = Math.floor(v / 60), m = v % 60;
        return (h <= 0 ? "+" : "-") + Z(C, 2, "0") + ":" + Z(m, 2, "0");
      }, m: function M(h, v) {
        if (h.date() < v.date()) return -M(v, h);
        var C = 12 * (v.year() - h.year()) + (v.month() - h.month()), m = h.clone().add(C, b), T = v - m < 0, B = h.clone().add(C + (T ? -1 : 1), b);
        return +(-(C + (v - m) / (T ? m - B : B - m)) || 0);
      }, a: function(M) {
        return M < 0 ? Math.ceil(M) || 0 : Math.floor(M);
      }, p: function(M) {
        return { M: b, y: D, w: u, d: l, D: y, h: d, m: n, s: t, ms: f, Q: k }[M] || String(M || "").toLowerCase().replace(/s$/, "");
      }, u: function(M) {
        return M === void 0;
      } }, Y = "en", X = {};
      X[Y] = E;
      var le = "$isDayjsObject", j = function(M) {
        return M instanceof ke || !(!M || !M[le]);
      }, be = function M(h, v, C) {
        var m;
        if (!h) return Y;
        if (typeof h == "string") {
          var T = h.toLowerCase();
          X[T] && (m = T), v && (X[T] = v, m = T);
          var B = h.split("-");
          if (!m && B.length > 1) return M(B[0]);
        } else {
          var I = h.name;
          X[I] = h, m = I;
        }
        return !C && m && (Y = m), m || !C && Y;
      }, V = function(M, h) {
        if (j(M)) return M.clone();
        var v = typeof h == "object" ? h : {};
        return v.date = M, v.args = arguments, new ke(v);
      }, w = oe;
      w.l = be, w.i = j, w.w = function(M, h) {
        return V(M, { locale: h.$L, utc: h.$u, x: h.$x, $offset: h.$offset });
      };
      var ke = (function() {
        function M(v) {
          this.$L = be(v.locale, null, !0), this.parse(v), this.$x = this.$x || v.x || {}, this[le] = !0;
        }
        var h = M.prototype;
        return h.parse = function(v) {
          this.$d = (function(C) {
            var m = C.date, T = C.utc;
            if (m === null) return /* @__PURE__ */ new Date(NaN);
            if (w.u(m)) return /* @__PURE__ */ new Date();
            if (m instanceof Date) return new Date(m);
            if (typeof m == "string" && !/Z$/i.test(m)) {
              var B = m.match(_);
              if (B) {
                var I = B[2] - 1 || 0, R = (B[7] || "0").substring(0, 3);
                return T ? new Date(Date.UTC(B[1], I, B[3] || 1, B[4] || 0, B[5] || 0, B[6] || 0, R)) : new Date(B[1], I, B[3] || 1, B[4] || 0, B[5] || 0, B[6] || 0, R);
              }
            }
            return new Date(m);
          })(v), this.init();
        }, h.init = function() {
          var v = this.$d;
          this.$y = v.getFullYear(), this.$M = v.getMonth(), this.$D = v.getDate(), this.$W = v.getDay(), this.$H = v.getHours(), this.$m = v.getMinutes(), this.$s = v.getSeconds(), this.$ms = v.getMilliseconds();
        }, h.$utils = function() {
          return w;
        }, h.isValid = function() {
          return this.$d.toString() !== s;
        }, h.isSame = function(v, C) {
          var m = V(v);
          return this.startOf(C) <= m && m <= this.endOf(C);
        }, h.isAfter = function(v, C) {
          return V(v) < this.startOf(C);
        }, h.isBefore = function(v, C) {
          return this.endOf(C) < V(v);
        }, h.$g = function(v, C, m) {
          return w.u(v) ? this[C] : this.set(m, v);
        }, h.unix = function() {
          return Math.floor(this.valueOf() / 1e3);
        }, h.valueOf = function() {
          return this.$d.getTime();
        }, h.startOf = function(v, C) {
          var m = this, T = !!w.u(C) || C, B = w.p(v), I = function(_e, te) {
            var ge = w.w(m.$u ? Date.UTC(m.$y, te, _e) : new Date(m.$y, te, _e), m);
            return T ? ge : ge.endOf(l);
          }, R = function(_e, te) {
            return w.w(m.toDate()[_e].apply(m.toDate("s"), (T ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(te)), m);
          }, G = this.$W, x = this.$M, ie = this.$D, de = "set" + (this.$u ? "UTC" : "");
          switch (B) {
            case D:
              return T ? I(1, 0) : I(31, 11);
            case b:
              return T ? I(1, x) : I(0, x + 1);
            case u:
              var he = this.$locale().weekStart || 0, Ee = (G < he ? G + 7 : G) - he;
              return I(T ? ie - Ee : ie + (6 - Ee), x);
            case l:
            case y:
              return R(de + "Hours", 0);
            case d:
              return R(de + "Minutes", 1);
            case n:
              return R(de + "Seconds", 2);
            case t:
              return R(de + "Milliseconds", 3);
            default:
              return this.clone();
          }
        }, h.endOf = function(v) {
          return this.startOf(v, !1);
        }, h.$set = function(v, C) {
          var m, T = w.p(v), B = "set" + (this.$u ? "UTC" : ""), I = (m = {}, m[l] = B + "Date", m[y] = B + "Date", m[b] = B + "Month", m[D] = B + "FullYear", m[d] = B + "Hours", m[n] = B + "Minutes", m[t] = B + "Seconds", m[f] = B + "Milliseconds", m)[T], R = T === l ? this.$D + (C - this.$W) : C;
          if (T === b || T === D) {
            var G = this.clone().set(y, 1);
            G.$d[I](R), G.init(), this.$d = G.set(y, Math.min(this.$D, G.daysInMonth())).$d;
          } else I && this.$d[I](R);
          return this.init(), this;
        }, h.set = function(v, C) {
          return this.clone().$set(v, C);
        }, h.get = function(v) {
          return this[w.p(v)]();
        }, h.add = function(v, C) {
          var m, T = this;
          v = Number(v);
          var B = w.p(C), I = function(x) {
            var ie = V(T);
            return w.w(ie.date(ie.date() + Math.round(x * v)), T);
          };
          if (B === b) return this.set(b, this.$M + v);
          if (B === D) return this.set(D, this.$y + v);
          if (B === l) return I(1);
          if (B === u) return I(7);
          var R = (m = {}, m[n] = r, m[d] = i, m[t] = o, m)[B] || 1, G = this.$d.getTime() + v * R;
          return w.w(G, this);
        }, h.subtract = function(v, C) {
          return this.add(-1 * v, C);
        }, h.format = function(v) {
          var C = this, m = this.$locale();
          if (!this.isValid()) return m.invalidDate || s;
          var T = v || "YYYY-MM-DDTHH:mm:ssZ", B = w.z(this), I = this.$H, R = this.$m, G = this.$M, x = m.weekdays, ie = m.months, de = m.meridiem, he = function(te, ge, Ce, De) {
            return te && (te[ge] || te(C, T)) || Ce[ge].slice(0, De);
          }, Ee = function(te) {
            return w.s(I % 12 || 12, te, "0");
          }, _e = de || function(te, ge, Ce) {
            var De = te < 12 ? "AM" : "PM";
            return Ce ? De.toLowerCase() : De;
          };
          return T.replace(g, (function(te, ge) {
            return ge || (function(Ce) {
              switch (Ce) {
                case "YY":
                  return String(C.$y).slice(-2);
                case "YYYY":
                  return w.s(C.$y, 4, "0");
                case "M":
                  return G + 1;
                case "MM":
                  return w.s(G + 1, 2, "0");
                case "MMM":
                  return he(m.monthsShort, G, ie, 3);
                case "MMMM":
                  return he(ie, G);
                case "D":
                  return C.$D;
                case "DD":
                  return w.s(C.$D, 2, "0");
                case "d":
                  return String(C.$W);
                case "dd":
                  return he(m.weekdaysMin, C.$W, x, 2);
                case "ddd":
                  return he(m.weekdaysShort, C.$W, x, 3);
                case "dddd":
                  return x[C.$W];
                case "H":
                  return String(I);
                case "HH":
                  return w.s(I, 2, "0");
                case "h":
                  return Ee(1);
                case "hh":
                  return Ee(2);
                case "a":
                  return _e(I, R, !0);
                case "A":
                  return _e(I, R, !1);
                case "m":
                  return String(R);
                case "mm":
                  return w.s(R, 2, "0");
                case "s":
                  return String(C.$s);
                case "ss":
                  return w.s(C.$s, 2, "0");
                case "SSS":
                  return w.s(C.$ms, 3, "0");
                case "Z":
                  return B;
              }
              return null;
            })(te) || B.replace(":", "");
          }));
        }, h.utcOffset = function() {
          return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
        }, h.diff = function(v, C, m) {
          var T, B = this, I = w.p(C), R = V(v), G = (R.utcOffset() - this.utcOffset()) * r, x = this - R, ie = function() {
            return w.m(B, R);
          };
          switch (I) {
            case D:
              T = ie() / 12;
              break;
            case b:
              T = ie();
              break;
            case k:
              T = ie() / 3;
              break;
            case u:
              T = (x - G) / 6048e5;
              break;
            case l:
              T = (x - G) / 864e5;
              break;
            case d:
              T = x / i;
              break;
            case n:
              T = x / r;
              break;
            case t:
              T = x / o;
              break;
            default:
              T = x;
          }
          return m ? T : w.a(T);
        }, h.daysInMonth = function() {
          return this.endOf(b).$D;
        }, h.$locale = function() {
          return X[this.$L];
        }, h.locale = function(v, C) {
          if (!v) return this.$L;
          var m = this.clone(), T = be(v, C, !0);
          return T && (m.$L = T), m;
        }, h.clone = function() {
          return w.w(this.$d, this);
        }, h.toDate = function() {
          return new Date(this.valueOf());
        }, h.toJSON = function() {
          return this.isValid() ? this.toISOString() : null;
        }, h.toISOString = function() {
          return this.$d.toISOString();
        }, h.toString = function() {
          return this.$d.toUTCString();
        }, M;
      })(), Pe = ke.prototype;
      return V.prototype = Pe, [["$ms", f], ["$s", t], ["$m", n], ["$H", d], ["$W", l], ["$M", b], ["$y", D], ["$D", y]].forEach((function(M) {
        Pe[M[1]] = function(h) {
          return this.$g(h, M[0], M[1]);
        };
      })), V.extend = function(M, h) {
        return M.$i || (M(h, ke, V), M.$i = !0), V;
      }, V.locale = be, V.isDayjs = j, V.unix = function(M) {
        return V(1e3 * M);
      }, V.en = X[Y], V.Ls = X, V.p = {}, V;
    }));
  })(qe)), qe.exports;
}
var fo = co();
const Ae = /* @__PURE__ */ va(fo);
var Ne = { exports: {} }, vo = Ne.exports, ea;
function po() {
  return ea || (ea = 1, (function(e, a) {
    (function(o, r) {
      e.exports = r();
    })(vo, (function() {
      return function(o, r, i) {
        o = o || {};
        var f = r.prototype, t = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
        function n(l, u, b, k) {
          return f.fromToBase(l, u, b, k);
        }
        i.en.relativeTime = t, f.fromToBase = function(l, u, b, k, D) {
          for (var y, s, _, g = b.$locale().relativeTime || t, E = o.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], Z = E.length, oe = 0; oe < Z; oe += 1) {
            var Y = E[oe];
            Y.d && (y = k ? i(l).diff(b, Y.d, !0) : b.diff(l, Y.d, !0));
            var X = (o.rounding || Math.round)(Math.abs(y));
            if (_ = y > 0, X <= Y.r || !Y.r) {
              X <= 1 && oe > 0 && (Y = E[oe - 1]);
              var le = g[Y.l];
              D && (X = D("" + X)), s = typeof le == "string" ? le.replace("%d", X) : le(X, u, Y.l, _);
              break;
            }
          }
          if (u) return s;
          var j = _ ? g.future : g.past;
          return typeof j == "function" ? j(s) : j.replace("%s", s);
        }, f.to = function(l, u) {
          return n(l, u, this, !0);
        }, f.from = function(l, u) {
          return n(l, u, this);
        };
        var d = function(l) {
          return l.$u ? i.utc() : i();
        };
        f.toNow = function(l) {
          return this.to(d(this), l);
        }, f.fromNow = function(l) {
          return this.from(d(this), l);
        };
      };
    }));
  })(Ne)), Ne.exports;
}
var mo = po();
const bo = /* @__PURE__ */ va(mo);
Ae.extend(bo);
const ho = N({
  name: "EliTabelaCelulaData",
  props: {
    dados: {
      type: Object,
      required: !1
    }
  },
  setup({ dados: e }) {
    const a = S(() => {
      const o = e == null ? void 0 : e.valor;
      if (!o) return "";
      const r = (e == null ? void 0 : e.formato) ?? "data";
      return r === "relativo" ? Ae(o).fromNow() : r === "data_hora" ? Ae(o).format("DD/MM/YYYY HH:mm") : Ae(o).format("DD/MM/YYYY");
    });
    return { dados: e, textoData: a };
  }
}), go = { key: 1 };
function $o(e, a, o, r, i, f) {
  var t;
  return (t = e.dados) != null && t.acao ? (c(), $("button", {
    key: 0,
    type: "button",
    class: "eli-tabela__celula-link",
    onClick: a[0] || (a[0] = ue((n) => e.dados.acao(), ["stop", "prevent"]))
  }, F(e.textoData), 1)) : (c(), $("span", go, F(e.textoData), 1));
}
const yo = /* @__PURE__ */ L(ho, [["render", $o], ["__scopeId", "data-v-2b88bbb2"]]), _o = {
  textoSimples: Xt,
  textoTruncado: eo,
  numero: no,
  tags: so,
  data: yo
}, Eo = N({
  name: "EliTabelaCelula",
  props: {
    celula: {
      // `ComponenteCelula` é uma tupla `readonly [tipo, dados]`.
      type: Array,
      required: !0
    }
  },
  setup(e) {
    const a = S(() => e.celula[0]), o = S(() => e.celula[1]), r = S(() => _o[a.value]), i = S(() => o.value);
    return { Componente: r, dadosParaComponente: i };
  }
});
function Co(e, a, o, r, i, f) {
  return c(), W(Te(e.Componente), { dados: e.dadosParaComponente }, null, 8, ["dados"]);
}
const pa = /* @__PURE__ */ L(Eo, [["render", Co]]), Ao = N({
  name: "EliTabelaDetalhesLinha",
  components: { EliTabelaCelula: pa },
  props: {
    linha: {
      type: null,
      required: !0
    },
    colunasInvisiveis: {
      type: Array,
      required: !0
    }
  }
}), So = { class: "eli-tabela__detalhes" }, ko = { class: "eli-tabela__detalhe-rotulo" }, Do = { class: "eli-tabela__detalhe-valor" };
function Mo(e, a, o, r, i, f) {
  const t = K("EliTabelaCelula");
  return c(), $("div", So, [
    (c(!0), $(re, null, ve(e.colunasInvisiveis, (n, d) => (c(), $("div", {
      key: `det-${d}-${n.rotulo}`,
      class: "eli-tabela__detalhe"
    }, [
      p("div", ko, F(n.rotulo), 1),
      p("div", Do, [
        q(t, {
          celula: n.celula(e.linha)
        }, null, 8, ["celula"])
      ])
    ]))), 128))
  ]);
}
const Bo = /* @__PURE__ */ L(Ao, [["render", Mo], ["__scopeId", "data-v-f1ee8d20"]]), To = N({
  name: "EliTabelaBody",
  components: {
    EliTabelaCelula: pa,
    EliTabelaDetalhesLinha: Bo,
    MoreVertical: ct,
    ChevronRight: Qe,
    ChevronDown: Ke
  },
  props: {
    colunas: {
      type: Array,
      required: !0
    },
    colunasInvisiveis: {
      type: Array,
      required: !0
    },
    temColunasInvisiveis: {
      type: Boolean,
      required: !0
    },
    linhasExpandidas: {
      type: Object,
      required: !0
    },
    linhas: {
      type: Array,
      required: !0
    },
    temAcoes: {
      type: Boolean,
      required: !0
    },
    menuAberto: {
      type: Number,
      required: !0
    },
    possuiAcoes: {
      type: Function,
      required: !0
    },
    toggleMenu: {
      type: Function,
      required: !0
    },
    alternarLinhaExpandida: {
      type: Function,
      required: !0
    }
  },
  setup() {
    return {
      ChevronRight: Qe,
      ChevronDown: Ke
    };
  }
}), wo = { class: "eli-tabela__tbody" }, Po = ["aria-expanded", "aria-label", "title", "onClick"], Oo = ["id", "disabled", "aria-expanded", "aria-controls", "aria-label", "title", "onClick"], Fo = ["colspan"];
function Vo(e, a, o, r, i, f) {
  const t = K("EliTabelaCelula"), n = K("MoreVertical"), d = K("EliTabelaDetalhesLinha");
  return c(), $("tbody", wo, [
    (c(!0), $(re, null, ve(e.linhas, (l, u) => {
      var b, k, D, y, s, _;
      return c(), $(re, {
        key: `grp-${u}`
      }, [
        p("tr", {
          class: Me(["eli-tabela__tr", [u % 2 === 1 ? "eli-tabela__tr--zebra" : void 0]])
        }, [
          e.temColunasInvisiveis ? (c(), $("td", {
            class: "eli-tabela__td eli-tabela__td--expander",
            key: `td-${u}-exp`
          }, [
            p("button", {
              type: "button",
              class: Me(["eli-tabela__expander-botao", [(b = e.linhasExpandidas) != null && b[u] ? "eli-tabela__expander-botao--ativo" : void 0]]),
              "aria-expanded": (k = e.linhasExpandidas) != null && k[u] ? "true" : "false",
              "aria-label": (D = e.linhasExpandidas) != null && D[u] ? "Ocultar colunas ocultas" : "Mostrar colunas ocultas",
              title: (y = e.linhasExpandidas) != null && y[u] ? "Ocultar detalhes" : "Mostrar detalhes",
              onClick: ue((g) => e.alternarLinhaExpandida(u), ["stop"])
            }, [
              (c(), W(Te((s = e.linhasExpandidas) != null && s[u] ? e.ChevronDown : e.ChevronRight), {
                class: "eli-tabela__expander-icone",
                size: 16,
                "stroke-width": 2,
                "aria-hidden": "true"
              }))
            ], 10, Po)
          ])) : Q("", !0),
          (c(!0), $(re, null, ve(e.colunas, (g, E) => (c(), $("td", {
            key: `td-${u}-${E}`,
            class: "eli-tabela__td"
          }, [
            q(t, {
              celula: g.celula(l)
            }, null, 8, ["celula"])
          ]))), 128)),
          e.temAcoes ? (c(), $("td", {
            class: "eli-tabela__td eli-tabela__td--acoes",
            key: `td-${u}-acoes`
          }, [
            p("div", {
              class: Me(["eli-tabela__acoes-container", [e.menuAberto === u ? "eli-tabela__acoes-container--aberto" : void 0]])
            }, [
              p("button", {
                class: "eli-tabela__acoes-toggle",
                type: "button",
                id: `eli-tabela-acoes-toggle-${u}`,
                disabled: !e.possuiAcoes(u),
                "aria-haspopup": "menu",
                "aria-expanded": e.menuAberto === u ? "true" : "false",
                "aria-controls": e.possuiAcoes(u) ? `eli-tabela-acoes-menu-${u}` : void 0,
                "aria-label": e.possuiAcoes(u) ? "Ações da linha" : "Nenhuma ação disponível",
                title: e.possuiAcoes(u) ? "Ações" : "Nenhuma ação disponível",
                onClick: ue((g) => e.toggleMenu(u, g), ["stop"])
              }, [
                q(n, {
                  class: "eli-tabela__acoes-toggle-icone",
                  size: 18,
                  "stroke-width": 2
                })
              ], 8, Oo)
            ], 2)
          ])) : Q("", !0)
        ], 2),
        e.temColunasInvisiveis && ((_ = e.linhasExpandidas) != null && _[u]) ? (c(), $("tr", {
          key: 0,
          class: Me(["eli-tabela__tr eli-tabela__tr--detalhes", [u % 2 === 1 ? "eli-tabela__tr--zebra" : void 0]])
        }, [
          p("td", {
            class: "eli-tabela__td eli-tabela__td--detalhes",
            colspan: (e.temColunasInvisiveis ? 1 : 0) + e.colunas.length + (e.temAcoes ? 1 : 0)
          }, [
            q(d, {
              linha: l,
              colunasInvisiveis: e.colunasInvisiveis
            }, null, 8, ["linha", "colunasInvisiveis"])
          ], 8, Fo)
        ], 2)) : Q("", !0)
      ], 64);
    }), 128))
  ]);
}
const Io = /* @__PURE__ */ L(To, [["render", Vo]]), qo = N({
  name: "EliTabelaMenuAcoes",
  props: {
    menuAberto: {
      type: Number,
      required: !0
    },
    posicao: {
      type: Object,
      required: !0
    },
    acoes: {
      type: Array,
      required: !0
    },
    linha: {
      // Aceita qualquer tipo de linha (objeto, string, etc.) sem validação runtime.
      type: null,
      required: !0
    }
  },
  emits: {
    executar(e) {
      return e !== null && typeof e == "object";
    }
  },
  setup(e, { emit: a, expose: o }) {
    const r = O(null);
    o({ menuEl: r });
    const i = S(() => e.acoes.length > 0);
    function f(t) {
      e.linha && a("executar", { acao: t.acao, linha: e.linha });
    }
    return { menuEl: r, possuiAcoes: i, emitExecutar: f };
  }
}), No = ["id", "aria-labelledby"], Lo = ["aria-label", "title", "onClick"], jo = { class: "eli-tabela__acoes-item-texto" };
function zo(e, a, o, r, i, f) {
  return c(), W(Sa, { to: "body" }, [
    e.menuAberto !== null && e.possuiAcoes ? (c(), $("ul", {
      key: 0,
      id: `eli-tabela-acoes-menu-${e.menuAberto}`,
      ref: "menuEl",
      class: "eli-tabela__acoes-menu",
      role: "menu",
      "aria-labelledby": `eli-tabela-acoes-toggle-${e.menuAberto}`,
      style: ze({
        position: "fixed",
        top: `${e.posicao.top}px`,
        left: `${e.posicao.left}px`,
        zIndex: 999999
      })
    }, [
      (c(!0), $(re, null, ve(e.acoes, (t) => (c(), $("li", {
        key: `acao-${e.menuAberto}-${t.indice}`,
        class: "eli-tabela__acoes-item",
        role: "none"
      }, [
        p("button", {
          type: "button",
          class: "eli-tabela__acoes-item-botao",
          style: ze({ color: t.acao.cor }),
          role: "menuitem",
          "aria-label": t.acao.rotulo,
          title: t.acao.rotulo,
          onClick: ue((n) => e.emitExecutar(t), ["stop"])
        }, [
          (c(), W(Te(t.acao.icone), {
            class: "eli-tabela__acoes-item-icone",
            size: 16,
            "stroke-width": 2
          })),
          p("span", jo, F(t.acao.rotulo), 1)
        ], 12, Lo)
      ]))), 128))
    ], 12, No)) : Q("", !0)
  ]);
}
const Ho = /* @__PURE__ */ L(qo, [["render", zo]]), Uo = N({
  name: "EliTabelaPaginacao",
  props: {
    pagina: {
      type: Number,
      required: !0
    },
    totalPaginas: {
      type: Number,
      required: !0
    },
    maximoBotoes: {
      type: Number,
      required: !1
    }
  },
  emits: {
    alterar(e) {
      return Number.isFinite(e);
    }
  },
  setup(e, { emit: a }) {
    const o = S(() => {
      const l = e.maximoBotoes;
      return typeof l == "number" && l >= 5 ? Math.floor(l) : 7;
    }), r = S(() => {
      const l = e.totalPaginas, u = e.pagina, b = o.value, k = [], D = (E) => {
        k.push({
          label: String(E),
          pagina: E,
          ativo: E === u
        });
      }, y = () => {
        k.push({ label: "…", ehEllipsis: !0 });
      };
      if (l <= b) {
        for (let E = 1; E <= l; E += 1)
          D(E);
        return k;
      }
      const s = Math.max(3, b - 2);
      let _ = Math.max(2, u - Math.floor(s / 2)), g = _ + s - 1;
      g >= l && (g = l - 1, _ = g - s + 1), D(1), _ > 2 && y();
      for (let E = _; E <= g; E += 1)
        D(E);
      return g < l - 1 && y(), D(l), k;
    });
    function i(l) {
      if (!l)
        return;
      const u = Math.min(Math.max(1, l), e.totalPaginas);
      u !== e.pagina && a("alterar", u);
    }
    const f = S(() => e.pagina <= 1), t = S(() => e.pagina >= e.totalPaginas), n = S(() => e.pagina), d = S(() => e.totalPaginas);
    return {
      botoes: r,
      irParaPagina: i,
      anteriorDesabilitado: f,
      proximaDesabilitada: t,
      paginaAtual: n,
      totalPaginasExibidas: d
    };
  }
}), Yo = {
  key: 0,
  class: "eli-tabela__paginacao",
  role: "navigation",
  "aria-label": "Paginação de resultados"
}, Ro = ["disabled"], Jo = {
  key: 0,
  class: "eli-tabela__pagina-ellipsis",
  "aria-hidden": "true"
}, Wo = ["disabled", "aria-current", "aria-label", "onClick"], Zo = ["disabled"];
function Xo(e, a, o, r, i, f) {
  return e.totalPaginasExibidas > 1 ? (c(), $("nav", Yo, [
    p("button", {
      type: "button",
      class: "eli-tabela__pagina-botao",
      disabled: e.anteriorDesabilitado,
      "aria-label": "Página anterior",
      onClick: a[0] || (a[0] = (t) => e.irParaPagina(e.paginaAtual - 1))
    }, " << ", 8, Ro),
    (c(!0), $(re, null, ve(e.botoes, (t, n) => (c(), $(re, {
      key: `${t.label}-${n}`
    }, [
      t.ehEllipsis ? (c(), $("span", Jo, F(t.label), 1)) : (c(), $("button", {
        key: 1,
        type: "button",
        class: Me(["eli-tabela__pagina-botao", t.ativo ? "eli-tabela__pagina-botao--ativo" : void 0]),
        disabled: t.ativo,
        "aria-current": t.ativo ? "page" : void 0,
        "aria-label": `Ir para página ${t.label}`,
        onClick: (d) => e.irParaPagina(t.pagina)
      }, F(t.label), 11, Wo))
    ], 64))), 128)),
    p("button", {
      type: "button",
      class: "eli-tabela__pagina-botao",
      disabled: e.proximaDesabilitada,
      "aria-label": "Próxima página",
      onClick: a[1] || (a[1] = (t) => e.irParaPagina(e.paginaAtual + 1))
    }, " >> ", 8, Zo)
  ])) : Q("", !0);
}
const Go = /* @__PURE__ */ L(Uo, [["render", Xo], ["__scopeId", "data-v-5ca7a362"]]), aa = "application/x-eli-tabela-coluna", Ko = N({
  name: "EliTabelaModalColunas",
  props: {
    aberto: {
      type: Boolean,
      required: !0
    },
    rotulosColunas: {
      type: Array,
      required: !0
    },
    configInicial: {
      type: Object,
      required: !0
    },
    colunas: {
      type: Array,
      required: !0
    }
  },
  emits: {
    fechar() {
      return !0;
    },
    salvar(e) {
      return !0;
    }
  },
  setup(e, { emit: a }) {
    const o = O([]), r = O([]);
    function i() {
      var X, le;
      const y = e.rotulosColunas, s = (((X = e.configInicial.visiveis) == null ? void 0 : X.length) ?? 0) > 0 || (((le = e.configInicial.invisiveis) == null ? void 0 : le.length) ?? 0) > 0, _ = new Set(
        e.colunas.filter((j) => j.visivel === !1).map((j) => j.rotulo)
      ), g = s ? new Set(e.configInicial.invisiveis ?? []) : _, E = y.filter((j) => !g.has(j)), Z = e.configInicial.visiveis ?? [], oe = new Set(E), Y = [];
      for (const j of Z)
        oe.has(j) && Y.push(j);
      for (const j of E)
        Y.includes(j) || Y.push(j);
      o.value = Y, r.value = y.filter((j) => g.has(j));
    }
    me(
      () => [e.aberto, e.rotulosColunas, e.configInicial, e.colunas],
      () => {
        e.aberto && i();
      },
      { deep: !0, immediate: !0 }
    );
    function f() {
      a("fechar");
    }
    function t() {
      a("salvar", {
        visiveis: [...o.value],
        invisiveis: [...r.value]
      });
    }
    function n(y, s) {
      var _, g;
      try {
        (_ = y.dataTransfer) == null || _.setData(aa, JSON.stringify(s)), (g = y.dataTransfer) == null || g.setData("text/plain", s.rotulo), y.dataTransfer.effectAllowed = "move";
      } catch {
      }
    }
    function d(y) {
      var s;
      try {
        const _ = (s = y.dataTransfer) == null ? void 0 : s.getData(aa);
        if (!_) return null;
        const g = JSON.parse(_);
        return !g || typeof g.rotulo != "string" || g.origem !== "visiveis" && g.origem !== "invisiveis" ? null : g;
      } catch {
        return null;
      }
    }
    function l(y) {
      const s = y.origem === "visiveis" ? o.value : r.value, _ = s.indexOf(y.rotulo);
      _ >= 0 && s.splice(_, 1);
    }
    function u(y, s, _) {
      const g = y === "visiveis" ? o.value : r.value, E = g.indexOf(s);
      E >= 0 && g.splice(E, 1), _ === null || _ < 0 || _ > g.length ? g.push(s) : g.splice(_, 0, s);
    }
    function b(y, s, _, g) {
      n(y, { rotulo: s, origem: _, index: g });
    }
    function k(y, s, _) {
      const g = d(y);
      if (g)
        if (l(g), u(s, g.rotulo, _), s === "visiveis") {
          const E = r.value.indexOf(g.rotulo);
          E >= 0 && r.value.splice(E, 1);
        } else {
          const E = o.value.indexOf(g.rotulo);
          E >= 0 && o.value.splice(E, 1);
        }
    }
    function D(y, s, _) {
      const g = d(y);
      if (g)
        if (l(g), u(s, g.rotulo, null), s === "visiveis") {
          const E = r.value.indexOf(g.rotulo);
          E >= 0 && r.value.splice(E, 1);
        } else {
          const E = o.value.indexOf(g.rotulo);
          E >= 0 && o.value.splice(E, 1);
        }
    }
    return {
      visiveisLocal: o,
      invisiveisLocal: r,
      emitFechar: f,
      emitSalvar: t,
      onDragStart: b,
      onDropItem: k,
      onDropLista: D
    };
  }
}), Qo = {
  class: "eli-tabela-modal-colunas__modal",
  role: "dialog",
  "aria-modal": "true",
  "aria-label": "Configurar colunas"
}, xo = { class: "eli-tabela-modal-colunas__header" }, en = { class: "eli-tabela-modal-colunas__conteudo" }, an = { class: "eli-tabela-modal-colunas__coluna" }, tn = ["onDragstart", "onDrop"], on = { class: "eli-tabela-modal-colunas__item-texto" }, nn = { class: "eli-tabela-modal-colunas__coluna" }, rn = ["onDragstart", "onDrop"], ln = { class: "eli-tabela-modal-colunas__item-texto" }, sn = { class: "eli-tabela-modal-colunas__footer" };
function un(e, a, o, r, i, f) {
  return e.aberto ? (c(), $("div", {
    key: 0,
    class: "eli-tabela-modal-colunas__overlay",
    role: "presentation",
    onClick: a[9] || (a[9] = ue((...t) => e.emitFechar && e.emitFechar(...t), ["self"]))
  }, [
    p("div", Qo, [
      p("header", xo, [
        a[10] || (a[10] = p("h3", { class: "eli-tabela-modal-colunas__titulo" }, "Colunas", -1)),
        p("button", {
          type: "button",
          class: "eli-tabela-modal-colunas__fechar",
          "aria-label": "Fechar",
          onClick: a[0] || (a[0] = (...t) => e.emitFechar && e.emitFechar(...t))
        }, " × ")
      ]),
      p("div", en, [
        p("div", an, [
          a[12] || (a[12] = p("div", { class: "eli-tabela-modal-colunas__coluna-titulo" }, "Visíveis", -1)),
          p("div", {
            class: "eli-tabela-modal-colunas__lista",
            onDragover: a[2] || (a[2] = ue(() => {
            }, ["prevent"])),
            onDrop: a[3] || (a[3] = (t) => e.onDropLista(t, "visiveis", null))
          }, [
            (c(!0), $(re, null, ve(e.visiveisLocal, (t, n) => (c(), $("div", {
              key: `vis-${t}`,
              class: "eli-tabela-modal-colunas__item",
              draggable: "true",
              onDragstart: (d) => e.onDragStart(d, t, "visiveis", n),
              onDragover: a[1] || (a[1] = ue(() => {
              }, ["prevent"])),
              onDrop: (d) => e.onDropItem(d, "visiveis", n)
            }, [
              a[11] || (a[11] = p("span", {
                class: "eli-tabela-modal-colunas__item-handle",
                "aria-hidden": "true"
              }, "⋮⋮", -1)),
              p("span", on, F(t), 1)
            ], 40, tn))), 128))
          ], 32)
        ]),
        p("div", nn, [
          a[14] || (a[14] = p("div", { class: "eli-tabela-modal-colunas__coluna-titulo" }, "Invisíveis", -1)),
          p("div", {
            class: "eli-tabela-modal-colunas__lista",
            onDragover: a[5] || (a[5] = ue(() => {
            }, ["prevent"])),
            onDrop: a[6] || (a[6] = (t) => e.onDropLista(t, "invisiveis", null))
          }, [
            (c(!0), $(re, null, ve(e.invisiveisLocal, (t, n) => (c(), $("div", {
              key: `inv-${t}`,
              class: "eli-tabela-modal-colunas__item",
              draggable: "true",
              onDragstart: (d) => e.onDragStart(d, t, "invisiveis", n),
              onDragover: a[4] || (a[4] = ue(() => {
              }, ["prevent"])),
              onDrop: (d) => e.onDropItem(d, "invisiveis", n)
            }, [
              a[13] || (a[13] = p("span", {
                class: "eli-tabela-modal-colunas__item-handle",
                "aria-hidden": "true"
              }, "⋮⋮", -1)),
              p("span", ln, F(t), 1)
            ], 40, rn))), 128))
          ], 32)
        ])
      ]),
      p("footer", sn, [
        p("button", {
          type: "button",
          class: "eli-tabela-modal-colunas__botao eli-tabela-modal-colunas__botao--sec",
          onClick: a[7] || (a[7] = (...t) => e.emitFechar && e.emitFechar(...t))
        }, " Cancelar "),
        p("button", {
          type: "button",
          class: "eli-tabela-modal-colunas__botao eli-tabela-modal-colunas__botao--prim",
          onClick: a[8] || (a[8] = (...t) => e.emitSalvar && e.emitSalvar(...t))
        }, " Salvar ")
      ])
    ])
  ])) : Q("", !0);
}
const cn = /* @__PURE__ */ L(Ko, [["render", un], ["__scopeId", "data-v-b8f693ef"]]);
function dn(e) {
  if (!Number.isFinite(e) || e <= 0 || e >= 1) return 0;
  const a = e.toString();
  if (a.includes("e-")) {
    const [, i] = a.split("e-"), f = Number(i);
    return Number.isFinite(f) ? f : 0;
  }
  const o = a.indexOf(".");
  return o === -1 ? 0 : a.slice(o + 1).replace(/0+$/, "").length;
}
function fn(e) {
  const a = (e ?? "").trim().replace(/,/g, ".");
  if (!a) return null;
  const o = Number(a);
  return Number.isNaN(o) ? null : o;
}
function Le(e, a) {
  return e == null ? "" : a === null ? String(e) : Number(e).toFixed(Math.max(0, a)).replace(/\./g, ",");
}
function ta(e) {
  return (e ?? "").replace(/\D+/g, "");
}
function vn(e) {
  const a = (e ?? "").replace(/[^0-9.,]+/g, ""), o = a.match(/[.,]/);
  if (!o) return a;
  const r = o[0], i = a.indexOf(r), f = a.slice(0, i).replace(/[.,]/g, ""), t = a.slice(i + 1).replace(/[.,]/g, "");
  return `${f.length ? f : "0"}${r}${t}`;
}
function pn(e, a) {
  if (a === null) return e;
  if (a <= 0) return e.replace(/[.,]/g, "");
  const o = e.match(/[.,]/);
  if (!o) return e;
  const r = o[0], i = e.indexOf(r), f = e.slice(0, i), t = e.slice(i + 1);
  return `${f}${r}${t.slice(0, a)}`;
}
function mn(e) {
  const a = e.match(/^(\d+)[.,]$/);
  if (!a) return null;
  const o = Number(a[1]);
  return Number.isNaN(o) ? null : o;
}
const bn = N({
  name: "EliEntradaNumero",
  inheritAttrs: !1,
  props: {
    /** Interface padrão (EliEntrada): value + opcoes. */
    value: {
      type: [Number, null],
      default: void 0
    },
    opcoes: {
      type: Object,
      required: !0
    }
  },
  emits: {
    "update:value": (e) => !0,
    /** Compat Vue2 (v-model padrão: value + input) */
    input: (e) => !0,
    change: (e) => !0,
    focus: () => !0,
    blur: () => !0
  },
  setup(e, { attrs: a, emit: o }) {
    const r = S(() => {
      var u;
      const l = (u = e.opcoes) == null ? void 0 : u.precisao;
      return l == null ? null : dn(l);
    }), i = S(() => r.value === 0), f = S(() => {
      const l = r.value;
      return l !== null && l > 0;
    }), t = O(""), n = O(void 0);
    me(
      () => e.value,
      (l) => {
        l !== n.value && (t.value = Le(l, r.value), n.value = l);
      },
      { immediate: !0 }
    );
    function d(l) {
      if (f.value) {
        const D = r.value ?? 0, y = ta(l), s = y ? Number(y) : 0, _ = Math.pow(10, D), g = y ? s / _ : null, E = g === null ? null : g;
        n.value = E, o("update:value", E), o("input", E), o("change", E), t.value = Le(E, D);
        return;
      }
      const u = i.value ? ta(l) : vn(l), b = i.value ? u : pn(u, r.value);
      let k = null;
      if (b) {
        const y = (i.value ? null : mn(b)) ?? fn(b);
        k = y === null ? null : y;
      }
      n.value = k, o("update:value", k), o("input", k), o("change", k), t.value = Le(k, r.value);
    }
    return { attrs: a, emit: o, displayValue: t, isInteiro: i, onUpdateModelValue: d };
  }
}), hn = { class: "eli-entrada__prefixo" }, gn = { class: "eli-entrada__sufixo" };
function $n(e, a, o, r, i, f) {
  var t, n, d, l;
  return c(), W(He, Se({
    "model-value": e.displayValue,
    label: (t = e.opcoes) == null ? void 0 : t.rotulo,
    placeholder: (n = e.opcoes) == null ? void 0 : n.placeholder,
    type: e.isInteiro ? "number" : "text",
    inputmode: e.isInteiro ? "numeric" : "decimal",
    pattern: e.isInteiro ? "[0-9]*" : "[0-9.,]*"
  }, e.attrs, {
    "onUpdate:modelValue": e.onUpdateModelValue,
    onFocus: a[0] || (a[0] = () => e.emit("focus")),
    onBlur: a[1] || (a[1] = () => e.emit("blur"))
  }), ka({ _: 2 }, [
    (d = e.opcoes) != null && d.prefixo ? {
      name: "prepend-inner",
      fn: ae(() => [
        p("span", hn, F(e.opcoes.prefixo), 1)
      ]),
      key: "0"
    } : void 0,
    (l = e.opcoes) != null && l.sufixo ? {
      name: "append-inner",
      fn: ae(() => [
        p("span", gn, F(e.opcoes.sufixo), 1)
      ]),
      key: "1"
    } : void 0
  ]), 1040, ["model-value", "label", "placeholder", "type", "inputmode", "pattern", "onUpdate:modelValue"]);
}
const ma = /* @__PURE__ */ L(bn, [["render", $n], ["__scopeId", "data-v-77cbf216"]]), yn = N({
  name: "EliEntradaDataHora",
  inheritAttrs: !1,
  props: {
    // --- Novo padrão EliEntrada ---
    value: {
      type: String,
      default: void 0
    },
    opcoes: {
      type: Object,
      required: !1,
      default: void 0
    },
    // --- Compatibilidade com componente antigo EliDataHora ---
    modelValue: {
      type: String,
      default: null
    },
    modo: { type: String, default: void 0 },
    rotulo: { type: String, default: void 0 },
    placeholder: { type: String, default: void 0 },
    desabilitado: { type: Boolean, default: void 0 },
    limpavel: { type: Boolean, default: void 0 },
    erro: { type: Boolean, default: void 0 },
    mensagensErro: {
      type: [String, Array],
      default: void 0
    },
    dica: { type: String, default: void 0 },
    dicaPersistente: { type: Boolean, default: void 0 },
    densidade: { type: String, default: void 0 },
    variante: { type: String, default: void 0 },
    min: { type: String, default: void 0 },
    max: { type: String, default: void 0 }
  },
  emits: {
    // Novo padrão
    "update:value": (e) => !0,
    input: (e) => !0,
    // compat Vue2
    change: (e) => !0,
    // Compat antigo
    "update:modelValue": (e) => !0,
    alterar: (e) => !0,
    foco: () => !0,
    desfoco: () => !0,
    focus: () => !0,
    blur: () => !0
  },
  setup(e, { emit: a, attrs: o }) {
    const r = S(() => e.opcoes ? e.opcoes : {
      rotulo: e.rotulo ?? "Data e hora",
      placeholder: e.placeholder ?? "",
      modo: e.modo ?? "dataHora",
      limpavel: e.limpavel,
      erro: e.erro,
      mensagensErro: e.mensagensErro,
      dica: e.dica,
      dicaPersistente: e.dicaPersistente,
      densidade: e.densidade,
      variante: e.variante,
      min: e.min,
      max: e.max
    }), i = S(
      () => r.value.modo ?? "dataHora"
    ), f = S(() => !!e.desabilitado), t = S(
      () => i.value === "data" ? "date" : "datetime-local"
    );
    function n(s) {
      return i.value === "data" ? Ae(s).format("YYYY-MM-DD") : Ae(s).format("YYYY-MM-DDTHH:mm");
    }
    function d(s) {
      return i.value === "data" ? Ae(`${s}T00:00`).format() : Ae(s).format();
    }
    const l = S(() => e.value !== void 0 ? e.value ?? null : e.modelValue), u = S({
      get: () => l.value ? n(l.value) : "",
      set: (s) => {
        const _ = s && s.length > 0 ? s : null;
        if (!_) {
          a("update:value", null), a("input", null), a("change", null), a("update:modelValue", null), a("alterar", null);
          return;
        }
        const g = d(_);
        a("update:value", g), a("input", g), a("change", g), a("update:modelValue", g), a("alterar", g);
      }
    }), b = S(() => {
      const s = r.value.min;
      if (s)
        return n(s);
    }), k = S(() => {
      const s = r.value.max;
      if (s)
        return n(s);
    });
    function D() {
      a("foco"), a("focus");
    }
    function y() {
      a("desfoco"), a("blur");
    }
    return {
      attrs: o,
      valor: u,
      tipoInput: t,
      minLocal: b,
      maxLocal: k,
      opcoesEfetivas: r,
      desabilitadoEfetivo: f,
      emitCompatFocus: D,
      emitCompatBlur: y
    };
  }
}), _n = { class: "eli-data-hora" };
function En(e, a, o, r, i, f) {
  return c(), $("div", _n, [
    q(He, Se({
      modelValue: e.valor,
      "onUpdate:modelValue": a[0] || (a[0] = (t) => e.valor = t),
      type: e.tipoInput,
      label: e.opcoesEfetivas.rotulo,
      placeholder: e.opcoesEfetivas.placeholder,
      disabled: e.desabilitadoEfetivo,
      clearable: !!e.opcoesEfetivas.limpavel,
      error: !!e.opcoesEfetivas.erro,
      "error-messages": e.opcoesEfetivas.mensagensErro,
      hint: e.opcoesEfetivas.dica,
      "persistent-hint": !!e.opcoesEfetivas.dicaPersistente,
      density: e.opcoesEfetivas.densidade ?? "comfortable",
      variant: e.opcoesEfetivas.variante ?? "outlined",
      min: e.minLocal,
      max: e.maxLocal
    }, e.attrs, {
      onFocus: e.emitCompatFocus,
      onBlur: e.emitCompatBlur
    }), null, 16, ["modelValue", "type", "label", "placeholder", "disabled", "clearable", "error", "error-messages", "hint", "persistent-hint", "density", "variant", "min", "max", "onFocus", "onBlur"])
  ]);
}
const ba = /* @__PURE__ */ L(yn, [["render", En], ["__scopeId", "data-v-1bfd1be8"]]), Cn = N({
  name: "EliEntradaParagrafo",
  components: { VTextarea: Oa },
  inheritAttrs: !1,
  props: {
    value: {
      type: [String, null],
      default: void 0
    },
    opcoes: {
      type: Object,
      required: !0
    }
  },
  emits: {
    "update:value": (e) => !0,
    input: (e) => !0,
    change: (e) => !0,
    focus: () => !0,
    blur: () => !0
  },
  setup(e, { attrs: a, emit: o }) {
    const r = S({
      get: () => e.value,
      set: (i) => {
        o("update:value", i), o("input", i), o("change", i);
      }
    });
    return { attrs: a, emit: o, localValue: r, opcoes: e.opcoes };
  }
});
function An(e, a, o, r, i, f) {
  var t, n, d, l, u, b, k, D, y, s, _, g;
  return c(), W(Ia, Se({
    modelValue: e.localValue,
    "onUpdate:modelValue": a[0] || (a[0] = (E) => e.localValue = E),
    label: (t = e.opcoes) == null ? void 0 : t.rotulo,
    placeholder: (n = e.opcoes) == null ? void 0 : n.placeholder,
    rows: ((d = e.opcoes) == null ? void 0 : d.linhas) ?? 4,
    counter: (l = e.opcoes) == null ? void 0 : l.limiteCaracteres,
    maxlength: (u = e.opcoes) == null ? void 0 : u.limiteCaracteres,
    clearable: !!((b = e.opcoes) != null && b.limpavel),
    error: !!((k = e.opcoes) != null && k.erro),
    "error-messages": (D = e.opcoes) == null ? void 0 : D.mensagensErro,
    hint: (y = e.opcoes) == null ? void 0 : y.dica,
    "persistent-hint": !!((s = e.opcoes) != null && s.dicaPersistente),
    density: ((_ = e.opcoes) == null ? void 0 : _.densidade) ?? "comfortable",
    variant: ((g = e.opcoes) == null ? void 0 : g.variante) ?? "outlined",
    "auto-grow": ""
  }, e.attrs, {
    onFocus: a[1] || (a[1] = () => e.emit("focus")),
    onBlur: a[2] || (a[2] = () => e.emit("blur"))
  }), null, 16, ["modelValue", "label", "placeholder", "rows", "counter", "maxlength", "clearable", "error", "error-messages", "hint", "persistent-hint", "density", "variant"]);
}
const Sn = /* @__PURE__ */ L(Cn, [["render", An]]), kn = N({
  name: "EliEntradaSelecao",
  components: { VSelect: Fa },
  inheritAttrs: !1,
  props: {
    value: {
      type: [String, null],
      default: void 0
    },
    opcoes: {
      type: Object,
      required: !0
    }
  },
  emits: {
    "update:value": (e) => !0,
    input: (e) => !0,
    change: (e) => !0,
    focus: () => !0,
    blur: () => !0
  },
  setup(e, { attrs: a, emit: o }) {
    const r = O([]), i = O(!1), f = S({
      get: () => e.value,
      set: (n) => {
        o("update:value", n), o("input", n), o("change", n);
      }
    });
    async function t() {
      i.value = !0;
      try {
        const n = await e.opcoes.itens(), d = Array.isArray(n) ? n : [];
        r.value = [...d];
      } finally {
        i.value = !1;
      }
    }
    return me(
      () => e.opcoes.itens,
      () => {
        t();
      }
    ), la(() => {
      t();
    }), me(
      r,
      (n) => {
        console.debug("[EliEntradaSelecao] itens:", n);
      },
      { deep: !0 }
    ), { attrs: a, emit: o, localValue: f, opcoes: e.opcoes, itens: r, carregando: i };
  }
});
function Dn(e, a, o, r, i, f) {
  var t, n, d, l, u, b, k, D, y;
  return c(), W(qa, Se({
    modelValue: e.localValue,
    "onUpdate:modelValue": a[0] || (a[0] = (s) => e.localValue = s),
    label: (t = e.opcoes) == null ? void 0 : t.rotulo,
    placeholder: (n = e.opcoes) == null ? void 0 : n.placeholder,
    items: e.itens,
    "item-title": "rotulo",
    "item-value": "chave",
    loading: e.carregando,
    disabled: e.carregando,
    "menu-props": { maxHeight: 320 },
    clearable: !!((d = e.opcoes) != null && d.limpavel),
    error: !!((l = e.opcoes) != null && l.erro),
    "error-messages": (u = e.opcoes) == null ? void 0 : u.mensagensErro,
    hint: (b = e.opcoes) == null ? void 0 : b.dica,
    "persistent-hint": !!((k = e.opcoes) != null && k.dicaPersistente),
    density: ((D = e.opcoes) == null ? void 0 : D.densidade) ?? "comfortable",
    variant: ((y = e.opcoes) == null ? void 0 : y.variante) ?? "outlined"
  }, e.attrs, {
    onFocus: a[1] || (a[1] = () => e.emit("focus")),
    onBlur: a[2] || (a[2] = () => e.emit("blur"))
  }), null, 16, ["modelValue", "label", "placeholder", "items", "loading", "disabled", "clearable", "error", "error-messages", "hint", "persistent-hint", "density", "variant"]);
}
const Mn = /* @__PURE__ */ L(kn, [["render", Dn]]);
function Bn(e) {
  return e === "texto" || e === "numero" || e === "dataHora";
}
function Tn(e) {
  var o, r;
  const a = (r = (o = e == null ? void 0 : e.entrada) == null ? void 0 : o[1]) == null ? void 0 : r.rotulo;
  return String(a || ((e == null ? void 0 : e.coluna) ?? "Filtro"));
}
const wn = N({
  name: "EliTabelaModalFiltroAvancado",
  props: {
    aberto: { type: Boolean, required: !0 },
    filtrosBase: {
      type: Array,
      required: !0
    },
    modelo: {
      type: Array,
      required: !0
    }
  },
  emits: {
    fechar: () => !0,
    limpar: () => !0,
    salvar: (e) => !0
  },
  setup(e, { emit: a }) {
    const o = O([]), r = O(""), i = S(() => (e.filtrosBase ?? []).map((s) => String(s.coluna))), f = S(() => {
      const s = new Set(o.value.map((_) => String(_.coluna)));
      return (e.filtrosBase ?? []).filter((_) => !s.has(String(_.coluna)));
    });
    function t(s) {
      const _ = s == null ? void 0 : s[0];
      return _ === "numero" ? ma : _ === "dataHora" ? ba : Ye;
    }
    function n(s) {
      return (s == null ? void 0 : s[1]) ?? { rotulo: "" };
    }
    function d(s) {
      return (s == null ? void 0 : s[0]) === "numero" ? null : "";
    }
    function l() {
      var g;
      const s = e.filtrosBase ?? [], _ = Array.isArray(e.modelo) ? e.modelo : [];
      o.value = _.map((E) => {
        const Z = s.find((j) => String(j.coluna) === String(E.coluna)) ?? s[0], oe = (Z == null ? void 0 : Z.entrada) ?? E.entrada, Y = (Z == null ? void 0 : Z.coluna) ?? E.coluna, X = String((Z == null ? void 0 : Z.operador) ?? "="), le = E.valor ?? d(oe);
        return {
          coluna: Y,
          operador: X,
          entrada: oe,
          valor: le
        };
      });
      for (const E of o.value)
        i.value.includes(String(E.coluna)) && (E.operador = String(((g = s.find((Z) => String(Z.coluna) === String(E.coluna))) == null ? void 0 : g.operador) ?? "="), E.entrada && !Bn(E.entrada[0]) && (E.entrada = ["texto", { rotulo: "Valor" }]));
    }
    me(
      () => [e.aberto, e.filtrosBase, e.modelo],
      () => {
        e.aberto && l();
      },
      { deep: !0, immediate: !0 }
    );
    function u() {
      if (!r.value) return;
      const s = (e.filtrosBase ?? []).find((_) => String(_.coluna) === String(r.value));
      s && (o.value.some((_) => String(_.coluna) === String(s.coluna)) || (o.value.push({
        coluna: s.coluna,
        entrada: s.entrada,
        operador: String(s.operador ?? "="),
        valor: d(s.entrada)
      }), r.value = ""));
    }
    function b(s) {
      o.value.splice(s, 1);
    }
    function k() {
      a("fechar");
    }
    function D() {
      a("limpar");
    }
    function y() {
      a(
        "salvar",
        o.value.map((s) => ({
          coluna: s.coluna,
          valor: s.valor
        }))
      );
    }
    return {
      linhas: o,
      opcoesParaAdicionar: f,
      colunaParaAdicionar: r,
      componenteEntrada: t,
      opcoesEntrada: n,
      adicionar: u,
      remover: b,
      // exibimos operador fixo só como texto
      emitFechar: k,
      emitSalvar: y,
      emitLimpar: D,
      rotuloDoFiltro: Tn
    };
  }
}), Pn = {
  class: "eli-tabela-modal-filtro__modal",
  role: "dialog",
  "aria-modal": "true",
  "aria-label": "Filtro avançado"
}, On = { class: "eli-tabela-modal-filtro__header" }, Fn = { class: "eli-tabela-modal-filtro__conteudo" }, Vn = {
  key: 0,
  class: "eli-tabela-modal-filtro__vazio"
}, In = {
  key: 1,
  class: "eli-tabela-modal-filtro__lista"
}, qn = { class: "eli-tabela-modal-filtro__entrada" }, Nn = ["onClick"], Ln = { class: "eli-tabela-modal-filtro__acoes" }, jn = ["disabled"], zn = ["value"], Hn = ["disabled"], Un = { class: "eli-tabela-modal-filtro__footer" };
function Yn(e, a, o, r, i, f) {
  return e.aberto ? (c(), $("div", {
    key: 0,
    class: "eli-tabela-modal-filtro__overlay",
    role: "presentation",
    onClick: a[6] || (a[6] = ue((...t) => e.emitFechar && e.emitFechar(...t), ["self"]))
  }, [
    p("div", Pn, [
      p("header", On, [
        a[7] || (a[7] = p("h3", { class: "eli-tabela-modal-filtro__titulo" }, "Filtro avançado", -1)),
        p("button", {
          type: "button",
          class: "eli-tabela-modal-filtro__fechar",
          "aria-label": "Fechar",
          onClick: a[0] || (a[0] = (...t) => e.emitFechar && e.emitFechar(...t))
        }, " × ")
      ]),
      p("div", Fn, [
        e.filtrosBase.length ? (c(), $("div", In, [
          (c(!0), $(re, null, ve(e.linhas, (t, n) => (c(), $("div", {
            key: String(t.coluna),
            class: "eli-tabela-modal-filtro__linha"
          }, [
            p("div", qn, [
              (c(), W(Te(e.componenteEntrada(t.entrada)), {
                value: t.valor,
                "onUpdate:value": (d) => t.valor = d,
                opcoes: e.opcoesEntrada(t.entrada),
                density: "compact"
              }, null, 40, ["value", "onUpdate:value", "opcoes"]))
            ]),
            p("button", {
              type: "button",
              class: "eli-tabela-modal-filtro__remover",
              title: "Remover",
              "aria-label": "Remover",
              onClick: (d) => e.remover(n)
            }, " × ", 8, Nn)
          ]))), 128))
        ])) : (c(), $("div", Vn, " Nenhum filtro configurado na tabela. ")),
        p("div", Ln, [
          ra(p("select", {
            "onUpdate:modelValue": a[1] || (a[1] = (t) => e.colunaParaAdicionar = t),
            class: "eli-tabela-modal-filtro__select",
            disabled: !e.opcoesParaAdicionar.length
          }, [
            a[8] || (a[8] = p("option", {
              disabled: "",
              value: ""
            }, "Selecione um filtro…", -1)),
            (c(!0), $(re, null, ve(e.opcoesParaAdicionar, (t) => (c(), $("option", {
              key: String(t.coluna),
              value: String(t.coluna)
            }, F(e.rotuloDoFiltro(t)), 9, zn))), 128))
          ], 8, jn), [
            [Da, e.colunaParaAdicionar]
          ]),
          p("button", {
            type: "button",
            class: "eli-tabela-modal-filtro__botao",
            onClick: a[2] || (a[2] = (...t) => e.adicionar && e.adicionar(...t)),
            disabled: !e.colunaParaAdicionar
          }, " Adicionar ", 8, Hn)
        ])
      ]),
      p("footer", Un, [
        p("button", {
          type: "button",
          class: "eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--sec",
          onClick: a[3] || (a[3] = (...t) => e.emitLimpar && e.emitLimpar(...t))
        }, " Limpar "),
        p("button", {
          type: "button",
          class: "eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--sec",
          onClick: a[4] || (a[4] = (...t) => e.emitFechar && e.emitFechar(...t))
        }, " Cancelar "),
        p("button", {
          type: "button",
          class: "eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--prim",
          onClick: a[5] || (a[5] = (...t) => e.emitSalvar && e.emitSalvar(...t))
        }, " Aplicar ")
      ])
    ])
  ])) : Q("", !0);
}
const Rn = /* @__PURE__ */ L(wn, [["render", Yn], ["__scopeId", "data-v-cdc3f41a"]]), Jn = "eli:tabela";
function ha(e) {
  return `${Jn}:${e}:colunas`;
}
function ga(e) {
  if (!e || typeof e != "object")
    return { visiveis: [], invisiveis: [] };
  const a = e, o = Array.isArray(a.visiveis) ? a.visiveis.filter((i) => typeof i == "string") : [], r = Array.isArray(a.invisiveis) ? a.invisiveis.filter((i) => typeof i == "string") : [];
  return { visiveis: o, invisiveis: r };
}
function oa(e) {
  try {
    const a = window.localStorage.getItem(ha(e));
    return a ? ga(JSON.parse(a)) : { visiveis: [], invisiveis: [] };
  } catch {
    return { visiveis: [], invisiveis: [] };
  }
}
function Wn(e, a) {
  try {
    window.localStorage.setItem(ha(e), JSON.stringify(ga(a)));
  } catch {
  }
}
function Re(e) {
  return `eli_tabela:${e}:filtro_avancado`;
}
function na(e) {
  try {
    const a = localStorage.getItem(Re(e));
    if (!a) return [];
    const o = JSON.parse(a);
    return Array.isArray(o) ? o : [];
  } catch {
    return [];
  }
}
function Zn(e, a) {
  try {
    localStorage.setItem(Re(e), JSON.stringify(a ?? []));
  } catch {
  }
}
function Xn(e) {
  try {
    localStorage.removeItem(Re(e));
  } catch {
  }
}
const Gn = N({
  name: "EliTabela",
  inheritAttrs: !1,
  components: {
    EliTabelaCabecalho: At,
    EliTabelaEstados: wt,
    EliTabelaDebug: Vt,
    EliTabelaHead: Rt,
    EliTabelaBody: Io,
    EliTabelaMenuAcoes: Ho,
    EliTabelaPaginacao: Go,
    EliTabelaModalColunas: cn,
    EliTabelaModalFiltroAvancado: Rn
  },
  props: {
    /** Configuração principal da tabela (colunas, consulta e ações) */
    tabela: {
      type: Object,
      required: !0
    }
  },
  setup(e) {
    const o = O(!1), r = O(null), i = O([]), f = O(0), t = O([]), n = O(null), d = O(null), l = O({ top: 0, left: 0 }), u = O(""), b = O(1), k = O(null), D = O("asc"), y = O(!1), s = O(na(e.tabela.nome));
    function _() {
      y.value = !0;
    }
    function g() {
      y.value = !1;
    }
    function E() {
      s.value = [], Xn(e.tabela.nome), y.value = !1, u.value = "", b.value !== 1 ? b.value = 1 : $e();
    }
    function Z(A) {
      s.value = A ?? [], Zn(e.tabela.nome, A ?? []), y.value = !1, u.value = "", b.value !== 1 ? b.value = 1 : $e();
    }
    const oe = S(() => {
      const A = e.tabela.filtroAvancado ?? [];
      return (s.value ?? []).filter((P) => P && P.coluna !== void 0).map((P) => {
        const z = A.find((H) => String(H.coluna) === String(P.coluna));
        return z ? {
          coluna: String(z.coluna),
          operador: z.operador,
          valor: P.valor
        } : null;
      }).filter(Boolean);
    }), Y = S(() => e.tabela), X = S(() => !!e.tabela.mostrarCaixaDeBusca), le = S(() => e.tabela.acoesTabela ?? []), j = S(() => le.value.length > 0), be = O(!1), V = O(
      oa(e.tabela.nome)
    ), w = O({}), ke = S(() => e.tabela.colunas.map((A) => A.rotulo)), Pe = S(() => {
      var ne, se;
      const A = e.tabela.colunas, z = (((ne = V.value.visiveis) == null ? void 0 : ne.length) ?? 0) > 0 || (((se = V.value.invisiveis) == null ? void 0 : se.length) ?? 0) > 0 ? V.value.invisiveis ?? [] : A.filter((J) => J.visivel === !1).map((J) => J.rotulo), H = new Set(z), fe = A.filter((J) => H.has(J.rotulo)), ce = z, ye = /* @__PURE__ */ new Map();
      for (const J of fe)
        ye.has(J.rotulo) || ye.set(J.rotulo, J);
      const ee = [];
      for (const J of ce) {
        const pe = ye.get(J);
        pe && ee.push(pe);
      }
      for (const J of fe)
        ee.includes(J) || ee.push(J);
      return ee;
    }), M = S(() => Pe.value.length > 0), h = S(() => {
      var J, pe;
      const A = e.tabela.colunas, P = ke.value, z = (((J = V.value.visiveis) == null ? void 0 : J.length) ?? 0) > 0 || (((pe = V.value.invisiveis) == null ? void 0 : pe.length) ?? 0) > 0, H = z ? V.value.invisiveis ?? [] : e.tabela.colunas.filter((U) => U.visivel === !1).map((U) => U.rotulo), fe = new Set(H), ce = P.filter((U) => !fe.has(U)), ye = new Set(ce), ee = z ? V.value.visiveis ?? [] : [], ne = [];
      for (const U of ee)
        ye.has(U) && ne.push(U);
      for (const U of ce)
        ne.includes(U) || ne.push(U);
      const se = /* @__PURE__ */ new Map();
      for (const U of A)
        se.has(U.rotulo) || se.set(U.rotulo, U);
      return ne.map((U) => se.get(U)).filter(Boolean);
    });
    function v() {
      be.value = !0;
    }
    function C() {
      be.value = !1;
    }
    function m(A) {
      V.value = A, Wn(e.tabela.nome, A), be.value = !1, w.value = {};
    }
    function T(A) {
      const P = !!w.value[A];
      w.value = {
        ...w.value,
        [A]: !P
      };
    }
    const B = S(() => {
      const A = e.tabela.registros_por_consulta;
      return typeof A == "number" && A > 0 ? Math.floor(A) : 10;
    }), I = S(() => {
      const A = B.value;
      if (!A || A <= 0) return 1;
      const P = f.value ?? 0;
      return P ? Math.max(1, Math.ceil(P / A)) : 1;
    }), R = S(() => i.value ?? []), G = S(() => f.value ?? 0), x = S(() => (e.tabela.acoesLinha ?? []).length > 0), ie = S(() => (e.tabela.filtroAvancado ?? []).length > 0);
    let de = 0;
    function he(A) {
      var ee, ne, se, J, pe, U;
      const P = A.getBoundingClientRect(), z = 8, H = ((se = (ne = (ee = d.value) == null ? void 0 : ee.menuEl) == null ? void 0 : ne.value) == null ? void 0 : se.offsetHeight) ?? 0, fe = ((U = (pe = (J = d.value) == null ? void 0 : J.menuEl) == null ? void 0 : pe.value) == null ? void 0 : U.offsetWidth) ?? 180;
      let ce = P.bottom + z;
      const ye = P.right - fe;
      H && ce + H > window.innerHeight - z && (ce = P.top - z - H), l.value = {
        top: Math.max(z, Math.round(ce)),
        left: Math.max(z, Math.round(ye))
      };
    }
    function Ee(A) {
      var z, H;
      if (n.value === null) return;
      const P = A.target;
      (H = (z = d.value) == null ? void 0 : z.menuEl) != null && H.value && d.value.menuEl.value.contains(P) || (n.value = null);
    }
    function _e(A) {
      if (A) {
        if (k.value === A) {
          D.value = D.value === "asc" ? "desc" : "asc", $e();
          return;
        }
        k.value = A, D.value = "asc", b.value !== 1 ? b.value = 1 : $e();
      }
    }
    function te(A) {
      u.value !== A && (u.value = A, b.value !== 1 ? b.value = 1 : $e());
    }
    function ge(A) {
      const P = Math.min(Math.max(1, A), I.value);
      P !== b.value && (b.value = P);
    }
    function Ce(A) {
      const P = e.tabela.acoesLinha ?? [], z = t.value[A] ?? [];
      return P.map((H, fe) => {
        const ce = H.exibir === void 0 ? !0 : typeof H.exibir == "boolean" ? H.exibir : !1;
        return {
          acao: H,
          indice: fe,
          visivel: z[fe] ?? ce
        };
      }).filter((H) => H.visivel);
    }
    function De(A) {
      return Ce(A).length > 0;
    }
    function $a(A, P) {
      if (!De(A)) return;
      if (n.value === A) {
        n.value = null;
        return;
      }
      n.value = A;
      const z = (P == null ? void 0 : P.currentTarget) ?? null;
      z && (he(z), requestAnimationFrame(() => he(z)));
    }
    async function $e() {
      var ce, ye;
      const A = ++de;
      o.value = !0, r.value = null, t.value = [], n.value = null, w.value = {};
      const P = Math.max(1, B.value), H = {
        offSet: (b.value - 1) * P,
        limit: P
      }, fe = (u.value ?? "").trim();
      if (fe)
        H.texto_busca = fe;
      else {
        const ee = oe.value;
        ee.length && (H.filtros = ee);
      }
      k.value && (H.coluna_ordem = k.value, H.direcao_ordem = D.value);
      try {
        const ee = e.tabela, ne = await ee.consulta(H);
        if (A !== de) return;
        if (ne.cod !== fa.sucesso) {
          i.value = [], f.value = 0, r.value = ne.mensagem;
          return;
        }
        const se = ((ce = ne.valor) == null ? void 0 : ce.valores) ?? [], J = ((ye = ne.valor) == null ? void 0 : ye.quantidade) ?? se.length;
        i.value = se, f.value = Number(J) || 0;
        const pe = Math.max(1, Math.ceil((f.value || 0) / P));
        b.value > pe && (b.value = pe);
        const U = ee.acoesLinha ?? [];
        if (!U.length) {
          t.value = [];
          return;
        }
        const ya = se.map(
          () => U.map((Oe) => Oe.exibir === void 0 ? !0 : typeof Oe.exibir == "boolean" ? Oe.exibir : !1)
        );
        t.value = ya;
        const _a = await Promise.all(
          se.map(
            async (Oe) => Promise.all(
              U.map(async (Ve) => {
                if (Ve.exibir === void 0) return !0;
                if (typeof Ve.exibir == "boolean") return Ve.exibir;
                try {
                  const Ea = Ve.exibir(Oe);
                  return !!await Promise.resolve(Ea);
                } catch {
                  return !1;
                }
              })
            )
          )
        );
        A === de && (t.value = _a);
      } catch (ee) {
        if (A !== de) return;
        i.value = [], f.value = 0, r.value = ee instanceof Error ? ee.message : "Erro ao carregar dados.";
      } finally {
        A === de && (o.value = !1);
      }
    }
    return la(() => {
      document.addEventListener("click", Ee), $e();
    }), Ma(() => {
      document.removeEventListener("click", Ee);
    }), me(
      () => e.tabela.mostrarCaixaDeBusca,
      (A) => {
        !A && u.value && (u.value = "", b.value !== 1 ? b.value = 1 : $e());
      }
    ), me(b, (A, P) => {
      A !== P && $e();
    }), me(
      () => e.tabela,
      () => {
        n.value = null, k.value = null, D.value = "asc", u.value = "", be.value = !1, y.value = !1, V.value = oa(e.tabela.nome), s.value = na(e.tabela.nome), w.value = {}, b.value !== 1 ? b.value = 1 : $e();
      }
    ), me(
      () => e.tabela.registros_por_consulta,
      () => {
        b.value !== 1 ? b.value = 1 : $e();
      }
    ), me(i, () => {
      n.value = null, w.value = {};
    }), {
      // state
      isDev: !1,
      tabela: Y,
      carregando: o,
      erro: r,
      linhas: i,
      linhasPaginadas: R,
      filtrosAvancadosAtivos: oe,
      quantidadeFiltrada: G,
      quantidade: f,
      menuAberto: n,
      valorBusca: u,
      paginaAtual: b,
      colunaOrdenacao: k,
      direcaoOrdenacao: D,
      totalPaginas: I,
      registrosPorConsulta: B,
      // computed
      exibirBusca: X,
      exibirFiltroAvancado: ie,
      acoesCabecalho: le,
      temAcoesCabecalho: j,
      temAcoes: x,
      colunasEfetivas: h,
      rotulosColunas: ke,
      modalColunasAberto: be,
      configColunas: V,
      temColunasInvisiveis: M,
      colunasInvisiveisEfetivas: Pe,
      linhasExpandidas: w,
      abrirModalColunas: v,
      abrirModalFiltro: _,
      fecharModalColunas: C,
      salvarModalColunas: m,
      modalFiltroAberto: y,
      filtrosUi: s,
      salvarFiltrosAvancados: Z,
      limparFiltrosAvancados: E,
      fecharModalFiltro: g,
      alternarLinhaExpandida: T,
      // actions
      alternarOrdenacao: _e,
      atualizarBusca: te,
      irParaPagina: ge,
      acoesDisponiveisPorLinha: Ce,
      possuiAcoes: De,
      toggleMenu: $a,
      // popup
      menuPopup: d,
      menuPopupPos: l
    };
  }
}), Kn = { class: "eli-tabela" }, Qn = { class: "eli-tabela__table" };
function xn(e, a, o, r, i, f) {
  const t = K("EliTabelaDebug"), n = K("EliTabelaEstados"), d = K("EliTabelaCabecalho"), l = K("EliTabelaModalColunas"), u = K("EliTabelaModalFiltroAvancado"), b = K("EliTabelaHead"), k = K("EliTabelaBody"), D = K("EliTabelaMenuAcoes"), y = K("EliTabelaPaginacao");
  return c(), $("div", Kn, [
    q(t, {
      isDev: e.isDev,
      menuAberto: e.menuAberto,
      menuPopupPos: e.menuPopupPos
    }, {
      default: ae(() => [
        p("div", null, "paginaAtual: " + F(e.paginaAtual), 1),
        p("div", null, "limit: " + F(e.registrosPorConsulta), 1),
        p("div", null, "texto_busca: " + F((e.valorBusca || "").trim()), 1),
        p("div", null, "filtrosAvancadosAtivos: " + F(JSON.stringify(e.filtrosAvancadosAtivos)), 1),
        p("div", null, "quantidadeTotal: " + F(e.quantidade), 1)
      ]),
      _: 1
    }, 8, ["isDev", "menuAberto", "menuPopupPos"]),
    e.carregando || e.erro || !e.linhas.length ? (c(), W(n, {
      key: 0,
      carregando: e.carregando,
      erro: e.erro,
      mensagemVazio: e.tabela.mensagemVazio
    }, null, 8, ["carregando", "erro", "mensagemVazio"])) : (c(), $(re, { key: 1 }, [
      e.exibirBusca || e.temAcoesCabecalho ? (c(), W(d, {
        key: 0,
        exibirBusca: e.exibirBusca,
        exibirBotaoFiltroAvancado: e.exibirFiltroAvancado,
        valorBusca: e.valorBusca,
        acoesCabecalho: e.acoesCabecalho,
        onBuscar: e.atualizarBusca,
        onColunas: e.abrirModalColunas,
        onFiltroAvancado: e.abrirModalFiltro
      }, null, 8, ["exibirBusca", "exibirBotaoFiltroAvancado", "valorBusca", "acoesCabecalho", "onBuscar", "onColunas", "onFiltroAvancado"])) : Q("", !0),
      q(l, {
        aberto: e.modalColunasAberto,
        rotulosColunas: e.rotulosColunas,
        configInicial: e.configColunas,
        colunas: e.tabela.colunas,
        onFechar: e.fecharModalColunas,
        onSalvar: e.salvarModalColunas
      }, null, 8, ["aberto", "rotulosColunas", "configInicial", "colunas", "onFechar", "onSalvar"]),
      q(u, {
        aberto: e.modalFiltroAberto,
        filtrosBase: e.tabela.filtroAvancado ?? [],
        modelo: e.filtrosUi,
        onFechar: e.fecharModalFiltro,
        onLimpar: e.limparFiltrosAvancados,
        onSalvar: e.salvarFiltrosAvancados
      }, null, 8, ["aberto", "filtrosBase", "modelo", "onFechar", "onLimpar", "onSalvar"]),
      p("table", Qn, [
        q(b, {
          colunas: e.colunasEfetivas,
          temAcoes: e.temAcoes,
          temColunasInvisiveis: e.temColunasInvisiveis,
          colunaOrdenacao: e.colunaOrdenacao,
          direcaoOrdenacao: e.direcaoOrdenacao,
          onAlternarOrdenacao: e.alternarOrdenacao
        }, null, 8, ["colunas", "temAcoes", "temColunasInvisiveis", "colunaOrdenacao", "direcaoOrdenacao", "onAlternarOrdenacao"]),
        q(k, {
          colunas: e.colunasEfetivas,
          colunasInvisiveis: e.colunasInvisiveisEfetivas,
          temColunasInvisiveis: e.temColunasInvisiveis,
          linhasExpandidas: e.linhasExpandidas,
          linhas: e.linhasPaginadas,
          temAcoes: e.temAcoes,
          menuAberto: e.menuAberto,
          possuiAcoes: e.possuiAcoes,
          toggleMenu: e.toggleMenu,
          alternarLinhaExpandida: e.alternarLinhaExpandida
        }, null, 8, ["colunas", "colunasInvisiveis", "temColunasInvisiveis", "linhasExpandidas", "linhas", "temAcoes", "menuAberto", "possuiAcoes", "toggleMenu", "alternarLinhaExpandida"])
      ]),
      q(D, {
        ref: "menuPopup",
        menuAberto: e.menuAberto,
        posicao: e.menuPopupPos,
        acoes: e.menuAberto === null ? [] : e.acoesDisponiveisPorLinha(e.menuAberto),
        linha: e.menuAberto === null ? null : e.linhasPaginadas[e.menuAberto],
        onExecutar: a[0] || (a[0] = ({ acao: s, linha: _ }) => {
          e.menuAberto = null, s.acao(_);
        })
      }, null, 8, ["menuAberto", "posicao", "acoes", "linha"]),
      e.totalPaginas > 1 && e.quantidadeFiltrada > 0 ? (c(), W(y, {
        key: 1,
        pagina: e.paginaAtual,
        totalPaginas: e.totalPaginas,
        maximoBotoes: e.tabela.maximo_botoes_paginacao,
        onAlterar: e.irParaPagina
      }, null, 8, ["pagina", "totalPaginas", "maximoBotoes", "onAlterar"])) : Q("", !0)
    ], 64))
  ]);
}
const er = /* @__PURE__ */ L(Gn, [["render", xn]]), dr = (e, a) => [e, a], fr = {
  install(e) {
    e.component("EliOlaMundo", xa), e.component("EliBotao", da), e.component("EliBadge", Ue), e.component("EliCartao", nt), e.component("EliTabela", er), e.component("EliEntradaTexto", Ye), e.component("EliEntradaNumero", ma), e.component("EliEntradaDataHora", ba), e.component("EliEntradaParagrafo", Sn), e.component("EliEntradaSelecao", Mn);
  }
};
export {
  Ue as EliBadge,
  da as EliBotao,
  nt as EliCartao,
  ba as EliEntradaDataHora,
  ma as EliEntradaNumero,
  Sn as EliEntradaParagrafo,
  Mn as EliEntradaSelecao,
  Ye as EliEntradaTexto,
  xa as EliOlaMundo,
  er as EliTabela,
  dr as celulaTabela,
  fr as default
};
