
    hi%,                       d Z ddlmZ ddlmZmZmZ ddl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mZmZmZmZmZmZ erdd	lmZ  G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z  G d de          Z! G d de          Z" G d de          Z# G d de          Z$ G d de          Z% G d  d!e          Z& G d" d#e          Z' G d$ d%e          Z(d&S )'zBSlide-related custom element classes, including those for masters.    )annotations)TYPE_CHECKINGCallablecast)parse_from_template	parse_xml)CT_GradientFillPropertiesnsdecls)	XsdString)BaseOxmlElementChoiceOneAndOnlyOneOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOneZeroOrOneChoice)CT_GroupShapec                  6    e Zd ZU dZded<   edd            ZdS )	_BaseSlideElementz=Base class for the six slide types, providing common methods.CT_CommonSlideDatacSldreturnr   c                    | j         j        S )z-Return required `p:cSld/p:spTree` grandchild.)r   spTreeselfs    g/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/pptx/oxml/slide.pyr   z_BaseSlideElement.spTree   s     y    N)r   r   )__name__
__module____qualname____doc____annotations__propertyr    r    r   r   r      sF         GG      X     r    r   c                  h    e Zd ZU dZded<   dZ edd          Zded	<    ed
d          Z[d Z	dS )CT_Backgroundz`p:bg` element.z)Callable[[CT_BackgroundProperties], None]_insert_bgPr)p:bgPrp:bgRefr+   r'   
successorszCT_BackgroundProperties | NonebgPrr,   c                    dt          dd          z  }t          t          t          |                    }|                     |           |S )z5Return a new `p:bgPr` element with noFill properties.z4<p:bgPr %s>
  <a:noFill/>
  <a:effectLst/>
