
    "|ho&                        d dl mZ d dlZd dlZd dlmZmZmZmZ  ej                  d      Z
d
ddZddZddZd Zed	k(  r e        yy)    )annotationsN)ListUnionTupleOptionalu   .*[-.!?;:…]$c                    t        | t              r| g} |r$| D cg c]  }t        j                  dd|       } }| S c c}w )Nz<[^>]*> )
isinstancestrresub)textremove_ssml_tagsxs      I/var/www/html/test/engine/venv/lib/python3.12/site-packages/pyht/utils.pyprepare_textr   
   s@    $v378az2q)88K 9s   <c                    | j                  dd      \  }}|r||k(  r&t        j                  d| d| d| d| d	       ||fS t        d|  d| d	      )
N-   Voice engine zF is deprecated;                         separately pass voice_engine='z' and protocol='z'.z&Got voice engine of deprecated format z9                          as well as mismatched protocol .)rsplitloggingwarning
ValueError)voice_engineprotocol_voice_engine	_protocols       r    _convert_deprecated_voice_enginer       s    +223:M9x9,-a	{ C77DoEUV_U``bd 	ei''A, P99A
!E F 	F    c                   |r|dvrt        d| d      | st|st        j                  d       d} d}| |fS |dv r"t        j                  d| d	| d
       d} | |fS |dk(  rt        j                  d       d} | |fS t        d| d      | dk(  r|sd}|dk7  rt        d| d      | |fS | dv rod| vr't        j                  d       | j                  dd      } | dk(  r,|st        j                  d       d}|dvrt        d| d      t	        | |      \  } }| |fS | dv rF| dv r/|st        j                  d       d}|dvr!t        d|  d| d      t	        | |      \  } }| |fS t        d|  d      )N)httpwsgrpczInvalid protocol: z (must be http, ws, or grpc).z?No voice engine or protocol specified; using Play3.0-mini-http.Play3.0-minir#   )r#   r$   z*No voice engine specified and protocol is z; using Play3.0-mini-r   r%   zFNo voice engine specified and protocol is grpc; using PlayHT2.0-turbo.PlayHT2.0-turboz/No voice engine specified and invalid protocol z7Voice engine PlayHT2.0-turbo does not support protocol z (must be grpc).)r&   Play3.0-mini-httpPlay3.0-mini-wsPlay3.0-mini-grpcPlay3.0Play3.0-http
Play3.0-wsPlay3.0-grpcminiz5Voice engine Play3.0 is deprecated; use Play3.0-mini.r+   z!No protocol specified; using httpz4Voice engine Play3.0-mini does not support protocol z`                                  (must be http, ws, or grpc [grpc for on-prem customers only]).)
PlayDialogPlayDialog-httpPlayDialog-wsPlayDialogMultilingualPlayDialogMultilingual-httpPlayDialogMultilingual-ws)r0   r3   r   z does not support protocol z7                                  (must be http or ws).zInvalid voice engine: zi (must be Play3.0-mini, PlayDialog,                          PlayDialogMultilingual, or PlayHT2.0-turbo).)r   r   r   replacer    )r   r   s     r   get_voice_engine_and_protocolr7      s[   H$::-hZ7TUVV OO]^)LH^ !!] 'OOH
Rghpgqqrst)LX !!W OOde,LR !!O NxjXuvww	*	*HvVW_V``pqrrB !!? 
 S 
S%OOST'//	>JL>) CD!55 #WX`Wa b` "a b b &FlT\%]"L($ !!! 
 V 
VCC CD!~- =>YZbYc d7 "8 9 9 &FlT\%]"L( !! 1, @F G H 	Hr!   c                    t        d d      dk(  sJ t        dd      dk(  sJ t        d d      dk(  sJ t        dd      dk(  sJ t        d d       dk(  sJ t        dd       dk(  sJ t        d d      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        d	d      dk(  sJ t        d	d       dk(  sJ t        d	d      dk(  sJ t        d
d      dk(  sJ t        d
d       dk(  sJ t        d
d      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ t        d d      dk(  sJ t        dd      dk(  sJ t        dd      dk(  sJ t        dd       dk(  sJ t        dd      dk(  sJ y )Nr#   )r&   r#   r	   r$   )r&   r$   r&   r%   )r&   r%   r(   r)   r*   r+   r,   r-   r.   r0   )r0   r#   )r0   r$   r1   r2   r3   )r3   r#   )r3   r$   r4   r5   )r'   r%   r'   )r7    r!   r   mainr:   Y   sY   (v6:RRRR(V48PPPP(t48NNNN(T26LLLL(t48PPPP(T26NNNN(r26NNNN(R04LLLL(@D\\\\(>BXXXX(@D\\\\(>BZZZZ(<@XXXX()<fEIaaaa()<dCG____()<bAE]]]]():DAE[[[[():DAE[[[[():B?CYYYY()<fEIaaaa()<dCG____()<bAE]]]](F;?WWWW(D9=SSSS(F;?WWWW(D9=UUUU(B7;SSSS(@D\\\\(>BZZZZ(<@XXXX(t<@VVVV(t<@VVVV(r:>TTTT(@D\\\\(>BZZZZ(<@XXXX(v>BXXXX(t<@TTTT(t<@VVVV(r:>TTTT():FCG]]]]():DAE[[[[():B?CYYYY($?CWWWW($?CWWWW("=AUUUU()A6JNpppp()A4HLllll()A4HLnnnn()A2FJllll()FOSuuuu()FMQssss()FKOqqqq()DdKOoooo()DdKOoooo()DbIMmmmm(v6:UUUU(V48SSSS():FCGbbbb():DAE````():B?C^^^^r!   __main__)T)r   zUnion[str, List[str]]r   boolreturnz	List[str])r   r   r   Optional[str]r=   Tuple[str, str])r   r>   r   r>   r=   r?   )
__future__r   r   r   typingr   r   r   r   compileSENTENCE_END_REGEXr   r    r7   r:   __name__r9   r!   r   <module>rE      sS    "  	 / /RZZ 01 F9"x@_F zF r!   