Ë
    SÏ!hü  ã                   ó€   — d 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
 ddlmZmZ  G d„ de«      Z G d	„ d
e«      Zy)z
RichText definition
é    )Úcopy)ÚNUMERIC_TYPES)Ú
InlineFontÚText)ÚStrictÚStringÚTyped)ÚElementÚ
whitespacec                   óN   — e Zd ZdZ ee¬«      Z e«       Zd„ Z	d„ Z
d„ Zd„ Zd„ Zy)	Ú	TextBlockzv Represents text string in a specific format

    This class is used as part of constructing a rich text strings.
    )Úexpected_typec                 ó    — || _         || _        y ©N)ÚfontÚtext)Úselfr   r   s      úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/openpyxl/cell/rich_text.pyÚ__init__zTextBlock.__init__   s   € ØˆŒ	Øˆ�	ó    c                 ój   — | j                   |j                   k(  xr | j                  |j                  k(  S r   )r   r   )r   Úothers     r   Ú__eq__zTextBlock.__eq__   s'   € Ø�y‰y˜EŸJ™JÑ&ÒB¨4¯9©9¸¿
¹
Ñ+BÐBr   c                 ó   — | j                   S )zJust retun the text)r   ©r   s    r   Ú__str__zTextBlock.__str__"   s   € à�y‰yÐr   c                 ó¤   — | j                   t        «       k7  xr | j                   xs d}| j                  j                  › d| j                  › d|› �S )NÚdefaultz text=z, font=)r   r   Ú	__class__Ú__name__r   )r   r   s     r   Ú__repr__zTextBlock.__repr__'   sF   € Ø�y‰yœJ›LÑ(Ò6¨T¯Y©YÒC¸)ˆØ—.‘.×)Ñ)Ð*¨&°·±°¸7À4À&ÐIÐIr   c                 óâ   — t        d«      }|j                  | j                  j                  d¬«      «       t        d«      }| j                  |_        t        |«       |j                  |«       |S )NÚrÚrPr)ÚtagnameÚt)r
   Úappendr   Úto_treer   r   )r   Úelr&   s      r   r(   zTextBlock.to_tree,   sT   € Ü�S‹\ˆØ
�	‰	�$—)‘)×#Ñ#¨EÐ#Ó2Ô3Ü�C‹LˆØ—‘ˆŒÜ�1ŒØ
�	‰	�!ŒØˆ	r   N)r    Ú
__module__Ú__qualname__Ú__doc__r	   r   r   r   r   r   r   r   r!   r(   © r   r   r   r      s5   „ ññ ˜zÔ*€DÙ‹8€Dòò
Còò
Jó
r   r   c                   ó¢   ‡ — e Zd ZdZˆ fd„Zed„ «       Zed„ «       Zed„ «       Zˆ fd„Z	ˆ fd„Z
d„ Zˆ fd	„Zˆ fd
„Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zˆ xZS )ÚCellRichTexta  Represents a rich text string.

    Initialize with a list made of pure strings or :class:`TextBlock` elements
    Can index object to access or modify individual rich text elements
    it also supports the + and += operators between rich text strings
    There are no user methods for this class

    operations which modify the string will generally call an optimization pass afterwards,
    that merges text blocks with identical formats, consecutive pure text strings,
    and remove empty strings and empty text blocks
    c                 óþ   •— t        |«      dk(  rJ|d   }t        |t        t        f«      rt        j                  |«       n.t        j                  |«       |g}nt        j                  |«       t        ‰| �!  |«       y )Né   r   )	ÚlenÚ
