§
    ¬	Êj…7  ã                  ó|   — d Z ddlmZ ddlmZmZmZmZ ddddddœZd	d
dddœZ	 G d„ de¦  «        Z
dd„Zdd„ZdZdS )uO  Proxy translation: ONE reading of the endpoint, ONE road to the engine.

â›” THERE USED TO BE THREE ROADS FOR ONE FACT - where does this session's
traffic go - and the scheme picked between them. SOCKS was routed by writing
``network.proxy.*``; HTTP/HTTPS was handed back for the Playwright driver to
route per channel; HTTP/HTTPS without a driver got different prefs and a
refusal whenever credentials were present. When the Node driver was removed the
middle road stopped existing, and ``proxy=`` with an ``http`` scheme was
accepted and dropped: the page resolved its own DNS and went out on the host
address while the timezone, the locale and the WebRTC candidate had all been
resolved THROUGH the proxy. Announcing one country and connecting from another
is the exact signal this package exists to avoid, manufactured by the package.

Reported from outside on 2026-08-30, and the report is what settled the design:
adding the missing call would have left two roads, which is the shape that
produced the defect. So the other roads are DELETED, not fixed.

**The one road is the engine's ``Browser.setBrowserProxy``.** It has always been
there, it carries credentials, and it covers ``http``, ``https``, ``socks`` and
``socks4`` alike - so the scheme decides nothing any more. ``parse_proxy`` reads
the endpoint once; whoever holds the protocol connection sends the command. A
caller with no connection is not given a second road: ``build_launch_plan``
refuses a proxy and names the wrapper.

What stays here is what was never routing: the prefs that close the channels a
proxied session can still leak through.
é    )Úannotations)ÚAnyÚDictÚ
NamedTupleÚOptionalÚhttpÚhttpsÚsocksÚsocks4)r   r	   r
   Úsocks5r   éP   i»  i8  )r   r	   r
   r   c                  óˆ   — e Zd ZU dZded<   ded<   ded<   ded<   ded<   d	ed
<   edd„¦   «         Zedd„¦   «         Zdd„ZdS )ÚProxyEndpointzEOne proxy, in the terms the engine uses. ``type`` is one of the four.ÚstrÚtypeÚhostÚintÚportÚusernameÚpasswordÚtupleÚbypassÚreturnÚboolc                ó   — | j         dv S )N)r
   r   )r   ©Úselfs    úEC:\Projects\Muse2API\.venv\Lib\site-packages\invisible_core/_proxy.pyÚis_sockszProxyEndpoint.is_socks5   s   € àŒyÐ/Ð/Ð/ó    c                ó8   — t          | j        p| j        ¦  «        S )N)r   r   r   r   s    r   Úhas_credentialszProxyEndpoint.has_credentials9   s   € å�D”MÐ2 T¤]Ñ3Ô3Ð3r    úDict[str, Any]c                óš   — | j         | j        | j        t          | j        ¦  «        dœ}| j        r
| j        |d<   | j        r
| j        |d<   |S )zÝThe params of ``Browser.setBrowserProxy`` / ``setContextProxy``.

        Credentials are OMITTED rather than sent empty: the engine declares
        them Optional, and an empty string is a value, not an absence.
        )r   r   r   r   r   r   )r   r   r   Úlistr   r   r   )r   Úparamss     r   Úas_engine_commandzProxyEndpoint.as_engine_command=   s]   € ð +/¬)¸T¼YØ*.¬)½tÀDÄKÑ?PÔ?Pð"Rð "RˆàŒ=ð 	/Ø!%¤ˆF�:ÑØŒ=ð 	/Ø!%¤ˆF�:ÑØˆr    N)r   r   )r   r#   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__Úpropertyr   r"   r'   © r    r   r   r   +   s¤   € € € € € € ØOÐOà€I€I�IØ€I€I�IØ€I€I�IØ€M€M�MØ€M€M�MØ€M€M�Màð0ð 0ð 0ñ „Xð0ð ð4ð 4ð 4ñ „Xð4ðð ð ð ð ð r    r   ÚproxyúOptional[Dict[str, Any]]r   úOptional[ProxyEndpoint]c                ó<  — | sdS t          |                      d¦  «        pd¦  «                             ¦   «         }|r|                     ¦   «         dk    rdS |}d}d|v r-|                     dd¦  «        \  }}|                     ¦   «         }|t
          vr=t          d|›d	|›d
d                     t          t
          ¦  «        ¦  «        ›�¦  «        ‚t
          |         }|                     dd¦  «        d         }| 	                    d¦  «        rE| 
                    d¦  «        \  }}}|dd…         | 	                    d¦  «        r
|dd…         nd}}n"d|v r|                     d¦  «        \  }}}n|d}}|st          d|z  ¦  «        ‚|rS	 t          |¦  «        }	n # t          $ r t          d|z  ¦  «        ‚w xY wd|	cxk    rdk    sn t          d|z  ¦  «        ‚nt          |         }	|                      d¦  «        }
t          |
t           ¦  «        rd„ |
                     d¦  «        D ¦   «         }
