§
    ¹³ÙgZE  ã                  óT  — d Z ddlmZ dZddlZddlmZmZmZm	Z	m
Z
mZmZmZ ddlmZmZ ddlmZmZ ddlmZ d	d
lmZmZmZ d	dlmZ d	dlmZmZmZ erddl m!Z!  G d„ d¦  «        Z" e"¦   «         Z# G d„ de¦  «        Z$ G d„ de¦  «        Z% G d„ d¦  «        Z& G d„ d¦  «        Z'dS )z<Circuit operation representing an ``switch/case`` statement.é    )Úannotations)ÚSwitchCaseOpÚCASE_DEFAULTN)ÚUnionÚIterableÚAnyÚTupleÚOptionalÚListÚLiteralÚTYPE_CHECKING)ÚClassicalRegisterÚClbit)ÚexprÚtypes)ÚCircuitErroré   )ÚInstructionPlaceholderÚInstructionResourcesÚControlFlowBuilderBlock)ÚControlFlowOp)Úunify_circuit_resourcesÚpartition_registersÚnode_resources©ÚQuantumCircuitc                  ó   — e Zd ZdZd„ ZdS )Ú_DefaultCaseTypeae  A special object that represents the "default" case of a switch statement.  If you use this
    as a case target, it must be the last case, and will match anything that wasn't already matched.
    When using the builder interface of :meth:`.QuantumCircuit.switch`, this can also be accessed as
    the ``DEFAULT`` attribute of the bound case-builder object.c                ó   — dS )Nz<default case>© ©Úselfs    ú\/granary/edev/quantum/lib/python3.11/site-packages/qiskit/circuit/controlflow/switch_case.pyÚ__repr__z_DefaultCaseType.__repr__+   s   € ØÐó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r$   r    r%   r#   r   r   "   s/   € € € € € ðCð Cð
 ð  ð  ð  ð  r%   r   c                  óf   ‡ — e Zd ZdZddœdˆ fd
„Zˆ fd„Zdd„Zd„ Zed„ ¦   «         Z	dd„Z
d„ Zˆ xZS )r   zîA circuit operation that executes one particular circuit block based on matching a given
    ``target`` against an ordered list of ``values``.  The special value :data:`.CASE_DEFAULT` can
    be used to represent a default condition.
    N©ÚlabelÚtargetú%Clbit | ClassicalRegister | expr.ExprÚcasesú$Iterable[Tuple[Any, QuantumCircuit]]r,   úOptional[str]c               ó8  •— ddl m} t          |t          j        ¦  «        r=|j        j        t          j        t          j	        fvrt          d|j        › d�¦  «        ‚n+t          |t          t          f¦  «        st          d¦  «        ‚t          |t          j        ¦  «        r'|j        j        t          j	        u rdn|j        j        }n&t          |t          ¦  «        rdnt          |¦  «        }d|z  dz
  }t          ¦   «         }d\  }}	|| _        i | _        	 g | _        	 g | _        	 t)          |¦  «        D �]�\  }
\  }}t          |t*          t,          f¦  «        rt+          |¦  «        n|f}|D ]™}|| j        v rt          d|› �¦  «        ‚t.          | j        v rt          d	¦  «        ‚|t.          urLt          |t0          ¦  «        r|dk     rt          d
¦  «        ‚||k    rt          d|› d|› d|› d|› d�	¦  «        ‚|
| j        |<   Œš| j                             |¦  «         t          ||¦  «        st          d¦  «        ‚t5          |¦  «        |v rt          d¦  «        ‚|                     t5          |¦  «        ¦  «         |€|j        |j        }	}|j        |k    s|j        |	k    rt          d¦  «        ‚| j                             |¦  «         �ŒŸ| j        st          d¦  «        ‚t=          ¦   «                              d||	| j        |¬¦  «         dS )aD  
        Args:
            target: the real-time value to switch on.
            cases: an ordered iterable of the corresponding value of the ``target`` and the circuit
                block that should be executed if this is matched.  There is no fall-through between
                blocks, and the order matters.
        r   r   zNthe switch target must be an expression with type 'Uint(n)' or 'Bool()', not 'ú'z5the switch target must be a classical bit or registerr   )NNzduplicate case value z'cases after the default are unreachablez5case values must be Booleans or non-negative integerszswitch target 'z' has z bit(s) of precision, but case z is larger than the maximum of ú.z,case blocks must be QuantumCircuit instancesz.ungrouped cases cannot point to the same blockNzincompatible bits between casesz"must have at least one case to runÚswitch_caser+   ) Úqiskit.circuitr   Ú
