+
    i:                     6    ^ RI t ] P                  t^ RIHtHtH	t	 ^ RI
HtHt ]]]3,          t]]]3,          t]],          t]],          t]	]R3,          t]],          t]],          t^t] P*                  ] P,                  ! ] P.                  ] P.                  ] P0                  ] P0                  ] P0                  ] P0                  ] P0                  ] P0                  ] P0                  R7	      R R l4       4       tR R	 ltR
 R lt] P*                  ] P8                  ] P,                  ! ] P.                  ] P.                  ] P0                  ] P0                  ] P0                  ] P0                  R7      ] P:                  ! ]4      R R l4       4       4       4       t] P,                  ! ] P0                  ] P0                  ] P0                  ] P0                  ] P0                  ] P0                  ] P.                  ]R7      RR R ll4       t ] P,                  ! ] P.                  ] P.                  ] P0                  ] P.                  ] P0                  ]] P0                  R7      ]! 4       ^ R3R R ll4       t!R R lt"R R lt#RR R llt$RR R llt%R#   ]]3 d    ^ RIH t   ELi ; i)    N)cython)SequenceTupleUnion)IntegralReal)	jnx1x2d1d2scalexdc          
      T    V ^8  d   QhR\         R\        R\        R\        R\        /# )   coordsrc1rd1rc2rd2)_PointSegment_Point_Delta)formats   "t/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/fontTools/varLib/iup.py__annotate__r   (   s4     0 00 &0-30:@0GM0    c                   RR.pR F  p. ;WV&   pW,          W6,          W&,          WF,          3w  rrW8X  dG   \        V 4      pW8X  d   VP                  V
.V,          4       MVP                  ^ .V,          4       Kv  W8  d   YrYrW,
          W,
          ,          pV  FF  pW,          pW8:  d   T
pM!W8  d   TpMW,
          V,          pV
V,           pVP                  V4       KH  	  K  	  \        V!  # )zGiven two reference coordinates `rc1` & `rc2` and their respective
delta vectors `rd1` & `rd2`, returns interpolated deltas for the set of
coordinates `coords`.Nr      )lenextendappendzip)r   r   r   r   r   
out_arraysr	   outr   r   r   r   r
   r   pairr   r   nudges   &&&&&             r   iup_segmentr+      s    * J  
78FAx

B4!8$

A37#7 RW%DAw 5(JJJqM% % L 
r   c                <    V ^8  d   QhR\         R\        R\        /# )r   deltasr   return)_DeltaOrNoneSegmentr   _DeltaSegment)r   s   "r   r   r   [   s"     1 1+ 1] 1} 1r   c                   \        V 4      \        V4      8X  g   Q hRV 9  d   V # \        V 4      p\        V 4       UUu. uF  w  r4Vf   K  VNK  	  pppV'       g   R.V,          # . p\        V4      p\        V4      pV^ 8w  dH   ^ WVR,          3w  rrVP	                  \        WV
 W,          W,          W,          W,          4      4       VP                  W,          4       V Fp  pW,
          ^8  dH   V^,           WV3w  rrVP	                  \        WV
 W,          W,          W,          W,          4      4       VP                  W,          4       TpKr  	  W^,
          8w  dO   V^,           W(V^ ,          3w  rrVP	                  \        WV
 W,          W,          W,          W,          4      4       \        V 4      \        V4      8X  g   Q \        V 4      \        V4      34       hV# u uppi )zFor the contour given in `coords`, interpolate any missing
delta values in delta vector `deltas`.

Returns fully filled-out delta vector.N)r   r   )r#   	enumerateiternextr$   r+   r%   )r-   r   r
   ivindicesr(   itstarti1i2ri1ri2ends   &&            r   iup_contourr@   [   s    v;#f+%%%6FA&v.@.TQ!qq.G@x!|
C	gBHEzeGBK7

"v{FKfk	

 JJv};?$qy#c9BCJJbM6;V[&+
 	

6;  A~ 19a
:

"v{FKfk	
 v;#c(";S[#c($;;"JK As   G*G*c                H    V ^8  d   QhR\         R\        R\        R\        /# )r   r-   r   endsr.   )r/   r   
_Endpointsr0   )r   s   "r   r   r      s,      )6>Hr   c                `   \        V4      V8X  d0   \        V4      V'       d   VR,          ^,           M^ ^,           8X  g   Q h\        V4      pW#^,
          V^,
          V^,
          V^,
          .,           p. p^ pV F/  pV^,          p\        WV WV 4      pVP                  V4       TpK1  	  V# )zFor the outline given in `coords`, with contour endpoints given
in sorted increasing order in `ends`, interpolate any missing
delta values in delta vector `deltas`.

