
    u%jJ                     z    d dl Z d dlZd dlmZ d dlmZ ddlmZ d Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zy)    N)MessageMessageToDict   )googleplay_pb2c                     t        | ddd      S )NFr   objs    Y/home/ubuntu/.local/share/pipx/venvs/gplaycli/lib/python3.12/site-packages/gpapi/utils.pyparseProtobufObjr      s    eUE22    c                 @    t        j                  d| |d dd       d   S )zVRead the byte array, starting from *start* position,
    as an 32-bit unsigned integerz!LNr      )structunpack)	byteArraystarts     r   readIntr   
   s(     ==y0156q99r   c                     | ddd   }d}t        |      D ]3  \  }}t        j                  dt        |g            d   }|||dz  z  z  }5 |S )z&Convert the byte array to a BigIntegerNr   B   )	enumerater   r   bytes)r   arrayoutkeyvaluedecodeds         r   toBigIntr       sa    ddOE
C& '
U--UE7^4Q7GsQw&&' Jr   c                 R    	 t        | j                        dkD  S # t        $ r Y yw xY w)Nr   F)lenpreFetch
ValueErrorr	   s    r   hasPrefetchr%      s-    3<< 1$$ s    	&&c                 D    	 | j                  d      S # t        $ r Y yw xY w)NlistResponseFHasFieldr$   r	   s    r   hasListResponser*      s(    ||N++     	c                 D    	 | j                  d      S # t        $ r Y yw xY w)NsearchResponseFr(   r	   s    r   hasSearchResponser.   %   s)    ||,-- r+   c                 D    	 | j                  d      S # t        $ r Y yw xY w)NclusterFr(   r	   s    r   
hasClusterr1   +   s(    ||I&& r+   c                 D    	 | j                  d      S # t        $ r Y yw xY w)N
tosContentFr(   tocResponses    r   hasTosContentr6   1   s*    ##L11 r+   c                 D    	 | j                  d      S # t        $ r Y yw xY w)NtosTokenFr(   r4   s    r   hasTosTokenr9   7   s*    ##J// r+   c                 D    	 | j                  d      S # t        $ r Y yw xY w)NcookieFr(   r4   s    r   	hasCookier<   =   s*    ##H-- r+   c                     	 | j                  d      }|S # t        $ r0 	 t        | j                        dkD  }Y |S # t        $ r d}Y Y |S w xY ww xY w)Ndocr   F)r)   r$   r"   r>   	TypeError)r
   	existances     r   hasDocrA   C   si    LL'	   	CGGq(I   	I	s$    	A:A
A	A

A)r   sysgoogle.protobuf.messager   google.protobuf.json_formatr    r   r   r   r    r%   r*   r.   r1   r6   r9   r<   rA    r   r   <module>rG      sK     
 + 5 3:r   