'use strict';
import { c } from 'react/compiler-runtime';
import { jsx } from 'react/jsx-runtime';
import { useState } from 'react';
import { initBodyCellTooltip } from './BodyCellArrayTooltip.funcs.js';
import { useAsyncEffect } from '../../../../fd-toolbox/hooks/use-async-effect.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
const bodyCellTooltipItemPrefix = "bodyCellTooltipItem";
function BodyCellArrayTooltip(t0) {
  const $ = c(4);
  const {
    cellContext
  } = t0;
  const [cellValue, setCellValue] = useState();
  let t1;
  if ($[0] !== cellContext) {
    t1 = async () => {
      await initBodyCellTooltip(cellContext, setCellValue);
    };
    $[0] = cellContext;
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  useAsyncEffect(t1);
  if (!cellValue) {
    return void 0;
  }
  let t2;
  if ($[2] !== cellValue) {
    const valueToCount = new Map();
    t2 = cellValue.map(item => {
      const valueCount = (valueToCount.get(item) ?? 0) + 1;
      valueToCount.set(item, valueCount);
      return jsx("div", {
        children: item
      }, `${bodyCellTooltipItemPrefix}_${item}_${valueCount}`);
    });
    $[2] = cellValue;
    $[3] = t2;
  } else {
    t2 = $[3];
  }
  return t2;
}
__name(BodyCellArrayTooltip, "BodyCellArrayTooltip");

export { BodyCellArrayTooltip };
