
    UHjf                       d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	  ee
      j                         j                  d   Zedz  ZdZd	Zd
Zg dZg dZdddddddddddddddgZd)dZd*dZd+dZd,dZd-dZd.dZd/dZd0dZd1d Zd2d!Z	 	 	 	 	 d3	 	 	 	 	 	 	 	 	 	 	 d4d"Zd5d#Z d6d$Z!d6d%Z"efd7d&Z#d8d'Z$e%d(k(  r e$        yy)9zERank map1_01a geometry exit candidates for the current route blocker.    )annotationsN)Path)Any   outmap1_01amap2_02dmap1_02b)zstrict-source-hotspotztarget-map-control-flowz'strict-or-confirmed-outgoing-transitionz selected-root-or-real-save-proof),strict map1_01a source coordinate or hotspotBruntime/control-flow proof that the selected exit targets map2_02dzdstrict or confirmed outgoing transition for map1_01a -> map2_02d rather than selector-adjacency-onlyz;real selector 2:0 savedata or selected-root execution tracezout/map_exit_candidates.jsonzGgeometry exit candidates, target hints, and reciprocal exit projections)pathdescriptionz!out/map_exit_coordinate_refs.jsonzApacked-coordinate diagnostics for map1_01a -> map2_02d candidateszout/route_assist_frontier.jsonzIrouteAssist trial URLs and source/target spawn probes for candidate exitszdata/transition_reviews.jsonzEconfirmed incoming reviews separated from outgoing proof requirementsz,out/save_selector_scene_adjacency_index.jsonzCselector adjacency rows and strict/confirmed outgoing backing flagsc                p    | j                         s|S t        j                  | j                  d            S )Nutf-8encoding)existsjsonloads	read_text)r   fallbacks     C/home/exedev/hwanse/tools/summarize_map1_01a_exit_target_ranking.py	load_jsonr   5   s*    ;;=::dnngn677    c                .    t        fd| D        i       S )Nc              3  L   K   | ]  }|j                  d       k(  s|  yw)mapNget).0rownames     r   	<genexpr>zmap_exit_row.<locals>.<genexpr><   s      ?$(>?s   $$)next)rowsr"   s    `r   map_exit_rowr&   ;   s    ??DDr   c                ,    | j                  d      xs i S )Nsampler   )	candidates    r   r(   r(   ?   s    =="(b(r   c                |    t        |       }| j                  d      |j                  d      |j                  d      fS )Nsidexy)r(   r   )r)   points     r   candidate_keyr/   C   s2    9E== %))C.%))C.@@r   c                h    | j                  d      xs g D ]  }|j                  d      |k(  s|c S  y )NtargetHintstargetr   )r)   r2   hints      r   	find_hintr4   H   s:    m,2 88H'K r   c                   | D ]  }|j                  d      t        k(  s|j                  d      |k(  s1|j                  d      |k(  sF|j                  d      |k(  s[|j                  d      |k(  sp|j                  d      xs i }|j                  d      |j                  d      |j                  d	      xs i j                  d
      |j                  d      xs i j                  d
      dc S  ddd d dS )Nsourcer2   r+   r,   r-   packedScansstatus
