Ë
    ³Œj3  ã                  óh   — d Z ddlmZ ddlZddlZddlmZ	 ddlm
Z dd„Zdd„Z	 	 	 	 	 	 dd	„Zg d
¢Zy)ziPublic UUID v7 helpers.

These helpers expose utilities for generating UUID v7 identifiers in user code.
é    )ÚannotationsNé   )Úuuid7)Úuuid7_deterministicc                 ó   — t        «       S )zfGenerate a random UUID v7.

    Returns:
        uuid.UUID: A random, RFC 9562-compliant UUID v7.
    )Ú_uuid7© ó    úX/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langsmith/uuid.pyr   r      s   € ô ‹8€Or
   c                ó¼   — | j                   €*| j                  t        j                  j                  ¬«      } t        | j                  «       dz  «      }t        |«      S )z×Generate a UUID v7 from a datetime.

    Args:
        dt: A timezone-aware datetime. If naive, it is treated as UTC.

    Returns:
        uuid.UUID: A UUID v7 whose timestamp corresponds to the provided time.
    )Útzinfoi Êš;)r   ÚreplaceÚ_dtÚtimezoneÚutcÚintÚ	timestampr   )ÚdtÚnanosecondss     r   Úuuid7_from_datetimer      sH   € ð 
‡y�yÐØ�Z‰ZœsŸ|™|×/Ñ/ˆZÓ0ˆÜ�b—l‘l“n }Ñ4Ó5€KÜ�+ÓÐr
   c                óÄ   — t        |t        «      r|st        d«      ‚t        j                  t        | «      «      }|j
                  dk7  rt        d«      ‚t        ||«      S )a‹  Compute the run ID used for a secondary tracing replica.

    Args:
        run_id: The original UUID v7 run ID.
        project_name: The secondary replica's destination project name.

    Returns:
        uuid.UUID: The run ID used in the secondary replica destination.

    Raises:
        ValueError: If ``run_id`` is not UUID v7, or if ``project_name`` is
            empty or invalid.
    z'project_name must be a non-empty stringé   zrun_id must be a UUID v7)Ú
isinstanceÚstrÚ
ValueErrorÚ_uuidÚUUIDÚversionÚ_uuid7_deterministic)Úrun_idÚproject_nameÚparsed_run_ids      r   Ú$compute_run_id_for_secondary_replicar#   '   sU   € ô  �l¤CÔ(±ÜÐBÓCÐCä—J‘Jœs 6›{Ó+€MØ×Ñ Ò!ÜÐ3Ó4Ð4Ü ¨|Ó<Ð<r
   )r#   r   r   )Úreturnú
_uuid.UUID)r   z_dt.datetimer$   r%   )r    z_uuid.UUID | strr!   r   r$   r%   )Ú__doc__Ú
__future__r   Údatetimer   Úuuidr   Ú_internal._uuidr   r   r   r   r   r#   Ú__all__r	   r
   r   Ú<module>r,      sJ   ðñõ
 #ã Û å ,Ý Hóóð=Øð=Ø,/ð=àó=ò2 S�r
   