+
    2j`B                      a  0 t $ R t^ RIHt ^ RIHtHtHt ^RIH	t	 ^RI
HtHtHtHt ]'       d2   ^ RIHtHt ^RI
Ht ]]].]3,          tR]R&   ]].]3,          tR]R	&   . R+OtR
]3R R llt^t]! ]P                  ]P6                  04      tR
]3R R lltR R ltR R ltR R lt R R lt!R R lt"R R lt#]3R R llt$]3R R llt%R R  lt&R! R" lt']3R# R$ llt(]3R% R& llt)R' R( lt*R) R* lt+R
# ),a5  Error reporting and term combinators.

Mirrors pubgrub-rs's ``report.rs`` / dart pub's ``failure.dart``: the
message-building walk and the prior-cause / term-union combinators sit
alongside the public ``ResolutionError``.

Reference: https://github.com/dart-lang/pub/blob/master/doc/solver.md#error-reporting
)annotations)TYPE_CHECKINGAny	TypeAlias)ROOT)IncompatibilityCausePackageTypeTermVersionType)CallableSequence)Incompatibilityr   	_NarrowFn	_FormatFnNc               (    V ^8  d   QhRRRRRRRR/# )	   root_incompatibilityIncompatibility[Any, Any]narrow_NarrowFn | Noneformat_ranger   returnstr )formats   "^/home/user/billing-ledger-validation/.venv/lib/python3.14/site-packages/nab_resolver/report.py__annotate__r   "   s6     B B3BB B 		B    c                f    . p\        W\        4       W4       V'       d   RP                  V4      # R# )a  Format a human-readable error from an incompatibility derivation tree.

Where narrowing leaves a line ruling out versions its causes no longer
account for, the range it dropped is stated once for that package, as the
resolver states it when it looks for a version in a range and finds none.

``narrow`` maps ``(package, constraint)`` to a display constraint and is
applied to originally-positive terms only; a negative dependency-side
term renders as requested even when displayed negated.  On a
``NO_VERSIONS`` line a narrowing to the full range is ignored, since the
range is what keeps the sentence true.  Narrowing happens at render time
only, never mutating the derivation tree.

``format_range`` renders a constraint for display and defaults to ``str``,
which reads well for the resolver's own ``Range``.  A range type whose
``str`` is a debug repr passes its own.  Rendering a constraint as the
empty string drops it from the line along with its separating space.

zResolution impossible)explain_incompatibilitysetjoin)r   r   r   liness   &&& r   format_errorr$   "   s/    . E0U$499UA*AAr   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r   incompatibilityr   r#   z	list[str]visited_idszset[int]r   r   r   r   r   Noner   )r   s   "r   r   r   I   sD     )7 )7.)7)7 )7 	)7
 )7 
)7r   c                   V R3.pVf   / / 3M
\        W4      w  rgV'       Edg   VP                  4       w  rV	'       d   VP                  \        V4      R4       FK  p
VP                  V
R4      pVf   K  \	        \        V
4      V! V4      4      pVP                  RV R24       KM  	  VP                  \        WV4      4       K  \        V4      V9   d   K  VP                  \        V4      4       VP                  VR34       VP                  \        P                  8X  g   EK  VP                  '       d   VP                  VP                  R34       VP                  '       g   EKO  VP                  VP                  R34       EKo  R# )zWalk the cause tree appending one explanatory line per node.

The walk is iterative: the tree gains a level per conflict, so a deeply
backtracked resolve overflows the recursion limit.
FNzbecause no versions of  are availableTr   )_unstated_rangespopgetid_with_ranger   append_render_lineaddcauser   DERIVEDcause_right
cause_left)r&   r#   r'   r   r   stackneededunstatednodeexpandedpackagegapsubjects   &&&&&        r   r    r    I   s@    =LU;S:TE NR(8(Q F %!::bh3ll7D1?)#g,S8IJGLL#:7)>!RS	 4
 LLdLABd8{"4!dD\" ::-555d..67doou56- r   c               $    V ^8  d   QhRRRRRR/# )r   termTerm[Any, Any]r   r   r   r   )r   s   "r   r   r   u   s&     T T> T9 T Tr   c                    V P                  4       '       g   V # \        V P                  V! V P                  V P                  4      RR7      # )zDReturn ``term`` with a narrowed constraint when originally positive.Tpositive)is_positiver	   r<   
constraint)r@   r   s   &&r   _narrow_positiverG   u   s8    fT\\4??CdSSr   c               $    V ^8  d   QhRRRRRR/# )r   r&   r   r   r   r   zdict[Any, Term[Any, Any]]r   )r   s   "r   r   r   |   s$      .8Ar   c                    V P                   \        P                  J d'   V P                   Uu/ uF  q"P                  VbK  	  up# V P                   Uu/ uF  q"P                  \        W!4      bK  	  up# u upi u upi )zReturn the terms of ``incompatibility`` as its line renders them.

The comparison runs on exactly what the reader sees, so a requirement is
read as printed, un-narrowed, the way the line states it.
)r3   r   NO_VERSIONStermsr<   rG   )r&   r   r@   s   && r   _shown_termsrL   |   sx      4 @ @@/>/D/DE/Dtd"/DEEAPAVAVAV&t44AV  Fs   A4A9c                    V ^8  d   QhRRRR/# )r   r@   Term[Any, Any] | Noner   r   r   )r   s   "r   r   r      s     G G+ G Gr   c                l    V f   R# V P                  4       '       d   V P                  # V P                  ( # )zFReturn the versions that satisfy ``term``, or None for no restriction.N)rE   rF   r@   s   &r   _satisfyingrQ      s.    |"..004??Ft6FFr   c               (    V ^8  d   QhRRRRRRRR/# )r   
conclusionrN   leftrightr   r   r   )r   s   "r   r   r      s0     < <%<
< !< 		<r   c                    Vf   TMVf   TM
\        W4      p\        V4      p\        V 4      pVf   R# Vf   V( # WT,
          # )a  Return what a step rules out for one package that its causes do not.

A step rules out the union of what its causes rule out.  Absent from one
cause the package carries the other's term; absent from the step it was
resolved away, which needs the causes to leave nothing.
N)union_termsrQ   )rS   rT   rU   jointcoveredstateds   &&&   r   
_shortfallr[      sO     DL5k$>V 
 % G$F~G8;6+;;r   c               $    V ^8  d   QhRRRRRR/# )r   rootr   r   r   r   z+tuple[dict[int, list[Any]], dict[Any, Any]]r   )r   s   "r   r   r      s$      
#-60r   c                   / p/ p\        4       pV .pV'       d   VP                  4       p\        V4      V9   d   K*  VP                  \        V4      4       \	        Wa4       FP  w  rxVP                  \        V4      . 4      P                  V4       VP                  V4      p	V	f   TMW,          W7&   KR  	  VP                  e   VP                  VP                  4       VP                  f   K  VP                  VP                  4       K  W#3# )al  Return which line needs a package's listing stated, and what to state.

The first mapping is node id to packages, the second is package to the whole
range to state for it.  A derivation can reach past its causes at more than
one line over gaps of one listing, so the ranges are unioned per package and
the caller states each once, at the first line that needs it.
)
r!   r,   r.   r2   _narrowed_away
setdefaultr0   r-   r6   r5   )
r]   r   r8   r9   seen_idsr7   r:   r<   r=   previouss
   &&        r   r+   r+      s     $&F!HH.2VE
yy{d8xRX*48LGbh+227;||G,H'/'7X^H 9
 ??&LL)'LL))*r   c               $    V ^8  d   QhRRRRRR/# )r   r&   r   r   r   r   zlist[tuple[Any, Any]]r   )r   s   "r   r   r      s$     ( (.(8A((r   c                R   V P                   pV P                  pV P                  \        P                  Jg	   Ve   Vf   . # VP
                   Uu/ uF  qDP                  VbK  	  ppVP
                   Uu/ uF  qDP                  VbK  	  ppV P
                   Uu/ uF  qDP                  VbK  	  pp\        W!4      p\        W14      p	\        W4      p
. p/ VCVC F  p\        VP                  V4      VP                  V4      VP                  V4      4      pVe   VP                  '       g   KU  \        V
P                  V4      VP                  V4      V	P                  V4      4      pVf   K  VP                  '       d   K  VP                  W34       K  	  V# u upi u upi u upi )a  Return the packages and ranges narrowing drops from a line's support.

Narrowing a widened term back onto the listed versions drops the versions the
widening added, so a line can rule out, or resolve a requirement over, a range
its causes no longer account for.  Only a shortfall the un-narrowed terms do
not have is reported, so what is stated is what narrowing dropped: a range
holding no listed version, since narrowing keeps which listed versions a
constraint contains.
)r6   r5   r3   r   r4   rK   r<   rL   r[   r-   is_emptyr0   )r&   r   rT   rU   r@   raw_left	raw_rightraw_node
shown_leftshown_right
shown_nodefoundr<   raw_gapr=   s   &&             r   r_   r_      ss    %%D''E%9%A%AA<=	/3zz:ztd"zH:05<t#I</>/D/DE/Dtd"/DHEd+Ju-Ko6J#%E,h,),LL!8<<#8)--:P
 w'7'7'7NN7#Z^^G%<koog>V
 ?3<<<LL'( - L' ;<Es   F4FF$c               (    V ^8  d   QhRRRRRRRR/# )	r   r&   r   r   r   r   r   r   r   r   )r   s   "r   r   r      s0     ,; ,;.,;,; ,; 		,;r   c           	     |   V P                   pV P                  pVe/   V\        P                  Jd   V Uu. uF  p\	        WQ4      NK  	  ppV\        P
                  J d   \        V4      \        8X  d   Vw  rg\        V4      pVP                  4       '       d*   V'       d   RMRp	R\        Wb4       RV	 R\        Wr4       2# V'       d   RMRp	\        VP                  4       V4      p
R\        Wb4       RV	 RV
 2# V\        P                  J dQ   \        V4      \        8X  d=   Vw  rVP                  4       '       d   TMVP                  4       p\        W4      p
RV
 2# V\        P                  J d;   Vw  pV! V P                  4      p\!        \#        VP$                  4      V4      pR	V 2# \'        W4V4      # u upi )
z8Render a single incompatibility as one explanation line.areiszbecause  z incompatible with z	depend onz
depends onz because your project depends on zbecause the user constrained )r3   rK   r   rJ   rG   
DEPENDENCYlen_ATTRIBUTION_CLAUSE_TERMS_is_fullrE   format_term_format_requirementnegater   
CONSTRAINTconstraint_ranger/   r   r<   _render_prefix_line)r&   r   r   r3   rK   r@   parentdeppluralverbrequirement_positive_depshownr>   s   &&&            r   r1   r1      s    !!E!!E e+?+K+KK<ABED!$/EB 	%000J33&! ??"5D;v<=Qtf E%%0%C$DF %{,)#**,E+f;<AdV1[MRR$)))c%j<U.U!oo//sSZZ\),E1+??$///_==>c$,,/7.wi88u\::C Cs   F9c               (    V ^8  d   QhRRRRRRRR/# )	r   r3   r   rK   zSequence[Term[Any, Any]]r   r   r   r   r   )r   s   "r   r   r   #  s0      #  		r   c                  aa V Uu. uF  q3P                   \        Jg   K  VNK  	  ppV'       g   R# \        P                  R\        P                  R\        P                  R\        P
                  R/P                  V R4      pV \        9   d   \        M\        oRP                  VV3R lV 4       4      pV \        P                  J d	   V R	V R
2# V R	V 2# u upi )zDRender a clause that has no attribution form as a prefix and a body.z2so your project's requirements cannot be satisfiedzbecause root requiresbecausezbecause no versions ofso z and c              3  6   <"   T F  pS! VS4      x  K  	  R # 5i)Nr   ).0r@   r   renders   & r   	<genexpr>&_render_prefix_line.<locals>.<genexpr>6  s     Fvtt\22vs   rr   r*   )r<   r   r   rs   rJ   r4   r-   _REQUIREMENT_PREFIX_CAUSESrx   rw   r"   )r3   rK   r   r@   rZ   prefixbodyr   s   &&f    @r   r|   r|   #  s      %AutD(@dduFAC 	!!#:''((*B$$d	
 
c%n  %*-G$G [F<<FvFFD$0004&//XQtf Bs
   CCc                    V ^8  d   QhRRRR/# )r   r@   rA   r   boolr   )r   s   "r   r   r   =  s     > >> >d >r   c                `    V P                  4       ;'       d    V P                  ( P                  # )zJReturn whether ``term`` is positive over a range with an empty complement.)rE   rF   re   rP   s   &r   rv   rv   =  s&    ==DOO#3"="==r   c               $    V ^8  d   QhRRRRRR/# )r   r>   r   r   r   r   )r   s   "r   r   r   B  s!     6 6 6S 6S 6r   c                $    V'       d   V  RV 2# T # )zJoin a subject to its rendered range, omitting an empty one.

