+
    2j                        R t ^ RIHt ^ RIHt ^ RIHtHt ^RIH	t	H
t
Ht ]'       d   ^RIHt ^RIHt . ROtRtR R	 ltR
 R ltR R ltR R ltR# )a  Unit propagation for the PubGrub resolver.

When an incompatibility has all but one term satisfied, the
remaining term's negation is derived (unit rule).  This module
owns that loop plus the per-term/per-incompatibility evaluators
that classify each term as SATISFIED, CONTRADICTED, or UNDETERMINED.

Reference: https://github.com/dart-lang/pub/blob/master/doc/solver.md#unit-propagation
)annotations)deque)TYPE_CHECKINGAny)IncompatibilityStateSetRelationTerm)Resolver)Incompatibilityi c               $    V ^8  d   QhRRRRRR/# )   resolverResolver[Any, Any]changed_packager   returnz Incompatibility[Any, Any] | None )formats   "a/home/user/billing-ledger-validation/.venv/lib/python3.14/site-packages/nab_resolver/propagate.py__annotate__r   !   s$     1 1 1361%1    c                   \        V.4      pV0pV'       Ed   VP                  4       pVP                  V4       V P                  P	                  V. 4      pV EF  pV P
                  V,          p\        W4      pV\        P                  J d   Vu # \        V\        4      '       g   KR  VP                  4       p	V P                  P	                  V	P                  4      p
V P                  P                  V	P                  V	P                  V	P!                  4       VR7       V P                  P	                  V	P                  4      pW8w  g   K  V P"                  ;P$                  ^,          un        V P&                  P)                  V	P                  V	P!                  4       VR7       V	P                  V9  g   EKb  VP+                  V	P                  4       VP-                  V	P                  4       EK  	  EK  R# )aj  Propagate constraints from incompatibilities.

When an incompatibility has all but one term satisfied, the
remaining term's negation is derived (unit rule). Returns a
conflicting incompatibility if all terms are satisfied, or
None if propagation completes without conflict.

Reference: https://github.com/dart-lang/pub/blob/master/doc/solver.md#unit-propagation
)positivecauseN)r   popleftdiscardpackage_to_incompatibilitiesgetincompatibilitiesevaluate_incompatibilityr   CONFLICT
isinstancer   negatesolutionpackagederive
constraintis_positivestatsderivationsobserveron_derivationappendadd)r   r   propagation_queuein_queuer#   related_indicesincompatibility_indexincompatibility
evaluationnegated_termrange_beforerange_afters   &&          r   unit_propagationr6   !   s    %*?*;$<)*H

#++-!"??CCGRP%4!&889NOO1(LJ1:::&&*d++)002'0044\5I5IJ!!(( (( ++)557)	 )  '//33L4H4HI.NN..!3.%%33$,,!-!9!9!;- 4 
 $++8;)001E1EF \%9%9:7 &5: r   c               $    V ^8  d   QhRRRRRR/# )r   r   r   r1   zIncompatibility[Any, Any]r   z,IncompatibilityState | Term[Any, Any] | Noner   )r   s   "r   r   r   U   s$     ) ) )3L)1)r   c                    RpVP                    FD  p\        W4      pV\        P                  J d   K$  V\        P                  J d    R# Ve    R# TpKF  	  Ve   V# \
        P                  # )a  Evaluate an incompatibility against the current partial solution.

Returns:
  ``IncompatibilityState.CONFLICT``: all terms satisfied
  ``Term``: exactly one undetermined term (unit propagation candidate)
  ``None``: 0 or 2+ undetermined terms (nothing to do yet)
N)termsterm_relationr   	SATISFIEDCONTRADICTEDr   r   )r   r1   undetermined_termtermrelations   &&   r   r   r   U   so     04%% 0{,,,{///(  & $  (((r   c               $    V ^8  d   QhRRRRRR/# )r   r   r   r>   Term[Any, Any]r   r   r   )r   s   "r   r   r   p   s"        .  n    r   c                   V P                   P                  VP                  4      pVf   \        P                  # VP                  4       pV P                  pW2VP                  3pVP                  V4      pVfe   VP                  VP                  4      p\        WP                  VP                  R7      p\        V4      \        8  d   VP                  4        WdV&   T;'       d    V\        P                  J ;'       g"    V'       * ;'       d    V\        P                   J pV'       d<   V P                   P#                  VP                  4      '       g   \        P                  # V# )aC  Check how the partial solution relates to this term.

A term can only be satisfied or contradicted when the package has a
positive constraint; without one it might not participate in the
solution (negative terms are trivially true for absent packages).

See: https://github.com/dart-lang/pub/blob/master/doc/solver.md#term
)subsetdisjoint)r"   r   r#   r   UNDETERMINEDr&   relation_cacher%   r?   classify_relation	is_subsetis_disjointlenRELATION_CACHE_MAXclearr;   r<   has_positive_constraint)	r   r>   
assignmentr   cachekeyresultr?   needs_positives	   &&       r   r:   r:   p   s$    ""&&t||4J'''!H##E
1CYYs^F~&&t7"++h6J6J
 u:++KKMc
BB6[-B-B#B  ;;;#;#;;  h//GGUU'''Mr   c               (    V ^8  d   QhRRRRRRRR/# )r   r>   rA   rC   boolrD   r   r   r   )r   s   "r   r   r      s2     $ $
$ $ 	$
 $r   c                   V P                  4       '       d   YrCMY!rCV'       d   \        P                  # V'       d   \        P                  # \        P                  # )a  Classify a term from the assignment's relation to its constraint.

``subset`` and ``disjoint`` describe the assignment against
``term.constraint``, as returned by ``RangeProtocol.relation``.

Positive term: satisfied when the assignment is a subset of the
constraint; contradicted when the two are disjoint.
Negative term: the two swap, since a negative term forbids the
constraint's versions.
)r&   r   r;   r<   rE   )r>   rC   rD   	satisfiedcontradicteds   &$$  r   rG   rG      sG      "(<"*<$$$'''###r   N)rG   r   r:   r6   )__doc__
__future__r   collectionsr   typingr   r   typesr   r   r   r   r	   r
   __all__rK   r6   r   r:   rG   r   r   r   <module>r^      sI    #  % : :"&  1h)6 F$r   