Ë
    uPêj�d  ã                   ó  — U d dl mZmZ d dlmZ d dlmZ d dlmZmZm	Z	m
Z
 d dlZd dlmZ d dlmZmZ d dl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mZ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( er	d dl)m*Z+ e+Z,neZ, G d„ de«      Z- G d„ ded¬«      Z. G d„ dee/¬«      Z0dejb                  de.fd„Z2dZ3e	e4d<   d Z5e	e6e6e7e8f   d!f      e4d"<   d#e/de8dz  fd$„Z9d%e8dz  de:dz  fd&„Z;d'e.de:dz  fd(„Z<d)e:de7fd*„Z= G d+„ d,e«      Z>y)-é    )ÚMappingÚSequence)Údatetime)ÚMappingProxyType)ÚTYPE_CHECKINGÚAnyÚFinalÚLiteralN)ÚRequestFiles)ÚReadOnlyÚ	TypedDict)ÚRUNWAYML_DEFAULT_API_VERSION)Úencode_url_path_segment)ÚBaseLLMException)ÚBaseVideoConfig)ÚAsyncHTTPHandlerÚHTTPHandlerÚ_get_httpx_clientÚget_async_httpx_client)Úget_secret_str)ÚGenericLiteLLMParams)Ú VideoCreateOptionalRequestParamsÚVideoObject)Úencode_video_id_with_providerÚextract_original_video_id)ÚLoggingc                   ó   — e Zd Zy)ÚRunwayMLErrorN)Ú__name__Ú
__module__Ú__qualname__© ó    úp/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/llms/runwayml/videos/transformation.pyr   r   %   s   „ Ør#   r   c                   ó´   — e Zd ZU ee   ed<   ee   ed<   ee   ed<   ee   ed<   eee   ez     ed<   ee   ed<   ee   ed<   ee   ed<   eeeef      ed	<   y
)Ú_RunwayTaskResponseÚidÚstatusÚ	createdAtÚcompletedAtÚoutputÚfailureCodeÚfailureÚprogressÚestimatedCostN)	r   r    r!   r   ÚstrÚ__annotations__r   Úfloatr   r"   r#   r$   r&   r&   )   sp   … Ø�‰ÓØ�S‰MÓØ˜‰}ÓØ˜#‘ÓØ�X˜c‘] SÑ(Ñ)Ó)Ø˜#‘ÓØ�c‰]ÓØ�u‰oÓØ˜G C¨ JÑ/Ñ0Ô0r#   r&   F)Útotalc                   óT   — e Zd ZU ee   ed<   eed      ed<   ee   ed<   ee   ed<   y)Ú_VideoObjectDatar'   ÚvideoÚobjectr(   Ú
created_atN)r   r    r!   r   r0   r1   r
   Úintr"   r#   r$   r5   r5   5   s0   … Ø�‰ÓØ�W˜WÑ%Ñ&Ó&Ø�S‰MÓØ˜‘Ôr#   r5   )Úextra_itemsÚraw_responseÚreturnc                 ó&   — | j                  «       }|S ©N)Újson)r;   Úresponse_datas     r$   Ú_parse_runway_task_responserA   <   s   € Ø0<×0AÑ0AÓ0C€MØÐr#   g{®Gáz„?Ú_USD_PER_CREDIT))iÀ'	 Ú480p)i`ã Ú720p)i 	= Ú1080p.Ú_RESOLUTION_AREA_TIERSÚratioc                 óú   ‡— t        | t        «      rd| vry | j                  d«      \  }}}|j                  «       r|j                  «       sy t	        |«      t	        |«      z  Št        ˆfd„t        D «       d«      S )Nú:c              3   ó4   •K  — | ]  \  }}‰|k  sŒ|–— Œ y ­wr>   r"   )Ú.0Ú	thresholdÚlabelÚareas      €r$   ú	<genexpr>z'_ratio_to_resolution.<locals>.<genexpr>Q   s   øè ø€ ÒZÑ+˜9 eÈÐPYÓIY”ÑZùs   ƒ‘Ú4k)Ú
