
    =h                       U d Z ddlmZ 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mZmZmZmZmZmZmZ ddlZddlmZmZmZmZmZ ddlmZ ddlmZmZmZm Z  dd	l!m"Z" 	 dd
l#m$Z$ dZ%ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 e
r<ddlm8Z8 ddl9m:Z: ddl;m<Z<m=Z=m>Z> ddl?m@Z@ ddlAmBZB ddlCmDZD ddlEmFZF ddl4mGZG ddlHmIZImJZJ dZKdZLdZMdZNdZOdZPd ZQd!ZRd"ZSd#ZTd$ZUd%ZVd&ZWeNd'eOd(ePd)iZXd*d+d,d-ZY ed./      ZZd0e[d1<   dod2Z\	 	 	 	 	 	 dpd3Z]dqd4Z^	 	 	 	 	 	 	 	 drd5Z_ e"g d6      Z` e"g d7      Za	 	 	 ds	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dtd8Zb	 	 	 	 	 	 	 	 	 	 	 	 	 	 dud9Zc G d: d;      Zd G d< d=      Ze G d> d?ed      Zf G d@ dAee      Zg G dB dCeh      Zi ej                  dD      j                  ZldEZm	 	 	 	 	 	 	 	 dvdFZn ej                  dG      j                  ZodwdHZp ej                  dI      j                  Zq ej                  dJ      j                  Zr ej                  dK      j                  Zs	 	 	 	 	 	 	 	 	 	 	 	 dxdLZt	 	 	 	 	 	 	 	 	 	 	 	 	 	 dydMZu	 	 	 	 	 	 	 	 	 	 	 	 dzdNZve%re$j                  Zv	 d{	 	 	 	 	 	 	 	 	 	 	 	 	 d|dOZw	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d}dPZx	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d~dQZy	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddRZze%re$j                  Zz	 d{	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddSZ| ej                  dT      j                  Z}ddUZ~	 	 	 	 	 	 	 	 	 	 ddVZ	 	 	 	 	 	 	 	 ddWZe%re$j                  Z	 d{	 	 	 	 	 	 	 	 	 ddXZ G dY dZ      Zd[Z G d\ d]e      Zdd^ZeNd_eOd`ePdaiZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddbZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddcZe%re$j                  Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 dddZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddeZe%re$j                  Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddfZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddgZe%re$j                  Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddhZ G di dj      Z G dk dl      Zej"                  ej$                  ej"                  ej$                  iZdme[dn<   y# e&$ r dZ%Y w xY w)zTools for creating `messages
<https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/>`_ to be sent to
MongoDB.

.. note:: This module is for internal use and is generally not needed by
   application developers.
    )annotationsN)BytesIO)
TYPE_CHECKINGAnyCallableIterableMappingMutableMappingNoReturnOptionalUnioncast)CodecOptions_decode_selective_dict_to_bson_make_c_stringencode)Int64)_RAW_ARRAY_BSON_OPTIONSDEFAULT_RAW_BSON_OPTIONSRawBSONDocument_inflate_bson)SON)	_cmessageTF)ConfigurationErrorCursorNotFoundDocumentTooLargeExecutionTimeoutInvalidOperationNotPrimaryErrorOperationFailureProtocolError)HelloCompat)_handle_reauth)ReadPreference)WriteConcern)	timedelta)ClientSession)SnappyContextZlibContextZstdContext)MongoClient)_EventListeners)
Connection)ReadConcern)_ServerMode)_Address_DocumentOutii   i?                   s            s           s       s   documents     s   updates     s   deletes     	documentsupdatesdeletes)insertupdatedeletereplace)unicode_decode_error_handlerzCodecOptions[Mapping[str, Any]]_UNICODE_REPLACE_CODEC_OPTIONSc                 >    t        j                  t        t              S )z(Generate a pseudo random 32 bit integer.)randomrandint	MIN_INT32	MAX_INT32 r5   _/var/www/html/phonemate/phone_mate_backend/venv/lib/python3.12/site-packages/pymongo/message.py_randintrI   r   s    >>)Y//r5   c                    |j                   }|j                  }|rB|t        j                  j                   k7  st	        |      dkD  rd| vrt        d| fg      } || d<   | S )z-Add $readPreference to spec when appropriate.r3   $query$readPreference)modedocumentr%   SECONDARY_PREFERREDlenr   )specread_preferencerM   rN   s       rH   _maybe_add_read_preferencerS   w   sh     D''H ;;@@@CMTUDU44()*D"*Kr5   c                F    t        |       | j                  j                  dS )z<Convert an Exception into a failure document for publishing.)errmsgerrtype)str	__class____name__)	exceptions    rH   _convert_exceptionr[      s    )n1D1D1M1MNNr5   c                   |j                  dd      }d|d}|j                  d|j                  dd            }|rG|j                  d      r|d	dd
id|d<   n*d|j                  dd      |d}d|v r|d   |d<   |g|d<   |S | dk(  rt        |d         |d<   |S | dk(  rbd|v rd|d   dg|d<   |S |j                  d      du r=|dk(  r8|d   d   }|d   j                  d|d   j                  d            }d|dg|d<   |S )z6Convert a legacy write result to write command format.nr   r3   )okr]   rU   err wtimeout@   T)rU   codeerrInfowriteConcernErrorrc      )indexrc   rU   rd   writeErrorsr<   r9   r=   upserted)rg   _idupdatedExistingFr:   urj   q)getrP   )		operationcommandresultaffectedresrU   errorr=   rj   s	            rH   _convert_write_resultru      sU   
 zz#q!H
"CZZ&**UB"78F::j!28"R\^bQc'dC#$  FA)>&QEF"#))#4i "'CJHw{+,C J 
h	)*6*3EFGC
O J ZZ)*e3A Y'*F+//%)?@C)*378C
OJr5   ))tailabler4   )oplogReplayrf   )noCursorTimeout   )	awaitData    )allowPartialResults   ))rK   filter)z$orderbysort)z$hinthint)z$commentcomment)z$maxScanmaxScan)z
$maxTimeMS	maxTimeMS)z$maxmax)z$minmin)z
$returnKey	returnKey)z$showRecordIdshowRecordId)z$showDiskLocr   )z	$snapshotsnapshotc                |   t        d| fg      }d|v rr|j                  |j                         D cg c]  \  }}|t        v rt        |   |fn||f c}}       d|v r|j	                  d       d|v r|j	                  d       n||d<   |r||d<   |r||d<   |rt        |      |d<   |d	k  rd
|d<   |r||d<   |j                  r|	r|	j                  s|j                  |d<   |r||d<   |
|
|d<   |r>|j                  t        j                         D cg c]  \  }}||z  s|d
f c}}       |S c c}}w c c}}w )z!Generate a find command document.findrK   $explainrL   r~   
projectionskiplimitr   TsingleBatch	batchSizereadConcern	collationallowDiskUse)
r   r=   items
_MODIFIERSpopabslevelin_transactionrN   _OPTIONS)collrQ   r   r   r   
batch_sizeoptionsread_concernr   sessionallow_disk_usecmdkeyvalopts                  rH   _gen_find_commandr      si    vtn-.C4

 !%

 ,HC +.*;C#&#sK ,	
 GGJ#GG%&H&LF5zG19!%C%K7w/E/E)22M$K!,N

0@R0@HCGcMS$K0@RSJ?: Ss   !D2
D8
"D8
c                p    t        d| fd|fg      }|r||d<   |||d<   ||j                  dk\  r||d<   |S )z$Generate a getMore command document.getMore
collectionr   r   	   r   )r   max_wire_version)	cursor_idr   r   max_await_time_msr   connr   s          rH   _gen_get_more_commandr     s[     y)4|T6JKLC%K$,Kt449 IJr5   c                      e Zd ZdZdZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
dZddZddZ	ddZ
	 d	 	 	 	 	 ddZ	 d	 	 	 	 	 	 	 dd	Zy)_QueryzA query operation.)flagsdbr   ntoskiprQ   fieldscodec_optionsrR   r   r   namer   r   r   clientr   _as_commandexhaustNc                    || _         || _        || _        || _        || _        || _        || _        || _        || _        |	| _	        |
| _
        || _        || _        || _        || _        d| _        d | _        || _        y )Nr   )r   r   r   r   rQ   r   r   rR   r   r   r   r   r   r   r   r   r   r   )selfr   r   r   r   rQ   r   r   rR   r   r   r   r   r   r   r   r   s                    rH   __init__z_Query.__init__1  s    & 
		*.(
$",	@Dr5   c                    d | _         y Nr   r   s    rH   resetz_Query.resetW  
    r5   c                8    | j                    d| j                   S N.r   r   r   s    rH   	namespacez_Query.namespaceZ      ''!DII;''r5   c                    d}| j                   sd}nV|j                  dk\  rd}nD| j                  j                  s.t	        d| j                  j
                  |j                  fz        |j                  | j                  | j                         |S )NFTrf   zDread concern level of %s is not valid with a max wire version of %d.)	r   r   r   ok_for_legacyr   r   validate_sessionr   r   )r   r   use_find_cmds      rH   use_commandz_Query.use_command]  s    ||L""a'L""00$1484E4E4K4KTMbMb3cd 
 	dkk4<<8r5   c                   | j                   | j                   S d| j                  v }t        | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  | j                  | j                        }|rd| _        t        d|fg      }| j                  }|j                  |       |r>|j!                  |d| j"                  |       |s|j$                  s|j'                  ||       |j)                  ||| j*                         | j*                  }|j,                  rb|j,                  j.                  sLt1        t        t2        t4        f   |j,                  j7                  | j8                  || j:                              }|r|j=                  ||       || j8                  f| _         | j                   S )z.Return a find command document for this query.r   explainF)r   rQ   r   r   r   r   r   r   r   r   r   r   r   r   r   add_server_api	_apply_torR   r   _update_read_concernsend_cluster_timer   
_encrypter_bypass_auto_encryptionr   rW   r   encryptr   r   apply_timeout)r   r   r   r   r   r   r   s          rH   
as_commandz_Query.as_commandm  s    '###		).IIIIKKLLJJOOJJNNLL
 !DI	3'()C,,C c5$*>*>E7#9#9,,S$7sGT[[9V%6%6%N%Ns38}f&7&7&?&?dN`N`&abCvs+<r5   c           
        || _         |j                  r| j                  dz  }n| j                  }| j                         }| j                  }|rO| j                  |d      d   }t        d|| j                  || j                  |j                        \  }}}	}
|||	fS | j                  dk(  xr dxs | j                  }| j                  r%|rt        | j                  |      }n| j                  }|j                  rt        |t              sJ t!        ||      }t#        ||| j$                  |||rdn| j&                  | j                  |j                        S )	z:Get a query message, possibly setting the secondaryOk bit.   Tr   r   ctxr3   r4   N)rR   rM   r   r   rQ   r   _op_msgr   r   compression_contextr   r   r   	is_mongos
isinstancer
   rS   _queryr   r   )r   rR   r   use_cmdr   nsrQ   
request_idmsgsize_	ntoreturns               rH   get_messagez_Query.get_message  s?   
  /JJNEJJE^^yy??4t?<Q?D'."",,($JT1 sD((
 OOq(.QA$//	::

I6	 JJ	>>dN333-dODDLLD((	
 		
r5   ) r   intr   rW   r   rW   r   r   rQ   Mapping[str, Any]r   Optional[Mapping[str, Any]]r   r   rR   r0   r   r   r   r   r   r/   r   r   r   Optional[ClientSession]r   r,   r   Optional[bool]r   boolreturnNoner   rW   r   r.   r   r   Fr   r.   r   r   r   ztuple[SON[str, Any], str])rR   r0   r   r.   r   r   r   tuple[int, bytes, int])rY   
__module____qualname____doc__	__slots__conn_mgrr   r   r   r   r   r   r   rG   r5   rH   r   r     s   I, HI$$ $ 	$
 $  $ ,$ $$ %$ $ $ "$ /$ )$ $  '!$" #$L (" 7<* * /3* 	"* Z OT2
*2
2<2
GK2
	2
r5   r   c                      e Zd ZdZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZddZ		 d	 	 	 	 	 ddZ
	 d	 	 	 	 	 	 	 dd	Zy
)_GetMorezA getmore operation.)r   r   r   r   r   r   rR   r   r   r   r   r   r   r   c                    || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        d | _
        || _        || _        y r   )r   r   r   r   r   rR   r   r   r   r   r   r   r   )r   r   r   r   r   r   rR   r   r   r   r   r   r   s                rH   r   z_GetMore.__init__  sc     	""*.!2 @Dr5   c                    d | _         y r   r   r   s    rH   r   z_GetMore.reset   r   r5   c                8    | j                    d| j                   S r   r   r   s    rH   r   z_GetMore.namespace  r   r5   c                    d}| j                   sd}n|j                  dk\  rd}|j                  | j                  | j                         |S )NFTrf   )r   r   r   r   r   )r   r   r   s      rH   r   z_GetMore.use_command  sC    ||G""a'Gdkk4<<8r5   c                   | j                   | j                   S t        | j                  | j                  | j                  | j
                  | j                  |      }| j                  r(| j                  j                  |d| j                  |       |j                  |       |j                  || j                  | j                         | j                  }|j                  rb|j                  j                  sLt        t         t"        t$        f   |j                  j'                  | j(                  || j*                              }|r|j-                  |d       || j(                  f| _         | j                   S )z1Return a getMore command document for this query.NF)r   )r   r   r   r   r   r   r   r   r   rR   r   r   r   r   r   r   r   rW   r   r   r   r   r   )r   r   r   r   r   s        rH   r   z_GetMore.as_command  s"   
 '###2NNIINN""LL
 <<LL""3t/C/CTJC sDLL$++>V%6%6%N%Ns38}f&7&7&?&?dN`N`&abCv40<r5   c                v   | j                         }|j                  }|rz| j                  |d      d   }| j                  r| j                  rt
        j                  }nd}t        ||| j                  d| j                  |j                        \  }}	}
}||	|
fS t        || j                  | j                  |      S )zGet a getmore message.Tr   r   Nr   )r   r   r   r   r   _OpMsgEXHAUST_ALLOWEDr   r   r   	_get_morer   r   )r   dummy0r   r   r   r   rQ   r   r   r   r   r   s               rH   r   z_GetMore.get_message/  s     ^^&&??4t?<Q?D}}..'.tTWWdD,>,>DD\D\($JT1 sD((T^^T^^SAAr5   N)r   rW   r   rW   r   r   r   r   r   r   rR   r0   r   r   r   r,   r   Optional[int]r   r   r   r   r   r   r   r   r   r   r   )r	  r   r   r.   r   r   r   z0Union[tuple[int, bytes, int], tuple[int, bytes]])rY   r   r   r   r   r   r   r   r   r   r   r   rG   r5   rH   r   r     s    I  D  	
  $ % )  )   : (	 7<  /3 	" > >CBB!+B6:B	9Br5   r   c                        e Zd Zd fdZ xZS )_RawBatchQueryc                ^    t         |   |       |j                  dk\  ry| j                  syyNrf   TFsuperr   r   r   r   r   rX   s     rH   r   z_RawBatchQuery.use_commandE  .    D!  A%r5   r   rY   r   r   r   __classcell__rX   s   @rH   r  r  D       r5   r  c                        e Zd Zd fdZ xZS )_RawBatchGetMorec                ^    t         |   |       |j                  dk\  ry| j                  syyr  r  r  s     rH   r   z_RawBatchGetMore.use_commandQ  r  r5   r   r  r  s   @rH   r  r  P  r  r5   r  c                  N    e Zd ZU dZded<   d
dZedd       ZddZddZ	ddZ
y	)_CursorAddresszEThe server address (host, port) of a cursor, with namespace property.r   _CursorAddress__namespacec                @    t         j                  | |      }||_        |S r   )tuple__new__r  )clsaddressr   r   s       rH   r  z_CursorAddress.__new__a  s    }}S'*$r5   c                    | j                   S )zThe namespace this cursor.)r  r   s    rH   r   z_CursorAddress.namespacef  s     r5   c                @    g | | j                   j                         S r   )r  __hash__r   s    rH   r$  z_CursorAddress.__hash__k  s#     *$)(()3355r5   c                    t        |t              r2t        |       t        |      k(  xr | j                  |j                  k(  S t        S r   )r   r  r  r   NotImplementedr   others     rH   __eq__z_CursorAddress.__eq__p  s7    e^,;%,.T4>>U__3TTr5   c                    | |k(   S r   rG   r'  s     rH   __ne__z_CursorAddress.__ne__u  s    5=  r5   N)r!  r1   r   rW   r   r  r   r   r   )r(  objectr   r   )rY   r   r   r   __annotations__r  propertyr   r$  r)  r+  rG   r5   rH   r  r  \  s3    O
    6

!r5   r  z<iiiiiiB   c           
         |j                  |      }t               }t        t        t	        |      z   |dd| t	        |      |j
                        }|||z   fS )zDTakes message data, compresses it, and adds an OP_COMPRESSED header.r   i  )compressrI   _pack_compression_header_COMPRESSION_HEADER_SIZErP   compressor_id)ro   datar   
compressedr   headers         rH   	_compressr9  }  s]     d#JJ% 3z?2	D	F v
***r5   z<iiiic                X    t               }t        dt        |      z   |d|       }|||z   fS )ztTakes message data and adds a message header based on the operation.

    Returns the resultant message string.
    ry   r   )rI   _pack_headerrP   )ro   r6  ridmessages       rH   __pack_messager>    s2    
 *C2D	>39=G$r5   z<iz<IBz<Bc                   t        |d|      }t        | d      }t        |      }d}|r|}t        d      }	t	        |      }
|D cg c]  }t        |d|       }}t        |
      t        d |D              z   dz   }t        |      }||z  }t        d |D              }|||	||
g|}n||g}dj                  |      ||fS c c}w )zGet a OP_MSG message.

    Note: this method handles multiple documents in a type one payload but
    it does not perform batch splitting and the total message size is
    only checked *after* generating the entire message.
    Fr   r3   c              3  2   K   | ]  }t        |        y wr   rP   .0docs     rH   	<genexpr>z$_op_msg_no_header.<locals>.<genexpr>  s     !Cls#c(l   r   c              3  2   K   | ]  }t        |        y wr   rA  rB  s     rH   rE  z$_op_msg_no_header.<locals>.<genexpr>  s     <|3s8|rF  r5   )	r   _pack_op_msg_flags_typerP   
_pack_byter   sum	_pack_intr   join)r   rp   
identifierdocsoptsencoded
flags_type
total_sizemax_doc_sizetype_onecstringrD  encoded_docsr   encoded_sizer6  s                   rH   _op_msg_no_headerrX    s     GUD1G(2JWJLd&a= ,CGH4Cc5$74H7|c!Cl!CCCaG d
<|<<GX|WT|TG$88D>:|33 Is   C c                T    t        | ||||      \  }}}t        d||      \  }	}|	|||fS )zInternal OP_MSG message helper.  )rX  r9  )
r   rp   rM  rN  rO  r   r   rR  max_bson_sizer<  s
             rH   _op_msg_compressedr\    s@     &7ugzSWY]%^"C]sC(HCZ..r5   c                R    t        | ||||      \  }}}t        d|      \  }}	||	||fS )z*Internal compressed OP_MSG message helper.rZ  )rX  r>  )
r   rp   rM  rN  rO  r6  rR  r[  r   
op_messages
             rH   _op_msg_uncompressedr_    s?     '8w
TXZ^&_#D*m+D$7J
z:}<<r5   c                P   ||d<   |d|vr|j                   r|j                  |d<   t        t        |            }	 t        |   }|j                  |      }	 |rt        | |||||      |r|||<   S S t        | ||||      |r|||<   S S # t        $ r d}d}Y Aw xY w# |r|||<   w w xY w)zGet a OP_MSG message.$dbNrL   r`   )	rM   rN   nextiter
_FIELD_MAPr   KeyErrorr\  r_  )	r   rp   dbnamerR   rO  r   r   rM  rN  s	            rH   r   r     s     GEN"'8'G)8)A)AG%&WD%
{{:&'%eWj$cR "&GJ  $E7JdK "&GJ   
 "&GJ s#   B B 1B BB
B%c                    t        |d|      }|rt        |d|      }nd}t        t        |      t        |            }	dj                  t	        |       t        |      t	        |      t	        |      ||g      |	fS )zGet an OP_QUERY message.Fr5   )r   r   rP   rL  rK  r   )
r   collection_namenum_to_skipnum_to_returnqueryfield_selectorrO  rP  efsr[  s
             rH   _query_implrn    s     E5$/GNE48Gc#h/M'"/+&-(		
 	 r5   c           	     T    t        | ||||||      \  }}	t        d||      \  }
}|
||	fS )z)Internal compressed query message helper.  )rn  r9  )r   rh  ri  rj  rk  rl  rO  r   op_queryr[  r<  r   s               rH   _query_compressedrr     sD     *+}e^UYHm x-HC]""r5   c           	     R    t        | ||||||      \  }}t        d|      \  }	}
|	|
|fS )zInternal query message helper.rp  )rn  r>  )r   rh  ri  rj  rk  rl  rO  rq  r[  r<  r   s              rH   _query_uncompressedrt  2  sB     *+}e^UYHm dH-HC]""r5   c           
     L    |rt        | |||||||      S t        | ||||||      S )zGet a **query** message.)rr  rt  )r   rh  ri  rj  rk  rl  rO  r   s           rH   r   r   G  sF      _k=%Y]_b
 	
 +}e^UY r5   z<qc                j    dj                  t        t        |       t        |      t	        |      g      S )zGet an OP_GET_MORE message.r5   )rL  _ZERO_32r   rK  _pack_long_longrh  rj  r   s      rH   _get_more_implrz  ^  s3    88?+m$I&		
 r5   c                2    t        dt        | ||      |      S )z+Internal compressed getMore message helper.  )r9  rz  rh  rj  r   r   s       rH   _get_more_compressedr~  j  s     T>/=)TVYZZr5   c                0    t        dt        | ||            S )z Internal getMore message helper.r|  )r>  rz  ry  s      rH   _get_more_uncompressedr  t  s     $y YZZr5   c                <    |rt        | |||      S t        | ||      S )zGet a **getMore** message.)r~  r  r}  s       rH   r  r    s'     #O]IsSS!/=)LLr5   c                  6   e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 ddZe	dd       Z