isinstancer   ÚExprÚtypeÚkindr   ÚUintÚBoolr   r   r   ÚwidthÚlenÚsetr-   Ú	_case_mapÚ_label_specÚ_paramsÚ	enumerateÚtupleÚlistr   ÚintÚappendÚidÚaddÚ
num_qubitsÚ
num_clbitsÚsuperÚ__init__)r"   r-   r/   r,   r   Útarget_bitsÚ
target_maxÚcase_idsrJ   rK   ÚiÚ
value_specÚcase_ÚvaluesÚvalueÚ	__class__s                  €r#   rM   zSwitchCaseOp.__init__8   sœ  ø€ ð 	2Ð1Ð1Ð1Ð1Ð1å�f�dœiÑ(Ô(ð 	XØŒ{Ô­¬
µE´JÐ'?Ð?Ð?Ý"ð,Ø#œ[ð,ð ,ð ,ñô ð ð @õ
 ˜F¥UÕ,=Ð$>Ñ?Ô?ð 	XÝÐVÑWÔWÐWå�f�dœiÑ(Ô(ð 	JØ%œ{Ô/µ5´:Ð=Ð=˜!˜!À6Ä;ÔCTˆKˆKå)¨&µ%Ñ8Ô8ÐI˜!˜!½cÀ&¹k¼kˆKØ˜;Ñ&¨!Ñ+ˆ
å‘5”5ˆØ!+Ñˆ
�JØˆŒØˆŒð	&ð QSˆÔð	ð ˆŒð	Sõ '0°Ñ&6Ô&6ð 	'ñ 	'Ñ"ˆAÑ"�
˜EÝ*4°ZÅ%ÍÀÑ*OÔ*OÐb•U˜:Ñ&Ô&Ð&ÐV`ÐUbˆFØð *ð *�Ø˜DœNÐ*Ð*Ý&Ð'F¸uÐ'FÐ'FÑGÔGÐGÝ 4¤>Ð1Ð1Ý&Ð'PÑQÔQÐQØ¥Ð,Ð,Ý% e­SÑ1Ô1ð d°U¸Q²Y°YÝ*Ð+bÑcÔcÐcØ˜zÒ)Ð)Ý*ð]¨fð ]ð ]¸Kð ]ð ]Ø).ð]ð ]ØOYð]ð ]ð ]ñô ð ð )*�”˜uÑ%Ð%ØÔ×#Ò# FÑ+Ô+Ð+Ý˜e ^Ñ4Ô4ð SÝ"Ð#QÑRÔRÐRÝ�%‰yŒy˜HÐ$Ð$Ý"Ð#SÑTÔTÐTØ�LŠL�˜E™œÑ#Ô#Ð#ØÐ!Ø).Ô)9¸5Ô;K˜J�
ØÔ :Ò-Ð-°Ô1AÀZÒ1OÐ1OÝ"Ð#DÑEÔEÐEØŒL×Ò Ñ&Ô&Ð&Ñ&ØŒ|ð 	EåÐCÑDÔDÐDå‰Œ×Ò˜¨
°JÀÄÐTYÐÑZÔZÐZÐZÐZr%   c                óÈ   •— t          ¦   «                              |¦  «        o@| j        |j        k    o0t          d„ t	          | j        |j        ¦  «        D ¦   «         ¦  «        S )Nc              3  ó\   K  — | ]'\  }}t          |¦  «        t          |¦  «        k    V — Œ(d S ©N)r?   )Ú.0Úlabels_selfÚlabels_others      r#   ú	<genexpr>z&SwitchCaseOp.__eq__.<locals>.<genexpr>�   sO   è è € ð ð á-�K õ �KÑ Ô ¥C¨Ñ$5Ô$5Ò5ðð ð ð ð ð r%   )rL   Ú__eq__r-   ÚallÚziprA   )r"   ÚotherrV   s     €r#   r^   zSwitchCaseOp.__eq__‰   sl   ø€ õ ‰GŒG�NŠN˜5Ñ!Ô!ð Ø”˜uœ|Ò+ðåð ð å14°TÔ5EÀuÔGXÑ1YÔ1Yðñ ô ñ ô ð	
r%   Úreturnú&Iterable[Tuple[Tuple, QuantumCircuit]]c                ó6   — t          | j        | j        ¦  «        S )a  Return an iterable where each element is a 2-tuple whose first element is a tuple of
        jump values, and whose second is the single circuit block that is associated with those
        values.

        This is an abstract specification of the jump table suitable for creating new
        :class:`.SwitchCaseOp` instances.

        .. seealso::
            :meth:`.SwitchCaseOp.cases`
                Create a lookup table that you can use for your own purposes to jump from values to
                the circuit that would be executed.)r`   rA   rB   r!   s    r#   Úcases_specifierzSwitchCaseOp.cases_specifier•   s   € õ �4Ô# T¤\Ñ2Ô2Ð2r%   c                óN   ‡ — ˆ fd„‰ j                              ¦   «         D ¦   «         S )aå  Return a lookup table from case labels to the circuit that would be executed in that
        case.  This object is not generally suitable for creating a new :class:`.SwitchCaseOp`
        because any keys that point to the same object will not be grouped.

        .. seealso::
            :meth:`.SwitchCaseOp.cases_specifier`
                An alternate method that produces its output in a suitable format for creating new
                :class:`.SwitchCaseOp` instances.
        c                ó2   •— i | ]\  }}|‰j         |         “ŒS r    )rB   )rZ   ÚkeyÚindexr"   s      €r#   ú