Returns fully filled-out delta vector.r2   )sortedr#   r@   r$   )r-   r   rB   r
   r(   r:   r?   contours   &&&     r   	iup_deltarG      s     $<4CKDDHqLaST3T$TTTFAq5!a%QA..D
CEqf3/c1BC

7	  Jr   )r6   r	   r   ypqc          
      T    V ^8  d   QhR\         R\        R\        R\        R\        /# )r   r-   r   r6   r	   	tolerance)r0   r   r   r   )r   s   "r   r   r      s:        	
 r   c                0  a W2,
          ^8  g   Q h\        W^,           V W,          W,          W,          W,          4      pW^,           V p \        ;QJ d(    V3R l\        W4       4       F  '       d   K   R# 	  R# ! V3R l\        W4       4       4      # )zReturn true if the deltas for points at `i` and `j` (`i < j`) can be
successfully used to interpolate deltas for points in between them within
provided error tolerance.c              3   z   <"   T F0  w  w  rw  r4\        \        W,
          W$,
          4      4      S8*  x  K2  	  R # 5iNabscomplex).0r   rH   rI   rJ   rL   s   &    r   	<genexpr>%can_iup_in_between.<locals>.<genexpr>   s5      1NFQFQ 	GAE15!"i/1s   8;FT)r+   allr&   )r-   r   r6   r	   rL   interps   &&&&f r   can_iup_in_betweenrX      s    . 5A::A*FIvy&)VYWFEAF3 !&133 3 3 !&1  r   )cjdjlcjldjncjndjforceforcedc                H    V ^8  d   QhR\         R\        R\        R\        /# r   r-   r   rL   r.   )r0   r   r   set)r   s   "r   r   r      s2     N NN#0N=ANNr   c                D   \        V 4      \        V4      8X  g   Q h\        V 4      p\        4       p\        \        V 4      ^,
          RR4       EF  pW^,
          ,          W^,
          ,          rvW,          W,          rWV,
          ^,           ,          WV,
          ^,           ,          rR EFk  pW,          pW,          pW|,          pWl,          pW,          pW,          pVV8:  d
   TTppTTppMTTppTTppRpVV8X  d+   \        VV,
          4      V8  d   \        V4      V8  d   RpMVTu;8:  d   V8:  d:   M M6\	        VV4      V,
          Tu;8:  d   \        VV4      V,           8:  g   M RpMVV8w  d   VV8  d>   \        V4      V8  d-   \        VV,
          4      V8  d   W,
          V8  VV8  8w  d   RpM<\        V4      V8  d-   \        VV,
          4      V8  d   VW,           8  VV8  8w  d   RpV'       g   EKY  VP                  V4        EK  	  EK  	  V# )a  The forced set is a conservative set of points on the contour that must be encoded
explicitly (ie. cannot be interpolated).  Calculating this set allows for significantly
speeding up the dynamic-programming, as well as resolve circularity in DP.

The set is precise; that is, if an index is in the returned set, then there is no way
that IUP can generate delta for that point, given `coords` and `deltas`.
FTr2   r!   )r#   rc   rangerQ   minmaxadd)r-   r   rL   r
   r`   r6   ldlcr   cndncr	   rY   rZ   r[   r\   r]   r^   c1c2r   r   r_   s   &&&                     r   _iup_contour_bound_forced_setrp      s   ( v;#f+%%%FAUF3v;?B+A1uBy&)1A	"Fq519$5BABB%C%C%C%CczcBcBBcBcBE RxrBw<)+B)0C E rRBi/2PRy9PP E
 8BwGi/ #BGy 8"$.2"527!C$(E  Gi/ #BGy 8"$r~"527!C$(Eu

1q  ,~ Mr   )r6   r	   	best_costbest_jcostr`   rL   c                H    V ^8  d   QhR\         R\        R\        R\        /# )r   r-   r   rL   lookback)r0   r   r   r   )r   s   "r   r   r   .  s0     ) ))) 	)
 )r   c           	        \        V 4      pVf   Tp\        V\        4      pR^ /pRR/p\        ^ V4       F  pWh^,
          ,          ^,           p	WV&   V^,
          Wx&   V^,
          V9   d   K8  \        V^,
          \	        W,
          R4      R4       F>  p
Wj,          ^,           pW8  d   \        WWV4      '       d   T;Wh&   p	WV&   W9   g   K=   K  	  K  	  Wv3# )a  Straightforward Dynamic-Programming.  For each index i, find least-costly encoding of
points 0 to i where i is explicitly encoded.  We find this by considering all previous
explicit points j and check whether interpolation can fill points between j and i.

Note that solution always encodes last point explicitly.  Higher-level is responsible
for removing that restriction.

