import { computed as a } from "vue";
import { uniqueId as c, asConst as p, sliceBy as h } from "@milaboratories/helpers";
import { GAP as b } from "../constants.js";
function v(i) {
  return a(() => {
    const { data: o, settings: u } = i, { bodyWidth: l, scrollLeft: e } = o, n = [...o.columns], s = c();
    u.value.controlColumn && n.unshift(
      p({
        id: s,
        label: "#",
        width: 60,
        frozen: !0
      })
    );
    let r = 0;
    const f = n.map((t) => {
      const d = { ...t, offset: r };
      return r += t.width + b, d;
    }), m = f.filter((t) => t.frozen);
    return h(f, (t) => t.frozen ? !1 : e < t.offset + t.width && t.offset < l + e).concat(m).map((t) => ({
      ...t,
      style: {
        left: t.frozen ? `${t.offset}px` : `${t.offset - o.scrollLeft}px`,
        width: `${t.width}px`
      },
      control: t.id === s
    }));
  });
}
export {
  v as useTableColumns
};
//# sourceMappingURL=useTableColumns.js.map