<dictcomp>z&SwitchCaseOp.cases.<locals>.<dictcomp>­   s&   ø€ ÐRÐRÐR©Z¨S°%��T”\ %Ô(ÐRÐRÐRr%   )r@   Úitemsr!   s   `r#   r/   zSwitchCaseOp.cases£   s.   ø€ ð SÐRÐRÐR¸4¼>×;OÒ;OÑ;QÔ;QÐRÑRÔRÐRr%   c                ó*   — t          | j        ¦  «        S rY   )rD   rB   r!   s    r#   ÚblockszSwitchCaseOp.blocks¯   s   € å�T”\Ñ"Ô"Ð"r%   rm   úIterable[QuantumCircuit]ú'SwitchCaseOp'c                ó"  — t          |¦  «        }t          |¦  «        t          | j        ¦  «        k    r4t          dt          | j        ¦  «        › dt          |¦  «        › �¦  «        ‚t          | j        t          | j        |¦  «        ¦  «        S )Nzneeded z blocks but received )	rD   r>   rB   r   r@   r   r-   r`   rA   )r"   rm   s     r#   Úreplace_blockszSwitchCaseOp.replace_blocks³   sz   € Ý�v‘”ˆÝˆv‰;Œ;�#˜dœlÑ+Ô+Ò+Ð+ÝÐ`­¨T¬^Ñ)<Ô)<Ð`Ð`ÕSVÐW]ÑS^ÔS^Ð`Ð`ÑaÔaÐaÝ˜DœK­¨TÔ-=¸vÑ)FÔ)FÑGÔGÐGr%   c                ó    — t          d¦  «        ‚)NznSwitchCaseOp cannot be classically controlled through Instruction.c_if. Please nest it in an IfElseOp instead.)ÚNotImplementedError)r"   Ú	classicalÚvals      r#   Úc_ifzSwitchCaseOp.c_if¹   s   € Ý!ð5ñ
ô 
ð 	
r%   )r-   r.   r/   r0   r,   r1   )rb   rc   )rm   rn   rb   ro   )r&   r'   r(   r)   rM   r^   re   r/   Úpropertyrm   rq   rv   Ú__classcell__©rV   s   @r#   r   r   2   sè   ø€ € € € € ðð ð  $ðO[ð O[ð O[ð O[ð O[ð O[ð O[ð O[ðb

ð 

ð 

ð 

ð 

