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

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

const renderReference = (field, data) => {
  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, src: imageSrc, text: initialLetters })));
};
const DvnFieldDisplayCellReference = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  render() {
    const { field } = this;
    const value = this.value || [];
    return (h(Host, null, Array.isArray(value)
      ? value.map(data => renderReference(field, data))
      : renderReference(field, value)));
  }
};
DvnFieldDisplayCellReference.style = dvnFieldDisplayCellReferenceCss;

export { DvnFieldDisplayCellReference as dvn_field_display_cell_reference };
