
    i              	          d dl Z d dlmZ d dlmZ e j
                  j                  dd      j                         dk7  r%d dlm	Z	  e
e	dd      Z e
e	d	d      Z eee
      Znd dlZ ej                  d      Zd dlmZ ej$                  j&                  Zd Zeej$                  _        erd dlmZ d dlmZ d dlmZmZmZ d dlmZm 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) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z7 d dl8m9Z9 d dl:m;Z; d d l<m=Z= d d!l>m?Z?m@Z@ i d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d/d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJZAdKeBfdLZCg dMZDy)N    N)TYPE_CHECKING)setup_loggingBROWSER_USE_SETUP_LOGGINGtruefalse)CONFIGBROWSER_USE_DEBUG_LOG_FILEBROWSER_USE_INFO_LOG_FILE)debug_log_fileinfo_log_filebrowser_use)base_subprocessc                     	 t        | d      r'| j                  r| j                  j                         ryt        |        y# t        $ r}dt        |      v rn Y d}~yd}~ww xY w)zPatched __del__ that handles closed event loops without throwing noisy red-herring errors like RuntimeError: Event loop is closed_loopNzEvent loop is closed)hasattrr   	is_closed_original_delRuntimeErrorstr)selfes     ^/mnt/e/genesis-system/.venvs/browser-army/lib/python3.12/site-packages/browser_use/__init__.py_patched_delr      sX    	T7

tzz/C/C/E	 	s1v% 	s   2A A 	A#
AA#)SystemPrompt)Agent)ActionModelActionResultAgentHistoryList)BrowserProfileBrowserSession)r    )	CodeAgent)
DomService)models)ChatAnthropic)ChatAzureOpenAI)ChatBrowserUse)
ChatGoogle)ChatGroq)ChatMistral)
ChatOCIRaw)
ChatOllama)
ChatOpenAI)
ChatVercel)sandbox)
ControllerToolsr!   )zbrowser_use.code_use.servicer!   r   )zbrowser_use.agent.servicer   r   )zbrowser_use.agent.promptsr   r   )browser_use.agent.viewsr   r   )r1   r   r   )r1   r   r    )browser_use.browserr    Browserr   )r2   r   r0   )browser_use.tools.servicer0   r/   )r4   r/   r"   )zbrowser_use.dom.servicer"   r,   )zbrowser_use.llm.openai.chatr,   r'   )zbrowser_use.llm.google.chatr'   r$   )zbrowser_use.llm.anthropic.chatr$   r&   )z browser_use.llm.browser_use.chatr&   r(   )zbrowser_use.llm.groq.chatr(   )zbrowser_use.llm.mistral.chatr)   )zbrowser_use.llm.azure.chatr%   )zbrowser_use.llm.oci_raw.chatr*   )zbrowser_use.llm.ollama.chatr+   )zbrowser_use.llm.vercel.chatr-   )zbrowser_use.llm.modelsN)zbrowser_use.sandboxr.   )r)   r%   r*   r+   r-   r#   r.   namec           	          | t         v r;t         |    \  }}	 ddlm}  ||      }||}nt        ||      }|t	               | <   |S t        dt         d|  d	      # t
        $ r}t        d|  d| d|       |d}~ww xY w)
zKLazy import mechanism - only import modules when they're actually accessed.r   )import_moduleNzFailed to import z from z: zmodule 'z' has no attribute '')_LAZY_IMPORTS	importlibr7   getattrglobalsImportErrorAttributeError__name__)r5   module_path	attr_namer7   moduleattrr   s          r   __getattr__rD   n   s    M(.+yP&+&6D69%D79T?
; 
*>tfAFGG 
 P	(f[MA3G	HaOPs   -A 	A=#A88A=)r   r!   r    r3   r   r/   r"   r   r   r   r   r,   r'   r$   r&   r(   r)   r%   r*   r+   r-   r0   r/   r#   r.   )Eostypingr   browser_use.logging_configr   environgetlowerbrowser_use.configr   r;   r   r   loggerlogging	getLoggerasyncior   BaseSubprocessTransport__del__r   r   browser_use.agent.promptsr   browser_use.agent.servicer   browser_use.agent.viewsr   r   r   browser_use.browserr   r    r3   browser_use.code_use.servicer!   browser_use.dom.servicer"   browser_use.llmr#   browser_use.llm.anthropic.chatr$   browser_use.llm.azure.chatr%    browser_use.llm.browser_use.chatr&   browser_use.llm.google.chatr'   browser_use.llm.groq.chatr(   browser_use.llm.mistral.chatr)   browser_use.llm.oci_raw.chatr*   browser_use.llm.ollama.chatr+   browser_use.llm.openai.chatr,   browser_use.llm.vercel.chatr-   browser_use.sandboxr.   browser_use.tools.servicer/   r0   r9   r   rD   __all__     r   <module>rh      s   	   4 ::>>-v6<<>'I& &">E!<dC ~]
S
'

M
* $77??	  3? ' ' / 3, QP?:3/#97<3/54333(8# ;	#
 	
0# ># :# <# D# <# 5# <#  	
0!#" :##& 8'#* <+#, <-#. E/#0 I1#2 63#4 @E=<<+.E#LHc H,rg   