right now my annotation box is palced to the irght of the text selection, however it is no placed inline vertically with the text, can you fix this? const handleMouseUp = (event: React.MouseEvent) => {
    const id = event.currentTarget.id;
    const selection = window.getSelection();
    if (!(selection && selection.toString() && !annotationVisible && selection.anchorNode) || id === "annots") { //Ignore highlights on annotations
      return;
    }
  
    const selectedText = selection.toString();
    const range = selection.getRangeAt(0);
    
    //For annotation positioning
    const rect = range.getBoundingClientRect();
    setAnnotationPosition({
      top: rect.bottom, //- window.scrollY,
      left: rect.right + 3 // 10px padding
    });
  
    const startContainer = range.startContainer;
    const endContainer = range.endContainer;
  
    const startOffset = range.startOffset;
    const endOffset = range.endOffset;
  
    console.log("Start Container: ", startContainer, startOffset);
    console.log("End Container: ", endContainer, endOffset);
  
    // Helper function to retrieve the text content of an entire node and its children
    const getTextContent = (node: Node): string => 
      node.nodeType === Node.TEXT_NODE ? 
      (node.textContent ?? "") : 
      Array.from(node.childNodes).map(getTextContent).join("");
  
    // Retrieve the full text content of the start and end containers
    const startContainerText = getTextContent(startContainer);
    const endContainerText = getTextContent(endContainer);
  
    console.log("Start Container Text: ", startContainerText);
    console.log("End Container Text: ", endContainerText);

    console.log("start container using text content", startContainer.textContent)
  
    const startIdxInMessage = message.text.indexOf(startContainerText) + startOffset;
    const endIdxInMessage = message.text.indexOf(endContainerText) + endOffset;
  
    console.log("Start Index in Message: ", startIdxInMessage);
    console.log("End Index in Message: ", endIdxInMessage);
  
    if (startContainer === endContainer) {
      // When the selection is within a single container
      const start = startIdxInMessage;
      const end = startIdxInMessage + selectedText.length;
      const isMatch = message.text.substring(start, end) === selectedText;
  
      if (isMatch) {
        const id = addAnnotation(selectedText, "", start, end, annotRanges);
        setAnnotationVisible(true);
        setAnnotationKey(id);
      }
    
    }
  };
  

  // Function to add annotation
  const addAnnotation = (s: string, a: string, start: number, end: number, ar: AnnotRanges[]) => {

    const id = uuidv4().toString();

    const annot: Annotation = { text:s, annotation:a, start, end };
    setAnnotDict(prevDict => ({ ...prevDict, [id]: annot }));

    ar.push({start,end})
    const newRanges = Object.values(ar).sort((a, b) => a.start - b.start); //For proper rendering later. DO NOT REMOVE!
    setAnnotRanges(newRanges)

    console.log('start', start)
    console.log('end', end)


  console.log("key!!!", id)

  return id

   
  };

  interface RenderAnnoatedTextProps {
    msg: string;
    ar: AnnotRanges[];
  }