e	dd       Ze	dd	       Ze	dd
       Z	 	 	 	 	 	 	 	 	 	 	 	 ddZe	 	 	 	 	 	 	 	 	 	 dd       Z	 	 	 	 	 	 	 	 ddZddZddZy)_BulkWriteContextzCA wrapper around Connection for use with write splitting functions.)db_namer   op_idr   fieldpublish
start_time	listenersr   r2  op_typecodecc	                \   || _         || _        || _        || _        |j                  | _        || _        t        | j                     | _        | j
                  rt        j                  j                         nd | _        || _        t        |j                        | _        || _        || _        y r   )r  r   r  r  enabled_for_commandsr  r   rd  r  datetimenowr  r   r   r   r2  r  r  )	r   database_namecmd_namer   operation_idr  r   r  r  s	            rH   r   z_BulkWriteContext.__init__  s     %	!
" 55			*
59\\(++//1tT556
r5   c                    | j                   dz   }t        || j                  ||| j                  |       \  }}}|st	        d      |||fS )N.$cmdcannot do an empty bulk write)r  _do_batched_op_msgr  r  r   )r   r   rN  r   r   r   to_sends          rH   __batch_commandz!_BulkWriteContext.__batch_command  sV     LL7*	#5t||S$

D$
 
C "#BCC3''r5   c                    | j                  ||      \  }}}| j                  ||||      }|j                  || j                         ||fS r   ) _BulkWriteContext__batch_commandwrite_command_process_responser   )r   r   rN  r   r   r   r  rq   s           rH   executez_BulkWriteContext.execute  sQ     $(#7#7T#B 
C##CS'B  6wr5   c                \    | j                  ||      \  }}}| j                  |||d|       |S )Nr   )r  unack_write)r   r   rN  r   r   r   r  s          rH   execute_unackz_BulkWriteContext.execute_unack  s:     $(#7#7T#B 
C 	j#q':r5   c                .    | j                   j                  S )z#A proxy for SockInfo.max_bson_size.)r   r[  r   s    rH   r[  z_BulkWriteContext.max_bson_size  s     yy&&&r5   c                x    | j                   r| j                  j                  dz
  S | j                  j                  S )z&A proxy for SockInfo.max_message_size.ry   )r2  r   max_message_sizer   s    rH   r  z"_BulkWriteContext.max_message_size  s0     ==99--22yy)))r5   c                .    | j                   j                  S )z*A proxy for SockInfo.max_write_batch_size.)r   max_write_batch_sizer   s    rH   r  z&_BulkWriteContext.max_write_batch_size  s     yy---r5   c                    | j                   S )z:The maximum size of a BSON command before batch splitting.)r[  r   s    rH   max_split_sizez _BulkWriteContext.max_split_size  s     !!!r5   c                   | j                   rj| j                  J t        j                  j                         | j                  z
  }| j	                  |||      }t        j                  j                         }	 | j
                  j                  ||      }| j                   rUt        j                  j                         z
  z   }|t        | j                  ||      }	nddi}	| j                  ||	|       t        j                  j                         | _        |S # t        $ r}