promotablexytotalyx)r8   r9   xyTotalyxTotalznot-scannedF)r   SOURCE)r%   r+   r,   r-   r2   r!   scanss          r   coordinate_statusrA   O   s     GGH'!V+4'!!GGM*0bE''(+!ggl3!IIdO1r66w?!IIdO1r66w?	    	 r   c           	        |sy t        |      }| j                  d      xs g D ]_  }t        |      }|j                  d      |j                  d      k(  s3|j                  d      |j                  d      k(  sW|j                  d      |j                  d      k(  s{t        |t              }|s|j                  d      |j                  d      k(  s|j                  d      |j                  d      k(  s|j                  d      |j                  d      k(  s|j                  d      |j                  d      |j                  d      |j                  d      |j                  d      dk(  |j                  d      dc S  y )	NexitCandidatesr+   r,   r-   edgeDistancer   projectionDelta)r+   r,   r-   rD   autoTriggerreverseProjectionDelta)r(   r   r4   r?   )
target_mapsource_candidatetarget_hintsource_pointr)   target_pointreverse_hints          r   reciprocal_exitrN   g   s\   *+L^^$45; 	i(MM&![__V%<<  %)==  %)==$Y7L $$V,0@0D0DV0LL $$S)\-=-=c-BB $$S)\-=-=c-BB &MM&1%))#.%))#.$-MM.$A#,==#@A#E.:.>.>?P.Q , r   c                   t        d | D        i       }t        |j                  d      xs g       D ]  \  }}|j                  d      xs i }|j                  d      |k(  s0|j                  d      |k(  sE|j                  d      |k(  sZ|dz   |j                  d      |j                  d	      |j                  d
      |j                  d      dc S  y )Nc              3     K   | ]6  }|j                  d       t        k(  r|j                  d      t        k(  r| 8 yw)r6   r2   N)r   r?   BLOCKED_TARGETr    items     r   r#   z)route_assist_candidate.<locals>.<genexpr>   s9      	
xx!V+0Bn0T 	
s   <>candidateExitsr(   r+   r,   r-   r   rF   sourceStandablerouteAssistUrltargetSpawnUrl)orderrF   rU   rV   rW   )r$   	enumerater   )route_assist_rowsr+   r,   r-   r!   indexr)   r.   s           r   route_assist_candidater\      s    
	
.	
 	C &cgg.>&?&E2F 	yh'-2== D(UYYs^q-@UYYs^WXEX(}}];#,==1B#C"+--0@"A"+--0@"A 	 r   c                   g }| j                         D ]  }|j                  d      t        k7  s|j                  d      dk7  r0|j                  |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d	      d
        t	        |d       S )Nr2   state	confirmedr6   r,   r-   spawnXspawnYrecordVaHex)r6   r2   r,   r-   r`   ra   rb   c                ~    | j                  d      xs d| j                  d      xs d| j                  d      xs dfS )Nr6    r,   r-   r   r!   s    r   <lambda>z,confirmed_incoming_reviews.<locals>.<lambda>   s<    ):)@b#''#,BTRTVYV]V]^aVbVhfh(i r   key)valuesr   r?   appendsorted)reviewsr%   reviews      r   confirmed_incoming_reviewsro      s    D.." ::h6)VZZ-@K-Ojj*jj*CCjj*jj*!::m4
 	 $ijjr   c                   g }| j                  d      xs g D ]  }|j                  d      t        k7  r|j                  |j                  d      |j                  d      |j                  d      xs g |j                  d      xs g |j                  d      xs g |j                  d      xs g |j                  d	      d
u |j                  d      d
u |j                  d      d
u |j                  d      d
        t        |d       S )NpairRowsr6   r2   occurrenceCount	selectorsleafPointerssourceRecordstargetRecordsstrictEventBackedTconfirmedReviewBackedselectorAdjacencyOnlyclassification)
r2   rr   rs   rt   ru   rv   rw   rx   ry   rz   c                V    | j                  d      xs d| j                  d      xs dfS )Nr2   rd   rr   r   r   rf   s    r   rg   z(selector_outgoing_rows.<locals>.<lambda>   s)    ):)@b#''J[B\Ba`a(b r   rh   )r   r?   rk   rl   )scene_adjacency_indexr%   r!   s      r   selector_outgoing_rowsr}      s    D$((4: 778&ggh'"ww'89-3GGN39r WW_5; WW_5;!$)<!=!E%(WW-D%E%M%(WW-D%E%M!gg&67
 	 $bccr   c                   | | nt        t        dz  g       } ||nt        t        dz  i       }||nt        t        dz  g       }||nt        t        dz  dz  i       }||nt        t        dz  i       }t        | t              }t        | t
              }|j                  d      xs g }g }|j                  d      xs g D ]  }	t        |	      \  }
}}t        |t              rt        |t              s4g }t        |	j                  d	      xs g       D ]  }t        |	|      }t        | |      }|j                  ||t
        k(  |rs|j                  d
      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      dnd t        ||	|      |t
        k(  rt        ||
|||      nd d        t        ||
||      }|j                  |
|||	j                  d      |	j                  d      dk(  t!        |	      j                  d      t!        |	      j                  d      t!        |	      j                  d      t#        |      |||	j                  d      |	j                  d      d        |D cg c]:  }|j                  d      r't%        d |j                  d      xs g D              r|< }}|D cg c])  }t%        d |j                  d      xs g D              r|+ }}|D cg c])  }t%        d |j                  d      xs g D              r|+ }}|D cg c]6  }|j                  d      xs g D ]  }|j                  d      t
        k(  r| 8 }}}t'        d |D              }t'        d  |D              }t'        d! |D              }t)        |      }t+        |      }|D cg c]  }|j                  d"      s| }}t-        d# |D        i       }t-        d$ |D        i       }t         d%t#        |       d&t#        |       d't
         d(}i d)t        d*t
        d+t.        d,|j                  d-      |j                  d.      d/d	|j                  d	      xs g d0|j                  d0      xs g d1t#        |      d2t#        |      d3t#        |      d4t#        |      d5|d6|d7|d8t#        |      d9|D cg c]  }|j                  d       c}d:t'        d; |D              d<t'        d= |D              i d>t#        |      d?|d@|j                  dAd      dB|j                  dAd      dC|dDt#        |      dE|dFdGdHdGdIt0        dJt2        dKt4        dLt#        t4              dMdNdOg dPdQ|S c c}w c c}w c c}w c c}}w c c}w c c}w )RNmap_exit_candidates.jsonmap_exit_coordinate_refs.jsonroute_assist_frontier.jsondatatransition_reviews.json(save_selector_scene_adjacency_index.jsonr%   rC   selectorTargetCandidatesr+   r,   r-   rF   rD   rE   rank)r+   r,   r-   rF   rD   rE   r   )r2   blockedRouteTarget
