
    afRC                       d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d dl	Z	d dl
mZ d dlmZmZ d dlmZ 	 d dlZd dlZd dlmZ dZn# e$ r d	ZY nw xY wd
Z e j        d          Z e j        d          Z e j        d          Z e j        d          Z e j        d          Z e j        d          Z e j        d          Z e j        d          Z  e j        d          Z! e j        d          Z" e j        d          Z#dZ$dZ%dZ&e$e%e&gZ'g dZ(d Z)dZ*dZ+dZ,e)de*de+de,diZ-d e-.                                D             Z/d Z0dZ1dZ2dZ3dZ4d Z5d!Z6e0de1d"e2d#e3d$e4d%e5d&e6d'iZ7d( e7.                                D             Z8d) Z9d* Z:dod,Z;d-ed.ee<         fd/Z=	 	 	 dpd-ed1e<d2e>d3e>d4e>d5e>d.e<fd6Z?dqd7Z@drd-ed1e<d.eAfd8ZBdrd-ed1e<d.ee<ef         fd9ZCdrd:ZD G d; d<eE          ZF G d= d>eF          ZG G d? d@eF          ZH G dA dBeF          ZI G dC dDeF          ZJ G dE dFeF          ZK G dG dHeF          ZL G dI dJeF          ZM G dK dLeF          ZN G dM dNeF          ZO G dO dPeF          ZP G dQ dReF          ZQ G dS dTeF          ZR G dU dVeF          ZS G dW dXeF          ZT G dY dZeF          ZU G d[ d\eF          ZV G d] d^eF          ZW G d_ d`eF          ZX G da dbeF          ZY G dc ddeF          ZZ G de dfeF          Z[ G dg dheF          Z\ G di djeF          Z] G dk dleF          Z^ G dm dneF          Z_dS )s    N)pformat)AnyDictOptional)hlval)ProtocolErrorInvalidUriError)ROLE_NAME_TO_CLASS)message_fbsTF)#MessageHelloWelcomeAbort	ChallengeAuthenticateGoodbyeErrorPublish	Published	Subscribe
SubscribedUnsubscribeUnsubscribedEventCallCancelResultRegister
Registered
UnregisterUnregistered
Invocation	InterruptYieldcheck_or_raise_uricheck_or_raise_realm_namecheck_or_raise_idcheck_or_raise_extrais_valid_enc_algois_valid_enc_serializeridentify_realm_name_categoryPAYLOAD_ENC_CRYPTO_BOXPAYLOAD_ENC_MQTT PAYLOAD_ENC_STANDARD_IDENTIFIERSz!^[A-Za-z][A-Za-z\d_\-@\.]{2,254}$z^0x([A-Fa-f\d]{40})$z^([a-z\d_\-@\.]{2,250})\.eth$z^eth\.([a-z\d_\-@\.]{2,250})$z!^(([\da-z_]+\.)|\.)*([\da-z_]+)?$z!^(([^\s\.#]+\.)|\.)*([^\s\.#]+)?$z^([\da-z_]+\.)*([\da-z_]+)$z^([^\s\.#]+\.)*([^\s\.#]+)$z^([\da-z_]+\.)*([\da-z_]*)$z^([^\s\.#]+\.)*([^\s\.#]*)$z^x_([a-z][\da-z_]+)?$	cryptoboxmqttxbr)jsonmsgpackcborubjsonflatbuffers         nullc                     i | ]\  }}||	S  r<   .0valuekeys      G/var/www/html/env/lib/python3.11/site-packages/autobahn/wamp/message.py
<dictcomp>rB      s    DDDJE3S%DDD             r2   r3   r4   r5   opaquer6   c                     i | ]\  }}||	S r<   r<   r=   s      rA   rB   rB      s    BBB:5#CBBBrC   c                 x    t          |           t          k    o"| t          v pt                              |           S )a'  
    For WAMP payload transparency mode, check if the provided ``enc_algo``
    identifier in the WAMP message is a valid one.

    Currently defined standard identifiers are:

    * ``"cryptobox"``
    * ``"mqtt"``
    * ``"xbr"``

    Users can select arbitrary identifiers too, but these MUST start with ``"x_"``.

    :param enc_algo: The payload transparency algorithm identifier to check.
    :type enc_algo: str

    :returns: Returns ``True`` if and only if the payload transparency
        algorithm identifier is valid.
    :rtype: bool
    )typestrr.   _CUSTOM_ATTRIBUTEmatch)enc_algos    rA   r)   r)      s5    ( >>S xh2R&R&wVgVmVmnvVwVwxrC   c                 x    t          |           t          k    o"| t          v pt                              |           S )am  
    For WAMP payload transparency mode, check if the provided ``enc_serializer``
    identifier in the WAMP message is a valid one.

    Currently, the only standard defined identifier are

    * ``"json"``
    * ``"msgpack"``
    * ``"cbor"``
    * ``"ubjson"``
    * ``"flatbuffers"``

    Users can select arbitrary identifiers too, but these MUST start with ``"x_"``.

    :param enc_serializer: The payload transparency serializer identifier to check.
    :type enc_serializer: str

    :returns: Returns ``True`` if and only if the payload transparency
        serializer identifier is valid.
    :rtype: bool
    )rJ   rK    PAYLOAD_ENC_STANDARD_SERIALIZERSrL   rM   )enc_serializers    rA   r*   r*      sL    , 3&  KN>^,^  -Jbsbyby  {I  cJ  cJ  KrC   (   c                 0   t          |           t          k    r| }nZt          |           t          k    r(t          j        |                               d          }n| d}nd                    |           }t          |          |k    r|d |         dz   S |S )Nascii-z{}z..)rJ   rK   bytesbinasciib2a_hexdecodeformatlen)datamax_lenss      rA   b2ar_      s    DzzS	du		T""))'22	KK
1vv'{T!!rC   r?   returnc                    t          |           t          k    rdS t                              |           r:t                              |           rdS t
                              |           rdS dS t                              |           rdS dS )az  
    Identify the real name category of the given value:

    * ``"standalone"``: A normal, standalone WAMP realm name, e.g. ``"realm1"``.
    * ``"eth"``: An Ethereum address, e.g. ``"0xe59C7418403CF1D973485B36660728a5f4A8fF9c"``.
    * ``"ens"``: An Ethereum ENS name, e.g. ``"wamp-proto.eth"``.
    * ``"reverse_ens"``: An Ethereum ENS name in reverse notation, e.g. ``"eth.wamp-proto"``.
    * ``None``: The value is not a WAMP realm name.

    :param value: The value for which to identify realm name category.
    :return: The category identified, one of ``["standalone", "eth", "ens", "reverse-ens"]``
        or ``None``.
    Nensreverse_ens
standaloneeth)rJ   rK   _URI_PAT_REALM_NAMErM   _URI_PAT_REALM_NAME_ENS_URI_PAT_REALM_NAME_ENS_REVERSE_URI_PAT_REALM_NAME_ETH)r?   s    rA   r+   r+      s     E{{ct  '' 
"((// 	 5,22599 	  =<	 	&	&u	-	- utrC   WAMP message invalidmessagestrictallow_empty_componentsallow_last_empty
allow_nonec                    | &|rdS t          d                    |                    t          |           t          k    r4| |s0t          d                    |t          |                               |r|rt          }n-|rt
          }n#t          }n|rt          }n|rt          }nt          }|
                    |           s-t          d                    || |j        ||||                    | S )a^  
    Check a value for being a valid WAMP URI.

    If the value is not a valid WAMP URI is invalid, raises :class:`autobahn.wamp.exception.InvalidUriError`,
    otherwise returns the value.

    :param value: The value to check.
    :param message: Prefix for message in exception raised when value is invalid.
    :param strict: If ``True``, do a strict check on the URI (the WAMP spec SHOULD behavior).
    :param allow_empty_components: If ``True``, allow empty URI components (for pattern based
       subscriptions and registrations).
    :param allow_last_empty: If ``True``, allow the last URI component to be empty (for prefix based
       subscriptions and registrations).
    :param allow_none: If ``True``, allow ``None`` for URIs.
    :returns: The URI value (if valid).
    :raises: instance of :class:`autobahn.wamp.exception.InvalidUriError`
    Nz{0}: URI cannot be nullz{0}: invalid type {1} for URIz{0}: invalid value "{1}" for URI (did not match pattern "{2}" with options strict={3}, allow_empty_components={4}, allow_last_empty={5}, allow_none={6}))r	   rZ   rJ   rK   _URI_PAT_STRICT_LAST_EMPTY_URI_PAT_STRICT_EMPTY_URI_PAT_STRICT_NON_EMPTY_URI_PAT_LOOSE_LAST_EMPTY_URI_PAT_LOOSE_EMPTY_URI_PAT_LOOSE_NON_EMPTYrM   pattern)r?   rk   rl   rm   rn   ro   pats          rA   r%   r%     sK   ( } 	MF!";"B"B7"K"KLLLE{{c*!"A"H"HRVW\R]R]"^"^___ + 	,,CC# 	,'CC+CC 	++CC# 	+&CC*C99U   y  @  @  AH  JO  QT  Q\  ^d  f|  ~N  PZ  [  [  \  \  	\rC   c                 P   | "t          d                    |                    t          |           t          k    r0t          d                    |t          |                               |rot                              |           st                              |           r| S t          d                    || t          j        t          j                            t                              |           r| S t          d                    || t          j                            )a|  
    Check a value for being a valid WAMP URI.

    If the value is not a valid WAMP URI is invalid, raises :class:`autobahn.wamp.exception.InvalidUriError`,
    otherwise returns the value.

    :param value: The value to check, e.g. ``"realm1"`` or ``"com.example.myapp"`` or ``"eth.example"``.
    :param message: Prefix for message in exception raised when value is invalid.
    :param allow_eth: If ``True``, allow Ethereum addresses as realm names,
        e.g. ``"0xe59C7418403CF1D973485B36660728a5f4A8fF9c"``.
    :returns: The URI value (if valid).
    :raises: instance of :class:`autobahn.wamp.exception.InvalidUriError`
    Nz{0}: realm name cannot be nullz${0}: invalid type {1} for realm namezO{0}: invalid value "{1}" for realm name (did not match patterns "{2}" or "{3}")zE{0}: invalid value "{1}" for realm name (did not match pattern "{2}"))r	   rZ   rJ   rK   rf   rM   ri   rw   )r?   rk   	allow_eths      rA   r&   r&   7  s#    }>EEgNNOOOE{{cDKKGUYZ_U`U`aabbb >$$U++ 	K/F/L/LU/S/S 	KL!""(&%)<)D)@)H#J #JK K K $$U++ 	>L! 3 ;= => > >rC   c                     t          |           t          k    r0t          d                    |t          |                               | dk     s| dk    r#t          d                    ||                     | S )a  
    Check a value for being a valid WAMP ID.

    If the value is not a valid WAMP ID, raises :class:`autobahn.wamp.exception.ProtocolError`,
    otherwise return the value.

    :param value: The value to check.
    :param message: Prefix for message in exception raised when value is invalid.
    :returns: The ID value (if valid).
    :raises: instance of :class:`autobahn.wamp.exception.ProtocolError`
    z{0}: invalid type {1} for IDr   l          z{0}: invalid value {1} for ID)rJ   intr   rZ   )r?   rk   s     rA   r'   r'   ^  su     E{{c:AA'4PU;;WWXXX qyyE,,,;BB7ERRSSSLrC   c           	      P   t          |           t          k    r0t          d                    |t          |                               |                                 D ]H}t          |t                    s1t          d                    |t          |          |                    I| S )a  
    Check a value for being a valid WAMP extra dictionary.

    If the value is not a valid WAMP extra dictionary, raises :class:`autobahn.wamp.exception.ProtocolError`,
    otherwise return the value.

    :param value: The value to check.
    :param message: Prefix for message in exception raised when value is invalid.
    :returns: The extra dictionary (if valid).
    :raises: instance of :class:`autobahn.wamp.exception.ProtocolError`
    z${0}: invalid type {1} for WAMP extraz3{0}: invalid type {1} for key in WAMP extra ('{2}')rJ   dictr   rZ   keys
isinstancerK   )r?   rk   ks      rA   r(   r(   s  s     E{{dBII'SWX]S^S^__```ZZ\\ s s!S!! 	s U \ \]dfjklfmfmop q qrrr	sLrC   c           	      X   | t          |           t          k    r0t          d                    |t          |                               |                                 D ]H}t          |t                    s1t          d                    |t          |          |                    I| S dS )a*  
    Check a value for being a valid WAMP kwargs dictionary.

    If the value is not a valid WAMP kwargs dictionary,
    raises :class:`autobahn.wamp.exception.ProtocolError`.
    Otherwise return the kwargs.

    The WAMP spec requires that the keys in kwargs are proper
    strings (unicode), not bytes. Note that the WAMP spec
    says nothing about keys in application payload. Key in the
    latter can be potentially of other type (if that is really
    wanted).

    :param kwargs: The keyword arguments to check.
    :type kwargs: dict

    :param message: Prefix for message in exception raised when
        value is invalid.
    :type message: str

    :returns: The kwargs dictionary (if valid).
    :rtype: dict

    :raises: instance of
        :class:`autobahn.wamp.exception.ProtocolError`
    Nz%{0}: invalid type {1} for WAMP kwargsz4{0}: invalid type {1} for key in WAMP kwargs ('{2}')r~   )kwargsrk   r   s      rA   _validate_kwargsr     s    6 <<4 G N NwX\]cXdXd e efff 	x 	xAa%% x#$Z$a$abikopqkrkrtu$v$vwwwx rC   c                   X   e Zd ZdZdZ	 dZddZed             Zej	        d             Zed             Z
e
j	        d             Z
ed	             Zej	        d
             Zed             Zej	        d             Zd Zd ZdefdZed             Zd Zed             Zd Zd Zd ZdS )r   zo
    WAMP message base class.

    .. note:: This is not supposed to be instantiated, but subclassed only.
    N	_from_fbs_serialized_correlation_id_correlation_uri_correlation_is_anchor_correlation_is_last_router_internalc                 h    || _         i | _        d | _        d | _        d | _        d | _        d | _        d S Nr   )selffrom_fbss     rA   __init__zMessage.__init__  sE    !   $ $&*#$(! !%rC   c                     | j         S r   )r   r   s    rA   correlation_idzMessage.correlation_id  s    ##rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   rK   r   r   r?   s     rA   r   zMessage.correlation_id  s+    }Us 2 2 22$rC   c                     | j         S r   )r   r   s    rA   correlation_urizMessage.correlation_uri  s    $$rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   rK   r   r   s     rA   r   zMessage.correlation_uri  s+    }Us 2 2 22 %rC   c                     | j         S r   )r   r   s    rA   correlation_is_anchorzMessage.correlation_is_anchor  s    **rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   boolr   r   s     rA   r   zMessage.correlation_is_anchor  s+    }Ut 3 3 33&+###rC   c                     | j         S r   )r   r   s    rA   correlation_is_lastzMessage.correlation_is_last  s    ((rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r   r   r   s     rA   r   zMessage.correlation_is_last  s+    }Ut 3 3 33$)!!!rC   c                     t          || j                  sdS | j        D ]@}|dvr:|                    d          s%t	          | |          t	          ||          k    s dS AdS )z
        Compare this message to another message for equality.

        :param other: The other message to compare with.
        :type other: obj

        :returns: ``True`` iff the messages are equal.
        :rtype: bool
        F)r   r   r   r   r   _T)r   	__class__	__slots__
startswithgetattr)r   otherr   s      rA   __eq__zMessage.__eq__  s     %00 	5 	! 	!A 1 1 1 :;c9J9J	1
 tQ''75!+<+<<< 55trC   c                 .    |                      |           S )z
        Compare this message to another message for inequality.

        :param other: The other message to compare with.
        :type other: obj

        :returns: ``True`` iff the messages are not equal.
        :rtype: bool
        r   r   r   s     rA   __ne__zMessage.__ne__  s     ;;u%%%%rC   r`   c                    d                     t          | j        j                                        dz   dd          t          t          j        t          |                                           d          dd                    S )Nz{}
{}z::blueT)colorboldz    F)	rZ   r   r   __name__uppertextwrapindentr   marshalr   s    rA   __str__zMessage.__str__  st    uT^%<%B%B%D%Dt%KSY`deee$X_WT\\^^5L5Lf%U%U]cjopppr r 	rrC   c                     t                      )a   
        Factory method that parses a unserialized raw message (as returned byte
        :func:`autobahn.interfaces.ISerializer.unserialize`) into an instance
        of this class.

        :returns: An instance of this class.
        :rtype: obj
        NotImplementedError)wmsgs    rA   parsezMessage.parse  s     "###rC   c                     t                      r   r   r   s    rA   r   zMessage.marshal)      !###rC   c                     t                      r   r   bufs    rA   castzMessage.cast,  s    !###rC   c                     t                      r   r   )r   builders     rA   buildzMessage.build0  r   rC   c                     i | _         dS )z1
        Resets the serialization cache.
        N)r   r   s    rA   uncachezMessage.uncache3  s     rC   c                 v   || j         vr|j        dk    rjt          j        d          }|                     |          }|                    |           |                                }t          |          | j         |<   n/|                    | 	                                          | j         |<   | j         |         S )a  
        Serialize this object into a wire level bytes representation and cache
        the resulting bytes. If the cache already contains an entry for the given
        serializer, return the cached representation directly.

        :param serializer: The wire level serializer to use.
        :type serializer: An instance that implements :class:`autobahn.interfaces.ISerializer`

        :returns: The serialized bytes.
        :rtype: bytes
        r6   i   )
r   NAMEr6   Builderr   FinishOutputrV   	serializer   )r   
serializerr   objr   s        rA   r   zMessage.serialize9  s     T----//%-d33 jj))s###nn&&/4Szz ,, 0:/C/CDLLNN/S/S , 
++rC   r   )r   
__module____qualname____doc__MESSAGE_TYPEr   r   propertyr   setterr   r   r   r   r   rK   r   staticmethodr   r   r   r   r   r   r<   rC   rA   r   r     s         L	I% % % %  $ $ X$ % % % % % X% & & & + + X+ !, , "!, ) ) X) * *  *  .
& 
& 
&r r r r r 	$ 	$ \	$$ $ $ $ $ \$$ $ $  , , , , ,rC   r   c                   N    e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 ddZed             Zd Z	dS )	r   zU
    A WAMP ``HELLO`` message.

    Format: ``[HELLO, Realm|uri, Details|dict]``
    r7   )	realmrolesauthmethodsauthidauthrole	authextra	resumableresume_sessionresume_tokenNc
                    |t          |t                    sJ t          |          t          k    sJ t	          |          dk    sJ |D ]:}
|
dv sJ t          ||
         t
          j        j        j        |
                   sJ ;|r9t          |          t          k    sJ |D ]}t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |	t          |	          t          k    sJ t                              |            || _        || _        || _        || _        || _        || _        || _        || _        |	| _        dS )a  

        :param realm: The URI of the WAMP realm to join.
        :type realm: str

        :param roles: The WAMP session roles and features to announce.
        :type roles: dict of :class:`autobahn.wamp.role.RoleFeatures`

        :param authmethods: The authentication methods to announce.
        :type authmethods: list of str or None

        :param authid: The authentication ID to announce.
        :type authid: str or None

        :param authrole: The authentication role to announce.
        :type authrole: str or None

        :param authextra: Application-specific "extra data" to be forwarded to the client.
        :type authextra: dict or None

        :param resumable: Whether the client wants this to be a session that can be later resumed.
        :type resumable: bool or None

        :param resume_session: The session the client would like to resume.
        :type resume_session: int or None

        :param resume_token: The secure authorisation token to resume the session.
        :type resume_token: str or None
        Nr   