| j                   r| j                  J t        j                  j                         z
  z   }t        |
t              r"t        | j                  ||
j                        }n(t        |
t              r|
j                  }nt        |
      }| j!                  |||        d}
~
ww xY w# t        j                  j                         | _        w xY w)zAA proxy for Connection.unack_write that handles event publishing.Nr^   r3   )r  r  r  r  _startr   r  ru   r   _succeed	Exceptionr   r!   detailsr    r[   _fail)r   r   r   r   rS  rN  durationstartrq   replyexcfailures               rH   r  z_BulkWriteContext.unack_write  s    <<??...((,,.@H++c:t4C%%))+E	6YY**3=F||$--113e;xG%1$))S&IE "1IEj%: '//335DO  	||222$--113e;xGc#34,A$))SRUR]R],^G_5!kkG05G

:w9	 '//335DOs&   8A=D 	G#B,GGG %G<c                d   | j                   rj| j                  J t        j                  j                         | j                  z
  }| j	                  |||       t        j                  j                         }	 | j
                  j                  ||| j                        }| j                   r7t        j                  j                         z
  z   }| j                  |||       t        j                  j                         | _        |S # t        $ rw}| j                   ret        j                  j                         z
  z   }t        |t        t        f      r|j                  }	nt        |      }	| j                  ||	|        d}~ww xY w# t        j                  j                         | _        w xY w)zCA proxy for SocketInfo.write_command that handles event publishing.N)r  r  r  r  r  r   r  r  r  r  r   r    r!   r  r[   r  )