isinstanceÚlistÚtupler/   Ú_check_rich_textÚ_check_elementÚsuperr   )r   Úargsr   s     €r   r   zCellRichText.__init__I   sc   ø€ Üˆt‹9˜Š>Ø˜‘7ˆDÜ˜$¤¤u Ô.Ü×-Ñ-¨dÕ3ä×+Ñ+¨DÔ1Ø�v‘ä×)Ñ)¨$Ô/Ü‰Ñ˜Õr   c                 óV   — t        |t        t        t        f«      st	        d|› �«      ‚y )NzIllegal CellRichText element )r3   Ústrr   r   Ú	TypeError)ÚclsÚvalues     r   r7   zCellRichText._check_elementV   s,   € ä˜%¤#¤y´-Ð!@ÔAÜÐ;¸E¸7ÐCÓDÐDð Br   c                 ó<   — |D ]  }t         j                  |«       Œ y r   )r/   r7   )r=   Ú	rich_textr&   s      r   r6   zCellRichText._check_rich_text\   s   € àò 	+ˆAÜ×'Ñ'¨Õ*ñ	+r   c                 óŽ  — t        j                  |«      }|j                  r|j                  j                  dd«      fS g }|j                  D ]o  }d}|j                  r|j                  j                  dd«      }|j
                  r&|j                  t        |j
                  |«      «       Œ_|j                  |«       Œq  | |«      S )NÚx005F_Ú )r   Ú	from_treer&   Úreplacer#   r$   r'   r   )r=   Únoder   Úsr#   r&   s         r   rD   zCellRichText.from_treea   s›   € ä�~‰~˜dÓ#ˆØ�6Š6Ø—F‘F—N‘N 8¨RÓ0Ð2Ð2ØˆØ—‘ò 	ˆAØˆAØ�sŠsØ—C‘C—K‘K ¨"Ó-�Ø�uŠuØ—‘œ 1§5¡5¨!Ó,Õ-à—‘˜•ð	ñ �1‹vˆr   c                 óÎ  •— d }t        t        «       «      }| D ]�  }t        |t        «      r|sŒ|j                  sŒ#t        |«      t        |«      k(  rOt        |t        «      r||z  }ŒP|j                  |j                  k(  r |xj                  |j                  z  c_        Œ‰|r|j                  |«       |}ŒŸ |r|j                  |«       t        ‰| �%  t        d «      |«       | S r   )r/   r5   r3   r;   r   Útyper   r'   r8   Ú__setitem__Úslice)r   Úlast_tÚlr&   r   s       €r   Ú_optzCellRichText._opts   sÅ   ø€ ØˆÜœ›Ó!ˆØò 	ˆAÜ˜!œSÔ!ÙØØ—V’VØÜ�F‹|œt A›wÒ&Ü˜a¤Ô%Ø˜a‘K�FØØ—[‘[ A§F¡FÒ*Ø—K’K 1§6¡6Ñ)•KØÙØ—‘˜Ô Ø‰Fð	ñ  à�H‰H�VÔÜ‰ÑœE $›K¨Ô+Øˆr   c                 ó¶   •— t         j                  |«       t        ‰| �  t	        |«      D �cg c]  }t        |«      ‘Œ c}«       | j                  «       S c c}w r   )r/   r6   r8   Ú__iadd__r4   r   rN   )r   ÚargÚer   s      €r   rP   zCellRichText.__iadd__�   sB   ø€ ä×%Ñ% cÔ*Ü‰Ñ¬4°«9Ö5 aœ$˜q�'Ò5Ô6Ø�y‰y‹{Ðùò 6s   ­Ac                 ó–   — t        t        | «      t        |«      z   D �cg c]  }t        |«      ‘Œ c}«      j                  «       S c c}w r   )r/   r4   r   rN   )r   rQ   rR   s      r   Ú__add__zCellRichText.__add__”   s5   € Ü¬d°4«j¼4À»9Ñ.DÖE¨œT !�WÒEÓF×KÑKÓMÐMùÒEs   ŸAc                 óp   •— t         j                  |«       t        ‰| �  ||«       | j	                  «        y r   )r/   r7   r8   rJ   rN   )r   ÚindxÚvalr   s      €r   rJ   zCellRichText.__setitem__˜   s)   ø€ Ü×#Ñ# CÔ(Ü‰Ñ˜D #Ô&Ø�	‰	�r   c                 óN   •— t         j                  |«       t        ‰| �  |«       y r   )r/   r7   r8   r'   ©r   rQ   r   s     €r   r'   zCellRichText.appendž   s   ø€ Ü×#Ñ# CÔ(Ü‰‰�sÕr   c                 óN   •— t         j                  |«       t        ‰| �  |«       y r   )r/   r6   r8   ÚextendrY   s     €r   r[   zCellRichText.extend£   s   ø€ Ü×%Ñ% cÔ*Ü‰‰�sÕr   c                 óP   — dj                  dj                  d„ | D «       «      «      S )NzCellRichText([{}])z, c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   )Úrepr)Ú.0rG   s     r   ú	<genexpr>z(CellRichText.__repr__.<locals>.<genexpr>©   s   è ø€ Ò5LÀ!´d¸1·gÑ5Lùs   ‚)ÚformatÚjoinr   s    r   r!   zCellRichText.__repr__¨   s"   € Ø#×*Ñ*¨4¯9©9Ñ5LÀtÔ5LÓ+MÓNÐNr   c                 ó\   — dj                  | D �cg c]  }t        |«      ‘Œ c}«      S c c}w )NrC   )rb   r;   ©r   rG   s     r   r   zCellRichText.__str__¬   s#   € Ø�w‰w¨Ö- 1œ˜A�Ò-Ó.Ð.ùÒ-s   �)c                 ó>   — | D �cg c]  }t        |«      ‘Œ c}S c c}w )zv
        Returns a list of the strings contained.
        The main reason for this is to make editing easier.
        )r;   rd   s     r   Úas_listzCellRichText.as_list°   s   € ð
 !%Ö%˜1”�A•Ò%Ð%ùÒ%s   …c                 ó  — t        d«      }| D ]|  }t        |t        «      r |j                  |j	                  «       «       Œ3t        d«      }t        d«      }||_        t        |«       |j                  |«       |j                  |«       Œ~ |S )z4
        Return the full XML representation
        Úisr#   r&   )r
   r3   r   r'   r(   r   r   )r   Ú	containerÚobjr)   r&   s        r   r(   zCellRichText.to_tree¸   s}   € ô ˜D“Mˆ	Øò 
	%ˆCÜ˜#œyÔ)Ø× Ñ  §¡£Õ/ô ˜S“\�Ü˜C“L�Ø�”Ü˜1”Ø—	‘	˜!”Ø× Ñ  Õ$ð
	%ð Ðr   )r    r*   r+   r,   r   Úclassmethodr7   r6   rD   rN   rP   rT   rJ   r'   r[   r!   r   rf   r(   Ú__classcell__)r   s   @r   r/   r/   <   s   ø„ ñ
ô
ð ñEó ðEð
 ñ+ó ð+ð ñó ðô"ô4òNôôô
ò
Oò/ò&ör   r/   N)r,   r   Úopenpyxl.compatr   Úopenpyxl.cell.textr   r   Úopenpyxl.descriptorsr   r   r	   Úopenpyxl.xml.functionsr
   r   r   r4   r/   r-   r   r   ú<module>rq      s?   ðñõ Ý )ß /÷ñ ÷ 7ô"�ô "ôVM�4õ Mr   