//ad: { [key: string]: Annotation }}
  const renderAnnotatedText: React.FC<RenderAnnoatedTextProps> = ({msg, ar}: {msg: string, ar: AnnotRanges[]}) => {

      return (
        <Markdown
          text={msg}
          className={cn(STYLE_LEVEL_TO_CLASSES.p)}
          customComponents={{
            img: MarkdownImage as any,
            cite: CitationTextHighlighter as any,
            table: DataTable as any,
          }}
          renderLaTex={true}
          //highlightedRanges={[{start:1,end:5},{start:310, end:320},{start:310, end:340}]}
          highlightedRanges={ar}
        />
      )
    };

  const msg = message.text;

  return (
    <div
      id={
        isFulfilledOrTypingMessage(message) && message.generationId
          ? getMessageRowId(message.generationId)
          : undefined
      }
      className={cn(ReservedClasses.MESSAGE, 'flex', className)}
      onMouseEnter={handleOnMouseEnter}
      onMouseLeave={handleOnMouseLeave}
      onMouseUp={handleMouseUp}
      ref={ref}
    >
      <LongPressMenu
        isOpen={isLongPressMenuOpen}
        close={() => setIsLongPressMenuOpen(false)}
        className="md:hidden"
      >
        <div className={cn('flex flex-col divide-y', 'divide-marble-300')}>
          <div className="flex flex-col gap-y-4 pt-4">
            <CopyToClipboardButton
              value={getMessageText()}
              label="Copy text"
              kind="secondary"
              iconAtStart
              onClick={onCopy}
            />
            {hasSteps && (
              <Button
                label={`${isStepsExpanded ? 'Hide' : 'Show'} steps`}
                startIcon={<Icon name="list" />}
                kind="secondary"
                size="md"
                aria-label={`${isStepsExpanded ? 'Hide' : 'Show'} steps`}
                animate={false}
                onClick={() => setIsStepsExpanded((prevIsExpanded) => !prevIsExpanded)}
              />
            )}
          </div>
        </div>
      </LongPressMenu>
      <div
        className={cn(
          'group flex h-fit w-full flex-col gap-2 rounded-md p-2 text-left md:flex-row',
          'transition-colors ease-in-out',
          'hover:bg-secondary-100',

          {
            'bg-secondary-50':
              isFulfilledOrTypingMessage(message) &&
              message.generationId &&
              hoveredGenerationId === message.generationId,
            'bg-primary-50 hover:bg-primary-50': highlightMessage,
          }
        )}
        {...(enableLongPress && longPressProps)}
      >
        <div className="flex w-full gap-x-2">
          <Avatar message={message} />
          <div className="flex w-full min-w-0 max-w-message flex-1 flex-col items-center gap-x-3 md:flex-row">
            <div className="w-full">
              {hasSteps && <ToolEvents show={isStepsExpanded} events={message.toolEvents} />}

              {//This is where we render the annotated box
              }

              {annotationVisible && (
                    console.log("annot visisble!"),
                    console.log("pos", annotationPosition.top), 
                    <div 
                    ref={annotationRef} 
                    style={{
                      display: "block",
                      position: "absolute",
                      top: `${annotationPosition}px`,
                      left: `${annotationPosition.left}px`,
                      //zIndex: 1000,
                  }}
                  
                    > 
                              <input
                              type='text'
                              style={{
                                fontSize: '14px', // Adjust the font size as needed
                                height: '2rem', // Adjust the height as needed
                                width: '200px', // Adjust the width as needed
                                padding: '0.5rem', // Adjust the padding as needed
                                lineHeight: '1.5', // Adjust the line height as needed
                                fontFamily: 'Arial, sans-serif' // Adjust the font family as needed
                            }}
                                className='w-full'
                                placeholder="Add annotation . . ."
                                onKeyDown={(e) => {
                                  if (e.key === "Enter") {
                                    const target = e.target as HTMLInputElement;


                                    console.log(annotationKey)
                                    console.log("TEXT",message.text)

                                    setAnnotDict(prevDict => ({
                                      ...prevDict,
                                      [annotationKey]: { ...prevDict[annotationKey], annotation: target.value }
                                    }));
                                    
                                    setAnnotationVisible(false);
                                    setAnnotationKey("")
                                    target.value = "";
                                  }
                                  else if(e.key === "Escape"){
                                    setAnnotationVisible(false);
                                    setAnnotationKey("")
                                  }
                                }}
                          />
                      </div>
                      )}
              
              <div className="flex w-full flex-col justify-center gap-y-1 py-1">
                <Text        
                  as="div"
                  className="flex flex-col gap-y-1 whitespace-pre-wrap [overflow-wrap:anywhere] md:max-w-4xl">
                  <div>
                    {renderAnnotatedText({msg:msg, ar:annotRanges})}
                  </div>
                </Text>
              </div>

              {//This was an old rendering pipeline. 
              //<MessageContent isLast={isLast} message={message} onRetry={onRetry} />
              }

              {/* {annotations.map((annotation, index) => (
                <div key={index} className='bg-secondary-50 p-1 my-1'>
                  <span className='font-bold'>{annotation.text}</span>: {annotation.annotation}
                </div>
              ))} */}
           

            {Object.values(annotDict).map((annotation, index) => (
                <div id='annots' key={index} className='bg-secondary-50 p-1 my-1'>
                  <span className='font-bold'>{annotation.text}</span>: {annotation.annotation}
                </div>
              ))}
            </div>

            

            <div
              className={cn('flex h-full items-end justify-end self-end', {
                'hidden md:invisible md:flex':
                  !isFulfilledMessage(message) && !isUserMessage(message),
                'hidden md:invisible md:flex md:group-hover:visible': !isLast,
              })}
            >
              {hasSteps && (
                <Tooltip label={`${isStepsExpanded ? 'Hide' : 'Show'} steps`} hover>
                  <IconButton
                    iconName="list"
                    className="rounded hover:bg-secondary-100"
                    iconClassName={cn(
                      'text-volcanic-800 group-hover/icon-button:text-secondary-800',
                      {
                        'hidden md:invisible md:flex': !isFulfilledMessage(message),
                      }
                    )}
                    onClick={() => setIsStepsExpanded((prevIsExpanded) => !prevIsExpanded)}
                  />
                </Tooltip>
              )}
              <CopyToClipboardIconButton value={getMessageText()} onClick={onCopy} />
            </div>
          </div>
        </div>
      </div>
    </div>
  );
});
export default MessageRow;