ð3ð 3ð 3ð 3ð
Sð 
Sð 
Sð ð#ð #ñ „Xð#ðHð Hð Hð Hð
ð 
ð 
ð 
ð 
ð 
ð 
r%   r   c                  ó<   ‡ — e Zd ZdZddœdˆ fd
„Zd„ Zd„ Zd„ Zˆ xZS )ÚSwitchCasePlaceholderað  A placeholder instruction to use in control-flow context managers, when calculating the
    number of resources this instruction should block is deferred until the construction of the
    outer loop.

    This generally should not be instantiated manually; only :obj:`.SwitchContext` should do it when
    it needs to defer creation of the concrete instruction.

    .. warning::

        This is an internal interface and no part of it should be relied upon outside of Qiskit
        Terra.
    Nr+   r-   r.   r/   ú)List[Tuple[Any, ControlFlowBuilderBlock]]r,   r1   c               óþ   •— || _         || _        |                      ¦   «         | _        t	          ¦   «                              dt          | j        j        ¦  «        t          | j        j        ¦  «        g |¬¦  «         d S )Nr5   r+   )	Ú_SwitchCasePlaceholder__targetÚ_SwitchCasePlaceholder__casesÚ _calculate_placeholder_resourcesÚ!_SwitchCasePlaceholder__resourcesrL   rM   r>   ÚqubitsÚclbits)r"   r-   r/   r,   rV   s       €r#   rM   zSwitchCasePlaceholder.__init__Î   s}   ø€ ð ˆŒØˆŒØ×@Ò@ÑBÔBˆÔÝ‰Œ×ÒØÝ�Ô Ô'Ñ(Ô(Ý�Ô Ô'Ñ(Ô(ØØð 	ñ 	
ô 	
ð 	
ð 	
ð 	
r%   c                óP  — t          ¦   «         }t          ¦   «         }t          ¦   «         }t          ¦   «         }t          | j        t          ¦  «        r|                     | j        ¦  «         n—t          | j        t
          ¦  «        r5|                     | j        ¦  «         |                     | j        ¦  «         nHt          | j        ¦  «        }|                     |j        ¦  «         |                     |j	        ¦  «         | j
        D ]T\  }}||                     ¦   «         z  }||                     ¦   «         z  }t          |j        ¦  «        \  }}	||z  }||	z  }ŒUt          t          |¦  «        t          |¦  «        t          |¦  «        t          |¦  «        ¬¦  «        S )N©r‚   rƒ   ÚqregsÚcregs)r?   r7   r~   r   rI   r   Úupdater   rƒ   r‡   r   r‚   r   Ú	registersr   rD   )
r"   r‚   rƒ   r†   r‡   Ú	resourcesÚ_ÚbodyÚ
body_qregsÚ
body_cregss
             r#   r€   z6SwitchCasePlaceholder._calculate_placeholder_resourcesà   sg  € Ý‘”ˆÝ‘”ˆÝ‘”ˆÝ‘”ˆÝ�d”m¥UÑ+Ô+ð 	*Ø�JŠJ�t”}Ñ%Ô%Ð%Ð%Ý˜œÕ'8Ñ9Ô9ð 	*Ø�MŠM˜$œ-Ñ(Ô(Ð(Ø�IŠI�d”mÑ$Ô$Ð$Ð$å& t¤}Ñ5Ô5ˆIØ�MŠM˜)Ô*Ñ+Ô+Ð+Ø�LŠL˜œÑ)Ô)Ð)Ø”|ð 	 ð 	 ‰GˆAˆtØ�d—k’k‘m”mÑ#ˆFØ�d—k’k‘m”mÑ#ˆFÝ%8¸¼Ñ%HÔ%HÑ"ˆJ˜
Ø�ZÑˆEØ�ZÑˆEˆEÝ#Ý˜‘=”=Ý˜‘=”=Ý˜‘,”,Ý˜‘,”,ð	
ñ 
ô 
ð 	
r%   c                ó   — | j         S rY   )r�   r!   s    r#   Úplaceholder_resourcesz+SwitchCasePlaceholder.placeholder_resourcesû   s   € ØÔÐr%   c           	     ó  ‡‡— d„ t          | j        t          ˆˆfd„| j        D ¦   «         ¦  «        ¦  «        D ¦   «         }|rŒt          t	          |d         d         j        ¦  «        t	          |d         d         j        ¦  «        t	          |d         d         j        ¦  «        t	          |d         d         j        ¦  «        ¬¦  «        }n| j	        }|  
                    t          | j        || j        ¬¦  «        ¦  «        |fS )Nc                ó"   — g | ]\  \  }}}||f‘ŒS r    r    )rZ   Úlabelsr‹   Úunified_bodys       r#   ú
