import { r as registerInstance, h, H as Host } from './index-55faf181.js';

const dvnFieldDisplayCellReferenceCss = ".sc-dvn-field-display-cell-reference-h{display:-ms-flexbox;display:flex;overflow:auto;padding:0 4px}.sc-dvn-field-display-cell-reference-h abbr.sc-dvn-field-display-cell-reference{border-bottom:none}";

const renderReference = (field, data, meta) => {
  const imageSrc = field.imageField ? data[field.imageField] : undefined;
  const initialLetters = field.titleField
    ? data[field.titleField].split(' ').map(word => word[0]).join('')
    : undefined;
  return (h("abbr", { title: data[field.titleField] }, h("dvn-image", { bordered: true, leanedVertically: true, src: imageSrc, text: initialLetters, shape: meta === null || meta === void 0 ? void 0 : meta.imageShape })));
};
const DvnFieldDisplayCellReference = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  render() {
    const { field, meta } = this;
    const value = this.value || [];
    return (h(Host, null, Array.isArray(value)
      ? value.map(data => renderReference(field, data, meta))
      : renderReference(field, value, meta)));
  }
};
DvnFieldDisplayCellReference.style = dvnFieldDisplayCellReferenceCss;

export { DvnFieldDisplayCellReference as dvn_field_display_cell_reference };