An unconstrained range renders as the empty string, and a bare space
before nothing would trail the line.
rr   r   )r>   r   s   &&r   r/   r/   B  s     $)gYaw5g5r   c               $    V ^8  d   QhRRRRRR/# r   r@   rA   r   r   r   r   r   )r   s   "r   r   r   K  s"     + +n +I +PS +r   c                d    \        V 4      '       d   \        V P                  4      # \        W4      # )zaRender a term in object position ("depends on b").

A full term there is the package name alone.
)rv   r   r<   rw   )r@   r   s   &&r   rx   rx   K  s'    
 ~~4<<  t**r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r   U  s&     	O 	On 	OI 	O 	Or   c                    \        V 4      '       d   RV P                   2# V P                  4       '       d   RMRp\        V V P                   2V! V P                  4      4      # )zRender a single term as ``[not ]package range``.

A full term reads as "all versions of package"; :func:`_format_requirement`
renders the object form.
zall versions of r   znot )rv   r<   rE   r/   rF   )r@   r   signs   && r   rw   rw   U  sV     ~~!$,,00!!##2D$~.T__0MNNr   c               (    V ^8  d   QhRRRRRRRR/# )r   r&   z)Incompatibility[PackageType, VersionType]satisfier_causeshared_packager   r   z$list[Term[PackageType, VersionType]]r   )r   s   "r   r   r   a  s0     4 4>4>4  4 *	4r   c                   V P                    Uu/ uF  q3P                  VbK  	  ppVP                    Uu/ uF  q3P                  VbK  	  pp. pVP                  VR4      pVP                  VR4      pVe&   Ve"   \        Wx4      p	V	e   VP	                  V	4       M+Ve   VP	                  V4       MVe   VP	                  V4       / VCVCp
V
 F  pVP                  V4      pVP                  V4      pVe/   Ve+   VP                  V4      pVf   Q hVP	                  V4       KW  Ve   VP	                  V4       Kn  Vf   Q hVP	                  V4       K  	  V# u upi u upi )a<  Compute the prior cause by resolving two incompatibilities.