r   r   r   r   rN  r  r  r  r  r  s
             rH   r  z_BulkWriteContext.write_command  sU    <<??...((,,.@HKKZ.%%))+E	6II++JTZZHE||$--113e;xGj%: '//335DO  	||$--113e;xGcO5E#FG,/KKG05G

:w9	 '//335DOs&   8A*D 	FA2FFF
 
%F/c                    ||| j                   <   | j                  j                  || j                  || j                  j
                  | j                  | j                  j                         |S )zPublish a CommandStartedEvent.)r  r  publish_command_startr  r   r!  r  
service_id)r   r   r   rN  s       rH   r  z_BulkWriteContext._start3  sX     DJJ,,LLIIJJII  	
 
r5   c           
         | j                   j                  ||| j                  || j                  j                  | j
                  | j                  j                  | j                         y)z Publish a CommandSucceededEvent.r  N)r  publish_command_successr   r   r!  r  r  r  )r   r   r  r  s       rH   r  z_BulkWriteContext._succeedB  sQ    ..IIIIJJII  ,, 	/ 		
r5   c           
         | j                   j                  ||| j                  || j                  j                  | j
                  | j                  j                  | j                         y)zPublish a CommandFailedEvent.r  N)r  publish_command_failurer   r   r!  r  r  r  )r   r   r  r  s       rH   r  z_BulkWriteContext._failO  sQ    ..IIIIJJII  ,, 	/ 		
