return "hide";
    }
    return "none";
  }

  /**
   * @param {HTMLElement} dfn
   * @param {HTMLElement} panel
   * @param {{ x: number, y: number }} clickPosition
   */
  function displayPanel(dfn, panel, { x, y }) {
    panel.hidden = false;
    // distance (px) between edge of panel and the pointing triangle (caret)
    const MARGIN = 20;

    const dfnRects = dfn.getClientRects();
    // Find the `top` offset when the `dfn` can be spread across multiple lines
    let closestTop = 0;
    let minDiff = 