
    Ji                        S SK Jr  S SKJr  S SKJr  S SKJr  S SK	J
r  S SKJr  \(       a  SSKJr  \\4rSS	 jrSS
 jrSS jr S       SS jjr S       SS jjrSSS jjrSSS jjrSS jrg)    )annotations)	b64decode)	b64encode)encodebytes)Error)TYPE_CHECKING   )Bufferc                    U S:X  d   eg)Nr   fallback )flagss    T/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/pybase64/_fallback.py_get_simd_namer      s    A::    c                     g)Nr   r   r   r   r   _get_simd_pathr      s    r   c                   [        U [        5      (       a   U R                  S5      $ [        U [
        5      (       a  U $  [        U 5      nUR                  (       d&  U R                  R                  <S S3n[        U5      eUR                  5       $ ! [         a    Sn[	        U5      S ef = f! [         a(    SU R                  R                  <S 3n[        U5      S ef = f)Nasciiz4string argument should contain only ASCII characterss': underlying buffer is not C-contiguousz<argument should be a bytes-like object or ASCII string, not )
isinstancestrencodeUnicodeEncodeError
ValueError_bytes_types
memoryviewc_contiguous	__class____name__BufferErrortobytes	TypeError)r   msgmvs      r   
_get_bytesr'      s    !S	,88G$$ !\""'][[)).A..UVCc""zz| " 	,HCS/t+	,  ';;//4!46 	 n$&'s   B  AB. B+.2C Nc                j   [        U 5      n Ub  [        U5      nU(       a  [        U 5      S-  S:w  a  Sn[        U5      e[        XSS9nSn[        U 5      S:  a2  SnU S   S:X  a  US-  nU S	   S:X  a  US-  nS
[        U 5      S-  -  U-
  nU[        U5      :w  a  Sn[        U5      eU$ [        XSS9$ )a  Decode bytes encoded with the standard Base64 alphabet.

Argument ``s`` is a :term:`bytes-like object` or ASCII string to
decode.

Optional ``altchars`` must be a :term:`bytes-like object` or ASCII
string of length 2 which specifies the alternative alphabet used instead
of the '+' and '/' characters.

If ``validate`` is ``False`` (the default), characters that are neither in
the normal base-64 alphabet nor the alternative alphabet are discarded
prior to the padding check.
If ``validate`` is ``True``, these non-alphabet characters in the input
result in a :exc:`binascii.Error`.

The result is returned as a :class:`bytes` object.

A :exc:`binascii.Error` is raised if ``s`` is incorrectly padded.
   r   zIncorrect paddingF)validate=   r	      zNon-base64 digit found)r'   lenBinAsciiErrorbuiltin_decode)r   altcharsr*   r%   resultexpected_lenpaddings          r   r   r   /   s    , 	1Ah'q6A:?%C$$e< q6A:Gu{1u{1A!,w6L3v;&*C$$!66r   c                (    [        [        XUS95      $ )a  Decode bytes encoded with the standard Base64 alphabet.

Argument ``s`` is a :term:`bytes-like object` or ASCII string to
decode.

Optional ``altchars`` must be a :term:`bytes-like object` or ASCII
string of length 2 which specifies the alternative alphabet used instead
of the '+' and '/' characters.

If ``validate`` is ``False`` (the default), characters that are neither in
the normal base-64 alphabet nor the alternative alphabet are discarded
prior to the padding check.
If ``validate`` is ``True``, these non-alphabet characters in the input
result in a :exc:`binascii.Error`.

The result is returned as a :class:`bytearray` object.

A :exc:`binascii.Error` is raised if ``s`` is incorrectly padded.
)r2   r*   )	bytearrayr   )r   r2   r*   s      r   b64decode_as_bytearrayr8   _   s    , YqhGHHr   c                    [        U 5      nUR                  (       d&  U R                  R                  <S S3n[	        U5      eUb  [        U5      n[        X5      $ )at  Encode bytes using the standard Base64 alphabet.

Argument ``s`` is a :term:`bytes-like object` to encode.

Optional ``altchars`` must be a byte string of length 2 which specifies
an alternative alphabet for the '+' and '/' characters.  This allows an
application to e.g. generate url or filesystem safe Base64 strings.

The result is returned as a :class:`bytes` object.
r   r   )r   r   r    r!   r"   r'   builtin_encode)r   r2   r&   r%   s       r   r   r   x   sW     
AB??%%***QR#h'!&&r   c                6    [        X5      R                  S5      $ )ar  Encode bytes using the standard Base64 alphabet.

Argument ``s`` is a :term:`bytes-like object` to encode.

Optional ``altchars`` must be a byte string of length 2 which specifies
an alternative alphabet for the '+' and '/' characters.  This allows an
application to e.g. generate url or filesystem safe Base64 strings.

The result is returned as a :class:`str` object.
r   )r   decode)r   r2   s     r   b64encode_as_stringr=      s     Q!((11r   c                    [        U 5      nUR                  (       d&  U R                  R                  <S S3n[	        U5      e[        U 5      $ )a  Encode bytes into a bytes object with newlines (b'\\n') inserted after
every 76 bytes of output, and ensuring that there is a trailing newline,
as per :rfc:`2045` (MIME).

Argument ``s`` is a :term:`bytes-like object` to encode.

The result is returned as a :class:`bytes` object.
r   r   )r   r   r    r!   r"   builtin_encodebytes)r   r&   r%   s      r   r   r      sG     
AB??%%***QR#q!!r   )r   intreturnr   )rA   r@   )r   str | BufferrA   zbytes | bytearray)NF)r   rB   r2   str | Buffer | Noner*   boolrA   bytes)r   rB   r2   rC   r*   rD   rA   r7   )N)r   r
   r2   rC   rA   rE   )r   r
   r2   rC   rA   r   )r   r
   rA   rE   )
__future__r   base64r   r1   r   r:   r   r?   binasciir   r0   typingr   _typingr
   rE   r7   r   r   r   r'   r8   r=   r   r   r   <module>rK      s    " . . 5 +  y!
'0 MR-7-72-7EI-7
-7b MRII2IEIII2'(2"r   