import {
  getCollectionGallery
} from "./chunk-42R54Z2X.js";
import {
  TextCell
} from "./chunk-JHIMVLB2.js";
import {
  Thumbnail
} from "./chunk-WIYFXWRI.js";

// src/hooks/table/columns/use-collection-table-columns.tsx
import { createColumnHelper } from "@tanstack/react-table";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { jsx, jsxs } from "react/jsx-runtime";
var columnHelper = createColumnHelper();
var useCollectionTableColumns = () => {
  const { t } = useTranslation();
  return useMemo(
    () => [
      columnHelper.accessor("title", {
        header: t("fields.title"),
        cell: ({ getValue, row }) => {
          const gallery = getCollectionGallery(
            row.original.media_images
          );
          const thumbnailSrc = gallery.find((image) => image.is_thumbnail)?.url ?? gallery[0]?.url ?? null;
          return /* @__PURE__ */ jsxs("div", { className: "flex size-full items-center gap-x-3 overflow-hidden", children: [
            /* @__PURE__ */ jsx(Thumbnail, { src: thumbnailSrc }),
            /* @__PURE__ */ jsx("span", { className: "truncate", children: getValue() })
          ] });
        }
      }),
      columnHelper.accessor("handle", {
        header: t("fields.handle"),
        cell: ({ getValue }) => /* @__PURE__ */ jsx(TextCell, { text: `/${getValue()}` })
      }),
      columnHelper.accessor("products", {
        header: t("fields.products"),
        cell: ({ getValue }) => {
          const count = getValue()?.length || void 0;
          return /* @__PURE__ */ jsx(TextCell, { text: count });
        }
      })
    ],
    [t]
  );
};

export {
  useCollectionTableColumns
};
