
    -e                    R    d Z ddlmZ ddlZ ej        e          ZdZd
dZd
d	Z	dS )z6 Internal utility functions used by ``bokeh.client``

    )annotationsN)server_url_for_websocket_urlwebsocket_url_for_server_urlurlstrreturnc                   |                      d          rd| dd         z   }n5|                      d          rd| dd         z   }nt          d| z             |                    d	          st          d
          |dd         S )ag   Convert an ``ws(s)`` URL for a Bokeh server into the appropriate
    ``http(s)`` URL for the websocket endpoint.

    Args:
        url (str):
            An ``ws(s)`` URL ending in ``/ws``

    Returns:
        str:
            The corresponding ``http(s)`` URL.

    Raises:
        ValueError:
            If the input URL is not of the proper form.

    zws:http   Nzwss:https   zURL has non-websocket protocol /wsz!websocket URL does not end in /ws
startswith
ValueErrorendswithr   reprotocoleds     1lib/python3.11/site-packages/bokeh/client/util.pyr   r   (   s    " ~~e BABB'			 BQRR(:S@AAA  '' ><===    c                    |                      d          rd| dd         z   }n5|                      d          rd| dd         z   }nt          d| z             |                    d	          r|dz   S |d
z   S )a]   Convert an ``http(s)`` URL for a Bokeh server websocket endpoint into
    the appropriate ``ws(s)`` URL

    Args:
        url (str):
            An ``http(s)`` URL

    Returns:
        str:
            The corresponding ``ws(s)`` URL ending in ``/ws``

    Raises:
        ValueError:
            If the input URL is not of the proper form.

    zhttp:ws   Nzhttps:wss   zURL has unknown protocol /r   r   r   s     r   r   r   C   s    " ~~g <c!""g~		!	! <s122w4s:;;;S!! $d""e##r   )r   r   r   r   )
__doc__
__future__r   logging	getLogger__name__log__all__r   r    r   r   <module>r&      sw     # " " " " " g!!   6$ $ $ $ $ $r   