const BOUNDARY_FALSE_POSITIVE_VALUE = 14;
export const cardFormResizeObserver = new ResizeObserver((entries) => {
  var _a;
  for (let entry of entries) {
    const children = ((_a = entry === null || entry === void 0 ? void 0 : entry.target) === null || _a === void 0 ? void 0 : _a.children) || [];
    const { parentElement } = (entry === null || entry === void 0 ? void 0 : entry.target) || {};
    if (!(parentElement === null || parentElement === void 0 ? void 0 : parentElement.clientWidth))
      return;
    const limitWidth = parentElement.clientWidth - BOUNDARY_FALSE_POSITIVE_VALUE;
    if (entry.target.hasChildNodes()) {
      const listWidth = [];
      for (const node of children)
        listWidth.push(node);
      listWidth.reduce((total, child) => {
        const totalWidth = total + child.clientWidth;
        if (totalWidth > limitWidth) {
          child.style.visibility = 'hidden';
        }
        else {
          child.style.visibility = 'visible';
        }
        return totalWidth;
      }, 0);
    }
  }
});
