o
    ÌÄ.j  ã                   @   sR   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 G dd„ de	ƒZ
dgZdS )	z&XML-REFERENCE values from :rfc:`9253`.é    )ÚClassVar)ÚunquoteÚurlparse)ÚSelf)ÚvUric                   @   s`   e Zd ZU dZdZee ed< edefdd„ƒZ	ededB fdd	„ƒZ
edee fd
d„ƒZdS )ÚvXmlReferencez¶An XML-REFERENCE.

    The associated value references an associated XML artifact and
    is a URI with an XPointer anchor value.

    This is defined in :rfc:`9253`, Section 7.
    zXML-REFERENCEÚdefault_valueÚreturnc                 C   s   | j S )z'The XML reference URI of this property.)Úuri)Úself© r   úQ/home/thesage/.local/lib/python3.10/site-packages/icalendar/prop/xml_reference.pyÚxml_reference   s   zvXmlReference.xml_referenceNc                 C   s8   t | jƒ}t|jƒ}| d¡r| d¡sdS |dd… S )aÄ  The XPointer of the URI.

        The XPointer is defined in `W3C.WD-xptr-xpointer-20021219
        <https://www.rfc-editor.org/rfc/rfc9253.html#W3C.WD-xptr-xpointer-20021219>`_,
        and its use as an anchor is defined in `W3C.REC-xptr-framework-20030325
        <https://www.rfc-editor.org/rfc/rfc9253.html#W3C.REC-xptr-framework-20030325>`_.

        Returns:
            The decoded x-pointer or ``None`` if no valid x-pointer is found.
        z	xpointer(ú)Né	   éÿÿÿÿ)r   r   r   ÚfragmentÚ
startswithÚendswith)r   Úparsedr   r   r   r   Ú	x_pointer   s
   

zvXmlReference.x_pointerc                 C   s
   | dƒgS )zExamples of vXmlReference.z1http://example.com/doc.xml#xpointer(/doc/element)r   )Úclsr   r   r   Úexamples,   s   
zvXmlReference.examples)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚstrÚ__annotations__Úpropertyr   r   ÚclassmethodÚlistr   r   r   r   r   r   r   
   s   
 r   N)r   Útypingr   Úurllib.parser   r   Úicalendar.compatibilityr   Úicalendar.prop.urir   r   Ú__all__r   r   r   r   Ú<module>   s    
(