targetHintreciprocalExitcoordinateEvidencer   	standablelayer0layer1	reviewUrltrialUrl)r+   r,   r-   rD   rF   r   r   r   targetCounttargetsrouteAssistr   r   c              3  L   K   | ]  }|j                  d       t        k(    ywr2   Nr   rQ   r    r2   s     r   r#   z build_summary.<locals>.<genexpr>	  s     ^6

8$6^   "$r   c              3  L   K   | ]  }|j                  d       t        k(    ywr   r   r   s     r   r#   z build_summary.<locals>.<genexpr>  s     ]&vzz(#~5]r   c              3  L   K   | ]  }|j                  d       t        k(    ywr   r   RETURN_TARGETr   s     r   r#   z build_summary.<locals>.<genexpr>  s     \vzz(#}4\r   r2   c              3  D   K   | ]  }|j                  d       sd  yw)r   r   Nr   r   s     r   r#   z build_summary.<locals>.<genexpr>  s!      *vzz:J/K*     c              3  n   K   | ]-  }|j                  d       xs i j                  d      dk(  rd / yw)r   r8   z*coordinate-like-hit-without-table-text-refr   Nr   r   s     r   r#   z build_summary.<locals>.<genexpr>  s=      /JJ+,277A78 	
/s   35c              3     K   | ]F  }|j                  d       xs g D ],  }|j                  d      xs i j                  d      du rd . H yw)r   r   r9   Tr   Nr   )r    r!   r2   s      r   r#   z build_summary.<locals>.<genexpr>"  s[      &ggi(.B&JJ+,277EM 	
&	&s   AAry   c              3  R   K   | ]  }|j                  d       t        k(  s| ! ywr   r   r    r!   s     r   r#   z build_summary.<locals>.<genexpr>*  s!     eSARVdAdSe   ''c              3  R   K   | ]  }|j                  d       t        k(  s| ! ywr   r   r   s     r   r#   z build_summary.<locals>.<genexpr>+  s!     cC@QUb@bCcr   z has z geometry exits and z auto edge candidates for a  . Reciprocal target hints make the top and bottom exits useful routeAssist tests, but every candidate remains geometry-only: coordinate scans do not provide a promotable strict source hotspot, and the confirmed incoming map1_02b event only proves entry into map1_01a, not an outgoing map1_01a -> map2_02d transition. The scene-list outgoing candidates from map1_01a are also selector-adjacency-only, so there is no alternate strict or confirmed outgoing transition to promote.r6   blockedTargetreturnTargetsourceMapSizewidthheight)r   r   blockedTargetCandidates	exitCountblockedTargetExitCountautoBlockedTargetExitCount#blockedTargetReturnOverlapExitCount blockedTargetReciprocalExitCount#blockedTargetCoordinateLikeHitCountcoordinatePromotableCountselectorOutgoingCandidateCountselectorOutgoingTargets!selectorOutgoingStrictBackedCountc              3  D   K   | ]  }|j                  d       sd  yw)rw   r   Nr   r   s     r   r#   z build_summary.<locals>.<genexpr>G  s     0psSVSZSZ[nSo0pr   $selectorOutgoingConfirmedBackedCountc              3  D   K   | ]  }|j                  d       sd  yw)rx   r   Nr   r   s     r   r#   z build_summary.<locals>.<genexpr>H  s!      4
cgg6M.NA4
r   selectorOutgoingOnlyCountselectorOutgoingCandidates$blockedTargetSelectorOccurrenceCountrr   #returnTargetSelectorOccurrenceCountconfirmedIncomingReviewsconfirmedIncomingCountexits
proofFoundFexitTargetRankingProofFoundfailedExitTargetRankingGateIdsmissingEvidenceevidenceRefsevidenceRefCountpromotionStatusblockedremainingProofs)r   r   z6real selector 2:0 savedata or equivalent runtime trace
conclusion)r   OUTROOTr&   r?   rQ   r   r/   
isinstanceintrl   r4   rk   rN   rA   r\   r(   lenanysumro   r}   r$   r   #FAILED_EXIT_TARGET_RANKING_GATE_IDS$EXIT_TARGET_RANKING_MISSING_EVIDENCE!EXIT_TARGET_RANKING_EVIDENCE_REFS) map_exit_candidatesmap_exit_coordinate_refsroute_assist_frontiertransition_reviewsr|   
source_maprH   
coord_rowsr   r)   r+   r,   r-   r   r2   r3   
target_rowassistr!   auto_blockedblocked_target_exitsreturn_overlap_exitsblocked_target_rowsblocked_target_reciprocal_count$blocked_target_coordinate_like_countcoordinate_promotable_countincomingselector_outgoingselector_only_outgoingblocked_selectorreturn_selectorr   s                                    r   build_summaryr      sG    2E1P-V_((
W <T;_7en--
f 6K5V1\e**
] 0B/M+S\v11
T 6K5V1\e88
] 16:J1>BJ)--f5;JE^^$45; (	"9-
a!S!As);Y]]+EFL"M 	FY/D%&96BJNN &,&>  !HHV,###'88M#:$(HH^$<'+xx0A'B HHV,  $"1*i"N^+ '8
D!QPV&W 	( ((=tQJ%MM.9$==8A=	*..{;Y'++H5Y'++H5w<!"{3!j1
 	5(T 77=!^SWWYEWE][]^^ 	L  ]CGGIDVD\Z\]] 	 
 ,\3779CUC[Y[\\ 	  (ggi(.B ::h>1 	  '* *+* '# ,/ /)/ ,( #& && #
 **<=H./DE->cc#''JaBbccce,=egijc+<ceghO(%E
|#7L8I7JJd
 p	p +&++ 	+ 	^^G, nnX.
	+ 	#JNN3M$N$TRT+ 	":>>2K#L#RPR+ 	SZ+ 	!#&:";+ 	%c,&7+ 	.s3G/H+ 	+,K+ 	./S+  	$%@!+" 	)#.?*@#+$ 	"AR#S#CGGH$5#S%+& 	,S0p>O0p-p'+( 	/ 4
*4
 1
)+. 	$S)?%@/+0 	%&71+2 	/0@0D0DEVXY0Z3+4 	./B/BCTVW/X5+6 	#H7+8 	!#h-9+: 	;+< 	e=+> 	&u?+@ 	)*MA+B 	?C+D 	9E+F 	C ABG+H 	9I+J 	 
K+T 	jU+ +]
, d: $Ts*   .?W3.W'.W;W*WWW c                   | j                  d      xs i }| j                  d      xs i }| j                  d      xs i }|r[|j                  d       d|j                  d       d|j                  d       d	|j                  d
       d|j                  d       	nd}|rI|j                  d       d|j                  d       d|j                  d       d|j                  d       nd}|r7|j                  d       d|j                  d       d|j                  d       nd}| j                  d       d| d| d| S )Nr   r   r   r+    r,   ,r-    auto=rF   z proj=rE   -z reverseProj=rG   r8   z xy=r=   z yx=r>   r2   z hint z; reciprocal z; coord r   )r2   r3   