r5   N)r  rW   r  rW   r   r.   r  r   r  r-   r   r(   r  r   r  r   )r   MutableMapping[str, Any]rN  list[Mapping[str, Any]]r   *tuple[int, bytes, list[Mapping[str, Any]]]r   r  rN  r  r   r,   r   z1tuple[Mapping[str, Any], list[Mapping[str, Any]]]r   r  rN  r  r   r,   r   r  r,  )r   r  r   r   r   bytesrS  r   rN  r  r   r   )
r   r  r   r   r   r  rN  r  r   dict[str, Any])r   r  r   r   rN  r  r   r  )r   r   r  r2   r  r'   r   r   )r   r   r  r2   r  r'   r   r   )rY   r   r   r   r   r   r  r  r  r/  r[  r  r  r  r  r$   r  r  r  r  rG   r5   rH   r  r    s   MI  	
  #   0	(+	(3J	(	3	(+3JT_	:
+
3J
T_
	 
 ' ' * * . . " "&%& & 	&
 & && 
%&P %  	
 & 
 >+9<D[	!

r5   r  i    c                  f    e Zd ZdZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 d	dZed
d       Zy)_EncryptedBulkWriteContextrG   c                    | j                   dz   }t        || j                  ||| j                  |       \  }}|st	        d      |j                  dd      dz   }t        t        |      |d  t              }||fS )Nr  r  r7   r   r   )	r  _encode_batched_write_commandr  r  r   rg   r   
memoryviewr   )r   r   rN  r   r   r  	cmd_startoutgoings           rH   r  z*_EncryptedBulkWriteContext.__batch_commandg  s     LL7*	4t||S$

