§
    šŠtjy  ã                  ó¦   — d dl mZ d dlmZmZ d dlmZ d dlmZm	Z	 d dl
mZmZmZ d dlmZ d dlmZmZ  G d„ d	e¦  «        Z G d
„ de¦  «        ZdS )é    )Úannotations)ÚOptionalÚType)Úurlparse)ÚAsyncCallbackManagerForToolRunÚCallbackManagerForToolRun)Ú	BaseModelÚFieldÚmodel_validator)ÚBaseBrowserTool)Úaget_current_pageÚget_current_pagec                  ót   — e Zd ZU dZ edd¬¦  «        Zded<    ed¬¦  «        edd„¦   «         ¦   «         Z	dS )ÚNavigateToolInputzInput for NavigateToolInput..zurl to navigate to)ÚdescriptionÚstrÚurlÚbefore)ÚmodeÚvaluesÚdictÚreturnc                ó~   — |                      d¦  «        }t          |¦  «        }|j        dvrt          d¦  «        ‚|S )z#Check that the URL scheme is valid.r   )ÚhttpÚhttpsz$URL scheme must be 'http' or 'https')Úgetr   ÚschemeÚ
ValueError)Úclsr   r   Ú
parsed_urls       úk/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_community/tools/playwright/navigate.pyÚvalidate_url_schemez%NavigateToolInput.validate_url_scheme   sC   € ð �jŠj˜ÑÔˆÝ˜c‘]”]ˆ
ØÔÐ$5Ð5Ð5ÝÐCÑDÔDÐDØˆó    N)r   r   r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r   Ú__annotations__r   Úclassmethodr"   © r#   r!   r   r      ss   € € € € € € Ø&Ð&àˆu�SÐ&:Ð;Ñ;Ô;€CÐ;Ð;Ð;Ñ;à€_˜(Ð#Ñ#Ô#Øðð ð ñ „[ñ $Ô#ðð ð r#   r   c                  óV   — e Zd ZU dZdZded<   dZded<   eZded<   	 ddd„Z		 ddd„Z
d	S )ÚNavigateToola  Tool for navigating a browser to a URL.

    **Security Note**: This tool provides code to control web-browser navigation.

        This tool can navigate to any URL, including internal network URLs, and
        URLs exposed on the server itself.

        However, if exposing this tool to end-users, consider limiting network
        access to the server that hosts the agent.

        By default, the URL scheme has been limited to 'http' and 'https' to
        prevent navigation to local file system URLs (or other schemes).

        If access to the local file system is required, consider creating a custom
        tool or providing a custom args_schema that allows the desired URL schemes.

        See https://python.langchain.com/docs/security for more information.
    Únavigate_browserr   Únamez'Navigate a browser to the specified URLr   zType[BaseModel]Úargs_schemaNr   Úrun_managerú#Optional[CallbackManagerForToolRun]r   c                ó¶   — | j         €t          d| j        › �¦  «        ‚t          | j         ¦  «        }|                     |¦  «        }|r|j        nd}d|› d|› �S )úUse the tool.Nz$Synchronous browser not provided to ÚunknownúNavigating to ú returned status code )Úsync_browserr   r.   r   ÚgotoÚstatus©Úselfr   r0   ÚpageÚresponser9   s         r!   Ú_runzNavigateTool._run;   sk   € ð ÔÐ$ÝÐOÀDÄIÐOÐOÑPÔPÐPÝ Ô 1Ñ2Ô2ˆØ—9’9˜S‘>”>ˆØ$,Ð;�”�°)ˆØC ÐCÐC¸6ÐCÐCÐCr#   ú(Optional[AsyncCallbackManagerForToolRun]c              ƒ  óÒ   K  — | j         €t          d| j        › �¦  «        ‚t          | j         ¦  «        ƒ d{V —†}|                     |¦  «        ƒ d{V —†}|r|j        nd}d|› d|› �S )r3   Nz%Asynchronous browser not provided to r4   r5   r6   )Úasync_browserr   r.   r   r8   r9   r:   s         r!   Ú_arunzNavigateTool._arunH   s“   è è € ð ÔÐ%ÝÐPÀTÄYÐPÐPÑQÔQÐQÝ& tÔ'9Ñ:Ô:Ð:Ð:Ð:Ð:Ð:Ð:ˆØŸš 3™œÐ'Ð'Ð'Ð'Ð'Ð'ˆØ$,Ð;�”�°)ˆØC ÐCÐC¸6ÐCÐCÐCr#   )N)r   r   r0   r1   r   r   )r   r   r0   r?   r   r   )r$   r%   r&   r'   r.   r(   r   r   r/   r>   rB   r*   r#   r!   r,   r,   #   s    € € € € € € ðð ð& #€DÐ"Ð"Ð"Ñ"Ø@€KÐ@Ð@Ð@Ñ@Ø#4€KÐ4Ð4Ð4Ñ4ð
 <@ðDð Dð Dð Dð Dð  AEðDð Dð Dð Dð Dð Dð Dr#   r,   N)Ú
__future__r   Útypingr   r   Úurllib.parser   Úlangchain_core.callbacksr   r   Úpydanticr	   r
   r   Ú)langchain_community.tools.playwright.baser   Ú*langchain_community.tools.playwright.utilsr   r   r   r,   r*   r#   r!   ú<module>rJ      s+  ðØ "Ð "Ð "Ð "Ð "Ð "à !Ð !Ð !Ð !Ð !Ð !Ð !Ð !Ø !Ð !Ð !Ð !Ð !Ð !ðð ð ð ð ð ð ð ð 7Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6à EÐ EÐ EÐ EÐ EÐ Eðð ð ð ð ð ð ð ðð ð ð ð ˜	ñ ô ð ð 0Dð 0Dð 0Dð 0Dð 0D�?ñ 0Dô 0Dð 0Dð 0Dð 0Dr#   