function allNodes() {
  return Array.from(document.querySelectorAll('.matrix-node'));
}

export function clearHighlight() {
  allNodes().forEach(el => el.classList.remove('is-dim','is-focus','is-related'));
}

export function highlightByIds(ids = []) {
    return;
  }

  els.forEach(el => {
    const id = el.getAttribute('data-id');
    if (set.has(id)) {
      el.classList.add('is-focus');
      el.classList.remove('is-dim','is-related');
    } else {
      el.classList.add('is-dim');
      el.classList.remove('is-focus','is-related');
    }
  });
}

export function highlightByValue(val) {
  const v = String(val);
  const els = allNodes();
  if (!v) return;

  // Фокус: все узлы с этим числом
  let any = false;
  els.forEach(el => {
    const nodeVal = el.getAttribute('data-val');
    if (nodeVal === v) {
      any = true;
      el.classList.add('is-focus');
      el.classList.remove('is-dim','is-related');
    } else {
      el.classList.add('is-dim');
      el.classList.remove('is-focus','is-related');
    }
  });

  if (!any) clearHighlight();
}
