+
    is.                        R t ^ RIHt RtRtRt^ RIt^ RItR.t]P                  ^ ,          ^8X  d   ]
tR tRR
 lt]R8X  Ed8    ^ RIt^ RIt]! ]P&                  4      ^8  g   ]! ]P&                  4      ^8  d.   ]P(                  P+                  R4       ]P,                  ! ^4       ]P.                  ! ]! ]P&                  ^,          4      4      t]P&                  ^,          tRt]! ]P&                  4      ^8  d   ]P&                  ^,          t]! ]]]4      t]'       g   ]P,                  ! ^4       ]P(                  t]P<                  ! ]]R	^R7       ]P+                  R4       ]P,                  ! ^ 4       R# R#   ] d	    ^ RIt ELBi ; i)a  
An XPath for JSON

A port of the Perl, and JavaScript versions of JSONPath
see http://goessner.net/articles/JsonPath/

Based on on JavaScript version by Stefan Goessner at:
        https://goessner.net/articles/JsonPath/
        http://code.google.com/p/jsonpath/
and Perl version by Kay Rhodes at:
        http://github.com/masukomi/jsonpath-perl/

Python3 compatibily by Per J. Sandstrom
)print_functionz
Phil Budnez$Revision: 1.20 $z0.82.2Njsonpathc                  a . oV3R lp\         P                  ! RW4      p \         P                  ! RRV 4      p \         P                  ! RRV 4      p \         P                  ! RRV 4      p V3R	 lp\         P                  ! R
W 4      p V # )z@normalize the path expression; outside jsonpath to allow testingc                 t   < \        S4      pV P                  ^4      pSP                  V4       RV,          pV# )   z[#%d])lengroupappend)mng1retsubxs   &   Q/Users/mibo/.openclaw/workspace/.venv-ak/lib/python3.14/site-packages/jsonpath.pyf1normalize.<locals>.f1M   s2    IWWQZBk
    z[\['](\??\(.*?\))[\]']z'?(?<!@)\.'?|\['?;z;;;|;;z;..;z
;$|'?\]|'$ c                 J   < V P                  ^4      pS\        V4      ,          # )r   )r   int)r
   r   r   s   & r   f2normalize.<locals>.f2^   s    WWQZCG}r   z	#([0-9]+))resub)xr   r   r   s   &  @r   	normalizer   G   su    D 	("0A 	#S!,A
y&!$A
}b!$A
 	|R#AHr   VALUETc                f  aaaaaaa	a
aaaa R oR o	V	3R loVV
V3R loVVV	VVVV3R loR oVVV	V3R lo\         P                  ! ^4      P                  o. o
V'       dO   V '       dG   \        V4      pVP	                  R4      '       d
   VR	,          pS! WPR
4       \        S
4      ^ 8  d   S
# R# )zCtraverse JSON object using jsonpath expr, returning values or pathsc                F    \        V 4      R,           \        V4      ,           # )zconcatenate path elementsr   )strr   ys   &&r   sjsonpath.<locals>.sj   s    1v|c!f$$r   c                "    V P                  4       # )z.check if argument represents a decimal integer)isdigit)r   s   &r   isintjsonpath.<locals>.isintn   s    yy{r   c                   < RpV P                  R4      R,           F3  pS! V4      '       d   VRV,          ,          pK#  VRV,          ,          pK5  	  V# )zOconvert internal path representation to
"full bracket notation" for PATH output$r   r   NN[%s]['%s'])split)pathppiecer'   s   &  r   as_pathjsonpath.<locals>.as_pathr   sS     ZZ_R((E U||Ve^#X%% ) r   c                    < SR 8X  d   SP                  V4       V # SR8X  d*   SP                  V P                  R4      R,          4       V # SP                  S! V 4      4       V # )r   IPATHr   r+   )r	   r.   )r/   objectr2   resultresult_types   &&r   storejsonpath.<locals>.store   s_    '!MM&!  G#MM$**S/"-.  MM'$-(r   c                 j  < S'       d   \        R V RV4       V '       Ed   V P                  R4      pV^ ,          pRP                  VR,          4      pS'       d   \        RV\        V4      4       VR8X  d   VVV3R lpS! WCWV4       R# VR8X  d   S! W1V4       VVV3R lpS! WCWV4       R# VR	8X  d   V3R
 lpS! WCWV4       R# \	        V\
        4      '       d   WA9   d   S! W1V,          S! W$4      4       R# \	        V\        4      '       db   S! V4      '       dT   \        V4      pS'       d   \        RV\        V4      4       \        V4      V8  d   S! W1V,          S! W$4      4       R# R# VP                  R4      '       dD   VP                  R4      '       d-   S^8  d   \        RV4       S! WA4      p	S! S! W4      W4       R# VP                  R4      '       dE   VP                  R4      '       d.   S^8  d   \        RV4       VVVV3R lp