D
W "#BCC IIgq)A-	 C!<>VW  r5   c                    | j                  ||      \  }}| j                  j                  | j                  || j                  | j
                  |      }||fS )N)r   r   r   ))_EncryptedBulkWriteContext__batch_commandr   rp   r  r  r   )r   r   rN  r   batched_cmdr  rq   s          rH   r  z"_EncryptedBulkWriteContext.executev  sX      $33C>W$(II$5$5LL+TZZ^d %6 %
 wr5   c                    | j                  ||      \  }}| j                  j                  | j                  |t	        d      | j
                  |       |S )Nr   )w)write_concernr   r   )r  r   rp   r  r&   r   )r   r   rN  r   r  r  s         rH   r  z(_EncryptedBulkWriteContext.execute_unack  sU      $33C>W		LL&+LL 	 	
 r5   c                    t         S )z Reduce the batch splitting size.)_MAX_SPLIT_SIZE_ENCr   s    rH   r  z)_EncryptedBulkWriteContext.max_split_size  s
     #"r5   N)r   r  rN  r  r   z8tuple[MutableMapping[str, Any], list[Mapping[str, Any]]]r  r  r,  )	rY   r   r   r   r  r  r  r/  r  rG   r5   rH   r  r  d  s    I!+!3J!	A!+3JT_	:+3JT_	  # #r5   r  c                H    | dk(  rt        d||fz        t        | d      )z-Internal helper for raising DocumentTooLarge.r<   zfBSON document too large (%d bytes) - the connected server supports BSON document sizes up to %d bytes.z command document too large)r   )ro   doc_sizemax_sizes      rH   _raise_document_too_larger    s@    H "8,-
 	
 ).IJKKr5   s
   documents s   updates s   deletes c                   |j                   }|j                  }|j                  }	|rdnd}
|j                  |
       |j                  d       |j                  t	        |d|             |j                  d       |j                         }|j                  d       	 |j                  t        |           g }d}|D ]  }t	        |d|      }t        |      }|j                         |z   }|dk(  xr ||	kD  }| xr ||kD  }|s|r6t        t        j                               |    }t        |t        |      |       ||	kD  r n0|j                  |       |j                  |       |d	z  }||k(  s n |j                         }|j                  |       |j                  t!        ||z
               ||fS # t        $ r t        d      dw xY w)
zCreate a batched OP_MSG write.r8   s      r7   F   Unknown commandNr   r3   )r[  r  r  writer   tell_OP_MSG_MAPre  r   rP   listrd  keysr  appendseekrK  )ro   rp   rN  ackrO  r   bufr[  r  r  r   size_locationr  idxrD  value
doc_lengthnew_message_sizedoc_too_largeunacked_doc_too_largewrite_oplengths                         rH   _batched_op_msg_implr    s    %%M33++#&,?EIIe IIgIImGUD12 IIgHHJMII!"<		+i() G
Cc5$/Z
88:
2qJ&69I&I %( HZ--G1JOO-.y9H%hE
MJ..		%sq&&1 6 XXZFHH]IIi./0F?I  <01t;<s   F1 1Gc           	     b    t               }t        | ||||||      \  }}|j                         |fS )zOEncode the next batched insert, update, or delete operation
    as OP_MSG.
    )_BytesIOr  getvalue)	ro   rp   rN  r  rO  r   r  r  r   s	            rH   _encode_batched_op_msgr    s7     *C%i$T3PSTJGQ<<>7""r5   c                    t        | |||||      \  }}|j                  j                  J t        d||j                  j                        \  }}	||	|fS )z]Create the next batched insert, update, or delete operation
    with OP_MSG, compressed.
    rZ  )r  r   r   r9  )
ro   rp   rN  r  rO  r   r6  r  r   r   s
             rH   _batched_op_msg_compressedr    s\     +9gtS$PSTMD'88''333dCHH,H,HIOJsG##r5   c           	     p   t               }|j                  t               |j                  d       t        | ||||||      \  }}|j	                  d       t               }	|j                  t        |	             |j	                  d       |j                  t        |             |	|j                         |fS )z"OP_MSG implementation entry point.s         r   r   )r  r  _ZERO_64r  r  rI   rK  r  )
ro   rp   rN  r  rO  r   r  r  r  r   s
             rH   _batched_op_msgr    s     *C IIhII12*9gtS$PSUXYOGV HHQKJIIi
#$HHQKIIi s||~w..r5   c                    | j                  dd      d   |d<   d|v rt        |d   j                  dd            }nd}|j                  j                  rt        ||||||      S t        ||||||      S )zRCreate the next batched insert, update, or delete operation
    using OP_MSG.
    r   r3   r   ra  writeConcernr  T)splitr   rn   r   r   r  r  )r   ro   rp   rN  rO  r   r  s          rH   r  r  6  s}     __S!,Q/GEN 7>*..sA67
xx##))WdCsSS9gtS$DDr5   c           	     b    t               }t        | ||||||      \  }}|j                         |fS )z:Encode the next batched insert, update, or delete command.)r  _batched_write_command_implr  )	r   ro   rp   rN  rO  r   r  r  r   s	            rH   r  r  N  s9     *C,Y	7DRVX[]`aJGQ<<>7""r5   c                ~   |j                   }|j                  }|t        z   }	|j                  }
|j	                  t
               |j	                  | j                  d             |j	                  t               |j	                  t               |j                         }|j	                  t        |             |j                  dd       |j                          	 |j	                  t        |          |j                         dz
  }g }d}|D ]  }t        |      j                  d      }t!        |d|      }t#        |      |	kD  }|r6t%        t&        j)                               |   }t+        |t#        |      |       |d	k\  xr+ |j                         t#        |      z   t#        |      z   |
k\  }||k\  }|s|r ne|j	                  t,               |j	                  |       |j	                  t               |j	                  |       |j/                  |       |d	z  } |j	                  t0               |j                         }|j                  |       |j	                  t3        ||z
  d	z
               |j                  |       |j	                  t3        ||z
               ||fS # t        $ r t        d      dw xY w)
