Ë
    bQbj%  ã            	      ó>  — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZmZ  G d„ d«      Ze G d	„ d
«      «       ZddiZ G d„ d«      Z e«       j%                  d
e«      Z e«       Zd e
ddej%                  d«      rej%                  de«      ne«      ie_        y)z»
WebDriver BiDi speculation module.

Provides events for observing the status of Speculation Rules prefetch
requests initiated by the browser (e.g. via <script type='speculationrules'>).
é    )Úannotations)ÚCallable)Ú	dataclass)ÚAny)ÚEventConfigÚ_EventWrapperÚ_EventManagerc                  ó    — e Zd ZdZdZdZdZdZy)ÚPreloadingStatusa6  
    Status values for a speculation-rules prefetch operation.

    PENDING: The prefetch has been queued but not yet attempted.
    READY:   The prefetch succeeded and the resource is cached.
    SUCCESS: The prefetched navigation was used successfully.
    FAILURE: The prefetch failed or was cancelled.
    ÚpendingÚreadyÚsuccessÚfailureN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚPENDINGÚREADYÚSUCCESSÚFAILURE© ó    ú]/var/www/html/venv/lib/python3.12/site-packages/selenium/webdriver/common/bidi/speculation.pyr   r      s   „ ñð €GØ€EØ€GØ�Gr   r   c                  ó<   — e Zd ZU dZdZded<   dZded<   dZded<   y)ÚPrefetchStatusUpdatedParametersa   
    Event payload emitted when a prefetch status changes.

    Attributes:
        context: The browsing context ID that owns the speculation rule.
        url: The URL being prefetched.
        status: The new prefetch status (see PreloadingStatus).
    Nz
str | NoneÚcontextÚurlz
Any | NoneÚstatus)r   r   r   r   r   Ú__annotations__r   r   r   r   r   r   r   &   s'   … ñð €GˆZÓØ€CˆÓØ€FˆJÔr   r   Úprefetch_status_updatedz!speculation.prefetchStatusUpdatedc                  óB   — e Zd ZU dZi Zded<   d	d„Zd
dd„Zdd„Zd	d„Z	y)ÚSpeculationzABiDi interface for observing Speculation Rules prefetch activity.zdict[str, EventConfig]ÚEVENT_CONFIGSc                óH   — || _         t        || j                  «      | _        y ©N)Ú_connr	   r$   Ú_event_manager)ÚselfÚconns     r   Ú__init__zSpeculation.__init__?   s   € ØˆŒ
Ü+¨D°$×2DÑ2DÓEˆÕr   Nc                ó<   — | j                   j                  |||«      S )a  Add an event handler.

        Args:
            event: The event to subscribe to.
            callback: The callback function to execute on event.
            contexts: The context IDs to subscribe to (optional).

        Returns:
            The callback ID.
        )r(   Úadd_event_handler)r)   ÚeventÚcallbackÚcontextss       r   r-   zSpeculation.add_event_handlerD   s   € ð ×"Ñ"×4Ñ4°U¸HÀhÓOÐOr   c                ó:   — | j                   j                  ||«      S )zŒRemove an event handler.

        Args:
            event: The event to unsubscribe from.
            callback_id: The callback ID.
        )r(   Úremove_event_handler)r)   r.   Úcallback_ids      r   r2   z Speculation.remove_event_handlerQ   s   € ð ×"Ñ"×7Ñ7¸¸{ÓKÐKr   c                ó6   — | j                   j                  «       S )zClear all event handlers.)r(   Úclear_event_handlers)r)   s    r   r5   z Speculation.clear_event_handlersZ   s   € à×"Ñ"×7Ñ7Ó9Ð9r   )ÚreturnÚNoner&   )r.   Ústrr/   r   r0   zlist[str] | Noner6   Úint)r.   r8   r3   r9   r6   r7   )
r   r   r   r   r$   r    r+   r-   r2   r5   r   r   r   r#   r#   ;   s'   … ÙKà,.€MÐ)Ó.óFô
PóLô:r   r#   ÚPrefetchStatusUpdatedN)r   Ú
__future__r   Úcollections.abcr   Údataclassesr   Útypingr   Ú-selenium.webdriver.common.bidi._event_managerr   r   r	   r   r   ÚEVENT_NAME_MAPPINGr#   ÚglobalsÚgetÚdictr:   Ú_globalsr$   r   r   r   ú<module>rE      s³   ðñõ #å $Ý !Ý ç cÑ c÷ñ ð  ÷ð ó ðð" ÐBðÐ ÷!:ñ !:ñJ  ›	Ÿ™Ð&GÈÓNÐ ñ ‹9€à™{Ø!Ø+Ø7?·|±|ÐD[Ô7\ˆ�‰Ð,¨dÔ3Ðbfó ð€Õ r   