reciprocalcoord	hint_textreciprocal_text
coord_texts          r   target_textr   b  sn   ::l#)rD,-3JJJ+,2E  88F
Adhhsm_Adhhsm_ ='(txx8I/J.K	M 	   >>&!
"!JNN3$7#8*..:M9N O!~~&>?@	B 	   99X
tEIIi$8#9eii	>R=ST 
 jj"#6)M/ARRZ[eZfggr   c                   ddd| d    d| d   j                  d       d| d   j                  d	       d
| d    dddj                  d | d   D               d| d    d| d    d| d    d| d    d	d| d    d| d    d| d    d | d!    d"	d#| d$    d%| d&    d'| d(    d)| d*    d+| d,    dd-| d.    dd/| d0    d| d1   dd2dg}|j                  d3 | d4   D               |j                  g d5       |j                  d6 | d7   D               |j                  g d8       |j                  d9 | d:   D               |j                  g d;       | d<   D ]b  }|j                  d=|d    d>|d    d?|d@    dA|dB    dC|j                  dD       d?|j                  dE       dF|j                  dG       d       d | d<   s|j                  dH       |j                  g dI       | dJ   D ]  }d?j                  |j                  dK      xs g       dLz   d?j                  |j                  dM      xs g       z   }|j                  dN|j                  dB       dO|j                  dP       dQdj                  dR |j                  dS      xs g D              xs dT dQ| dQ|j                  dU       dQ|j                  dV       dQ|j                  dW       dX        | dJ   s|j                  dY       |j                  g dZ       | d[   D ]  }|j                  d\      xs i }|r8d]|j                  d^       d_|j                  d`       da|j                  db       ndT}dcj                  dd |j                  de      xs g D              }|j                  df|dg    dh|d    d?|d@    di|j                  dj       dk|j                  dl       dQ|d`    dQ| dQ| dm|j                  dn       do        |j                  g dp       |j                  dq | dr   D               |j                  d       dsj                  |      S )tNz# map1_01a Exit Target Rankingrd   z- source: `r6   z` size r   r   r,   r   z- blocked target: `r   `z- selector targets: , c              3  (   K   | ]
  }d | d   ywr   N r   s     r   r#   zmarkdown.<locals>.<genexpr>  s     (i61VHA(i   r   z - selector outgoing candidates: r   z (selector-only r   z, strict-backed r   z, confirmed-backed r   )z- exit candidates: r   z (r   z mention blocked target, r   z auto for blocked target, r   z also mention return target)z2- blocked-target reciprocal/coordinate-like hits: r   z / r   z- coordinate-promotable exits: r   z- confirmed incoming reviews: r   z- proof found: `r   z$- exit target ranking proof found: `r   z- promotion status: r   r   z## Failed Gatesc              3  (   K   | ]
  }d | d  yw)- `r   Nr   rR   s     r   r#   zmarkdown.<locals>.<genexpr>  s     U43tfAUr   r   )rd   z## Missing Evidencerd   c              3  &   K   | ]	  }d |   ywz- Nr   rR   s     r   r#   zmarkdown.<locals>.<genexpr>       D2dVD   r   )rd   z## Evidence Refsrd   c              3  8   K   | ]  }d |d    d|d      yw)r   r   z`: r   Nr   r   s     r   r#   zmarkdown.<locals>.<genexpr>  s/       c&k]#c-012s   r   )rd   z## Confirmed Incoming Contextrd   r   r   z` `r   r-   z` -> `r2   z	` spawn `r`   ra   z
