Ë
    Eêñiú)  ã                  ój  — U d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZmZ d d	lmZmZmZmZmZ d d
lmZ d dlmZ d dlmZ  d dlm!Z" d dl#m$Z$ d dl%m&Z&m'Z' d dl(m)Z)m*Z*m+Z+m,Z, d dl-m.Z.m/Z/ erd dl0m1Z1 d dlm2Z2 e/e.z  dz  Z3de4d<   e G d„ d«      «       Z5 G d„ d«      Z6y)é    )Úannotations)Ú	dataclass)Údedent)ÚTYPE_CHECKINGÚ	TypeAliasÚcast)Úenforce_filename_restriction)Úcurrent_form_id)Úcreate_layout_config)Úcheck_widget_policiesÚmaybe_raise_label_warnings)ÚKeyÚLabelVisibilityÚcompute_and_register_element_idÚ get_label_visibility_proto_valueÚto_key)Ú_get_upload_files)ÚCameraInput)ÚFileUploaderState)ÚUploadedFileInfo)Úgather_metrics)ÚScriptRunContextÚget_script_run_ctx)Ú
WidgetArgsÚWidgetCallbackÚWidgetKwargsÚregister_widget)ÚDeletedFileÚUploadedFile)ÚDeltaGenerator)ÚWidthWithoutContentNr   ÚSomeUploadedSnapshotFilec                  ó,   — e Zd Z	 	 	 	 dd„Z	 	 	 	 dd„Zy)ÚCameraInputSerdec                ó&  — t        «       }|�t        |t        «      r|S |j                  j	                  «       }|j
                  |_        |j                  |_        |j                  |_        |j                  j                  |j                  «       |S )N)ÚFileUploaderStateProtoÚ
isinstancer   Úuploaded_file_infoÚaddÚfile_idÚnameÚsizeÚ	file_urlsÚCopyFromÚ
_file_urls)ÚselfÚsnapshotÚstate_protoÚ	file_infos       úi/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/widgets/camera_input.pyÚ	serializezCameraInputSerde.serialize:   sy   € ô -Ó.ˆàÐœz¨(´KÔ@ØÐà+6×+IÑ+I×+MÑ+MÓ+Oˆ	Ø$×,Ñ,ˆ	ÔØ!Ÿ™ˆ	ŒØ!Ÿ™ˆ	ŒØ×Ñ×$Ñ$ X×%8Ñ%8Ô9àÐó    c                ó˜   — t        |«      }t        |«      dk(  rd n|d   }|�'t        |t        «      st	        |j
                  dg«       |S )Nr   z.jpg)r   Úlenr'   r   r	   r+   )r0   Úui_valueÚupload_filesÚreturn_values       r4   ÚdeserializezCameraInputSerde.deserializeK   sL   € ô )¨Ó2ˆÜ" <Ó0°AÒ5‘t¸<È¹?ˆØÐ#¬J°|Ä[Ô,QÜ(¨×):Ñ):¸V¸HÔEØÐr6   N)r1   r"   Úreturnr&   )r9   zFileUploaderStateProto | Noner=   r"   )Ú__name__Ú
__module__Ú__qualname__r5   r<   © r6   r4   r$   r$   8   s.   „ ðà*ðð 
 óð"Ø5ðà	!ôr6   r$   c                  óÂ   — e Zd Z ed«      	 	 	 	 	 dddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	 	 	 	 	 ddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„Zedd