<listcomp>z>SwitchCasePlaceholder.concrete_instruction.<locals>.<listcomp>ÿ   s5   € ð 
ð 
ð 
á)‘�˜˜\ð �\Ð"ð
ð 
ð 
r%   c              3  óJ   •K  — | ]\  }}|                      ‰‰¦  «        V — Œd S rY   )Úbuild)rZ   r‹   rŒ   rƒ   r‚   s      €€r#   r]   z=SwitchCasePlaceholder.concrete_instruction.<locals>.<genexpr>  s5   øè è € Ð'_Ð'_ÁwÀqÈ$¨¯
ª
°6¸6Ñ(BÔ(BÐ'_Ð'_Ð'_Ð'_Ð'_Ð'_r%   r   r   r…   r+   )r`   r   r   r   rD   r‚   rƒ   r†   r‡   r�   Ú_copy_mutable_propertiesr   r~   r,   )r"   r‚   rƒ   r/   rŠ   s    ``  r#   Úconcrete_instructionz*SwitchCasePlaceholder.concrete_instructionþ   s  øø€ ð
ð 
å-0Ø”Ý'Ð'_Ð'_Ð'_Ð'_Ð'_ÐRVÔR^Ð'_Ñ'_Ô'_Ñ_Ô_ñ.ô .ð
ñ 
ô 
ˆð ð 	)Ý,Ý˜U 1œX aœ[Ô/Ñ0Ô0Ý˜U 1œX aœ[Ô/Ñ0Ô0Ý˜E !œH QœKÔ-Ñ.Ô.Ý˜E !œH QœKÔ-Ñ.Ô.ð	ñ ô ˆIˆIð Ô(ˆIà×)Ò)­,°t´}ÀeÐSWÔS]Ð*^Ñ*^Ô*^Ñ_Ô_Øð
ð 	
r%   )r-   r.   r/   r|   r,   r1   )	r&   r'   r(   r)   rM   r€   r�   r™   rx   ry   s   @r#   r{   r{   À   sƒ   ø€ € € € € ðð ð$  $ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð$
ð 
ð 
ð6 ð  ð  ð
ð 
ð 
ð 
ð 
ð 
ð 
r%   r{   c                  ó:   — e Zd ZdZddœdd„Zd„ Zdd„Zd„ Zd„ ZdS )ÚSwitchContextaƒ  A context manager for building up ``switch`` statements onto circuits in a natural order,
    without having to construct the case bodies first.

    The return value of this context manager can be used within the created context to build up the
    individual ``case`` statements.  No other instructions should be appended to the circuit during
    the `switch` context.

    This context should almost invariably be created by a :meth:`.QuantumCircuit.switch_case` call,
    and the resulting instance is a "friend" of the calling circuit.  The context will manipulate
    the circuit's defined scopes when it is entered (by pushing a new scope onto the stack) and
    exited (by popping its scope, building it, and appending the resulting :obj:`.SwitchCaseOp`).

    .. warning::

        This is an internal interface and no part of it should be relied upon outside of Qiskit
        Terra.
    Nr+   Úcircuitr   r-   r.   Úin_loopÚboolr,   r1   c               ó|  — || _         || _        t          |t          ¦  «        r|f| _        d| _        nYt          |t          ¦  «        rt          |¦  «        | _        |f| _        n't          |¦  «        }|j	        | _        |j
        | _        || _        d| _        || _        g | _        t          ¦   «         | _        d S )Nr    F)rœ   Ú_targetr7   r   Útarget_clbitsÚtarget_cregsr   rD   r   rƒ   r‡   r�   ÚcompleteÚ	_op_labelÚ_casesr?   Ú
_label_set)r"   rœ   r-   r�   r,   rŠ   s         r#   rM   zSwitchContext.__init__(  s´   € ð ˆŒØˆŒÝ�f�eÑ$Ô$ð 		0Ø5;°IˆDÔØ?AˆDÔÐÝ˜Õ 1Ñ2Ô2ð 	0Ý!& v¡¤ˆDÔØ!' 	ˆDÔÐå& vÑ.Ô.ˆIØ!*Ô!1ˆDÔØ )¤ˆDÔØˆŒØˆŒØˆŒØMOˆŒÝ™%œ%ˆŒˆˆr%   c                ó   — || j         v S )zMReturn whether a case label is already accounted for in the switch statement.)r¦   )r"   r,   s     r#   Úlabel_in_usezSwitchContext.label_in_useB  s   € à˜œÐ'Ð'r%   r“   ú-Tuple[Union[int, Literal[CASE_DEFAULT]], ...]Úblockr   c                ór   — | j                              |¦  «         | j                             ||f¦  «         dS )zÍAdd a sequence of conditions and the single block that should be run if they are
        triggered to the context.  The labels are assumed to have already been validated using
        :meth:`label_in_use`.N)r¦   rˆ   r¥   rG   )r"   r“   rª   s      r#   Úadd_casezSwitchContext.add_caseF  s:   € ð 	Œ×Ò˜vÑ&Ô&Ð&ØŒ×Ò˜F E˜?Ñ+Ô+Ð+Ð+Ð+r%   c                óV   — | j                              d¬¦  «         t          | ¦  «        S )Nz'Cannot have instructions outside a case)Úforbidden_message)rœ   Ú_push_scopeÚCaseBuilderr!   s    r#   Ú	__enter__zSwitchContext.__enter__Q  s*   € ØŒ× Ò Ð3\Ð Ñ]Ô]Ð]Ý˜4Ñ Ô Ð r%   c                óÚ  — d| _         | j                             ¦   «          |�dS t          | j        | j        | j        ¬¦  «        }|                     ¦   «         }| j        r'| j         	                    ||j
        |j        ¦  «         nc|                     t          |j
        ¦  «        t          |j        ¦  «        ¦  «        \  }}| j         	                    ||j
        |j        ¦  «         dS )NTFr+   )r£   rœ   Ú
_pop_scoper{   r    r¥   r¤   r�   r�   rG   r‚   rƒ   r™   r?   )r"   Úexc_typeÚexc_valÚexc_tbÚplaceholderÚinitial_resourcesÚ	operationrŠ   s           r#   Ú__exit__zSwitchContext.__exit__U  sä   € ØˆŒàŒ×ÒÑ!Ô!Ð!ØÐØ�5õ ,¨D¬L¸$¼+ÈTÌ^Ð\Ñ\Ô\ˆØ'×=Ò=Ñ?Ô?ÐØŒ<ð 	OØŒL×Ò Ð->Ô-EÐGXÔG_Ñ`Ô`Ð`Ð`à#.×#CÒ#CÝÐ%Ô,Ñ-Ô-­sÐ3DÔ3KÑ/LÔ/Lñ$ô $Ñ ˆI�yð ŒL×Ò 	¨9Ô+;¸YÔ=MÑNÔNÐNØˆur%   )rœ   r   r-   r.   r�   rž   r,   r1   )r“   r©   rª   r   )	r&   r'   r(   r)   rM   r¨   r¬   r±   rº   r    r%   r#   r›   r›     s‚   € € € € € ðð ð0  $ð ð  ð  ð  ð  ð  ð4(ð (ð (ð	,ð 	,ð 	,ð 	,ð!ð !ð !ðð ð ð ð r%   r›   c                  ó@   — e Zd ZdZeZ	 dd„Zej        d„ ¦   «         Z	dS )r°   a%  A child context manager for building up the ``case`` blocks of ``switch`` statements onto
    circuits in a natural order, without having to construct the case bodies first.

    This context should never need to be created manually by a user; it is the return value of the
    :class:`.SwitchContext` context manager, which in turn should only be created by suitable
    :meth:`.QuantumCircuit.switch_case` calls.

    .. warning::

        This is an internal interface and no part of it should be relied upon outside of Qiskit
        Terra.
    Úparentr›   c                ó"   — || _         d| _        d S )NF)ÚswitchÚentered)r"   r¼   s     r#   rM   zCaseBuilder.__init__{  s   € ØˆŒØˆŒˆˆr%   c              '  óÜ  K  — | j         rt          d¦  «        ‚| j        j        rt          d¦  «        ‚t	          d„ |D ¦   «         ¦  «        st          d¦  «        ‚t          ¦   «         }|D ]H}| j                             |¦  «        s||v rt          d|› d�¦  «        ‚|                     |¦  «         ŒI| j        j         	                    | j        j
        | j        j        | j        j        ¬¦  «         	 d| _         d V — d	| _         | j        j                             ¦   «         }n*# d	| _         | j        j                             ¦   «         }w xY w| j                             ||¦  «         d S )
Nz§Cannot enter more than one case at once. If you want multiple labels to point to the same block, pass them all to a single case context, such as `with case(1, 2, 3):`.z6Cannot add a new case to a completed switch statement.c              3  óR   K  — | ]"}|t           u pt          |t          ¦  «        V — Œ#d S rY   )r   r7   rF   )rZ   rU   s     r#   r]   z'CaseBuilder.__call__.<locals>.<genexpr>Š  s6   è è € ÐWÐWÀu�5�LÐ(ÐB­J°u½cÑ,BÔ,BÐWÐWÐWÐWÐWÐWr%   z.Case values must be integers or `CASE_DEFAULT`zduplicate case label: 'r3   )rƒ   r‰   Úallow_jumpsTF)r¿   r   r¾   r£   r_   r?   r¨   rI   rœ   r¯   r¡   r¢   r�   r³   r¬   )r"   rT   ÚseenrU   rª   s        r#   Ú__call__zCaseBuilder.__call__  s”  è è € àŒ<ð 	Ýð2ñô ð ð Œ;Ôð 	YÝÐWÑXÔXÐXÝÐWÐWÐPVÐWÑWÔWÑWÔWð 	QÝÐOÑPÔPÐPÝ‰uŒuˆØð 	ð 	ˆEØŒ{×'Ò'¨Ñ.Ô.ð G°%¸4°-°-Ý"Ð#E¸UÐ#EÐ#EÐ#EÑFÔFÐFØ�HŠH�U‰OŒOˆOˆOØŒÔ×'Ò'Ø”;Ô,Ø”kÔ.ØœÔ+ð 	(ñ 	
ô 	
ð 	
ð	5ØˆDŒLØˆEˆEˆEà ˆDŒLØ”KÔ'×2Ò2Ñ4Ô4ˆEˆEøð !ˆDŒLØ”KÔ'×2Ò2Ñ4Ô4ˆEÐ4Ð4Ð4Ð4ð
 	Œ×Ò˜V UÑ+Ô+Ð+Ð+Ð+s   Ã6D' Ä''EN)r¼   r›   )
r&   r'   r(   r)   r   ÚDEFAULTrM   Ú
contextlibÚcontextmanagerrÄ   r    r%   r#   r°   r°   j  s[   € € € € € ðð ð €GØGðð ð ð ð Ôð!,ð !,ñ Ôð!,ð !,ð !,r%   r°   )(r)   Ú
__future__r   Ú__all__rÆ   Útypingr   r   r   r	   r
   r   r   r   Ú qiskit.circuit.classicalregisterr   r   Úqiskit.circuit.classicalr   r   Úqiskit.circuit.exceptionsr   Úbuilderr   r   r   Úcontrol_flowr   Ú_builder_utilsr   r   r   r6   r   r   r   r   r{   r›   r°   r    r%   r#   ú<module>rÑ      s  ðð CÐ Bà "Ð "Ð "Ð "Ð "Ð "à
*€à Ð Ð Ð Ø VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ VÐ Và EÐ EÐ EÐ EÐ EÐ EÐ EÐ EØ 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2à ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZØ 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø XÐ XÐ XÐ XÐ XÐ XÐ XÐ XÐ XÐ Xàð .Ø-Ð-Ð-Ð-Ð-Ð-ð
 ð 
 ð 
 ð 
 ð 
 ñ 
 ô 
 ð 
 ð  ÐÑ!Ô!€ðK
ð K
ð K
ð K
ð K
�=ñ K
ô K
ð K
ð\R
ð R
ð R
ð R
ð R
Ð2ñ R
ô R
ð R
ðjRð Rð Rð Rð Rñ Rô Rð Rðj7,ð 7,ð 7,ð 7,ð 7,ñ 7,ô 7,ð 7,ð 7,ð 7,r%   