</p:bgPr>ap)r   r   CT_BackgroundPropertiesr   r*   )r   xmlr/   s      r   add_noFill_bgPrzCT_Background.add_noFill_bgPr3   sH    PSZ[^`cSdSdd+Ys^^<<$r    N)
r!   r"   r#   r$   r%   _tag_seqr   r/   bgRefr5   r'   r    r   r)   r)   %   s         ;;;; %H+49R, , ,D     IiB///E    r    r)   c            
          e Zd ZdZdZ e ed           ed           ed           ed           ed           ed          fed	d
                   Z[d Zd
S )r3   z`p:bgPr` element.)	a:noFilla:solidFill
a:gradFill
a:blipFill
a:pattFill	a:grpFillza:effectLstza:effectDagza:extLstr9   r:   r;   r<   r=   r>      Nr-   c                (    t          j                    S )z1Override default to add default gradient subtree.)r	   new_gradFillr   s    r   _new_gradFillz%CT_BackgroundProperties._new_gradFillV   s    (5777r    )	r!   r"   r#   r$   r6   r   r   eg_fillPropertiesrB   r'   r    r   r3   r3   ;   s        
H (F:F=!!F<  F<  F<  F;	
 ABB<
 
 
 	8 8 8 8 8r    r3   c                      e Zd ZU dZded<   ded<   dZ ededd	         
          Zded<    ed          Z	ded<   [ e
ded          Zded<   ddZddZd	S )r   z`p:cSld` element.zCallable[[], None]
_remove_bgzCallable[[], CT_Background]get_or_add_bg)p:bgp:spTreezp:custDataLstz
p:controlsp:extLstrG      Nr-   zCT_Background | NonebgrH   r   r   name )defaultstrr   r3   c                ~    | j         }||j        |                                 }t          t          |j                  S )zReturn `p:bg/p:bgPr` grandchild.

        If no such grandchild is present, any existing `p:bg` child is first removed and a new
        default `p:bg` with noFill settings is added.
        )rK   r/   _change_to_noFill_bgr   r3   r   rK   s     r   get_or_add_bgPrz"CT_CommonSlideData.get_or_add_bgPrk   s:     W:**,,B+RW555r    r)   c                ~    |                                   |                                 }|                                 |S )zmEstablish a `p:bg` child with no-fill settings.

        Any existing `p:bg` child is first removed.
        )rE   rF   r5   rR   s     r   rQ   z'CT_CommonSlideData._change_to_noFill_bgv   s<    
 	!!
	r    )r   r3   )r   r)   )r!   r"   r#   r$   r%   r6   r   rK   r   r   r   r   rL   rS   rQ   r'   r    r   r   r   [   s         """"....NH(y8ABB<     B     *M*55F5555!!	2  D    	6 	6 	6 	6     r    r   c                  R    e Zd ZU dZdZ ed          Zded<   [ed	d            Z	dS )
CT_NotesMasterz5`p:notesMaster` element, root of a notes master part.)p:cSldp:clrMapp:hfzp:notesStylerI   rW   r   r   r   c                F    t          t          t          d                    S )zLReturn a new `p:notesMaster` element based on the built-in default template.notesMaster)r   rV   r   clss    r   new_defaultzCT_NotesMaster.new_default   s     N$7$F$FGGGr    N)r   rV   )
r!   r"   r#   r$   r6   r   r   r%   classmethodr^   r'   r    r   rV   rV      sc         ??IH,}X66D6666H H H [H H Hr    rV   c                  R    e Zd ZU dZdZ ed          Zded<   [ed	d            Z	dS )
CT_NotesSlidez.`p:notes` element, root of a notes slide part.)rW   p:clrMapOvrrI   rW   r   r   r   c                F    t          t          t          d                    S )zReturn a new ``<p:notes>`` element based on the default template.

        Note that the template does not include placeholders, which must be subsequently cloned
        from the notes master.
        notes)r   ra   r   r\   s    r   newzCT_NotesSlide.new   s     M#6w#?#?@@@r    N)r   ra   )
r!   r"   r#   r$   r6   r   r   r%   r_   re   r'   r    r   ra   ra      sc         884H,}X66D6666A A A [A A Ar    ra   c                  
   e Zd ZU dZdZ ed          Zded<    ededd         	          Z	 ed
edd         	          Z
[edd            Zed             Zd Zd Zed             Zed             Zed             ZdS )CT_Slidez=`p:sld` element, root element of a slide part (XML document).)rW   rb   p:transitionp:timingrI   rW   r   r   rb      Nr-   ri      r   c                j    t          t          t          |                                                     S )z:Return new `p:sld` element configured as base slide shape.)r   rg   r   _sld_xmlr\   s    r   re   zCT_Slide.new   s$     Hi77888r    c                    | j         j        S )z0Return `p:bg` grandchild or None if not present.)r   rK   r   s    r   rK   zCT_Slide.bg   s     y|r    c                @    | j         }||                                 }|S )a  Return parent element for a new `p:video` child element.

        The `p:video` element causes play controls to appear under a video
        shape (pic shape containing video). There can be more than one video
        shape on a slide, which causes the precondition to vary. It needs to
        handle the case when there is no `p:sld/p:timing` element and when
        that element already exists. If the case isn't simple, it just nukes
        what's there and adds a fresh one. This could theoretically remove
        desired existing timing information, but there isn't any evidence
        available to me one way or the other, so I've taken the simple
        approach.
        )_childTnLst_add_childTnLst)r   
childTnLsts     r   get_or_add_childTnLstzCT_Slide.get_or_add_childTnLst   s)     %
--//Jr    c                    |                      |                                            t          |                                           }|                     |           |                    d          d         S )zAdd `./p:timing/p:tnLst/p:par/p:cTn/p:childTnLst` descendant.

        Any existing `p:timing` child element is ruthlessly removed and
        replaced.
        z"./p:tnLst/p:par/p:cTn/p:childTnLstr   )removeget_or_add_timingr   _childTnLst_timing_xml_insert_timingxpath)r   timings     r   rq   zCT_Slide._add_childTnLst   sg     	D**,,---4668899F###||@AA!DDr    c                D    |                      d          }|sdS |d         S )z~Return `./p:timing/p:tnLst/p:par/p:cTn/p:childTnLst` descendant.

        Return None if that element is not present.
        z+./p:timing/p:tnLst/p:par/p:cTn/p:childTnLstNr   )ry   )r   childTnLstss     r   rp   zCT_Slide._childTnLst   s-     jj!NOO 	41~r    c                 &    dt          d          z  S )Nz<p:timing %s>
  <p:tnLst>
    <p:par>
      <p:cTn id="1" dur="indefinite" restart="never" nodeType="tmRoot">
        <p:childTnLst/>
      </p:cTn>
    </p:par>
  </p:tnLst>
</p:timing>r2   r
   r'   r    r   rw   zCT_Slide._childTnLst_timing_xml   s    	 $CLL	)	
r    c                 *    dt          ddd          z  S )Na  <p:sld %s>
  <p:cSld>
    <p:spTree>
      <p:nvGrpSpPr>
        <p:cNvPr id="1" name=""/>
        <p:cNvGrpSpPr/>
        <p:nvPr/>
      </p:nvGrpSpPr>
      <p:grpSpPr/>
    </p:spTree>
  </p:cSld>
  <p:clrMapOvr>
    <a:masterClrMapping/>
  </p:clrMapOvr>
</p:sld>r1   r2   rr
   r'   r    r   rm   zCT_Slide._sld_xml   s"     !c3//0	
r    )r   rg   )r!   r"   r#   r$   r6   r   r   r%   r   	clrMapOvrrz   r_   re   r&   rK   rs   rq   rp   staticmethodrw   rm   r'   r    r   rg   rg      s"        GGPH,}X66D6666	-HQRRLAAAIYzhqrrl;;;F9 9 9 [9   X  $	E 	E 	E   X 
 
 \
 
 
 \
 
 
r    rg   c                  :    e Zd ZU dZdZ ed          Zded<   [dS )CT_SlideLayoutz3`p:sldLayout` element, root of a slide layout part.)rW   rb   rh   ri   rY   rI   rW   r   r   N)r!   r"   r#   r$   r6   r   r   r%   r'   r    r   r   r      s9         ==XH,}X66D6666r    r   c                  4    e Zd ZU dZded<    ed          ZdS )CT_SlideLayoutIdListz`p:sldLayoutIdLst` element, child of `p:sldMaster`.

    Contains references to the slide layouts that inherit from the slide master.
    zlist[CT_SlideLayoutIdListEntry]sldLayoutId_lstzp:sldLayoutIdN)r!   r"   r#   r$   r%   r   sldLayoutIdr'   r    r   r   r     s7          
 5444*_--KKKr    r   c                  6    e Zd ZU dZ ede          Zded<   dS )CT_SlideLayoutIdListEntryzg`p:sldLayoutId` element, child of `p:sldLayoutIdLst`.

    Contains a reference to a slide layout.
    zr:idrO   rIdN)r!   r"   r#   r$   r   r   r   r%   r'   r    r   r   r     s<          
 ! 33C333333r    r   c                  x    e Zd ZU dZded<   dZ ed          Zded<    eded	d
                   Z	ded<   [d
S )CT_SlideMasterz3`p:sldMaster` element, root of a slide master part.z"Callable[[], CT_SlideLayoutIdList]get_or_add_sldLayoutIdLst)rW   rX   p:sldLayoutIdLstrh   ri   rY   z
p:txStylesrI   rW   r   r   r      Nr-   r   sldLayoutIdLst)
r!   r"   r#   r$   r%   r6   r   r   r   r   r'   r    r   r   r     s         ==AAAA	H  -}X66D6666+49x|, , ,N     	r    r   c                  B    e Zd ZdZdZ ededd                   Z[dS )CT_SlideTimingz>`p:timing` element, specifying animations and timed behaviors.)p:tnLstzp:bldLstrI   r   rJ   Nr-   )r!   r"   r#   r$   r6   r   tnLstr'   r    r   r   r   0  s8        HH2HIiHQRRL999Er    r   c                  .    e Zd ZdZd Zed             ZdS )CT_TimeNodeListz%`p:tnLst` or `p:childTnList` element.c                    dt          d          | j        |fz  }t          |          }|                     |           dS )z>Add a new `p:video` child element for movie having *shape_id*.a  <p:video %s>
  <p:cMediaNode vol="80000">
    <p:cTn id="%d" fill="hold" display="0">
      <p:stCondLst>
        <p:cond delay="indefinite"/>
      </p:stCondLst>
    </p:cTn>
    <p:tgtEl>
      <p:spTgt spid="%d"/>
    </p:tgtEl>
  </p:cMediaNode>
</p:video>
r2   N)r   _next_cTn_idr   append)r   shape_id	video_xmlvideos       r   	add_videozCT_TimeNodeList.add_video;  sN     &cllD,=xHI 	 )$$Er    c                h    |                      d          }d |D             }t          |          dz   S )z<Return the next available unique ID (int) for p:cTn element.z/p:sld/p:timing//p:cTn/@idc                ,    g | ]}t          |          S r'   )int).0id_strs     r   
<listcomp>z0CT_TimeNodeList._next_cTn_id.<locals>.<listcomp>R  s    555vs6{{555r    rJ   )ry   max)r   cTn_id_strsidss      r   r   zCT_TimeNodeList._next_cTn_idN  s9     jj!=>>555553xx!|r    N)r!   r"   r#   r$   r   r&   r   r'   r    r   r   r   8  sD        //  &   X  r    r   c                  .    e Zd ZdZdZ ed          Z[dS )CT_TLMediaNodeVideoz2`p:video` element, specifying video media details.)p:cMediaNoder   N)r!   r"   r#   r$   r6   r   
cMediaNoder'   r    r   r   r   V  s+        << H~..Jr    r   N))r$   
__future__r   typingr   r   r   	pptx.oxmlr   r   pptx.oxml.dml.fillr	   pptx.oxml.nsr   pptx.oxml.simpletypesr   pptx.oxml.xmlchemyr   r   r   r   r   r   r   r   pptx.oxml.shapes.groupshaper   r   r)   r3   r   rV   ra   rg   r   r   r   r   r   r   r   r'   r    r   <module>r      s   H H " " " " " " 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 8 8 8 8 8 8             + + + + + +	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  :999999                   O   ,8 8 8 8 8o 8 8 8@# # # # # # # #L
H 
H 
H 
H 
H& 
H 
H 
HA A A A A% A A A"\
 \
 \
 \
 \
  \
 \
 \
~    &   . . . . .? . . .4 4 4 4 4 4 4 4    &   ,    _       o   <    /     r    