„«       Zy)ÚCameraInputMixinÚcamera_inputNFÚvisibleÚstretch)ÚdisabledÚlabel_visibilityÚwidthc               óL   — t        «       }
| j                  |||||||||	|
¬«
      S )ax  Display a widget that returns pictures from the user's webcam.

        Parameters
        ----------
        label : str
            A short label explaining to the user what this widget is used for.
            The label can optionally contain GitHub-flavored Markdown of the
            following types: Bold, Italics, Strikethroughs, Inline Code, Links,
            and Images. Images display like icons, with a max height equal to
            the font height.

            Unsupported Markdown elements are unwrapped so only their children
            (text contents) render. Common block-level Markdown (headings,
            lists, blockquotes) is automatically escaped and displays as
            literal text in labels.

            See the ``body`` parameter of |st.markdown|_ for additional,
            supported Markdown directives.

            For accessibility reasons, you should never set an empty label, but
            you can hide it with ``label_visibility`` if needed. In the future,
            we may disallow empty labels by raising an exception.

            .. |st.markdown| replace:: ``st.markdown``
            .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown

        key : str, int, or None
            An optional string or integer to use as the unique key for
            the widget. If this is ``None`` (default), a key will be
            generated for the widget based on the values of the other
            parameters. No two widgets may have the same key. Assigning
            a key stabilizes the widget's identity and preserves its
            state across reruns even when other parameters change.

            A key lets you access the widget's value via
            ``st.session_state[key]`` (read-only). For more details, see
            `Widget behavior
            <https://docs.streamlit.io/develop/concepts/architecture/widget-behavior>`_.

            Additionally, if ``key`` is provided, it will be used as a
            CSS class name prefixed with ``st-key-``.

        help : str or None
            A tooltip that gets displayed next to the widget label. Streamlit
            only displays the tooltip when ``label_visibility="visible"``. If
            this is ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        on_change : callable
            An optional callback invoked when this camera_input's value
            changes.

        args : list or tuple
            An optional list or tuple of args to pass to the callback.

        kwargs : dict
            An optional dict of kwargs to pass to the callback.

        disabled : bool
            An optional boolean that disables the camera input if set to
            ``True``. Default is ``False``.

        label_visibility : "visible", "hidden", or "collapsed"
            The visibility of the label. The default is ``"visible"``. If this
            is ``"hidden"``, Streamlit displays an empty spacer instead of the
            label, which can help keep the widget aligned with other widgets.
            If this is ``"collapsed"``, Streamlit displays no label or spacer.

        width : "stretch" or int
            The width of the camera input widget. This can be one of the
            following:

            - ``"stretch"`` (default): The width of the widget matches the
              width of the parent container.
            - An integer specifying the width in pixels: The widget has a
              fixed width. If the specified width is greater than the width of
              the parent container, the width of the widget matches the width
              of the parent container.

        Returns
        -------
        None or UploadedFile
            The UploadedFile class is a subclass of BytesIO, and therefore is
            "file-like". This means you can pass an instance of it anywhere a
            file is expected.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> enable = st.checkbox("Enable camera")
        >>> picture = st.camera_input("Take a picture", disabled=not enable)
        >>>
        >>> if picture:
        ...     st.image(picture)

        .. output::
           https://doc-camera-input.streamlit.app/
           height: 600px

        )
ÚlabelÚkeyÚhelpÚ	on_changeÚargsÚkwargsrG   rH   rI   Úctx)r   Ú_camera_input)r0   rK   rL   rM   rN   rO   rP   rG   rH   rI   rQ   s              r4   rD   zCameraInputMixin.camera_inputV   sC   € ôl !Ó"ˆØ×!Ñ!ØØØØØØØØ-ØØð "ó 
ð 	
r6   )rG   rH   rI   rQ   c          
     ó~  — t        |«      }t        | j                  ||d d¬«       t        ||«       t	        d|d| j                  |||	¬«      }t        «       }||_        ||_        t        | j                  «      |_	        ||_
        t        |«      |j                  _        |�t        |«      |_        t!        |	¬«      }t#        «       }t%        |j                  ||||j&                  |j(                  |
d¬«      }| j                  j+                  d||¬	«       t-        |j                  t.        «      ry |j                  S )
NF)Údefault_valueÚwrites_allowedrD   T)Úuser_keyÚkey_as_main_identityÚdgrK   rM   rI   )rI   Úfile_uploader_state_value)Úon_change_handlerrO   rP   ÚdeserializerÚ
serializerrQ   Ú
value_type)Úlayout_config)r   r   rX   r   r   ÚCameraInputProtoÚidrK   r
   Úform_idrG   r   rH   Úvaluer   rM   r   r$   r   r<   r5   Ú_enqueuer'   r   )r0   rK   rL   rM   rN   rO   rP   rG   rH   rI   rQ   Ú