z(Create a batched OP_QUERY write command.utf8r4   r  Nr   r   Fr3   )r[  r  _COMMAND_OVERHEADr  r  rw  r   _ZERO_8_SKIPLIMr  r  truncate_OP_MAPre  r   rW   r   rP   r  rd  r  r  _BSONOBJr  _ZERO_16rK  )r   ro   rp   rN  rO  r   r  r[  r  max_cmd_sizer  command_start
list_startr  r  rD  r   r  r  r  enough_dataenough_documentsr  s                          rH   r  r  a  sK    %%M33 !#44L''N IIhIIiv&'IIgIIh HHJMIIfWo HHROLLN<		')$%
 aJG
C#hoof%c5$/ E
\1JOO-.y9H%hE
MJQhYCHHJS$9CJ$F>#Y"66*		(		#		'		%sq' . IIh XXZFHHZIIi+a/01HH]IIi./0F?O  <01t;<s   J& &J<c                      e Zd ZdZdZ ej                  d      j                  ZdZ	ddZ
	 d	 	 	 	 	 ddZdeddf	 	 	 	 	 	 	 	 	 dd	Zdd
ZddZedd       Zedd       Zy)_OpReplyz$A MongoDB OP_REPLY response message.)r   r   number_returnedr9   z<iqiir3   c                N    || _         t        |      | _        || _        || _        y r   )r   r   r   r  r9   )r   r   r   r  r9   s        rH   r   z_OpReply.__init__  s$    
y)."r5   Nc                   | j                   dz  r&|t        d      d|fz  }d|dd}t        |d|      | j                   dz  rt        j                  | j
                        j                         }|j                  dd       |d	   j                  t        j                        rt        |d	   |      |j                  d
      dk(  r.d}t        |j                  d	|      |j                  d
      |      t        d|j                  d	      z  |j                  d
      |      | j
                  r| j
                  gS g S )a  Check the response header from the database, without decoding BSON.

        Check the response for errors and unpack.

        Can raise CursorNotFound, NotPrimaryError, ExecutionTimeout, or
        OperationFailure.

        :Parameters:
          - `cursor_id` (optional): cursor_id we sent to get this response -
            used for raising an informative exception when we get cursor id not
            valid at server response.
        r3   z"No cursor id for getMore operationzCursor not found, cursor id: %dr   +   )r^   rU   rc   r4   r^   z$errrc   2   zoperation exceeded time limitzdatabase error: %s)r   r"   r   bsonBSONr9   decode
setdefault
startswithr#   LEGACY_ERRORr    rn   r   r!   )r   r   user_fieldsr   errobjerror_objectdefault_msgs          rH   raw_responsez_OpReply.raw_response  s>    ::> #$HII 4ylBCb9F b&11ZZ!^!%4>>!:!A!A!CL##D!,F#..{/G/GH%l6&:LII!!&)R/=& $$V[9<;K;KF;SUa  #$|'7'7'??  ( 
 >>NN##	r5   Fc                    | j                  |       |r t        j                  | j                  |      S t        j                  | j                  ||      S )a  Unpack a response from the database and decode the BSON document(s).

        Check the response for errors and unpack, returning a dictionary
        containing the response data.

        Can raise CursorNotFound, NotPrimaryError, ExecutionTimeout, or
        OperationFailure.

        :Parameters:
          - `cursor_id` (optional): cursor_id we sent to get this response -
            used for raising an informative exception when we get cursor id not
            valid at server response
          - `codec_options` (optional): an instance of
            :class:`~bson.codec_options.CodecOptions`
          - `user_fields` (optional): Response fields that should be decoded
            using the TypeDecoders from codec_options, passed to
            bson._decode_all_selective.
        )r  r  
decode_allr9   _decode_all_selectiver   r   r   r  legacy_responses        rH   unpack_responsez_OpReply.unpack_response  sC    2 	)$??4>>=AA))$..-UUr5   c                R    | j                  |      }| j                  dk(  sJ |d   S )Unpack a command response.r   r3   r   )r   r  )r   r   rN  s      rH   command_responsez_OpReply.command_response  s2    ##-#@##q(((Awr5   c                    t         z)Return the bytes of the command response.)NotImplementedErrorr   s    rH   raw_command_responsez_OpReply.raw_command_response  s
     "!r5   c                     y)+Is the moreToCome bit set on this response?FrG   r   s    rH   more_to_comez_OpReply.more_to_come  s     r5   c                N    | j                  |      \  }}}}|dd } | ||||      S )z%Construct an _OpReply from raw bytes.   N)UNPACK_FROM)r   r   r   r   r   r  r9   s          rH   unpackz_OpReply.unpack  s7     03s/C,y!_H	5)_i@@r5   )r   r   r   r   r  r   r9   r  )NN)r   r
  r  r   r   zlist[bytes]