t          |||	t          |                      d¦  «        pd¦  «        t          |                      d¦  «        pd¦  «        t!          |
pd¦  «        ¬¦  «        S )ao  The ONE place that reads what the caller wrote. Raises, never guesses.

    ``None`` means "no proxy was asked for", which is the only case a caller may
    treat as "carry on". Anything present and unreadable RAISES, because the
    caller cannot otherwise tell that apart from a proxy that was silently
    dropped - and a dropped proxy has to stop the launch.
    NÚserverÚ z	direct://r   z://é   zproxy server z uses scheme z4, which the engine cannot express. It takes one of: z, ú/r   ú[ú]ú:zproxy server %r names no hostz/proxy server %r has a port that is not a numberiÿÿ  z*proxy server %r has a port outside 1-65535r   c                ó^   — g | ]*}|                      ¦   «         ¯|                      ¦   «         ‘Œ+S r.   )Ústrip)Ú.0Úbs     r   ú
<listcomp>zparse_proxy.<locals>.<listcomp>„   s-   € ÐDÐDÐD ¸!¿'º'¹)¼)ÐD�!—'’'‘)”)ÐDÐDÐDr    ú,r   r   r.   )r   r   r   r   r   r   )r   Úgetr;   ÚlowerÚsplitÚ_PROXY_TYPESÚ
ValueErrorÚjoinÚsortedÚ
startswithÚ	partitionÚ
rpartitionr   Ú_DEFAULT_PORTÚ
isinstancer   r   )r/   r3   ÚrestÚschemeÚkindr   Ú_ÚtailÚ	port_textr   r   s              r   Úparse_proxyrR   L   sø  € ð ð ØˆtÝ�—’˜8Ñ$Ô$Ð*¨Ñ+Ô+×1Ò1Ñ3Ô3€FØð �V—\’\‘^”^ {Ò2Ð2Øˆtà€DØ€FØ�€}€}Ø—z’z %¨Ñ+Ô+‰ˆ�Ø—’‘”ˆØ•\Ð!Ð!Ýˆjð ˆvˆv�v�v�v˜tŸyšy­µÑ)=Ô)=Ñ>Ô>Ð>ð@ñAô Að 	Aõ ˜Ô€Dà�:Š:�c˜1ÑÔ˜aÔ €DØ‡‚�sÑÔð #ØŸš sÑ+Ô+‰ˆˆa�Ø˜q˜r˜rœ(°·²ÀÑ1EÔ1EÐ%M T¨!¨"¨"¤X XÈ2ˆiˆˆØ	�ˆˆð "Ÿ_š_¨SÑ1Ô1Ñˆˆa��à ˆiˆØð CÝÐ8¸6ÑAÑBÔBÐBàð 
#ð	LÝ�y‘>”>ˆDˆDøÝð 	Lð 	Lð 	LÝØAÀFÑJñLô Lð Lð	Løøøð �DÐ!Ð!Ò!Ð!˜EÒ!Ð!Ð!Ð!ÝØ<¸vÑEñGô Gð Gð "õ ˜TÔ"ˆà�YŠY�xÑ Ô €FÝ�&�#ÑÔð EØDÐD V§\¢\°#Ñ%6Ô%6ÐDÑDÔDˆÝ˜d¨°DÝ"% e§i¢i°
Ñ&;Ô&;Ð&A¸rÑ"BÔ"BÝ"% e§i¢i°
Ñ&;Ô&;Ð&A¸rÑ"BÔ"BÝ % f l°Ñ 3Ô 3ð5ñ 5ô 5ð 5s   ÆF ÆF;úOptional[Dict[str, str]]Úprefsr#   c                ód   — t          | ¦  «        €dS t          | ¦  «        }d|d<   d|d<   d|d<   |S )u  Validate the endpoint, close the leak channels, hand it on. NO routing.

    â›” THIS WRITES NO ``network.proxy.*``, AND THAT IS THE POINT. Routing is the
    engine command, sent by whoever holds the connection, for every scheme
    alike - see the module docstring for the three roads this replaced and the
    defect they produced.

    What remains is what was never routing: the prefs below close the channels
    a proxied session can still leak through. They were already applied to both
    schemes and they still are, unchanged.

    Returns the endpoint dict so the caller can hand it to the client that
    sends the command, ``None`` when no proxy was asked for. An unreadable
    endpoint RAISES: a caller cannot tell "none" from "dropped", and dropped
    has to stop the launch.
    NFznetwork.proxy.allow_bypassTz$zoom.stealth.dns.no_local_resolutionz!zoom.stealth.webrtc.no_direct_udp)rR   Údict)r/   rT   Úresults      r   Úconfigure_proxyrX   ‹   sQ   € õ( �5ÑÔÐ!Øˆtõ4 �%‰[Œ[€FðX +0€EÐ
&Ñ'ð4 59€EÐ
0Ñ1ð 26€EÐ
-Ñ.Ø€Mr    FN)r/   r0   r   r1   )r/   rS   rT   r#   r   rS   )r+   Ú
__future__r   Útypingr   r   r   r   rC   rJ   r   rR   rX   ÚUDP_GOES_THROUGH_SOCKSr.   r    r   ú<module>r\      sÝ   ððð ð6 #Ð "Ð "Ð "Ð "Ð "à 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2ð ¨Ø ¨G¸xðIð I€ð  c°DÀDÐIÐI€ðð ð ð ð �Jñ ô ð ðB<5ð <5ð <5ð <5ð~Eð Eð Eð Eðn Ð Ð Ð r    