` record `rb   z- none)rd   z## Selector Outgoing Candidatesrd   zK| target | occurrences | selectors | records | strict | confirmed | class |z,| --- | ---: | --- | --- | --- | --- | --- |r   ru    -> rv   z| `z` | rr   z | c              3  (   K   | ]
  }d | d   ywr   r   )r    values     r   r#   zmarkdown.<locals>.<genexpr>  s     N%1UG1Nr   rs   r   rw   rx   rz   z |z| - | 0 | - | - | - | - | - |)rd   z## Exit Candidatesrd   z2| side | tile | auto | assist | targets | review |z%| --- | --- | --- | --- | --- | --- |r   r   order rX   r   rF    standable=rU   <br>c              3  2   K   | ]  }t        |        y wN)r   r   s     r   r#   zmarkdown.<locals>.<genexpr>  s     Yfk&1Ys   r   z| r+   z | `z` l0=r    l1=r   z
 | [open](r   z) |)rd   z## Remaining Proofsrd   c              3  &   K   | ]	  }d |   ywr   r   rR   s     r   r#   zmarkdown.<locals>.<genexpr>  r   r   r   
)r   joinextendrk   )summarylinesr!   recordsr   assist_textr   s          r   markdownr  z  sT   (

gh'(0H0L0LW0U/VVWX_`oXpXtXtu}X~W  	A
go67q9
tyy(iWMgEh(iijk
*73S+T*U V!"=>??OPWX{P|O} ~#$JKLA	O gk232g>V6W5XXq/0
11K89
::V	X =WEg=h<iil89
:	<
)'2M*N)OP
(1I)J(KL
7<013
.w7T/U.VVWX
w'89:;


/E2 
LLU73S+TUU	LL  
 
LLD1B)CDD	LL  
 
LL >*  
LL  
 12 
#h-CH:Qs3xjs8}o Nggh'(#''(*;)<Jsww}G]F^^_a	


 -.X	LL   34 
((377?39r:VCchhswwWfOgOmkmFnn#''(#$D1B)C(DCyyN377;3G3M2NNURUVVYis377#678CGGD[<\;]]`ww'()-	

 /045	LL   w 
'-2  VZZ()

=0I/J+V\V`V`arVsUtu 	
 ++Y	@R@XVXYYVT#c(1SXJeCGGH<M;NdSVSZSZ[cSdReeh=!"#k]#gYjQ\I]H^^ac	

 
LL01	LLD1B)CDD	LL99Ur   c                   g }| d   D ]+  }|j                  d      xs i }|r8d|j                  d       d|j                  d       d|j                  d       nd	}d
j                  d |j                  d      xs g D              }|j                  dt        j                  t        |d                d|d    d|d    d|j                  d       d|j                  d       d|d    dt        j                  |       d| dt        j                  |j                  d      xs d       d       . dj                  d | d   D              xs d}g }| d    D ]G  }dj                  |j                  d!      xs g       d"z   dj                  |j                  d#      xs g       z   }d$j                  |j                  d%      xs g       xs d	}	|j                  d&t        j                  t        |j                  d'                   d(|j                  d)       dt        j                  |	       d*t        j                  |       d(|j                  d+       d|j                  d,       dt        j                  t        |j                  d-                   d.       J dj                  d/ | d0   D              }
dj                  d1 | d2   D              }dj                  d3 | d4   D              }dj                  d5 | d6   D              }d7j                  d8d9d:d;| d<    d=| d>    d?| d@    dA| dB    dC| dD    dE| dF    dG| dH    dI| dJ    dK| dL    dM| dN    dO| dP    dQ| dR    dSdTt        j                  | dU          dVdWdX| dYdZdX| dYd[dX| dYd\dX| dYd]d^d7j                  |      xs d_d`dadbd7j                  |      d`dcdX|
 dYg      S )dNr   r   r  rX   r   rF   r  rU   r   r  c              3  X   K   | ]"  }t        j                  t        |             $ y wr  )htmlescaper   r   s     r   r#   zhtml_page.<locals>.<genexpr>  s     f6dkk+f*=>fs   (*r   z<tr><td>r+   z</td><td><code>r,   r   r-   z</code><br>l0=r   r	  r   z	</td><td>z</td><td><a href="r   #z">open</a></td></tr>rd   c              3  f  K   | ]  }d t        j                  t        |d                d|d    d|d    dt        j                  t        |d                d|j                  d	       d|j                  d
       dt        j                  t        |j                  d                   d  yw)