r   r
  r   r   r  r   r  r   r   zlist[dict[str, Any]]r   r   r   r  )r   r   r   r   )r   r  r   r
  )rY   r   r   r   r   structStructunpack_fromr.  OP_CODEr   r  rA   r   r$  r(  r/  r+  classmethodr/  rG   r5   rH   r
  r
    s    .FI&--(44KG# [_+&+<W+	+^ $(&D37 %V V $V 1	V
 V 
V<"
   A Ar5   r
  c                      e Zd ZdZdZ ej                  d      j                  ZdZ	dZ
dZdZddZd	i f	 	 	 	 	 dd
Zd	ed	df	 	 	 	 	 	 	 	 	 ddZddZddZedd       Zedd       Zy	)r  z"A MongoDB OP_MSG response message.)r   r   r  payload_documentz<IBirZ  r3   r4   i   c                     || _         || _        y r   )r   r9  )r   r   r9  s      rH   r   z_OpMsg.__init__.  s    
 0r5   Nc                P    t        t        | j                        |t              }|gS )zp
        cursor_id is ignored
        user_fields is used to determine which fields must not be decoded
        )r   r   r9  r   )r   r   r  inflated_responses       rH   r  z_OpMsg.raw_response2  s-     .D112KAX
 """r5   Fc                L    |rJ t        j                  | j                  ||      S )a  Unpack a OP_MSG command response.

        :Parameters:
          - `cursor_id` (optional): Ignored, for compatibility with _OpReply.
          - `codec_options` (optional): an instance of
            :class:`~bson.codec_options.CodecOptions`
          - `user_fields` (optional): Response fields that should be decoded
            using the TypeDecoders from codec_options, passed to
            bson._decode_all_selective.
        )r  r  r9  r  s        rH   r   z_OpMsg.unpack_response@  s)    $ #""))$*?*?P[\\r5   c                ,    | j                  |      d   S )r"  r#  r   )r   )r   r   s     rH   r$  z_OpMsg.command_responseU  s    ##-#@CCr5   c                    | j                   S r&  )r9  r   s    rH   r(  z_OpMsg.raw_command_responseY  s    $$$r5   c                F    t        | j                  | j                  z        S )r*  )r   r   MORE_TO_COMEr   s    rH   r+  z_OpMsg.more_to_come]  s     DJJ!2!2233r5   c                *   | j                  |      \  }}}|dk7  r<|| j                  z  rt        d|d      || j                  z  rt        d|d      |dk7  rt        d|d      t	        |      |dz   k7  rt        d      |dd } | ||      S )	z#Construct an _OpMsg from raw bytes.r   z+Unsupported OP_MSG flag checksumPresent: 0xxzUnsupported OP_MSG flags: 0xz#Unsupported OP_MSG payload type: 0x   z$Unsupported OP_MSG reply: >1 sectionN)r.  CHECKSUM_PRESENTr"   rA  rP   )r   r   r   first_payload_typefirst_payload_sizer9  s         rH   r/  z_OpMsg.unpackb  s     9<8L5!#5A:s+++#&QRWXYQZ$[\\s'''#&B5)$LMM""EFXYZE[ \]]s8)A-- FGGqr75*++r5   )r   r   r9  r  )r   r
  r  r   r   r  r0  r1  )r   r  r2  )r   r  r   r  )rY   r   r   r   r   r3  r4  r5  r.  r6  rE  rA  r  r   r  rA   r   r$  r(  r/  r+  r7  r/  rG   r5   rH   r  r  !  s    ,MI&--'33KG LO1 $(35# # 1# 
!	#  $(&D37 %] ] $] 1	]
 ] 
]*D% 4 4 , ,r5   r  z5dict[int, Callable[[bytes], Union[_OpReply, _OpMsg]]]_UNPACK_REPLYr,  )rQ   r  rR   r0   r   r  )rZ   r  r   r  )ro   rW   rp   r   rq   r   r   r  )NNN)r   rW   rQ   r   r   z1Optional[Union[Mapping[str, Any], Iterable[str]]]r   r   r   r   r   r
  r   r
  r   r/   r   r   r   r   r   r   r   SON[str, Any])r   r
  r   rW   r   r
  r   r
  r   zOptional[Any]r   r.   r   rI  )ro   r   r6  r  r   .Union[SnappyContext, ZlibContext, ZstdContext]r   tuple[int, bytes])ro   r   r6  r  r   rK  )r   r   rp   r   rM  rW   rN  !Optional[list[Mapping[str, Any]]]rO  r   r   ztuple[bytes, int, int])r   r   rp   r   rM  rW   rN  rL  rO  r   r   rJ  r   tuple[int, bytes, int, int])r   r   rp   r   rM  rW   rN  rL  rO  r   r   rM  r   )r   r   rp   r  rf  rW   rR   zOptional[_ServerMode]rO  r   r   4Union[SnappyContext, ZlibContext, ZstdContext, None]r   rM  )r   r   rh  rW   ri  r   rj  r   rk  r   rl  r   rO  r   r   ztuple[bytes, int])r   r   rh  rW   ri  r   rj  r   rk  r   rl  r   rO  r   r   rJ  r   r   )r   r   rh  rW   ri  r   rj  r   rk  r   rl  r   rO  r   r   r   )r   r   rh  rW   ri  r   rj  r   rk  r   rl  r   rO  r   r   rN  r   r   )rh  rW   rj  r   r   r   r   r  )
rh  rW   rj  r   r   r   r   rJ  r   rK  )rh  rW   rj  r   r   r   r   rK  )
rh  rW   rj  r   r   r   r   rN  r   rK  )ro   rW   r  r   r  r   r   r   )ro   r   rp   r   rN  r  r  r   rO  r   r   r  r  r  r   #tuple[list[Mapping[str, Any]], int])ro   r   rp   r   rN  r  r  r   rO  r   r   r  r   %tuple[bytes, list[Mapping[str, Any]]])ro   r   rp   r   rN  r  r  r   rO  r   r   r  r   r  )r   rW   ro   r   rp   r  rN  r  rO  r   r   r  r   r  )r   rW   ro   r   rp   r  rN  r  rO  r   r   r  r   rP  )r   rW   ro   r   rp   r  rN  r  rO  r   r   r  r  r  r   rO  )r   
__future__r   r  rC   r3  ior   r  typingr   r   r   r   r	   r
   r   r   r   r   r  r   r   r   r   r   
bson.int64r   bson.raw_bsonr   r   r   r   bson.sonr   pymongor   _use_cImportErrorpymongo.errorsr   r   r   r   r   r    r!   r"   pymongo.hellor#   pymongo.helpersr$   pymongo.read_preferencesr%   pymongo.write_concernr&   r'   pymongo.client_sessionr(   pymongo.compression_supportr)   r*   r+   pymongo.mongo_clientr,   pymongo.monitoringr-   pymongo.poolr.   pymongo.read_concernr/   r0   pymongo.typingsr1   r2   rF   rE   r  _INSERT_UPDATE_DELETE_EMPTYr  r  r  rw  r  r  r  rd  rA   r.  rI   rS   r[   ru   r   r   r   r   r   r   r  r  r  r  r4  packr3  r4  r9  r;  r>  rK  rH  rI  rX  r\  r_  r   rn  rr  rt  _query_messager   rx  rz  r~  r  _get_more_messager  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r6  r/  rH  rG   r5   rH   <module>rm     s	   #    "    W W   !F	 	 	 & * 3 ."4SS02'046		  


	
..1//
 $yIN
BN!*C  ? 
0

"5@$O
!!.!8I!!H  
6 .2'+%)0
0
0 B0 	0
 0 0 0 0 +0 %0 #0 0f
  %	
   &v
 v
rsB sBl	V 		x 	!U !: )6==499  +++&T++& v}}W%** FMM$$$	'&--.33 V]]4 %%
444 4 ,	4
 4 4@/// / ,	/
 / 
8/ !/
=
=
= 
= ,	
=
 
= !
= 
$,, AE''%' ' +	'
 ' 
>' !'@  	
  0  >### # 	#
 # 0# # 
8# #$### # 	#
 # 0# # #" 
#22 AE  	
  0  
> (  &--%**	[[[ [ 
8	[
 [[[),[9<[[ 
&88 AE		M	M	M 	M 
>		M
 	MO
 O
l  +#!2 +#\L& ^^AAA "A 
	A
 A 
A 
A )AH### "# 
	#
 # 
# +#" 
&==$$$ "$ 
	$
 $ 
$ 0$$/// "/ 
	/
 / 
/ 0/8 
//OEEE &E "	E
 E 
E 0E0### &# "	#
 # 
# +# 
$-$K$K!JJJ &J "	J
 J 
J 
J )JZpA pAfR, R,l hoo
NNFMMHD }1  Fs   Q) )Q43Q4