V^R pS! WCWV
4       R# \        P                  ! RV4      pV'       Ed   \	        V\
        \        34      '       d   R pR p\        V4      pVP                  ^4      pVP                  ^4      pVP                  ^4      pV'       d   \        V4      M^ pV'       d   \        V4      MTpV'       d   \        V4      M^pV^ 8  d   V! ^ VV,           4      pM	V! VV4      pV^ 8  d   V! ^ VV,           4      pM	V! VV4      p\        VVV4       F  pS! S! VV4      W4       K  	  R# VP                  R4      ^ 8  dD   \        P                  ! RV4       F&  pS^8  d   \        RV4       S! S! VV4      W4       K(  	  R# R# S! W!4       R# )trace/r   r+   	*c                 N   < S^8  d   \        RWW$4       S! S! W4      W44       R# )r   z	f03N)printkeylocexprobjr/   debugr#   r<   s   &&&&&r   f03$jsonpath.<locals>.trace.<locals>.f03   s#    qy%4"F!C,2r   ..c                   < S^8  d   \        RWW$4       \        V\        4      '       d(   W9   d    S! S! RV4      W0,          S! W@4      4       R# R# V \        V4      8  d    S! S! RV4      W0,          S! W@4      4       R# R# )r   z	f04rJ   N)rA   
isinstancedictr   rB   s   &&&&&r   f04$jsonpath.<locals>.trace.<locals>.f04   sn    qy%4"F!#t,,:!!D$-1T<H & S>!!D$-1T<H *r   !c                 J   < \        V\        4      '       d   S! W V4       R # R # N)rL   rM   )rC   rD   rE   rF   r/   r<   s   &&&&&r   f06$jsonpath.<locals>.trace.<locals>.f06   s    !#t,,d. -r   z----->()indexNz?(filterc                    < S^8  d   \        RWW$4       \        V\        4      '       d   S! WV ,          4      pMS! W\        V 4      ,          4      pV'       d   S	! S! W4      W44       R# R# )r   f05N)rA   rL   rM   r   )
rC   rD   rE   rF   r/   eval_resultrG   evalxr#   r<   s
   &&&&& r   rZ   $jsonpath.<locals>.trace.<locals>.f05   sX     19eE3T&H%c400*/X*>K*/S]*CK&!!C,: 'r   z"(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)$c                     W8  d   V # V# rR    r!   s   &&r   max$jsonpath.<locals>.trace.<locals>.max        u'(#$Hr   c                     W8  d   V # V# rR   r_   r!   s   &&r   min$jsonpath.<locals>.trace.<locals>.min   rb   r   ,z'?,'?r1   )rA   r.   jointyperL   rM   listr   r   
startswithendswithr   matchr   xrangefind)rE   rF   r/   r   rD   rH   rN   rS   ilocerZ   r
   r`   rd   objlens0s1s2startendstepir1   rG   r\   r'   r#   r9   r<   walks   &&&                    r   r<   jsonpath.<locals>.trace   s   %sD14

3AA$C2AeD#tCy1cz3 SS,ad#I SS,/ SS,C&&3:aS1T<0C&&5::3x%$C9s8d?!Y$5 # >>#&&3<<+<+<qy%"5cA!A&#, >>$''CLL,=,=qy%#"6; ; a)CC0HHBCH1!#d|44%
%
 "%SWWQZWWQZWWQZ ,.B1)+c"g*,s2w! 19$'5<$8E$'$6E7"%aV"4C"%fc"2C!'sD!9A!!Aq'35 ": 88C=A%!#(C!8 19eGU&;aqk35 "9 & $r   c                     \        V\        4      '       d)   \        ^ \        V4      4       F  pV! WPWV4       K  	  R# \        V\        4      '       d   V F  pV! W`WV4       K  	  R# R# )    N)rL   rj   rn   r   rM   )rD   rE   rF   r/   functry   rC   s   &&&&&  r   rz   jsonpath.<locals>.walk   sX    c4  As3x(ad. )T""c40  #r   c                |  < S'       d   \        RV 4       V P                  RR4      p V P                  RR4      P                  RR4      p R p\        P                  ! R	W 4      p V3R
 lp\        P                  ! RW04      p \        P                  ! RRV 4      P                  RR4      p S	'       g   S'       d   \        R4       \	        R4      hS'       d   \        RV 4        \        V SRV/4      pS'       d   \        RT4       T#   \         d(   pS'       d   \        \        T4      4        Rp?R# Rp?ii ; i)zeval expressionr\   z@.lengthz