isinstancer0   Ú	partitionÚisdigitr9   ÚnextrF   )rG   Ú	width_strÚ_Ú
height_strrN   s       @r$   Ú_ratio_to_resolutionrX   J   sm   ø€ Ü�eœSÔ! S°Ñ%5ØØ$Ÿ™¨sÓ3Ñ€Iˆq�*Ø×ÑÔ J×$6Ñ$6Ô$8ØÜ�i“.¤3 z£?Ñ2€DÜÓZÔ/EÔZÐ\`ÓaÐar#   Úsecondsc                 ó>   — | sy 	 t        | «      S # t        $ r Y y w xY wr>   )r2   Ú
ValueError)rY   s    r$   Ú_duration_secondsr\   T   s)   € ÙØðÜ�W‹~ÐøÜò Ùðús   …
 �	›r@   c                 óº   — | j                  d«      }t        |t        «      sy |j                  d«      }t        |t        t        f«      sy t	        |«      t
        z  S )Nr/   Úcredits)ÚgetrQ   r   r9   r2   rB   )r@   Úestimated_costr^   s      r$   Ú_estimated_cost_usdra   ]   sO   € Ø)×-Ñ-¨oÓ>€NÜ�n¤gÔ.ØØ#×'Ñ'¨	Ó2€GÜ�g¤¤U˜|Ô,ØÜ�‹>œOÑ+Ð+r#   r.   c                 óX   — t        dt        dt        t        | «      dz  «      «      «      S )Néd   r   )ÚminÚmaxÚroundr2   )r.   s    r$   Ú_progress_percentrg   g   s$   € Üˆs”C˜œ5¤ x£°3Ñ!6Ó7Ó8Ó9Ð9r#   c                   ó&  ‡ — e Zd ZdZˆ fd„Zdedefd„Zdedede	de
fd„Z	 	 d=d
e
deded	z  ded	z  de
f
d„Zdeded	z  de
defd„Zdededede
ded
e
dee
eef   fd„Zdeeef   defd„Z	 	 d=dedej,                  deded	z  de
d	z  defd„Zdedefd„Zded	z  defd„Z	 d>dededed
e
ded	z  deee
f   fd„Zd e
eef   defd!„Zdej,                  dede fd"„Z!dej,                  dede fd#„Z"	 d>dedededed
e
d$eeef   d	z  deee
f   fd%„Z#	 d>dej,                  deded	z  defd&„Z$	 	 	 	 d?deded
e
d'ed	z  d(ed	z  d)ed	z  d*eeef   d	z  deee
f   fd+„Z%	 d>dej,                  deded	z  de
eef   fd,„Z&dededed
e
deee
f   f
d-„Z'dej,                  dedefd.„Z(dededed
e
deee
f   f
d/„Z)	 d>dej,                  deded	z  defd0„Z*d1efd2„Z+d3„ Z,d4„ Z-d5„ Z.	 	 	 d@d6„Z/	 	 d=d7„Z0	 d>d8„Z1d>d9„Z2d:ed;ed
e
ejf                  z  de4fd<„Z5ˆ xZ6S )AÚRunwayMLVideoConfiga&  
    Configuration class for RunwayML video generation.

    RunwayML uses a task-based API where:
    1. POST /v1/text_to_video, /v1/image_to_video, or /v1/video_to_video creates a task
    2. The task returns immediately with a task ID
    3. Client must poll or wait for task completion
    c                 ó"   •— t         ‰| �  «        y r>   )ÚsuperÚ__init__)ÚselfÚ	__class__s    €r$   rl   zRunwayMLVideoConfig.__init__u   s   ø€ Ü‰ÑÕr#   Úmodelr<   c                 ó
   — g d¢S )a&  
        Get the list of supported OpenAI parameters for video generation.
        Maps OpenAI params to RunwayML equivalents:
        - prompt -> promptText
        - input_reference -> promptImage
        - size -> ratio (e.g., "1280x720" -> "1280:720")
        - seconds -> duration
        )ro   ÚpromptÚinput_referencerY   ÚsizeÚuserÚextra_headersr"   )rm   ro   s     r$   Úget_supported_openai_paramsz/RunwayMLVideoConfig.get_supported_openai_paramsx   s   € ò
ð 	
r#   Úvideo_create_optional_paramsÚdrop_paramsc                 ó–  — i }d|v r
|d   }||d<   d|v r.|d   }t        |t        «      rd|v r|j                  dd«      |d<   d|v r:|d   }|�3	 t        |t        «      rt        t	        |«      «      n
t        |«      |d<   | j                  |«      }|j                  «       D ]  \  }	}
|	|vsŒ|
||	<   Œ |S # t
        t        f$ r Y ŒFw xY w)	a  
        Map OpenAI parameters to RunwayML format.

        Mappings:
        - prompt -> promptText
        - input_reference -> promptImage
        - size -> ratio (convert "WIDTHxHEIGHT" to "WIDTH:HEIGHT")
        - seconds -> duration (convert to integer)
        rr   ÚpromptImagers   ÚxrI   rG   rY   Úduration)	rQ   r0   Úreplacer9   r2   r[   Ú	TypeErrorrv   Úitems)rm   rw   ro   rx   Úmapped_paramsrr   rs   rY   Úsupported_openai_paramsÚkeyÚvalues              r$   Úmap_openai_paramsz%RunwayMLVideoConfig.map_openai_params‹   s  € ð 35ˆð Ð <Ñ<Ø%AÐBSÑ%TˆOà+:ˆM˜-Ñ(ð Ð1Ñ1Ø6°vÑ>ˆDÜ˜$¤Ô$¨°©Ø)-¯©°c¸3Ó)?�˜gÑ&ð Ð4Ñ4Ø9¸)ÑDˆGØÐ"ðÜGQÐRYÔ[^ÔG_´´E¸'³NÔ0CÔehÐipÓeq�M *Ñ-ð *.×)IÑ)IÈ%Ó)PÐØ6×<Ñ<Ó>ò 	+‰JˆC�ØÐ1Ò1Ø%*�˜cÒ"ð	+ð Ðøô #¤IÐ.ò áðús   Á2B6 Â6CÃCNÚheadersÚapi_keyÚlitellm_paramsc                 óð   — |r|j                   r|xs |j                   }|xs* t        j                   xs t        d«      xs t        d«      }|€t        d«      ‚|j	                  d|› �t
        ddœ«       |S )z”
        Validate environment and set up authentication headers.
        RunwayML uses Bearer token authentication via RUNWAYML_API_SECRET.
        ÚRUNWAYML_API_SECRETÚRUNWAYML_API_KEYzeRunwayML API key is required. Set RUNWAYML_API_SECRET environment variable or pass api_key parameter.zBearer zapplication/json)ÚAuthorizationzX-Runway-VersionzContent-Type)r†   Úlitellmr   r[   Úupdater   )rm   r…   ro   r†   r‡   s        r$   Úvalidate_environmentz(RunwayMLVideoConfig.validate_environmentº   sŠ   € ñ ˜n×4Ò4ØÒ7 ×!7Ñ!7ˆGð Òu”w—‘Òu¬.Ð9NÓ*OÒuÔSaÐbtÓSuð 	ð ˆ?ÜØwóð ð 	�‰à#*¨7¨)Ð!4Ü$@Ø 2ñô	
ð ˆr#   Úapi_basec                 ó,   — |€d}|j                  d«      S )z
        Get the base URL for RunwayML API.
        The specific endpoint path will be added in the transform methods.
        zhttps://api.dev.runwayml.com/v1ú/)Úrstrip)rm   ro   r�   r‡   s       r$   Úget_complete_urlz$RunwayMLVideoConfig.get_complete_urlÛ   s   € ð ÐØ8ˆHà�‰˜sÓ#Ð#r#   rq   Ú$video_create_optional_request_paramsc                 óÄ   — t        ||dœ|¥«      }| j                  |«      }|j                  «       D �	�
ci c]  \  }	}
|dk(  s|	dk7  sŒ|	|
“Œ }}	}
g }|||› d|› �fS c c}
}	w )a   
        Transform the video creation request for RunwayML API.

        RunwayML has three generation endpoints discriminated by which input is
        present, and each request body rejects unknown fields:
        - /text_to_video: promptText only (rejects promptImage)
        - /image_to_video: promptImage (+ optional promptText)
        - /video_to_video: promptVideo or videoUri (rejects promptImage)
        )ro   Ú
promptTextÚimage_to_videorz   r‘   )r   Ú_select_generation_endpointr   )rm   ro   rq   r�   r”   r‡   r…   Úmerged_paramsÚendpointr‚   rƒ   Úrequest_dataÚ
files_lists                r$   Útransform_video_create_requestz2RunwayMLVideoConfig.transform_video_create_requestê   s—   € ô$  0àØ$ñð 7ðó 
ˆð ×:Ñ:¸=ÓIˆð *7×)<Ñ)<Ó)>÷2
Ù%˜3 À(ÐN^ÒB^ÐbeÐivÓbvˆC�‰Jð2
ˆñ 2
ð +-ˆ
à˜Z¨H¨:°Q°x°jÐ)AÐAÐAùó2
s   µAÁAr›   c                 ón   — |j                  d«      €|j                  d«      �y|j                  d«      �yy)NÚpromptVideoÚvideoUriÚvideo_to_videorz   r—   Útext_to_video)r_   )rm   r›   s     r$   r˜   z/RunwayMLVideoConfig._select_generation_endpoint  s=   € Ø×Ñ˜MÓ*Ð6¸,×:JÑ:JÈ:Ó:VÐ:bØ#Ø×Ñ˜MÓ*Ð6Ø#Ør#   r;   Úlogging_objÚcustom_llm_providerc                 ó¦  — t        |«      }|j                  dd«      d| j                  |j                  dd«      «      | j                  |j                  d«      «      dœ}d|v r(|d   r#t	        |d   t
        «      r|d   d	   n|d   |d
<   d|v r#| j                  |j                  d«      «      |d<   d|v sd|v r(|j                  dd«      |j                  dd«      dœ|d<   |rSd|v r|d   |d<   d|v r.|d   }t	        |t        «      rd|v r|j                  dd«      |d<   d|v rt        |d   «      |d<   t        di |¤Ž}	|r(|	j                  rt        |	j                  ||«      |	_	        dt        |	j                  «      fdt        |r|j                  d«      nd«      fdt        |«      ffD �
�ci c]
  \  }
}|�|
|“Œ c}}
|	_        |	S c c}}
w )ah  
        Transform the RunwayML video creation response.

        RunwayML returns a task object that looks like:
        {
            "id": "task_123...",
            "status": "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED",
            "output": ["https://...video.mp4"] (when succeeded)
        }

        We map this to OpenAI VideoObject format.
        r'   Ú r6   r(   Úpendingr)   ©r'   r7   r(   r8   r+   r   Ú
output_urlr*   Úcompleted_atr,   r-   ÚunknownúVideo generation failed©ÚcodeÚmessageÚerrorro   rG   rI   r{   rs   r|   rY   Úduration_secondsÚvideo_resolutionNÚprovider_reported_cost_usdr"   )rA   r_   Ú_map_runway_statusÚ_parse_runway_timestamprQ   Úlistr0   r}   r   r'   r   r\   rY   rX   ra   Úusage)rm   ro   r;   r£   r¤   r›   r@   Ú
video_datarG   Ú	video_objr‚   rƒ   s               r$   Útransform_video_create_responsez3RunwayMLVideoConfig.transform_video_create_response  s  € ô(  ;¸<ÓHˆð  ×#Ñ# D¨"Ó-ØØ×-Ñ-¨m×.?Ñ.?ÀÈ)Ó.TÓUØ×6Ñ6°}×7HÑ7HÈÓ7UÓVñ	/
ˆ
ð �}Ñ$¨°xÒ)@ô /9¸ÀxÑ9PÔRVÔ.W�˜hÑ'¨Ò*Ð]jÐksÑ]tð �|Ñ$ð ˜MÑ)Ø)-×)EÑ)EÀm×FWÑFWÐXeÓFfÓ)gˆJ�~Ñ&à˜MÑ)¨Y¸-Ñ-Gà%×)Ñ)¨-¸ÓCØ(×,Ñ,¨YÐ8QÓRñ#ˆJ�wÑñ Ø˜,Ñ&Ø&2°7Ñ&;�
˜7Ñ#Ø˜,Ñ&à+¨GÑ4�Ü˜e¤SÔ)¨c°U©lØ).¯©°s¸CÓ)@�J˜vÑ&Ø˜\Ñ)Ü(+¨L¸Ñ,DÓ(E�
˜9Ñ%ä&Ñ4¨Ñ4ˆ	á 9§<¢<Ü8¸¿¹ÐGZÐ\aÓbˆIŒLð $Ô%6°y×7HÑ7HÓ%IÐJØ#Ô%9ÑWc¸,×:JÑ:JÈ7Ô:SÐimÓ%nÐoØ-Ô/BÀ=Ó/QÐRð÷
á��Uð
 Ð ð �‰Jó
ˆ	Œð Ðùó
s   Æ3GÚrunway_statusc                 óT   — dddddddœ}|j                  |j                  «       d«      S )zÉ
        Map RunwayML status to OpenAI status format.

        RunwayML statuses: PENDING, RUNNING, SUCCEEDED, FAILED, CANCELLED
        OpenAI statuses: queued, in_progress, completed, failed
        ÚqueuedÚin_progressÚ	completedÚfailed)ÚPENDINGÚRUNNINGÚ	SUCCEEDEDÚFAILEDÚ	CANCELLEDÚ	THROTTLED)r_   Úupper)rm   r»   Ú
status_maps      r$   r´   z&RunwayMLVideoConfig._map_runway_statusa  s9   € ð  Ø$Ø$ØØ!Ø!ñ
ˆ
ð �~‰~˜m×1Ñ1Ó3°XÓ>Ð>r#   Útimestamp_strc                 ó°   — |sy	 t        j                  |j                  dd«      «      }t        |j	                  «       «      S # t
        t        f$ r Y yw xY w)zÒ
        Convert RunwayML ISO 8601 timestamp to Unix timestamp.

        RunwayML returns timestamps like: "2025-11-11T21:48:50.448Z"
        We need to convert to Unix timestamp (seconds since epoch).
        r   ÚZz+00:00)r   Úfromisoformatr}   r9   Ú	timestampr[   ÚAttributeError)rm   rÉ   Údts      r$   rµ   z+RunwayMLVideoConfig._parse_runway_timestampr  sT   € ñ Øð	ä ×.Ñ.¨}×/DÑ/DÀSÈ(Ó/SÓTˆBä�r—|‘|“~Ó&Ð&øÜœNÐ+ò 	Ùð	ús   …=A ÁAÁAÚvideo_idÚvariantc                 óL   — t        |«      }t        |d¬«      }|› d|› �}i }	||	fS )a  
        Transform the video content request for RunwayML API.

        RunwayML doesn't have a separate content download endpoint.
        The video URL is returned in the task output field.
        We'll retrieve the task and extract the video URL.
        rÐ   ©Ú
field_nameú/tasks/©r   r   )
rm   rÐ   r�   r‡   r…   rÑ   Úoriginal_video_idÚencoded_video_idÚurlÚparamss
             r$   Útransform_video_content_requestz3RunwayMLVideoConfig.transform_video_content_request„  sA   € ô $=¸XÓ#FÐÜ"9Ð:KÐXbÔ"cÐð !�z Ð)9Ð(:Ð;ˆà(*ˆà�Fˆ{Ðr#   r@   c                 ó  — d}d|v r!|d   r|d   }t        |t        «      r|d   n|}|sU|j                  dd«      }|dv rt        d|› d�«      ‚|d	k(  r |j                  d
d«      }t        d|› �«      ‚t        d«      ‚|S )z~
        Helper method to extract video URL from RunwayML response.
        Shared between sync and async transforms.
        Nr+   r   r(   ÚUNKNOWN)rÁ   rÂ   rÆ   z#Video is still processing (status: z). Please wait and try again.rÄ   r-   zUnknown errorzVideo generation failed: z<Video URL not found in response. Video may not be ready yet.)rQ   r¶   r_   r[   )rm   r@   Ú	video_urlr+   r(   Úfailure_reasons         r$   Ú _extract_video_url_from_responsez4RunwayMLVideoConfig._extract_video_url_from_response�  sª   € ð ˆ	Ø�}Ñ$¨°xÒ)@Ø)¨(Ñ3ˆFÜ%/°¼Ô%=˜˜qš	À6ˆIáà)×-Ñ-¨h¸	ÓBˆFØÐ<Ñ<Ü Ð#FÀvÀhÐNkÐ!lÓmÐmØ˜8Ò#Ø(5×(9Ñ(9¸)À_Ó(U�Ü Ð#<¸^Ð<LÐ!MÓNÐNä Ð!_Ó`Ð`àÐr#   c                 ó²   — |j                  «       }| j                  |«      }t        «       }|j                  |«      }|j	                  «        |j
                  S )aú  
        Transform the RunwayML video content download response (synchronous).

        RunwayML's task endpoint returns JSON with a video URL in the output field.
        We need to extract the URL and download the video.

        Example response:
        {
            "id":"63fd0f13-f29d-4e58-99d3-1cb9efa14a5b",
            "createdAt":"2025-11-11T21:48:50.448Z",
            "status":"SUCCEEDED",
            "output":["https://dnznrvs05pmza.cloudfront.net/.../video.mp4?_jwt=..."]
        }
        )r?   rà   r   r_   Úraise_for_statusÚcontent)rm   r;   r£   r@   rÞ   Úhttpx_clientÚvideo_responses          r$   Ú transform_video_content_responsez4RunwayMLVideoConfig.transform_video_content_responseµ  sT   € ð&  ,×0Ñ0Ó2ˆØ×@Ñ@ÀÓOˆ	ô ,=Ó+>ˆØ ,× 0Ñ 0°Ó ;ˆØ×'Ñ'Ô)à×%Ñ%Ð%r#   c              ƒ   ó  K  — |j                  «       }| j                  |«      }t        t        j                  j
                  ¬«      }|j                  |«      ƒ d{  –—† }|j                  «        |j                  S 7 Œ ­w)a
  
        Transform the RunwayML video content download response (asynchronous).

        RunwayML's task endpoint returns JSON with a video URL in the output field.
        We need to extract the URL and download the video asynchronously.

        Example response:
        {
            "id":"63fd0f13-f29d-4e58-99d3-1cb9efa14a5b",
            "createdAt":"2025-11-11T21:48:50.448Z",
            "status":"SUCCEEDED",
            "output":["https://dnznrvs05pmza.cloudfront.net/.../video.mp4?_jwt=..."]
        }
        )Úllm_providerN)	r?   rà   r   rŒ   ÚLlmProvidersÚRUNWAYMLr_   râ   rã   )rm   r;   r£   r@   rÞ   Úasync_httpx_clientrå   s          r$   Ú&async_transform_video_content_responsez:RunwayMLVideoConfig.async_transform_video_content_responseÒ  sv   è ø€ ð&  ,×0Ñ0Ó2ˆØ×@Ñ@ÀÓOˆ	ô 7MÜ ×-Ñ-×6Ñ6ô7
Ðð '9×&<Ñ&<¸YÓ&G× GˆØ×'Ñ'Ô)à×%Ñ%Ð%ð !Hús   ‚AA?ÁA=Á!A?Ú
extra_bodyc                 ó   — t        d«      ‚)zÛ
        Transform the video remix request for RunwayML API.

        RunwayML doesn't have a direct remix endpoint in their current API.
        This would need to be implemented when/if they add this feature.
        ú0Video remix is not yet supported by RunwayML API©ÚNotImplementedError)rm   rÐ   rq   r�   r‡   r…   rí   s          r$   Útransform_video_remix_requestz1RunwayMLVideoConfig.transform_video_remix_requestñ  s   € ô "Ð"TÓUÐUr#   c                 ó   — t        d«      ‚)z,Transform the RunwayML video remix response.rï   rð   ©rm   r;   r£   r¤   s       r$   Útransform_video_remix_responsez2RunwayMLVideoConfig.transform_video_remix_response  s   € ô "Ð"TÓUÐUr#   ÚafterÚlimitÚorderÚextra_queryc                 ó   — t        d«      ‚)zŽ
        Transform the video list request for RunwayML API.

        RunwayML doesn't expose a list endpoint in their public API yet.
        ú2Video listing is not yet supported by RunwayML APIrð   )rm   r�   r‡   r…   rö   r÷   rø   rù   s           r$   Útransform_video_list_requestz0RunwayMLVideoConfig.transform_video_list_request  s   € ô "Ð"VÓWÐWr#   c                 ó   — t        d«      ‚)z+Transform the RunwayML video list response.rû   rð   rô   s       r$   Útransform_video_list_responsez1RunwayMLVideoConfig.transform_video_list_response  s   € ô "Ð"VÓWÐWr#   c                 óN   — t        |«      }t        |d¬«      }|› d|› d�}i }||fS )zp
        Transform the video delete request for RunwayML API.

        RunwayML uses task cancellation.
        rÐ   rÓ   rÕ   z/cancelrÖ   ©	rm   rÐ   r�   r‡   r…   r×   rØ   rÙ   Údatas	            r$   Útransform_video_delete_requestz2RunwayMLVideoConfig.transform_video_delete_request%  sC   € ô $=¸XÓ#FÐÜ"9Ð:KÐXbÔ"cÐð !�z Ð)9Ð(:¸'ÐBˆà&(ˆà�DˆyÐr#   c           
      ó–   — t        |«      }t        |j                  dd«      dd| j                  |j                  d«      «      ¬«      }|S )z4Transform the RunwayML video delete/cancel response.r'   r¦   r6   Ú	cancelledr)   r¨   )rA   r   r_   rµ   )rm   r;   r£   r@   r¹   s        r$   Útransform_video_delete_responsez3RunwayMLVideoConfig.transform_video_delete_response;  sO   € ô  ;¸<ÓHˆä&Ø× Ñ   rÓ*ØØØ×3Ñ3°M×4EÑ4EÀkÓ4RÓSô	
ˆ	ð Ðr#   c                 óL   — t        |«      }t        |d¬«      }|› d|› �}i }||fS )z�
        Transform the RunwayML video status retrieve request.

        RunwayML uses GET /v1/tasks/{task_id} to retrieve task status.
        rÐ   rÓ   rÕ   rÖ   r   s	            r$   Ú'transform_video_status_retrieve_requestz;RunwayMLVideoConfig.transform_video_status_retrieve_requestL  sC   € ô $=¸XÓ#FÐÜ"9Ð:KÐXbÔ"cÐð !�z Ð)9Ð(:Ð;ˆð ')ˆà�DˆyÐr#   c                 óv  — t        |«      }|j                  dd«      d| j                  |j                  dd«      «      | j                  |j                  d«      «      dœ}d|v r(|d   r#t	        |d   t
        «      r|d   d	   n|d   |d
<   d|v r#| j                  |j                  d«      «      |d<   |j                  d«      }|�t        |«      |d<   d|v sd|v r(|j                  dd«      |j                  dd«      dœ|d<   t        di |¤Ž}|r(|j                  rt        |j                  |d«      |_        |S )zH
        Transform the RunwayML video status retrieve response.
        r'   r¦   r6   r(   r§   r)   r¨   r+   r   r©   r*   rª   r.   Nr,   r-   r«   r¬   r­   r°   r"   )
rA   r_   r´   rµ   rQ   r¶   rg   r   r'   r   )rm   r;   r£   r¤   r@   r¸   Úprogress_valuer¹   s           r$   Ú(transform_video_status_retrieve_responsez<RunwayMLVideoConfig.transform_video_status_retrieve_responsec  s^  € ô  ;¸<ÓHˆð  ×#Ñ# D¨"Ó-ØØ×-Ñ-¨m×.?Ñ.?ÀÈ)Ó.TÓUØ×6Ñ6°}×7HÑ7HÈÓ7UÓVñ	/
ˆ
ð �}Ñ$¨°xÒ)@ä.8¸ÀxÑ9PÔRVÔ.W�˜hÑ'¨Ò*Ð]jÐksÑ]tð �|Ñ$ð ˜MÑ)Ø)-×)EÑ)EÀm×FWÑFWÐXeÓFfÓ)gˆJ�~Ñ&à -× 1Ñ 1°*Ó =ˆØÐ%Ü%6°~Ó%FˆJ�zÑ"à˜MÑ)¨Y¸-Ñ-Gà%×)Ñ)¨-¸ÓCØ(×,Ñ,¨YÐ8QÓRñ#ˆJ�wÑô
 'Ñ4¨Ñ4ˆ	á 9§<¢<Ü8¸¿¹ÐGZÐ\`ÓaˆIŒLàÐr#   r6   c                 ó   — t        d«      ‚©Nz4video create character is not supported for RunwayMLrð   )rm   Únamer6   r�   r‡   r…   s         r$   Ú(transform_video_create_character_requestz<RunwayMLVideoConfig.transform_video_create_character_request�  ó   € Ü!Ð"XÓYÐYr#   c                 ó   — t        d«      ‚r  rð   ©rm   r;   r£   s      r$   Ú)transform_video_create_character_responsez=RunwayMLVideoConfig.transform_video_create_character_response“  r  r#   c                 ó   — t        d«      ‚©Nz1video get character is not supported for RunwayMLrð   )rm   Úcharacter_idr�   r‡   r…   s        r$   Ú%transform_video_get_character_requestz9RunwayMLVideoConfig.transform_video_get_character_request–  ó   € Ü!Ð"UÓVÐVr#   c                 ó   — t        d«      ‚r  rð   r  s      r$   Ú&transform_video_get_character_responsez:RunwayMLVideoConfig.transform_video_get_character_response™  r  r#   c	                 ó   — t        d«      ‚©Nz(video edit is not supported for RunwayMLrð   )	rm   rq   rÐ   r�   r‡   r…   Ú
video_filerí   Úprefetched_source_datas	            r$   Útransform_video_edit_requestz0RunwayMLVideoConfig.transform_video_edit_requestœ  s   € ô "Ð"LÓMÐMr#   c                 ó   — t        d«      ‚r  rð   )rm   r;   r£   r¤   r›   s        r$   Útransform_video_edit_responsez1RunwayMLVideoConfig.transform_video_edit_response©  s   € ô "Ð"LÓMÐMr#   c                 ó   — t        d«      ‚©Nz-video extension is not supported for RunwayMLrð   )rm   rq   rÐ   rY   r�   r‡   r…   rí   s           r$   Ú!transform_video_extension_requestz5RunwayMLVideoConfig.transform_video_extension_request²  s   € ô "Ð"QÓRÐRr#   c                 ó   — t        d«      ‚r"  rð   rô   s       r$   Ú"transform_video_extension_responsez6RunwayMLVideoConfig.transform_video_extension_response¾  s   € Ü!Ð"QÓRÐRr#   Úerror_messageÚstatus_codec                 ó   — t        |||¬«      S )N)r'  r¯   r…   )r   )rm   r&  r'  r…   s       r$   Úget_error_classz#RunwayMLVideoConfig.get_error_classÁ  s   € ÜØ#Ø!Øô
ð 	
r#   )NNr>   )NNNN)NNN)7r   r    r!   Ú__doc__rl   r0   r¶   rv   r   ÚboolÚdictr„   r   rŽ   r“   Útupler   r�   r   r7   r˜   ÚhttpxÚResponseÚLiteLLMLoggingObjr   rº   r´   r9   rµ   rÛ   r   rà   Úbytesræ   rì   rò   rõ   rü   rþ   r  r  r  r
  r  r  r  r  r  r   r#  r%  ÚHeadersr   r)  Ú__classcell__)rn   s   @r$   ri   ri   k   sN  ø„ ñôð
°ð 
¸ó 
ð&-à&Fð-ð ð-ð ð	-ð
 
ó-ðf #Ø6:ñàðð ðð �t‘ð	ð
 -¨tÑ3ðð 
óðB$àð$ð ˜‘*ð$ð ð	$ð
 
ó$ð"Bàð"Bð ð"Bð ð	"Bð
 /3ð"Bð -ð"Bð ð"Bð 
ˆt�\ 3Ð&Ñ	'ó"BðH¸ÀÀVÀÑ8Lð ÐQTó ð +/Ø$(ñJàðJð —n‘nðJð 'ð	Jð
 ! 4™ZðJð ˜T‘kðJð 
óJðX?°ð ?¸ó ?ð"°S¸4±Zð ÀCó ð0 #ñàðð ðð -ð	ð
 ðð �t‘ðð 
ˆs�DˆyÑ	óð2¸dÀ3ÈÀ8¹nð ÐQTó ð0&à—n‘nð&ð 'ð&ð 
ó	&ð:&à—n‘nð&ð 'ð&ð 
ó	&ðL 37ñVàðVð ðVð ð	Vð
 -ðVð ðVð ˜C ˜KÑ(¨4Ñ/ðVð 
ˆs�DˆyÑ	óVð* +/ñ	Và—n‘nðVð 'ðVð ! 4™Zð	Vð
 
óVð !Ø Ø Ø37ñXàðXð -ðXð ð	Xð
 �T‰zðXð �T‰zðXð �T‰zðXð ˜S &˜[Ñ)¨DÑ0ðXð 
ˆs�DˆyÑ	óXð* +/ñ	Xà—n‘nðXð 'ðXð ! 4™Zð	Xð
 
ˆc�3ˆh‰óXðàðð ðð -ð	ð
 ðð 
ˆs�DˆyÑ	óð,à—n‘nðð 'ðð 
ó	ð"àðð ðð -ð	ð
 ðð 
ˆs�DˆyÑ	óð6 +/ñ	+à—n‘nð+ð 'ð+ð ! 4™Zð	+ð
 
ó+ðZZÀFó ZòZòWòWð ØØ#óNð" !ØóNð" ó
SóSð
¨Sð 
¸sð 
ÈTÐTY×TaÑTaÑMað 
Ðfv÷ 
r#   ri   )?Úcollections.abcr   r   r   Útypesr   Útypingr   r   r	   r
   r.  Úhttpx._typesr   Útyping_extensionsr   r   rŒ   Úlitellm.constantsr   Ú$litellm.litellm_core_utils.url_utilsr   Ú)litellm.llms.base_llm.chat.transformationr   Ú+litellm.llms.base_llm.videos.transformationr   Ú&litellm.llms.custom_httpx.http_handlerr   r   r   r   Úlitellm.secret_managers.mainr   Úlitellm.types.routerr   Úlitellm.types.videos.mainr   r   Úlitellm.types.videos.utilsr   r   Ú*litellm.litellm_core_utils.litellm_loggingr   Ú_LiteLLMLoggingObjr0  r   r&   r7   r5   r/  rA   rB   r1   rF   r-  r9   r0   rX   r2   r\   ra   rg   ri   r"   r#   r$   ú<module>rD     s>  ðß -Ð -Ý Ý "ß 5Ó 5ã Ý %ß 1ã Ý :Ý HÝ FÝ G÷ó õ 8Ý 5ß S÷ñ
 ÝXà*ÑàÐô	Ð$ô 	ô	1˜)¨5õ 	1ô�y¨fõ ð¨e¯n©nð ÐATó ð
 €�Ó ð>Ð ˜˜e E¨#¨s¨(¡O°SÐ$8Ñ9Ñ:ó ðb ð b¨3°©:ó bð˜s T™zð ¨e°d©ló ð,Ð':ð ,¸uÀt¹|ó ,ð: ð :¨#ó :ô[	
˜/õ [	
r#   