subscriber	publishercallercallee)r   rK   rJ   r   r[   autobahnwamproler
   listr   r|   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   
authmethods               rA   r   zHello.__init__r  s   N }
5# 6 6}}6E{{d""""5zzA~~~~ 	Y 	YDJJJJJeDk8=+=+PQU+VWWXXWX 	0$$,,,,) 0 0
J''3.....~f!4!4!444>>S#8#8#88 DOOt$;$;$;; DOOt$;$;$;;%n)=)=)D)D)DD#tL'9'9S'@'@'@@

& "",(rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         dd          }t          | d         d	          }i }d
|vrt          d          t          |d
         d          }t          |          dk    rt          d          |D ]}|dvr"t          d                    |                    t          |         }t          ||         d                    |                    }d|v r8t          |d         d                    |                      |d$i |d         }n
 |            }|||<   d}	d|v r|d         }
t          |
          t          k    r/t          d                    t          |
                              |
D ]I}t          |          t          k    r/t          d                    t          |                              J|
}	d}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d}d|v rO|d         }t          |          t          k    r/t          d                    t          |                              d}d|v rO|d         }t          |          t          k    r/t          d                     t          |                              d}d!|v rP|d!         }t          |          t          k    r/t          d"                    t          |                              n|rt          d#          t          |||	||||||	  	        }|S )%
        Verifies and parses an unserialized raw message into an actual WAMP message instance.

        :param wmsg: The unserialized raw message.
        :type wmsg: list

        :returns: An instance of this class.
        r   r9   z$invalid message length {0} for HELLOr7   z'realm' in HELLOT)ro   r8   z'details' in HELLOr   z5missing mandatory roles attribute in options in HELLOz'roles' in 'details' in HELLOz#empty 'roles' in 'details' in HELLOr   z3invalid role '{0}' in 'roles' in 'details' in HELLOz+role '{0}' in 'roles' in 'details' in HELLOfeaturesz9'features' in role '{0}' in 'roles' in 'details' in HELLONr   z2invalid type {0} for 'authmethods' detail in HELLOz:invalid type {0} for item in 'authmethods' detail in HELLOr   z-invalid type {0} for 'authid' detail in HELLOr   z/invalid type {0} for 'authrole' detail in HELLOr   z0invalid type {0} for 'authextra' detail in HELLOr   z0invalid type {0} for 'resumable' detail in HELLOresume-sessionz5invalid type {0} for 'resume-session' detail in HELLOresume-tokenz3invalid type {0} for 'resume-token' detail in HELLOzDresume-token must be provided if resume-session is provided in HELLOr<   )r[   r   r   r   rZ   r%   r(   r
   rJ   r   rK   r   r   r|   )r   r   detailsr   details_rolesr   role_clsdetails_rolerole_featuresr   details_authmethodsauth_methodr   details_authidr   details_authroler   details_authextrar   r   r   r   s                         rA   r   zHello.parse  s    4yy1}}aE,>!>!>!>>t99>> F M McRVii X XYYY"47,>4PPP&tAw0DEE'!! WXXX,WW-=?^__}"" EFFF! 	( 	(DJJJ#$Y$`$`ae$f$fggg)$/H/d0CErEyEyz~EE  A  AL\))$\*%=?z  @B  @B  CG  @H  @H  I  I  I ( D D<
+C D D !)

'E$KKG##")-"8'((D00#$X$_$_`dex`y`y$z$z{{{2 @ @$$++'(d(k(klpq|l}l}(~(~ , .Kw$X.NN##s**#$S$Z$Z[_`n[o[o$p$pqqq#F  &z2$%%,,#$U$\$\]abr]s]s$t$tuuu'H	'!! ' 4%&&$..#$V$]$]^bct^u^u$v$vwww)I	'!!,II$&&#$V$]$]^bcl^m^m$n$nooow&&$%56NN##s**#$[$b$bcghvcwcw$x$xyyyW$$">2LL!!S((#$Y$`$`aefrasas$t$tuuu )  l#$jkkkE5+vxIWegstt
rC   c                    di i}| j                                         D ]}i |d         |j        <   |j        D ]~}|                    d          sg|dk    rat          ||          Qd|d         |j                 vrdi i|d         |j        <   t          ||          |d         |j                 d         |<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j	        
| j	        |d	<   | j
        
| j
        |d
<   | j        
| j        |d<   | j        
| j        |d<   t          j        | j        |gS )
        Marshal this object into a raw message for subsequent serialization to bytes.

        :returns: The serialized raw message.
        :rtype: list
        r   r   ROLENr   r   r   r   r   r   r   r   )r   valuesr   __dict__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   features       rA   r   zHello.marshal!  s    B-J%%'' 	^ 	^D*,GGTY'= ^ ^))#.. ^7f3D3DQUW^I_I_Ik!)9$))DDD7A26F(3GNtU\G]G]GG$TY/
;GD	^ '%)%5GM";" $GH=$"&-GJ>%#'>GK >%#'>GK *(,(;G$%(&*&7GN#"DJ88rC   )NNNNNNN
r   r   r   r   r   r   r   r   r   r   r<   rC   rA   r   r   Z  s          L
I " $"A) A) A) A)F i i \iV%9 %9 %9 %9 %9rC   r   c                   T    e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 	 	 	 ddZed             Zd Z	dS )	r   zZ
    A WAMP ``WELCOME`` message.

    Format: ``[WELCOME, Session|id, Details|dict]``
    r8   )sessionr   r   r   r   r   authproviderr   resumedr   r   customNc                 h   t          |          t          k    sJ t          |          t          k    sJ t          |          dk    sJ |D ]:}|dv sJ t	          ||         t
          j        j        j        |                   sJ ;|t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |	t          |	          t          k    sJ |
t          |
          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |r!|D ]}t                              |          sJ t                              |            || _        || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _        || _        |pi | _        dS )a0  

        :param session: The WAMP session ID the other peer is assigned.
        :type session: int

        :param roles: The WAMP roles to announce.
        :type roles: dict of :class:`autobahn.wamp.role.RoleFeatures`

        :param realm: The effective realm the session is joined on.
        :type realm: str or None

        :param authid: The authentication ID assigned.
        :type authid: str or None

        :param authrole: The authentication role assigned.
        :type authrole: str or None

        :param authmethod: The authentication method in use.
        :type authmethod: str or None

        :param authprovider: The authentication provided in use.
        :type authprovider: str or None

        :param authextra: Application-specific "extra data" to be forwarded to the client.
        :type authextra: arbitrary or None

        :param resumed: Whether the session is a resumed one.
        :type resumed: bool or None

        :param resumable: Whether this session can be resumed later.
        :type resumable: bool or None

        :param resume_token: The secure authorisation token to resume the session.
        :type resume_token: str or None

        :param custom: Implementation-specific "custom attributes" (`x_my_impl_attribute`) to be set.
        :type custom: dict or None
        r   brokerdealerN)rJ   r|   r   r[   r   r   r   r   r
   rK   r   rL   rM   r   r   r  r   r   r   r   r   r  r   r  r   r   r  )r   r  r   r   r   r   r   r  r   r  r   r   r  r   r   s                  rA   r   zWelcome.__init__d  sT   f G}}####E{{d""""5zzA~~~~ 	Y 	YD/////eDk8=+=+PQU+VWWXXWX}Us 2 2 22~f!4!4!444>>S#8#8#88!T*%5%5%<%<%<<#tL'9'9S'@'@'@@ DOOt$;$;$;;$w--4"7"7"77 DOOt$;$;$;;#tL'9'9S'@'@'@@~f!5!5!55 	3 3 3(..q112212

 $(""(lrC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }|                    dd	          }|                    d
d	          }|                    dd	          }|                    dd	          }|                    dd	          }|                    dd	          }d	}	d|v rO|d         }	t          |	          t          k    s/t          d                    t          |	                              d	}
d|v rO|d         }
t          |
          t          k    s/t          d                    t          |
                              d	}d|v rP|d         }t          |          t          k    s/t          d                    t          |                              n|
rt          d          i }d|vrt          d          t          |d         d          }t          |          dk    rt          d          |D ]}|dvr"t          d                    |                    t          |         }t          ||         d                    |                    }d|v r>t          |d         d                    |                      |di ||         d         }n
 |            }|||<   i }|D ]'}t                              |          r||         ||<   (t          |||||||||	|
||          }|S ) r   r   r9   z&invalid message length {0} for WELCOMEr7   z'session' in WELCOMEr8   z'details' in WELCOMEr   Nr   r   r   r  r   r  z0invalid type {0} for 'resumed' detail in WELCOMEr   z2invalid type {0} for 'resumable' detail in WELCOMEr   z5invalid type {0} for 'resume_token' detail in WELCOMEz8resume_token required when resumable is given in WELCOMEr   z7missing mandatory roles attribute in options in WELCOMEz'roles' in 'details' in WELCOMEz%empty 'roles' in 'details' in WELCOMEr
  z5invalid role '{0}' in 'roles' in 'details' in WELCOMEz-role '{0}' in 'roles' in 'details' in WELCOMEr   z;'features' in role '{0}' in 'roles' in 'details' in WELCOMEr<   )r[   r   r   r   rZ   r'   r(   getrJ   r   rK   r
   rL   rM   )r   r  r   r   r   r   r   r  r   r  r   r   r   r   r   r   r   r   r  r   r   s                        rA   r   zWelcome.parse  s    4yy1}}aG,@!@!@!@@t99>> H O OPSTXPYPY Z Z[[[#DG-CDD&tAw0FGG GT**Xt,,;;z400[[t44
{{>488KKT22	i(G==D((#$V$]$]^bcj^k^k$l$lmmm	'!!,I	??d**#$X$_$_`den`o`o$p$pqqqW$$">2L%%,,#$[$b$bcghtcucu$v$vwww - 	\ Z[[['!! YZZZ,WW-=?`aa}"" GHHH! 	( 	(D///#$[$b$bcg$h$hiii)$/H/d0CEtE{E{  }A  FB  FB  C  CL\))$\*%=?|  @D  @D  EI  @J  @J  K  K  K ( K K=+>z+J K K !)

'E$KK 	' 	'A &&q)) '#AJq	gueVXz<Ybdkmv  yE  GM  N  N
rC   c                    i }|                     | j                   | j        r
| j        |d<   | j        r
| j        |d<   | j        r
| j        |d<   | j        r
| j        |d<   | j        r
| j        |d<   | j        r
| j        |d<   | j        r
| j        |d<   | j	        r
| j	        |d<   | j
        r
| j
        |d	<   i |d
<   | j                                        D ]}i |d
         |j        <   |j        D ]~}|                    d          sg|dk    rat!          ||          Qd|d
         |j                 vrdi i|d
         |j        <   t!          ||          |d
         |j                 d         |<   t"          j        | j        |gS )r   r   r   r   r   r  r   r  r   r   r   r   r   Nr   )updater  r   r   r   r   r  r   r  r   r   r   r   r   r   r   r   r   r   r  r  s       rA   r   zWelcome.marshal  s    t{###: 	*#zGG; 	, $GH= 	0"&-GJ= 	4$(OGL! 	8&*&7GN#> 	2#'>GK < 	.!%GI> 	2#'>GK  	8&*&7GN#J%%'' 	^ 	^D*,GGTY'= ^ ^))#.. ^7f3D3DQUW^I_I_Ik!)9$))DDD7A26F(3GNtU\G]G]GG$TY/
;GD	^ $dlG<<rC   
NNNNNNNNNNr  r<   rC   rA   r   r   I  s          LI$  ""S# S# S# S#j Q Q \Qf.= .= .= .= .=rC   r   c                   @    e Zd ZdZdZ	 dZddZed             Zd Z	dS )	r   zV
    A WAMP ``ABORT`` message.

    Format: ``[ABORT, Details|dict, Reason|uri]``
    r9   )reasonrk   Nc                     t          |          t          k    sJ |t          |          t          k    sJ t                              |            || _        || _        dS )z

        :param reason: WAMP or application error URI for aborting reason.
        :type reason: str

        :param message: Optional human-readable closing message, e.g. for logging purposes.
        :type message: str or None
        N)rJ   rK   r   r   r  rk   )r   r  rk   s      rA   r   zAbort.__init__O  s\     F||s""""$w--3"6"6"66rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }d}d	|v rQ|d	         }t          |          t          k    r/t          d
                    t          |                              |}t          ||          }|S )r   r   r9   z$invalid message length {0} for ABORTr7   z'details' in ABORTr8   z'reason' in ABORTNrk   z.invalid type {0} for 'message' detail in ABORT)	r[   r   r   r   rZ   r(   r%   rJ   rK   )r   r   r  rk   details_messager   s         rA   r   zAbort.parse_  s     4yy1}}aE,>!>!>!>>t99>> F M McRVii X XYYY&tAw0DEE#DG-@AA%i0OO$$++#$T$[$[\`ap\q\q$r$rsss%GFG$$
rC   c                 P    i }| j         r
| j         |d<   t          j        || j        gS )r   rk   )rk   r   r   r  r   r   s     rA   r   zAbort.marshal  s1     < 	.!%GI"GT[99rC   r   r  r<   rC   rA   r   r   >  sp          LI
       \@: : : : :rC   r   c                   @    e Zd ZdZdZ	 dZddZed             Zd Z	dS )	r   z_
    A WAMP ``CHALLENGE`` message.

    Format: ``[CHALLENGE, Method|string, Extra|dict]``
    rD   )methodextraNc                     t          |          t          k    sJ |t          |          t          k    sJ t                              |            || _        |pi | _        dS )z

        :param method: The authentication method.
        :type method: str

        :param extra: Authentication method specific information.
        :type extra: dict or None
        N)rJ   rK   r   r   r   r  r  )r   r  r  s      rA   r   zChallenge.__init__  s`     F||s""""}Ut 3 3 33[b


rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               | d         }t          |          t          k    r/t          d                    t          |                              t          | d         d          }t          ||          }|S )r   r   r9   z(invalid message length {0} for CHALLENGEr7   z*invalid type {0} for 'method' in CHALLENGEr8   z'extra' in CHALLENGE)r[   r   r   r   rZ   rJ   rK   r(   )r   r  r  r   s       rA   r   zChallenge.parse  s     4yy1}}aI,B!B!B!BBt99>> J Q QRUVZR[R[ \ \]]]a<<3 L S STXY_T`T` a abbb$T!W.DEE&&
rC   c                 4    t           j        | j        | j        gS r   )r   r   r  r  r   s    rA   r   zChallenge.marshal  s     &TZ@@rC   r   r  r<   rC   rA   r   r     st          LI
! ! ! !    \2A A A A ArC   r   c                   @    e Zd ZdZdZ	 dZddZed             Zd Z	dS )	r   zh
    A WAMP ``AUTHENTICATE`` message.

    Format: ``[AUTHENTICATE, Signature|string, Extra|dict]``
    rE   )	signaturer  Nc                     t          |          t          k    sJ |t          |          t          k    sJ t                              |            || _        |pi | _        dS )z

        :param signature: The signature for the authentication challenge.
        :type signature: str

        :param extra: Authentication method specific information.
        :type extra: dict or None
        N)rJ   rK   r   r   r   r!  r  )r   r!  r  s      rA   r   zAuthenticate.__init__  s`     I#%%%%}Ut 3 3 33"[b


rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               | d         }t          |          t          k    r/t          d                    t          |                              t          | d         d          }t          ||          }|S )r   r   r9   z+invalid message length {0} for AUTHENTICATEr7   z0invalid type {0} for 'signature' in AUTHENTICATEr8   z'extra' in AUTHENTICATE)r[   r   r   r   rZ   rJ   rK   r(   )r   r!  r  r   s       rA   r   zAuthenticate.parse  s     4yy1}}aL,E!E!E!EEt99>> M T TUXY]U^U^ _ _```G		??c!! R Y YZ^_hZiZi j jkkk$T!W.GHH9e,,
rC   c                 4    t           j        | j        | j        gS r  )r   r   r!  r  r   s    rA   r   zAuthenticate.marshal  s     )4>4:FFrC   r   r  r<   rC   rA   r   r     st          LI
! ! ! !    \2G G G G GrC   r   c                   L    e Zd ZdZdZ	 dZ	 dZeddfdZed             Z	d Z
dS )	r   zZ
    A WAMP ``GOODBYE`` message.

    Format: ``[GOODBYE, Details|dict, Reason|uri]``
    rF   zwamp.close.normalr  rk   r   Nc                    t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ t                              |            || _        || _        || _        dS )a  

        :param reason: Optional WAMP or application error URI for closing reason.
        :type reason: str

        :param message: Optional human-readable closing message, e.g. for logging purposes.
        :type message: str or None

        :param resumable: From the server: Whether the session is able to be resumed (true) or destroyed (false). From the client: Whether it should be resumable (true) or destroyed (false).
        :type resumable: bool or None
        N)rJ   rK   r   r   r   r  rk   r   )r   r  rk   r   s       rA   r   zGoodbye.__init__/  s     F||s""""$w--3"6"6"66 DOOt$;$;$;;"rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }d}d}d	|v rQ|d	         }t          |          t          k    r/t          d
                    t          |                              |}d|v rO|d         }t          |          t          k    r/t          d                    t          |                              t          |||          }|S )r   r   r9   z&invalid message length {0} for GOODBYEr7   z'details' in GOODBYEr8   z'reason' in GOODBYENrk   z0invalid type {0} for 'message' detail in GOODBYEr   z2invalid type {0} for 'resumable' detail in GOODBYEr&  )
r[   r   r   r   rZ   r(   r%   rJ   rK   r   )r   r   r  rk   r   r  r   s          rA   r   zGoodbye.parseD  sV    4yy1}}aG,@!@!@!@@t99>> H O OPSTXPYPY Z Z[[[&tAw0FGG#DG-BCC	%i0OO$$++#$V$]$]^bcr^s^s$t$tuuu%G'!!,II$&&#$X$_$_`den`o`o$p$pqqqV% )+ + + 
rC   c                 r    i }| j         r
| j         |d<   | j        r
| j        |d<   t          j        || j        gS )r   rk   r   )rk   r   r   r   r  r  s     rA   r   zGoodbye.marshalm  sG     < 	.!%GI> 	2#'>GK $gt{;;rC   )r   r   r   r   r   DEFAULT_REASONr   r   r   r   r   r<   rC   rA   r   r     s          L )NI -dd # # # #* & & \&P< < < < <rC   r   c                   T    e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 	 	 	 ddZed             Zd Z	dS )	r   a  
    A WAMP ``ERROR`` message.

    Formats:

    * ``[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri]``
    * ``[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Arguments|list]``
    * ``[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Arguments|list, ArgumentsKw|dict]``
    * ``[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Payload|binary]``
       )request_typerequesterrorargsr   payloadrN   enc_keyrQ   r   callee_authidcallee_authroleforward_forNc                    t          |          t          k    sJ t          |          t          k    sJ t          |          t          k    sJ |t          |          t          t          fv sJ |t          |          t
          k    sJ |t          |          t          k    sJ ||||J |t          |          sJ |||	||J |t          |          t          k    sJ |	t          |	          sJ |
t          |
          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t
          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t          
                    |            || _        || _        || _        || _        t          |          | _        || _        || _        || _        |	| _        |
| _        || _        || _        || _        dS )a  

        :param request_type: The WAMP message type code for the original request.
        :type request_type: int

        :param request: The WAMP request ID of the original request (`Call`, `Subscribe`, ...) this error occurred for.
        :type request: int

        :param error: The WAMP or application error URI for the error that occurred.
        :type error: str

        :param args: Positional values for application-defined exception.
           Must be serializable using any serializers in use.
        :type args: list or None

        :param kwargs: Keyword values for application-defined exception.
           Must be serializable using any serializers in use.
        :type kwargs: dict or None

        :param payload: Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
        :type payload: bytes or None

        :param enc_algo: If using payload transparency, the encoding algorithm that was used to encode the payload.
        :type enc_algo: str or None

        :param enc_key: If using payload transparency with an encryption algorithm, the payload encryption key.
        :type enc_key: str or None

        :param enc_serializer: If using payload transparency, the payload object serializer that was used encoding the payload.
        :type enc_serializer: str or None

        :param callee: The WAMP session ID of the effective callee that responded with the error. Only filled if callee is disclosed.
        :type callee: None or int

        :param callee_authid: The WAMP authid of the responding callee. Only filled if callee is disclosed.
        :type callee_authid: None or unicode

        :param callee_authrole: The WAMP authrole of the responding callee. Only filled if callee is disclosed.
        :type callee_authrole: None or unicode

        :param forward_for: When this Error is forwarded for a client/callee (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   )rJ   r|   rK   r   tupler   rV   r)   r*   r   r   r-  r.  r/  r0  r   r   r1  rN   r2  rQ   r   r3  r4  r5  )r   r-  r.  r/  r0  r   r1  rN   r2  rQ   r   r3  r4  r5  ffs                  rA   r   zError.__init__  s   r L!!S((((G}}####E{{c!!!!|tDzzdE]::::~f!5!5!55$w--5"8"8"887#64<FNN[#4X#>#>> W_9OU\Uhmu  nB  nB  C$w--3"6"6"66%)@)P)P%%P~f!4!4!44$](;(;s(B(B(BB&$*?*?3*F*F*FF"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G(
	&v.. !, *. 'rC   c                 
   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               | d         }t          |          t          k    r"t          d                    |                    |t          j        t          j        t          j        t          j        t          j        t          j        t          j        fvr"t          d                    |                    t          | d         d          }t          | d	         d
          }t!          | d         d          }d}d}d}d}d}	d}
d}d}d}d}t          |           dk    rt          | d                   t"          k    r| d         }|                    dd          }|r1t'          |          s"t          d                    |                    |                    dd          }	|	rGt          |	          t(          k    r/t          d                    t          |	                              |                    dd          }
|
r1t+          |
          s"t          d                    |
                    nt          |           dk    rQ| d         }|Gt          |          t,          k    r/t          d                    t          |                              t          |           dk    rO| d         }t          |          t.          k    r/t          d                    t          |                              d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t(          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t(          k    r/t          d                    t          |                              |}d|v r|d         }d}t          |          t,          k    r|D ]}t          |          t.          k    r nmd |vst          |d                    t          k    r nId!|vst          |d!                   t(          k    r n%d"|vst          |d"                   t(          k    r nd#}|st          d$          t          ||||||||	|
||||%          }|S )&r   r   )rE   rF      z$invalid message length {0} for ERRORr7   z,invalid type {0} for 'request_type' in ERRORz-invalid value {0} for 'request_type' in ERRORr8   z'request' in ERRORr9   z'details' in ERRORrD   z'error' in ERRORNrF   rE   rN   0invalid value {0} for 'enc_algo' detail in EVENTr2  .invalid type {0} for 'enc_key' detail in EVENTrQ   6invalid value {0} for 'enc_serializer' detail in EVENTz$invalid type {0} for 'args' in ERRORz&invalid type {0} for 'kwargs' in ERRORr   z-invalid type {0} for 'callee' detail in ERRORr3  z4invalid type {0} for 'callee_authid' detail in ERRORr4  z6invalid type {0} for 'callee_authrole' detail in ERRORr5  Fr  r   r   Tz?invalid type/value {0} for/within 'forward_for' option in ERROR)
r0  r   r1  rN   r2  rQ   r   r3  r4  r5  )r[   r   r   r   rZ   rJ   r|   r   r   r   r   r    r   r"   r'   r(   r%   rV   r  r)   rK   r*   r   r   )r   r-  r.  r   r/  r0  r   r1  rN   r2  rQ   r   r3  r4  r5  detail_calleedetail_callee_authiddetail_callee_authrolevalidr8  r   s                        rA   r   zError.parse  s`    4yy1}}aE,>!>!>!>>t99I%% F M McRVii X XYYYAw$$ N U UVb c cddd	 6 + 8 ' 4 ( 5 * 7 $ 1 * 7 9 9 9   O V VWc d deee#DG-ABB&tAw0DEE"47,>??t99>>d47mmu441gG{{:t44H i 1( ; ; i#$V$]$]^f$g$ghhhkk)T22G l4==C//#$T$[$[\`ah\i\i$j$jkkk$[[)94@@N u&=n&M&M u#$\$c$cdr$s$sttt 4yy1}}Aw#T

d(:(:'(N(U(UVZ[_V`V`(a(abbb4yy1}}a<<4'''(P(W(WX\]cXdXd(e(efffw#H-MM""c))#$S$Z$Z[_`m[n[n$o$oppp"Fg%%#*?#; ())S00#$Z$a$abfg{b|b|$}$}~~~0M''%,->%?"*++s22#$\$c$cdhi  eA  eA  %B  %B  C  C  C4OG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K g#$efffL!#%##1!"/$3 +- - - 
rC   c                 &   i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        rT| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        | j	        | j
        || j        | j        gS | j        r'| j        | j	        | j
        || j        | j        | j        gS | j        r!| j        | j	        | j
        || j        | j        gS | j        | j	        | j
        || j        gS )	r   Nr   r3  r4  r5  rN   r2  rQ   )r   r3  r4  r5  r1  rN   r2  rQ   r   r-  r.  r/  r   r0  r  s     rA   r   zError.marshal  sL    ;" $GH)'+'9GO$+)-)=G%&'%)%5GM"< 	a}(&*m
#|'%)\	"".,0,?()%t'8$,QUQ[]a]ijj{ a)4+<dlGUYU_aeajlplwxx a)4+<dlGUYU_aeajkk)4+<dlGUYU_``rC   r  r  r<   rC   rA   r   r   ~  s        	 	 LI(  $#!%!e' e' e' e'N ~ ~ \~@ a  a  a  a  arC   r   c                      e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d3dZd Zd Ze	d             Z
e
j        d	             Z
e	d
             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d              Zej        d!             Ze	d"             Zej        d#             Ze	d$             Zej        d%             Ze	d&             Zej        d'             Ze	d(             Zej        d)             Ze	d*             Zej        d+             Ze	d,             Zej        d-             Zed.             Zd/ Z ed0             Z!d1 Z"d2 Z#dS )4r   aZ  
    A WAMP ``PUBLISH`` message.

    Formats:

    * ``[PUBLISH, Request|id, Options|dict, Topic|uri]``
    * ``[PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list]``
    * ``[PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list, ArgumentsKw|dict]``
    * ``[PUBLISH, Request|id, Options|dict, Topic|uri, Payload|binary]``
       )_request_topic_args_kwargs_payload	_enc_algo_enc_serializer_enc_key_acknowledge_exclude_me_exclude_exclude_authid_exclude_authrole	_eligible_eligible_authid_eligible_authrole_retain_transaction_hash_forward_forNc                    |t          |          t          k    sJ |t          |          t          k    sJ |+t          |          t          t          t          t
          fv sJ |%t          |          t          t          t
          fv sJ |t          |          t
          k    sJ ||||J |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ |	t          |	          t          k    sJ |	r|	D ]}t          |          t          k    sJ |
t          |
          t          k    sJ |
r|
D ]}t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ |t          |          sJ |||||J |t          |          t          k    sJ |t          |          sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              | |           || _        || _        || _        t          |          | _        || _        || _        || _        || _        |	| _        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        dS )a  

        :param request: The WAMP request ID of this request.
        :type request: int

        :param topic: The WAMP or application URI of the PubSub topic the event should
           be published to.
        :type topic: str

        :param args: Positional values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type args: list or tuple or None

        :param kwargs: Keyword values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type kwargs: dict or None

        :param payload: Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
        :type payload: bytes or None

        :param acknowledge: If True, acknowledge the publication with a success or
           error response.
        :type acknowledge: bool or None

        :param exclude_me: If ``True``, exclude the publisher from receiving the event, even
           if he is subscribed (and eligible).
        :type exclude_me: bool or None

        :param exclude: List of WAMP session IDs to exclude from receiving this event.
        :type exclude: list of int or None

        :param exclude_authid: List of WAMP authids to exclude from receiving this event.
        :type exclude_authid: list of str or None

        :param exclude_authrole: List of WAMP authroles to exclude from receiving this event.
        :type exclude_authrole: list of str or None

        :param eligible: List of WAMP session IDs eligible to receive this event.
        :type eligible: list of int or None

        :param eligible_authid: List of WAMP authids eligible to receive this event.
        :type eligible_authid: list of str or None

        :param eligible_authrole: List of WAMP authroles eligible to receive this event.
        :type eligible_authrole: list of str or None

        :param retain: If ``True``, request the broker retain this event.
        :type retain: bool or None

        :param transaction_hash: An application provided transaction hash for the published event, which may
            be used in the router to throttle or deduplicate the events on the topic. See the discussion
            `here <https://github.com/wamp-proto/wamp-proto/issues/391#issuecomment-998577967>`_.
        :type transaction_hash: str

        :param enc_algo: If using payload transparency, the encoding algorithm that was used to encode the payload.
        :type enc_algo: str or None

        :param enc_key: If using payload transparency with an encryption algorithm, the payload encryption key.
        :type enc_key: str or None

        :param enc_serializer: If using payload transparency, the payload object serializer that was used encoding the payload.
        :type enc_serializer: str or None or None

        :param forward_for: When this Call is forwarded for a client (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   r   ) rJ   r|   rK   r   r7  rV   r   r   r)   r*   r   r   rE  rF  rG  r   rH  rI  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rJ  rL  rK  rW  )r   r.  topicr0  r   r1  acknowledge
exclude_meexcludeexclude_authidexclude_authroleeligibleeligible_authideligible_authroleretaintransaction_hashrN   r2  rQ   r5  r   	sessionidr   r   r8  s                            rA   r   zPublish.__init__  s	   n $w--3"6"6"66}Us 2 2 22|tDzzdE3-FFFFF~f$U1C!C!C!CC$w--5"8"8"887#64<FNN["d;&7&74&?&?&??~f!5!5!55'40@+A+AS+H+H+HH !T*%5%5%=%=%==$w--4"7"7"77 	/$ / /	I#-----%n)=)=)E)E)EE 	,( , ,F||s*****'40@+A+AT+I+I+II 	., . .H~~,,,,,4>>T#9#9#99 	/% / /	I#-----&$*?*?4*G*G*GG 	,) , ,F||s***** (D1B,C,Ct,K,K,KK 	.- . .H~~,,,,,#4X#>#>> W_9OU\Uhmu  nB  nB  C$w--3"6"6"66%)@)P)P%%P"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G111
'//' &-!1! /"3  "2 "- (rC   c                    t          || j                  sdS t                              | |          sdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j	        | j	        k    rdS |j
        | j
        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS dS NFT)r   r   r   r   r.  rZ  r0  r   r1  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  rN   r2  rQ   r5  r   s     rA   r   zPublish.__eq__  s   %00 	5~~dE** 	5=DL((5;$*$$5:""5<4;&&5=DL((5 0005t..5=DL((54#6665!T%:::5>T]**5 D$8885"d&<<<5<4;&&5!T%:::5>T]**5=DL((54#6665 0005trC   c                 .    |                      |           S r   r   r   s     rA   r   zPublish.__ne__      ;;u%%%%rC   c                 h    | j         %| j        r| j                                        | _         | j         S r   )rE  r   Requestr   s    rA   r.  zPublish.request  s.    = T^  N2244DM}rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r|   rE  r   s     rA   r.  zPublish.request  s(    }Us 2 2 22rC   c                     | j         <| j        r5| j                                        }|r|                    d          | _         | j         S Nutf8rF  r   TopicrY   r   r^   s     rA   rZ  zPublish.topic  G    ;4>$$&&A /hhv..{rC   c                 L    |t          |          t          k    sJ || _        d S r   rJ   rK   rF  r   s     rA   rZ  zPublish.topic  (    }Us 2 2 22rC   c                     | j         ]| j        rV| j                                        r=t          j        t          | j                                                            | _         | j         S r   rG  r   
ArgsLengthcbor2loadsrV   ArgsAsBytesr   s    rA   r0  zPublish.args  W    :$.~((** N"[t~/I/I/K/K)L)LMM
zrC   c                 V    |t          |          t          t          fv sJ || _        d S r   rJ   r   r7  rG  r   s     rA   r0  zPublish.args  ,    }Ue} < < <<


rC   c                     | j         ]| j        rV| j                                        r=t          j        t          | j                                                            | _         | j         S r   rH  r   KwargsLengthrz  r{  rV   KwargsAsBytesr   s    rA   r   zPublish.kwargs  W    <DN~**,, R${51M1M1O1O+P+PQQ|rC   c                 L    |t          |          t          k    sJ || _        d S r   rJ   r   rH  r   s     rA   r   zPublish.kwargs  (    }Ut 3 3 33rC   c                     | j         >| j        r7| j                                        r| j                                        | _         | j         S r   rI  r   PayloadLengthPayloadAsBytesr   s    rA   r1  zPublish.payload  E    = T^ ~++-- @ $ = = ? ?}rC   c                 L    |t          |          t          k    sJ || _        d S r   rJ   rV   rI  r   s     rA   r1  zPublish.payload  (    }Uu 4 4 44rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   )rM  r   Acknowledge)r   r[  s     rA   r[  zPublish.acknowledge  s>    $$.4466K 0$/!  rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r   rM  r   s     rA   r[  zPublish.acknowledge  s+    }Ut 3 3 33!rC   c                 t    | j         +| j        r$| j                                        }|du r|| _         | j         S )NF)rN  r   	ExcludeMe)r   r\  s     rA   r\  zPublish.exclude_me  sA    ##1133JU""#- rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r   rN  r   s     rA   r\  zPublish.exclude_me%  s+    }Ut 3 3 33 rC   c                    | j         | j        rx| j                                        r_g }t          | j                                                  D ]/}|                    | j                            |                     0|| _         | j         S r   )rO  r   ExcludeLengthrangeappendExclude)r   r]  js      rA   r]  zPublish.exclude*  s    = T^ ~++-- (t~;;==>> > >ANN4>#9#9!#<#<==== '}rC   c                     |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ || _        d S r   )rJ   r   r|   rO  r   r?   xs      rA   r]  zPublish.exclude4  sT    }Ut 3 3 33 	& & &Aww#~~~~~rC   c                 B   | j         | j        r| j                                        rrg }t          | j                                                  D ]B}|                    | j                            |                              d                     C|| _         | j         S rn  )rP  r   ExcludeAuthidLengthr  r  ExcludeAuthidrY   )r   r^  r  s      rA   r^  zPublish.exclude_authid<  s    'DN'~1133 6!#t~AACCDD Z ZA"))$.*F*Fq*I*I*P*PQW*X*XYYYY'5$##rC   c                     |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ || _        d S r   )rJ   r   rK   rP  r  s      rA   r^  zPublish.exclude_authidF  sW    }Ut 3 3 33 	& & &Aww#~~~~~$rC   c                 B   | j         | j        r| j                                        rrg }t          | j                                                  D ]B}|                    | j                            |                              d                     C|| _         | j         S rn  )rQ  r   ExcludeAuthroleLengthr  r  ExcludeAuthrolerY   )r   r_  r  s      rA   r_  zPublish.exclude_authroleN  s    !)dn)~3355 :#% t~CCEEFF ^ ^A$++DN,J,J1,M,M,T,TU[,\,\]]]])9&%%rC   c                     |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ || _        d S r   )rJ   r   rK   rQ  r  s      rA   r_  zPublish.exclude_authroleX  sW    }Ut 3 3 33 	& & &Aww#~~~~~!&rC   c                    | j         | j        rx| j                                        r_g }t          | j                                                  D ]/}|                    | j                            |                     0|| _         | j         S r   )rR  r   EligibleLengthr  r  Eligible)r   r`  r  s      rA   r`  zPublish.eligible`  s    >!dn!~,,.. *t~<<>>?? @ @AOODN$;$;A$>$>????!)~rC   c                     |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ || _        d S r   )rJ   r   r|   rR  r  s      rA   r`  zPublish.eligiblej  sT    }Ut 3 3 33 	& & &Aww#~~~~~rC   c                 B   | j         | j        r| j                                        rrg }t          | j                                                  D ]B}|                    | j                            |                              d                     C|| _         | j         S rn  )rS  r   EligibleAuthidLengthr  r  EligibleAuthidrY   )r   ra  r  s      rA   ra  zPublish.eligible_authidr  s     (T^(~2244 8"$t~BBDDEE \ \A#**4>+H+H+K+K+R+RSY+Z+Z[[[[(7%$$rC   c                     |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ || _        d S r   )rJ   r   rK   rS  r  s      rA   ra  zPublish.eligible_authid|  sW    }Ut 3 3 33 	& & &Aww#~~~~~ %rC   c                 B   | j         | j        r| j                                        rrg }t          | j                                                  D ]B}|                    | j                            |                              d                     C|| _         | j         S rn  )rT  r   EligibleAuthroleLengthr  r  EligibleAuthrolerY   )r   rb  r  s      rA   rb  zPublish.eligible_authrole  s    "*t~*~4466 <$&!t~DDFFGG ` `A%,,T^-L-LQ-O-O-V-VW]-^-^____*;'&&rC   c                     |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ || _        d S r   )rJ   r   rK   rT  r  s      rA   rb  zPublish.eligible_authrole  sW    }Ut 3 3 33 	& & &Aww#~~~~~"'rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   )rU  r   Retain)r   rc  s     rA   rc  zPublish.retain  s;    <DN^**,,F &%|rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r   rU  r   s     rA   rc  zPublish.retain  r  rC   c                     | j         <| j        r5| j                                        }|r|                    d          | _         | j         S rn  rV  r   TransactionHashrY   rr  s     rA   rd  zPublish.transaction_hash  J    !)dn)..00A :)*&)9)9&%%rC   c                 L    |t          |          t          k    sJ || _        d S r   rJ   rK   rV  r   s     rA   rd  zPublish.transaction_hash  +    }Us 2 2 22!&rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   rJ  r   EncAlgor   rN   s     rA   rN   zPublish.enc_algo  ;    >!dn!~--//H *!)~rC   c                 H    ||t           t          t          fv sJ || _        d S r   ENC_ALGO_CRYPTOBOXENC_ALGO_MQTTENC_ALGO_XBRrJ  r   s     rA   rN   zPublish.enc_algo  *    }*<m\)Z Z Z ZZrC   c                     | j         >| j        r7| j                                        r| j                                        | _         | j         S r   rL  r   EncKeyLengthEncKeyAsBytesr   s    rA   r2  zPublish.enc_key  D    = T^ ~**,, ? $ < < > >}rC   c                 L    |t          |          t          k    sJ || _        d S r   rJ   rV   rL  r   s     rA   r2  zPublish.enc_key  r  rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   rK  r   EncSerializerr   rQ   s     rA   rQ   zPublish.enc_serializer  >    'DN'!^99;;N 6'5$##rC   c                 T    ||t           t          t          t          fv sJ || _        d S r   ENC_SER_JSONENC_SER_MSGPACKENC_SER_CBORENC_SER_UBJSONrK  r   s     rA   rQ   zPublish.enc_serializer  /    },We)f f f ff$rC   c                     | j         S r   rW  r   s    rA   r5  zPublish.forward_for         rC   c                     || _         d S r   r  r   s     rA   r5  zPublish.forward_for       "rC   c                 ^    t          t          j                             | d                    S Nr   rY  )r   r   GetRootAsPublishr   s    rA   r   zPublish.cast  s&     3 D DS! L LMMMMrC   c                    | j         }|r'|                    t          j        |                    }| j        }|r'|                    t          j        |                    }| j        }|r|                    |          }| j        }|r|                    |          }| j        }|r|                    |          }| j	        }|r|                    |          }| j
        }|rvt          j                            |t          |                     t          |          D ]}	|                    |	           |                    t          |                    }| j        }
|
rg }|
D ]*}|                    |                    |                     +t          j                            |t          |                     t          |          D ]}|                    |           |                    t          |                    }
| j        }|
rg }|D ]*}|                    |                    |                     +t          j                            |t          |                     t          |          D ]}|                    |           |                    t          |                    }| j        }|rvt          j                            |t          |                     t          |          D ]}	|                    |	           |                    t          |                    }| j        }|rg }|D ]*}|                    |                    |                     +t          j                            |t          |                     t          |          D ]}|                    |           |                    t          |                    }| j        }|rg }|D ]*}|                    |                    |                     +t          j                            |t          |                     t          |          D ]}|                    |           |                    t          |                    }t          j                            |           | j        %t          j                            || j                   |r t          j                            ||           |r t          j                             ||           |r t          j        !                    ||           |r t          j        "                    ||           | j#        r%t          j        $                    || j#                   | j%        r%t          j        &                    || j%                   |r t          j        '                    ||           | j(        %t          j        )                    || j(                   | j*        %t          j        +                    || j*                   |r t          j        ,                    ||           |
r t          j        -                    ||
           |r t          j        .                    ||           |r t          j        /                    ||           |r t          j        0                    ||           |r t          j        1                    ||           | j2        %t          j        3                    || j2                   |%t          j        4                    || j                   t          j        5                    |          }t          j6        7                    |           t          j6        8                    |t          j9        j:                   t          j6        ;                    ||           t          j6        <                    |          }|S r   )=r0  CreateByteVectorrz  dumpsr   r1  rZ  CreateStringrd  r2  r]  r   
PublishGenPublishStartExcludeAuthidVectorr[   reversedPrependUint64	EndVectorr^  r  PrependUOffsetTRelativer_  !PublishStartExcludeAuthroleVectorr`   PublishStartEligibleAuthidVectorra  rb  "PublishStartEligibleAuthroleVectorPublishStartr.  PublishAddRequestPublishAddTopicPublishAddArgsPublishAddKwargsPublishAddPayloadrN   PublishAddEncAlgorQ   PublishAddEncSerializerPublishAddEncKeyr[  PublishAddAcknowledger\  PublishAddExcludeMePublishAddExcludePublishAddExcludeAuthidPublishAddExcludeAuthrolePublishAddEligiblePublishAddEligibleAuthidPublishAddEligibleAuthrolerc  PublishAddRetainPublishAddTransactionHash
PublishEndr   MessageStartMessageAddMsgTypeMessageTypePUBLISHMessageAddMsg
MessageEnd)r   r   r0  r   r1  rZ  rd  r2  r]  r  r^  rP  r   or_  rQ  r   r`  ra  rS  rb  rT  msg	union_msgs                           rA   r   zPublish.build  s   y 	?++EK,=,=>>D 	C--ek&.A.ABBF, 	8..w77G
 	0((//E0 	F&334DEE, 	8..w77G , 	6"BB7CPWLLYYY#G,, / /%%g....''G55G , 	E O( E E&&w';';F'C'CDDDD"BB7CP_L`L`aaao.. 3 3//2222$..s?/C/CDDN  0 	I ", I I!(()=)=h)G)GHHHH"DDWcRcNdNdeee/00 3 3//2222&005F1G1GHH = 	8"CCGSQY]][[[#H-- / /%%g....((X77H . 	G!) F F ''(<(<V(D(DEEEE"CCGSQaMbMbccc.// 3 3//2222%//4D0E0EFFO !2 	K!#- J J"))'*>*>x*H*HIIII"EEgsSeOfOfggg011 3 3//2222 ' 1 1#6H2I2I J J 	++G444<#"44WdlKKK 	C"227EBBB 	A"11'4@@@ 	E"33GVDDD 	G"44WgFFF= 	M"44WdmLLL 	Y"::7DDWXXX 	F"33GWEEE'"88$BRSSS?&"66wPPP 	G"44WgFFF 	T"::7NSSS 	X"<<WFVWWW 	I"55gxHHH 	V";;G_UUU 	Z"==gGXYYY;""33GT[III'"<<WdF[\\\ $//88((111--g{7N7VWWW))'3777'227;;	rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }t          | d         d	          }d
}d
}d
}t          |           dk    rt          | d                   t          t          fv r| d         }|                    dd
          }|r1t          |          s"t          d                    |                    |                    dd
          }|rGt          |          t          k    r/t          d                    t          |                              |                    dd
          }	|	r1t          |	          s"t          d                    |	                    nt          |           dk    rZ| d         }t          |          t          t          t          fvr/t          d                    t          |                              t          |           dk    rZ| d         }t          |          t          t          t          fvr/t          d                    t          |                              d
}d
}d
}	d
}
d
}d
}d
}d
}d
}d
}d
}d
}d
}d
}d|v rQ|d         }t          |          t           k    r/t          d                    t          |                              |}
d|v rQ|d         }t          |          t           k    r/t          d                    t          |                              |}d|v r|d         }t          |          t          k    r/t          d                    t          |                              |D ]I}t          |          t"          k    r/t          d                    t          |                              J|}d|v r|d         }t          |          t          k    r/t          d                    t          |                              |D ]I}t          |          t          k    r/t          d                    t          |                              J|}d|v r|d         }t          |          t          k    r/t          d                     t          |                              |D ]I}t          |          t          k    r/t          d!                    t          |                              J|}d"|v r|d"         }t          |          t          k    r/t          d#                    t          |                              |D ]I}t          |          t"          k    r/t          d$                    t          |                              J|}d%|v r|d%         }t          |          t          k    r/t          d&                    t          |                              |D ]I}t          |          t          k    r/t          d'                    t          |                              J|}d(|v r|d(         } t          |           t          k    r/t          d)                    t          |                               | D ]I}t          |          t          k    r/t          d*                    t          |                              J| }d+|v rO|d+         }t          |          t           k    r/t          d,                    t          |                              d-|v rO|d-         }t          |          t          k    r/t          d.                    t          |                              d/|v r|d/         }d0}!t          |          t          k    r|D ]}"t          |"          t          k    r nmd1|"vst          |"d1                   t"          k    r nId2|"vst          |"d2                   t          k    r n%d3|"vst          |"d3                   t          k    r nd4}!|!st          d5          t          ||fi d6|d7|d8|d|
d|d|d|d|d"|d%|d(|d+|d-|d|d|d|	d/|}#|#S )9r   r   rD   rE   rF   z&invalid message length {0} for PUBLISHr7   z'request' in PUBLISHr8   z'options' in PUBLISHr9   z'topic' in PUBLISHNrE   rD   rN   z2invalid value {0} for 'enc_algo' option in PUBLISHr2  z0invalid type {0} for 'enc_key' option in PUBLISHrQ   z8invalid value {0} for 'enc_serializer' option in PUBLISHz&invalid type {0} for 'args' in PUBLISHz(invalid type {0} for 'kwargs' in PUBLISHr[  z4invalid type {0} for 'acknowledge' option in PUBLISHr\  z3invalid type {0} for 'exclude_me' option in PUBLISHr]  z0invalid type {0} for 'exclude' option in PUBLISHz9invalid type {0} for value in 'exclude' option in PUBLISHr^  z7invalid type {0} for 'exclude_authid' option in PUBLISHz@invalid type {0} for value in 'exclude_authid' option in PUBLISHr_  z9invalid type {0} for 'exclude_authrole' option in PUBLISHzBinvalid type {0} for value in 'exclude_authrole' option in PUBLISHr`  z1invalid type {0} for 'eligible' option in PUBLISHz:invalid type {0} for value in 'eligible' option in PUBLISHra  z8invalid type {0} for 'eligible_authid' option in PUBLISHzAinvalid type {0} for value in 'eligible_authid' option in PUBLISHrb  z:invalid type {0} for 'eligible_authrole' option in PUBLISHzCinvalid type {0} for value in 'eligible_authrole' option in PUBLISHrc  z/invalid type {0} for 'retain' option in PUBLISHrd  z9invalid type {0} for 'transaction_hash' option in PUBLISHr5  Fr  r   r   TzAinvalid type/value {0} for/within 'forward_for' option in PUBLISHr0  r   r1  )r[   r   r   r   rZ   r'   r(   r%   rJ   rK   rV   r  r)   r*   r   r   r   r|   )$r   r.  optionsrZ  r0  r   r1  rN   r2  rQ   r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  r5  option_acknowledgeoption_exclude_meoption_exclude
_sessionidoption_exclude_authid_authidoption_exclude_authrole	_authroleoption_eligible	sessionIdoption_eligible_authidoption_eligible_authrolerA  r8  r   s$                                       rA   r   zPublish.parset	  s
    4yy1}}aG,@!@!@!@@t99I%% H O OPSTXPYPY Z Z[[[#DG-CDD&tAw0FGG"47,@AAt99>>d47mmU|;;1gG{{:t44H k 1( ; ; k#$X$_$_`h$i$ijjjkk)T22G n4==C//#$V$]$]^bcj^k^k$l$lmmm$[[)94@@N w&=n&M&M w#$^$e$eft$u$uvvv 4yy1}}Aw::dC%777'(P(W(WX\]aXbXb(c(cddd4yy1}}a<<c5'999'(R(Y(YZ^_eZfZf(g(ghhhHG!N
 G##!(!7&''4//#$Z$a$abfgybzbz${${|||,K7"" ' 5%&&$..#$Y$`$`aefwaxax$y$yzzz*J$Y/NN##t++#$V$]$]^bcq^r^r$s$sttt, ~ ~

##s**'(c(j(jkopzk{k{(|(|}}} + %Gw&&$+,<$=!)**d22#$]$d$deij  fA  fA  %B  %B  C  C  C0 B B==C'''(j(q(qrvw~rr  )A  )A  B  B  B ( 3N((&-.@&A#+,,44#$_$f$fgk  mD  hE  hE  %F  %F  G  G  G4 F F		??c))'(l(s(stx  zC  uD  uD  )E  )E  F  F  F *  7  %j1OO$$,,#$W$^$^_cds_t_t$u$uvvv, ~ ~		??c))'(d(k(klpqzl{l{(|(|}}} * 'H''%,->%?"*++t33#$^$e$efj  lB  gC  gC  %D  %D  E  E  E1 C C==C'''(k(r(rswx  tA  tA  )B  )B  C  C  C ( 5O'))'./B'C$,--55#$`$g$ghl  nF  iG  iG  %H  %H  I  I  I5 G G		??c))'(m(t(tuy  {D  vE  vE  )F  )F  G  G  G * !9wX&FF||t###$U$\$\]abh]i]i$j$jkkk((&'9:$%%,,#$_$f$fgkl|g}g}$~$~G##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K i#$ghhhg/ / /4/ $V/ &g	/
 #.+/ ",/ &g/ &4^/ (8'7/  (x/ '6o/ ):(9/ $V/ (8'7/  (x/  &g!/" &4^#/$ #.+%/( 
rC   c                    i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d	<   | j	        
| j	        |d
<   | j
        r3| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S )Nr[  r\  r]  r^  r_  r`  ra  rb  rc  rd  rN   r2  rQ   r5  )r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  r1  rN   r2  rQ   r5  r   r  s     rA   marshal_optionszPublish.marshal_optionsA
  sE   '%)%5GM"?&$(OGL!<#!%GI*(,(;G$% ,*.*?G&'=$"&-GJ+)-)=G%&!-+/+AG'(;" $GH ,*.*?G&'< 	@}(&*m
#|'%)\	"".,0,?()'%)%5GM"rC   c                 T   |                                  }| j        r t          j        | j        || j        | j        gS | j        r&t          j        | j        || j        | j        | j        gS | j        r t          j        | j        || j        | j        gS t          j        | j        || j        gS r  )r  r1  r   r   r.  rZ  r   r0  r  s     rA   r   zPublish.marshalg
  s     &&((< 	Q($,T\ZZ{ Q,dlGTZQUQZ\`\ghh Q,dlGTZQUQZ[[,dlGTZPPrC   )NNNNNNNNNNNNNNNNNNNN)$r   r   r   r   r   r   r   r   r   r   r.  r   rZ  r0  r   r1  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  rN   r2  rQ   r5  r   r   r   r   r  r   r<   rC   rA   r   r     sV       	 	 L9Ix !  $"&!%#'"& $!)l( l( l( l(\+ + +Z& & &   X
 ^  ^   X \  \   X 
[  [   X ]  ]   X ^  ^ ! ! X! " " "     X  ! ! !   X ^  ^ $ $ X$ % % % & & X& ' ' '   X _  _ % % X% & & & ' ' X' ( ( (   X ]  ] & & X& ' ' '   X _  _   X ^  ^ $ $ X$ % % % ! ! X! " " " N N \NN N N` J J \JX$ $ $LQ Q Q Q QrC   r   c                   >    e Zd ZdZdZ	 dZd Zed             Zd Z	dS )r   zh
    A WAMP ``PUBLISHED`` message.

    Format: ``[PUBLISHED, PUBLISH.Request|id, Publication|id]``
       )r.  publicationc                     t          |          t          k    sJ t          |          t          k    sJ t                              |            || _        || _        dS )z

        :param request: The request ID of the original `PUBLISH` request.
        :type request: int

        :param publication: The publication ID for the published event.
        :type publication: int
        N)rJ   r|   r   r   r.  r#  )r   r.  r#  s      rA   r   zPublished.__init__
  s]     G}}####K  C''''&rC   c                 X   t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }t          ||          }|S )r   r   r9   z(invalid message length {0} for PUBLISHEDr7   z'request' in PUBLISHEDr8   z'publication' in PUBLISHED)r[   r   r   r   rZ   r'   )r   r.  r#  r   s       rA   r   zPublished.parse
  s     4yy1}}aI,B!B!B!BBt99>> J Q QRUVZR[R[ \ \]]]#DG-EFF'Q1MNN--
rC   c                 4    t           j        | j        | j        gS r  )r   r   r.  r#  r   s    rA   r   zPublished.marshal
  s     &d6FGGrC   Nr  r<   rC   rA   r   r   {
  so          LI
' ' '    \,H H H H HrC   r   c                   X    e Zd ZdZdZ	 dZdZdZdZ	 	 	 ddZ	e
d	             Zd
 Zd ZdS )r   zi
    A WAMP ``SUBSCRIBE`` message.

    Format: ``[SUBSCRIBE, Request|id, Options|dict, Topic|uri]``
        exactprefixwildcard)r.  rZ  rM   get_retainedr5  Nc                     t          |          t          k    sJ t          |          t          k    sJ |t          |          t          k    sJ |'|t          j        t          j        t          j        fv sJ |t          |          t          u sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _        || _        |pt          j        | _        || _        || _        dS )a  

        :param request: The WAMP request ID of this request.
        :type request: int

        :param topic: The WAMP or application URI of the PubSub topic to subscribe to.
        :type topic: str

        :param match: The topic matching method to be used for the subscription.
        :type match: str

        :param get_retained: Whether the client wants the retained message we may have along with the subscription.
        :type get_retained: bool or None

        :param forward_for: When this Subscribe is forwarded over a router-to-router link,
            or via an intermediary router.
        :type forward_for: list[dict]
        Nr  r   r   )rJ   r|   rK   r   MATCH_EXACTMATCH_PREFIXMATCH_WILDCARDr   r   r   r   r   r.  rZ  rM   r,  r5  )r   r.  rZ  rM   r,  r5  r8  s          rA   r   zSubscribe.__init__
  s   0 G}}####E{{c!!!!}Us 2 2 22})*?AWYbYq)r r r rr#tL'9'9T'A'A'AA"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G
3i3
(&rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }t          | d         d	d
          }t          j        }d}d}d|v r|d         }t          |          t          k    r/t          d                    t          |                              |t          j        t          j        t          j        fvr"t          d                    |                    |}d|v rO|d         }t          |          t          k    r/t          d                    t          |                              d|v r|d         }d}t          |          t          k    r|D ]}	t          |	          t          k    r nmd|	vst          |	d                   t           k    r nId|	vst          |	d                   t          k    r n%d|	vst          |	d                   t          k    r nd
}|st          d          t          |||||          }
|
S )r   r   rD   z(invalid message length {0} for SUBSCRIBEr7   z'request' in SUBSCRIBEr8   z'options' in SUBSCRIBEr9   z'topic' in SUBSCRIBET)rm   NrM   z0invalid type {0} for 'match' option in SUBSCRIBEz1invalid value {0} for 'match' option in SUBSCRIBEr,  z7invalid type {0} for 'get_retained' option in SUBSCRIBEr5  Fr  r   r   zCinvalid type/value {0} for/within 'forward_for' option in SUBSCRIBE)rM   r,  r5  )r[   r   r   r   rZ   r'   r(   r%   r.  rJ   rK   r/  r0  r   r   r   r|   )r   r.  r  rZ  rM   r,  r5  option_matchrA  r8  r   s              rA   r   zSubscribe.parse  s    4yy1}}aI,B!B!B!BBt99>> J Q QRUVZR[R[ \ \]]]#DG-EFF&tAw0HII"47,B[_```%g"7+LL!!S((#$V$]$]^bco^p^p$q$qrrrI$99;QS\Sk#lll#$W$^$^_k$l$lmmm EW$$">2LL!!T))#$]$d$deijvewew$x$xyyyG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K k#$ijjje,\ghhh
rC   c                     i }| j         r| j         t          j        k    r
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   |S )NrM   r,  r5  )rM   r   r.  r,  r5  r  s     rA   r  zSubscribe.marshal_options@  s]    : 	*$*	(===#zGG(&*&7GN#'%)%5GM"rC   c                 Z    t           j        | j        |                                 | j        gS r  )r   r   r.  r  rZ  r   s    rA   r   zSubscribe.marshalN  s&     &d6J6J6L6LdjYYrC   NNN)r   r   r   r   r   r.  r/  r0  r   r   r   r   r  r   r<   rC   rA   r   r   
  s          L KLNI "!*' *' *' *'X < < \<|  Z Z Z Z ZrC   r   c                   >    e Zd ZdZdZ	 dZd Zed             Zd Z	dS )r   zm
    A WAMP ``SUBSCRIBED`` message.

    Format: ``[SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]``
    !   )r.  subscriptionc                     t          |          t          k    sJ t          |          t          k    sJ t                              |            || _        || _        dS )z

        :param request: The request ID of the original ``SUBSCRIBE`` request.
        :type request: int

        :param subscription: The subscription ID for the subscribed topic (or topic pattern).
        :type subscription: int
        N)rJ   r|   r   r   r.  r8  )r   r.  r8  s      rA   r   zSubscribed.__init__i  ]     G}}####L!!S(((((rC   c                 X   t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }t          ||          }|S )r   r   r9   z)invalid message length {0} for SUBSCRIBEDr7   z'request' in SUBSCRIBEDr8   z'subscription' in SUBSCRIBED)r[   r   r   r   rZ   r'   )r   r.  r8  r   s       rA   r   zSubscribed.parsey       4yy1}}aJ,C!C!C!CCt99>> K R RSVW[S\S\ ] ]^^^#DG-FGG(a2PQQ,//
rC   c                 4    t           j        | j        | j        gS r  )r   r   r.  r8  r   s    rA   r   zSubscribed.marshal       't7HIIrC   Nr  r<   rC   rA   r   r   X  o          LI
) ) )    \,J J J J JrC   r   c                   @    e Zd ZdZdZ	 dZddZed             Zd Z	dS )	r   z
    A WAMP ``UNSUBSCRIBE`` message.

    Formats:

    * ``[UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]``
    * ``[UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id, Options|dict]``
    "   )r.  r8  r5  Nc                    t          |          t          k    sJ t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _        || _        || _        dS )a  

        :param request: The WAMP request ID of this request.
        :type request: int

        :param subscription: The subscription ID for the subscription to unsubscribe from.
        :type subscription: int

        :param forward_for: When this Unsubscribe is forwarded over a router-to-router link,
            or via an intermediary router.
        :type forward_for: list[dict]
        r  r   Nr   )	rJ   r|   r   rK   r   r   r.  r8  r5  )r   r.  r8  r5  r8  s        rA   r   zUnsubscribe.__init__  s    G}}####L!!S(((( 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G(&rC   c                 >   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }d}t          |           d	k    rt          | d	         d
          }d}|rd|v r|d         }d}t          |          t          k    r|D ]}t          |          t          k    r nmd|vst          |d                   t          k    r nId|vst          |d                   t          k    r n%d|vst          |d                   t          k    r nd}|st          d          t          |||          }|S )r   r   r9   rD   z/invalid message length {0} for WAMP UNSUBSCRIBEr7   z'request' in UNSUBSCRIBEr8   z'subscription' in UNSUBSCRIBENr9   z'options' in UNSUBSCRIBEr5  Fr  r   r   TzEinvalid type/value {0} for/within 'forward_for' option in UNSUBSCRIBEr5  )r[   r   r   r   rZ   r'   r(   rJ   r   r   r|   rK   )r   r.  r8  r  r5  rA  r8  r   s           rA   r   zUnsubscribe.parse  s    4yy1}}aK,D!D!D!DDt99F"" Q X XY\]aYbYb c cddd#DG-GHH(a2QRRt99q==*474NOOG 	m}//!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K m#$klll'<[III
rC   c                     | j         r#d| j         i}t          j        | j        | j        |gS t          j        | j        | j        gS r   r5  )r5  r   r   r.  r8  r  s     rA   r   zUnsubscribe.marshal  sM      	Ot/G  ,dlD<MwWW,dlD<MNNrC   r   r  r<   rC   rA   r   r     su          LI' ' ' '6 + + \+ZO O O O OrC   r   c                   @    e Zd ZdZdZ	 dZddZed             Zd Z	dS )	r   z
    A WAMP ``UNSUBSCRIBED`` message.

    Formats:

    * ``[UNSUBSCRIBED, UNSUBSCRIBE.Request|id]``
    * ``[UNSUBSCRIBED, UNSUBSCRIBE.Request|id, Details|dict]``
    #   )r.  r8  r  Nc                 4   t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |dk    r||dk    r|dk    sJ t                              |            || _        || _        || _        dS )a  

        :param request: The request ID of the original ``UNSUBSCRIBE`` request or
            ``0`` is router triggered unsubscribe ("router revocation signaling").
        :type request: int

        :param subscription: If unsubscribe was actively triggered by router, the ID
            of the subscription revoked.
        :type subscription: int or None

        :param reason: The reason (an URI) for an active (router initiated) revocation.
        :type reason: str or None.
        Nr   )rJ   r|   rK   r   r   r.  r8  r  )r   r.  r8  r  s       rA   r   zUnsubscribed.__init__  s     G}}#####tL'9'9S'@'@'@@~f!4!4!441!57a<<L\]L]L]L]^(rC   c                 b   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }d}d}t          |           dk    rt          | d         d          }d	|v rQ|d	         }t          |          t          k    r/t          d
                    t          |                              |}d|v rt          |d         d          }t          |||          }|S )r   r   r8   r9   z+invalid message length {0} for UNSUBSCRIBEDr7   z'request' in UNSUBSCRIBEDNr8   z'details' in UNSUBSCRIBEDr8  z:invalid type {0} for 'subscription' detail in UNSUBSCRIBEDr  z'reason' in UNSUBSCRIBED)
r[   r   r   r   rZ   r'   r(   rJ   r|   r%   )r   r.  r8  r  r   details_subscriptionr   s          rA   r   zUnsubscribed.parse5  J    4yy1}}aL,E!E!E!EEt99F"" M T TUXY]U^U^ _ _```#DG-HIIt99q==*474OPPG(('.~'>$,--44'(d(k(klp  rF  mG  mG  )H  )H  I  I  I37""+GH,=?YZZ7L&99
rC   c                     | j         | j        8i }| j         
| j         |d<   | j        
| j        |d<   t          j        | j        |gS t          j        | j        gS )r   Nr  r8  )r  r8  r   r   r.  r  s     rA   r   zUnsubscribed.marshal[  e     ;"d&7&CG{&$(K! ,*.*;' -t|WEE -t|<<rC   NNr  r<   rC   rA   r   r     sp          LI   0 # # \#J= = = = =rC   r   c                      e Zd ZdZdZ	 dZ	 	 	 	 	 d,dZd Zd Ze	d             Z
e
j        d	             Z
e	d
             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d             Zej        d             Ze	d              Zej        d!             Ze	d"             Zej        d#             Ze	d$             Zej        d%             Ze	d&             Zej        d'             Zed(             Zd) Zed*             Zd+ ZdS )-r   a  
    A WAMP ``EVENT`` message.

    Formats:

    * ``[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict]``
    * ``[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list]``
    * ``[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list, PUBLISH.ArgumentsKw|dict]``
    * ``[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Payload|binary]``
    $   )_subscription_publicationrG  rH  rI  rJ  rK  rL  
_publisher_publisher_authid_publisher_authrolerF  	_retainedrV  _x_acknowledged_deliveryrW  Nc                    |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          t          fv sJ |t          |          t          k    sJ |t          |          t
          k    sJ ||||J |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |	t          |	          t          k    sJ |
t          |
          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          sJ |||||J |t          |          t          k    sJ |t          |          sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              | |           || _        || _        || _        t          |          | _        || _        || _        || _        || _        |	| _        |
| _        || _        || _        || _        || _        || _        || _        dS )a
  

        :param subscription: The subscription ID this event is dispatched under.
        :type subscription: int

        :param publication: The publication ID of the dispatched event.
        :type publication: int

        :param args: Positional values for application-defined exception.
           Must be serializable using any serializers in use.
        :type args: list or tuple or None

        :param kwargs: Keyword values for application-defined exception.
           Must be serializable using any serializers in use.
        :type kwargs: dict or None

        :param payload: Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
        :type payload: bytes or None

        :param publisher: The WAMP session ID of the publisher. Only filled if publisher is disclosed.
        :type publisher: None or int

        :param publisher_authid: The WAMP authid of the publisher. Only filled if publisher is disclosed.
        :type publisher_authid: None or unicode

        :param publisher_authrole: The WAMP authrole of the publisher. Only filled if publisher is disclosed.
        :type publisher_authrole: None or unicode

        :param topic: For pattern-based subscriptions, the event MUST contain the actual topic published to.
        :type topic: str or None

        :param retained: Whether the message was retained by the broker on the topic, rather than just published.
        :type retained: bool or None

        :param transaction_hash: An application provided transaction hash for the originating call, which may
            be used in the router to throttle or deduplicate the calls on the procedure. See the discussion
            `here <https://github.com/wamp-proto/wamp-proto/issues/391#issuecomment-998577967>`_.
        :type transaction_hash: str

        :param x_acknowledged_delivery: Whether this Event should be acknowledged.
        :type x_acknowledged_delivery: bool or None

        :param enc_algo: If using payload transparency, the encoding algorithm that was used to encode the payload.
        :type enc_algo: str or None

        :param enc_key: If using payload transparency with an encryption algorithm, the payload encryption key.
        :type enc_key: str or None

        :param enc_serializer: If using payload transparency, the payload object serializer that was used encoding the payload.
        :type enc_serializer: str or None

        :param forward_for: When this Event is forwarded for a client (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   rY  )rJ   r|   r   r7  r   rV   rK   r   r)   r*   r   r   rT  rU  rG  r   rH  rI  rV  rW  rX  rF  rY  rV  rZ  rJ  rL  rK  rW  )r   r8  r#  r0  r   r1  r   publisher_authidpublisher_authrolerZ  retainedrd  x_acknowledged_deliveryrN   r2  rQ   r5  r   r8  s                      rA   r   zEvent.__init__  sd   v #tL'9'9S'@'@'@@"d;&7&73&>&>&>>|tDzzdE]::::~f!5!5!55$w--5"8"8"887#64<FNN[ DOOs$:$:$::'40@+A+AS+H+H+HH!)T2D-E-E-L-L-LL}Us 2 2 224>>T#9#9#99'40@+A+AS+H+H+HH&.$7N2O2OSW2W2W2WW#4X#>#>> W_9OU\Uhmu  nB  nB  C$w--3"6"6"66%)@)P)P%%P"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G111)'
'//#!1#5 !!1(?%!-'rC   c                    t          || j                  sdS t                              | |          sdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j	        | j	        k    rdS |j
        | j
        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS |j        | j        k    rdS dS rg  )r   r   r   r   r8  r#  r0  r   r1  r   r\  r]  rZ  r^  rd  r_  rN   r2  rQ   r5  r   s     rA   r   zEvent.__eq__  s   %00 	5~~dE** 	5!2225 0005:""5<4;&&5=DL((5?dn,,5!T%:::5#t'>>>5;$*$$5>T]**5!T%:::5(D,HHH5>T]**5=DL((54#6665 0005trC   c                 .    |                      |           S r   r   r   s     rA   r   zEvent.__ne__>  ri  rC   c                 h    | j         %| j        r| j                                        | _         | j         S r   )rT  r   Subscriptionr   s    rA   r8  zEvent.subscriptionA  s1    %$.%!%!<!<!>!>D!!rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r|   rT  r   s     rA   r8  zEvent.subscriptionG  s+    }Us 2 2 22"rC   c                 h    | j         %| j        r| j                                        | _         | j         S r   )rU  r   Publicationr   s    rA   r#  zEvent.publicationL  s1    $$ $ : : < <D  rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r|   rU  r   s     rA   r#  zEvent.publicationR  s+    }Us 2 2 22!rC   c                     | j         ]| j        rV| j                                        r=t          j        t          | j                                                            | _         | j         S r   rx  r   s    rA   r0  z
Event.argsW  r}  rC   c                 V    |t          |          t          t          fv sJ || _        d S r   r  r   s     rA   r0  z
Event.args^  r  rC   c                     | j         ]| j        rV| j                                        r=t          j        t          | j                                                            | _         | j         S r   r  r   s    rA   r   zEvent.kwargsc  r  rC   c                 L    |t          |          t          k    sJ || _        d S r   r  r   s     rA   r   zEvent.kwargsj  r  rC   c                     | j         >| j        r7| j                                        r| j                                        | _         | j         S r   r  r   s    rA   r1  zEvent.payloado  r  rC   c                 L    |t          |          t          k    sJ || _        d S r   r  r   s     rA   r1  zEvent.payloadv  r  rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   )rV  r   	Publisher)r   r   s     rA   r   zEvent.publisher{  s;    ?"t~"0022I ,"+rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r|   rV  r   s     rA   r   zEvent.publisher  s(    }Us 2 2 22rC   c                     | j         <| j        r5| j                                        }|r|                    d          | _         | j         S rn  )rW  r   PublisherAuthidrY   rr  s     rA   r\  zEvent.publisher_authid  r  rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   rK   rW  r   s     rA   r\  zEvent.publisher_authid  r  rC   c                     | j         <| j        r5| j                                        }|r|                    d          | _         | j         S rn  )rX  r   PublisherAuthrolerY   rr  s     rA   r]  zEvent.publisher_authrole  sJ    #++0022A <+,88F+;+;(''rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   rK   rX  r   s     rA   r]  zEvent.publisher_authrole  s+    }Us 2 2 22#(   rC   c                     | j         <| j        r5| j                                        }|r|                    d          | _         | j         S rn  rp  rr  s     rA   rZ  zEvent.topic  rs  rC   c                 L    |t          |          t          k    sJ || _        d S r   ru  r   s     rA   rZ  zEvent.topic  rv  rC   c                 h    | j         %| j        r| j                                        | _         | j         S r   )rY  r   Retainedr   s    rA   r^  zEvent.retained  s.    >!dn!!^4466DN~rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r   rY  r   s     rA   r^  zEvent.retained  s(    }Ut 3 3 33rC   c                     | j         <| j        r5| j                                        }|r|                    d          | _         | j         S rn  r  rr  s     rA   rd  zEvent.transaction_hash  r  rC   c                 L    |t          |          t          k    sJ || _        d S r   r  r   s     rA   rd  zEvent.transaction_hash  r  rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   )rZ  r   r  )r   r_  s     rA   r_  zEvent.x_acknowledged_delivery  s@    (0T^0&*n&@&@&B&B#& H0G-,,rC   c                 L    |t          |          t          k    sJ || _        d S r   )rJ   r   rZ  r   s     rA   r_  zEvent.x_acknowledged_delivery  s+    }Ut 3 3 33(-%%%rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   r  r  s     rA   rN   zEvent.enc_algo  r  rC   c                 H    ||t           t          t          fv sJ || _        d S r   r  r   s     rA   rN   zEvent.enc_algo  r  rC   c                     | j         >| j        r7| j                                        r| j                                        | _         | j         S r   r  r   s    rA   r2  zEvent.enc_key  r  rC   c                 L    |t          |          t          k    sJ || _        d S r   r  r   s     rA   r2  zEvent.enc_key  r  rC   c                 p    | j         )| j        r"| j                                        }|r|| _         | j         S r   r  r  s     rA   rQ   zEvent.enc_serializer  r  rC   c                 T    ||t           t          t          t          fv sJ || _        d S r   r  r   s     rA   rQ   zEvent.enc_serializer  r  rC   c                     | j         S r   r  r   s    rA   r5  zEvent.forward_for  r  rC   c                     || _         d S r   r  r   s     rA   r5  zEvent.forward_for  r  rC   c                 ^    t          t          j                             | d                    S r  )r   r   GetRootAsEventr   s    rA   r   z
Event.cast  s&    k/>>sAFFGGGGrC   c                 L   | j         }|r'|                    t          j        |                    }| j        }|r'|                    t          j        |                    }| j        }|r|                    |          }| j        }|r|                    |          }| j        }|r|                    |          }| j	        }|r|                    |          }| j
        }|r|                    |          }| j        }	|	r|                    |	          }	t          j                            |           | j        r%t          j                            || j                   | j        r%t          j                            || j                   |r t          j                            ||           |r t          j                            ||           |r t          j                            ||           | j        r%t          j                            || j                   |r t          j                            ||           |r t          j                            ||           |r t          j                            ||           | j        %t          j                            || j                   | t          j                            ||           | j        %t          j                            || j                   | j         r%t          j        !                    || j                    |	r t          j        "                    ||	           | j#        r%t          j        $                    || j#                   t          j        %                    |          }
t          j&        '                    |           t          j&        (                    |t          j)        j*                   t          j&        +                    ||
           t          j&        ,                    |          }|S r   )-r0  r  rz  r  r   r1  r\  r  r]  rZ  rd  r2  r   EventGen
EventStartr8  EventAddSubscriptionr#  EventAddPublicationEventAddArgsEventAddKwargsEventAddPayloadr   EventAddPublisherEventAddPublisherAuthidEventAddPublisherAuthroleEventAddTopicr^  EventAddRetainedEventAddTransactionHashr_  EventAddAcknowledgerN   EventAddEncAlgoEventAddEncKeyrQ   EventAddEncSerializerEventEndr   r  r  r  EVENTr	  r
  )r   r   r0  r   r1  r\  r]  rZ  rd  r2  r  r  s               rA   r   zEvent.build  s   y 	?++EK,=,=>>D 	C--ek&.A.ABBF, 	8..w77G0 	F&334DEE!4 	J!(!5!56H!I!I
 	0((//E0 	F&334DEE, 	8..w77G''000 	R 55gt?PQQQ 	P 44Wd>NOOO 	= --gt<<< 	A //@@@ 	C 00'BBB> 	L 227DNKKK 	T 88BRSSS 	X ::7DVWWW 	? ..w>>>=$ 11'4=III' 88BRSSS'3 44Wd>Z[[[= 	I 00$-HHH 	B //AAA 	U 66w@STTT "++G44((111--g{7N7TUUU))'3777'227;;	rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }t          | d         d	          }d
}d
}d
}d
}d
}d
}	t          |           dk    rt          | d                   t          k    r| d         }|	                    dd
          }|r1t          |          s"t          d                    |                    |	                    dd
          }|rGt          |          t          k    r/t          d                    t          |                              |	                    dd
          }	|	r1t          |	          s"t          d                    |	                    nt          |           dk    rQ| d         }|Gt          |          t          k    r/t          d                    t          |                              t          |           dk    rO| d         }t          |          t          k    r/t          d                    t          |                              d
}
d
}d
}d
}d
}d
}d
}d
}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}
d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rO|d         }t          |          t           k    r/t          d                    t          |                              d|v rQ|d         }t          |          t          k    r/t          d                     t          |                              |}d!|v rO|d!         }t          |          t           k    r/t          d"                    t          |                              d#|v r|d#         }d$}t          |          t          k    r|D ]}t          |          t          k    r nmd%|vst          |d%                   t          k    r nId&|vst          |d&                   t          k    r n%d'|vst          |d'                   t          k    r nd(}|st          d)          t          ||||||
|||||||||	|*          }|S )+r   r   r  z$invalid message length {0} for EVENTr7   z'subscription' in EVENTr8   z'publication' in EVENTr9   z'details' in EVENTNrE   rD   rN   r;  r2  r<  rQ   r=  z$invalid type {0} for 'args' in EVENTz&invalid type {0} for 'kwargs' in EVENTr   z0invalid type {0} for 'publisher' detail in EVENTr\  z7invalid type {0} for 'publisher_authid' detail in EVENTr]  z9invalid type {0} for 'publisher_authrole' detail in EVENTrZ  z,invalid type {0} for 'topic' detail in EVENTr^  z/invalid type {0} for 'retained' detail in EVENTrd  7invalid type {0} for 'transaction_hash' detail in EVENTr_  z>invalid type {0} for 'x_acknowledged_delivery' detail in EVENTr5  Fr  r   r   Tz?invalid type/value {0} for/within 'forward_for' option in EVENT)r0  r   r1  r   r\  r]  rZ  r^  rd  r_  rN   r2  rQ   r5  )r[   r   r   r   rZ   r'   r(   rJ   rV   r  r)   rK   r*   r   r   r|   r   )r   r8  r#  r   r0  r   r1  rN   r2  rQ   r   r\  r]  rZ  r^  rd  r5  r_  detail_publisherdetail_publisher_authiddetail_publisher_authroledetail_topicdetail_transaction_hashrA  r8  r   s                             rA   r   zEvent.parseZ  s    4yy1}}aE,>!>!>!>>t99I%% F M McRVii X XYYY(a2KLL'Q1IJJ&tAw0DEEt99>>d47mmu441gG{{:t44H i 1( ; ; i#$V$]$]^f$g$ghhhkk)T22G l4==C//#$T$[$[\`ah\i\i$j$jkkk$[[)94@@N u&=n&M&M u#$\$c$cdr$s$sttt 4yy1}}Aw#T

d(:(:'(N(U(UVZ[_V`V`(a(abbb4yy1}}a<<4'''(P(W(WX\]cXdXd(e(efff	!"&'!!&{3$%%,,#$V$]$]^bcs^t^t$u$uvvv(I((&-.@&A#+,,33#$]$d$dei  kB  fC  fC  %D  %D  E  E  E67**(/0D(E%-..#55#$_$f$fgk  mF  hG  hG  %H  %H  I  I  I!:g"7+LL!!S((#$R$Y$YZ^_kZlZl$m$mnnn E  z*HH~~%%#$U$\$\]abj]k]k$l$lmmm((&-.@&A#+,,33#$]$d$dei  kB  fC  fC  %D  %D  E  E  E6$//&-.G&H#+,,44#$d$k$klp  rI  mJ  mJ  %K  %K  L  L  LG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K g#$efffL!#'%5'9%%5,C%##1 +- - -" 
rC   c                    i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d	<   | j        rS| j	        
| j	        |d
<   | j
        
| j
        |d<   | j        
| j        |d<   t          j        | j        | j        || j        gS | j        r&t          j        | j        | j        || j        | j        gS | j        r t          j        | j        | j        || j        gS t          j        | j        | j        |gS )r   Nr   r\  r]  rZ  r^  rd  r_  r5  rN   r2  rQ   )r   r\  r]  rZ  r^  rd  r_  r5  r1  rN   r2  rQ   r   r   r8  r#  r   r0  r  s     rA   r   zEvent.marshal  s    >%#'>GK  ,*.*?G&'".,0,CG():!#zGG=$"&-GJ ,*.*?G&''3151MG-.'%)%5GM"< 	Z}(&*m
#|'%)\	"".,0,?()&(94;KWVZVbcc{ Z*D,=t?OQXZ^Zceiepqq Z*D,=t?OQXZ^Zcdd*D,=t?OQXYYrC   )NNNNNNNNNNNNNNNNN) r   r   r   r   r   r   r   r   r   r   r8  r   r#  r0  r   r1  r   r\  r]  rZ  r^  rd  r_  rN   r2  rQ   r5  r   r   r   r   r   r<   rC   rA   r   r   m  ss       	 	 L0Id ]aW[OSOS	e( e( e( e(N% % %N& & & " " X"
 # # # ! ! X!
 " " "   X 
[  [   X ]  ]   X ^  ^   X       & & X& ' ' ' ( ( X( ) ) )   X \  \   X
 _  _ & & X& ' ' ' - - X- #. . $#.   X _  _   X ^  ^ $ $ X$ % % % ! ! X! " " " H H \HP P Pd R R \Rh/Z /Z /Z /Z /ZrC   r   c                   >    e Zd ZdZdZ	 dZd Zed             Zd Z	dS )EventReceivedzd
    A WAMP ``EVENT_RECEIVED`` message.

    Format: ``[EVENT_RECEIVED, EVENT.Publication|id]``
    iQ  )r#  c                 |    t          |          t          k    sJ t                              |            || _        dS )zl

        :param publication: The publication ID for the sent event.
        :type publication: int
        N)rJ   r|   r   r   r#  )r   r#  s     rA   r   zEventReceived.__init__2  s?     K  C''''&rC   c                 *   t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          |          }|S )r   r   r8   z-invalid message length {0} for EVENT_RECEIVEDr7   z'publication' in EVENT_RECEIVED)r[   r  r   r   rZ   r'   )r   r#  r   s      rA   r   zEventReceived.parse=  s     4yy1}}aM,F!F!F!FFt99>> O V VWZ[_W`W` a abbb'Q1RSSK((
rC   c                 (    t           j        | j        gS r  )r  r   r#  r   s    rA   r   zEventReceived.marshalS  s     *D,<==rC   Nr  r<   rC   rA   r  r  !  sj          LI	' 	' 	'   \*> > > > >rC   r  c                   `    e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 	 	 	 	 	 	 d	dZed             Zd Z	d Z
dS )
r   a[  
    A WAMP ``CALL`` message.

    Formats:

    * ``[CALL, Request|id, Options|dict, Procedure|uri]``
    * ``[CALL, Request|id, Options|dict, Procedure|uri, Arguments|list]``
    * ``[CALL, Request|id, Options|dict, Procedure|uri, Arguments|list, ArgumentsKw|dict]``
    * ``[CALL, Request|id, Options|dict, Procedure|uri, Payload|binary]``
    0   )r.  	procedurer0  r   r1  timeoutreceive_progressrd  rN   r2  rQ   r   caller_authidcaller_authroler5  Nc                    t          |          t          k    sJ t          |          t          k    sJ |t          |          t          t          fv sJ |t          |          t
          k    sJ |t          |          t          k    sJ ||||J |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |	t          |	          sJ |
t          |
          t          k    sJ |t          |          sJ |	|
|||	J |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t
          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _        || _        || _        t          |          | _        || _        || _        || _        || _        |	| _        |
| _        || _        || _        || _        || _        || _        dS )a	  

        :param request: The WAMP request ID of this request.
        :type request: int

        :param procedure: The WAMP or application URI of the procedure which should be called.
        :type procedure: str

        :param args: Positional values for application-defined call arguments.
           Must be serializable using any serializers in use.
        :type args: list or tuple or None

        :param kwargs: Keyword values for application-defined call arguments.
           Must be serializable using any serializers in use.
        :type kwargs: dict or None

        :param payload: Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
        :type payload: bytes or None

        :param timeout: If present, let the callee automatically cancel
           the call after this ms.
        :type timeout: int or None

        :param receive_progress: If ``True``, indicates that the caller wants to receive
           progressive call results.
        :type receive_progress: bool or None

        :param transaction_hash: An application provided transaction hash for the originating call, which may
            be used in the router to throttle or deduplicate the calls on the procedure. See the discussion
            `here <https://github.com/wamp-proto/wamp-proto/issues/391#issuecomment-998577967>`_.
        :type transaction_hash: str

        :param enc_algo: If using payload transparency, the encoding algorithm that was used to encode the payload.
        :type enc_algo: str or None

        :param enc_key: If using payload transparency with an encryption algorithm, the payload encryption key.
        :type enc_key: str or None

        :param enc_serializer: If using payload transparency, the payload object serializer that was used encoding the payload.
        :type enc_serializer: str or None

        :param caller: The WAMP session ID of the caller. Only filled if caller is disclosed.
        :type caller: None or int

        :param caller_authid: The WAMP authid of the caller. Only filled if caller is disclosed.
        :type caller_authid: None or unicode

        :param caller_authrole: The WAMP authrole of the caller. Only filled if caller is disclosed.
        :type caller_authrole: None or unicode

        :param forward_for: When this Publish is forwarded for a client (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   )rJ   r|   rK   r   r7  r   rV   r   r)   r*   r   r   r.  r  r0  r   r   r1  r  r  rd  rN   r2  rQ   r   r  r  r5  )r   r.  r  r0  r   r1  r  r  rd  rN   r2  rQ   r   r  r  r5  r8  s                    rA   r   zCall.__init__  s.   J G}}####I#%%%%|tDzzdE]::::~f!5!5!55$w--5"8"8"887#64<FNN[$w--3"6"6"66'40@+A+AT+I+I+II'40@+A+AS+H+H+HH #4X#>#>>$w--3"6"6"66%)@)P)P%%P W_9OU\Uhmu  nB  nB  C~f!4!4!44$](;(;s(B(B(BB&$*?*?3*F*F*FF"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G"	&v.. 0 0 !, *.&rC   c                    t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }t          | d         d	          }d
}d
}d
}d
}d
}d
}	t          |           dk    rt          | d                   t          t          fv r| d         }|                    dd
          }|r1t          |          s"t          d                    |                    |                    dd
          }|rGt          |          t          k    r/t          d                    t          |                              |                    dd
          }	|	r1t          |	          s"t          d                    |	                    nt          |           dk    rQ| d         }|Gt          |          t          k    r/t          d                    t          |                              t          |           dk    rO| d         }t          |          t          k    r/t          d                    t          |                              d
}
d
}d
}d
}d
}d
}d
}d|v ry|d         }t          |          t           k    r/t          d                    t          |                              |dk     r"t          d                    |                    |}
d|v rQ|d         }t          |          t"          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t           k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d |v rQ|d          }t          |          t          k    r/t          d!                    t          |                              |}d"|v r|d"         }d#}t          |          t          k    r|D ]}t          |          t          k    r nmd$|vst          |d$                   t           k    r nId%|vst          |d%                   t          k    r n%d&|vst          |d&                   t          k    r nd'}|st          d(          t          ||||||
|||||	||||)          }|S )*r   r   r  z#invalid message length {0} for CALLr7   z'request' in CALLr8   z'options' in CALLr9   z'procedure' in CALLNrE   rD   rN   z/invalid value {0} for 'enc_algo' detail in CALLr2  z-invalid type {0} for 'enc_key' detail in CALLrQ   z5invalid value {0} for 'enc_serializer' detail in CALLz#invalid type {0} for 'args' in CALLz%invalid type {0} for 'kwargs' in CALLr  z-invalid type {0} for 'timeout' option in CALLz.invalid value {0} for 'timeout' option in CALLr  z6invalid type {0} for 'receive_progress' option in CALLrd  z6invalid type {0} for 'transaction_hash' detail in CALLr   z,invalid type {0} for 'caller' detail in CALLr  z3invalid type {0} for 'caller_authid' detail in CALLr  z5invalid type {0} for 'caller_authrole' detail in CALLr5  Fr  r   r   Tz>invalid type/value {0} for/within 'forward_for' option in CALL)r0  r   r1  r  r  rd  rN   r2  rQ   r   r  r  r5  )r[   r   r   r   rZ   r'   r(   r%   rJ   rK   rV   r  r)   r*   r   r   r|   r   )r   r.  r  r  r0  r   r1  rN   r2  rQ   r  r  rd  r   r  r  r5  option_timeoutoption_receive_progressoption_transaction_hashoption_calleroption_caller_authidoption_caller_authrolerA  r8  r   s                             rA   r   z
Call.parse  sA    4yy1}}aD,=!=!=!==t99I%% E L LSQUYY W WXXX#DG-@AA&tAw0CDD&tAw0EFF	t99>>d47mmU|;;1gG{{:t44H h 1( ; ; h#$U$\$\]e$f$fgggkk)T22G k4==C//#$S$Z$Z[_`g[h[h$i$ijjj$[[)94@@N t&=n&M&M t#$[$b$bcq$r$rsss 4yy1}}Aw#T

d(:(:'(M(T(TUYZ^U_U_(`(`aaa4yy1}}a<<4'''(O(V(VW[\bWcWc(d(deee$Y/NN##s**#$S$Z$Z[_`n[o[o$p$pqqq!!#$T$[$[\j$k$klll$G((&-.@&A#+,,44#$\$c$cdh  jA  eB  eB  %C  %C  D  D  D6((&-.@&A#+,,33#$\$c$cdh  jA  eB  eB  %C  %C  D  D  D6w#H-MM""c))#$R$Y$YZ^_lZmZm$n$nooo"Fg%%#*?#; ())S00#$Y$`$`aefza{a{$|$|}}}0M''%,->%?"*++s22#$[$b$bcgh~cc  %A  %A  B  B  B4OG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K f#$deee7 ""$4$4$""0 !.#2*, , ,  
rC   c                 l   i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        r3| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j	        
| j	        |d	<   | j
        
| j
        |d
<   |S )Nr  r  rd  rN   r2  rQ   r   r  r  r5  )r  r  rd  r1  rN   r2  rQ   r   r  r  r5  r  s     rA   r  zCall.marshal_options  s    <#!%GI ,*.*?G&' ,*.*?G&'< 	@}(&*m
#|'%)\	"".,0,?();" $GH)'+'9GO$+)-)=G%&'%)%5GM"rC   c                 T   |                                  }| j        r t          j        | j        || j        | j        gS | j        r&t          j        | j        || j        | j        | j        gS | j        r t          j        | j        || j        | j        gS t          j        | j        || j        gS r  )r  r1  r   r   r.  r  r   r0  r  s     rA   r   zCall.marshal  s     &&((< 	R%t|Wdndl[[{ R)4<$.RVR[]a]hii R)4<$.RVR[\\)4<$.QQrC   )NNNNNNNNNNNNN)r   r   r   r   r   r   r   r   r   r  r   r<   rC   rA   r   r   ]  s        	 	 LI* "&"& $#!%!t' t' t' t'l R R \Rh  @R R R R RrC   r   c                   L    e Zd ZdZdZ	 dZdZdZdZddZ	e
d	             Zd
 ZdS )r   z
    A WAMP ``CANCEL`` message.

    Format: ``[CANCEL, CALL.Request|id, Options|dict]``

    See: https://wamp-proto.org/static/rfc/draft-oberstet-hybi-crossbar-wamp.html#rfc.section.14.3.4
    1   skipkill
killnowait)r.  moder5  Nc                 d   t          |          t          k    sJ |t          |          t          k    sJ |d| j        | j        | j        fv sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t          	                    |            || _
        || _        || _        dS )a  

        :param request: The WAMP request ID of the original `CALL` to cancel.
        :type request: int

        :param mode: Specifies how to cancel the call (``"skip"``, ``"killnowait"`` or ``"kill"``).
        :type mode: str or None

        :param forward_for: When this Cancel is forwarded for a client (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   )rJ   r|   rK   SKIP
KILLNOWAITKILLr   r   r   r   r.  r  r5  )r   r.  r  r5  r8  s        rA   r   zCancel.__init__  sU    G}}####|tDzzS0000di$)DDDDD"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G	 'rC   c                 $   t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }d}d}d	|v r|d	         }t          |          t          k    r/t          d
                    t          |                              |t          j	        t          j
        t          j        fvr"t          d                    |                    |}d|v r|d         }d}t          |          t          k    r|D ]}t          |          t          k    r nmd|vst          |d                   t          k    r nId|vst          |d                   t          k    r n%d|vst          |d                   t          k    r nd}|st          d          t          |||          }|S )r   r   r9   z%invalid message length {0} for CANCELr7   z'request' in CANCELr8   z'options' in CANCELNr  z,invalid type {0} for 'mode' option in CANCELz/invalid value '{0}' for 'mode' option in CANCELr5  Fr  r   r   Tz@invalid type/value {0} for/within 'forward_for' option in CANCEL)r  r5  )r[   r   r   r   rZ   r'   r(   rJ   rK   r  r  r  r   r   r|   )	r   r.  r  r  r5  option_moderA  r8  r   s	            rA   r   zCancel.parse  s    4yy1}}aF,?!?!?!??t99>> G N NsSWyy Y YZZZ#DG-BCC&tAw0EFF W!&/KK  C''#$R$Y$YZ^_jZkZk$l$lmmm6;0A6;"OOO#$U$\$\]h$i$ijjjDG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K h#$fgggW4[AAA
rC   c                 r    i }| j         
| j         |d<   | j        
| j        |d<   t          j        | j        |gS )r   Nr  r5  )r  r5  r   r   r.  r  s     rA   r   zCancel.marshal/  sD     9 "iGFO'%)%5GM"#T\7;;rC   rQ  )r   r   r   r   r   r  r  r  r   r   r   r   r   r<   rC   rA   r   r     s          L DDJI' ' ' '> 6 6 \6p< < < < <rC   r   c                   V    e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 	 	 	 	 ddZed             Zd Z	dS )	r   aO  
    A WAMP ``RESULT`` message.

    Formats:

    * ``[RESULT, CALL.Request|id, Details|dict]``
    * ``[RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list]``
    * ``[RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list, YIELD.ArgumentsKw|dict]``
    * ``[RESULT, CALL.Request|id, Details|dict, Payload|binary]``
    2   r.  r0  r   r1  progressrN   r2  rQ   r   r3  r4  r5  Nc                    t          |          t          k    sJ |t          |          t          t          fv sJ |t          |          t          k    sJ |t          |          t
          k    sJ ||||J |t          |          t          k    sJ |t          |          sJ |t          |          t          k    sJ |t          |          sJ |||||J |	t          |	          t          k    sJ |
t          |
          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _        || _        t          |          | _        || _        || _        || _        || _        || _        |	| _        |
| _        || _        || _        dS )as  

        :param request: The request ID of the original `CALL` request.
        :type request: int

        :param args: Positional values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type args: list or tuple or None

        :param kwargs: Keyword values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type kwargs: dict or None

        :param payload: Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
        :type payload: bytes or None

        :param progress: If ``True``, this result is a progressive call result, and subsequent
           results (or a final error) will follow.
        :type progress: bool or None

        :param enc_algo: If using payload transparency, the encoding algorithm that was used to encode the payload.
        :type enc_algo: str or None

        :param enc_key: If using payload transparency with an encryption algorithm, the payload encryption key.
        :type enc_key: str or None

        :param enc_serializer: If using payload transparency, the payload object serializer that was used encoding the payload.
        :type enc_serializer: str or None

        :param callee: The WAMP session ID of the effective callee that responded with the result. Only filled if callee is disclosed.
        :type callee: None or int

        :param callee_authid: The WAMP authid of the responding callee. Only filled if callee is disclosed.
        :type callee_authid: None or unicode

        :param callee_authrole: The WAMP authrole of the responding callee. Only filled if callee is disclosed.
        :type callee_authrole: None or unicode

        :param forward_for: When this Result is forwarded for a client/callee (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   rJ   r|   r   r7  r   rV   r   r)   rK   r*   r   r   r.  r0  r   r   r1  r  rN   r2  rQ   r   r3  r4  r5  r   r.  r0  r   r1  r  rN   r2  rQ   r   r3  r4  r5  r8  s                 rA   r   zResult.__init__`  s   l G}}####|tDzzdE]::::~f!5!5!55$w--5"8"8"887#64<FNN[4>>T#9#9#99#4X#>#>>$w--3"6"6"66%)@)P)P%%P W_9OU\Uhmu  nB  nB  C~f!4!4!44$](;(;s(B(B(BB&$*?*?3*F*F*FF"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G	&v..  !, *. 'rC   c                 	   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }d}d}d}d}d}d}d}	d}
d}d}d}t          |           d	k    rt          | d
                   t          t          fv r| d
         }|
                    dd          }|r1t          |          s"t          d                    |                    |
                    dd          }|rGt          |          t          k    r/t          d                    t          |                              |
                    dd          }	|	r1t          |	          s"t          d                    |	                    nt          |           d
k    rQ| d
         }|Gt          |          t          k    r/t          d                    t          |                              t          |           d	k    rO| d	         }t          |          t          k    r/t          d                    t          |                              d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t           k    r/t          d                    t          |                              |}
d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v r|d         }d}t          |          t          k    r|D ]}t          |          t          k    r nmd|vst          |d                   t           k    r nId|vst          |d                   t          k    r n%d|vst          |d                   t          k    r nd }|st          d!          t          ||||||||	|
|||"          }|S )#r   r   r9   rD   rE   z%invalid message length {0} for RESULTr7   z'request' in RESULTr8   z'details' in RESULTNrD   r9   rN   z1invalid value {0} for 'enc_algo' detail in RESULTr2  z/invalid type {0} for 'enc_key' detail in RESULTrQ   z7invalid value {0} for 'enc_serializer' detail in RESULTz%invalid type {0} for 'args' in RESULTz'invalid type {0} for 'kwargs' in RESULTr  z0invalid type {0} for 'progress' option in RESULTr   z.invalid type {0} for 'callee' detail in RESULTr3  z5invalid type {0} for 'callee_authid' detail in RESULTr4  z7invalid type {0} for 'callee_authrole' detail in RESULTr5  Fr  r   r   Tz@invalid type/value {0} for/within 'forward_for' option in RESULTr0  r   r1  r  rN   r2  rQ   r   r3  r4  r5  )r[   r   r   r   rZ   r'   r(   rJ   rK   rV   r  r)   r*   r   r   r   r|   )r   r.  r   r0  r   r1  r  rN   r2  rQ   r   r3  r4  r5  detail_progressr>  r?  r@  rA  r8  r   s                        rA   r   zResult.parse  s    4yy1}}aF,?!?!?!??t99I%% G N NsSWyy Y YZZZ#DG-BCC&tAw0EFFt99>>d47mmU|;;1gG{{:t44H j 1( ; ; j#$W$^$^_g$h$hiiikk)T22G m4==C//#$U$\$\]abi]j]j$k$klll$[[)94@@N v&=n&M&M v#$]$d$des$t$tuuu 4yy1}}Aw#T

d(:(:'(O(V(VW[\`WaWa(b(bccc4yy1}}a<<4'''(Q(X(XY]^dYeYe(f(fggg  %j1OO$$,,#$V$]$]^bcr^s^s$t$tuuu&Hw#H-MM""c))#$T$[$[\`an\o\o$p$pqqq"Fg%%#*?#; ())S00#$[$b$bcgh|c}c}$~$~0M''%,->%?"*++s22#$]$d$dei  kA  fB  fB  %C  %C  D  D  D4OG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K h#$fgggW"$&&$$2"#0%4!,. . . 
rC   c                    i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        rM| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d	<   t          j
        | j        || j        gS | j        r t          j
        | j        || j        | j        gS | j        rt          j
        | j        || j        gS t          j
        | j        |gS 
r   Nr  r   r3  r4  r5  rN   r2  rQ   )r  r   r3  r4  r5  r1  rN   r2  rQ   r   r   r.  r   r0  r  s     rA   r   zResult.marshal=  s,    =$"&-GJ;" $GH)'+'9GO$+)-)=G%&'%)%5GM"< 	D}(&*m
#|'%)\	"".,0,?()'wMM{ D+T\7DIt{[[ D+T\7DINN+T\7CCrC   NNNNNNNNNNNr  r<   rC   rA   r   r   @  s        	 	 LI"  $#!%!`' `' `' `'D x x \xt#D #D #D #D #DrC   r   c                   t    e Zd ZdZdZ	 dZdZdZdZdZ	dZ
d	Zd
ZdZdZ	 	 	 	 	 ddZed             Zd Zd ZdS )r   zk
    A WAMP ``REGISTER`` message.

    Format: ``[REGISTER, Request|id, Options|dict, Procedure|uri]``
    @   r)  r*  r+  singlefirstlast
roundrobinrandomall)r.  r  rM   invokeconcurrencyforce_reregisterr5  Nc                 &   t          |          t          k    sJ t          |          t          k    sJ |t          |          t          k    sJ |'|t          j        t          j        t          j        fv sJ |t          |          t          k    sJ |=|t          j        t          j        t          j	        t          j
        t          j        fv sJ | t          |          t          k    r|dk    sJ |dv sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _        || _        |pt          j        | _        |pt          j        | _        || _        || _        || _        dS )a  

        :param request: The WAMP request ID of this request.
        :type request: int

        :param procedure: The WAMP or application URI of the RPC endpoint provided.
        :type procedure: str

        :param match: The procedure matching policy to be used for the registration.
        :type match: str

        :param invoke: The procedure invocation policy to be used for the registration.
        :type invoke: str

        :param concurrency: The (maximum) concurrency to be used for the registration.
        :type concurrency: int

        :param forward_for: When this Register is forwarded over a router-to-router link,
            or via an intermediary router.
        :type forward_for: list[dict]
        Nr   )NTFr  r   r   )rJ   r|   rK   r   r.  r/  r0  INVOKE_SINGLEINVOKE_FIRSTINVOKE_LASTINVOKE_ROUNDROBININVOKE_RANDOMr   r   r   r   r.  r  rM   r  r  r  r5  )	r   r.  r  rM   r  r  r  r5  r8  s	            rA   r   zRegister.__init__  s>   : G}}####I#%%%%}Us 2 2 22}(*>@UW_Wn)o o o oo~f!4!4!44~H,BHDY[c[oqy  rL  NV  Nd  ,e  "e  "e  "e  e"tK'8'8C'?'?KRSOOOT#66666"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G"2h2
6 6& 0&rC   c           	      &   t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }t          j        }t          j        }d}d}d}d	|v r|d	         }t          |          t          k    r/t          d
                    t          |                              |t          j        t          j        t          j        fvr"t          d                    |                    |}|t          j        k    rd}	d}
n9|t          j        k    rd}	d}
n$|t          j        k    rd}	d}
nt          d          t          | d         d|	|
          }d|v r|d         }t          |          t          k    r/t          d                    t          |                              |t          j        t          j        t          j        t          j        t          j        fvr"t          d                    |                    |}d|v ry|d         }t          |          t&          k    r/t          d                    t          |                              |dk     r"t          d                    |                    |}|                    dd          }|dvr/t          d                    t          |                              ||}d|v r|d         }d}t          |          t*          k    r|D ]}t          |          t,          k    r nmd|vst          |d                   t&          k    r nId|vst          |d                   t          k    r n%d|vst          |d                   t          k    r nd}|st          d          t          |||||||           }|S )!r   r   rD   z'invalid message length {0} for REGISTERr7   z'request' in REGISTERr8   z'options' in REGISTERNrM   z/invalid type {0} for 'match' option in REGISTERz0invalid value {0} for 'match' option in REGISTERFTzlogic errorr9   z'procedure' in REGISTER)rm   rn   r  z0invalid type {0} for 'invoke' option in REGISTERz1invalid value {0} for 'invoke' option in REGISTERr  z5invalid type {0} for 'concurrency' option in REGISTERz6invalid value {0} for 'concurrency' option in REGISTERr  )TFNz9invalid type {0} for 'force_reregister option in REGISTERr5  r  r   r   zBinvalid type/value {0} for/within 'forward_for' option in REGISTER)rM   r  r  r  r5  )r[   r   r   r   rZ   r'   r(   r.  r  rJ   rK   r/  r0  	Exceptionr%   r  r  r  r  r|   r  r   r   )r   r.  r  rM   r  r  r  r5  r2  rm   rn   r  option_invokeoptions_concurrencyoptions_reregisterrA  r8  r   s                     rA   r   zRegister.parse  sj    4yy1}}aH,A!A!A!AAt99>> I P PQTUYQZQZ [ [\\\#DG-DEE&tAw0GHH$'g"7+LL!!S((#$U$\$\]abn]o]o$p$pqqqH$8(:OQYQh#iii#$V$]$]^j$k$klll EH(((%*"$h+++%*"#h---%)"$ M***&tAw0Ibx  L\  ]  ]  ]	w#H-MM""c))#$V$]$]^bcp^q^q$r$rsssX%;X=RT\Thjr  kE  GO  G]  %^  ^  ^#$W$^$^_l$m$mnnn"FG##")-"8'((C//#$[$b$bcgh{c|c|$}$}~~~"Q&&#$\$c$cdw$x$xyyy-K$[[);TBB%888KRR+,,   
 )1G##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K j#$hiiiw	vS^(8kS S S 
rC   c                    i }| j         r| j         t          j        k    r
| j         |d<   | j        r| j        t          j        k    r
| j        |d<   | j        r
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S )NrM   r  r  r  r5  )rM   r   r.  r  r  r  r  r5  r  s     rA   r  zRegister.marshal_options&  s    : 	*$*(<<<#zGG; 	,4;(*@@@ $GH 	6%)%5GM" ,*.*?G&''%)%5GM"rC   c                 Z    t           j        | j        |                                 | j        gS r  )r   r   r.  r  r  r   s    rA   r   zRegister.marshal:  s&     %t|T5I5I5K5KT^\\rC   )NNNNN)r   r   r   r   r   r.  r/  r0  r  r  r  r  r  
INVOKE_ALLr   r   r   r   r  r   r<   rC   rA   r   r   c  s          L KLNMLK$MJI !"&!4' 4' 4' 4'l i i \iV  (] ] ] ] ]rC   r   c                   >    e Zd ZdZdZ	 dZd Zed             Zd Z	dS )r   zl
    A WAMP ``REGISTERED`` message.

    Format: ``[REGISTERED, REGISTER.Request|id, Registration|id]``
    A   )r.  registrationc                     t          |          t          k    sJ t          |          t          k    sJ t                              |            || _        || _        dS )z

        :param request: The request ID of the original ``REGISTER`` request.
        :type request: int

        :param registration: The registration ID for the registered procedure (or procedure pattern).
        :type registration: int
        N)rJ   r|   r   r   r.  r  )r   r.  r  s      rA   r   zRegistered.__init__U  r:  rC   c                 X   t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }t          ||          }|S )r   r   r9   z)invalid message length {0} for REGISTEREDr7   z'request' in REGISTEREDr8   z'registration' in REGISTERED)r[   r   r   r   rZ   r'   )r   r.  r  r   s       rA   r   zRegistered.parsee  r<  rC   c                 4    t           j        | j        | j        gS r  )r   r   r.  r  r   s    rA   r   zRegistered.marshal|  r>  rC   Nr  r<   rC   rA   r   r   D  r?  rC   r   c                   @    e Zd ZdZdZ	 dZddZed             Zd Z	dS )	r    z
    A WAMP `UNREGISTER` message.

    Formats:

    * ``[UNREGISTER, Request|id, REGISTERED.Registration|id]``
    * ``[UNREGISTER, Request|id, REGISTERED.Registration|id, Options|dict]``
    B   )r.  r  r5  Nc                     t          |          t          k    sJ t          |          t          k    sJ t                              |            || _        || _        || _        dS )a  

        :param request: The WAMP request ID of this request.
        :type request: int

        :param registration: The registration ID for the registration to unregister.
        :type registration: int

        :param forward_for: When this Unregister is forwarded over a router-to-router link,
            or via an intermediary router.
        :type forward_for: list[dict]
        N)rJ   r|   r   r   r.  r  r5  )r   r.  r  r5  s       rA   r   zUnregister.__init__  se     G}}####L!!S(((((&rC   c                 >   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }d}t          |           d	k    rt          | d	         d
          }d}|rd|v r|d         }d}t          |          t          k    r|D ]}t          |          t          k    r nmd|vst          |d                   t          k    r nId|vst          |d                   t          k    r n%d|vst          |d                   t          k    r nd}|st          d          t          |||          }|S )r   r   rD  z.invalid message length {0} for WAMP UNREGISTERr7   z'request' in UNREGISTERr8   z'registration' in UNREGISTERNr9   z'options' in UNREGISTERr5  Fr  r   r   TzDinvalid type/value {0} for/within 'forward_for' option in UNREGISTERrE  )r[   r    r   r   rZ   r'   r(   rJ   r   r   r|   rK   )r   r.  r  r  r5  rA  r8  r   s           rA   r   zUnregister.parse  s    4yy1}}aJ,C!C!C!CCt99F"" P W WX[\`XaXa b bccc#DG-FGG(a2PQQt99q==*474MNNG 	l}//!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K l#$jkkk,KHHH
rC   c                     | j         r#d| j         i}t          j        | j        | j        |gS t          j        | j        | j        gS rG  )r5  r    r   r.  r  r  s     rA   r   zUnregister.marshal  sM      	Nt/G +T\4;LgVV+T\4;LMMrC   r   r  r<   rC   rA   r    r      su          LI' ' ' '* + + \+ZN N N N NrC   r    c                   @    e Zd ZdZdZ	 dZddZed             Zd Z	dS )	r!   z
    A WAMP ``UNREGISTERED`` message.

    Formats:

    * ``[UNREGISTERED, UNREGISTER.Request|id]``
    * ``[UNREGISTERED, UNREGISTER.Request|id, Details|dict]``
    C   )r.  r  r  Nc                 4   t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |dk    r||dk    r|dk    sJ t                              |            || _        || _        || _        dS )ay  

        :param request: The request ID of the original ``UNREGISTER`` request.
        :type request: int

        :param registration: If unregister was actively triggered by router, the ID
            of the registration revoked.
        :type registration: int or None

        :param reason: The reason (an URI) for revocation.
        :type reason: str or None.
        Nr   )rJ   r|   rK   r   r   r.  r  r  )r   r.  r  r  s       rA   r   zUnregistered.__init__  s     G}}#####tL'9'9S'@'@'@@~f!4!4!441!57a<<L\]L]L]L]^(rC   c                 b   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }d}d}t          |           dk    rt          | d         d          }d	|v rQ|d	         }t          |          t          k    r/t          d
                    t          |                              |}d|v rt          |d         d          }t          |||          }|S )r   r   rL  z+invalid message length {0} for UNREGISTEREDr7   z'request' in UNREGISTEREDNr8   z'details' in UNREGISTEREDr  z:invalid type {0} for 'registration' detail in UNREGISTEREDr  z'reason' in UNREGISTERED)
r[   r!   r   r   rZ   r'   r(   rJ   r|   r%   )r   r.  r  r  r   details_registrationr   s          rA   r   zUnregistered.parse  rN  rC   c                     | j         | j        8i }| j         
| j         |d<   | j        
| j        |d<   t          j        | j        |gS t          j        | j        gS )r   Nr  r  )r  r  r!   r   r.  r  s     rA   r   zUnregistered.marshal@  rP  rC   rQ  r  r<   rC   rA   r!   r!     sp          LI   . # # \#J= = = = =rC   r!   c                   \    e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZed             Zd Z	dS )	r"   a  
    A WAMP ``INVOCATION`` message.

    Formats:

    * ``[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict]``
    * ``[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list]``
    * ``[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list, CALL.ArgumentsKw|dict]``
    * ``[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, Payload|binary]``
    D   )r.  r  r0  r   r1  r  r  r   r  r  r  rd  rN   r2  rQ   r5  Nc                    t          |          t          k    sJ t          |          t          k    sJ |t          |          t          t          fv sJ |t          |          t          k    sJ |t          |          t
          k    sJ ||||J |t          |          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |	t          |	          t          k    sJ |
t          |
          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |t          |          sJ |t          |          t          k    sJ |t          |          sJ |||||J |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _        || _        || _        t          |          | _        || _        || _        || _        || _        |	| _        |
| _        || _        || _        || _        || _        || _        || _        dS )a	  

        :param request: The WAMP request ID of this request.
        :type request: int

        :param registration: The registration ID of the endpoint to be invoked.
        :type registration: int

        :param args: Positional values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type args: list or tuple or None

        :param kwargs: Keyword values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type kwargs: dict or None

        :param payload: Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
        :type payload: bytes or None

        :param timeout: If present, let the callee automatically cancels
           the invocation after this ms.
        :type timeout: int or None

        :param receive_progress: Indicates if the callee should produce progressive results.
        :type receive_progress: bool or None

        :param caller: The WAMP session ID of the caller. Only filled if caller is disclosed.
        :type caller: None or int

        :param caller_authid: The WAMP authid of the caller. Only filled if caller is disclosed.
        :type caller_authid: None or unicode

        :param caller_authrole: The WAMP authrole of the caller. Only filled if caller is disclosed.
        :type caller_authrole: None or unicode

        :param procedure: For pattern-based registrations, the invocation MUST include the actual procedure being called.
        :type procedure: str or None

        :param transaction_hash: An application provided transaction hash for the originating call, which may
            be used in the router to throttle or deduplicate the calls on the procedure. See the discussion
            `here <https://github.com/wamp-proto/wamp-proto/issues/391#issuecomment-998577967>`_.
        :type transaction_hash: str

        :param enc_algo: If using payload transparency, the encoding algorithm that was used to encode the payload.
        :type enc_algo: str or None

        :param enc_key: If using payload transparency with an encryption algorithm, the payload encryption key.
        :type enc_key: str or None

        :param enc_serializer: If using payload transparency, the payload object serializer that was used encoding the payload.
        :type enc_serializer: str or None

        :param forward_for: When this Call is forwarded for a client (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   )rJ   r|   r   r7  r   rV   r   rK   r)   r*   r   r   r.  r  r0  r   r   r1  r  r  r   r  r  r  rd  rN   r2  rQ   r5  )r   r.  r  r0  r   r1  r  r  r   r  r  r  rd  rN   r2  rQ   r5  r8  s                     rA   r   zInvocation.__init__v  sP   P G}}####L!!S((((|tDzzdE]::::~f!5!5!55$w--5"8"8"887#64<FNN[$w--3"6"6"66'40@+A+AT+I+I+II~f!4!4!44$](;(;s(B(B(BB&$*?*?3*F*F*FF DOOs$:$:$::'40@+A+AS+H+H+HH#4X#>#>>$w--3"6"6"66%)@)P)P%%P W_9OU\Uhmu  nB  nB  C"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G(	&v.. 0*." 0 , 'rC   c                 8   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }t          | d         d	          }d
}d
}d
}d
}d
}d
}	t          |           dk    rt          | d                   t          k    r| d         }|	                    dd
          }|r1t          |          s"t          d                    |                    |	                    dd
          }|rGt          |          t          k    r/t          d                    t          |                              |	                    dd
          }	|	r1t          |	          s"t          d                    |	                    nt          |           dk    rQ| d         }|Gt          |          t          k    r/t          d                    t          |                              t          |           dk    rO| d         }t          |          t          k    r/t          d                    t          |                              d
}
d
}d
}d
}d
}d
}d
}d
}d|v ry|d         }t          |          t          k    r/t          d                    t          |                              |dk     r"t          d                    |                    |}
d|v rQ|d         }t          |          t           k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d |v rQ|d          }t          |          t          k    r/t          d!                    t          |                              |}d"|v rQ|d"         }t          |          t          k    r/t          d#                    t          |                              |}d$|v r|d$         }d%}t          |          t          k    r|D ]}t          |          t          k    r nmd&|vst          |d&                   t          k    r nId'|vst          |d'                   t          k    r n%d(|vst          |d(                   t          k    r nd)}|st          d*          t          ||||||
|||||||||	|+          }|S ),r   r   r  z)invalid message length {0} for INVOCATIONr7   z'request' in INVOCATIONr8   z'registration' in INVOCATIONr9   z'details' in INVOCATIONNrE   rD   rN   z5invalid value {0} for 'enc_algo' detail in INVOCATIONr2  z3invalid type {0} for 'enc_key' detail in INVOCATIONrQ   z;invalid value {0} for 'enc_serializer' detail in INVOCATIONz)invalid type {0} for 'args' in INVOCATIONz+invalid type {0} for 'kwargs' in INVOCATIONr  z3invalid type {0} for 'timeout' detail in INVOCATIONz4invalid value {0} for 'timeout' detail in INVOCATIONr  z<invalid type {0} for 'receive_progress' detail in INVOCATIONr   z2invalid type {0} for 'caller' detail in INVOCATIONr  z9invalid type {0} for 'caller_authid' detail in INVOCATIONr  z;invalid type {0} for 'caller_authrole' detail in INVOCATIONr  z5invalid type {0} for 'procedure' detail in INVOCATIONrd  r  r5  Fr  r   r   TzDinvalid type/value {0} for/within 'forward_for' option in INVOCATION)r0  r   r1  r  r  r   r  r  r  rd  rN   r2  rQ   r5  )r[   r"   r   r   rZ   r'   r(   rJ   rV   r  r)   rK   r*   r   r   r|   r   )r   r.  r  r   r0  r   r1  rN   r2  rQ   r  r  r   r  r  r  rd  r5  detail_timeoutdetail_receive_progressdetail_callerdetail_caller_authiddetail_caller_authroledetail_procedurer  rA  r8  r   s                               rA   r   zInvocation.parse  s    4yy1}}aJ,C!C!C!CCt99I%% K R RSVW[S\S\ ] ]^^^#DG-FGG(a2PQQ&tAw0IJJt99>>d47mmu441gG{{:t44H n 1( ; ; n#$[$b$bck$l$lmmmkk)T22G q4==C//#$Y$`$`aefmanan$o$oppp$[[)94@@N z&=n&M&M z#$a$h$hiw$x$xyyy 4yy1}}Aw#T

d(:(:'(S(Z(Z[_`d[e[e(f(fggg4yy1}}a<<4'''(U(\(\]abh]i]i(j(jkkk	$Y/NN##s**#$Y$`$`aeftauau$v$vwww!!#$Z$a$abp$q$qrrr$G((&-.@&A#+,,44#$b$i$ijn  pG  kH  kH  %I  %I  J  J  J6w#H-MM""c))#$X$_$_`der`s`s$t$tuuu"Fg%%#*?#; ())S00#$_$f$fgk  mA  hB  hB  %C  %C  D  D  D0M''%,->%?"*++s22#$a$h$him  oE  jF  jF  %G  %G  H  H  H4O'!!&{3$%%,,#$[$b$bcghxcycy$z$z{{{(I((&-.@&A#+,,33#$]$d$dei  kB  fC  fC  %D  %D  E  E  E6G##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K l#$jkkk%" &!(!(*: &'4)8#,*:"*!((6%02 2 2" 
rC   c                    i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d	<   | j        rS| j	        
| j	        |d
<   | j
        
| j
        |d<   | j        
| j        |d<   t          j        | j        | j        || j        gS | j        r&t          j        | j        | j        || j        | j        gS | j        r t          j        | j        | j        || j        gS t          j        | j        | j        |gS )r   Nr  r  r   r  r  r  rd  r5  rN   r2  rQ   )r  r  r   r  r  r  rd  r5  r1  rN   r2  rQ   r"   r   r.  r  r   r0  r  s     rA   r   zInvocation.marshal  s    <#!%GI ,*.*?G&';" $GH)'+'9GO$+)-)=G%&>%#'>GK  ,*.*?G&''%)%5GM"< 	[}(&*m
#|'%)\	"".,0,?()+T\4;LgW[Wcdd{ ["/t?PRY[_[dfjfqrr ["/t?PRY[_[dee"/t?PRYZZrC   )NNNNNNNNNNNNNNr  r<   rC   rA   r"   r"   R  s        	 	 LI, "&#!%"& $!!t' t' t' t'l \ \ \\|/[ /[ /[ /[ /[rC   r"   c                   H    e Zd ZdZdZ	 dZdZdZd
dZe	d             Z
d	 ZdS )r#   z
    A WAMP ``INTERRUPT`` message.

    Format: ``[INTERRUPT, INVOCATION.Request|id, Options|dict]``

    See: https://wamp-proto.org/static/rfc/draft-oberstet-hybi-crossbar-wamp.html#rfc.section.14.3.4
    E   r  r  )r.  r  r  r5  Nc                    t          |          t          k    sJ |t          |          t          k    sJ ||| j        | j        fv sJ |t          |          t          k    sJ |t          |          t
          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _	        || _
        || _        || _        dS )aV  

        :param request: The WAMP request ID of the original ``INVOCATION`` to interrupt.
        :type request: int

        :param mode: Specifies how to interrupt the invocation (``"killnowait"`` or ``"kill"``).
            With ``"kill"``, the router will wait for the callee to return an ERROR before
            proceeding (sending back an ERROR to the original caller). With ``"killnowait"`` the
            router will immediately proceed (on the caller side returning an ERROR) - but still
            expects the callee to send an ERROR to conclude the message exchange for the inflight
            call.
        :type mode: str or None

        :param reason: The reason (an URI) for the invocation interrupt, eg actively
            triggered by the caller (``"wamp.error.canceled"`` - ApplicationError.CANCELED) or
            passively because of timeout (``"wamp.error.timeout"`` - ApplicationError.TIMEOUT).
        :type reason: str or None.

        :param forward_for: When this Call is forwarded for a client (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   )rJ   r|   rK   r  r  r   r   r   r   r.  r  r  r5  )r   r.  r  r  r5  r8  s         rA   r   zInterrupt.__init__  su   , G}}####|tDzzS0000|t	4?'CCCCC~f!4!4!44"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G	 'rC   c                 H   t          |           dk    r| d         t          j        k    sJ t          |           dk    r/t          d                    t          |                               t          | d         d          }t          | d         d          }d}d}d}d	|v r|d	         }t          |          t          k    r/t          d
                    t          |                              |t          j	        t          j
        fvr"t          d                    |                    |}d|v rt          |d         d          }d|v r|d         }d}t          |          t          k    r|D ]}t          |          t          k    r nmd|vst          |d                   t          k    r nId|vst          |d                   t          k    r n%d|vst          |d                   t          k    r nd}|st          d          t          ||||          }	|	S )r   r   r9   z(invalid message length {0} for INTERRUPTr7   z'request' in INTERRUPTr8   z'options' in INTERRUPTNr  z/invalid type {0} for 'mode' option in INTERRUPTz2invalid value '{0}' for 'mode' option in INTERRUPTr  z"reason" in INTERRUPTr5  Fr  r   r   TzCinvalid type/value {0} for/within 'forward_for' option in INTERRUPT)r  r  r5  )r[   r#   r   r   rZ   r'   r(   rJ   rK   r  r  r%   r   r   r|   )
r   r.  r  r  r  r5  r  rA  r8  r   s
             rA   r   zInterrupt.parse   sA    4yy1}}aI,B!B!B!BBt99>> J Q QRUVZR[R[ \ \]]]#DG-EFF&tAw0HII W!&/KK  C''#$U$\$\]abm]n]n$o$oppp9>93G"HHH#$X$_$_`k$l$lmmmDw'(9;RSSFG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K k#$ijjjd6{SSS
rC   c                     i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   t          j        | j        |gS )r   Nr  r  r5  )r  r  r5  r#   r   r.  r  s     rA   r   zInterrupt.marshal=  sX     9 "iGFO;" $GH'%)%5GM"&g>>rC   r5  )r   r   r   r   r   r  r  r   r   r   r   r   r<   rC   rA   r#   r#     s}          L DJI)' )' )' )'V : : \:x? ? ? ? ?rC   r#   c                   V    e Zd ZdZdZ	 dZ	 	 	 	 	 	 	 	 	 	 	 ddZed             Zd Z	dS )	r$   aP  
    A WAMP ``YIELD`` message.

    Formats:

    * ``[YIELD, INVOCATION.Request|id, Options|dict]``
    * ``[YIELD, INVOCATION.Request|id, Options|dict, Arguments|list]``
    * ``[YIELD, INVOCATION.Request|id, Options|dict, Arguments|list, ArgumentsKw|dict]``
    * ``[YIELD, INVOCATION.Request|id, Options|dict, Payload|binary]``
    F   r  Nc                    t          |          t          k    sJ |t          |          t          t          fv sJ |t          |          t          k    sJ |t          |          t
          k    sJ ||||J |t          |          t          k    sJ |t          |          sJ |||||J |t          |          t          k    sJ |t          |          sJ |	t          |	          t          k    sJ |
t          |
          t          k    sJ |t          |          t          k    sJ |t          |          t          k    sJ |r|D ]}t          |          t          k    sJ d|v rt          |d                   t          k    sJ d|v r&|d          t          |d                   t          k    sJ d|v rt          |d                   t          k    sJ t                              |            || _        || _        t          |          | _        || _        || _        || _        || _        || _        |	| _        |
| _        || _        || _        dS )aj  

        :param request: The WAMP request ID of the original call.
        :type request: int

        :param args: Positional values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type args: list or tuple or None

        :param kwargs: Keyword values for application-defined event payload.
           Must be serializable using any serializers in use.
        :type kwargs: dict or None

        :param payload: Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
        :type payload: bytes or None

        :param progress: If ``True``, this result is a progressive invocation result, and subsequent
           results (or a final error) will follow.
        :type progress: bool or None

        :param enc_algo: If using payload transparency, the encoding algorithm that was used to encode the payload.
        :type enc_algo: str or None

        :param enc_key: If using payload transparency with an encryption algorithm, the payload encryption key.
        :type enc_key: str or None

        :param enc_serializer: If using payload transparency, the payload object serializer that was used encoding the payload.
        :type enc_serializer: str or None

        :param callee: The WAMP session ID of the effective callee that responded with the error. Only filled if callee is disclosed.
        :type callee: None or int

        :param callee_authid: The WAMP authid of the responding callee. Only filled if callee is disclosed.
        :type callee_authid: None or unicode

        :param callee_authrole: The WAMP authrole of the responding callee. Only filled if callee is disclosed.
        :type callee_authrole: None or unicode

        :param forward_for: When this Call is forwarded for a client (or from an intermediary router).
        :type forward_for: list[dict]
        Nr  r   r   r  r  s                 rA   r   zYield.__init__r  s   l G}}####|tDzzdE]::::~f!5!5!55$w--5"8"8"887#64<FNN[4>>T#9#9#99#4X#>#>> W_9OU\Uhmu  nB  nB  C$w--3"6"6"66%)@)P)P%%P~f!4!4!44$](;(;s(B(B(BB&$*?*?3*F*F*FF"d;&7&74&?&?&?? 	H! H HBxx4'''' B49+>+>#+E+E+EE2~~2h<+?48CUCUY\C\C\C\]!R''DJ,@,@C,G,G,GG,G	&v..  , *. 'rC   c                 	   t          |           dk    r| d         t          j        k    sJ t          |           dvr/t          d                    t          |                               t          | d         d          }t          | d         d          }d}d}d}d}d}d}t          |           d	k    rt          | d
                   t          k    r| d
         }|	                    dd          }|r1t          |          s"t          d                    |                    |	                    dd          }|rGt          |          t          k    r/t          d                    t          |                              |	                    dd          }|r1t          |          s"t          d                    |                    nt          |           d
k    rQ| d
         }|Gt          |          t          k    r/t          d                    t          |                              t          |           d	k    rO| d	         }t          |          t          k    r/t          d                    t          |                              d}	d}
d}d}d}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}	d|v rQ|d         }t          |          t           k    r/t          d                    t          |                              |}
d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v rQ|d         }t          |          t          k    r/t          d                    t          |                              |}d|v r|d         }d}t          |          t          k    r|D ]}t          |          t          k    r nmd|vst          |d                   t           k    r nId|vst          |d                   t          k    r n%d|vst          |d                   t          k    r nd }|st          d!          t          |||||	||||
|||"          }|S )#r   r   r  z$invalid message length {0} for YIELDr7   z'request' in YIELDr8   z'options' in YIELDNrD   r9   rN   z0invalid value {0} for 'enc_algo' detail in YIELDr2  z.invalid type {0} for 'enc_key' detail in YIELDrQ   z6invalid value {0} for 'enc_serializer' detail in YIELDz$invalid type {0} for 'args' in YIELDz&invalid type {0} for 'kwargs' in YIELDr  z/invalid type {0} for 'progress' option in YIELDr   z-invalid type {0} for 'callee' detail in YIELDr3  z4invalid type {0} for 'callee_authid' detail in YIELDr4  z6invalid type {0} for 'callee_authrole' detail in YIELDr5  Fr  r   r   Tz?invalid type/value {0} for/within 'forward_for' option in YIELDr  )r[   r$   r   r   rZ   r'   r(   rJ   rV   r  r)   rK   r*   r   r   r   r|   )r   r.  r  r0  r   r1  rN   r2  rQ   r  r   r3  r4  r5  option_progressoption_calleeoption_callee_authidoption_callee_authrolerA  r8  r   s                        rA   r   zYield.parse  s    4yy1}}aE,>!>!>!>>t99I%% F M McRVii X XYYY#DG-ABB&tAw0DEEt99>>d47mmu441gG{{:t44H i 1( ; ; i#$V$]$]^f$g$ghhhkk)T22G l4==C//#$T$[$[\`ah\i\i$j$jkkk$[[)94@@N u&=n&M&M u#$\$c$cdr$s$sttt 4yy1}}Aw#T

d(:(:'(N(U(UVZ[_V`V`(a(abbb4yy1}}a<<4'''(P(W(WX\]cXdXd(e(efff  %j1OO$$,,#$U$\$\]abq]r]r$s$sttt&Hw#H-MM""c))#$S$Z$Z[_`m[n[n$o$oppp"Fg%%#*?#; ())S00#$Z$a$abfg{b|b|$}$}~~~0M''%,->%?"*++s22#$\$c$cdhi  eA  eA  %B  %B  C  C  C4OG##!-0KEK  D((%  BBxx4'' **d2i=.A.AS.H.Hr))T"X,-?-?3-F-F!++tBzN/C/Cs/J/J 0K g#$efffG!#%%##1!"/$3 +- - - 
rC   c                    i }| j         
| j         |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        rM| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d	<   t          j
        | j        || j        gS | j        r t          j
        | j        || j        | j        gS | j        rt          j
        | j        || j        gS t          j
        | j        |gS r  )r  r   r3  r4  r5  r1  rN   r2  rQ   r$   r   r.  r   r0  r  s     rA   r   zYield.marshalM  s,    =$"&-GJ;" $GH)'+'9GO$+)-)=G%&'%)%5GM"< 	C}(&*m
#|'%)\	"".,0,?()&gt|LL{ C*DL'49dkZZ C*DL'49MM*DL'BBrC   r  r  r<   rC   rA   r$   r$   R  s        	 	 LI"  $#!%!]' ]' ]' ]'~ y y \yv#C #C #C #C #CrC   r$   )rR   )rj   FFFF)rj   T)rj   )`rerW   r   pprintr   typingr   r   r   r   autobahn.utilr   autobahn.wamp.exceptionr   r	   autobahn.wamp.roler
   rz  r6   autobahn.wampr   _HAS_WAMP_FLATBUFFERSImportError__all__compilerf   ri   rg   rh   rr   ru   rs   rv   rq   rt   rL   r,   r-   PAYLOAD_ENC_XBRr.   rP   ENC_ALGO_NONEr  r  r  	ENC_ALGOSitemsENC_ALGOS_FROMSTRENC_SER_NONEr  r  r  r  ENC_SER_OPAQUEENC_SER_FLATBUFFERSENC_SERSENC_SERS_FROMSTRr)   r*   r_   rK   r+   r   r%   r&   r|   r'   r(   r   objectr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   r   r   r   r    r!   r"   r#   r$   r<   rC   rA   <module>r0     s	  6 
			         & & & & & & & & & &        B B B B B B B B 1 1 1 1 1 1!LLL)))))) !  " " "!"
"/J !bj!EFF  %"*%<==  %"*%EFF  #-"*-M"N"N  #
#GHH  "rz"FGG  'BJ'EFF  &2:&DEE  (RZ(FGG  'BJ'EFF  BJ788 
 %     %;<Lo#^   $X#W#W    66%		 ED)//2C2CDDD   &&Y&HH CB1A1ABBB y y y.K K K2        : Z_V[*/0 0c 0C 0RV 0/30OS0#'0470 0 0 0f$> $> $> $>N S 3 C    *  c tTWY\T\~    (! ! ! !Hl, l, l, l, l,f l, l, l,^l9 l9 l9 l9 l9G l9 l9 l9^r= r= r= r= r=g r= r= r=jM: M: M: M: M:G M: M: M:`BA BA BA BA BA BA BA BAJBG BG BG BG BG7 BG BG BGJc< c< c< c< c<g c< c< c<Lia ia ia ia iaG ia ia iaX	NQ NQ NQ NQ NQg NQ NQ NQb?H ?H ?H ?H ?H ?H ?H ?HDXZ XZ XZ XZ XZ XZ XZ XZv?J ?J ?J ?J ?J ?J ?J ?JDkO kO kO kO kO' kO kO kO\b= b= b= b= b=7 b= b= b=Jq
Z q
Z q
Z q
Z q
ZG q
Z q
Z q
Zh9> 9> 9> 9> 9>G 9> 9> 9>x_R _R _R _R _R7 _R _R _RD~< ~< ~< ~< ~<W ~< ~< ~<B`D `D `D `D `DW `D `D `DF	^] ^] ^] ^] ^]w ^] ^] ^]B?J ?J ?J ?J ?J ?J ?J ?JDeN eN eN eN eN eN eN eNPa= a= a= a= a=7 a= a= a=Hh[ h[ h[ h[ h[ h[ h[ h[VR? R? R? R? R? R? R? R?j^C ^C ^C ^C ^CG ^C ^C ^C ^C ^Cs   A AA