<li><code>r6   z</code> <code>r,   r   r-   z</code> -> <code>r2   z</code> spawn <code>r`   ra   z</code> record <code>rb   </code></li>N)r  r  strr   r   s     r   r#   zhtml_page.<locals>.<genexpr>  s        T[[S]!345 6S
!CH:%6t{{3s8}CU7V6W Xwwx()3778+<*==RSWS^S^_bcfcjcjkxcy_zS{R|  }I	Js   B/B1r   z<li>none</li>r   ru   r  rv   r   rs   z<tr><td><code>r2   z</code></td><td>rr   z</code></td><td><code>rw   rx   rz   z
</td></tr>c              3  N   K   | ]  }d t        j                  |       d  ywz<li></li>Nr  r  rR   s     r   r#   zhtml_page.<locals>.<genexpr>  s#     \tDKK-.e4\   #%r   c              3  N   K   | ]  }d t        j                  |       d  yw)r  r  Nr  rR   s     r   r#   zhtml_page.<locals>.<genexpr>  s+       T[[&'|4r   r   c              3  N   K   | ]  }d t        j                  |       d  ywr  r  rR   s     r   r#   zhtml_page.<locals>.<genexpr>  s+       t{{4 !'r   r   c              3     K   | ]9  }d t        j                  |d          dt        j                  |d          d ; yw)r  r   z	</code>: r   r  Nr  r   s     r   r#   zhtml_page.<locals>.<genexpr>  sE       T[[V-.iCDV8W7XX]^s   ?Ar   r  zP<!doctype html><meta charset="utf-8"><title>map1_01a Exit Target Ranking</title>z<style>body{font-family:system-ui,sans-serif;background:#111;color:#eee;max-width:1200px;margin:24px auto}table{border-collapse:collapse;width:100%}td,th{border:1px solid #444;padding:6px 8px;vertical-align:top}code{color:#9bd4ff}a{color:#9bd4ff}</style>z%<h1>map1_01a Exit Target Ranking</h1>z<p>blocked target <code>r   z</code>; exits r   z; blocked-target exits r   z ; auto exits for blocked target r   z1; blocked-target exits also naming return target r   z"; reciprocal blocked-target hints r   z&; coordinate-like blocked-target hits r   z; coordinate-promotable exits r   z; selector outgoing candidates r   z / selector-only r   z; proof found <code>r   z </code>; promotion status <code>r   z</code>.</p>z<p>r   z</p>z<h2>Failed Gates</h2>z<ul>z</ul>z<h2>Missing Evidence</h2>z<h2>Evidence Refs</h2>z#<h2>Confirmed Incoming Context</h2>z%<h2>Selector Outgoing Candidates</h2>z<table><thead><tr><th>target</th><th>occurrences</th><th>selectors</th><th>records</th><th>strict</th><th>confirmed</th><th>class</th></tr></thead><tbody>z><tr><td colspan="7">No selector outgoing candidates.</td></tr>z</tbody></table>z<h2>Exit Candidates</h2>z{<table><thead><tr><th>side</th><th>tile</th><th>auto</th><th>assist</th><th>targets</th><th>review</th></tr></thead><tbody>z<h2>Remaining Proofs</h2>)r   r  rk   r  r  r  )r  r%   r!   r   r  r   r   selector_rowsr  rs   proofsfailed_gatesmissing_evidenceevidence_refss                 r   	html_pager)    s   Dw 
'-2  VZZ()

=0I/J+V\V`V`arVsUtu 	
 ++fSWWU^M_Meceff;;s3v;/01 2S
!CH:^CGGH<M;NdSVSZSZ[cSdRe f}%& ';;{+, -) ![[)=)DEF G		

$ ww  56	  
 
  M34 
((377?39r:VCchhswwWfOgOmkmFnnIIcggk28b9@S	S):%;<= >77,-. /Y/0 1W-. /77./0 177234 5;;s377+;#<=>? @
	

 WW\IZA[\\F77 <= L ww -.  GG >* M 99\ 	I/
"7?#;"<OGT_L`Kaax  zA  BZ  z[  y\  \|  }D  Ea  }b  |c  cT  U\  ]B  UC  TD  Df  gn  oQ  gR  fS  Sy  zA  Bg  zh  yi  iG  HO  Pk  Hl  Gm  mL	  M	T	  U	u	  M	v	  L	w	  w	H
  I
