o
�J�hG$ � @ s� d dl mZ d dlZd dlmZ d dlmZmZmZ ddl m
Z
mZ er*ddlm
Z
d#dd
�Zd$dd�ZG dd� d�ZG dd� d�Zd%dd�Zd&d!d"�ZdS )'� )�annotationsN)�BytesIO)�
TYPE_CHECKING�Any�cast� )�Image� ImageFile)�CapsuleType�kw�dict[str, Any]�return�ImageFile.ImageFile | Nonec C s@ d }d| v r| � d�}nd| v rt| � d��}|sd S t�|�S )N�file�data)�popr r �open)r �source� r �IC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\PIL\ImageTk.py�_get_image_from_kw* s
r �command�str�photo�PhotoImage | tkinter.PhotoImage�ptrr
�Nonec C sb |j }z|�| |t|�� W d S tjy0 ddlm} |�|�� � |�| |t|�� Y d S w )Nr )�
_imagingtk) �tk�call�repr�tkinter�TclError� r Ztkinit�
interpaddr)r r r r r r r r �_pyimagingtkcall5 s �r% c @ sR e Zd ZdZ dddd�Zdd
d�Zddd�Zddd�Zddd�Zd dd�Z dS )!�
PhotoImagea3
A Tkinter-compatible photo image. This can be used
everywhere Tkinter expects an image object. If the image is an RGBA
image, pixels having alpha 0 are treated as transparent.
The constructor takes either a PIL image, or a mode and a size.
Alternatively, you can use the ``file`` or ``data`` options to initialize
the photo image object.
:param image: Either a PIL image, or a mode string. If a mode string is
used, a size must also be given.
:param size: If the first argument is a mode string, this defines the size
of the image.
:keyword file: A filename to load the image from (using
``Image.open(file)``).
:keyword data: An 8-bit string containing image data (as loaded from an
image file).
N�image�Image.Image | str | None�size�tuple[int, int] | Noner r r
r c K s� |d u rt |�}|d u rd}t|��t|t�r&|}d }|d u r%d}t|��n#|j}|dkr>|�� |�� |jr<|jjnd}|j}|\|d<