len(__obj)z&&z and z||z or c                 2    R V P                  ^4      ,          # )z'%s' not in __obj)r   )r
   s   &r   notvar'jsonpath.<locals>.evalx.<locals>.notvar  s    &33r   z!@\.([a-zA-Z@_0-9-]*)c                    < V3R  lpV P                  ^4      pVP                  R4      pVR,          R8X  d   RV! V^R 4      ,          # V! VR,          4      # )c                 ~   < R pV  F3  pS! V4      '       d   VRV,          ,          pK#  VRV,          ,          pK5  	  V# )__objr,   r-   r_   )eltsr   rq   r'   s   &  r   brackets;jsonpath.<locals>.evalx.<locals>.varmatch.<locals>.brackets  s>    AQxxvz)x!|+	 
 
r   .lengthzlen(%s)r+   rg   )r   r.   )r
   r   r   r   r'   s   &   r   varmatch)jsonpath.<locals>.evalx.<locals>.varmatch  sU     B88C=DBx8# 8D2J#777DH%%r   z(?<!\\)(@\.[a-zA-Z@_.0-9]+)z(?<!\\)@r   z\@@zeval disabledevalNFz->)rA   replacer   r   	Exceptionr   repr)
rD   rF   r   r   vrq   caller_globalsrG   r'   use_evals
   &&    r   r\   jsonpath.<locals>.evalx   s     %% kk*l3kk$(00v>	4ff-v;	& ff3XC ff['3/77sCeO,O,,%$	S.7C.9A
 %a.  	eDGn	s   $D	 	D;D66D;z$;:   NNr*   F)sys	_getframe	f_globalsr   rk   r   )rF   rE   r8   rG   r   cleaned_exprr2   r   r\   r'   r7   r#   r9   r<   rz   s   &&fff @@@@@@@@@r   r   r   g   s    %g gR15 5t ]]1%//NF ""4(('+L 	l%v;?Mr   __main__z+Usage: jsonpath.py FILE PATH [OUTPUT_TYPE]
)	sort_keysindent
)r   r}   T)__doc__
__future__r   
__author____revision____version__r   r   __all__version_inforangern   r   r   __name__jsonImportError
simplejsonr   argvstdoutwriteexitloadopenr6   r/   formatvaluefdumpr_   r   r   <module>r      s\   &
"8 
 
 . A!F@Yv z"  388}qCMA-

GHYYtCHHQK()F88A;DF
388}q!VT6*E

AIIeQ$q1GGDMHHQK?   "!"s   E= =FF