element_idÚcamera_input_protor^   ÚserdeÚcamera_input_states                   r4   rR   zCameraInputMixin._camera_inputÚ   sD  € ô �S‹kˆäØ�G‰GØØØØ õ	
ô 	# 5Ð*:Ô;ä4ØØØ!%Ø�w‰wØØØô
ˆ
ô .Ó/ÐØ *ÐÔØ#(ÐÔ Ü%4°T·W±WÓ%=ÐÔ"Ø&.ÐÔ#Ü4TØó5
Ð×+Ñ+Ô1ð ÐÜ&,¨T£lÐÔ#ä,°5Ô9ˆä Ó"ˆä,Ø×!Ñ!Ø'ØØØ×*Ñ*Ø—‘ØØ2ô	
Ðð 	�‰×ÑØÐ.¸mð 	ô 	
ô Ð(×.Ñ.´Ô<ØØ!×'Ñ'Ð'r6   c                ó   — t        d| «      S )zGet our DeltaGenerator.r    )r   )r0   s    r4   rX   zCameraInputMixin.dg   s   € ô Ð$ dÓ+Ð+r6   )NNNNN)rK   ÚstrrL   ú
Key | NonerM   ú
str | NonerN   úWidgetCallback | NonerO   úWidgetArgs | NonerP   úWidgetKwargs | NonerG   ÚboolrH   r   rI   r!   r=   úUploadedFile | None)rK   ri   rL   rj   rM   rk   rN   rl   rO   rm   rP   rn   rG   ro   rH   r   rI   r!   rQ   zScriptRunContext | Noner=   rp   )r=   r    )r>   r?   r@   r   rD   rR   ÚpropertyrX   rA   r6   r4   rC   rC   U   sa  „ Ù�NÓ#ð ØØ+/Ø"&Ø&*ðA
ð Ø,5Ø%.ñA
àðA
ð ðA
ð ð	A
ð
 )ðA
ð  ðA
ð $ðA
ð ðA
ð *ðA
ð #ðA
ð 
òA
ó $ðA
ðL ØØ+/Ø"&Ø&*ðD(ð Ø,5Ø%.Ø'+ñD(àðD(ð ðD(ð ð	D(ð
 )ðD(ð  ðD(ð $ðD(ð ðD(ð *ðD(ð #ðD(ð %ðD(ð 
óD(ðL ò,ó ñ,r6   rC   )7Ú
__future__r   Údataclassesr   Útextwrapr   Útypingr   r   r   Ú*streamlit.elements.lib.file_uploader_utilsr	   Ú!streamlit.elements.lib.form_utilsr
   Ú#streamlit.elements.lib.layout_utilsr   Ústreamlit.elements.lib.policiesr   r   Ústreamlit.elements.lib.utilsr   r   r   r   r   Ú(streamlit.elements.widgets.file_uploaderr   Ústreamlit.proto.CameraInput_pb2r   r_   Ústreamlit.proto.Common_pb2r   r&   r   ÚUploadedFileInfoProtoÚstreamlit.runtime.metrics_utilr   Ústreamlit.runtime.scriptrunnerr   r   Ústreamlit.runtime.stater   r   r   r   Ú'streamlit.runtime.uploaded_file_managerr   r   Ústreamlit.delta_generatorr    r!   r"   Ú__annotations__r$   rC   rA   r6   r4   ú<module>r…      s–   ðö #å !Ý ß 1Ñ 1å SÝ =Ý D÷÷õ õ GÝ KÝ RÝ PÝ 9ß O÷ó ÷ NáÝ8ÝGà&2°[Ñ&@À4Ñ&GÐ ˜)Ó Gð ÷ð ó ð÷8N,ò N,r6   