P
  Q
l
  I
m
  H
n
  n
B  CJ  KW  CX  BY  Yy  zA  BS  zT  yU  Ua  	b
dkk',/016
|nE"#
 & 
}oU#-
xj/ 	e		- d$d" 	F		$#
vhe/  r   c                    |j                  dd       |dz  j                  t        j                  | dd      dz   d	       y )
NT)parentsexist_ok!map1_01a_exit_target_ranking.jsonF   )ensure_asciiindentr  r   r   )mkdir
write_textr   dumps)r  out_dirs     r   write_outputsr5  +  sC    MM$M.22>>

7q9D@ ? r   c            
        t        j                  t              } | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  d	t        t        d
z  dz         | j                  dt        t
        dz         | j                  dt        t
               | j                         }t        t        |j                  g       t        |j                  i       t        |j                  g       t        |j                  i       t        |j                  i             }t        ||j                          t#        d|j                   dz          y )N)r   z--map-exitsr   )typedefaultz--coordinate-refsr   z--route-assistr   z--transition-reviewsr   r   z--scene-adjacencyr   z	--out-dirz&wrote map1_01a exit target ranking -> r-  )argparseArgumentParser__doc__add_argumentr   r   r   
parse_argsr   r   	map_exitscoordinate_refsroute_assistr   scene_adjacencyr5  r4  print)parserargsr  s      r   mainrE  3  sG   $$9F
D#@Z:Z[
+$Fe@ef
(tSC_=_`
.T4&=SlClm
+$Fp@pq
$<D$.."%$&&+$##R($))2.$&&+G '4<<(	24<<Be3e2f
ghr   __main__)r   r   r   r   returnr   )r%   
list[dict]r"   r  rG  dict)r)   rI  rG  rI  )r)   rI  rG  z)tuple[str | None, int | None, int | None])r)   rI  r2   r  rG  dict | None)r%   rH  r+   r  r,   r   r-   r   r2   r  rG  rI  )rH   rI  rI   rI  rJ   rJ  rG  rJ  )
rZ   rH  r+   r  r,   r   r-   r   rG  rJ  )rm   rI  rG  rH  )r|   rI  rG  rH  )NNNNN)r   list[dict] | Noner   rJ  r   rK  r   rJ  r|   rJ  rG  rI  )r2   rI  rG  r  )r  rI  rG  r  )r  rI  r4  r   rG  None)rG  rL  )&r;  
__future__r   r9  r  r   pathlibr   typingr   __file__resolver+  r   r   r?   rQ   r   r   r   r   r   r&   r(   r/   r4   rA   rN   r\   ro   r}   r   r   r  r)  r5  rE  __name__r   r   r   <module>rS     sn   K "      H~''*
Ul	' #( $ /`
 4Z
 1b
 /^
 ?\#% !08E)A
0:*k"d* .2,0/3&*)-a*a)a -a $	a
 'a 
aHh0]@Nb 25 i( zF r   