Follows pubgrub-rs's prior_cause: for the shared package, union
the terms (and drop if the union is a tautology). For other shared
packages, intersect the terms. For packages in only one side,
keep as-is.

Reference: https://github.com/pubgrub-rs/pubgrub
N)rK   r<   r,   rW   r0   r-   	intersect)r&   r   r   r@   incompat_termscause_termsresultincompat_sharedcause_sharedunionedall_packagesr<   incompat_term
cause_termintersecteds   &&&            r   prior_causer   a  s    (7'<'<I'<td'<  I (7'<'<F'<td'<  F 46F %((>O??>48L"|'?o<MM'"		$o&		!l#
 5n44L&**73 __W-
$)?'11*=K***MM+&&MM-()))MM*%   MMIFs
   EEc               $    V ^8  d   QhRRRRRR/# )r   firstzTerm[PackageType, VersionType]secondr   z%Term[PackageType, VersionType] | Noner   )r   s   "r   r   r     s$     : :):3Q:*:r   c                   V P                  4       '       dL   VP                  4       '       d6   V P                  VP                  ,          p\        V P                  VRR7      # V P                  4       '       g`   VP                  4       '       gJ   V P                  VP                  ,          pVP                  '       d   R# \        V P                  VRR7      # V P                  4       '       d   T MTpV P                  4       '       d   TMT pVP                  VP                  ,
          pVP                  '       d   R# \        V P                  VRR7      # )a/  Union two terms for the same package.

Returns None when the union is a tautology (the term can be dropped
from the resolvent).  Only a negative result can be one: a positive
term, even over the full range, still requires the package to be
selected, so solutions that omit the package don't satisfy it.
TrC   NF)rE   rF   r	   r<   re   )r   r   mergedpositive_termnegative_term	remainders   &&    r   rW   rW     s    v1133!!F$5$55EMM6D99 v'9'9';';!!F$5$55???EMM6E:: #..00EfM#//11FuM((=+C+CCIy599r   )r    r$   rw   r   rW   ),__conditional_annotations____doc__
__future__r   typingr   r   r   r]   r   typesr   r   r	   r
   collections.abcr   r   r   r   __annotations__r   r   __all__r$   ru   	frozensetrJ   r   r    rG   rL   rQ   r[   r+   r_   r1   r|   rv   r/   rx   rw   r   rW   )r   s   @r   <module>r      s   # 0 0  G G2&#S#JO4Iy4#SE3J/Iy/  $!B<   ' 4 @ @A   $!)7XTG<*D(\ ",;d "4>
6 IL + AD 	O4n:r   