As major speedup, we stop looking further whenever we see a "forced" point.Nr2   )r#   rf   MAX_LOOKBACKre   rg   rX   )r-   r   r`   rL   ru   r
   costschainr6   rq   r	   rs   s   &&&&&       r   _iup_contour_optimize_dpr{   %  s    2 	FA8\*HGEJE1a[a%L1$	aq5q5F?q1uc!,3R8A8a<D$6vqY$W$W'++9a{ 9 & <r   c                0    V ^8  d   QhR\         R\        /# )r   lk)listint)r   s   "r   r   r   Z  s     # # ## #r   c                r    \        V 4      pW,          pV'       g   V # WV,
          R V RW!,
           ,           # )zwRotate list by k items forward.  Ie. item at position 0 will be
at position k in returned list.  Negative k is allowed.N)r#   )r}   r~   r
   s   && r   	_rot_listr   Z  s7     	AAFAUW:'AE
""r   c                <    V ^8  d   QhR\         R\        R\        /# )r   sr~   r
   )rc   r   )r   s   "r   r   r   d  s!     $ $ $ $ $r   c                 n    W,          pV'       g   V # V  Uu0 uF  q3V,           V,          kK  	  up# u upi rO    )r   r~   r
   r7   s   &&& r   _rot_setr   d  s1    FA!"#AUaKK###s   2c                H    V ^8  d   QhR\         R\        R\        R\        /# rb   )r0   r   r   r/   )r   s   "r   r   r   k  s2     b bb#0b=Abbr   c                f  aa \        V 4      p\        ;QJ d    V3R lV  4       F  '       d   K   RM	  RM! V3R lV  4       4      '       d   R.V,          # V^8X  d   V # V ^ ,          o\        ;QJ d    V3R lV  4       F  '       d   K   RM	  RM! V3R lV  4       4      '       d   S.R.V^,
          ,          ,           # \        WS4      pV'       d   V^,
          \        V4      ,
          pV^ 8  g   Q h\	        W4      p \	        W4      p\        WEV4      p\        WVS4      w  rg\        4       pV^,
          p	V	e   VP                  V	4       Wi,          p	K  VP                  R4       WH8:  g	   Q WH34       h\        V4       U	u. uF  qV9   d	   W	,          MRNK  	  p p	\	        W) 4      p V # \        W ,           W,           VSV4      w  rgRV^,           r\        V^,
          \        V4      ^,
          4       Fr  p\        4       pTp	WV,
          8  d"   VP                  W,          4       Wi,          p	K.  WV,
          8X  g   KL  W|,          W|V,
          ,          ,
          pW8:  g   Kp  YrKt  	  WJ8:  g	   Q WJ34       h\        V4       U	u. uF  qV
9   d	   W	,          MRNK  	  p p	V # u up	i u up	i )zFor contour with coordinates `coords`, optimize a set of delta
values `deltas` within error `tolerance`.

Returns delta vector that has most number of None items instead of
the input delta.
c              3   N   <"   T F  p\        \        V!  4      S8*  x  K  	  R # 5irO   rP   )rS   rI   rL   s   & r   rT   'iup_contour_optimize.<locals>.<genexpr>z  s     
9&Q3w{y(&s   "%FTNc              3   .   <"   T F
  pSV8H  x  K  	  R # 5irO   r   )rS   r   d0s   & r   rT   r     s     
#Fq27Fs   r2   )r#   rV   rp   rg   r   r   r{   rc   rh   removere   )r-   r   rL   r
   r`   r~   rz   ry   solutionr6   best_solrq   r:   rs   r   s   &&f           @r   iup_contour_optimizer   k  sW    	FA
 s
9&
9sss
9&
999vz 	Av 
B
s
#F
#sss
#F
###ttfA&&& +69EF  Uc&k!Avv6%6%&Q' 0	R 5EmLLOA !5F#55!@EaI1H}&)$6I62&< M3 0OV_fi
 #AE)1q5#e*q.1EuHAai-QU#HAI~|eAI&66$*2i 2  !5F#55!@EaI1H}&)$6IMA J< Js   J)J.c          
      T    V ^8  d   QhR\         R\        R\        R\        R\        /# )r   r-   r   rB   rL   r.   )r0   r   rC   r   r/   )r   s   "r   r   r     s:        	
 r   c                   \        V4      V8X  d0   \        V4      V'       d   VR,          ^,           M^ ^,           8X  g   Q h\        V4      pW$^,
          V^,
          V^,
          V^,
          .,           p. p^ pV F[  p\        WV^,            WV^,            V4      p\        V4      Wv,
          ^,           8X  g   Q hVP                  V4       V^,           pK]  	  V# )zFor the outline given in `coords`, with contour endpoints given
in sorted increasing order in `ends`, optimize a set of delta
values `deltas` within error `tolerance`.

Returns delta vector that has most number of None items instead of
the input delta.
r2   )rE   r#   r   r$   )	r-   r   rB   rL   r
   r(   r:   r?   rF   s	   &&&&     r   iup_delta_optimizer     s     $<4CKDDHqLaST3T$TTTFAq5!a%QA..D
CE&37#VC!G%<i
 7|s{Q...

7a  Jr   )r   )g        )&r   AttributeErrorImportErrorfontTools.misccompiledCOMPILEDtypingr   r   r   numbersr   r   r   r   r   r0   _DeltaOrNoner/   rC   rx   cfunclocalsr   doubler+   r@   rG   inlinereturnsrX   rc   rp   r{   r   r   r   r   r   r   r   <module>r      sM  & ?? 
 # 
tTz		tTz	  VT\"|, h
  jjjj}}}}}}}}
--mmmm
0
 0f1h4 jjjjmmmmmmmm    * }}}}
**	N	Nb jjjjmm::	mm 5))X#$bJ [ 	$ &%%&s   J JJ