+
    {&j                    r    R t ^ RIHt ^ RIt^ RIHtHt ^ RIt^ RIH	t	H
t
Ht RtR R ltR R	 ltR
 R ltR# )ui  
XAntibot visitor gate — same behavior as xantibot-blocker.php (session + API).
Env:
  XANTIBOT_API_KEY     — required for checks (omit or XANTIBOT_DISABLED=1 to skip)
  XANTIBOT_DISABLED    — 1 / true / yes
  XANTIBOT_REDIRECT_BOT — default https://www.google.com
  XANTIBOT_REDIRECT_REAL — optional URL for “real” users (like PHP $redirectReal)
)annotationsN)AnyOptional)redirectrequestsessionz#https://xantibot.net/api/ip-antibotc                   V ^8  d   QhRR/# )   returnstr )formats   "7C:\Users\Rick\Downloads\siiiic_files\scii 2\xantibot.py__annotate__r      s     , ,C ,    c                     R F^  p \         P                  P                  V 4      pV'       g   K,  VP                  R4      ^ ,          P	                  4       pV'       g   K\  Vu # 	  \         P
                  ;'       g    R# )CF-Connecting-IP,z0.0.0.0)r   zX-Forwarded-Forz	X-Real-IPzX-Client-IP)r   headersgetsplitstripremote_addr)headervalips      r   
_client_ipr      sd     oo!!&)33"((*Br	 ++)+r   c                    V ^8  d   QhRRRR/# )r	   
header_valr   r
   r   )r   s   "r   r   r   #   s        r   c                4  a V '       g   R # / oV P                  R4       F  pVP                  4       pV'       g   K  RpRVP                  4       9   dk    VP                  R^4      w  rEVP                  4       pRVP                  4       9   d1   \        VP                  R^4      ^,          P                  4       4      pV'       g   K  VSV&   K  	  \        SP                  4       V3R lRR	7      pRP                  V4      #   \        \
        3 d    Rp LYi ; i)
 r   g      ?z;q=;zq==c                   < SV ,          # )Nr   )klangss   &r   <lambda>)_accept_language_sorted.<locals>.<lambda>6   s	    qr   T)keyreverse)	r   r   lowerfloat
ValueError
IndexErrorsortedkeysjoin)r   rawpartqcodeqvorderedr%   s   &      @r   _accept_language_sortedr7   #   s     E$yy{DJJL ::c1-zz|288:%bhhsA.q1779:A 4E$K % UZZ\'94HG88G 
+ s   A)DDDc                   V ^8  d   QhRR/# )r	   r
   zOptional[Any]r   )r   s   "r   r   r   :   s     : := :r   c                    \         P                  P                  R R4      P                  4       R9   d   R# \         P                  P                  R4      ;'       g    RP	                  4       p \         P                  P                  R4      ;'       g    RP	                  4       p\         P                  P                  R4      ;'       g    RP	                  4       pV '       g   R# \
        P                  ! R4      RJ d   \        VR	R
7      # \
        P                  ! R4      '       d   V'       d   \        VR	R
7      # R# \        P                  P                  4        UUu/ uF  w  r4VP                  4       VbK  	  pppR\        4       RV /pVP                  R4      pV'       d   \        V4      VR&   VP                  R4      pV'       d   WR&    \        P                  ! \        V^
R7      p	V	P                  4       p
\!        T
\"        4      '       d   T
P                  R4      R8X  dx   T
P                  R/ 4      P                  R4      pT^8X  d    R\
        R&   R\
        R&   \        TR	R
7      # T^ 8X  d
   R\
        R&   R\
        R&   T'       d   \        TR	R
7      # R# R\
        R&   R\
        R&   T'       d   \        TR	R
7      # R# u uppi   \         d.    R\
        R&   R\
        R&   T'       d   \        TR	R
7      u #  R# i ; i)XANTIBOT_DISABLEDr    NXANTIBOT_API_KEYXANTIBOT_REDIRECT_BOTzhttps://www.google.comXANTIBOT_REDIRECT_REALxantibot_botTi.  )r4   xantibot_checkedr   apikeyzaccept-languagelangz
user-agent	useragent)paramstimeoutFstatussuccessdata
is_blocked)1trueyest)osenvironr   r*   r   r   r   r   r   itemsr   r7   requestsAPI_URLjson	Exception
isinstancedict)api_keyredirect_botredirect_realr$   v
headers_lcrC   aluarrG   blockeds               r   run_xantibot_gater_   :   st   	zz~~)2.446:SSzz~~0177R>>@GJJNN#:;WW?W^^`LZZ^^$<=CCJJLM{{>"d*3//{{%&&M44+2??+@+@+BC+B41!'')Q,+BJCjl'F 
)	*B	04v		%B	 {LL<vvx $$((8"4	"A((62&**<8a<&*GN#*.G&'Ls33a<&+GN#&*"#M44"&G#GNC00O D  &*"#"'M44s    K-K $L	6L	L	)__doc__
__future__r   rM   typingr   r   rP   flaskr   r   r   rQ   r   r7   r_   r   r   r   <module>rd      s2    # 	    , ,
/,.:r   