codebaseiq 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-7GAK2F3H.js → chunk-23AD24QZ.js} +12 -12
  4. package/dist/chunk-24TEZJST.js +2 -0
  5. package/dist/{chunk-356EZBIP.js → chunk-26EDDGAX.js} +2 -2
  6. package/dist/{chunk-O2M3VNDY.js → chunk-26EZWQ24.js} +2 -2
  7. package/dist/{chunk-U33PMPNW.js → chunk-2L3NCI52.js} +2 -2
  8. package/dist/{chunk-MSI3K7PJ.js → chunk-2QJAVISG.js} +2 -2
  9. package/dist/{chunk-4LK5OIPW.js → chunk-2ZBZRYX4.js} +2 -2
  10. package/dist/chunk-33AXWMO2.js +2 -0
  11. package/dist/{chunk-EQNMD62X.js → chunk-37K55EG3.js} +2 -2
  12. package/dist/{chunk-ITSJMNUD.js → chunk-3EFZ5KQ4.js} +2 -2
  13. package/dist/{chunk-D7DOB27N.js → chunk-3F23W57G.js} +2 -2
  14. package/dist/{chunk-BGGB5N53.js → chunk-3GKKCVKK.js} +2 -2
  15. package/dist/{chunk-MQW6SJ4P.js → chunk-3SYRGMCL.js} +2 -2
  16. package/dist/{chunk-PFC44E6D.js → chunk-3VDL7GTY.js} +2 -2
  17. package/dist/{chunk-7JELP5YE.js → chunk-3XBZ5PKL.js} +2 -2
  18. package/dist/{chunk-75KJGYX7.js → chunk-42PXSE74.js} +2 -2
  19. package/dist/{chunk-FEIZXBLH.js → chunk-4GIERC2P.js} +2 -2
  20. package/dist/{chunk-W7YLRXZE.js → chunk-4UXDBRIF.js} +2 -2
  21. package/dist/chunk-4XMZYLW5.js +2 -0
  22. package/dist/{chunk-6BF3VYEF.js → chunk-55NUXP2V.js} +2 -2
  23. package/dist/chunk-5AJQCOZZ.js +21 -0
  24. package/dist/{chunk-5DSL3NT2.js → chunk-5NUPFZFA.js} +2 -2
  25. package/dist/{chunk-RJVAPMHF.js → chunk-65QIFIF6.js} +2 -2
  26. package/dist/{chunk-36JC5BG2.js → chunk-66Q5VLH6.js} +2 -2
  27. package/dist/{chunk-D7AZAOZX.js → chunk-6CQPIIS7.js} +2 -2
  28. package/dist/{chunk-GV2CEZCW.js → chunk-6CTSFS7R.js} +2 -2
  29. package/dist/{chunk-Q4XEU3UH.js → chunk-6EBUAKJT.js} +2 -2
  30. package/dist/chunk-6I55VYFG.js +4 -0
  31. package/dist/chunk-6NUURWPF.js +3 -0
  32. package/dist/{chunk-MHWMEZDA.js → chunk-6P5QMOM7.js} +2 -2
  33. package/dist/{chunk-LZSQ6X7E.js → chunk-6S5FE4ZF.js} +2 -2
  34. package/dist/chunk-74LRKLNC.js +22 -0
  35. package/dist/chunk-75A23IID.js +3 -0
  36. package/dist/chunk-75VNTSO6.js +7 -0
  37. package/dist/chunk-7HBBVZJ6.js +3 -0
  38. package/dist/{chunk-VWYGCMV5.js → chunk-7PPBMBH6.js} +2 -2
  39. package/dist/{chunk-3RSBGWGL.js → chunk-7WG57A5X.js} +2 -2
  40. package/dist/{chunk-FWQGH2N2.js → chunk-7XHZX6FX.js} +2 -2
  41. package/dist/{chunk-RIYJ4L33.js → chunk-A5HJ3CJW.js} +2 -2
  42. package/dist/{chunk-LONKINMJ.js → chunk-AJ5HVC5Z.js} +2 -2
  43. package/dist/{chunk-ZAFGY22Q.js → chunk-AYRHOFLV.js} +2 -2
  44. package/dist/chunk-AZDY3EKD.js +93 -0
  45. package/dist/{chunk-CW6AXOLR.js → chunk-AZZNG5Z2.js} +2 -2
  46. package/dist/chunk-BEKCTUPY.js +3 -0
  47. package/dist/{chunk-CR3OG6SQ.js → chunk-BKKX2OU5.js} +2 -2
  48. package/dist/{chunk-5LL4KEHO.js → chunk-BQKRYKDD.js} +2 -2
  49. package/dist/{chunk-FOZ74V56.js → chunk-BVDQU2XJ.js} +2 -2
  50. package/dist/chunk-C3PPB2T5.js +5 -0
  51. package/dist/chunk-CABIZQXQ.js +21 -0
  52. package/dist/{chunk-M2Y6PCFE.js → chunk-CAH322MC.js} +2 -2
  53. package/dist/{chunk-EIBGSU2R.js → chunk-CBOOHUK4.js} +2 -2
  54. package/dist/chunk-CFIICAOM.js +2 -0
  55. package/dist/{chunk-XMJ53WG4.js → chunk-CPWYEPWQ.js} +2 -2
  56. package/dist/{chunk-LQHYYIOB.js → chunk-CRT7I7RJ.js} +2 -2
  57. package/dist/{chunk-IZDPGOZR.js → chunk-CZVSQQDU.js} +2 -2
  58. package/dist/{chunk-TNJGTQWO.js → chunk-D3KE26FS.js} +2 -2
  59. package/dist/{chunk-GP7C5VAE.js → chunk-DNRHRVKS.js} +2 -2
  60. package/dist/{chunk-SGMNWYTH.js → chunk-DOQLO74K.js} +2 -2
  61. package/dist/{chunk-AURCQHSG.js → chunk-DP3EJ6XL.js} +2 -2
  62. package/dist/{chunk-C7QWUBR2.js → chunk-DQZF7MP6.js} +2 -2
  63. package/dist/{chunk-E52K4L2W.js → chunk-DTM4EHD2.js} +2 -2
  64. package/dist/{chunk-YRKP7PM7.js → chunk-DUM7GR6B.js} +2 -2
  65. package/dist/{chunk-I22IZYDI.js → chunk-DZ4QOIRY.js} +2 -2
  66. package/dist/{chunk-EXZ7VLRY.js → chunk-E3R6TJ5T.js} +2 -2
  67. package/dist/chunk-E4DP45YU.js +3 -0
  68. package/dist/{chunk-PUVNH4PO.js → chunk-E5U6N5WI.js} +2 -2
  69. package/dist/chunk-E7T22WET.js +21 -0
  70. package/dist/{chunk-QEOWONKY.js → chunk-ED7ZAZ5V.js} +2 -2
  71. package/dist/{chunk-RCIGX23V.js → chunk-EDMG5CSO.js} +2 -2
  72. package/dist/{chunk-IHSLIIL3.js → chunk-EOSUV7H5.js} +2 -2
  73. package/dist/{chunk-FQTIFWLR.js → chunk-ESWVTSHU.js} +2 -2
  74. package/dist/{chunk-6VREELBC.js → chunk-ETZBIG6K.js} +2 -2
  75. package/dist/chunk-EYSJHKX6.js +3 -0
  76. package/dist/{chunk-Q23IMHXS.js → chunk-F4AGM7ZE.js} +37 -37
  77. package/dist/{chunk-FTTV7IRX.js → chunk-FPUJRBHL.js} +50 -50
  78. package/dist/{chunk-CCIYWXX6.js → chunk-G2UU6PQP.js} +2 -2
  79. package/dist/{chunk-C6WKPKCF.js → chunk-G3KRXNNT.js} +2 -2
  80. package/dist/{chunk-TEANKHUU.js → chunk-G3ZBP72R.js} +2 -2
  81. package/dist/{chunk-NBCQZSGR.js → chunk-GC4I33OD.js} +2 -2
  82. package/dist/{chunk-NDKOVQFG.js → chunk-GLXEWYQY.js} +2 -2
  83. package/dist/{chunk-AEXQYQD7.js → chunk-GRHNPFHT.js} +2 -2
  84. package/dist/{chunk-NBZKSTXP.js → chunk-GWESWURK.js} +2 -2
  85. package/dist/{chunk-Q3ZCQY2Y.js → chunk-GXOFPAIR.js} +2 -2
  86. package/dist/{chunk-USOAJHY7.js → chunk-H4FGIFEU.js} +2 -2
  87. package/dist/{chunk-LKUTSP4G.js → chunk-HOGS6JFP.js} +2 -2
  88. package/dist/{chunk-UQE4XFSA.js → chunk-HSJLK5MC.js} +2 -2
  89. package/dist/{chunk-BWL3PMPT.js → chunk-HTPEUJ42.js} +2 -2
  90. package/dist/{chunk-3RR2K7EZ.js → chunk-IBPXUGJV.js} +2 -2
  91. package/dist/{chunk-BFBIMTCJ.js → chunk-ITA3N7G6.js} +2 -2
  92. package/dist/chunk-JG5OWAEB.js +22 -0
  93. package/dist/{chunk-2PRONPAS.js → chunk-JGJKRTTB.js} +2 -2
  94. package/dist/{chunk-TJWVT4DO.js → chunk-JGXLB7PR.js} +2 -2
  95. package/dist/{chunk-K7JLSGCJ.js → chunk-JKUF2UG6.js} +3 -3
  96. package/dist/{chunk-CIYA2KZN.js → chunk-JOYASZRF.js} +2 -2
  97. package/dist/{chunk-U7NUXDQO.js → chunk-K3PFL5QQ.js} +2 -2
  98. package/dist/{chunk-WK2IQJPK.js → chunk-KAXBWTSX.js} +2 -2
  99. package/dist/{chunk-5ZI2PPI7.js → chunk-KHHAGHAW.js} +2 -2
  100. package/dist/{chunk-UW6KD57C.js → chunk-KJLUQVBG.js} +2 -2
  101. package/dist/{chunk-WWCV4E6J.js → chunk-KOVUXHIZ.js} +2 -2
  102. package/dist/chunk-KPMMOAV5.js +4 -0
  103. package/dist/{chunk-GDHWOA57.js → chunk-LKJZNGMA.js} +2 -2
  104. package/dist/{chunk-3VJ3OCRE.js → chunk-LMPOC372.js} +2 -2
  105. package/dist/{chunk-F3QSL4W2.js → chunk-LTPNP6D5.js} +2 -2
  106. package/dist/{chunk-MVRGB4KJ.js → chunk-M3IBH6C3.js} +9 -9
  107. package/dist/{chunk-PHNCEUXX.js → chunk-MAGBSB6E.js} +2 -2
  108. package/dist/{chunk-QMOZZ2VX.js → chunk-MFMHD36E.js} +2 -2
  109. package/dist/{chunk-LMTSB3TB.js → chunk-MJX2J5QE.js} +2 -2
  110. package/dist/{chunk-PTQPPPG2.js → chunk-N26LGGSF.js} +2 -2
  111. package/dist/{chunk-J7AMBVWF.js → chunk-NB2DAVPP.js} +2 -2
  112. package/dist/{chunk-JYI7CV25.js → chunk-NJDXNYLG.js} +2 -2
  113. package/dist/{chunk-BRQL7AFJ.js → chunk-NMKQOIYZ.js} +2 -2
  114. package/dist/{chunk-ICUL7XRT.js → chunk-NRNVMB2R.js} +2 -2
  115. package/dist/{chunk-DDN2F6GB.js → chunk-O5BWFNIH.js} +2 -2
  116. package/dist/{chunk-HVFB3PME.js → chunk-O7PCDZ5B.js} +2 -2
  117. package/dist/{chunk-KPZGTB2O.js → chunk-OAJYNPRU.js} +2 -2
  118. package/dist/{chunk-2EDX3JT5.js → chunk-OFUC6R46.js} +2 -2
  119. package/dist/chunk-OSZ7PW5K.js +5 -0
  120. package/dist/{chunk-B3UYV66Z.js → chunk-OZ2M2X7A.js} +2 -2
  121. package/dist/{chunk-6O3KXIDL.js → chunk-OZI44VCR.js} +2 -2
  122. package/dist/{chunk-XN3EKMLI.js → chunk-PCKIKOUA.js} +2 -2
  123. package/dist/{chunk-NCJILOAK.js → chunk-PFMQRHC6.js} +2 -2
  124. package/dist/chunk-PVKSZBX5.js +82 -0
  125. package/dist/{chunk-NEWHKGVD.js → chunk-QANCT4MO.js} +2 -2
  126. package/dist/{chunk-ZNH33XIB.js → chunk-QEWN7BLP.js} +2 -2
  127. package/dist/{chunk-OQUCBKOI.js → chunk-QFJ46F6F.js} +2 -2
  128. package/dist/{chunk-2E6OUPCF.js → chunk-QPQWR6CW.js} +2 -2
  129. package/dist/{chunk-YTJHCGYB.js → chunk-QX4HDF2I.js} +2 -2
  130. package/dist/{chunk-J3GLP7Q5.js → chunk-R2F2CTBA.js} +2 -2
  131. package/dist/{chunk-2OMXFE64.js → chunk-R7PXHYMY.js} +2 -2
  132. package/dist/{chunk-F74LZWCE.js → chunk-RGBZDOUO.js} +2 -2
  133. package/dist/{chunk-362QOSFD.js → chunk-RNPG5P4P.js} +2 -2
  134. package/dist/{chunk-D62CTZX6.js → chunk-RS6UYNEP.js} +2 -2
  135. package/dist/{chunk-VGWZ4MOY.js → chunk-RVBRPBLQ.js} +2 -2
  136. package/dist/{chunk-5IZRKWTZ.js → chunk-RWAZCEJD.js} +2 -2
  137. package/dist/{chunk-ZQ62NNKN.js → chunk-RWDIONS7.js} +2 -2
  138. package/dist/{chunk-HQA7EBSK.js → chunk-S3CJYDXP.js} +2 -2
  139. package/dist/{chunk-GL6UTNUB.js → chunk-S6UTKCBT.js} +2 -2
  140. package/dist/chunk-SLLFJXTW.js +27 -0
  141. package/dist/{chunk-TOTWJZIX.js → chunk-T3KTMLQT.js} +2 -2
  142. package/dist/{chunk-67VJAYVR.js → chunk-TB575ZGO.js} +2 -2
  143. package/dist/{chunk-YHPG3S2U.js → chunk-TG4GMU73.js} +2 -2
  144. package/dist/{chunk-CVHOQONG.js → chunk-THKM7OXM.js} +2 -2
  145. package/dist/{chunk-GVAF222T.js → chunk-TNLOX4TN.js} +2 -2
  146. package/dist/{chunk-HENP2O4A.js → chunk-UHFZDQZJ.js} +2 -2
  147. package/dist/{chunk-YT4DVWUV.js → chunk-UUMAM5LM.js} +2 -2
  148. package/dist/{chunk-JX6ZWDOS.js → chunk-UUT5P3V7.js} +2 -2
  149. package/dist/{chunk-Z6RL7XOE.js → chunk-VEPK6M5C.js} +2 -2
  150. package/dist/{chunk-C7OUW52M.js → chunk-VPCHKZ3I.js} +2 -2
  151. package/dist/{chunk-GIDCP7KV.js → chunk-VZY3XOBU.js} +2 -2
  152. package/dist/{chunk-XQAVQVIL.js → chunk-W6E6ME7G.js} +2 -2
  153. package/dist/{chunk-XQPPURLQ.js → chunk-WGYZBS5S.js} +2 -2
  154. package/dist/{chunk-GUFPEFBG.js → chunk-WUP24Q4U.js} +2 -2
  155. package/dist/chunk-WXUHXSLN.js +2 -0
  156. package/dist/{chunk-HINZQKSY.js → chunk-X4YZD2MP.js} +2 -2
  157. package/dist/chunk-XARPGCTL.js +2 -0
  158. package/dist/{chunk-5FWR5HLG.js → chunk-XDQ6QJF5.js} +20 -20
  159. package/dist/{chunk-JCMFBF4Z.js → chunk-XRH7R5SX.js} +2 -2
  160. package/dist/{chunk-BBP7HVBJ.js → chunk-XVJ2E7W7.js} +2 -2
  161. package/dist/{chunk-D53LWANR.js → chunk-Y7GFAU5N.js} +2 -2
  162. package/dist/{chunk-T6MQNNAC.js → chunk-YBDLHFZZ.js} +2 -2
  163. package/dist/{chunk-ZB4C5TTR.js → chunk-YI3CJPOY.js} +2 -2
  164. package/dist/chunk-YMAGXBLT.js +3 -0
  165. package/dist/{chunk-MZNMASFM.js → chunk-YRAGNEBZ.js} +2 -2
  166. package/dist/chunk-YXZAAQHZ.js +3 -0
  167. package/dist/chunk-Z2L5H2HF.js +3 -0
  168. package/dist/{chunk-JSNTHRLQ.js → chunk-ZHK7TVAJ.js} +2 -2
  169. package/dist/chunk-ZJNV27DZ.js +4 -0
  170. package/dist/{chunk-GQLDYCWS.js → chunk-ZQ6GAIUV.js} +2 -2
  171. package/dist/{chunk-TPO7XC5Z.js → chunk-ZQE2QYAC.js} +2 -2
  172. package/dist/chunk-ZUQ2MDFT.js +2 -0
  173. package/dist/cli-context-4R2LREXQ.js +3 -0
  174. package/dist/cli-context-6X7JYARX.js +2 -0
  175. package/dist/cli-failure-RECEHOM2.js +3 -0
  176. package/dist/cli-program-MXA3WTAO.js +7 -0
  177. package/dist/cli.js +1 -1
  178. package/dist/{code-viewer-VHLBLIUM.js → code-viewer-C6HE4DFC.js} +2 -2
  179. package/dist/{code-viewer-KIXEYQNJ.js → code-viewer-XHSSAMBX.js} +2 -2
  180. package/dist/{command-descriptors-YCLATF5I.js → command-descriptors-NWW34Z54.js} +171 -171
  181. package/dist/{command-descriptors-F5P2V3NW.js → command-descriptors-XHK3PK2I.js} +116 -116
  182. package/dist/{command-panels-SZONPMLJ.js → command-panels-OXMCJ2QZ.js} +2 -2
  183. package/dist/direct-navigation-236VXYBZ.js +3 -0
  184. package/dist/direct-navigation-36YSILY6.js +2 -0
  185. package/dist/index.js +1 -1
  186. package/dist/invocation-command-descriptors-35JULLNR.js +3 -0
  187. package/dist/invocation-command-descriptors-FEWSFUO2.js +2 -0
  188. package/dist/output-continuation-command-MJBVH3A5.js +2 -0
  189. package/dist/output-continuation-command-TBXIOPHQ.js +3 -0
  190. package/dist/project-reindex-5TCGOVSK.js +2 -0
  191. package/dist/project-reindex-BUNTSYKM.js +3 -0
  192. package/dist/queries/affected.js +1 -1
  193. package/dist/queries/anchors.js +1 -1
  194. package/dist/queries/architecture.js +1 -1
  195. package/dist/queries/bottlenecks.js +1 -1
  196. package/dist/queries/by-kind.js +1 -1
  197. package/dist/queries/call-graph.js +1 -1
  198. package/dist/queries/change-surface.js +1 -1
  199. package/dist/queries/cleanup-plan.js +1 -1
  200. package/dist/queries/co-change.js +1 -1
  201. package/dist/queries/code.js +1 -1
  202. package/dist/queries/complexity-hotspots.js +1 -1
  203. package/dist/queries/complexity.js +1 -1
  204. package/dist/queries/context.js +1 -1
  205. package/dist/queries/convergence.js +1 -1
  206. package/dist/queries/coupling.js +1 -1
  207. package/dist/queries/cycles.js +1 -1
  208. package/dist/queries/dataflow.js +1 -1
  209. package/dist/queries/dead.js +1 -1
  210. package/dist/queries/decorative-checkers.js +1 -1
  211. package/dist/queries/deep-chains.js +1 -1
  212. package/dist/queries/dependence-slice.js +1 -1
  213. package/dist/queries/dependency-depth.js +1 -1
  214. package/dist/queries/deps.js +1 -1
  215. package/dist/queries/diff-impact.js +1 -1
  216. package/dist/queries/doc-drift.js +1 -1
  217. package/dist/queries/drift.js +1 -1
  218. package/dist/queries/duplicate-bodies.js +1 -1
  219. package/dist/queries/entry-map.js +1 -1
  220. package/dist/queries/evidence.js +1 -1
  221. package/dist/queries/extract-candidates.js +1 -1
  222. package/dist/queries/fan.js +1 -1
  223. package/dist/queries/files.js +1 -1
  224. package/dist/queries/health.js +1 -1
  225. package/dist/queries/hierarchy.js +1 -1
  226. package/dist/queries/hotspots.js +1 -1
  227. package/dist/queries/imports.js +1 -1
  228. package/dist/queries/incomplete-migration.js +1 -1
  229. package/dist/queries/index.js +1 -1
  230. package/dist/queries/isolated.js +1 -1
  231. package/dist/queries/locality-candidates.js +1 -1
  232. package/dist/queries/members.js +1 -1
  233. package/dist/queries/methods.js +1 -1
  234. package/dist/queries/not-implemented.js +1 -1
  235. package/dist/queries/outline.js +1 -1
  236. package/dist/queries/passthrough-candidates.js +1 -1
  237. package/dist/queries/plan-context.js +1 -1
  238. package/dist/queries/react-component-duplicates.js +1 -1
  239. package/dist/queries/react-hook-candidates.js +1 -1
  240. package/dist/queries/react-large-component-pressure.js +1 -1
  241. package/dist/queries/recent-duplicates.js +1 -1
  242. package/dist/queries/redundant-reexports.js +1 -1
  243. package/dist/queries/reference-neighborhood.js +1 -1
  244. package/dist/queries/reference-reachability.js +1 -1
  245. package/dist/queries/refs.js +1 -1
  246. package/dist/queries/self-audit.js +1 -1
  247. package/dist/queries/similar-chains.js +1 -1
  248. package/dist/queries/similar-files.js +1 -1
  249. package/dist/queries/similar-signatures.js +1 -1
  250. package/dist/queries/similar.js +1 -1
  251. package/dist/queries/slice.js +1 -1
  252. package/dist/queries/source-inspection.js +1 -1
  253. package/dist/queries/source-search.js +1 -1
  254. package/dist/queries/stale-abstractions.js +1 -1
  255. package/dist/queries/surface.js +1 -1
  256. package/dist/queries/symbols.js +1 -1
  257. package/dist/queries/system-map.js +1 -1
  258. package/dist/queries/system.js +1 -1
  259. package/dist/queries/test-quality.js +1 -1
  260. package/dist/queries/trace.js +1 -1
  261. package/dist/queries/twin-ab.js +1 -1
  262. package/dist/queries/twin-drift.js +1 -1
  263. package/dist/queries/unused-imports.js +1 -1
  264. package/dist/queries/unused-params.js +1 -1
  265. package/dist/queries/value-flow.js +1 -1
  266. package/dist/queries/vue-component-duplicates.js +1 -1
  267. package/dist/queries/vue-composable-candidates.js +1 -1
  268. package/dist/queries/vue-large-view-pressure.js +1 -1
  269. package/dist/queries/wrapper-candidates.js +1 -1
  270. package/dist/reindex-worker.js +1 -1
  271. package/dist/reindex.js +30 -30
  272. package/dist/runtime.js +1 -1
  273. package/dist/rust-semantic-session-server.js +1 -1
  274. package/dist/rust-semantic-session-worker.js +1 -1
  275. package/dist/rust-semantic-worker.js +1 -1
  276. package/dist/sentinel-ensure-command-3MZCLPQY.js +2 -0
  277. package/dist/sentinel-ensure-command-LEWHIRLL.js +3 -0
  278. package/dist/sentinel-worker.js +1 -1
  279. package/dist/typescript-mailbox-worker.js +1 -1
  280. package/dist/watch-server.js +6 -6
  281. package/docs/COMMAND_REFERENCE.md +2 -2
  282. package/docs/SECURITY_MODEL.md +3 -0
  283. package/package.json +1 -1
  284. package/skills/codebaseiq/SKILL.md +15 -3
  285. package/dist/chunk-23C5AD3B.js +0 -2
  286. package/dist/chunk-2I2UHZET.js +0 -2
  287. package/dist/chunk-5IC2WZAL.js +0 -22
  288. package/dist/chunk-5T44HG5Y.js +0 -88
  289. package/dist/chunk-6JMAVFL4.js +0 -3
  290. package/dist/chunk-6WAPPQ5F.js +0 -82
  291. package/dist/chunk-7UCDGXRW.js +0 -8
  292. package/dist/chunk-AQI4N64O.js +0 -22
  293. package/dist/chunk-DAKIGMIK.js +0 -21
  294. package/dist/chunk-DUKHVPU5.js +0 -4
  295. package/dist/chunk-DVWO7RBC.js +0 -2
  296. package/dist/chunk-FH5WG4LE.js +0 -2
  297. package/dist/chunk-GQXXOS55.js +0 -2
  298. package/dist/chunk-GWYZVVKY.js +0 -21
  299. package/dist/chunk-JFIA2JI3.js +0 -3
  300. package/dist/chunk-JLZLLLW5.js +0 -3
  301. package/dist/chunk-MEUHIDI3.js +0 -7
  302. package/dist/chunk-OFGOOL6U.js +0 -3
  303. package/dist/chunk-P4NVCOM7.js +0 -2
  304. package/dist/chunk-SMDIEDM4.js +0 -27
  305. package/dist/chunk-SX72EVMY.js +0 -3
  306. package/dist/chunk-T5X7DK6C.js +0 -3
  307. package/dist/chunk-T75DS2E6.js +0 -21
  308. package/dist/chunk-TJBOJUVN.js +0 -3
  309. package/dist/chunk-UC2FD2PS.js +0 -4
  310. package/dist/chunk-UQYQBLJX.js +0 -5
  311. package/dist/chunk-Z35GOVEH.js +0 -2
  312. package/dist/cli-context-FJL2JHOE.js +0 -3
  313. package/dist/cli-context-PQNWHMCQ.js +0 -2
  314. package/dist/cli-program-UO7PZD6V.js +0 -7
  315. package/dist/direct-navigation-4XJTXIDT.js +0 -2
  316. package/dist/direct-navigation-J5MVYYAD.js +0 -3
  317. package/dist/invocation-command-descriptors-RWV4VAI4.js +0 -2
  318. package/dist/invocation-command-descriptors-U76PN7IY.js +0 -3
  319. package/dist/output-continuation-command-BL25S26S.js +0 -3
  320. package/dist/output-continuation-command-BTETTXEC.js +0 -2
  321. package/dist/project-reindex-CRJU3IFG.js +0 -2
  322. package/dist/project-reindex-TQFCOA2O.js +0 -3
  323. package/dist/sentinel-ensure-command-OSWGCFFL.js +0 -3
  324. package/dist/sentinel-ensure-command-SPW7XQLB.js +0 -2
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as Xi,Ba as ke,Ca as Y,E as an,aa as pr,fa as fr,g as qi,h as D,ha as ge,i as at,na as mr,oa as gr,pa as yr,qa as hr,u as ct,w as lt,x as Ki,z as Gi}from"./chunk-5T44HG5Y.js";import{r as st,x as sn,y as Wi}from"./chunk-DUKHVPU5.js";import{createHash as Fc}from"crypto";import{existsSync as Pc,mkdirSync as wc}from"fs";import{dirname as Qi,join as Lc}from"path";import Sr from"better-sqlite3";function Ji(){let e=new WeakMap;return{cache:e,ensure(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}}}function v(e,t){let{cache:n,ensure:r}=Ji(),i={get(o,s,a){let c=r(o);if(c.has(s))return c.get(s);let l=a();return c.set(s,l),l},invalidate(o,s){n.get(o)?.delete(s)},invalidateAll(o){n.delete(o)},size(o){return n.get(o)?.size??0}};return lt({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}function ye(e,t){let n=new WeakMap,r={get(i,o){let s=n.get(i);if(s)return s.value;let a=o();return n.set(i,{value:a}),a},invalidate(i){n.delete(i)},has(i){return n.has(i)}};return lt({name:e,groups:t.clearGroups,clearAll:i=>r.invalidate(i)}),r}var Tc={clearGroups:["whole-project","source-file"]};function De(e){return ze(e,Tc)}function ze(e,t){let{cache:n,ensure:r}=Ji(),i={get(o,s,a,c){let l=r(o),u=l.get(s);if(u&&u.source===a)return u.value;let d=c();return l.set(s,{source:a,value:d}),d},invalidate(o,s){n.get(o)?.delete(s)},invalidateAll(o){n.delete(o)}};return lt({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var kc="evidence.db";var Dc=["source-facts","callable-units","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],br=new Set(Dc),Ac=25e4,Oc=512*1024*1024,Mc=6e4,dt=new WeakMap;Ki({name:"evidence-connections",close:Zi});var $c=v("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),Bc=v("evidence-project-fingerprint",{clearGroups:["whole-project"]}),G="evidence-v1",ut="version NOT LIKE 'evidence-%'";function Ne(e){return Fc("sha256").update(e).digest("hex")}function he(e,t,n){return $c.get(e,t,()=>Ne(n))}function We(e){return Bc.get(e,"current",()=>{try{if(!e.generation.metadataRaw)return null;let t=an(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=t.metadata,r=[...n.indexedLanguages??[]].sort();return Ne(JSON.stringify({fingerprint:n.fingerprint,indexedLanguages:r,status:n.status}))}catch(t){return Ae("project fingerprint unavailable",t),null}})}function Ae(e,t){process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-cache: ${e}: ${t instanceof Error?t.message:String(t)}`)}function Ee(e){if(dt.has(e))return dt.get(e)??null;let t=null;try{let n=new Sr(ct(Lc(Qi(e.config.dbPath),kc)));n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 5000"),n.pragma("synchronous = NORMAL"),n.exec(`
2
+ import{$a as hr,A as Ji,E as an,La as pr,Qa as fr,Sa as ge,Ya as mr,Za as gr,_a as yr,g as Ki,h as D,i as ct,kb as ke,lb as Y,u as lt,w as ut,x as Gi,z as Xi}from"./chunk-AZDY3EKD.js";import{s as at,y as sn,z as qi}from"./chunk-KPMMOAV5.js";import{b as Wi}from"./chunk-Z2L5H2HF.js";import{createHash as Fc}from"crypto";import{existsSync as Pc,mkdirSync as wc}from"fs";import{dirname as Zi,join as Lc}from"path";import Sr from"better-sqlite3";function Qi(){let e=new WeakMap;return{cache:e,ensure(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}}}function v(e,t){let{cache:n,ensure:r}=Qi(),i={get(o,s,a){let c=r(o);if(c.has(s))return c.get(s);let l=a();return c.set(s,l),l},invalidate(o,s){n.get(o)?.delete(s)},invalidateAll(o){n.delete(o)},size(o){return n.get(o)?.size??0}};return ut({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}function ye(e,t){let n=new WeakMap,r={get(i,o){let s=n.get(i);if(s)return s.value;let a=o();return n.set(i,{value:a}),a},invalidate(i){n.delete(i)},has(i){return n.has(i)}};return ut({name:e,groups:t.clearGroups,clearAll:i=>r.invalidate(i)}),r}var Tc={clearGroups:["whole-project","source-file"]};function De(e){return ze(e,Tc)}function ze(e,t){let{cache:n,ensure:r}=Qi(),i={get(o,s,a,c){let l=r(o),u=l.get(s);if(u&&u.source===a)return u.value;let d=c();return l.set(s,{source:a,value:d}),d},invalidate(o,s){n.get(o)?.delete(s)},invalidateAll(o){n.delete(o)}};return ut({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var kc="evidence.db";var Dc=["source-facts","callable-units","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],br=new Set(Dc),Ac=25e4,Oc=512*1024*1024,Mc=6e4,We=new WeakMap;Gi({name:"evidence-connections",close:Yi});var $c=v("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),Bc=v("evidence-project-fingerprint",{clearGroups:["whole-project"]}),G="evidence-v1",dt="version NOT LIKE 'evidence-%'";function Ne(e){return Fc("sha256").update(e).digest("hex")}function he(e,t,n){return $c.get(e,t,()=>Ne(n))}function qe(e){return Bc.get(e,"current",()=>{try{if(!e.generation.metadataRaw)return null;let t=an(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=t.metadata,r=[...n.indexedLanguages??[]].sort();return Ne(JSON.stringify({fingerprint:n.fingerprint,indexedLanguages:r,status:n.status}))}catch(t){return Ae("project fingerprint unavailable",t),null}})}function Ae(e,t){process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-cache: ${e}: ${t instanceof Error?t.message:String(t)}`)}function Ee(e){if(We.has(e))return We.get(e)??null;if(Wi())return We.set(e,null),null;let t=null;try{let n=new Sr(lt(Lc(Zi(e.config.dbPath),kc)));n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 5000"),n.pragma("synchronous = NORMAL"),n.exec(`
3
3
  CREATE TABLE IF NOT EXISTS file_evidence (
4
4
  kind TEXT NOT NULL,
5
5
  relative_path TEXT NOT NULL,
@@ -34,28 +34,28 @@ import{A as Xi,Ba as ke,Ca as Y,E as an,aa as pr,fa as fr,g as qi,h as D,ha as g
34
34
  PRIMARY KEY (relative_path, symbol)
35
35
  );
36
36
  `),t={evidence:n,shared:jc(e.config.sharedEvidenceDbPath),readFileEvidence:n.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:n.prepare(`SELECT payload FROM file_evidence
37
- WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${ut}
37
+ WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${dt}
38
38
  ORDER BY version DESC
39
39
  LIMIT 1`),writeFileEvidence:n.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readProjectEvidence:n.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:n.prepare(`SELECT payload FROM project_evidence
40
- WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${ut}
40
+ WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${dt}
41
41
  ORDER BY version DESC
42
42
  LIMIT 1`),writeProjectEvidence:n.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:n.prepare(`SELECT payload FROM semantic_callees
43
43
  WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:n.prepare(`SELECT payload FROM semantic_callees
44
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${ut}
44
+ WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${dt}
45
45
  ORDER BY version DESC
46
46
  LIMIT 1`),readCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
47
47
  WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
48
- WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${ut}
48
+ WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${dt}
49
49
  ORDER BY symbol, version DESC`),writeCallees:n.prepare(`INSERT OR REPLACE INTO semantic_callees
50
50
  (relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:n.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:n.prepare(`SELECT payload FROM semantic_references
51
51
  WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:n.prepare(`SELECT payload FROM semantic_references
52
- WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${ut}
52
+ WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${dt}
53
53
  ORDER BY version DESC
54
54
  LIMIT 1`),readReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
55
55
  WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
56
- WHERE relative_path = ? AND project_fingerprint = ? AND ${ut}
56
+ WHERE relative_path = ? AND project_fingerprint = ? AND ${dt}
57
57
  ORDER BY symbol, version DESC`),writeReferences:n.prepare(`INSERT OR REPLACE INTO semantic_references
58
- (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:n.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?")}}catch(n){Ae("disabled (open failed)",n)}return dt.set(e,t),t}function Ie(e,t,n){Ae(`disabled (${t})`,n);try{Zi(e)}catch(r){Ae("close failed while disabling",r)}dt.set(e,null)}function Zi(e){let t=dt.get(e);if(dt.delete(e),!t)return;let n,r;try{t.shared?.evidence.close()}catch(i){n=i}try{t.evidence.close()}catch(i){r=i}if(n!==void 0&&r!==void 0)throw new AggregateError([n,r],"Shared and project evidence connections failed to close.");if(n!==void 0)throw n;if(r!==void 0)throw r}function jc(e){if(!e)return null;try{wc(Qi(e),{recursive:!0});let t=new Sr(ct(e));return t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 250"),t.pragma("synchronous = NORMAL"),t.exec(`
58
+ (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:n.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?")}}catch(n){Ae("disabled (open failed)",n)}return We.set(e,t),t}function Ie(e,t,n){Ae(`disabled (${t})`,n);try{Yi(e)}catch(r){Ae("close failed while disabling",r)}We.set(e,null)}function Yi(e){let t=We.get(e);if(We.delete(e),!t)return;let n,r;try{t.shared?.evidence.close()}catch(i){n=i}try{t.evidence.close()}catch(i){r=i}if(n!==void 0&&r!==void 0)throw new AggregateError([n,r],"Shared and project evidence connections failed to close.");if(n!==void 0)throw n;if(r!==void 0)throw r}function jc(e){if(!e)return null;try{wc(Zi(e),{recursive:!0});let t=new Sr(lt(e));return t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 250"),t.pragma("synchronous = NORMAL"),t.exec(`
59
59
  CREATE TABLE IF NOT EXISTS file_evidence (
60
60
  kind TEXT NOT NULL,
61
61
  relative_path TEXT NOT NULL,
@@ -73,48 +73,48 @@ import{A as Xi,Ba as ke,Ca as Y,E as an,aa as pr,fa as fr,g as qi,h as D,ha as g
73
73
  DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`),touchFileEvidence:t.prepare(`UPDATE file_evidence
74
74
  SET last_accessed_at = ?
75
75
  WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?
76
- AND last_accessed_at < ?`)}}catch(t){return Ae("shared cache disabled (open failed)",t),null}}function xr(e,t,n){Ae(`shared cache disabled (${t})`,n);try{e.shared?.evidence.close()}catch{}e.shared=null}function BS(e,t={}){if(!Pc(e))return null;let n;try{n=new Sr(ct(e)),n.pragma("busy_timeout = 50"),n.exec(`CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
76
+ AND last_accessed_at < ?`)}}catch(t){return Ae("shared cache disabled (open failed)",t),null}}function xr(e,t,n){Ae(`shared cache disabled (${t})`,n);try{e.shared?.evidence.close()}catch{}e.shared=null}function US(e,t={}){if(!Pc(e))return null;let n;try{n=new Sr(lt(e)),n.pragma("busy_timeout = 50"),n.exec(`CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
77
77
  ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version)`),n.pragma("wal_checkpoint(TRUNCATE)");let r=n.prepare("SELECT COUNT(*) AS count FROM file_evidence").get().count,i=t.maxRows??Ac,o=t.budgetBytes??Oc,s=Number(n.pragma("page_size",{simple:!0})),a=Number(n.pragma("page_count",{simple:!0})),c=Number(n.pragma("freelist_count",{simple:!0})),l=Math.max(0,a-c)*s,u=r>0&&l>o?Math.min(r,Math.ceil((l-o)/Math.max(1,l/r))):0,d=Math.max(r-i,u);return d>0&&(n.prepare(`DELETE FROM file_evidence WHERE rowid IN (
78
78
  SELECT rowid FROM file_evidence ORDER BY last_accessed_at ASC, rowid ASC LIMIT ?
79
- )`).run(d),n.pragma("wal_checkpoint(TRUNCATE)")),{deletedRows:d,remainingRows:r-d}}catch(r){return Ae("shared cache maintenance skipped",r),null}finally{try{n?.close()}catch{}}}function Yi(e,t,n,r){let i=Ee(e);if(!i)return null;try{let o=i.readFileEvidence.get(t,n,r,G)??i.readLegacyFileEvidence.get(t,n,r);if(o?.payload!==void 0)return o.payload;if(!br.has(t)||!i.shared)return null;try{let s=i.shared.readFileEvidence.get(t,n,r,G);return s?.payload!==void 0&&Vc(i.shared,t,n,r),s?.payload??null}catch(s){return xr(i,"file_evidence read",s),null}}catch(o){return Ie(e,"file_evidence read",o),null}}function Vc(e,t,n,r){let i=Date.now();try{e.touchFileEvidence.run(i,t,n,r,G,i-Mc)}catch(o){Ae("shared file_evidence recency touch skipped",o)}}function eo(e,t,n,r,i){let o=Ee(e);if(o)try{if(o.writeFileEvidence.run(t,n,r,G,i),br.has(t)&&o.shared)try{o.shared.writeFileEvidence.run(t,n,r,G,i,Date.now())}catch(s){xr(o,"file_evidence write",s)}}catch(s){Ie(e,"file_evidence write",s)}}function to(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{for(let i of t)n.writeFileEvidence.run(i.kind,i.relativePath,i.contentHash,G,i.payload)})();let r=t.filter(i=>br.has(i.kind));if(r.length>0&&n.shared)try{n.shared.evidence.transaction(()=>{for(let i of r)n.shared.writeFileEvidence.run(i.kind,i.relativePath,i.contentHash,G,i.payload,Date.now())})()}catch(i){xr(n,"file_evidence batch write",i)}}catch(r){Ie(e,"file_evidence batch write",r)}}function no(e,t,n,r){let i=Ee(e);if(!i)return null;try{return(i.readProjectEvidence.get(t,n,r,G)??i.readLegacyProjectEvidence.get(t,n,r))?.payload??null}catch(o){return Ie(e,"project_evidence read",o),null}}function ro(e,t,n,r,i){let o=Ee(e);if(o)try{o.writeProjectEvidence.run(t,n,r,G,i)}catch(s){Ie(e,"project_evidence write",s)}}function jS(e,t,n,r){let i=Ee(e);if(!i)return new Map;try{let o=i.readCalleesForFile.all(t,n,r,G),s=i.readLegacyCalleesForFile.all(t,n,r);return io([...s,...o])}catch(o){return Ie(e,"semantic_callees bulk read",o),new Map}}function VS(e,t,n){let r=Ee(e);if(!r)return new Map;try{let i=r.readReferencesForFile.all(t,n,G),o=r.readLegacyReferencesForFile.all(t,n);return io([...o,...i])}catch(i){return Ie(e,"semantic_references bulk read",i),new Map}}function io(e){let t=new Map;for(let n of e)t.set(n.symbol,n.payload);return t}function US(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{let r=new Set;for(let i of t){let o=`${i.relativePath}\0${i.contentHash}`;r.has(o)||(r.add(o),n.dropStaleCallees.run(i.relativePath,i.contentHash)),n.writeCallees.run(i.relativePath,i.symbol,i.contentHash,i.depsDigest,G,i.payload)}})()}catch(r){Ie(e,"semantic_callees write",r)}}function HS(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{let r=new Set;for(let i of t){let o=`${i.relativePath}\0${i.projectFingerprint}`;r.has(o)||(r.add(o),n.dropStaleReferences.run(i.relativePath,i.projectFingerprint)),n.writeReferences.run(i.relativePath,i.symbol,i.projectFingerprint,G,i.payload)}})()}catch(r){Ie(e,"semantic_references write",r)}}import{basename as oo}from"path";var Uc=v("indexed-document-paths",{clearGroups:["whole-project"]});function ee(e,t={}){let n=Hc(t);return[...Uc.get(e,n,()=>{let i=t.scope?"AND relative_path LIKE ?":"",o=t.like?"AND relative_path LIKE ?":"",s=[...t.scope?[`%${t.scope}%`]:[],...t.like?[t.like]:[]],a=e.all(`SELECT relative_path
79
+ )`).run(d),n.pragma("wal_checkpoint(TRUNCATE)")),{deletedRows:d,remainingRows:r-d}}catch(r){return Ae("shared cache maintenance skipped",r),null}finally{try{n?.close()}catch{}}}function eo(e,t,n,r){let i=Ee(e);if(!i)return null;try{let o=i.readFileEvidence.get(t,n,r,G)??i.readLegacyFileEvidence.get(t,n,r);if(o?.payload!==void 0)return o.payload;if(!br.has(t)||!i.shared)return null;try{let s=i.shared.readFileEvidence.get(t,n,r,G);return s?.payload!==void 0&&Vc(i.shared,t,n,r),s?.payload??null}catch(s){return xr(i,"file_evidence read",s),null}}catch(o){return Ie(e,"file_evidence read",o),null}}function Vc(e,t,n,r){let i=Date.now();try{e.touchFileEvidence.run(i,t,n,r,G,i-Mc)}catch(o){Ae("shared file_evidence recency touch skipped",o)}}function to(e,t,n,r,i){let o=Ee(e);if(o)try{if(o.writeFileEvidence.run(t,n,r,G,i),br.has(t)&&o.shared)try{o.shared.writeFileEvidence.run(t,n,r,G,i,Date.now())}catch(s){xr(o,"file_evidence write",s)}}catch(s){Ie(e,"file_evidence write",s)}}function no(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{for(let i of t)n.writeFileEvidence.run(i.kind,i.relativePath,i.contentHash,G,i.payload)})();let r=t.filter(i=>br.has(i.kind));if(r.length>0&&n.shared)try{n.shared.evidence.transaction(()=>{for(let i of r)n.shared.writeFileEvidence.run(i.kind,i.relativePath,i.contentHash,G,i.payload,Date.now())})()}catch(i){xr(n,"file_evidence batch write",i)}}catch(r){Ie(e,"file_evidence batch write",r)}}function ro(e,t,n,r){let i=Ee(e);if(!i)return null;try{return(i.readProjectEvidence.get(t,n,r,G)??i.readLegacyProjectEvidence.get(t,n,r))?.payload??null}catch(o){return Ie(e,"project_evidence read",o),null}}function io(e,t,n,r,i){let o=Ee(e);if(o)try{o.writeProjectEvidence.run(t,n,r,G,i)}catch(s){Ie(e,"project_evidence write",s)}}function HS(e,t,n,r){let i=Ee(e);if(!i)return new Map;try{let o=i.readCalleesForFile.all(t,n,r,G),s=i.readLegacyCalleesForFile.all(t,n,r);return oo([...s,...o])}catch(o){return Ie(e,"semantic_callees bulk read",o),new Map}}function zS(e,t,n){let r=Ee(e);if(!r)return new Map;try{let i=r.readReferencesForFile.all(t,n,G),o=r.readLegacyReferencesForFile.all(t,n);return oo([...o,...i])}catch(i){return Ie(e,"semantic_references bulk read",i),new Map}}function oo(e){let t=new Map;for(let n of e)t.set(n.symbol,n.payload);return t}function WS(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{let r=new Set;for(let i of t){let o=`${i.relativePath}\0${i.contentHash}`;r.has(o)||(r.add(o),n.dropStaleCallees.run(i.relativePath,i.contentHash)),n.writeCallees.run(i.relativePath,i.symbol,i.contentHash,i.depsDigest,G,i.payload)}})()}catch(r){Ie(e,"semantic_callees write",r)}}function qS(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{let r=new Set;for(let i of t){let o=`${i.relativePath}\0${i.projectFingerprint}`;r.has(o)||(r.add(o),n.dropStaleReferences.run(i.relativePath,i.projectFingerprint)),n.writeReferences.run(i.relativePath,i.symbol,i.projectFingerprint,G,i.payload)}})()}catch(r){Ie(e,"semantic_references write",r)}}import{basename as so}from"path";var Uc=v("indexed-document-paths",{clearGroups:["whole-project"]});function ee(e,t={}){let n=Hc(t);return[...Uc.get(e,n,()=>{let i=t.scope?"AND relative_path LIKE ?":"",o=t.like?"AND relative_path LIKE ?":"",s=[...t.scope?[`%${t.scope}%`]:[],...t.like?[t.like]:[]],a=e.all(`SELECT relative_path
80
80
  FROM documents
81
81
  WHERE 1 = 1
82
82
  ${e.pathExclusionsFor("documents")}
83
83
  ${i}
84
84
  ${o}
85
- ORDER BY relative_path`,...s).map(l=>l.relative_path),c=t.extensions?a.filter(l=>t.extensions.some(u=>l.toLowerCase().endsWith(u.toLowerCase()))):a;return t.includeIgnored===!1?c.filter(l=>!e.isIgnored(l)):c})]}function Hc(e){let t=e.extensions?[...new Set(e.extensions.map(n=>n.toLowerCase()))].sort():null;return JSON.stringify({scope:e.scope??null,like:e.like??null,extensions:t,includeIgnored:e.includeIgnored!==!1})}function ao(e,t,n){let r=co(t);if(!r)return[];let i=e.all(`SELECT relative_path
85
+ ORDER BY relative_path`,...s).map(l=>l.relative_path),c=t.extensions?a.filter(l=>t.extensions.some(u=>l.toLowerCase().endsWith(u.toLowerCase()))):a;return t.includeIgnored===!1?c.filter(l=>!e.isIgnored(l)):c})]}function Hc(e){let t=e.extensions?[...new Set(e.extensions.map(n=>n.toLowerCase()))].sort():null;return JSON.stringify({scope:e.scope??null,like:e.like??null,extensions:t,includeIgnored:e.includeIgnored!==!1})}function co(e,t,n){let r=lo(t);if(!r)return[];let i=e.all(`SELECT relative_path
86
86
  FROM documents
87
87
  WHERE relative_path = ?
88
- ${e.pathExclusionsFor("documents")}`,r).filter(c=>!e.isIgnored(c.relative_path)).map(c=>({relativePath:c.relative_path,score:so(c.relative_path,r)}));if(i.length>0)return i;let o=ee(e,{includeIgnored:!1}).map(c=>({relativePath:c,score:so(c,r)})).filter(c=>c.score>0).sort((c,l)=>l.score-c.score||c.relativePath.localeCompare(l.relativePath)),s=o.filter(c=>c.score>=1100);if(s.length>0)return n.allowMultiple?s:[s[0]];let a=o.filter(c=>c.score>=800);return a.length>0?n.allowMultiple?a:[a[0]]:n.allowMultiple?o:o.slice(0,1)}function so(e,t){let n=co(e),r=oo(n),i=oo(t),o=0;return n===t&&(o+=1200),n.endsWith(`/${t}`)&&(o+=1100),r===i&&(o+=900),n.startsWith(`${t}/`)&&(o+=850),n.includes(t)&&(o+=250),o}function co(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}import{extname as lo}from"path";var zc={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function H(e){return zc[lo(e).toLowerCase()]??null}function Se(e){return lo(e).toLowerCase()===".vue"}import{createRequire as Wc}from"module";var V=Wc(import.meta.url),Ft=null,vr=!1;function uo(){if(vr)return null;if(Ft)return Ft;try{return Ft=V("tree-sitter"),Ft}catch{return vr=!0,null}}function QS(e){if(e==="clojure")return"reader";let t=uo();if(!t)return"unavailable";let n=po(e);if(!n)return"unavailable";try{return new t().setLanguage(n),"ast"}catch{return pt.add(e),"unavailable"}}var Nr=new Map,pt=new Set;function po(e){if(pt.has(e))return null;let t=Nr.get(e);if(t)return t;let n;try{switch(e){case"rust":n=V("tree-sitter-rust");break;case"typescript":n=V("tree-sitter-typescript").typescript;break;case"tsx":n=V("tree-sitter-typescript").tsx;break;case"javascript":n=V("tree-sitter-javascript");break;case"python":n=V("tree-sitter-python");break;case"java":n=V("tree-sitter-java");break;case"kotlin":n=V("tree-sitter-kotlin");break;case"scala":n=V("tree-sitter-scala");break;case"ruby":n=V("tree-sitter-ruby");break;case"c":n=V("tree-sitter-c");break;case"cpp":n=V("tree-sitter-cpp");break;case"csharp":n=V("tree-sitter-c-sharp");break;case"php":n=V("tree-sitter-php").php;break;case"vb":{let r=V("tree-sitter-vb-dotnet");n=r.language??r;break}case"clojure":return pt.add(e),null}}catch{return pt.add(e),null}return Nr.set(e,n),n}var Er=new Map;function ZS(){Ft=null,vr=!1,Nr.clear(),pt.clear(),Er.clear(),Gc.clear()}function qc(e){let t=Er.get(e);if(t)return t;let n=po(e);if(!n)return null;let r=uo();if(!r)return null;let i=new r;try{i.setLanguage(n)}catch{return pt.add(e),null}return Er.set(e,i),i}function Kc(e,t){return e.parse(r=>r>=t.length?null:t.slice(r,Math.min(t.length,r+16384)))}function qe(e,t){let n=qc(e);if(!n)return null;try{return Kc(n,t)}catch{return null}}var Gc=new Map;var Xc=v("source-text",{clearGroups:["whole-project","source-file"]}),Jc=v("source-lines",{clearGroups:["whole-project","source-file"]});function x(e,t){let n=t.replace(/\\/g,"/");return Xc.get(e,n,()=>{try{return yr(e.config.projectRoot,n,{inputKind:"indexed source file"})}catch(r){if(hr(r))return"";throw r}})}function Pt(e,t){let n=t.replace(/\\/g,"/");return Jc.get(e,n,()=>{let r=x(e,n);return r?r.split(`
89
- `):[]})}var Qc=/^\s*(?:\/\/|#|\/\*+|\*)\s*codebaseiq[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function Zc(e){let t=Qc.exec(e);return t?t[1]??"":null}function nb(e,t,n){return fo(e,t,n).length>0}function rb(e,t,n,r){let i=r.toLowerCase();return fo(e,t,n).some(o=>o.toLowerCase()===i)}function fo(e,t,n){if(n<=0)return[];let r=Pt(e,t);if(r.length===0)return[];let i=[];for(let o=n-1;o>=0&&o>=n-5;o-=1){let s=(r[o]??"").trim();if(s==="")continue;let a=Zc(s);if(a!==null){i.push(a);continue}if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return i}return i}import{posix as Ir}from"path";import{parse as Yc}from"@vue/compiler-sfc";var el=De("vue-sfc-units");function ft(e,t){let n=yo(t),r=x(e,n);return el.get(e,n,r,()=>Cr(e,n,r))}function yo(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function tl(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function Ke(e){return!e||e.body.length===0?0:e.body.split(`
90
- `).length}function Cr(e,t,n){let r={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!n)return r;let i;try{i=Yc(n,{filename:t})}catch(s){return r.errors.push(go(s)),r}r.errors.push(...i.errors.map(go));let{descriptor:o}=i;return o.template&&(r.template=cn(e,t,"template",o.template)),o.script&&r.scripts.push(mo(e,t,o.script,!1)),o.scriptSetup&&r.scripts.push(mo(e,t,o.scriptSetup,!0)),r.styles=o.styles.map(s=>cn(e,t,"style",s)),r.customBlocks=o.customBlocks.map(s=>cn(e,t,"custom",s)),r.errors.push(...[r.template,...r.scripts,...r.styles,...r.customBlocks].flatMap(s=>s?.errors??[])),r}function mo(e,t,n,r){let i=cn(e,t,"script",n);return{...i,kind:"script",setup:r,astLanguage:tl(i.lang)}}function cn(e,t,n,r){let i=rl(r.attrs),o=typeof i.lang=="string"?i.lang:null,s=typeof i.src=="string"?i.src:typeof r.src=="string"?r.src:void 0;if(s){let c=nl(t,s);if(!c)return{kind:n,ownerPath:t,sourcePath:t,external:!0,src:s,attrs:i,lang:o,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${n} block source: ${s}`]};let l=x(e,c),u=l?Math.max(0,l.split(`
91
- `).length-1):0;return{kind:n,ownerPath:t,sourcePath:c,external:!0,src:s,attrs:i,lang:o,body:l,startLine:0,endLine:u,errors:l?[]:[`Vue ${n} block source not found: ${c}`]}}let a=Math.max(0,r.loc.start.line-1);return{kind:n,ownerPath:t,sourcePath:t,external:!1,attrs:i,lang:o,body:r.content,startLine:a,endLine:Math.max(a,r.loc.end.line-1),errors:[]}}function nl(e,t){let n=t.split(/[?#]/,1)[0];if(!n||n.startsWith("/")||n.includes("://"))return null;let r=yo(Ir.normalize(Ir.join(Ir.dirname(e),n)));return r===".."||r.startsWith("../")?null:r}function rl(e){return{...e}}function go(e){return e instanceof Error?e.message:String(e)}function wt(e,t,n){let i=Cr(e,t,n).scripts.filter(s=>s.astLanguage&&s.body.length>0),o=i[0]?.astLanguage;return o?{body:i.map(s=>`${`
88
+ ${e.pathExclusionsFor("documents")}`,r).filter(c=>!e.isIgnored(c.relative_path)).map(c=>({relativePath:c.relative_path,score:ao(c.relative_path,r)}));if(i.length>0)return i;let o=ee(e,{includeIgnored:!1}).map(c=>({relativePath:c,score:ao(c,r)})).filter(c=>c.score>0).sort((c,l)=>l.score-c.score||c.relativePath.localeCompare(l.relativePath)),s=o.filter(c=>c.score>=1100);if(s.length>0)return n.allowMultiple?s:[s[0]];let a=o.filter(c=>c.score>=800);return a.length>0?n.allowMultiple?a:[a[0]]:n.allowMultiple?o:o.slice(0,1)}function ao(e,t){let n=lo(e),r=so(n),i=so(t),o=0;return n===t&&(o+=1200),n.endsWith(`/${t}`)&&(o+=1100),r===i&&(o+=900),n.startsWith(`${t}/`)&&(o+=850),n.includes(t)&&(o+=250),o}function lo(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}import{extname as uo}from"path";var zc={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function H(e){return zc[uo(e).toLowerCase()]??null}function Se(e){return uo(e).toLowerCase()===".vue"}import{createRequire as Wc}from"module";var V=Wc(import.meta.url),Ft=null,vr=!1;function po(){if(vr)return null;if(Ft)return Ft;try{return Ft=V("tree-sitter"),Ft}catch{return vr=!0,null}}function eb(e){if(e==="clojure")return"reader";let t=po();if(!t)return"unavailable";let n=fo(e);if(!n)return"unavailable";try{return new t().setLanguage(n),"ast"}catch{return pt.add(e),"unavailable"}}var Nr=new Map,pt=new Set;function fo(e){if(pt.has(e))return null;let t=Nr.get(e);if(t)return t;let n;try{switch(e){case"rust":n=V("tree-sitter-rust");break;case"typescript":n=V("tree-sitter-typescript").typescript;break;case"tsx":n=V("tree-sitter-typescript").tsx;break;case"javascript":n=V("tree-sitter-javascript");break;case"python":n=V("tree-sitter-python");break;case"java":n=V("tree-sitter-java");break;case"kotlin":n=V("tree-sitter-kotlin");break;case"scala":n=V("tree-sitter-scala");break;case"ruby":n=V("tree-sitter-ruby");break;case"c":n=V("tree-sitter-c");break;case"cpp":n=V("tree-sitter-cpp");break;case"csharp":n=V("tree-sitter-c-sharp");break;case"php":n=V("tree-sitter-php").php;break;case"vb":{let r=V("tree-sitter-vb-dotnet");n=r.language??r;break}case"clojure":return pt.add(e),null}}catch{return pt.add(e),null}return Nr.set(e,n),n}var Er=new Map;function tb(){Ft=null,vr=!1,Nr.clear(),pt.clear(),Er.clear(),Gc.clear()}function qc(e){let t=Er.get(e);if(t)return t;let n=fo(e);if(!n)return null;let r=po();if(!r)return null;let i=new r;try{i.setLanguage(n)}catch{return pt.add(e),null}return Er.set(e,i),i}function Kc(e,t){return e.parse(r=>r>=t.length?null:t.slice(r,Math.min(t.length,r+16384)))}function Ke(e,t){let n=qc(e);if(!n)return null;try{return Kc(n,t)}catch{return null}}var Gc=new Map;var Xc=v("source-text",{clearGroups:["whole-project","source-file"]}),Jc=v("source-lines",{clearGroups:["whole-project","source-file"]});function x(e,t){let n=t.replace(/\\/g,"/");return Xc.get(e,n,()=>{try{return yr(e.config.projectRoot,n,{inputKind:"indexed source file"})}catch(r){if(hr(r))return"";throw r}})}function Pt(e,t){let n=t.replace(/\\/g,"/");return Jc.get(e,n,()=>{let r=x(e,n);return r?r.split(`
89
+ `):[]})}var Qc=/^\s*(?:\/\/|#|\/\*+|\*)\s*codebaseiq[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function Zc(e){let t=Qc.exec(e);return t?t[1]??"":null}function ob(e,t,n){return mo(e,t,n).length>0}function sb(e,t,n,r){let i=r.toLowerCase();return mo(e,t,n).some(o=>o.toLowerCase()===i)}function mo(e,t,n){if(n<=0)return[];let r=Pt(e,t);if(r.length===0)return[];let i=[];for(let o=n-1;o>=0&&o>=n-5;o-=1){let s=(r[o]??"").trim();if(s==="")continue;let a=Zc(s);if(a!==null){i.push(a);continue}if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return i}return i}import{posix as Ir}from"path";import{parse as Yc}from"@vue/compiler-sfc";var el=De("vue-sfc-units");function ft(e,t){let n=ho(t),r=x(e,n);return el.get(e,n,r,()=>Cr(e,n,r))}function ho(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function tl(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function Ge(e){return!e||e.body.length===0?0:e.body.split(`
90
+ `).length}function Cr(e,t,n){let r={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!n)return r;let i;try{i=Yc(n,{filename:t})}catch(s){return r.errors.push(yo(s)),r}r.errors.push(...i.errors.map(yo));let{descriptor:o}=i;return o.template&&(r.template=cn(e,t,"template",o.template)),o.script&&r.scripts.push(go(e,t,o.script,!1)),o.scriptSetup&&r.scripts.push(go(e,t,o.scriptSetup,!0)),r.styles=o.styles.map(s=>cn(e,t,"style",s)),r.customBlocks=o.customBlocks.map(s=>cn(e,t,"custom",s)),r.errors.push(...[r.template,...r.scripts,...r.styles,...r.customBlocks].flatMap(s=>s?.errors??[])),r}function go(e,t,n,r){let i=cn(e,t,"script",n);return{...i,kind:"script",setup:r,astLanguage:tl(i.lang)}}function cn(e,t,n,r){let i=rl(r.attrs),o=typeof i.lang=="string"?i.lang:null,s=typeof i.src=="string"?i.src:typeof r.src=="string"?r.src:void 0;if(s){let c=nl(t,s);if(!c)return{kind:n,ownerPath:t,sourcePath:t,external:!0,src:s,attrs:i,lang:o,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${n} block source: ${s}`]};let l=x(e,c),u=l?Math.max(0,l.split(`
91
+ `).length-1):0;return{kind:n,ownerPath:t,sourcePath:c,external:!0,src:s,attrs:i,lang:o,body:l,startLine:0,endLine:u,errors:l?[]:[`Vue ${n} block source not found: ${c}`]}}let a=Math.max(0,r.loc.start.line-1);return{kind:n,ownerPath:t,sourcePath:t,external:!1,attrs:i,lang:o,body:r.content,startLine:a,endLine:Math.max(a,r.loc.end.line-1),errors:[]}}function nl(e,t){let n=t.split(/[?#]/,1)[0];if(!n||n.startsWith("/")||n.includes("://"))return null;let r=ho(Ir.normalize(Ir.join(Ir.dirname(e),n)));return r===".."||r.startsWith("../")?null:r}function rl(e){return{...e}}function yo(e){return e instanceof Error?e.message:String(e)}function wt(e,t,n){let i=Cr(e,t,n).scripts.filter(s=>s.astLanguage&&s.body.length>0),o=i[0]?.astLanguage;return o?{body:i.map(s=>`${`
92
92
  `.repeat(s.startLine)}${s.body}`).join(`
93
- `),startLine:0,language:o}:null}var ho=ze("ast-trees",{clearGroups:["whole-project","source-file"]});function R(e,t){if(Se(t))return il(e,t);let n=H(t);if(!n)return null;let r=x(e,t);return r?ho.get(e,t,r,()=>qe(n,r)):null}function Lt(e,t,n){if(Se(t)){let o=wt(e,t,n);if(!o)return null;let s=qe(o.language,`
94
- `.repeat(o.startLine)+o.body);return s?{tree:s,language:o.language}:null}let r=H(t);if(!r)return null;let i=qe(r,n);return i?{tree:i,language:r}:null}function il(e,t){let n=x(e,t);return n?ho.get(e,t,n,()=>{let r=wt(e,t,n);if(!r)return null;let i=`
95
- `.repeat(r.startLine)+r.body;return qe(r.language,i)}):null}function mt(e,t){let n=sl(e,t);if(!n)return null;let r=Ce(n);if(!r)return null;let i=al(n);return{calleeLeaf:r,calleeQualifier:i?ol(n):void 0,calleeText:n.text,memberAccess:i,line:e.startPosition.row}}function ol(e){return(e.childForFieldName("object")??e.childForFieldName("value")??e.namedChild(0)??void 0)?.text||void 0}function sl(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function al(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function Ce(e){switch(e.type){case"identifier":case"type_identifier":case"field_identifier":case"property_identifier":case"private_property_identifier":case"shorthand_property_identifier":return e.text.replace(/^#/u,"");case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?Ce(t):null}case"generic_function":{let t=e.childForFieldName("function")??e.namedChild(0);return t?Ce(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?Ce(t):null}case"super":case"self":case"this":return null;default:return null}}var cl=[U("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),U("callable-units",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/source/callable-units.test.ts",owner:"src/source/facts/callable-units.ts"}),U("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),U("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),U("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),U("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),U("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),U("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),U("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),U("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),U("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),U("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),U("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),U("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),U("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),ln("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function le(e){let t=new Map;return{kind:e.kind,read(n,r,i){let o=!1,s=0,a;if(pr()){let c=We(n);if(c){let l=`${c}\0${r}\0${i}`;a=t.get(l),a||(a=fr(["evidence-product-file-read-v1",e.kind,c,r,i]),t.set(l,a))}}return ge("evidence-product.file.read",()=>{let c=Yi(n,e.kind,r,i);if(c===null)return null;s=c.length;try{let l=e.deserialize(c);return o=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:o,payloadBytes:s}))},write(n,r,i,o){eo(n,e.kind,r,i,e.serialize(o))},writeBatch(n,r){to(n,r.map(i=>({kind:e.kind,relativePath:i.relativePath,contentHash:i.contentHash,payload:e.serialize(i.value)})))}}}function So(e){let t=new Map;return{kind:e.kind,read(n,r,i){let o=!1,s=0,a;if(pr()){let c=`${i}\0${r}`;a=t.get(c),a||(a=fr(["evidence-product-project-read-v1",e.kind,i,r]),t.set(c,a))}return ge("evidence-product.project.read",()=>{let c=no(n,e.kind,r,i);if(c===null)return null;s=c.length;try{let l=e.deserialize(c);return o=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:o,payloadBytes:s}))},write(n,r,i,o){ro(n,e.kind,r,i,e.serialize(o))}}}function X(e){let t=cl.find(n=>n.kind===e);if(!t)throw new Error(`missing evidence product manifest entry for ${e}`);return t.invalidation}function U(e,t){return{scope:"file",kind:e,invalidation:{scope:"file",...t}}}function ln(e,t){return{scope:"project",kind:e,invalidation:{scope:"project",...t}}}function kt(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var ll=new Set(["function_declaration","generator_function_declaration","method_definition","method_signature","function_signature"]),bo=new Set(["arrow_function","function_expression","generator_function"]);function ul(e,t){let n=ml(e,t);if(n)return n;if(!fl(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(i=>i.type==="identifier"||i.type==="property_identifier");return r?{name:r.text,definitionNode:e,functionNode:e}:null}function un(e,t){let n=ul(e,t);if(!n)return null;let{definitionNode:r,functionNode:i}=n;return{name:n.name,startLine:r.startPosition.row,endLine:r.endPosition.row,paramCount:gl(i),params:dl(i),paramsEndLine:pl(i),isLiteralPassthrough:yl(i,t)}}function vo(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function dl(e){let t=vo(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(kt(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let i=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),o=r.childForFieldName("pattern");if(!i&&o&&o.type==="identifier"){n.push({name:o.text,simple:!0});continue}let s=r.namedChildren.find(a=>a.type==="identifier");n.push({name:o?.type==="identifier"?o.text:s?.text??"",simple:!1})}return n}function pl(e){let t=vo(e);return t?t.endPosition.row:e.startPosition.row}function fl(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?ll.has(e):!1}function ml(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let i=xo(r);return i?{name:n.text,definitionNode:e,functionNode:i}:null}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let i=xo(r);return i?{name:n.text,definitionNode:e,functionNode:i}:null}return null}function xo(e){if(bo.has(e.type))return e;if(e.type!=="call_expression"||(e.childForFieldName("function")??e.namedChild(0))?.type!=="call_expression")return null;let r=((e.childForFieldName("arguments")??e.namedChildren.find(i=>i.type==="arguments"))?.namedChildren??[]).filter(i=>bo.has(i.type));return r.length===1?r[0]:null}function gl(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)kt(r)||(n+=1);return n}function yl(e,t){let n=e.namedChildren.find(d=>d.type==="block"||d.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(d=>!kt(d));if(r.length!==1)return!1;let i=r[0],o=null;if(i.type==="return_statement"||i.type==="expression_statement"?o=i.namedChild(0)??null:t==="rust"&&(i.type==="call_expression"||i.type==="macro_invocation")&&(o=i),!o)return!1;let s=t==="python"?"call":"call_expression";if(o.type!==s)return!1;let a=o.namedChildren.find(d=>d.type==="arguments"||d.type==="argument_list");if(!a)return!1;let c=a.namedChildren.filter(d=>!kt(d)),l=e.namedChildren.find(d=>d.type==="parameters"||d.type==="formal_parameters");if(!l)return!1;let u=[];for(let d of l.namedChildren){if(d.type==="identifier"){u.push(d.text);continue}let p=d.namedChildren.find(f=>f.type==="identifier");p&&u.push(p.text)}if(c.length!==u.length)return!1;for(let d=0;d<u.length;d+=1){let p=c[d];if(p.type!=="identifier"||p.text!==u[d])return!1}return!0}var hl=new Set(["identifier","type_identifier","field_identifier"]),Sl=new Set(["identifier"]),bl=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),xl=new Set(["rust","python"]),vl=/\{([^{}]*)\}/g,Nl=/\b([A-Za-z_][\w]*)\b/g;function No(e,t){return El(t).has(e.type)}function Eo(e,t){return xl.has(t)&&e.type==="string_content"}function _r(e){let t=0;for(let r of e.values()){let i=r[r.length-1];i!==void 0&&i>t&&(t=i)}let n=new Array(t+1);for(let r=0;r<=t;r+=1)n[r]=new Set;for(let[r,i]of e)for(let o of i)n[o].add(r);return n}function El(e){return e==="rust"?hl:e==="python"?Sl:bl}function Io(e,t){let n=e.startPosition.row;for(let r of e.text.matchAll(vl)){let i=r[1]??"";for(let o of i.matchAll(Nl))o[1]&&t(o[1],n)}}var Il=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],Cl=/^#!?\[\s*serde\s*\(/,_l=/^#!?\[\s*schemars\s*\(/,Rl=/^#!?\[\s*validate\s*\(/,Tl=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function Co(e,t,n){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript"||e.type!=="call_expression")return;let r=e.childForFieldName("function")??e.namedChild(0);if(!r)return;let i=Ce(r);if(!i||!Tl.has(i))return;let o=e.namedChildren.find(c=>c.type==="arguments");if(!o)return;let s=o.namedChild(0);if(!s||s.type!=="string")return;let a=s.namedChildren.find(c=>c.type==="string_fragment");a&&n.add(a.text)}function _o(e,t){let n=Cl.test(e),r=_l.test(e),i=Rl.test(e);if(!(!n&&!r&&!i))for(let o of Il){o.lastIndex=0;let s;for(;(s=o.exec(e))!==null;){let a=s[1],c=a.split("::").pop()??a;c==="is_none"&&/\bOption\b/.test(a)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(a)||c&&t.add(c)}}}function Ro(e,t){let n=new Map,r=(s,a)=>{if(s===a)return;let c=n.get(s);c||(c=new Set,n.set(s,c)),c.add(a)},i=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),o=(s,a)=>{let c=l=>{i.has(l.type)&&l.text!==a&&r(l.text,a);for(let u of l.children)c(u)};for(let l of s.children)c(l)};if(t==="rust")for(let s of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let a=s.namedChildren.find(l=>l.type==="type_identifier")?.text;if(!a)continue;let c=s.namedChildren.find(l=>l.type==="field_declaration_list"||l.type==="enum_variant_list"||l.type==="ordered_field_declaration_list");c&&o(c,a),s.type==="type_item"&&o(s,a)}else if(t==="python")for(let s of e.rootNode.descendantsOfType("class_definition")){let a=s.namedChildren.find(u=>u.type==="identifier")?.text;if(!a)continue;let c=s.childForFieldName("superclasses");c&&o(c,a);let l=s.namedChildren.find(u=>u.type==="block");if(l)for(let u of l.descendantsOfType("type"))for(let d of u.descendantsOfType("identifier"))d.text!==a&&r(d.text,a)}else for(let s of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let a=s.namedChildren.find(c=>c.type==="type_identifier")?.text;a&&o(s,a)}return n}var Fl=new Map([["defn","function"],["defn-","function"],["defmacro","macro"],["defmacro-","macro"],["defmethod","method"]]),Rr=new Set(["catch","comment","def","defprotocol","defrecord","deftype","defmethod","defmacro","defmacro-","defn","defn-","do","doseq","dotimes","fn","for","if","let","loop","ns","quote","recur","throw","try","extend-protocol","extend-type","when","when-let","when-not"]);function To(e){let t=[],n=[],r=[],i=new Map,o=[],s=0,a=0,c=(l,u)=>{let d=i.get(l);if(!d){i.set(l,[u]);return}d[d.length-1]!==u&&d.push(u)};for(;a<e.length;){let l=e[a];if(l===`
93
+ `),startLine:0,language:o}:null}var So=ze("ast-trees",{clearGroups:["whole-project","source-file"]});function R(e,t){if(Se(t))return il(e,t);let n=H(t);if(!n)return null;let r=x(e,t);return r?So.get(e,t,r,()=>Ke(n,r)):null}function Lt(e,t,n){if(Se(t)){let o=wt(e,t,n);if(!o)return null;let s=Ke(o.language,`
94
+ `.repeat(o.startLine)+o.body);return s?{tree:s,language:o.language}:null}let r=H(t);if(!r)return null;let i=Ke(r,n);return i?{tree:i,language:r}:null}function il(e,t){let n=x(e,t);return n?So.get(e,t,n,()=>{let r=wt(e,t,n);if(!r)return null;let i=`
95
+ `.repeat(r.startLine)+r.body;return Ke(r.language,i)}):null}function mt(e,t){let n=sl(e,t);if(!n)return null;let r=Ce(n);if(!r)return null;let i=al(n);return{calleeLeaf:r,calleeQualifier:i?ol(n):void 0,calleeText:n.text,memberAccess:i,line:e.startPosition.row}}function ol(e){return(e.childForFieldName("object")??e.childForFieldName("value")??e.namedChild(0)??void 0)?.text||void 0}function sl(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function al(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function Ce(e){switch(e.type){case"identifier":case"type_identifier":case"field_identifier":case"property_identifier":case"private_property_identifier":case"shorthand_property_identifier":return e.text.replace(/^#/u,"");case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?Ce(t):null}case"generic_function":{let t=e.childForFieldName("function")??e.namedChild(0);return t?Ce(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?Ce(t):null}case"super":case"self":case"this":return null;default:return null}}var cl=[U("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),U("callable-units",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/source/callable-units.test.ts",owner:"src/source/facts/callable-units.ts"}),U("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),U("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),U("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),U("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),U("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),U("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),U("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),U("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),U("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),U("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),U("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),U("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),U("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),ln("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function le(e){let t=new Map;return{kind:e.kind,read(n,r,i){let o=!1,s=0,a;if(pr()){let c=qe(n);if(c){let l=`${c}\0${r}\0${i}`;a=t.get(l),a||(a=fr(["evidence-product-file-read-v1",e.kind,c,r,i]),t.set(l,a))}}return ge("evidence-product.file.read",()=>{let c=eo(n,e.kind,r,i);if(c===null)return null;s=c.length;try{let l=e.deserialize(c);return o=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:o,payloadBytes:s}))},write(n,r,i,o){to(n,e.kind,r,i,e.serialize(o))},writeBatch(n,r){no(n,r.map(i=>({kind:e.kind,relativePath:i.relativePath,contentHash:i.contentHash,payload:e.serialize(i.value)})))}}}function bo(e){let t=new Map;return{kind:e.kind,read(n,r,i){let o=!1,s=0,a;if(pr()){let c=`${i}\0${r}`;a=t.get(c),a||(a=fr(["evidence-product-project-read-v1",e.kind,i,r]),t.set(c,a))}return ge("evidence-product.project.read",()=>{let c=ro(n,e.kind,r,i);if(c===null)return null;s=c.length;try{let l=e.deserialize(c);return o=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:o,payloadBytes:s}))},write(n,r,i,o){io(n,e.kind,r,i,e.serialize(o))}}}function X(e){let t=cl.find(n=>n.kind===e);if(!t)throw new Error(`missing evidence product manifest entry for ${e}`);return t.invalidation}function U(e,t){return{scope:"file",kind:e,invalidation:{scope:"file",...t}}}function ln(e,t){return{scope:"project",kind:e,invalidation:{scope:"project",...t}}}function kt(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var ll=new Set(["function_declaration","generator_function_declaration","method_definition","method_signature","function_signature"]),xo=new Set(["arrow_function","function_expression","generator_function"]);function ul(e,t){let n=ml(e,t);if(n)return n;if(!fl(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(i=>i.type==="identifier"||i.type==="property_identifier");return r?{name:r.text,definitionNode:e,functionNode:e}:null}function un(e,t){let n=ul(e,t);if(!n)return null;let{definitionNode:r,functionNode:i}=n;return{name:n.name,startLine:r.startPosition.row,endLine:r.endPosition.row,paramCount:gl(i),params:dl(i),paramsEndLine:pl(i),isLiteralPassthrough:yl(i,t)}}function No(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function dl(e){let t=No(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(kt(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let i=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),o=r.childForFieldName("pattern");if(!i&&o&&o.type==="identifier"){n.push({name:o.text,simple:!0});continue}let s=r.namedChildren.find(a=>a.type==="identifier");n.push({name:o?.type==="identifier"?o.text:s?.text??"",simple:!1})}return n}function pl(e){let t=No(e);return t?t.endPosition.row:e.startPosition.row}function fl(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?ll.has(e):!1}function ml(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let i=vo(r);return i?{name:n.text,definitionNode:e,functionNode:i}:null}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let i=vo(r);return i?{name:n.text,definitionNode:e,functionNode:i}:null}return null}function vo(e){if(xo.has(e.type))return e;if(e.type!=="call_expression"||(e.childForFieldName("function")??e.namedChild(0))?.type!=="call_expression")return null;let r=((e.childForFieldName("arguments")??e.namedChildren.find(i=>i.type==="arguments"))?.namedChildren??[]).filter(i=>xo.has(i.type));return r.length===1?r[0]:null}function gl(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)kt(r)||(n+=1);return n}function yl(e,t){let n=e.namedChildren.find(d=>d.type==="block"||d.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(d=>!kt(d));if(r.length!==1)return!1;let i=r[0],o=null;if(i.type==="return_statement"||i.type==="expression_statement"?o=i.namedChild(0)??null:t==="rust"&&(i.type==="call_expression"||i.type==="macro_invocation")&&(o=i),!o)return!1;let s=t==="python"?"call":"call_expression";if(o.type!==s)return!1;let a=o.namedChildren.find(d=>d.type==="arguments"||d.type==="argument_list");if(!a)return!1;let c=a.namedChildren.filter(d=>!kt(d)),l=e.namedChildren.find(d=>d.type==="parameters"||d.type==="formal_parameters");if(!l)return!1;let u=[];for(let d of l.namedChildren){if(d.type==="identifier"){u.push(d.text);continue}let p=d.namedChildren.find(f=>f.type==="identifier");p&&u.push(p.text)}if(c.length!==u.length)return!1;for(let d=0;d<u.length;d+=1){let p=c[d];if(p.type!=="identifier"||p.text!==u[d])return!1}return!0}var hl=new Set(["identifier","type_identifier","field_identifier"]),Sl=new Set(["identifier"]),bl=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),xl=new Set(["rust","python"]),vl=/\{([^{}]*)\}/g,Nl=/\b([A-Za-z_][\w]*)\b/g;function Eo(e,t){return El(t).has(e.type)}function Io(e,t){return xl.has(t)&&e.type==="string_content"}function _r(e){let t=0;for(let r of e.values()){let i=r[r.length-1];i!==void 0&&i>t&&(t=i)}let n=new Array(t+1);for(let r=0;r<=t;r+=1)n[r]=new Set;for(let[r,i]of e)for(let o of i)n[o].add(r);return n}function El(e){return e==="rust"?hl:e==="python"?Sl:bl}function Co(e,t){let n=e.startPosition.row;for(let r of e.text.matchAll(vl)){let i=r[1]??"";for(let o of i.matchAll(Nl))o[1]&&t(o[1],n)}}var Il=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],Cl=/^#!?\[\s*serde\s*\(/,_l=/^#!?\[\s*schemars\s*\(/,Rl=/^#!?\[\s*validate\s*\(/,Tl=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function _o(e,t,n){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript"||e.type!=="call_expression")return;let r=e.childForFieldName("function")??e.namedChild(0);if(!r)return;let i=Ce(r);if(!i||!Tl.has(i))return;let o=e.namedChildren.find(c=>c.type==="arguments");if(!o)return;let s=o.namedChild(0);if(!s||s.type!=="string")return;let a=s.namedChildren.find(c=>c.type==="string_fragment");a&&n.add(a.text)}function Ro(e,t){let n=Cl.test(e),r=_l.test(e),i=Rl.test(e);if(!(!n&&!r&&!i))for(let o of Il){o.lastIndex=0;let s;for(;(s=o.exec(e))!==null;){let a=s[1],c=a.split("::").pop()??a;c==="is_none"&&/\bOption\b/.test(a)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(a)||c&&t.add(c)}}}function To(e,t){let n=new Map,r=(s,a)=>{if(s===a)return;let c=n.get(s);c||(c=new Set,n.set(s,c)),c.add(a)},i=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),o=(s,a)=>{let c=l=>{i.has(l.type)&&l.text!==a&&r(l.text,a);for(let u of l.children)c(u)};for(let l of s.children)c(l)};if(t==="rust")for(let s of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let a=s.namedChildren.find(l=>l.type==="type_identifier")?.text;if(!a)continue;let c=s.namedChildren.find(l=>l.type==="field_declaration_list"||l.type==="enum_variant_list"||l.type==="ordered_field_declaration_list");c&&o(c,a),s.type==="type_item"&&o(s,a)}else if(t==="python")for(let s of e.rootNode.descendantsOfType("class_definition")){let a=s.namedChildren.find(u=>u.type==="identifier")?.text;if(!a)continue;let c=s.childForFieldName("superclasses");c&&o(c,a);let l=s.namedChildren.find(u=>u.type==="block");if(l)for(let u of l.descendantsOfType("type"))for(let d of u.descendantsOfType("identifier"))d.text!==a&&r(d.text,a)}else for(let s of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let a=s.namedChildren.find(c=>c.type==="type_identifier")?.text;a&&o(s,a)}return n}var Fl=new Map([["defn","function"],["defn-","function"],["defmacro","macro"],["defmacro-","macro"],["defmethod","method"]]),Rr=new Set(["catch","comment","def","defprotocol","defrecord","deftype","defmethod","defmacro","defmacro-","defn","defn-","do","doseq","dotimes","fn","for","if","let","loop","ns","quote","recur","throw","try","extend-protocol","extend-type","when","when-let","when-not"]);function Fo(e){let t=[],n=[],r=[],i=new Map,o=[],s=0,a=0,c=(l,u)=>{let d=i.get(l);if(!d){i.set(l,[u]);return}d[d.length-1]!==u&&d.push(u)};for(;a<e.length;){let l=e[a];if(l===`
96
96
  `){s+=1,a+=1;continue}if(/\s|,/.test(l)){a+=1;continue}if(l===";"){a=pn(e,a);continue}if(l==='"'){let m=At(e,a,s);s=m.line,a=m.index;continue}if(l==="("||l==="["||l==="{"){o.push({kind:l,startLine:s,endLine:s,headTokens:[],tokens:[],children:[]}),a+=1;continue}if(l===")"||l==="]"||l==="}"){let m=o.pop();m&&(m.endLine=s,Pl(m,{callables:t,callSites:n,clojureMembers:r,recordIdentifier:c}),o[o.length-1]?.children.push(m)),a+=1;continue}if(Tr(l)){a+=1;continue}let u=s,d=a;for(;a<e.length&&!Fr(e[a]);)a+=1;let p=e.slice(d,a);if(!p)continue;let f={text:p,line:u};wl(o[o.length-1],f),c(te(p),u)}return{language:"clojure",callables:t,callSites:n,clojureMembers:r,typeContainerMap:new Map,identifierLineMap:i,identifiersByLine:Ol(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:new Set,crossLanguageDispatchNames:new Set}}function Pl(e,t){if(e.kind!=="("||e.headTokens.length===0)return;let n=e.headTokens[0],r=te(n.text),i=Fl.get(n.text);if(i){let s=e.headTokens[1];if(s){let a=te(s.text);t.recordIdentifier(a,s.line),t.callables.push({name:a,startLine:e.startLine,endLine:e.endLine,paramCount:0,params:[],paramsEndLine:s.line,isLiteralPassthrough:!1,clojureKind:i})}}if(Ll(e,t),!r||Rr.has(n.text)||Rr.has(r)||r.startsWith(":"))return;let o=Al(n.text);t.callSites.push({calleeLeaf:o.leaf,calleeQualifier:o.qualifier,calleeText:o.text,memberAccess:!1,line:n.line})}function wl(e,t){e&&(e.headTokens.length<2&&e.headTokens.push(t),e.tokens.length<200&&e.tokens.push(t))}function Ll(e,t){let n=te(e.tokens[0]?.text??"");if(n==="defprotocol"){let r=te(e.tokens[1]?.text??"");if(!r)return;for(let i of dn(e))Dt(t,r,"protocol",i,"protocol-method");return}if(n==="defrecord"||n==="deftype"){let r=te(e.tokens[1]?.text??"");if(!r)return;let i=n==="defrecord"?"record":"type",o=n==="defrecord"?"record-method":"type-method";for(let s of dn(e))Dt(t,r,i,s,o);return}if(n==="extend-type"){let r=te(e.tokens[1]?.text??"");if(!r)return;for(let i of dn(e))Dt(t,r,"extension",i,"extension-method");return}if(n==="extend-protocol"){let r=te(e.tokens[1]?.text??"");for(let i of dn(e)){r&&Dt(t,r,"extension",i,"extension-method");let o=Dl(e,i.startLine);o&&o!==r&&Dt(t,o,"extension",i,"extension-method")}}}function dn(e){return e.children.filter(kl)}function kl(e){if(e.kind!=="(")return!1;let t=te(e.tokens[0]?.text??"");return!!(t&&!Rr.has(t)&&!t.startsWith(":"))}function Dt(e,t,n,r,i){let o=r.tokens[0],s=te(o?.text??"");!o||!s||(e.recordIdentifier(s,o.line),e.clojureMembers.push({ownerName:t,ownerKind:n,memberName:s,memberKind:i,startLine:r.startLine,endLine:r.endLine}))}function Dl(e,t){let n=null;for(let r=2;r<e.tokens.length;r+=1){let i=e.tokens[r];if(i.line>t)break;let o=te(i.text);o&&!o.startsWith(":")&&(n=o)}return n}function te(e){return e.replace(/^#?['`~@]+/,"").split("/").pop()?.replace(/^\./,"")??""}function Al(e){let t=e.replace(/^#?['`~@]+/,""),n=t.lastIndexOf("/"),r=te(t);if(n<=0)return{leaf:r,text:t};let i=t.slice(0,n);return{leaf:r,qualifier:i,text:t}}function pn(e,t){let n=t;for(;n<e.length&&e[n]!==`
97
97
  `;)n+=1;return n}function At(e,t,n){let r=t+1,i=n;for(;r<e.length;){let o=e[r];if(o==="\\"){r+=2;continue}if(o===`
98
- `&&(i+=1),r+=1,o==='"')break}return{index:r,line:i}}function Tr(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"||e==="#"}function Fr(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"||e==='"'||e===";"}function Ol(e){let t=[];for(let[n,r]of e)for(let i of r)t[i]??=new Set,t[i].add(n);return t}var Fo=6,Ml=ze("source-facts",{clearGroups:["whole-project","source-file"]}),Pr=le({kind:"source-facts",invalidation:X("source-facts"),serialize:jl,deserialize:Vl});function A(e,t){return wr(e,t).facts}function wr(e,t){let n=x(e,t);if(!n)return{facts:null};let r=$l(e,t,n);return r?Ml.get(e,t,n,()=>Bl(e,t,r,n)):{facts:null}}function $l(e,t,n){return Se(t)?wt(e,t,n)?.language??null:H(t)}function Bl(e,t,n,r){let i=he(e,t,r),o=Pr.read(e,t,i);if(o&&o.language===n)return{facts:o};if(n==="clojure"){let c=To(r);return Pr.write(e,t,i,c),{facts:c}}let s=R(e,t);if(!s)return{facts:null,unavailable:{language:n,reason:"parser-unavailable"}};let a=Wl(s,n);return Pr.write(e,t,i,a),{facts:a}}function jl(e){let t={version:Fo,language:e.language,callables:e.callables,callSites:e.callSites,clojureMembers:e.clojureMembers,typeContainerMap:[...e.typeContainerMap.entries()].map(([n,r])=>[n,[...r]]),identifierLineMap:[...e.identifierLineMap.entries()],rustAttrReferencedNames:[...e.rustAttrReferencedNames],crossLanguageDispatchNames:[...e.crossLanguageDispatchNames]};return JSON.stringify(t)}function Vl(e){try{let t=JSON.parse(e);if(t.version!==Fo||t.language==="clojure"&&(t.clojureMembers===void 0||t.callSites.some(r=>r.calleeText===void 0)))return null;let n=new Map(t.identifierLineMap);return{language:t.language,callables:t.callables,callSites:t.callSites,clojureMembers:t.clojureMembers??[],typeContainerMap:new Map(t.typeContainerMap.map(([r,i])=>[r,new Set(i)])),identifierLineMap:n,identifiersByLine:_r(n),fileIdentifiers:new Set(n.keys()),rustAttrReferencedNames:new Set(t.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(t.crossLanguageDispatchNames)}}catch{return null}}function Ul(e,t,n,r){let i=A(e,t);return i?zl(i,n,r)?.isLiteralPassthrough??!0:!0}function Hl(e,t){return t.relativePath.includes(".clj-kondo/hooks/")?!0:A(e,t.relativePath)?.callables.find(r=>r.startLine===t.startLine&&r.endLine===t.endLine)?.clojureKind==="macro"}function zl(e,t,n){return e.callables.find(r=>r.startLine===t&&r.endLine===n)??null}function Wl(e,t){let n=[],r=[],i=new Set,o=new Set,s=new Map,a=(l,u)=>{let d=s.get(l);if(!d){s.set(l,[u]);return}d[d.length-1]!==u&&d.push(u)},c=l=>{let u=un(l,t);u&&n.push(u);let d=mt(l,t);d&&r.push(d),Co(l,t,o),t==="rust"&&(l.type==="attribute_item"||l.type==="inner_attribute_item")&&_o(l.text,i),No(l,t)&&a(l.text,l.startPosition.row),Eo(l,t)&&Io(l,a);for(let p of l.children)c(p)};return c(e.rootNode),{language:t,callables:n,callSites:r,clojureMembers:[],typeContainerMap:Ro(e,t),identifierLineMap:s,identifiersByLine:_r(s),fileIdentifiers:new Set(s.keys()),rustAttrReferencedNames:i,crossLanguageDispatchNames:o}}var Po=new Set(["rust","typescript","tsx","javascript","python","clojure"]);function Lr(e,t){let n=A(e,t);return!n||!Po.has(n.language)?null:n.callables.map(r=>({name:r.name,startLine:r.startLine,endLine:r.endLine}))}function ql(e,t){let n=A(e,t);return!n||!Po.has(n.language)?null:n.callSites}function Kl(e,t){return A(e,t)?.typeContainerMap??new Map}import{ElementTypes as Xl,NodeTypes as kr,parse as Jl}from"@vue/compiler-dom";import{parse as Zb}from"@vue/compiler-sfc";var Gl=new Set(["children","className","data","e","err","error","ev","event","false","id","idx","index","item","key","null","props","res","result","state","style","true","undefined","val","value"]);function fn(e){return e.length<=2||Gl.has(e)}function mn(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var Ql=De("vue-template-facts"),Zl=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),Yl=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),eu=new Set(["div","span","template"]),tu=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function gn(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n);return Ql.get(e,n,r,()=>nu(n,ft(e,n).template))}function nu(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=Jl(t.body,{comments:!1})}catch{return n}let i=new Set,o=s=>{s.trim()&&i.add(s)};return Lo(r.children,t.startLine,n,o),n.structuralTokens=[...i].sort(),n}function Lo(e,t,n,r){for(let i of e)if(i.type===kr.ELEMENT)ru(i,t,n,r),Lo(i.children,t,n,r);else if(i.type===kr.INTERPOLATION){r("interpolation");let o=Dr(i.content);o&&ko(o,t,i.loc.start.line,n,r)}}function ru(e,t,n,r){let i=uu(e.tag),o={tag:e.tag,normalized:i,kind:lu(e),startLine:gt(t,e.loc.start.line),endLine:gt(t,e.loc.end.line)};o.kind==="component"?(n.componentTags.push(o),r(`component:${i}`)):o.kind==="builtin"?(n.builtinTags.push(o),r(`builtin:${i}`)):(n.nativeTags.push(o),eu.has(e.tag)||r(`native:${e.tag}`));for(let s of e.props)iu(s,t,n,r)}function iu(e,t,n,r){if(e.type===kr.ATTRIBUTE){let a=e.value?.content??null,c=wo("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(c),r(`prop:${e.name}`);return}let i=su(e),o=Dr(e.exp),s=wo(ou(e.name),i,o,t,e.loc.start.line,e.loc.end.line);switch(s.kind){case"prop":n.props.push(s),r(`prop:${i}`);break;case"event":n.events.push(s),r(`event:${i}`);break;case"slot":n.slots.push(s),r(`slot:${i}`);break;case"directive":n.directives.push(s),r(`directive:${i}`);break}o&&ko(o,t,e.loc.start.line,n,r)}function wo(e,t,n,r,i,o){return{kind:e,name:t,value:n,startLine:gt(r,i),endLine:gt(r,o)}}function ou(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function su(e){let t=Dr(e.arg);return t||e.name}function Dr(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function ko(e,t,n,r,i){for(let o of au(e)){let s={name:o,startLine:gt(t,n),endLine:gt(t,n)};r.expressionIdentifiers.push(s),i(`id:${o}`)}}function au(e){let t=new Set,n=cu(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,i;for(;i=r.exec(n);){let o=i[0];tu.has(o)||fn(o)||/^[A-Z_]+$/.test(o)||t.add(o)}return[...t].sort()}function cu(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function lu(e){let t=e.tag;return e.tagType===Xl.COMPONENT?"component":Zl.has(t)?"builtin":Yl.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function uu(e){return mn(e,/[-_:]/)}function gt(e,t){return e+Math.max(0,t-1)}import{createRequire as vu}from"module";import{existsSync as Je}from"fs";import{basename as Ao,dirname as J,extname as _e,join as ne,relative as Ge,resolve as O,sep as Nu}from"path";import{existsSync as Or,readdirSync as du,statSync as pu}from"fs";import{join as yt,relative as fu}from"path";function Do(e){let t=mu(e)??Su(e);if(!t||t.length===0)return[];let n=[],r=new Set;for(let i of t)for(let o of bu(e,i)){if(r.has(o))continue;r.add(o);let s=xu(e,o);s&&n.push(s)}return n}function mu(e){let t=yt(e,"pnpm-workspace.yaml");if(!Or(t))return null;try{return gu(st(t,"pnpm workspace manifest"))}catch{return null}}function gu(e){let t=[],n=!1;for(let r of e.split(/\r?\n/)){let i=yu(r);if(!n){/^packages\s*:\s*$/.test(i.trim())&&(n=!0);continue}let o=/^\s+-\s*(.+)$/.exec(i);if(o){let s=hu(o[1].trim());s&&t.push(s);continue}if(i.trim()!=="")break}return t}function yu(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function hu(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function Su(e){let t=yt(e,"package.json");if(!Or(t))return null;try{let n=JSON.parse(st(t,"workspace package manifest"));return n.workspaces?Array.isArray(n.workspaces)?n.workspaces:n.workspaces.packages??[]:null}catch{return null}}function bu(e,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let s=yt(e,t);return Ar(s)?[s]:[]}let n=t.indexOf("*"),r=t.slice(0,n).replace(/\/$/,""),i=t.slice(n+1).replace(/^\//,""),o=yt(e,r||".");return Ar(o)?du(o).map(s=>yt(o,s,i)).filter(Ar):[]}function Ar(e){try{return pu(e).isDirectory()}catch{return!1}}function xu(e,t){let n=yt(t,"package.json");if(!Or(n))return null;try{let r=JSON.parse(st(n,"workspace package manifest"));return typeof r.name!="string"||r.name.length===0?null:{name:r.name,relativeDir:fu(e,t).replace(/\\/g,"/"),exports:r.exports}}catch{return null}}var Eu=ye("indexed-paths",{clearGroups:[]}),Iu=ye("indexed-path-digest",{clearGroups:[]}),Cu=v("tsconfig-alias-config",{clearGroups:["whole-project"]}),_u=v("tsconfig-alias-config-for-dir",{clearGroups:["whole-project"]}),Ru=vu(import.meta.url),Ot;function Tu(){if(Ot!==void 0)return Ot;try{Ot=Ru("typescript")}catch{Ot=null}return Ot}var Fu=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"],Pu=ye("workspace-packages",{clearGroups:["whole-project"]}),Xe=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],yn=[".py",".pyi"],Q=[".java",".scala",".kt",".kts"],hn=[".rs"],Sn=[".rb"],bn=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],Oe=[".cs",".vb"],xn=[".dart"],Qe=[".php"],ht=[".clj",".cljs",".cljc"],wu=new Set(Xe),Mr=new Set(yn),Oo=new Set(Q),$r=new Set(hn),Br=new Set(Sn),Mo=new Set(bn),$o=new Set(Oe),jr=new Set(xn),Bo=new Set(Qe),jo=new Set(ht),Lu=[{extensions:Xe,lookup:wu},{extensions:yn,lookup:Mr},{extensions:Q,lookup:Oo},{extensions:hn,lookup:$r},{extensions:Sn,lookup:Br},{extensions:bn,lookup:Mo},{extensions:Oe,lookup:$o},{extensions:xn,lookup:jr},{extensions:Qe,lookup:Bo},{extensions:ht,lookup:jo}];function Re(e,t){return t.has(_e(e).toLowerCase())}function ku(e){return Re(e,Mr)}function Du(e){return Re(e,Oo)}function Au(e){return Re(e,$r)}function Ou(e){return Re(e,Br)}function Mu(e){return Re(e,Mo)}function $u(e){return Re(e,$o)}function Vo(e){return _e(e).toLowerCase()===".vb"}function Bu(e){return Re(e,jr)}function ju(e){return Re(e,Bo)}function Vu(e){return Re(e,jo)}function Vr(e){let t=_e(e).toLowerCase();for(let n of Lu)if(n.lookup.has(t))return n.extensions;return Xe}function Uu(e){return Du(e)||$u(e)||ju(e)}function be(e,t,n){return ku(t)?St(e,t,n):Au(t)?Te(e,t,n):Ou(t)?vn(e,t,n):Mu(t)?Nn(e,t,n):Uu(t)?w(e,n.replace(/\\/g,"."),Vr(t)):Bu(t)?En(e,t,n):Vu(t)?Ur(e,n):Hu(e,t,n)}function Hu(e,t,n){if(!n.startsWith(".")&&!n.startsWith("/"))return zu(e,t,n)??qu(e,n);let r=J(ne(e.config.projectRoot,t)),i=O(r,n),o=Fe(e);for(let s of zr(i)){let a=D(Ge(e.config.projectRoot,s));if(o.has(a)||Je(s))return a}return D(Ge(e.config.projectRoot,i))}function zu(e,t,n){let r=Zu(e,t);if(!r)return null;let i=Fe(e);for(let o of Wu(r,n)){let s=O(r.baseUrl,o);for(let a of zr(s)){let c=D(Ge(e.config.projectRoot,a));if(i.has(c)||Je(a))return c}}return null}function Wu(e,t){let n=[];for(let[r,i]of Object.entries(e.paths)){let o=r.indexOf("*");if(o===-1){if(t!==r)continue;n.push(...i);continue}let s=r.slice(0,o),a=r.slice(o+1);if(!t.startsWith(s)||!t.endsWith(a)||t.length<s.length+a.length)continue;let c=t.slice(s.length,t.length-a.length);for(let l of i)n.push(l.includes("*")?l.replace("*",c):l)}return n}function qu(e,t){let n=Gu(Ku(e),t);if(!n)return null;let r=Fe(e);for(let i of Xu(n)){let o=O(e.config.projectRoot,n.pkg.relativeDir,i);for(let s of zr(o)){let a=D(Ge(e.config.projectRoot,s));if(r.has(a)||Je(s))return a}}return null}function Ku(e){return Pu.get(e,()=>Do(e.config.projectRoot))}function Gu(e,t){let n=null;for(let r of e){let i=null;t===r.name?i="":t.startsWith(`${r.name}/`)&&(i=t.slice(r.name.length+1)),i!==null&&(!n||r.name.length>n.pkg.name.length)&&(n={pkg:r,subpath:i})}return n}function Xu(e){let t=[],n=Ju(e.pkg.exports,e.subpath);if(n){let r=Qu(n);r&&t.push(r)}return t.push(e.subpath?`src/${e.subpath}`:"src/index"),t}function Ju(e,t){if(!e||typeof e!="object")return null;let n=t===""?".":`./${t}`;return Uo(e[n])}function Uo(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;let t=e;for(let n of["types","import","default","require","node"]){let r=Uo(t[n]);if(r)return r}return null}function Qu(e){let t=e.replace(/^\.\//,"");return t.startsWith("dist/")?`src/${t.slice(5)}`:null}function Zu(e,t){let n=D(J(t));return _u.get(e,n,()=>Yu(e,n))}function Yu(e,t){let n=Tu();if(!n)return null;let r=O(e.config.projectRoot),i=O(r,t);for(;i===r||i.startsWith(r+Nu);){for(let s of Fu){let a=ne(i,s);if(!Je(a))continue;let c=Cu.get(e,a,()=>ed(n,a));if(c)return c}let o=J(i);if(o===i)break;i=o}return null}function ed(e,t){try{let n=e.readConfigFile(t,e.sys.readFile);if(n.error||!n.config)return null;let r=e.parseJsonConfigFileContent(n.config,e.sys,J(t)),i=r.options.paths;return!i||Object.keys(i).length===0?null:{baseUrl:r.options.baseUrl?O(J(t),r.options.baseUrl):J(t),paths:i}}catch{return null}}function St(e,t,n){let r=Fe(e),i;if(n.startsWith(".")){let o=n.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=J(ne(e.config.projectRoot,t));for(let l=1;l<s;l++)c=J(c);i=a?O(c,a.replace(/\./g,"/")):c}else i=O(e.config.projectRoot,n.replace(/\./g,"/"));for(let o of td(i)){let s=D(Ge(e.config.projectRoot,o));if(r.has(s)||Je(o))return s}return null}function Te(e,t,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=J(ne(e.config.projectRoot,t)),o;return r.startsWith("crate::")?o=O(e.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=O(i,r.slice(6).replace(/::/g,"/")):o=O(J(i),r.slice(7).replace(/::/g,"/")),Hr(e,nd(o))}function vn(e,t,n){let r=J(ne(e.config.projectRoot,t)),i=O(r,n);return Hr(e,rd(i))}function Nn(e,t,n){let r=J(ne(e.config.projectRoot,t)),i=[O(r,n),O(e.config.projectRoot,n),O(e.config.projectRoot,"include",n),O(e.config.projectRoot,"src",n)];return Hr(e,i)}function w(e,t,n){let r=Fe(e),i=t.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of n){let l=`${o}${c}`,u=[...r].find(d=>d.endsWith(l));if(u)return u}for(let c of n){let l=[...r].find(u=>Ao(u)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(_e(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function En(e,t,n){let r=Fe(e);if(n.startsWith("package:")){let s=n.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=D(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=J(ne(e.config.projectRoot,t)),o=O(i,n);for(let s of id(o)){let a=D(Ge(e.config.projectRoot,s));if(r.has(a)||Je(s))return a}return null}function Ur(e,t){let n=t.replace(/-/g,"_").replace(/\./g,"/"),r=Fe(e);for(let i of ht){let o=`${n}${i}`,s=[...r].find(a=>a.endsWith(o));if(s)return s}for(let i of ht){let o=[...r].find(s=>Ao(s)===`${n.split("/").pop()}${i}`);if(o)return o}return null}function td(e){let t=_e(e);return Mr.has(t)?[e]:[`${e}.py`,`${e}.pyi`,ne(e,"__init__.py"),ne(e,"__init__.pyi")]}function Hr(e,t){let n=Fe(e);for(let r of t){let i=D(Ge(e.config.projectRoot,r));if(n.has(i)||Je(r))return i}return null}function nd(e){let t=_e(e);return $r.has(t)?[e]:[`${e}.rs`,ne(e,"mod.rs")]}function rd(e){let t=_e(e);return Br.has(t)?[e]:[`${e}.rb`,ne(e,"index.rb")]}function id(e){let t=_e(e);return jr.has(t)?[e]:[`${e}.dart`,e]}function zr(e){let t=_e(e),n=new Set;if(t){n.add(e);for(let r of Xe)n.add(e.slice(0,-t.length)+r)}else for(let r of Xe)n.add(`${e}${r}`),n.add(ne(e,`index${r}`));return[...n]}function Fe(e){return Eu.get(e,()=>new Set(ee(e,{includeIgnored:!1}).map(D)))}function Wr(e){return Iu.get(e,()=>Ne([...Fe(e)].sort().join(`
99
- `)))}import{readdirSync as od}from"fs";import{execFileSync as sd}from"child_process";import{extname as In,join as ad}from"path";var cd=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],Ex=[".vue"],Ho=[".tsx",".jsx"],zo=[".vue"],ld=[...Ho,...zo],ud=new Set(Ho),dd=new Set(zo),Wo=new Set(cd.map(e=>e.toLowerCase())),pd=[...Wo].sort().join(","),qo=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".codebaseiq-cache","__pycache__",".venv","venv",".idea",".vscode"]);function z(e,t={}){let n=t.includeIndexed??!0,r=t.includeAuxiliary??!0,i=t.extensions?.map(c=>c.toLowerCase()),o=i?new Set(i):Wo,s=i?[...o].sort().join(","):pd,a=`${n?"1":"0"}|${r?"1":"0"}|${s}`;return fd.get(e,a,()=>{let c=new Set;if(n)for(let l of ee(e,{includeIgnored:!1}))o.has(In(l).toLowerCase())&&c.add(l);if(r)for(let l of md(e.config.projectRoot,o))e.isIgnored(l)||n&&c.has(l)||c.add(l);return[...c].sort()})}function Ix(e,t={}){let n=!1,r=!1;for(let i of z(e,{extensions:ld})){if(t.scope&&!i.includes(t.scope))continue;let o=In(i).toLowerCase();if(n||=ud.has(o),r||=dd.has(o),n&&r)break}return{react:n,vue:r}}var fd=v("source-files",{clearGroups:[]});function md(e,t){return gd(e,t)??hd(e,t)}function gd(e,t){try{let n=sd("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"],windowsHide:!0}),r=new Set;for(let i of n.split(`
100
- `)){let o=i.trim();o&&(yd(o)||t.has(In(o).toLowerCase())&&r.add(o))}return r}catch{return null}}function yd(e){return e.split("/").some(t=>qo.has(t))}function hd(e,t){let n=new Set,r=i=>{let o=i?ad(e,i):e,s;try{s=od(o,{withFileTypes:!0})}catch{return}for(let a of s)if(!qo.has(a.name)){if(a.isDirectory()){r(i?`${i}/${a.name}`:a.name);continue}t.has(In(a.name).toLowerCase())&&n.add(i?`${i}/${a.name}`:a.name)}};return r(""),n}var Sd=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),bd=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),xd=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),vd=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),Nd=new Set(["catch","for","function","if","return","switch","while"]);function _n(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=Ke(n),n.external&&(t.externalLineCount+=Ke(n),t.externalScriptPaths.push(n.sourcePath));for(let i of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:i});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(..._d(n));let r=qe(n.astLanguage,n.body);r?Id(n,r.rootNode,t):Cd(n,t)}return Ed(t),t.externalScriptPaths=Go(t.externalScriptPaths),t}function Ed(e){e.composables=bt(e,"composable"),e.stores=bt(e,"store"),e.reactivity=bt(e,"reactivity"),e.lifecycle=bt(e,"lifecycle"),e.requests=bt(e,"request"),e.macros=bt(e,"macro")}function bt(e,t){return Go(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function Id(e,t,n){let r=new Set,i=new Set,o=s=>{let a=un(s,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;i.has(l)||(i.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let c=mt(s,e.astLanguage);if(c){let l=`${c.calleeLeaf}:${c.line}`;r.has(l)||(r.add(l),n.calls.push({name:c.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+c.line,categories:Ko(c.calleeLeaf),setup:e.setup}))}for(let l of s.children)o(l)};o(t)}function Cd(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||Nd.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+Cn(e.body,n.index??0),categories:Ko(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let i=e.startLine+Cn(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let i=e.startLine+Cn(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}}function _d(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),i=n[2];if(!r||!i)continue;let o=e.startLine+Cn(e.body,n.index??0);for(let s of Rd(r))t.push({local:s,source:i,sourcePath:e.sourcePath,line:o,setup:e.setup})}return t}function Rd(e){let t=[],r=e.split(",").map(s=>s.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let i=/\{([^}]*)\}/.exec(e)?.[1];if(i)for(let s of i.split(",")){let a=s.trim();if(!a)continue;let c=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(c??a.replace(/^type\s+/,"").trim())}let o=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return o&&t.push(o),t.filter(s=>/^[A-Za-z_$][\w$]*$/.test(s))}function Ko(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),Sd.has(e)&&t.push("reactivity"),bd.has(e)&&t.push("lifecycle"),xd.has(e)&&t.push("request"),vd.has(e)&&t.push("macro"),t}function Cn(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Go(e){return[...new Set(e)].sort()}var Td=new Set(["in","key","of"]),Fd=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]),Pd=De("vue-component-behavior-profiles");function Xo(e,t={}){let n=z(e,{extensions:[".vue"]}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(i=>qr(e,i)).filter(i=>(t.minTemplateTokens===void 0||i.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function qr(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n),i=Pd.get(e,n,r,()=>wd(e,n,r));return kd(i)}function wd(e,t,n){let r=ft(e,t),i=gn(e,t),o=_n(r),s=Od(i),a=i.expressionIdentifiers.map(y=>y.name).filter(y=>!s.includes(y)).filter((y,S,b)=>b.indexOf(y)===S).sort(),c=i.componentTags.map(y=>y.normalized).filter((y,S,b)=>b.indexOf(y)===S).sort(),l=n?n.split(`
101
- `).length:0,u=Ke(r.template),d=o.lineCount,p=r.styles.reduce((y,S)=>y+Ke(S),0),f=r.customBlocks.reduce((y,S)=>y+Ke(S),0),{lines:m,paths:g}=Ld(e,t,o);return{file:t,sfc:r,templateFacts:i,scriptFacts:o,templateTokens:new Set(i.structuralTokens),behaviorTokens:Ad(i,o,a),templateBindingNames:a,templateLocalNames:s,componentNames:c,sfcLines:l,totalLines:l+o.externalLineCount,templateLines:u,scriptLines:d,styleLines:p,externalScriptLines:o.externalLineCount,externalScriptPaths:o.externalScriptPaths,customBlockLines:f,delegatedComposableLines:m,delegatedComposablePaths:g}}function Ld(e,t,n){let r=new Set;for(let s of n.composables){let a=n.imports.find(l=>l.local===s);if(!a)continue;let c=be(e,a.sourcePath,a.source);!c||c===t||r.add(c)}let i=[...r].sort();return{lines:i.reduce((s,a)=>{let c=x(e,a);return s+(c?c.split(`
102
- `).length:0)},0),paths:i}}function kd(e){let t=Dd(e.scriptFacts);return{...e,scriptFacts:t,templateTokens:new Set(e.templateTokens),behaviorTokens:new Set(e.behaviorTokens),templateBindingNames:[...e.templateBindingNames],templateLocalNames:[...e.templateLocalNames],componentNames:[...e.componentNames],externalScriptPaths:t.externalScriptPaths,delegatedComposablePaths:[...e.delegatedComposablePaths]}}function Dd(e){return{...e,imports:e.imports.map(t=>({...t})),functions:e.functions.map(t=>({...t})),calls:e.calls.map(t=>({...t,categories:[...t.categories]})),composables:[...e.composables],stores:[...e.stores],reactivity:[...e.reactivity],lifecycle:[...e.lifecycle],requests:[...e.requests],macros:[...e.macros],externalScriptPaths:[...e.externalScriptPaths],unresolvedScripts:e.unresolvedScripts.map(t=>({...t}))}}function Ad(e,t,n){let r=new Set;for(let i of t.composables)r.add(`composable:${i}`);for(let i of t.stores)r.add(`store:${i}`);for(let i of t.reactivity)r.add(`reactivity:${i}`);for(let i of t.lifecycle)r.add(`lifecycle:${i}`);for(let i of t.requests)r.add(`request:${i}`);for(let i of t.macros)r.add(`macro:${i}`);for(let i of t.functions){if(Fd.has(i.name))continue;r.add(`function:${i.name}`);let o=/^[a-z]+/.exec(i.name)?.[0]??null;o&&o.length>2&&o!==i.name&&r.add(`function-verb:${o}`)}for(let i of e.events)r.add(`template-event:${i.name}`);for(let i of n)r.add(`template-binding:${i}`);return r}function Od(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of Md(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of Jo(n.value))t.add(r);return[...t].sort()}function Md(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?Jo(t[1]??""):[]}function Jo(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];Td.has(r)||t.push(r)}return t}import{extname as $d}from"path";var Bd=[".tsx",".jsx"],Qo=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),jd=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),Vd=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),Ud=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),Hd=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),zd=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),Wd=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),qd=De("react-component-behavior-profiles"),Zo=le({kind:"react-component-behavior-profiles",invalidation:X("react-component-behavior-profiles"),serialize:Jd,deserialize:Qd});function ns(e,t={}){let n=z(e,{extensions:Bd}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(i=>Gr(e,i)).filter(i=>(t.minJsxTokens===void 0||i.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function Gr(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n);return qd.get(e,n,r,()=>Kd(e,n,r)).map(Xd)}function Kd(e,t,n){let r=he(e,t,n),i=Zo.read(e,t,r);if(i)return i;let o=Gd(e,t);return Zo.write(e,t,r,o),o}function Gd(e,t){let n=Yd(t);if(!n)return[];let r=R(e,t);if(!r)return[];let i=Pt(e,t).length;return ep(r.rootNode,n).filter(s=>s.kind==="hook"||Xr(s.bodyNode)).map(s=>{let a=ap(s.bodyNode),c=pp(s.bodyNode,n);return{file:t,name:s.name,kind:s.kind,startLine:s.node.startPosition.row,endLine:s.node.endPosition.row,loc:Math.max(1,s.node.endPosition.row-s.node.startPosition.row+1),fileLines:i,jsxTokens:a.tokens,behaviorTokens:c.tokens,componentNames:Pe(a.componentNames),nativeTags:Pe(a.nativeTags),propNames:Pe(a.propNames),eventNames:Pe(a.eventNames),hookNames:Pe(c.hookNames),requestNames:Pe(c.requestNames),stateNames:Pe(c.stateNames),effectNames:Pe(c.effectNames),handlerNames:Pe(c.handlerNames)}})}function Xd(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function Jd(e){return JSON.stringify(e.map(t=>({...t,jsxTokens:[...t.jsxTokens],behaviorTokens:[...t.behaviorTokens]})))}function Qd(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=[];for(let r of t){let i=Zd(r);if(!i)return null;n.push(i)}return n}catch{return null}}function Zd(e){if(!ke(e))return null;let{file:t,name:n,kind:r,startLine:i,endLine:o,loc:s,fileLines:a,jsxTokens:c,behaviorTokens:l,componentNames:u,nativeTags:d,propNames:p,eventNames:f,hookNames:m,requestNames:g,stateNames:y,effectNames:S,handlerNames:b}=e;if(typeof t!="string"||typeof n!="string"||r!=="component"&&r!=="hook"||!Rn(i)||!Rn(o)||!Rn(s)||!Rn(a))return null;let N={jsxTokens:Y(c),behaviorTokens:Y(l),componentNames:Y(u),nativeTags:Y(d),propNames:Y(p),eventNames:Y(f),hookNames:Y(m),requestNames:Y(g),stateNames:Y(y),effectNames:Y(S),handlerNames:Y(b)};return Object.values(N).some(E=>E===null)?null:{file:t,name:n,kind:r,startLine:i,endLine:o,loc:s,fileLines:a,jsxTokens:new Set(N.jsxTokens),behaviorTokens:new Set(N.behaviorTokens),componentNames:N.componentNames,nativeTags:N.nativeTags,propNames:N.propNames,eventNames:N.eventNames,hookNames:N.hookNames,requestNames:N.requestNames,stateNames:N.stateNames,effectNames:N.effectNames,handlerNames:N.handlerNames}}function Rn(e){return typeof e=="number"&&Number.isFinite(e)}function Yd(e){let t=$d(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:H(e)}function ep(e,t){let n=[],r=new Set,i=o=>{let s=tp(o);if(s&&(!op(o)||s.kind==="component")){let a=`${s.name}:${s.node.startIndex}:${s.node.endIndex}`;r.has(a)||(r.add(a),n.push(s))}for(let a of o.namedChildren)i(a)};return(t==="tsx"||t==="javascript")&&i(e),n}function tp(e){if(e.type==="class_declaration"){let o=Kr(e);if(!o||!/^[A-Z]/.test(o))return null;let s=np(e);return!s||!rp(e)&&!Xr(s)?null:{name:o,kind:"component",node:e,bodyNode:s}}if(e.type==="function_declaration"){let o=Kr(e);return!o||!Yo(o)?null:{name:o,kind:es(o),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),r=Mt(t);if(!r||!n||!Yo(r))return null;let i=ip(n);return i?{name:r,kind:es(r),node:e,bodyNode:i}:null}function np(e){for(let t of e.namedChildren)if(t.type==="class_body")for(let n of t.namedChildren){if(n.type!=="method_definition")continue;if((n.childForFieldName("name")??n.namedChild(0))?.text==="render")return n}return null}function rp(e){return/\b(?:React\.)?(?:Pure)?Component\b/.test(e.text)}function Yo(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function es(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function ip(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=sp(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(i=>i.type==="arguments")?.namedChildren.find(i=>i.type==="arrow_function"||i.type==="function_expression")??null}function op(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function Kr(e){return Mt(e.childForFieldName("name")??e.namedChild(0))}function sp(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function Xr(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(Xr)}function ap(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=r=>{r.type==="jsx_opening_element"||r.type==="jsx_self_closing_element"?cp(r,t):r.type==="jsx_element"&&r.text.trimStart().startsWith("<>")?t.tokens.add("jsx:fragment"):r.type==="jsx_expression"?lp(r,t):r.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let i of r.children)n(i)};return n(e),t}function cp(e,t){let n=up(e),r=!1;if(n){let i=ts(n),o=i==="Fragment"||i==="React.Fragment";r=hp(i)&&!o,o?t.tokens.add("jsx:fragment"):r?(t.componentNames.add(i),t.tokens.add(`component:${i}`)):(t.nativeTags.add(i),t.tokens.add(`native:${i}`))}for(let i of e.namedChildren)if(i.type==="jsx_attribute"){let o=dp(i);if(!o)continue;let s=ts(o);if(s.startsWith("on")&&s.length>2){let a=s.slice(2).replace(/^[A-Z]/,c=>c.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else Wd.has(s)||(t.propNames.add(s),t.tokens.add(`${r?"prop":"native-prop"}:${s}`))}else i.type==="jsx_spread_attribute"&&t.tokens.add(rs(i))}function lp(e,t){let n=e.text;/^\{\s*\.\.\./.test(n)&&t.tokens.add(rs(e)),is(e)&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let r of Sp(n))fn(r)||t.tokens.add(`binding:${r}`)}function rs(e){let t=/^\{\s*\.\.\.\s*([^}]+)\s*\}$/.exec(e.text)?.[1],n=e.namedChildren.find(o=>o.type!=="comment"),r=t??n?.text??"",i=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.exec(r.trim())?.[0];return i?`prop:spread:${i}`:"prop:spread"}function is(e){return e.type==="ternary_expression"||e.type==="conditional_expression"?!0:e.namedChildren.some(is)}function up(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function dp(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function pp(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},r=i=>{if(i.type==="call_expression"){let o=mt(i,t);o&&fp(o.calleeLeaf,n)}else if(i.type==="variable_declarator")gp(i,n);else if(i.type==="function_declaration"){let o=Kr(i);o&&os(o,n)}for(let o of i.namedChildren)r(o)};return r(e),n}function fp(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!Qo.has(e)&&!Ud.has(e)&&t.tokens.add(`hook:${e}`)),Qo.has(e)&&t.tokens.add(`react-hook:${e}`),jd.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),Vd.has(e)&&t.tokens.add(`state-hook:${e}`),mp(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function mp(e){if(Hd.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function gp(e,t){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&r?.text.includes("useState")){let o=n.namedChildren.find(a=>Mt(a)),s=Mt(o);s&&(t.stateNames.add(s),t.tokens.add(`state:${s}`))}let i=Mt(n);i&&os(i,t)}function os(e,t){let n=yp(e);!n||!zd.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function yp(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function hp(e){return/^[A-Z]/.test(e)||e.includes(".")}function ts(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function Mt(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function Sp(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];t.includes(r)||t.push(r)}return t}function Pe(e){return[...e].sort()}function nv(e){return{capability:(t,n)=>bp(t,n),reactProfiles:(t={})=>ns(e,t),reactProfilesForFile:t=>Gr(e,t),vueProfiles:(t={})=>Xo(e,t),vueProfileForFile:t=>qr(e,t),vueTemplateFacts:t=>gn(e,t),vueScriptFacts:t=>_n(ft(e,t))}}function bp(e,t){let n=e.startsWith("react-")?"react":"vue";if(t===void 0)return{slot:e,available:!0,framework:n};let r=t.replace(/\\/g,"/").toLowerCase();return n==="react"&&!r.endsWith(".tsx")&&!r.endsWith(".jsx")?{slot:e,available:!1,framework:n,reason:"React behavior profiles are only available for .tsx and .jsx files"}:n==="vue"&&!r.endsWith(".vue")?{slot:e,available:!1,framework:n,reason:"Vue behavior facts are only available for .vue files"}:{slot:e,available:!0,framework:n}}function xp(e,t,n={}){let r=A(e,t);if(!r)return[];let i=[];if(n.includeCrossLanguageDispatchNames)for(let o of r.crossLanguageDispatchNames)i.push({name:o,kind:"cross-language-dispatch",occurrences:1});if(n.includeRustAttributeNames&&r.language==="rust")for(let o of r.rustAttrReferencedNames)i.push({name:o,kind:"rust-attribute",occurrences:1});return i}import{basename as as}from"path";function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qr(e){return e.replace(/'''[\s\S]*?'''/g,Me).replace(/"""[\s\S]*?"""/g,Me).replace(/#.*$/gm,Me).replace(/\/\/.*$/gm,Me).replace(/\/\*[\s\S]*?\*\//g,Me).replace(/`(?:\\[\s\S]|[^`])*`/g,Me).replace(/'(?:\\.|[^'\\\r\n])*'/g,Me).replace(/"(?:\\.|[^"\\\r\n])*"/g,Me)}function Sv(e){return ss(e,{maskStrings:!1})}function bv(e){return ss(e,{maskStrings:!0})}function ss(e,t){let n="",r=0,i=e.length;for(;r<i;){if(e[r]==="/"&&e[r+1]==="/"){let s=e.indexOf(`
98
+ `&&(i+=1),r+=1,o==='"')break}return{index:r,line:i}}function Tr(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"||e==="#"}function Fr(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"||e==='"'||e===";"}function Ol(e){let t=[];for(let[n,r]of e)for(let i of r)t[i]??=new Set,t[i].add(n);return t}var Po=6,Ml=ze("source-facts",{clearGroups:["whole-project","source-file"]}),Pr=le({kind:"source-facts",invalidation:X("source-facts"),serialize:jl,deserialize:Vl});function A(e,t){return wr(e,t).facts}function wr(e,t){let n=x(e,t);if(!n)return{facts:null};let r=$l(e,t,n);return r?Ml.get(e,t,n,()=>Bl(e,t,r,n)):{facts:null}}function $l(e,t,n){return Se(t)?wt(e,t,n)?.language??null:H(t)}function Bl(e,t,n,r){let i=he(e,t,r),o=Pr.read(e,t,i);if(o&&o.language===n)return{facts:o};if(n==="clojure"){let c=Fo(r);return Pr.write(e,t,i,c),{facts:c}}let s=R(e,t);if(!s)return{facts:null,unavailable:{language:n,reason:"parser-unavailable"}};let a=Wl(s,n);return Pr.write(e,t,i,a),{facts:a}}function jl(e){let t={version:Po,language:e.language,callables:e.callables,callSites:e.callSites,clojureMembers:e.clojureMembers,typeContainerMap:[...e.typeContainerMap.entries()].map(([n,r])=>[n,[...r]]),identifierLineMap:[...e.identifierLineMap.entries()],rustAttrReferencedNames:[...e.rustAttrReferencedNames],crossLanguageDispatchNames:[...e.crossLanguageDispatchNames]};return JSON.stringify(t)}function Vl(e){try{let t=JSON.parse(e);if(t.version!==Po||t.language==="clojure"&&(t.clojureMembers===void 0||t.callSites.some(r=>r.calleeText===void 0)))return null;let n=new Map(t.identifierLineMap);return{language:t.language,callables:t.callables,callSites:t.callSites,clojureMembers:t.clojureMembers??[],typeContainerMap:new Map(t.typeContainerMap.map(([r,i])=>[r,new Set(i)])),identifierLineMap:n,identifiersByLine:_r(n),fileIdentifiers:new Set(n.keys()),rustAttrReferencedNames:new Set(t.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(t.crossLanguageDispatchNames)}}catch{return null}}function Ul(e,t,n,r){let i=A(e,t);return i?zl(i,n,r)?.isLiteralPassthrough??!0:!0}function Hl(e,t){return t.relativePath.includes(".clj-kondo/hooks/")?!0:A(e,t.relativePath)?.callables.find(r=>r.startLine===t.startLine&&r.endLine===t.endLine)?.clojureKind==="macro"}function zl(e,t,n){return e.callables.find(r=>r.startLine===t&&r.endLine===n)??null}function Wl(e,t){let n=[],r=[],i=new Set,o=new Set,s=new Map,a=(l,u)=>{let d=s.get(l);if(!d){s.set(l,[u]);return}d[d.length-1]!==u&&d.push(u)},c=l=>{let u=un(l,t);u&&n.push(u);let d=mt(l,t);d&&r.push(d),_o(l,t,o),t==="rust"&&(l.type==="attribute_item"||l.type==="inner_attribute_item")&&Ro(l.text,i),Eo(l,t)&&a(l.text,l.startPosition.row),Io(l,t)&&Co(l,a);for(let p of l.children)c(p)};return c(e.rootNode),{language:t,callables:n,callSites:r,clojureMembers:[],typeContainerMap:To(e,t),identifierLineMap:s,identifiersByLine:_r(s),fileIdentifiers:new Set(s.keys()),rustAttrReferencedNames:i,crossLanguageDispatchNames:o}}var wo=new Set(["rust","typescript","tsx","javascript","python","clojure"]);function Lr(e,t){let n=A(e,t);return!n||!wo.has(n.language)?null:n.callables.map(r=>({name:r.name,startLine:r.startLine,endLine:r.endLine}))}function ql(e,t){let n=A(e,t);return!n||!wo.has(n.language)?null:n.callSites}function Kl(e,t){return A(e,t)?.typeContainerMap??new Map}import{ElementTypes as Xl,NodeTypes as kr,parse as Jl}from"@vue/compiler-dom";import{parse as tx}from"@vue/compiler-sfc";var Gl=new Set(["children","className","data","e","err","error","ev","event","false","id","idx","index","item","key","null","props","res","result","state","style","true","undefined","val","value"]);function fn(e){return e.length<=2||Gl.has(e)}function mn(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var Ql=De("vue-template-facts"),Zl=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),Yl=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),eu=new Set(["div","span","template"]),tu=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function gn(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n);return Ql.get(e,n,r,()=>nu(n,ft(e,n).template))}function nu(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=Jl(t.body,{comments:!1})}catch{return n}let i=new Set,o=s=>{s.trim()&&i.add(s)};return ko(r.children,t.startLine,n,o),n.structuralTokens=[...i].sort(),n}function ko(e,t,n,r){for(let i of e)if(i.type===kr.ELEMENT)ru(i,t,n,r),ko(i.children,t,n,r);else if(i.type===kr.INTERPOLATION){r("interpolation");let o=Dr(i.content);o&&Do(o,t,i.loc.start.line,n,r)}}function ru(e,t,n,r){let i=uu(e.tag),o={tag:e.tag,normalized:i,kind:lu(e),startLine:gt(t,e.loc.start.line),endLine:gt(t,e.loc.end.line)};o.kind==="component"?(n.componentTags.push(o),r(`component:${i}`)):o.kind==="builtin"?(n.builtinTags.push(o),r(`builtin:${i}`)):(n.nativeTags.push(o),eu.has(e.tag)||r(`native:${e.tag}`));for(let s of e.props)iu(s,t,n,r)}function iu(e,t,n,r){if(e.type===kr.ATTRIBUTE){let a=e.value?.content??null,c=Lo("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(c),r(`prop:${e.name}`);return}let i=su(e),o=Dr(e.exp),s=Lo(ou(e.name),i,o,t,e.loc.start.line,e.loc.end.line);switch(s.kind){case"prop":n.props.push(s),r(`prop:${i}`);break;case"event":n.events.push(s),r(`event:${i}`);break;case"slot":n.slots.push(s),r(`slot:${i}`);break;case"directive":n.directives.push(s),r(`directive:${i}`);break}o&&Do(o,t,e.loc.start.line,n,r)}function Lo(e,t,n,r,i,o){return{kind:e,name:t,value:n,startLine:gt(r,i),endLine:gt(r,o)}}function ou(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function su(e){let t=Dr(e.arg);return t||e.name}function Dr(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function Do(e,t,n,r,i){for(let o of au(e)){let s={name:o,startLine:gt(t,n),endLine:gt(t,n)};r.expressionIdentifiers.push(s),i(`id:${o}`)}}function au(e){let t=new Set,n=cu(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,i;for(;i=r.exec(n);){let o=i[0];tu.has(o)||fn(o)||/^[A-Z_]+$/.test(o)||t.add(o)}return[...t].sort()}function cu(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function lu(e){let t=e.tag;return e.tagType===Xl.COMPONENT?"component":Zl.has(t)?"builtin":Yl.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function uu(e){return mn(e,/[-_:]/)}function gt(e,t){return e+Math.max(0,t-1)}import{createRequire as vu}from"module";import{existsSync as Qe}from"fs";import{basename as Oo,dirname as J,extname as _e,join as ne,relative as Xe,resolve as O,sep as Nu}from"path";import{existsSync as Or,readdirSync as du,statSync as pu}from"fs";import{join as yt,relative as fu}from"path";function Ao(e){let t=mu(e)??Su(e);if(!t||t.length===0)return[];let n=[],r=new Set;for(let i of t)for(let o of bu(e,i)){if(r.has(o))continue;r.add(o);let s=xu(e,o);s&&n.push(s)}return n}function mu(e){let t=yt(e,"pnpm-workspace.yaml");if(!Or(t))return null;try{return gu(at(t,"pnpm workspace manifest"))}catch{return null}}function gu(e){let t=[],n=!1;for(let r of e.split(/\r?\n/)){let i=yu(r);if(!n){/^packages\s*:\s*$/.test(i.trim())&&(n=!0);continue}let o=/^\s+-\s*(.+)$/.exec(i);if(o){let s=hu(o[1].trim());s&&t.push(s);continue}if(i.trim()!=="")break}return t}function yu(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function hu(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function Su(e){let t=yt(e,"package.json");if(!Or(t))return null;try{let n=JSON.parse(at(t,"workspace package manifest"));return n.workspaces?Array.isArray(n.workspaces)?n.workspaces:n.workspaces.packages??[]:null}catch{return null}}function bu(e,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let s=yt(e,t);return Ar(s)?[s]:[]}let n=t.indexOf("*"),r=t.slice(0,n).replace(/\/$/,""),i=t.slice(n+1).replace(/^\//,""),o=yt(e,r||".");return Ar(o)?du(o).map(s=>yt(o,s,i)).filter(Ar):[]}function Ar(e){try{return pu(e).isDirectory()}catch{return!1}}function xu(e,t){let n=yt(t,"package.json");if(!Or(n))return null;try{let r=JSON.parse(at(n,"workspace package manifest"));return typeof r.name!="string"||r.name.length===0?null:{name:r.name,relativeDir:fu(e,t).replace(/\\/g,"/"),exports:r.exports}}catch{return null}}var Eu=ye("indexed-paths",{clearGroups:[]}),Iu=ye("indexed-path-digest",{clearGroups:[]}),Cu=v("tsconfig-alias-config",{clearGroups:["whole-project"]}),_u=v("tsconfig-alias-config-for-dir",{clearGroups:["whole-project"]}),Ru=vu(import.meta.url),Ot;function Tu(){if(Ot!==void 0)return Ot;try{Ot=Ru("typescript")}catch{Ot=null}return Ot}var Fu=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"],Pu=ye("workspace-packages",{clearGroups:["whole-project"]}),Je=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],yn=[".py",".pyi"],Q=[".java",".scala",".kt",".kts"],hn=[".rs"],Sn=[".rb"],bn=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],Oe=[".cs",".vb"],xn=[".dart"],Ze=[".php"],ht=[".clj",".cljs",".cljc"],wu=new Set(Je),Mr=new Set(yn),Mo=new Set(Q),$r=new Set(hn),Br=new Set(Sn),$o=new Set(bn),Bo=new Set(Oe),jr=new Set(xn),jo=new Set(Ze),Vo=new Set(ht),Lu=[{extensions:Je,lookup:wu},{extensions:yn,lookup:Mr},{extensions:Q,lookup:Mo},{extensions:hn,lookup:$r},{extensions:Sn,lookup:Br},{extensions:bn,lookup:$o},{extensions:Oe,lookup:Bo},{extensions:xn,lookup:jr},{extensions:Ze,lookup:jo},{extensions:ht,lookup:Vo}];function Re(e,t){return t.has(_e(e).toLowerCase())}function ku(e){return Re(e,Mr)}function Du(e){return Re(e,Mo)}function Au(e){return Re(e,$r)}function Ou(e){return Re(e,Br)}function Mu(e){return Re(e,$o)}function $u(e){return Re(e,Bo)}function Uo(e){return _e(e).toLowerCase()===".vb"}function Bu(e){return Re(e,jr)}function ju(e){return Re(e,jo)}function Vu(e){return Re(e,Vo)}function Vr(e){let t=_e(e).toLowerCase();for(let n of Lu)if(n.lookup.has(t))return n.extensions;return Je}function Uu(e){return Du(e)||$u(e)||ju(e)}function be(e,t,n){return ku(t)?St(e,t,n):Au(t)?Te(e,t,n):Ou(t)?vn(e,t,n):Mu(t)?Nn(e,t,n):Uu(t)?w(e,n.replace(/\\/g,"."),Vr(t)):Bu(t)?En(e,t,n):Vu(t)?Ur(e,n):Hu(e,t,n)}function Hu(e,t,n){if(!n.startsWith(".")&&!n.startsWith("/"))return zu(e,t,n)??qu(e,n);let r=J(ne(e.config.projectRoot,t)),i=O(r,n),o=Fe(e);for(let s of zr(i)){let a=D(Xe(e.config.projectRoot,s));if(o.has(a)||Qe(s))return a}return D(Xe(e.config.projectRoot,i))}function zu(e,t,n){let r=Zu(e,t);if(!r)return null;let i=Fe(e);for(let o of Wu(r,n)){let s=O(r.baseUrl,o);for(let a of zr(s)){let c=D(Xe(e.config.projectRoot,a));if(i.has(c)||Qe(a))return c}}return null}function Wu(e,t){let n=[];for(let[r,i]of Object.entries(e.paths)){let o=r.indexOf("*");if(o===-1){if(t!==r)continue;n.push(...i);continue}let s=r.slice(0,o),a=r.slice(o+1);if(!t.startsWith(s)||!t.endsWith(a)||t.length<s.length+a.length)continue;let c=t.slice(s.length,t.length-a.length);for(let l of i)n.push(l.includes("*")?l.replace("*",c):l)}return n}function qu(e,t){let n=Gu(Ku(e),t);if(!n)return null;let r=Fe(e);for(let i of Xu(n)){let o=O(e.config.projectRoot,n.pkg.relativeDir,i);for(let s of zr(o)){let a=D(Xe(e.config.projectRoot,s));if(r.has(a)||Qe(s))return a}}return null}function Ku(e){return Pu.get(e,()=>Ao(e.config.projectRoot))}function Gu(e,t){let n=null;for(let r of e){let i=null;t===r.name?i="":t.startsWith(`${r.name}/`)&&(i=t.slice(r.name.length+1)),i!==null&&(!n||r.name.length>n.pkg.name.length)&&(n={pkg:r,subpath:i})}return n}function Xu(e){let t=[],n=Ju(e.pkg.exports,e.subpath);if(n){let r=Qu(n);r&&t.push(r)}return t.push(e.subpath?`src/${e.subpath}`:"src/index"),t}function Ju(e,t){if(!e||typeof e!="object")return null;let n=t===""?".":`./${t}`;return Ho(e[n])}function Ho(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;let t=e;for(let n of["types","import","default","require","node"]){let r=Ho(t[n]);if(r)return r}return null}function Qu(e){let t=e.replace(/^\.\//,"");return t.startsWith("dist/")?`src/${t.slice(5)}`:null}function Zu(e,t){let n=D(J(t));return _u.get(e,n,()=>Yu(e,n))}function Yu(e,t){let n=Tu();if(!n)return null;let r=O(e.config.projectRoot),i=O(r,t);for(;i===r||i.startsWith(r+Nu);){for(let s of Fu){let a=ne(i,s);if(!Qe(a))continue;let c=Cu.get(e,a,()=>ed(n,a));if(c)return c}let o=J(i);if(o===i)break;i=o}return null}function ed(e,t){try{let n=e.readConfigFile(t,e.sys.readFile);if(n.error||!n.config)return null;let r=e.parseJsonConfigFileContent(n.config,e.sys,J(t)),i=r.options.paths;return!i||Object.keys(i).length===0?null:{baseUrl:r.options.baseUrl?O(J(t),r.options.baseUrl):J(t),paths:i}}catch{return null}}function St(e,t,n){let r=Fe(e),i;if(n.startsWith(".")){let o=n.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=J(ne(e.config.projectRoot,t));for(let l=1;l<s;l++)c=J(c);i=a?O(c,a.replace(/\./g,"/")):c}else i=O(e.config.projectRoot,n.replace(/\./g,"/"));for(let o of td(i)){let s=D(Xe(e.config.projectRoot,o));if(r.has(s)||Qe(o))return s}return null}function Te(e,t,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=J(ne(e.config.projectRoot,t)),o;return r.startsWith("crate::")?o=O(e.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=O(i,r.slice(6).replace(/::/g,"/")):o=O(J(i),r.slice(7).replace(/::/g,"/")),Hr(e,nd(o))}function vn(e,t,n){let r=J(ne(e.config.projectRoot,t)),i=O(r,n);return Hr(e,rd(i))}function Nn(e,t,n){let r=J(ne(e.config.projectRoot,t)),i=[O(r,n),O(e.config.projectRoot,n),O(e.config.projectRoot,"include",n),O(e.config.projectRoot,"src",n)];return Hr(e,i)}function w(e,t,n){let r=Fe(e),i=t.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of n){let l=`${o}${c}`,u=[...r].find(d=>d.endsWith(l));if(u)return u}for(let c of n){let l=[...r].find(u=>Oo(u)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(_e(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function En(e,t,n){let r=Fe(e);if(n.startsWith("package:")){let s=n.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=D(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=J(ne(e.config.projectRoot,t)),o=O(i,n);for(let s of id(o)){let a=D(Xe(e.config.projectRoot,s));if(r.has(a)||Qe(s))return a}return null}function Ur(e,t){let n=t.replace(/-/g,"_").replace(/\./g,"/"),r=Fe(e);for(let i of ht){let o=`${n}${i}`,s=[...r].find(a=>a.endsWith(o));if(s)return s}for(let i of ht){let o=[...r].find(s=>Oo(s)===`${n.split("/").pop()}${i}`);if(o)return o}return null}function td(e){let t=_e(e);return Mr.has(t)?[e]:[`${e}.py`,`${e}.pyi`,ne(e,"__init__.py"),ne(e,"__init__.pyi")]}function Hr(e,t){let n=Fe(e);for(let r of t){let i=D(Xe(e.config.projectRoot,r));if(n.has(i)||Qe(r))return i}return null}function nd(e){let t=_e(e);return $r.has(t)?[e]:[`${e}.rs`,ne(e,"mod.rs")]}function rd(e){let t=_e(e);return Br.has(t)?[e]:[`${e}.rb`,ne(e,"index.rb")]}function id(e){let t=_e(e);return jr.has(t)?[e]:[`${e}.dart`,e]}function zr(e){let t=_e(e),n=new Set;if(t){n.add(e);for(let r of Je)n.add(e.slice(0,-t.length)+r)}else for(let r of Je)n.add(`${e}${r}`),n.add(ne(e,`index${r}`));return[...n]}function Fe(e){return Eu.get(e,()=>new Set(ee(e,{includeIgnored:!1}).map(D)))}function Wr(e){return Iu.get(e,()=>Ne([...Fe(e)].sort().join(`
99
+ `)))}import{readdirSync as od}from"fs";import{execFileSync as sd}from"child_process";import{extname as In,join as ad}from"path";var cd=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],_x=[".vue"],zo=[".tsx",".jsx"],Wo=[".vue"],ld=[...zo,...Wo],ud=new Set(zo),dd=new Set(Wo),qo=new Set(cd.map(e=>e.toLowerCase())),pd=[...qo].sort().join(","),Ko=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".codebaseiq-cache","__pycache__",".venv","venv",".idea",".vscode"]);function z(e,t={}){let n=t.includeIndexed??!0,r=t.includeAuxiliary??!0,i=t.extensions?.map(c=>c.toLowerCase()),o=i?new Set(i):qo,s=i?[...o].sort().join(","):pd,a=`${n?"1":"0"}|${r?"1":"0"}|${s}`;return fd.get(e,a,()=>{let c=new Set;if(n)for(let l of ee(e,{includeIgnored:!1}))o.has(In(l).toLowerCase())&&c.add(l);if(r)for(let l of md(e.config.projectRoot,o))e.isIgnored(l)||n&&c.has(l)||c.add(l);return[...c].sort()})}function Rx(e,t={}){let n=!1,r=!1;for(let i of z(e,{extensions:ld})){if(t.scope&&!i.includes(t.scope))continue;let o=In(i).toLowerCase();if(n||=ud.has(o),r||=dd.has(o),n&&r)break}return{react:n,vue:r}}var fd=v("source-files",{clearGroups:[]});function md(e,t){return gd(e,t)??hd(e,t)}function gd(e,t){try{let n=sd("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"],windowsHide:!0}),r=new Set;for(let i of n.split(`
100
+ `)){let o=i.trim();o&&(yd(o)||t.has(In(o).toLowerCase())&&r.add(o))}return r}catch{return null}}function yd(e){return e.split("/").some(t=>Ko.has(t))}function hd(e,t){let n=new Set,r=i=>{let o=i?ad(e,i):e,s;try{s=od(o,{withFileTypes:!0})}catch{return}for(let a of s)if(!Ko.has(a.name)){if(a.isDirectory()){r(i?`${i}/${a.name}`:a.name);continue}t.has(In(a.name).toLowerCase())&&n.add(i?`${i}/${a.name}`:a.name)}};return r(""),n}var Sd=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),bd=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),xd=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),vd=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),Nd=new Set(["catch","for","function","if","return","switch","while"]);function _n(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=Ge(n),n.external&&(t.externalLineCount+=Ge(n),t.externalScriptPaths.push(n.sourcePath));for(let i of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:i});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(..._d(n));let r=Ke(n.astLanguage,n.body);r?Id(n,r.rootNode,t):Cd(n,t)}return Ed(t),t.externalScriptPaths=Xo(t.externalScriptPaths),t}function Ed(e){e.composables=bt(e,"composable"),e.stores=bt(e,"store"),e.reactivity=bt(e,"reactivity"),e.lifecycle=bt(e,"lifecycle"),e.requests=bt(e,"request"),e.macros=bt(e,"macro")}function bt(e,t){return Xo(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function Id(e,t,n){let r=new Set,i=new Set,o=s=>{let a=un(s,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;i.has(l)||(i.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let c=mt(s,e.astLanguage);if(c){let l=`${c.calleeLeaf}:${c.line}`;r.has(l)||(r.add(l),n.calls.push({name:c.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+c.line,categories:Go(c.calleeLeaf),setup:e.setup}))}for(let l of s.children)o(l)};o(t)}function Cd(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||Nd.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+Cn(e.body,n.index??0),categories:Go(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let i=e.startLine+Cn(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let i=e.startLine+Cn(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}}function _d(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),i=n[2];if(!r||!i)continue;let o=e.startLine+Cn(e.body,n.index??0);for(let s of Rd(r))t.push({local:s,source:i,sourcePath:e.sourcePath,line:o,setup:e.setup})}return t}function Rd(e){let t=[],r=e.split(",").map(s=>s.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let i=/\{([^}]*)\}/.exec(e)?.[1];if(i)for(let s of i.split(",")){let a=s.trim();if(!a)continue;let c=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(c??a.replace(/^type\s+/,"").trim())}let o=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return o&&t.push(o),t.filter(s=>/^[A-Za-z_$][\w$]*$/.test(s))}function Go(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),Sd.has(e)&&t.push("reactivity"),bd.has(e)&&t.push("lifecycle"),xd.has(e)&&t.push("request"),vd.has(e)&&t.push("macro"),t}function Cn(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Xo(e){return[...new Set(e)].sort()}var Td=new Set(["in","key","of"]),Fd=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]),Pd=De("vue-component-behavior-profiles");function Jo(e,t={}){let n=z(e,{extensions:[".vue"]}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(i=>qr(e,i)).filter(i=>(t.minTemplateTokens===void 0||i.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function qr(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n),i=Pd.get(e,n,r,()=>wd(e,n,r));return kd(i)}function wd(e,t,n){let r=ft(e,t),i=gn(e,t),o=_n(r),s=Od(i),a=i.expressionIdentifiers.map(y=>y.name).filter(y=>!s.includes(y)).filter((y,S,b)=>b.indexOf(y)===S).sort(),c=i.componentTags.map(y=>y.normalized).filter((y,S,b)=>b.indexOf(y)===S).sort(),l=n?n.split(`
101
+ `).length:0,u=Ge(r.template),d=o.lineCount,p=r.styles.reduce((y,S)=>y+Ge(S),0),f=r.customBlocks.reduce((y,S)=>y+Ge(S),0),{lines:m,paths:g}=Ld(e,t,o);return{file:t,sfc:r,templateFacts:i,scriptFacts:o,templateTokens:new Set(i.structuralTokens),behaviorTokens:Ad(i,o,a),templateBindingNames:a,templateLocalNames:s,componentNames:c,sfcLines:l,totalLines:l+o.externalLineCount,templateLines:u,scriptLines:d,styleLines:p,externalScriptLines:o.externalLineCount,externalScriptPaths:o.externalScriptPaths,customBlockLines:f,delegatedComposableLines:m,delegatedComposablePaths:g}}function Ld(e,t,n){let r=new Set;for(let s of n.composables){let a=n.imports.find(l=>l.local===s);if(!a)continue;let c=be(e,a.sourcePath,a.source);!c||c===t||r.add(c)}let i=[...r].sort();return{lines:i.reduce((s,a)=>{let c=x(e,a);return s+(c?c.split(`
102
+ `).length:0)},0),paths:i}}function kd(e){let t=Dd(e.scriptFacts);return{...e,scriptFacts:t,templateTokens:new Set(e.templateTokens),behaviorTokens:new Set(e.behaviorTokens),templateBindingNames:[...e.templateBindingNames],templateLocalNames:[...e.templateLocalNames],componentNames:[...e.componentNames],externalScriptPaths:t.externalScriptPaths,delegatedComposablePaths:[...e.delegatedComposablePaths]}}function Dd(e){return{...e,imports:e.imports.map(t=>({...t})),functions:e.functions.map(t=>({...t})),calls:e.calls.map(t=>({...t,categories:[...t.categories]})),composables:[...e.composables],stores:[...e.stores],reactivity:[...e.reactivity],lifecycle:[...e.lifecycle],requests:[...e.requests],macros:[...e.macros],externalScriptPaths:[...e.externalScriptPaths],unresolvedScripts:e.unresolvedScripts.map(t=>({...t}))}}function Ad(e,t,n){let r=new Set;for(let i of t.composables)r.add(`composable:${i}`);for(let i of t.stores)r.add(`store:${i}`);for(let i of t.reactivity)r.add(`reactivity:${i}`);for(let i of t.lifecycle)r.add(`lifecycle:${i}`);for(let i of t.requests)r.add(`request:${i}`);for(let i of t.macros)r.add(`macro:${i}`);for(let i of t.functions){if(Fd.has(i.name))continue;r.add(`function:${i.name}`);let o=/^[a-z]+/.exec(i.name)?.[0]??null;o&&o.length>2&&o!==i.name&&r.add(`function-verb:${o}`)}for(let i of e.events)r.add(`template-event:${i.name}`);for(let i of n)r.add(`template-binding:${i}`);return r}function Od(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of Md(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of Qo(n.value))t.add(r);return[...t].sort()}function Md(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?Qo(t[1]??""):[]}function Qo(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];Td.has(r)||t.push(r)}return t}import{extname as $d}from"path";var Bd=[".tsx",".jsx"],Zo=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),jd=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),Vd=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),Ud=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),Hd=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),zd=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),Wd=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),qd=De("react-component-behavior-profiles"),Yo=le({kind:"react-component-behavior-profiles",invalidation:X("react-component-behavior-profiles"),serialize:Jd,deserialize:Qd});function rs(e,t={}){let n=z(e,{extensions:Bd}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(i=>Gr(e,i)).filter(i=>(t.minJsxTokens===void 0||i.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function Gr(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n);return qd.get(e,n,r,()=>Kd(e,n,r)).map(Xd)}function Kd(e,t,n){let r=he(e,t,n),i=Yo.read(e,t,r);if(i)return i;let o=Gd(e,t);return Yo.write(e,t,r,o),o}function Gd(e,t){let n=Yd(t);if(!n)return[];let r=R(e,t);if(!r)return[];let i=Pt(e,t).length;return ep(r.rootNode,n).filter(s=>s.kind==="hook"||Xr(s.bodyNode)).map(s=>{let a=ap(s.bodyNode),c=pp(s.bodyNode,n);return{file:t,name:s.name,kind:s.kind,startLine:s.node.startPosition.row,endLine:s.node.endPosition.row,loc:Math.max(1,s.node.endPosition.row-s.node.startPosition.row+1),fileLines:i,jsxTokens:a.tokens,behaviorTokens:c.tokens,componentNames:Pe(a.componentNames),nativeTags:Pe(a.nativeTags),propNames:Pe(a.propNames),eventNames:Pe(a.eventNames),hookNames:Pe(c.hookNames),requestNames:Pe(c.requestNames),stateNames:Pe(c.stateNames),effectNames:Pe(c.effectNames),handlerNames:Pe(c.handlerNames)}})}function Xd(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function Jd(e){return JSON.stringify(e.map(t=>({...t,jsxTokens:[...t.jsxTokens],behaviorTokens:[...t.behaviorTokens]})))}function Qd(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=[];for(let r of t){let i=Zd(r);if(!i)return null;n.push(i)}return n}catch{return null}}function Zd(e){if(!ke(e))return null;let{file:t,name:n,kind:r,startLine:i,endLine:o,loc:s,fileLines:a,jsxTokens:c,behaviorTokens:l,componentNames:u,nativeTags:d,propNames:p,eventNames:f,hookNames:m,requestNames:g,stateNames:y,effectNames:S,handlerNames:b}=e;if(typeof t!="string"||typeof n!="string"||r!=="component"&&r!=="hook"||!Rn(i)||!Rn(o)||!Rn(s)||!Rn(a))return null;let N={jsxTokens:Y(c),behaviorTokens:Y(l),componentNames:Y(u),nativeTags:Y(d),propNames:Y(p),eventNames:Y(f),hookNames:Y(m),requestNames:Y(g),stateNames:Y(y),effectNames:Y(S),handlerNames:Y(b)};return Object.values(N).some(E=>E===null)?null:{file:t,name:n,kind:r,startLine:i,endLine:o,loc:s,fileLines:a,jsxTokens:new Set(N.jsxTokens),behaviorTokens:new Set(N.behaviorTokens),componentNames:N.componentNames,nativeTags:N.nativeTags,propNames:N.propNames,eventNames:N.eventNames,hookNames:N.hookNames,requestNames:N.requestNames,stateNames:N.stateNames,effectNames:N.effectNames,handlerNames:N.handlerNames}}function Rn(e){return typeof e=="number"&&Number.isFinite(e)}function Yd(e){let t=$d(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:H(e)}function ep(e,t){let n=[],r=new Set,i=o=>{let s=tp(o);if(s&&(!op(o)||s.kind==="component")){let a=`${s.name}:${s.node.startIndex}:${s.node.endIndex}`;r.has(a)||(r.add(a),n.push(s))}for(let a of o.namedChildren)i(a)};return(t==="tsx"||t==="javascript")&&i(e),n}function tp(e){if(e.type==="class_declaration"){let o=Kr(e);if(!o||!/^[A-Z]/.test(o))return null;let s=np(e);return!s||!rp(e)&&!Xr(s)?null:{name:o,kind:"component",node:e,bodyNode:s}}if(e.type==="function_declaration"){let o=Kr(e);return!o||!es(o)?null:{name:o,kind:ts(o),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),r=Mt(t);if(!r||!n||!es(r))return null;let i=ip(n);return i?{name:r,kind:ts(r),node:e,bodyNode:i}:null}function np(e){for(let t of e.namedChildren)if(t.type==="class_body")for(let n of t.namedChildren){if(n.type!=="method_definition")continue;if((n.childForFieldName("name")??n.namedChild(0))?.text==="render")return n}return null}function rp(e){return/\b(?:React\.)?(?:Pure)?Component\b/.test(e.text)}function es(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function ts(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function ip(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=sp(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(i=>i.type==="arguments")?.namedChildren.find(i=>i.type==="arrow_function"||i.type==="function_expression")??null}function op(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function Kr(e){return Mt(e.childForFieldName("name")??e.namedChild(0))}function sp(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function Xr(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(Xr)}function ap(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=r=>{r.type==="jsx_opening_element"||r.type==="jsx_self_closing_element"?cp(r,t):r.type==="jsx_element"&&r.text.trimStart().startsWith("<>")?t.tokens.add("jsx:fragment"):r.type==="jsx_expression"?lp(r,t):r.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let i of r.children)n(i)};return n(e),t}function cp(e,t){let n=up(e),r=!1;if(n){let i=ns(n),o=i==="Fragment"||i==="React.Fragment";r=hp(i)&&!o,o?t.tokens.add("jsx:fragment"):r?(t.componentNames.add(i),t.tokens.add(`component:${i}`)):(t.nativeTags.add(i),t.tokens.add(`native:${i}`))}for(let i of e.namedChildren)if(i.type==="jsx_attribute"){let o=dp(i);if(!o)continue;let s=ns(o);if(s.startsWith("on")&&s.length>2){let a=s.slice(2).replace(/^[A-Z]/,c=>c.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else Wd.has(s)||(t.propNames.add(s),t.tokens.add(`${r?"prop":"native-prop"}:${s}`))}else i.type==="jsx_spread_attribute"&&t.tokens.add(is(i))}function lp(e,t){let n=e.text;/^\{\s*\.\.\./.test(n)&&t.tokens.add(is(e)),os(e)&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let r of Sp(n))fn(r)||t.tokens.add(`binding:${r}`)}function is(e){let t=/^\{\s*\.\.\.\s*([^}]+)\s*\}$/.exec(e.text)?.[1],n=e.namedChildren.find(o=>o.type!=="comment"),r=t??n?.text??"",i=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.exec(r.trim())?.[0];return i?`prop:spread:${i}`:"prop:spread"}function os(e){return e.type==="ternary_expression"||e.type==="conditional_expression"?!0:e.namedChildren.some(os)}function up(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function dp(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function pp(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},r=i=>{if(i.type==="call_expression"){let o=mt(i,t);o&&fp(o.calleeLeaf,n)}else if(i.type==="variable_declarator")gp(i,n);else if(i.type==="function_declaration"){let o=Kr(i);o&&ss(o,n)}for(let o of i.namedChildren)r(o)};return r(e),n}function fp(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!Zo.has(e)&&!Ud.has(e)&&t.tokens.add(`hook:${e}`)),Zo.has(e)&&t.tokens.add(`react-hook:${e}`),jd.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),Vd.has(e)&&t.tokens.add(`state-hook:${e}`),mp(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function mp(e){if(Hd.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function gp(e,t){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&r?.text.includes("useState")){let o=n.namedChildren.find(a=>Mt(a)),s=Mt(o);s&&(t.stateNames.add(s),t.tokens.add(`state:${s}`))}let i=Mt(n);i&&ss(i,t)}function ss(e,t){let n=yp(e);!n||!zd.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function yp(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function hp(e){return/^[A-Z]/.test(e)||e.includes(".")}function ns(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function Mt(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function Sp(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];t.includes(r)||t.push(r)}return t}function Pe(e){return[...e].sort()}function ov(e){return{capability:(t,n)=>bp(t,n),reactProfiles:(t={})=>rs(e,t),reactProfilesForFile:t=>Gr(e,t),vueProfiles:(t={})=>Jo(e,t),vueProfileForFile:t=>qr(e,t),vueTemplateFacts:t=>gn(e,t),vueScriptFacts:t=>_n(ft(e,t))}}function bp(e,t){let n=e.startsWith("react-")?"react":"vue";if(t===void 0)return{slot:e,available:!0,framework:n};let r=t.replace(/\\/g,"/").toLowerCase();return n==="react"&&!r.endsWith(".tsx")&&!r.endsWith(".jsx")?{slot:e,available:!1,framework:n,reason:"React behavior profiles are only available for .tsx and .jsx files"}:n==="vue"&&!r.endsWith(".vue")?{slot:e,available:!1,framework:n,reason:"Vue behavior facts are only available for .vue files"}:{slot:e,available:!0,framework:n}}function xp(e,t,n={}){let r=A(e,t);if(!r)return[];let i=[];if(n.includeCrossLanguageDispatchNames)for(let o of r.crossLanguageDispatchNames)i.push({name:o,kind:"cross-language-dispatch",occurrences:1});if(n.includeRustAttributeNames&&r.language==="rust")for(let o of r.rustAttrReferencedNames)i.push({name:o,kind:"rust-attribute",occurrences:1});return i}import{basename as cs}from"path";function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qr(e){return e.replace(/'''[\s\S]*?'''/g,Me).replace(/"""[\s\S]*?"""/g,Me).replace(/#.*$/gm,Me).replace(/\/\/.*$/gm,Me).replace(/\/\*[\s\S]*?\*\//g,Me).replace(/`(?:\\[\s\S]|[^`])*`/g,Me).replace(/'(?:\\.|[^'\\\r\n])*'/g,Me).replace(/"(?:\\.|[^"\\\r\n])*"/g,Me)}function vv(e){return as(e,{maskStrings:!1})}function Nv(e){return as(e,{maskStrings:!0})}function as(e,t){let n="",r=0,i=e.length;for(;r<i;){if(e[r]==="/"&&e[r+1]==="/"){let s=e.indexOf(`
103
103
  `,r),a=s===-1?i:s;n+=Jr(e,r,a),r=a;continue}if(e[r]==="/"&&e[r+1]==="*"){let s=e.indexOf("*/",r+2),a=s===-1?i:s+2;n+=Jr(e,r,a),r=a;continue}let o=e[r];if(o==="`"||o==="'"||o==='"'){let s=o,a=r+1;for(;a<i;){if(e[a]==="\\"){a+=2;continue}if(e[a]===s){a+=1;break}if(s!=="`"&&e[a]===`
104
104
  `)break;a+=1}n+=t.maskStrings?Jr(e,r,a):e.slice(r,a),r=a;continue}n+=o,r+=1}return n}function Jr(e,t,n){let r="";for(let i=t;i<n;i+=1)r+=e[i]===`
105
105
  `?`
106
- `:" ";return r}function Me(e){return e.replace(/[^\r\n]/g," ")}var xv=ze("stripped-lines",{clearGroups:["whole-project","source-file"]});lt({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{Tn=null,$t=""},clearFile:()=>{Tn=null,$t=""}});var Tn=null,$t="";function vp(e){return Tn===e||(Tn=e,$t=Qr(e)),$t}function $e(e,t,n){let r=vp(e);return`${r.slice(0,t)}${" ".repeat(n-t)}${r.slice(n)}`}function W(e,t){return new RegExp(`\\b${re(t)}\\b`,"m").test(e)}function xt(e,t){let n=new Set,r=new RegExp(`\\b${re(t)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let i of e.matchAll(r)){let o=i[1];o&&n.add(o)}return[...n]}function Zr(e){let t=0;for(let n of e)n==="("&&(t+=1),n===")"&&(t-=1);return t}var Np=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function q(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];(o==="{"||o==="["||o==="(")&&n++,(o==="}"||o==="]"||o===")")&&n--,o===","&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function Z(e,t){for(let n of e.namedChildren)if(n.type===t)return n;return null}function L(e,t){let n=new Set,r=(i,o)=>{let s=o||t.has(i.type);!s&&Np.has(i.type)&&n.add(i.text);for(let a of i.children)r(a,s)};return r(e.rootNode,!1),n}function ue(e,t,n,r,i,o,s){return{importedName:i,localName:o,sourcePath:s??w(e,r,Vr(t)),kind:"named",used:W(n,o),usedMembers:[]}}function F(e,t,n,r,i="named",o={}){return{importedName:e,localName:t,sourcePath:n,kind:i,used:r.has(t),usedMembers:[],isTypeOnly:o.isTypeOnly}}function we(e,t,n,r,i="named",o=[],s={}){return{importedName:e,localName:t,sourcePath:n,kind:i,used:r,usedMembers:o,isTypeOnly:s.isTypeOnly}}function Ze(e,t){return{importedName:e,localName:null,sourcePath:t,kind:"side-effect",used:!0,usedMembers:[]}}function Ye(e,t,n={}){return{importedName:e,localName:n.localName??null,sourcePath:t,kind:"namespace",used:n.used??!0,usedMembers:n.usedMembers??[],isTypeOnly:n.isTypeOnly}}function ie(e,t,n){let r=[];for(let i of e.matchAll(t)){let o=i[0];if(!o||typeof i.index!="number")continue;let s=$e(e,i.index,i.index+o.length);for(let a of n(i,s))r.push(a)}return r}function oe(e,t,n,r,i){let o=Lt(e,t,i)?.tree??null;if(o){let s=n(o);if(s)return s}return r()}function Fn(e,t,n,r,i){let o=Lt(e,t,i)?.tree??null,s=H(t),a=s?n[s]:void 0;return o&&a?a(o):r()}function cs(e,t,n){return oe(e,t,r=>Ip(e,t,r),()=>Ep(e,t,n),n)}function Ep(e,t,n){return ie(n,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(r,i)=>{let o=r[1]?.trim();if(!o)return[];let s=as(o).replace(/\.[^.]+$/,"");return[we(o,s,Nn(e,t,o),W(i,s))]})}function Ip(e,t,n){let r=L(n,new Set(["preproc_include"])),i=[];for(let o of n.rootNode.descendantsOfType("preproc_include")){let s=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){s=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){s=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!s)continue;let a=as(s).replace(/\.[^.]+$/,"");i.push(F(s,a,Nn(e,t,s),r))}return i}var Cp=new Set([":require",":require-macros",":use"]),ti=String.raw`A-Za-z0-9_$*+!?.<>=-`;function us(e,t,n){let r=Op(n);if(!r)return[];let i=Ap(n,r.start,r.end),o=[];for(let s of r.children.slice(2)){if(s.type!=="list"||s.children.length===0)continue;let a=se(s.children[0]);if(a){if(Cp.has(a)){for(let c of Tp(s.children.slice(1)))o.push(...Rp(e,c,i));continue}if(a===":import")for(let c of Pp(s.children.slice(1)))o.push(c)}}return o}function _p(e){return e.type==="list"&&se(e.children[0])==="ns"}function Rp(e,t,n){let r=Ur(e,t.namespace),i=t.alias??t.namespace,o=Lp(n,i),s=[{importedName:t.namespace,localName:i,sourcePath:r,kind:"namespace",used:t.refers.length>0||t.referAll||o.length>0||kp(n,t.namespace),usedMembers:o}];t.referAll&&s.push({importedName:"*",localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]});for(let a of t.refers)s.push({importedName:a,localName:a,sourcePath:r,kind:"named",used:Dp(n,a),usedMembers:[]});return s}function Tp(e){return e.flatMap(t=>Pn(t,null))}function Pn(e,t){if(e.type==="atom")return e.text.startsWith(":")?[]:[{namespace:ei(t,e.text),alias:null,refers:[],referAll:!1}];if(e.type==="vector")return e.children.length>0&&se(e.children[0])===null?e.children.flatMap(n=>Pn(n,t)):Fp(e,t);if(e.type==="list"&&e.children.length>0){let n=se(e.children[0]);return n?!n||n.startsWith(":")?[]:e.children.slice(1).flatMap(r=>Pn(r,ei(t,n))):e.children.flatMap(r=>Pn(r,t))}return[]}function Fp(e,t){let n=se(e.children[0]);if(!n||n.startsWith(":"))return[];let r={namespace:ei(t,n),alias:null,refers:[],referAll:!1};for(let i=1;i<e.children.length;i+=1){let o=se(e.children[i]);if(!o?.startsWith(":"))continue;let s=e.children[i+1];if((o===":as"||o===":as-alias")&&s){r.alias=se(s),i+=1;continue}o===":refer"&&s&&(se(s)===":all"?r.referAll=!0:(s.type==="vector"||s.type==="list")&&r.refers.push(...s.children.map(se).filter(wp)),i+=1)}return[r]}function Pp(e){let t=[];for(let n of e){if(n.type==="atom"){let i=n.text.split(".").pop()??n.text;t.push(we(i,i,null,!0));continue}if(n.type!=="vector")continue;let r=se(n.children[0]);if(r)for(let i of n.children.slice(1)){let o=se(i);o&&t.push(we(`${r}.${o}`,o,null,!0))}}return t}function ei(e,t){return e?`${e}.${t}`:t}function se(e){return e?.type==="atom"?e.text:null}function wp(e){return!!(e&&!e.startsWith(":"))}function Lp(e,t){let n=new Set,r=new RegExp(`${ni()}${re(t)}\\s*/\\s*([${ti}]+)`,"g");for(let i of e.matchAll(r)){let o=i[1];o&&n.add(o)}return[...n]}function kp(e,t){return new RegExp(`${ni()}${re(t)}\\s*/`,"m").test(e)}function Dp(e,t){return new RegExp(`${ni()}${re(t)}(?![${ti}])`,"m").test(e)}function ni(){return`(?<![${ti}])`}function Ap(e,t,n){let r="",i=0;for(;i<e.length;){if(i>=t&&i<n){r+=e[i]===`
106
+ `:" ";return r}function Me(e){return e.replace(/[^\r\n]/g," ")}var Ev=ze("stripped-lines",{clearGroups:["whole-project","source-file"]});ut({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{Tn=null,$t=""},clearFile:()=>{Tn=null,$t=""}});var Tn=null,$t="";function vp(e){return Tn===e||(Tn=e,$t=Qr(e)),$t}function $e(e,t,n){let r=vp(e);return`${r.slice(0,t)}${" ".repeat(n-t)}${r.slice(n)}`}function W(e,t){return new RegExp(`\\b${re(t)}\\b`,"m").test(e)}function xt(e,t){let n=new Set,r=new RegExp(`\\b${re(t)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let i of e.matchAll(r)){let o=i[1];o&&n.add(o)}return[...n]}function Zr(e){let t=0;for(let n of e)n==="("&&(t+=1),n===")"&&(t-=1);return t}var Np=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function q(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];(o==="{"||o==="["||o==="(")&&n++,(o==="}"||o==="]"||o===")")&&n--,o===","&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function Z(e,t){for(let n of e.namedChildren)if(n.type===t)return n;return null}function L(e,t){let n=new Set,r=(i,o)=>{let s=o||t.has(i.type);!s&&Np.has(i.type)&&n.add(i.text);for(let a of i.children)r(a,s)};return r(e.rootNode,!1),n}function ue(e,t,n,r,i,o,s){return{importedName:i,localName:o,sourcePath:s??w(e,r,Vr(t)),kind:"named",used:W(n,o),usedMembers:[]}}function F(e,t,n,r,i="named",o={}){return{importedName:e,localName:t,sourcePath:n,kind:i,used:r.has(t),usedMembers:[],isTypeOnly:o.isTypeOnly}}function we(e,t,n,r,i="named",o=[],s={}){return{importedName:e,localName:t,sourcePath:n,kind:i,used:r,usedMembers:o,isTypeOnly:s.isTypeOnly}}function Ye(e,t){return{importedName:e,localName:null,sourcePath:t,kind:"side-effect",used:!0,usedMembers:[]}}function et(e,t,n={}){return{importedName:e,localName:n.localName??null,sourcePath:t,kind:"namespace",used:n.used??!0,usedMembers:n.usedMembers??[],isTypeOnly:n.isTypeOnly}}function ie(e,t,n){let r=[];for(let i of e.matchAll(t)){let o=i[0];if(!o||typeof i.index!="number")continue;let s=$e(e,i.index,i.index+o.length);for(let a of n(i,s))r.push(a)}return r}function oe(e,t,n,r,i){let o=Lt(e,t,i)?.tree??null;if(o){let s=n(o);if(s)return s}return r()}function Fn(e,t,n,r,i){let o=Lt(e,t,i)?.tree??null,s=H(t),a=s?n[s]:void 0;return o&&a?a(o):r()}function ls(e,t,n){return oe(e,t,r=>Ip(e,t,r),()=>Ep(e,t,n),n)}function Ep(e,t,n){return ie(n,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(r,i)=>{let o=r[1]?.trim();if(!o)return[];let s=cs(o).replace(/\.[^.]+$/,"");return[we(o,s,Nn(e,t,o),W(i,s))]})}function Ip(e,t,n){let r=L(n,new Set(["preproc_include"])),i=[];for(let o of n.rootNode.descendantsOfType("preproc_include")){let s=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){s=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){s=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!s)continue;let a=cs(s).replace(/\.[^.]+$/,"");i.push(F(s,a,Nn(e,t,s),r))}return i}var Cp=new Set([":require",":require-macros",":use"]),ti=String.raw`A-Za-z0-9_$*+!?.<>=-`;function ds(e,t,n){let r=Op(n);if(!r)return[];let i=Ap(n,r.start,r.end),o=[];for(let s of r.children.slice(2)){if(s.type!=="list"||s.children.length===0)continue;let a=se(s.children[0]);if(a){if(Cp.has(a)){for(let c of Tp(s.children.slice(1)))o.push(...Rp(e,c,i));continue}if(a===":import")for(let c of Pp(s.children.slice(1)))o.push(c)}}return o}function _p(e){return e.type==="list"&&se(e.children[0])==="ns"}function Rp(e,t,n){let r=Ur(e,t.namespace),i=t.alias??t.namespace,o=Lp(n,i),s=[{importedName:t.namespace,localName:i,sourcePath:r,kind:"namespace",used:t.refers.length>0||t.referAll||o.length>0||kp(n,t.namespace),usedMembers:o}];t.referAll&&s.push({importedName:"*",localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]});for(let a of t.refers)s.push({importedName:a,localName:a,sourcePath:r,kind:"named",used:Dp(n,a),usedMembers:[]});return s}function Tp(e){return e.flatMap(t=>Pn(t,null))}function Pn(e,t){if(e.type==="atom")return e.text.startsWith(":")?[]:[{namespace:ei(t,e.text),alias:null,refers:[],referAll:!1}];if(e.type==="vector")return e.children.length>0&&se(e.children[0])===null?e.children.flatMap(n=>Pn(n,t)):Fp(e,t);if(e.type==="list"&&e.children.length>0){let n=se(e.children[0]);return n?!n||n.startsWith(":")?[]:e.children.slice(1).flatMap(r=>Pn(r,ei(t,n))):e.children.flatMap(r=>Pn(r,t))}return[]}function Fp(e,t){let n=se(e.children[0]);if(!n||n.startsWith(":"))return[];let r={namespace:ei(t,n),alias:null,refers:[],referAll:!1};for(let i=1;i<e.children.length;i+=1){let o=se(e.children[i]);if(!o?.startsWith(":"))continue;let s=e.children[i+1];if((o===":as"||o===":as-alias")&&s){r.alias=se(s),i+=1;continue}o===":refer"&&s&&(se(s)===":all"?r.referAll=!0:(s.type==="vector"||s.type==="list")&&r.refers.push(...s.children.map(se).filter(wp)),i+=1)}return[r]}function Pp(e){let t=[];for(let n of e){if(n.type==="atom"){let i=n.text.split(".").pop()??n.text;t.push(we(i,i,null,!0));continue}if(n.type!=="vector")continue;let r=se(n.children[0]);if(r)for(let i of n.children.slice(1)){let o=se(i);o&&t.push(we(`${r}.${o}`,o,null,!0))}}return t}function ei(e,t){return e?`${e}.${t}`:t}function se(e){return e?.type==="atom"?e.text:null}function wp(e){return!!(e&&!e.startsWith(":"))}function Lp(e,t){let n=new Set,r=new RegExp(`${ni()}${re(t)}\\s*/\\s*([${ti}]+)`,"g");for(let i of e.matchAll(r)){let o=i[1];o&&n.add(o)}return[...n]}function kp(e,t){return new RegExp(`${ni()}${re(t)}\\s*/`,"m").test(e)}function Dp(e,t){return new RegExp(`${ni()}${re(t)}(?![${ti}])`,"m").test(e)}function ni(){return`(?<![${ti}])`}function Ap(e,t,n){let r="",i=0;for(;i<e.length;){if(i>=t&&i<n){r+=e[i]===`
107
107
  `?`
108
- `:" ",i+=1;continue}let o=e[i];if(o===";"){let s=pn(e,i);r+=ls(e.slice(i,s)),i=s;continue}if(o==='"'){let s=At(e,i,0).index;r+=ls(e.slice(i,s)),i=s;continue}r+=o,i+=1}return r}function Op(e){let t=0;for(;t<e.length&&(t=ri(e,t),!(t>=e.length));){let n=wn(e,t);if(!n){t+=1;continue}if(_p(n.form))return n.form;t=n.index}return null}function wn(e,t){let n=ri(e,t);if(e.startsWith("#?@",n)||e.startsWith("#?",n))return Mp(e,n);if(e.startsWith("#_",n)){let i=wn(e,n+2);return i?{form:{type:"atom",text:"",start:n,end:i.index},index:i.index}:null}for(;Tr(e[n]);)n+=1;let r=e[n];return r?r==="("?Yr(e,n,"list",")"):r==="["?Yr(e,n,"vector","]"):r==="{"?Yr(e,n,"map","}"):r==='"'?{form:{type:"atom",text:"",start:n,end:At(e,n,0).index},index:At(e,n,0).index}:Bp(e,n):null}function Mp(e,t){let n=e.startsWith("#?@",t)?3:2,r=wn(e,t+n);return r?{form:{type:"list",children:r.form.type==="list"||r.form.type==="vector"||r.form.type==="map"?$p(r.form.children):[],start:t,end:r.index},index:r.index}:null}function $p(e){let t=[];for(let n=0;n<e.length;n+=2){let r=se(e[n]),i=e[n+1];r?.startsWith(":")&&i&&t.push(i)}return t}function Yr(e,t,n,r){let i=[],o=t+1;for(;o<e.length;){if(o=ri(e,o),e[o]===r)return{form:{type:n,children:i,start:t,end:o+1},index:o+1};let s=wn(e,o);if(!s){o+=1;continue}s.form.type==="atom"&&s.form.text===""||i.push(s.form),o=s.index}return{form:{type:n,children:i,start:t,end:e.length},index:e.length}}function Bp(e,t){let n=t;for(;n<e.length&&!Fr(e[n]);)n+=1;return{form:{type:"atom",text:e.slice(t,n),start:t,end:n},index:n}}function ri(e,t){let n=t;for(;n<e.length;){let r=e[n];if(/\s|,/.test(r)){n+=1;continue}if(r===";"){n=pn(e,n);continue}break}return n}function ls(e){return e.replace(/[^\r\n]/g," ")}function ds(e,t,n){let r=[];for(let i of n.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=i[1]?.trim(),s=i[2]?.trim()??null,a=i[0];if(!o||!a||typeof i.index!="number")continue;let c=$e(n,i.index,i.index+a.length);r.push({importedName:o,localName:s,sourcePath:En(e,t,o),kind:s?"namespace":"side-effect",used:s?W(c,s):!0,usedMembers:s?xt(c,s):[]})}return r}function ps(e,t,n){let r=[];for(let i of n.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=i[1]?.trim();o&&r.push({specifier:o,sourcePath:En(e,t,o)})}return r}function fs(e,t,n){return Fn(e,t,{csharp:r=>Vp(e,t,r),vb:r=>jp(e,t,r)},()=>{let r=Vo(t)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return ie(n,r,(i,o)=>{let s=i[1]?.trim();if(!s)return[];let[a,c]=s.split(/\s*=\s*/),l=!!c,u=(l?c:a)?.trim()??s,d=u.split(".").pop()??u,p=l?a?.trim()??d:d;return[ue(e,t,o,u,d,p,w(e,u,Oe))]})},n)}function jp(e,t,n){let r=L(n,new Set(["imports_statement"])),i=[];for(let o of n.rootNode.descendantsOfType("imports_statement")){let s=o.namedChildren.filter(p=>p.type==="namespace_name");if(s.length===0)continue;let a=s[s.length-1],c=s.length>1?s[0]:null,l=a.text,u=l.split(".").pop()??l,d=c?.text??u;i.push(F(u,d,w(e,l,Oe),r,c?"namespace":"named"))}return i}function Vp(e,t,n){let r=L(n,new Set(["using_directive"])),i=[];for(let o of n.rootNode.descendantsOfType("using_directive")){let s=o.namedChildren;if(s.length===0)continue;let a=null,c;s.length>=2&&s[0].type==="identifier"&&(s[1].type==="qualified_name"||s[1].type==="identifier")?(a=s[0],c=s[1]):c=s[s.length-1];let l=c.text,u=l.split(".").pop()??l,d=a?.text??u;i.push(F(u,d,w(e,l,Oe),r,a?"namespace":"named"))}return i}var Up=v("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function ms(e,t){return Up.get(e,t,()=>{let n=new Set,r=x(e,t);if(!r)return n;let o=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,s=>s.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,s=>s.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,s=>s.replace(/[^\r\n]/g," "));for(let s of o.matchAll(/[A-Za-z_$][\w$]*/g))n.add(s[0]);return n})}function ii(e,t,n){return oe(e,t,r=>zp(e,t,r),()=>Hp(e,t,n),n)}function Hp(e,t,n){return tf(n).flatMap(r=>nf(e,t,r.clause,r.specifier,r.start,r.end,n))}function zp(e,t,n){let r=Wp(e,t,n),i=[];for(let o of n.rootNode.descendantsOfType("import_statement"))i.push(...qp(e,t,n,o,r));return i}function Wp(e,t,n){let r=L(n,new Set(["import_statement"]));if(Se(t))for(let i of ms(e,t))r.add(i);return r}function qp(e,t,n,r,i){let o=Qp(r);if(!o)return[];let s=be(e,t,o),a=Z(r,"import_clause");return a?Kp(n,a,s,i,Zp(r.text)):[Ze("*",s)]}function Kp(e,t,n,r,i){let o=[];for(let s of t.namedChildren)if(s.type==="identifier")o.push(Gp(s.text,n,r,i));else if(s.type==="namespace_import"){let a=Xp(e,s,n,r,i);a&&o.push(a)}else s.type==="named_imports"&&o.push(...Jp(s,n,r,i));return o}function Gp(e,t,n,r){return F("default",e,t,n,"default",{isTypeOnly:r})}function Xp(e,t,n,r,i){let s=Z(t,"identifier")?.text??"";if(!s)return null;let a=ef(e,s);return Ye("*",n,{localName:s,usedMembers:a,isTypeOnly:i,used:a.length>0||r.has(s)})}function Jp(e,t,n,r){let i=[];for(let o of e.namedChildren){if(o.type!=="import_specifier")continue;let s=o.namedChild(0),a=o.namedChild(1);if(!s)continue;let c=s.text,l=a?.text??c;i.push(F(c,l,t,n,"named",{isTypeOnly:r||Yp(o.text)}))}return i}function Qp(e){let t=Z(e,"string");if(!t)return null;let n=Z(t,"string_fragment");return n?n.text:null}function Zp(e){return/^\s*import\s+type\b/.test(e)}function Yp(e){return/^\s*type\b/.test(e.trim())}function ef(e,t){let n=new Set;for(let r of e.rootNode.descendantsOfType("member_expression")){let i=r.namedChild(0),o=r.namedChild(1);!i||!o||i.type!=="identifier"||i.text!==t||(o.type==="property_identifier"||o.type==="identifier")&&n.add(o.text)}return[...n]}function tf(e){let t=[],n=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(n)){let o=i[0],s=i[1],a=i[2];!o||!a||typeof i.index!="number"||t.push({clause:s,specifier:a,start:i.index,end:i.index+o.length})}let r=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(r)){let o=i[0],s=i[1];!o||!s||typeof i.index!="number"||t.push({clause:null,specifier:s,start:i.index,end:i.index+o.length})}return t.sort((i,o)=>i.start-o.start)}function nf(e,t,n,r,i,o,s){let a=be(e,t,r),c=$e(s,i,o);return n?rf(n).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let d=xt(c,u.localName);return Ye(u.importedName,u.sourcePath,{localName:u.localName,usedMembers:d,used:d.length>0||W(c,u.localName),isTypeOnly:u.isTypeOnly})}return u.kind==="side-effect"?Ze(u.importedName,u.sourcePath):we(u.importedName,u.localName??"",u.sourcePath,u.localName?W(c,u.localName):!1,u.kind,[],{isTypeOnly:u.isTypeOnly})}):[Ze("*",a)]}function rf(e){let t=e.trim(),n=/^type\b/.test(t),r=t.replace(/^type\s+/,""),[i,o]=of(r),s=[];return i&&s.push(...gs(i,n)),o&&s.push(...gs(o,n)),s}function gs(e,t){let n=e.trim();if(!n)return[];if(n.startsWith("{")){let r=n.slice(1,-1).trim();return r?q(r).map(i=>{let o=i.trim(),s=t||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[c,l]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(l??c).trim(),kind:"named",isTypeOnly:s}}):[]}return n.startsWith("* as ")?[{importedName:"*",localName:n.slice(5).trim(),kind:"namespace",isTypeOnly:t}]:[{importedName:"default",localName:n,kind:"default",isTypeOnly:t}]}function of(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r==="{"&&t++,r==="}"&&t--,r===","&&t===0)return[e.slice(0,n).trim(),e.slice(n+1).trim()]}return[e.trim(),null]}function oi(e,t,n){let r=R(e,t);return r?df(e,t,r):sf(e,t,n)}function sf(e,t,n){return[...af(e,t,n),...cf(e,t,n),...lf(e,t,n)]}function af(e,t,n){let r=[],i=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[1]??"",a=o[2]??"",c=q(s).map(d=>uf(d.trim())).filter(d=>!!d),l=vt(n,o.index),u=vt(n,o.index+o[0].length-1);r.push({kind:"named",sourcePath:be(e,t,a),names:c,startLine:l,endLine:u})}return r}function cf(e,t,n){let r=[],i=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[2]??"",a=vt(n,o.index),c=vt(n,o.index+o[0].length-1);r.push({kind:"star-as",sourcePath:be(e,t,s),names:o[1]?[o[1]]:[],startLine:a,endLine:c})}return r}function lf(e,t,n){let r=[],i=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[1]??"",a=vt(n,o.index),c=vt(n,o.index+o[0].length-1);r.push({kind:"star",sourcePath:be(e,t,s),names:[],startLine:a,endLine:c})}return r}function uf(e){if(!e)return null;let t=e.replace(/^type\s+/,"").trim();if(!t)return null;let n=t.match(/^(\w+)\s+as\s+(\w+)$/);if(n)return n[2]??null;let r=t.match(/^(\w+)$/);return r?r[1]??null:null}function vt(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)e.charCodeAt(r)===10&&n++;return n}function df(e,t,n){let r=[];for(let i of n.rootNode.descendantsOfType("export_statement")){let o=pf(e,t,i);if(o===void 0)continue;let s=i.startPosition.row,a=i.endPosition.row,c=ff(i,o,s,a);r.push(c)}return r}function pf(e,t,n){let r=Z(n,"string");if(!r)return;let i=Z(r,"string_fragment");if(i)return be(e,t,i.text)}function ff(e,t,n,r){let i=Z(e,"export_clause");if(i){let s=[];for(let a of i.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),l=a.namedChild(1);c&&s.push((l??c).text)}return{kind:"named",sourcePath:t,names:s,startLine:n,endLine:r}}let o=Z(e,"namespace_export");if(o){let s=o.namedChildren.find(a=>a.type==="identifier"||a.type==="type_identifier")?.text;return{kind:"star-as",sourcePath:t,names:s?[s]:[],startLine:n,endLine:r}}return{kind:"star",sourcePath:t,names:[],startLine:n,endLine:r}}function ys(e,t,n){return Fn(e,t,{java:r=>mf(e,t,r),kotlin:r=>gf(e,t,r),scala:r=>yf(e,t,r)},()=>ie(n,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(r,i)=>{let o=r[1]?.trim();return o?hf(e,t,o,i):[]}),n)}function mf(e,t,n){let r=L(n,new Set(["import_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("import_declaration")){let s=o.children.some(d=>d.type==="asterisk"),c=o.namedChildren.find(d=>d.type==="scoped_identifier")??o.namedChildren.find(d=>d.type==="identifier");if(!c)continue;let l=c.text;if(s){i.push(Ye("*",w(e,l,Q)));continue}let u=l.split(".").pop()??l;i.push(F(u,u,w(e,l,Q),r))}return i}function gf(e,t,n){let r=L(n,new Set(["import_header","import_list"])),i=[];for(let o of n.rootNode.descendantsOfType("import_header")){let s=o.namedChildren.find(f=>f.type==="identifier");if(!s)continue;let a=o.namedChildren.some(f=>f.type==="wildcard_import"),c=o.namedChildren.find(f=>f.type==="import_alias");if(a){i.push(Ye("*",w(e,s.text,Q)));continue}let l=s.text,u=l.split(".").pop()??l,p=c?.namedChild(0)?.text??u;i.push(F(u,p,w(e,l,Q),r))}return i}function yf(e,t,n){let r=L(n,new Set(["import_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("import_declaration")){let s=o.namedChildren.find(d=>d.type==="namespace_selectors"||d.type==="namespace_wildcard"),a=o.namedChildren.filter(d=>d!==s&&(d.type==="identifier"||d.type==="stable_identifier")),c=a.map(d=>d.text).join(".");if(!c)continue;if(s?.type==="namespace_wildcard"){i.push(Ye("*",w(e,c,Q)));continue}if(s?.type==="namespace_selectors"){for(let d of s.namedChildren)if(d.type==="arrow_renamed_identifier"){let[p,f]=d.namedChildren;if(!p)continue;let m=p.text,g=f?.text??m;if(m==="_")continue;i.push(F(m,g,w(e,`${c}.${m}`,Q),r))}else if(d.type==="identifier"){let p=d.text;i.push(F(p,p,w(e,`${c}.${p}`,Q),r))}continue}let l=a[a.length-1]?.text??c,u=a.slice(0,-1).map(d=>d.text).join(".")||c;i.push(F(l,l,w(e,u&&a.length>1?`${u}.${l}`:c,Q),r))}return i}function hf(e,t,n,r){if(n.includes("{")&&n.includes("}")){let i=n.slice(0,n.indexOf("{")).replace(/\.$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return q(o).flatMap(s=>{let a=s.trim();if(!a)return[];let[c,l]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let d=(l??u.split(".").pop()??u).trim(),p=u==="_"?i:`${i}.${u}`.replace(/\.\./g,".");return[ue(e,t,r,p,u,d)]})}return[ue(e,t,r,n,n.split(".").pop()??n,n.split(".").pop()??n)]}function Ss(e,t,n){return oe(e,t,r=>Sf(e,t,r),()=>ie(n,/^[ \t]*use\s+(.+?)\s*;$/gm,(r,i)=>{let o=r[1]?.trim();return o?q(o).flatMap(s=>{let a=s.trim();if(!a)return[];let[c,l]=a.split(/\s+as\s+/i),u=c?.trim()??a,d=u.split("\\").pop()??u,p=(l??d).trim();return[ue(e,t,i,u,d,p,w(e,u.replace(/\\/g,"."),Qe))]}):[]}),n)}function Sf(e,t,n){let r=L(n,new Set(["namespace_use_declaration"])),i=[],o=(s,a,c)=>{i.push(F(a,c,w(e,s.replace(/\\/g,"."),Qe),r))};for(let s of n.rootNode.descendantsOfType("namespace_use_declaration")){let a=s.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=s.namedChildren.find(l=>l.type==="namespace_name")?.text??"";for(let l of a.namedChildren){if(l.type!=="namespace_use_clause")continue;let{importedName:u,localName:d,qualified:p}=hs(l,c);u&&o(p,u,d)}continue}for(let c of s.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:l,localName:u,qualified:d}=hs(c,"");l&&o(d,l,u)}}return i}function hs(e,t){let n=e.namedChildren.find(l=>l.type==="qualified_name"),r=e.namedChildren.filter(l=>l.type==="name"),i="";n?i=n.text:r.length>=1&&(i=r[0].text);let o=n&&r.length>0?r[r.length-1]:null,s=i.split("\\").pop()??i,a=o?.text??s,c=t?`${t}\\${i}`:i;return{importedName:s,localName:a,qualified:c}}function xs(e,t,n){return oe(e,t,r=>bf(e,t,r),()=>vf(n).flatMap(r=>Ef(e,t,r,n)),n)}function bf(e,t,n){let r=L(n,new Set(["import_statement","import_from_statement"])),i=[];for(let o of n.rootNode.descendantsOfType("import_statement"))for(let s of o.namedChildren){let a=bs(s);if(!a)continue;let c=St(e,t,a.qualifiedName);i.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:r.has(a.localName),usedMembers:[]})}for(let o of n.rootNode.descendantsOfType("import_from_statement")){let s=o.namedChild(0);if(!s)continue;let a=xf(s);if(a===null)continue;let c=St(e,t,a);for(let l=1;l<o.namedChildCount;l+=1){let u=o.namedChild(l);if(u.type==="wildcard_import"){i.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let d=bs(u);d&&i.push({importedName:d.qualifiedName,localName:d.localName,sourcePath:c,kind:"named",used:r.has(d.localName),usedMembers:[]})}}return i}function bs(e){if(e.type==="aliased_import"){let t=e.namedChild(0),n=e.namedChild(1);return!t||!n?null:{qualifiedName:t.text,localName:n.text}}if(e.type==="dotted_name"){let t=e.text;return{qualifiedName:t,localName:t.split(".")[0]??t}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function xf(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let t=Z(e,"import_prefix")?.text??"",n=Z(e,"dotted_name")?.text??"";return`${t}${n}`}return null}function vf(e){let t=e.split(`
108
+ `:" ",i+=1;continue}let o=e[i];if(o===";"){let s=pn(e,i);r+=us(e.slice(i,s)),i=s;continue}if(o==='"'){let s=At(e,i,0).index;r+=us(e.slice(i,s)),i=s;continue}r+=o,i+=1}return r}function Op(e){let t=0;for(;t<e.length&&(t=ri(e,t),!(t>=e.length));){let n=wn(e,t);if(!n){t+=1;continue}if(_p(n.form))return n.form;t=n.index}return null}function wn(e,t){let n=ri(e,t);if(e.startsWith("#?@",n)||e.startsWith("#?",n))return Mp(e,n);if(e.startsWith("#_",n)){let i=wn(e,n+2);return i?{form:{type:"atom",text:"",start:n,end:i.index},index:i.index}:null}for(;Tr(e[n]);)n+=1;let r=e[n];return r?r==="("?Yr(e,n,"list",")"):r==="["?Yr(e,n,"vector","]"):r==="{"?Yr(e,n,"map","}"):r==='"'?{form:{type:"atom",text:"",start:n,end:At(e,n,0).index},index:At(e,n,0).index}:Bp(e,n):null}function Mp(e,t){let n=e.startsWith("#?@",t)?3:2,r=wn(e,t+n);return r?{form:{type:"list",children:r.form.type==="list"||r.form.type==="vector"||r.form.type==="map"?$p(r.form.children):[],start:t,end:r.index},index:r.index}:null}function $p(e){let t=[];for(let n=0;n<e.length;n+=2){let r=se(e[n]),i=e[n+1];r?.startsWith(":")&&i&&t.push(i)}return t}function Yr(e,t,n,r){let i=[],o=t+1;for(;o<e.length;){if(o=ri(e,o),e[o]===r)return{form:{type:n,children:i,start:t,end:o+1},index:o+1};let s=wn(e,o);if(!s){o+=1;continue}s.form.type==="atom"&&s.form.text===""||i.push(s.form),o=s.index}return{form:{type:n,children:i,start:t,end:e.length},index:e.length}}function Bp(e,t){let n=t;for(;n<e.length&&!Fr(e[n]);)n+=1;return{form:{type:"atom",text:e.slice(t,n),start:t,end:n},index:n}}function ri(e,t){let n=t;for(;n<e.length;){let r=e[n];if(/\s|,/.test(r)){n+=1;continue}if(r===";"){n=pn(e,n);continue}break}return n}function us(e){return e.replace(/[^\r\n]/g," ")}function ps(e,t,n){let r=[];for(let i of n.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=i[1]?.trim(),s=i[2]?.trim()??null,a=i[0];if(!o||!a||typeof i.index!="number")continue;let c=$e(n,i.index,i.index+a.length);r.push({importedName:o,localName:s,sourcePath:En(e,t,o),kind:s?"namespace":"side-effect",used:s?W(c,s):!0,usedMembers:s?xt(c,s):[]})}return r}function fs(e,t,n){let r=[];for(let i of n.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=i[1]?.trim();o&&r.push({specifier:o,sourcePath:En(e,t,o)})}return r}function ms(e,t,n){return Fn(e,t,{csharp:r=>Vp(e,t,r),vb:r=>jp(e,t,r)},()=>{let r=Uo(t)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return ie(n,r,(i,o)=>{let s=i[1]?.trim();if(!s)return[];let[a,c]=s.split(/\s*=\s*/),l=!!c,u=(l?c:a)?.trim()??s,d=u.split(".").pop()??u,p=l?a?.trim()??d:d;return[ue(e,t,o,u,d,p,w(e,u,Oe))]})},n)}function jp(e,t,n){let r=L(n,new Set(["imports_statement"])),i=[];for(let o of n.rootNode.descendantsOfType("imports_statement")){let s=o.namedChildren.filter(p=>p.type==="namespace_name");if(s.length===0)continue;let a=s[s.length-1],c=s.length>1?s[0]:null,l=a.text,u=l.split(".").pop()??l,d=c?.text??u;i.push(F(u,d,w(e,l,Oe),r,c?"namespace":"named"))}return i}function Vp(e,t,n){let r=L(n,new Set(["using_directive"])),i=[];for(let o of n.rootNode.descendantsOfType("using_directive")){let s=o.namedChildren;if(s.length===0)continue;let a=null,c;s.length>=2&&s[0].type==="identifier"&&(s[1].type==="qualified_name"||s[1].type==="identifier")?(a=s[0],c=s[1]):c=s[s.length-1];let l=c.text,u=l.split(".").pop()??l,d=a?.text??u;i.push(F(u,d,w(e,l,Oe),r,a?"namespace":"named"))}return i}var Up=v("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function gs(e,t){return Up.get(e,t,()=>{let n=new Set,r=x(e,t);if(!r)return n;let o=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,s=>s.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,s=>s.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,s=>s.replace(/[^\r\n]/g," "));for(let s of o.matchAll(/[A-Za-z_$][\w$]*/g))n.add(s[0]);return n})}function ii(e,t,n){return oe(e,t,r=>zp(e,t,r),()=>Hp(e,t,n),n)}function Hp(e,t,n){return tf(n).flatMap(r=>nf(e,t,r.clause,r.specifier,r.start,r.end,n))}function zp(e,t,n){let r=Wp(e,t,n),i=[];for(let o of n.rootNode.descendantsOfType("import_statement"))i.push(...qp(e,t,n,o,r));return i}function Wp(e,t,n){let r=L(n,new Set(["import_statement"]));if(Se(t))for(let i of gs(e,t))r.add(i);return r}function qp(e,t,n,r,i){let o=Qp(r);if(!o)return[];let s=be(e,t,o),a=Z(r,"import_clause");return a?Kp(n,a,s,i,Zp(r.text)):[Ye("*",s)]}function Kp(e,t,n,r,i){let o=[];for(let s of t.namedChildren)if(s.type==="identifier")o.push(Gp(s.text,n,r,i));else if(s.type==="namespace_import"){let a=Xp(e,s,n,r,i);a&&o.push(a)}else s.type==="named_imports"&&o.push(...Jp(s,n,r,i));return o}function Gp(e,t,n,r){return F("default",e,t,n,"default",{isTypeOnly:r})}function Xp(e,t,n,r,i){let s=Z(t,"identifier")?.text??"";if(!s)return null;let a=ef(e,s);return et("*",n,{localName:s,usedMembers:a,isTypeOnly:i,used:a.length>0||r.has(s)})}function Jp(e,t,n,r){let i=[];for(let o of e.namedChildren){if(o.type!=="import_specifier")continue;let s=o.namedChild(0),a=o.namedChild(1);if(!s)continue;let c=s.text,l=a?.text??c;i.push(F(c,l,t,n,"named",{isTypeOnly:r||Yp(o.text)}))}return i}function Qp(e){let t=Z(e,"string");if(!t)return null;let n=Z(t,"string_fragment");return n?n.text:null}function Zp(e){return/^\s*import\s+type\b/.test(e)}function Yp(e){return/^\s*type\b/.test(e.trim())}function ef(e,t){let n=new Set;for(let r of e.rootNode.descendantsOfType("member_expression")){let i=r.namedChild(0),o=r.namedChild(1);!i||!o||i.type!=="identifier"||i.text!==t||(o.type==="property_identifier"||o.type==="identifier")&&n.add(o.text)}return[...n]}function tf(e){let t=[],n=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(n)){let o=i[0],s=i[1],a=i[2];!o||!a||typeof i.index!="number"||t.push({clause:s,specifier:a,start:i.index,end:i.index+o.length})}let r=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(r)){let o=i[0],s=i[1];!o||!s||typeof i.index!="number"||t.push({clause:null,specifier:s,start:i.index,end:i.index+o.length})}return t.sort((i,o)=>i.start-o.start)}function nf(e,t,n,r,i,o,s){let a=be(e,t,r),c=$e(s,i,o);return n?rf(n).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let d=xt(c,u.localName);return et(u.importedName,u.sourcePath,{localName:u.localName,usedMembers:d,used:d.length>0||W(c,u.localName),isTypeOnly:u.isTypeOnly})}return u.kind==="side-effect"?Ye(u.importedName,u.sourcePath):we(u.importedName,u.localName??"",u.sourcePath,u.localName?W(c,u.localName):!1,u.kind,[],{isTypeOnly:u.isTypeOnly})}):[Ye("*",a)]}function rf(e){let t=e.trim(),n=/^type\b/.test(t),r=t.replace(/^type\s+/,""),[i,o]=of(r),s=[];return i&&s.push(...ys(i,n)),o&&s.push(...ys(o,n)),s}function ys(e,t){let n=e.trim();if(!n)return[];if(n.startsWith("{")){let r=n.slice(1,-1).trim();return r?q(r).map(i=>{let o=i.trim(),s=t||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[c,l]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(l??c).trim(),kind:"named",isTypeOnly:s}}):[]}return n.startsWith("* as ")?[{importedName:"*",localName:n.slice(5).trim(),kind:"namespace",isTypeOnly:t}]:[{importedName:"default",localName:n,kind:"default",isTypeOnly:t}]}function of(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r==="{"&&t++,r==="}"&&t--,r===","&&t===0)return[e.slice(0,n).trim(),e.slice(n+1).trim()]}return[e.trim(),null]}function oi(e,t,n){let r=R(e,t);return r?df(e,t,r):sf(e,t,n)}function sf(e,t,n){return[...af(e,t,n),...cf(e,t,n),...lf(e,t,n)]}function af(e,t,n){let r=[],i=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[1]??"",a=o[2]??"",c=q(s).map(d=>uf(d.trim())).filter(d=>!!d),l=vt(n,o.index),u=vt(n,o.index+o[0].length-1);r.push({kind:"named",sourcePath:be(e,t,a),names:c,startLine:l,endLine:u})}return r}function cf(e,t,n){let r=[],i=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[2]??"",a=vt(n,o.index),c=vt(n,o.index+o[0].length-1);r.push({kind:"star-as",sourcePath:be(e,t,s),names:o[1]?[o[1]]:[],startLine:a,endLine:c})}return r}function lf(e,t,n){let r=[],i=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[1]??"",a=vt(n,o.index),c=vt(n,o.index+o[0].length-1);r.push({kind:"star",sourcePath:be(e,t,s),names:[],startLine:a,endLine:c})}return r}function uf(e){if(!e)return null;let t=e.replace(/^type\s+/,"").trim();if(!t)return null;let n=t.match(/^(\w+)\s+as\s+(\w+)$/);if(n)return n[2]??null;let r=t.match(/^(\w+)$/);return r?r[1]??null:null}function vt(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)e.charCodeAt(r)===10&&n++;return n}function df(e,t,n){let r=[];for(let i of n.rootNode.descendantsOfType("export_statement")){let o=pf(e,t,i);if(o===void 0)continue;let s=i.startPosition.row,a=i.endPosition.row,c=ff(i,o,s,a);r.push(c)}return r}function pf(e,t,n){let r=Z(n,"string");if(!r)return;let i=Z(r,"string_fragment");if(i)return be(e,t,i.text)}function ff(e,t,n,r){let i=Z(e,"export_clause");if(i){let s=[];for(let a of i.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),l=a.namedChild(1);c&&s.push((l??c).text)}return{kind:"named",sourcePath:t,names:s,startLine:n,endLine:r}}let o=Z(e,"namespace_export");if(o){let s=o.namedChildren.find(a=>a.type==="identifier"||a.type==="type_identifier")?.text;return{kind:"star-as",sourcePath:t,names:s?[s]:[],startLine:n,endLine:r}}return{kind:"star",sourcePath:t,names:[],startLine:n,endLine:r}}function hs(e,t,n){return Fn(e,t,{java:r=>mf(e,t,r),kotlin:r=>gf(e,t,r),scala:r=>yf(e,t,r)},()=>ie(n,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(r,i)=>{let o=r[1]?.trim();return o?hf(e,t,o,i):[]}),n)}function mf(e,t,n){let r=L(n,new Set(["import_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("import_declaration")){let s=o.children.some(d=>d.type==="asterisk"),c=o.namedChildren.find(d=>d.type==="scoped_identifier")??o.namedChildren.find(d=>d.type==="identifier");if(!c)continue;let l=c.text;if(s){i.push(et("*",w(e,l,Q)));continue}let u=l.split(".").pop()??l;i.push(F(u,u,w(e,l,Q),r))}return i}function gf(e,t,n){let r=L(n,new Set(["import_header","import_list"])),i=[];for(let o of n.rootNode.descendantsOfType("import_header")){let s=o.namedChildren.find(f=>f.type==="identifier");if(!s)continue;let a=o.namedChildren.some(f=>f.type==="wildcard_import"),c=o.namedChildren.find(f=>f.type==="import_alias");if(a){i.push(et("*",w(e,s.text,Q)));continue}let l=s.text,u=l.split(".").pop()??l,p=c?.namedChild(0)?.text??u;i.push(F(u,p,w(e,l,Q),r))}return i}function yf(e,t,n){let r=L(n,new Set(["import_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("import_declaration")){let s=o.namedChildren.find(d=>d.type==="namespace_selectors"||d.type==="namespace_wildcard"),a=o.namedChildren.filter(d=>d!==s&&(d.type==="identifier"||d.type==="stable_identifier")),c=a.map(d=>d.text).join(".");if(!c)continue;if(s?.type==="namespace_wildcard"){i.push(et("*",w(e,c,Q)));continue}if(s?.type==="namespace_selectors"){for(let d of s.namedChildren)if(d.type==="arrow_renamed_identifier"){let[p,f]=d.namedChildren;if(!p)continue;let m=p.text,g=f?.text??m;if(m==="_")continue;i.push(F(m,g,w(e,`${c}.${m}`,Q),r))}else if(d.type==="identifier"){let p=d.text;i.push(F(p,p,w(e,`${c}.${p}`,Q),r))}continue}let l=a[a.length-1]?.text??c,u=a.slice(0,-1).map(d=>d.text).join(".")||c;i.push(F(l,l,w(e,u&&a.length>1?`${u}.${l}`:c,Q),r))}return i}function hf(e,t,n,r){if(n.includes("{")&&n.includes("}")){let i=n.slice(0,n.indexOf("{")).replace(/\.$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return q(o).flatMap(s=>{let a=s.trim();if(!a)return[];let[c,l]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let d=(l??u.split(".").pop()??u).trim(),p=u==="_"?i:`${i}.${u}`.replace(/\.\./g,".");return[ue(e,t,r,p,u,d)]})}return[ue(e,t,r,n,n.split(".").pop()??n,n.split(".").pop()??n)]}function bs(e,t,n){return oe(e,t,r=>Sf(e,t,r),()=>ie(n,/^[ \t]*use\s+(.+?)\s*;$/gm,(r,i)=>{let o=r[1]?.trim();return o?q(o).flatMap(s=>{let a=s.trim();if(!a)return[];let[c,l]=a.split(/\s+as\s+/i),u=c?.trim()??a,d=u.split("\\").pop()??u,p=(l??d).trim();return[ue(e,t,i,u,d,p,w(e,u.replace(/\\/g,"."),Ze))]}):[]}),n)}function Sf(e,t,n){let r=L(n,new Set(["namespace_use_declaration"])),i=[],o=(s,a,c)=>{i.push(F(a,c,w(e,s.replace(/\\/g,"."),Ze),r))};for(let s of n.rootNode.descendantsOfType("namespace_use_declaration")){let a=s.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=s.namedChildren.find(l=>l.type==="namespace_name")?.text??"";for(let l of a.namedChildren){if(l.type!=="namespace_use_clause")continue;let{importedName:u,localName:d,qualified:p}=Ss(l,c);u&&o(p,u,d)}continue}for(let c of s.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:l,localName:u,qualified:d}=Ss(c,"");l&&o(d,l,u)}}return i}function Ss(e,t){let n=e.namedChildren.find(l=>l.type==="qualified_name"),r=e.namedChildren.filter(l=>l.type==="name"),i="";n?i=n.text:r.length>=1&&(i=r[0].text);let o=n&&r.length>0?r[r.length-1]:null,s=i.split("\\").pop()??i,a=o?.text??s,c=t?`${t}\\${i}`:i;return{importedName:s,localName:a,qualified:c}}function vs(e,t,n){return oe(e,t,r=>bf(e,t,r),()=>vf(n).flatMap(r=>Ef(e,t,r,n)),n)}function bf(e,t,n){let r=L(n,new Set(["import_statement","import_from_statement"])),i=[];for(let o of n.rootNode.descendantsOfType("import_statement"))for(let s of o.namedChildren){let a=xs(s);if(!a)continue;let c=St(e,t,a.qualifiedName);i.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:r.has(a.localName),usedMembers:[]})}for(let o of n.rootNode.descendantsOfType("import_from_statement")){let s=o.namedChild(0);if(!s)continue;let a=xf(s);if(a===null)continue;let c=St(e,t,a);for(let l=1;l<o.namedChildCount;l+=1){let u=o.namedChild(l);if(u.type==="wildcard_import"){i.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let d=xs(u);d&&i.push({importedName:d.qualifiedName,localName:d.localName,sourcePath:c,kind:"named",used:r.has(d.localName),usedMembers:[]})}}return i}function xs(e){if(e.type==="aliased_import"){let t=e.namedChild(0),n=e.namedChild(1);return!t||!n?null:{qualifiedName:t.text,localName:n.text}}if(e.type==="dotted_name"){let t=e.text;return{qualifiedName:t,localName:t.split(".")[0]??t}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function xf(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let t=Z(e,"import_prefix")?.text??"",n=Z(e,"dotted_name")?.text??"";return`${t}${n}`}return null}function vf(e){let t=e.split(`
109
109
  `),n=[],r=0;for(let i=0;i<t.length;i++){let o=t[i],s=o.trimStart(),a=r;if(r+=o.length+1,!s.startsWith("import ")&&!s.startsWith("from "))continue;let c=o,l=a+o.length,u=Zr(o);for(;i+1<t.length&&(u>0||c.trimEnd().endsWith("\\"));){i++;let p=t[i];c+=`
110
- ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,end:l})}return n}function Nf(e){let t=e.replace(/\\\s*\n/g," ").trim();if(t.startsWith("import "))return{kind:"import",module:null,clause:t.slice(7).trim()};let n=t.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!n)return null;let r=n[2].trim();return r.startsWith("(")&&r.endsWith(")")&&(r=r.slice(1,-1).trim()),{kind:"from",module:n[1],clause:r}}function Ef(e,t,n,r){let i=$e(r,n.start,n.end),o=n.clause.replace(/\n/g," ").trim();if(n.kind==="import")return q(o).flatMap(c=>{let l=c.trim().replace(/,$/,"");if(!l)return[];let[u,d]=l.split(/\s+as\s+/),p=u.trim(),f=(d??p.split(".")[0]??p).trim(),m=St(e,t,p),g=xt(i,f);return[{importedName:p,localName:f,sourcePath:m,kind:"namespace",used:W(i,f)||g.length>0,usedMembers:g}]});let s=n.module?St(e,t,n.module):null,a=[];for(let c of q(o)){let l=c.trim().replace(/,$/,"");if(!l)continue;if(l==="*"){a.push({importedName:"*",localName:null,sourcePath:s,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,d]=l.split(/\s+as\s+/),p=(d??u).trim();a.push({importedName:u.trim(),localName:p,sourcePath:s,kind:"named",used:W(i,p),usedMembers:[]})}return a}import{basename as If}from"path";function vs(e,t,n){return oe(e,t,r=>_f(e,t,r),()=>Cf(e,t,n),n)}function Cf(e,t,n){return ie(n,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(r,i)=>{let o=r[1],s=r[2];if(!o||!s)return[];let a=o==="require_relative"?vn(e,t,s):null;if(a){let c=Ns(s);return[we(c,c,a,W(i,c))]}return[Ze(s,a)]})}function _f(e,t,n){let r=L(n,new Set([])),i=[],o=new Set(["require","require_relative","load"]);for(let s of n.rootNode.descendantsOfType("call")){let a=s.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let l=s.namedChildren.find(f=>f.type==="argument_list")?.namedChild(0);if(!l||l.type!=="string")continue;let d=l.namedChildren.find(f=>f.type==="string_content")?.text;if(!d)continue;let p=a.text==="require_relative"?vn(e,t,d):null;if(p){let f=Ns(d);i.push(F(f,f,p,r))}else i.push(Ze(d,p))}return i}function Ns(e){return mn(If(e).replace(/\.[^.]+$/,""),/_/)}function Es(e,t,n){return oe(e,t,r=>Rf(e,t,r),()=>ie(n,/^[ \t]*use\s+(.+?)\s*;$/gm,(r,i)=>{let o=r[1]?.trim();return o?Tf(e,t,o,i):[]}),n)}function Rf(e,t,n){let r=L(n,new Set(["use_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("use_declaration")){let s=o.namedChild(0);if(s)for(let a of Bt(s,"")){if(!a.importedName||a.importedName==="*")continue;let c=Te(e,t,a.qualifiedName)??Te(e,t,a.qualifiedName.split("::").slice(0,-1).join("::"));i.push(F(a.importedName,a.localName,c,r))}}return i}function Bt(e,t){switch(e.type){case"identifier":case"super":case"crate":{let n=e.text;return[{qualifiedName:Ln(t,n),importedName:n,localName:n}]}case"self":{let n=t.split("::").filter(Boolean).pop()??"self";return[{qualifiedName:t||"self",importedName:n,localName:n}]}case"scoped_identifier":{let n=e.text,r=n.split("::").pop()??n;return[{qualifiedName:Ln(t,n),importedName:r,localName:r}]}case"scoped_use_list":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Ln(t,n.text),o=[];for(let s of r.namedChildren)o.push(...Bt(s,i));return o}case"use_list":{let n=[];for(let r of e.namedChildren)n.push(...Bt(r,t));return n}case"use_as_clause":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Bt(n,t),o=r.text;return i.map(s=>({...s,localName:o}))}case"use_wildcard":{let n=e.namedChild(0),r=n?n.text:"";return[{qualifiedName:Ln(t,`${r}::*`),importedName:"*",localName:"*"}]}default:return[]}}function Ln(e,t){return e?t?`${e}::${t}`:e:t}function Tf(e,t,n,r){let i=n.trim();if(i.includes("{")&&i.includes("}")){let u=i.slice(0,i.indexOf("{")).replace(/::$/,"").trim(),d=i.slice(i.indexOf("{")+1,i.lastIndexOf("}")).trim();return q(d).flatMap(p=>{let f=p.trim();if(!f)return[];if(f==="self"){let N=u.split("::").filter(Boolean).pop();return N?[ue(e,t,r,u,N,N)]:[]}let[m,g]=f.split(/\s+as\s+/),y=m?.trim();if(!y)return[];let S=(g??y.split("::").pop()??y).trim(),b=`${u}::${y}`.replace(/::::/g,"::");return[ue(e,t,r,b,y.split("::").pop()??y,S,Te(e,t,u))]})}let[o,s]=i.split(/\s+as\s+/),a=o?.trim()??i,c=(s??a.split("::").pop()??a).trim(),l=Te(e,t,a)??Te(e,t,a.split("::").slice(0,-1).join("::"));return[ue(e,t,r,a,a.split("::").pop()??a,c,l)]}function Is(e,t,n){let r=R(e,t);if(r)return Ff(e,t,r);let i=[];for(let o of n.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let s=o[1]?.trim();s&&i.push(...wf(e,t,s))}return i}function Ff(e,t,n){let r=[];for(let i of n.rootNode.descendantsOfType("use_declaration")){if(!Pf(i))continue;let o=i.namedChildren.find(s=>s.type!=="visibility_modifier");if(o)for(let s of Bt(o,""))s.importedName&&r.push(si(e,t,s.qualifiedName))}return r}function Pf(e){for(let t of e.children)if(t.type==="visibility_modifier"&&t.text.startsWith("pub"))return!0;return!1}function wf(e,t,n){let r=n.trim();if(r.includes("{")&&r.includes("}")){let i=r.slice(0,r.indexOf("{")).replace(/::$/,"").trim(),o=r.slice(r.indexOf("{")+1,r.lastIndexOf("}")).trim();return q(o).flatMap(s=>{let a=s.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),l=`${i}::${c?.trim()??a}`.replace(/::::/g,"::");return[si(e,t,l)]})}return[si(e,t,r)]}function si(e,t,n){return{specifier:n,sourcePath:Te(e,t,n)??Te(e,t,n.split("::").slice(0,-1).join("::"))}}function Be({language:e,extensions:t,imports:n,parseImports:r}){return{language:e,extensions:t,capabilities:{imports:n},parseImports:r}}function Cs(e,t){let n=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(n.endsWith(i))return r;return null}var Lf={language:"javascript",extensions:Xe,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:ii,parseReExports:oi},kf=Be({language:"python",extensions:yn,imports:"ast-with-regex-fallback",parseImports:xs}),Df=Be({language:"jvm",extensions:Q,imports:"ast-dispatch-with-regex-fallback",parseImports:ys}),Af={language:"rust",extensions:hn,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Es,parseExports:Is},Of=Be({language:"ruby",extensions:Sn,imports:"ast-with-regex-fallback",parseImports:vs}),Mf=Be({language:"c/cpp",extensions:bn,imports:"ast-with-regex-fallback",parseImports:cs}),$f=Be({language:"dotnet",extensions:Oe,imports:"ast-dispatch-with-regex-fallback",parseImports:fs}),Bf={language:"dart",extensions:xn,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:ds,parseExports:ps},jf=Be({language:"php",extensions:Qe,imports:"ast-with-regex-fallback",parseImports:Ss}),Vf=Be({language:"clojure",extensions:ht,imports:"regex-only",parseImports:us}),_s=[Lf,kf,Df,Af,Of,Mf,$f,Bf,jf,Vf];function kn(e){return Cs(_s,e)}function $N(e){return _s.find(n=>n.language===e)?.capabilities??null}var ai={clearGroups:["whole-project","source-file"]},Uf=v("source-imports",ai),Hf=v("source-exports",ai),zf=v("source-reexports",ai),Rs=le({kind:"source-imports",invalidation:X("source-imports"),serialize:Wf,deserialize:qf}),Ts=le({kind:"source-reexports",invalidation:X("source-reexports"),serialize:Kf,deserialize:Gf});function je(e,t){let n=D(t);return zf.get(e,n,()=>{let r=kn(n);if(!r?.parseReExports)return[];let i=x(e,n);if(!i)return[];let o=he(e,n,i),s=Wr(e),a=Ts.read(e,n,o);if(a?.resolutionFingerprint===s)return a.reExports;let c=r.parseReExports(e,n,i);return Ts.write(e,n,o,{resolutionFingerprint:s,reExports:c}),c})}function M(e,t){let n=D(t);return Uf.get(e,n,()=>{let r=kn(n);if(!r)return[];let i=x(e,n);if(!i)return[];let o=he(e,n,i),s=Wr(e),a=Rs.read(e,n,o);if(a?.resolutionFingerprint===s)return a.imports;let c=r.parseImports(e,n,i);return Rs.write(e,n,o,{resolutionFingerprint:s,imports:c}),c})}function KN(e,t){let n=D(t);return Hf.get(e,n,()=>{let r=kn(n);if(!r?.parseExports)return[];let i=x(e,n);return i?r.parseExports(e,n,i):[]})}function Wf(e){return JSON.stringify(e)}function qf(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.imports)?null:{resolutionFingerprint:t.resolutionFingerprint,imports:t.imports}}catch{return null}}function Kf(e){return JSON.stringify(e)}function Gf(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.reExports)?null:{resolutionFingerprint:t.resolutionFingerprint,reExports:t.reExports}}catch{return null}}function Dn(e){return{forFile(t,n){return Fs(e,t,n)},forFiles(t,n){let r=new Map;for(let i of t)r.set(i,Fs(e,i,n));return r}}}function Fs(e,t,n){let r={file:t},i=n.facts||n.identifiers;if(n.text&&(r.text=x(e,t)),n.lines&&(r.lines=Pt(e,t)),n.ast&&(r.ast=R(e,t)),n.imports&&(r.imports=M(e,t)),n.reexports&&(r.reexports=je(e,t)),i){let o=wr(e,t),s=o.facts;n.facts&&(r.facts=s),o.unavailable&&(r.sourceFactsUnavailable=o.unavailable),n.identifiers&&s&&(r.identifiers=s.fileIdentifiers,r.identifierLineMap=s.identifierLineMap)}return r}var Xf={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function de(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let n=t[0],r=t[1],i=e.slice(n.length+1+r.length+1),o;if(i.startsWith("`")){let l=i.indexOf("`",1);l===-1?(o=i.slice(1),i=""):(o=i.slice(1,l),i=i.slice(l+2))}else{let l=i.indexOf(" ");l===-1?(o=i,i=""):(o=i.slice(0,l),i=i.slice(l+1))}let s,a=i.indexOf(" ");a===-1?(s=i,i=""):(s=i.slice(0,a),i=i.slice(a+1));let c=Jf(i);return{scheme:n,manager:r,packageName:o,version:s,descriptors:c,raw:e}}function ae(e){let t=de(e);if("kind"in t)return null;for(let n=t.descriptors.length-2;n>=0;n--){let r=t.descriptors[n];if(r?.suffix==="type")return r.name}return null}function Jf(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="["){let o=e.indexOf("]",n+1);if(o===-1){t.push({name:e.slice(n+1),suffix:"type-param"});break}t.push({name:e.slice(n+1,o),suffix:"type-param"}),n=o+1;continue}if(e[n]==="("&&(t.length===0||n===0||Ps(e[n-1]))){let o=e.indexOf(")",n+1);if(o!==-1&&e[o+1]!=="."){t.push({name:e.slice(n+1,o),suffix:"parameter"}),n=o+1;continue}}let r;if(e[n]==="`"){let o=e.indexOf("`",n+1);if(o===-1){r=e.slice(n+1),t.push({name:r,suffix:"term"});break}r=e.slice(n+1,o),n=o+1}else{let o=n;for(;n<e.length&&!Ps(e[n]);)n++;r=e.slice(o,n)}if(n>=e.length){r&&t.push({name:r,suffix:"term"});break}let i=e[n];if(i==="("){let o=e.indexOf(")",n+1);o!==-1&&e[o+1]==="."?(t.push({name:r,suffix:"method"}),n=o+2):o!==-1?(t.push({name:r,suffix:"method"}),n=o+1):(t.push({name:r,suffix:"term"}),n++)}else{let o=Xf[i];o&&t.push({name:r,suffix:o}),n+=1}}return t}function Ps(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function Ve(e){let t=de(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let n=t;if(n.descriptors.length===0)return n.raw;let r=[];for(let i of n.descriptors){let o=Qf(i);o&&r.push(o)}return r.join(":")}function Qf(e){let t=e.suffix==="namespace"?Zf(e.name):e.name;return t?e.suffix==="method"?`${t}()`:t:""}function Zf(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function K(e){let t=de(e);if("kind"in t&&t.kind==="local")return t.id;let n=t;return n.descriptors.length===0?"":n.descriptors[n.descriptors.length-1].name}function et(e){let t=de(e);if("kind"in t&&t.kind==="local")return null;let n=t;return n.descriptors[n.descriptors.length-1]?.suffix??null}function ci(e){return e.endsWith("().")||et(e)==="method"}function jt(e){let t=et(e);return t==="method"?!0:t!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ws(e){return et(e)==="namespace"}var Yf=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function eE(e){return Yf.test(e)}var em=new Set(["test","tests","_tests"]);function tE(e){let t=de(e);if("kind"in t)return!1;for(let n=0;n<t.descriptors.length-1;n+=1){let r=t.descriptors[n];if(r?.suffix==="namespace"&&r.name&&em.has(r.name))return!0}return!1}function nE(e,t){let n=de(e),r=de(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,o=r.descriptors;if(o.length!==i.length+1)return!1;for(let s=0;s<i.length;s++){let a=i[s],c=o[s];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function rE(e,t){let n=de(e),r=de(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,o=r.descriptors;if(o.length<=i.length)return!1;for(let s=0;s<i.length;s++){let a=i[s],c=o[s];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Ue(e,t){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
110
+ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,end:l})}return n}function Nf(e){let t=e.replace(/\\\s*\n/g," ").trim();if(t.startsWith("import "))return{kind:"import",module:null,clause:t.slice(7).trim()};let n=t.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!n)return null;let r=n[2].trim();return r.startsWith("(")&&r.endsWith(")")&&(r=r.slice(1,-1).trim()),{kind:"from",module:n[1],clause:r}}function Ef(e,t,n,r){let i=$e(r,n.start,n.end),o=n.clause.replace(/\n/g," ").trim();if(n.kind==="import")return q(o).flatMap(c=>{let l=c.trim().replace(/,$/,"");if(!l)return[];let[u,d]=l.split(/\s+as\s+/),p=u.trim(),f=(d??p.split(".")[0]??p).trim(),m=St(e,t,p),g=xt(i,f);return[{importedName:p,localName:f,sourcePath:m,kind:"namespace",used:W(i,f)||g.length>0,usedMembers:g}]});let s=n.module?St(e,t,n.module):null,a=[];for(let c of q(o)){let l=c.trim().replace(/,$/,"");if(!l)continue;if(l==="*"){a.push({importedName:"*",localName:null,sourcePath:s,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,d]=l.split(/\s+as\s+/),p=(d??u).trim();a.push({importedName:u.trim(),localName:p,sourcePath:s,kind:"named",used:W(i,p),usedMembers:[]})}return a}import{basename as If}from"path";function Ns(e,t,n){return oe(e,t,r=>_f(e,t,r),()=>Cf(e,t,n),n)}function Cf(e,t,n){return ie(n,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(r,i)=>{let o=r[1],s=r[2];if(!o||!s)return[];let a=o==="require_relative"?vn(e,t,s):null;if(a){let c=Es(s);return[we(c,c,a,W(i,c))]}return[Ye(s,a)]})}function _f(e,t,n){let r=L(n,new Set([])),i=[],o=new Set(["require","require_relative","load"]);for(let s of n.rootNode.descendantsOfType("call")){let a=s.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let l=s.namedChildren.find(f=>f.type==="argument_list")?.namedChild(0);if(!l||l.type!=="string")continue;let d=l.namedChildren.find(f=>f.type==="string_content")?.text;if(!d)continue;let p=a.text==="require_relative"?vn(e,t,d):null;if(p){let f=Es(d);i.push(F(f,f,p,r))}else i.push(Ye(d,p))}return i}function Es(e){return mn(If(e).replace(/\.[^.]+$/,""),/_/)}function Is(e,t,n){return oe(e,t,r=>Rf(e,t,r),()=>ie(n,/^[ \t]*use\s+(.+?)\s*;$/gm,(r,i)=>{let o=r[1]?.trim();return o?Tf(e,t,o,i):[]}),n)}function Rf(e,t,n){let r=L(n,new Set(["use_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("use_declaration")){let s=o.namedChild(0);if(s)for(let a of Bt(s,"")){if(!a.importedName||a.importedName==="*")continue;let c=Te(e,t,a.qualifiedName)??Te(e,t,a.qualifiedName.split("::").slice(0,-1).join("::"));i.push(F(a.importedName,a.localName,c,r))}}return i}function Bt(e,t){switch(e.type){case"identifier":case"super":case"crate":{let n=e.text;return[{qualifiedName:Ln(t,n),importedName:n,localName:n}]}case"self":{let n=t.split("::").filter(Boolean).pop()??"self";return[{qualifiedName:t||"self",importedName:n,localName:n}]}case"scoped_identifier":{let n=e.text,r=n.split("::").pop()??n;return[{qualifiedName:Ln(t,n),importedName:r,localName:r}]}case"scoped_use_list":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Ln(t,n.text),o=[];for(let s of r.namedChildren)o.push(...Bt(s,i));return o}case"use_list":{let n=[];for(let r of e.namedChildren)n.push(...Bt(r,t));return n}case"use_as_clause":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Bt(n,t),o=r.text;return i.map(s=>({...s,localName:o}))}case"use_wildcard":{let n=e.namedChild(0),r=n?n.text:"";return[{qualifiedName:Ln(t,`${r}::*`),importedName:"*",localName:"*"}]}default:return[]}}function Ln(e,t){return e?t?`${e}::${t}`:e:t}function Tf(e,t,n,r){let i=n.trim();if(i.includes("{")&&i.includes("}")){let u=i.slice(0,i.indexOf("{")).replace(/::$/,"").trim(),d=i.slice(i.indexOf("{")+1,i.lastIndexOf("}")).trim();return q(d).flatMap(p=>{let f=p.trim();if(!f)return[];if(f==="self"){let N=u.split("::").filter(Boolean).pop();return N?[ue(e,t,r,u,N,N)]:[]}let[m,g]=f.split(/\s+as\s+/),y=m?.trim();if(!y)return[];let S=(g??y.split("::").pop()??y).trim(),b=`${u}::${y}`.replace(/::::/g,"::");return[ue(e,t,r,b,y.split("::").pop()??y,S,Te(e,t,u))]})}let[o,s]=i.split(/\s+as\s+/),a=o?.trim()??i,c=(s??a.split("::").pop()??a).trim(),l=Te(e,t,a)??Te(e,t,a.split("::").slice(0,-1).join("::"));return[ue(e,t,r,a,a.split("::").pop()??a,c,l)]}function Cs(e,t,n){let r=R(e,t);if(r)return Ff(e,t,r);let i=[];for(let o of n.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let s=o[1]?.trim();s&&i.push(...wf(e,t,s))}return i}function Ff(e,t,n){let r=[];for(let i of n.rootNode.descendantsOfType("use_declaration")){if(!Pf(i))continue;let o=i.namedChildren.find(s=>s.type!=="visibility_modifier");if(o)for(let s of Bt(o,""))s.importedName&&r.push(si(e,t,s.qualifiedName))}return r}function Pf(e){for(let t of e.children)if(t.type==="visibility_modifier"&&t.text.startsWith("pub"))return!0;return!1}function wf(e,t,n){let r=n.trim();if(r.includes("{")&&r.includes("}")){let i=r.slice(0,r.indexOf("{")).replace(/::$/,"").trim(),o=r.slice(r.indexOf("{")+1,r.lastIndexOf("}")).trim();return q(o).flatMap(s=>{let a=s.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),l=`${i}::${c?.trim()??a}`.replace(/::::/g,"::");return[si(e,t,l)]})}return[si(e,t,r)]}function si(e,t,n){return{specifier:n,sourcePath:Te(e,t,n)??Te(e,t,n.split("::").slice(0,-1).join("::"))}}function Be({language:e,extensions:t,imports:n,parseImports:r}){return{language:e,extensions:t,capabilities:{imports:n},parseImports:r}}function _s(e,t){let n=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(n.endsWith(i))return r;return null}var Lf={language:"javascript",extensions:Je,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:ii,parseReExports:oi},kf=Be({language:"python",extensions:yn,imports:"ast-with-regex-fallback",parseImports:vs}),Df=Be({language:"jvm",extensions:Q,imports:"ast-dispatch-with-regex-fallback",parseImports:hs}),Af={language:"rust",extensions:hn,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Is,parseExports:Cs},Of=Be({language:"ruby",extensions:Sn,imports:"ast-with-regex-fallback",parseImports:Ns}),Mf=Be({language:"c/cpp",extensions:bn,imports:"ast-with-regex-fallback",parseImports:ls}),$f=Be({language:"dotnet",extensions:Oe,imports:"ast-dispatch-with-regex-fallback",parseImports:ms}),Bf={language:"dart",extensions:xn,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:ps,parseExports:fs},jf=Be({language:"php",extensions:Ze,imports:"ast-with-regex-fallback",parseImports:bs}),Vf=Be({language:"clojure",extensions:ht,imports:"regex-only",parseImports:ds}),Rs=[Lf,kf,Df,Af,Of,Mf,$f,Bf,jf,Vf];function kn(e){return _s(Rs,e)}function VN(e){return Rs.find(n=>n.language===e)?.capabilities??null}var ai={clearGroups:["whole-project","source-file"]},Uf=v("source-imports",ai),Hf=v("source-exports",ai),zf=v("source-reexports",ai),Ts=le({kind:"source-imports",invalidation:X("source-imports"),serialize:Wf,deserialize:qf}),Fs=le({kind:"source-reexports",invalidation:X("source-reexports"),serialize:Kf,deserialize:Gf});function je(e,t){let n=D(t);return zf.get(e,n,()=>{let r=kn(n);if(!r?.parseReExports)return[];let i=x(e,n);if(!i)return[];let o=he(e,n,i),s=Wr(e),a=Fs.read(e,n,o);if(a?.resolutionFingerprint===s)return a.reExports;let c=r.parseReExports(e,n,i);return Fs.write(e,n,o,{resolutionFingerprint:s,reExports:c}),c})}function M(e,t){let n=D(t);return Uf.get(e,n,()=>{let r=kn(n);if(!r)return[];let i=x(e,n);if(!i)return[];let o=he(e,n,i),s=Wr(e),a=Ts.read(e,n,o);if(a?.resolutionFingerprint===s)return a.imports;let c=r.parseImports(e,n,i);return Ts.write(e,n,o,{resolutionFingerprint:s,imports:c}),c})}function JN(e,t){let n=D(t);return Hf.get(e,n,()=>{let r=kn(n);if(!r?.parseExports)return[];let i=x(e,n);return i?r.parseExports(e,n,i):[]})}function Wf(e){return JSON.stringify(e)}function qf(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.imports)?null:{resolutionFingerprint:t.resolutionFingerprint,imports:t.imports}}catch{return null}}function Kf(e){return JSON.stringify(e)}function Gf(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.reExports)?null:{resolutionFingerprint:t.resolutionFingerprint,reExports:t.reExports}}catch{return null}}function Dn(e){return{forFile(t,n){return Ps(e,t,n)},forFiles(t,n){let r=new Map;for(let i of t)r.set(i,Ps(e,i,n));return r}}}function Ps(e,t,n){let r={file:t},i=n.facts||n.identifiers;if(n.text&&(r.text=x(e,t)),n.lines&&(r.lines=Pt(e,t)),n.ast&&(r.ast=R(e,t)),n.imports&&(r.imports=M(e,t)),n.reexports&&(r.reexports=je(e,t)),i){let o=wr(e,t),s=o.facts;n.facts&&(r.facts=s),o.unavailable&&(r.sourceFactsUnavailable=o.unavailable),n.identifiers&&s&&(r.identifiers=s.fileIdentifiers,r.identifierLineMap=s.identifierLineMap)}return r}var Xf={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function de(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let n=t[0],r=t[1],i=e.slice(n.length+1+r.length+1),o;if(i.startsWith("`")){let l=i.indexOf("`",1);l===-1?(o=i.slice(1),i=""):(o=i.slice(1,l),i=i.slice(l+2))}else{let l=i.indexOf(" ");l===-1?(o=i,i=""):(o=i.slice(0,l),i=i.slice(l+1))}let s,a=i.indexOf(" ");a===-1?(s=i,i=""):(s=i.slice(0,a),i=i.slice(a+1));let c=Jf(i);return{scheme:n,manager:r,packageName:o,version:s,descriptors:c,raw:e}}function ae(e){let t=de(e);if("kind"in t)return null;for(let n=t.descriptors.length-2;n>=0;n--){let r=t.descriptors[n];if(r?.suffix==="type")return r.name}return null}function Jf(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="["){let o=e.indexOf("]",n+1);if(o===-1){t.push({name:e.slice(n+1),suffix:"type-param"});break}t.push({name:e.slice(n+1,o),suffix:"type-param"}),n=o+1;continue}if(e[n]==="("&&(t.length===0||n===0||ws(e[n-1]))){let o=e.indexOf(")",n+1);if(o!==-1&&e[o+1]!=="."){t.push({name:e.slice(n+1,o),suffix:"parameter"}),n=o+1;continue}}let r;if(e[n]==="`"){let o=e.indexOf("`",n+1);if(o===-1){r=e.slice(n+1),t.push({name:r,suffix:"term"});break}r=e.slice(n+1,o),n=o+1}else{let o=n;for(;n<e.length&&!ws(e[n]);)n++;r=e.slice(o,n)}if(n>=e.length){r&&t.push({name:r,suffix:"term"});break}let i=e[n];if(i==="("){let o=e.indexOf(")",n+1);o!==-1&&e[o+1]==="."?(t.push({name:r,suffix:"method"}),n=o+2):o!==-1?(t.push({name:r,suffix:"method"}),n=o+1):(t.push({name:r,suffix:"term"}),n++)}else{let o=Xf[i];o&&t.push({name:r,suffix:o}),n+=1}}return t}function ws(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function Ve(e){let t=de(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let n=t;if(n.descriptors.length===0)return n.raw;let r=[];for(let i of n.descriptors){let o=Qf(i);o&&r.push(o)}return r.join(":")}function Qf(e){let t=e.suffix==="namespace"?Zf(e.name):e.name;return t?e.suffix==="method"?`${t}()`:t:""}function Zf(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function K(e){let t=de(e);if("kind"in t&&t.kind==="local")return t.id;let n=t;return n.descriptors.length===0?"":n.descriptors[n.descriptors.length-1].name}function tt(e){let t=de(e);if("kind"in t&&t.kind==="local")return null;let n=t;return n.descriptors[n.descriptors.length-1]?.suffix??null}function ci(e){return e.endsWith("().")||tt(e)==="method"}function jt(e){let t=tt(e);return t==="method"?!0:t!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function Ls(e){return tt(e)==="namespace"}var Yf=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function rE(e){return Yf.test(e)}var em=new Set(["test","tests","_tests"]);function iE(e){let t=de(e);if("kind"in t)return!1;for(let n=0;n<t.descriptors.length-1;n+=1){let r=t.descriptors[n];if(r?.suffix==="namespace"&&r.name&&em.has(r.name))return!0}return!1}function oE(e,t){let n=de(e),r=de(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,o=r.descriptors;if(o.length!==i.length+1)return!1;for(let s=0;s<i.length;s++){let a=i[s],c=o[s];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function sE(e,t){let n=de(e),r=de(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,o=r.descriptors;if(o.length<=i.length)return!1;for(let s=0;s<i.length;s++){let a=i[s],c=o[s];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Ue(e,t){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
111
111
  FROM global_symbols gs
112
112
  JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
113
113
  JOIN documents d ON der.document_id = d.id
114
114
  WHERE ${t.where}
115
115
  ${e.pathExclusionsFor("d")}
116
- ${ks(t.orderBy)}
117
- ${Ds(t.limit)}`,...t.params??[])}function tt(e,t){return e.all(`SELECT
116
+ ${Ds(t.orderBy)}
117
+ ${As(t.limit)}`,...t.params??[])}function nt(e,t){return e.all(`SELECT
118
118
  gs.id,
119
119
  gs.symbol,
120
120
  c.document_id,
@@ -133,8 +133,8 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
133
133
  AND ${t.where}
134
134
  ${e.pathExclusionsFor("d")}
135
135
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
136
- ${ks(t.orderBy)}
137
- ${Ds(t.limit)}`,...t.params??[])}function ks(e){return e?`ORDER BY ${e}`:""}function Ds(e){return typeof e=="number"?`LIMIT ${e}`:""}function li(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function ui(e){if(!e)return null;let t=Ls(e);if(t)return t.replace(/\n/g," ");let n=e.indexOf("|");if(n===-1)return e.replace(/\n/g," ");let r=e.slice(n+1);return(Ls(r)??r).replace(/\n/g," ")}function Ls(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function tm(e,t={}){if(ae(e.symbol)!==null)return t.includeClassMemberFallbacks===!0;let i=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(i)}function Le(e,t,n={}){let r=new Map;for(let o of t)e.length>0&&!tm(o,{includeClassMemberFallbacks:n.includeClassMemberFallbacks})||r.set(o.id,o);for(let o of e)r.set(o.id,o);let i=[...r.values()];return n.sort?i.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):i}function bE(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let r=t.get(n.leaf)??[];r.push(n),t.set(n.leaf,r)}return t}var nm=v("file-definitions",{clearGroups:["definition-catalog"]}),rm=ye("scoped-matched-definitions",{clearGroups:["definition-catalog"]}),im=v("file-function-like-definitions",{clearGroups:["definition-catalog"]}),As=new WeakMap;function T(e,t,n={}){return n.includeClassMemberFallbacks?di(e,t,void 0,{includeClassMemberFallbacks:!0}):nm.get(e,t,()=>{let r=Bs(e,t);if(r)return r;let i=di(e,t),o=We(e),s=Dn(e).forFile(t,{text:!0}).text;return o&&s&&$s.write(e,t,he(e,t,s),{projectFingerprint:o,definitions:i.map(a=>({...a}))}),i})}function om(e,t){return im.get(e,t,()=>{let n=Bs(e,t);return n?n.filter(r=>r.isFunctionLike):di(e,t,r=>r.isFunctionLike)})}var $s=le({kind:"file-definitions",invalidation:X("file-definitions"),serialize:sm,deserialize:am});function Bs(e,t){let n=We(e);if(!n)return null;let r=Dn(e).forFile(t,{text:!0}).text;if(!r)return null;let i=$s.read(e,t,he(e,t,r));return i?cm(i,n,t):null}function sm(e){return JSON.stringify(e)}function am(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.projectFingerprint!="string"||!Array.isArray(t.definitions)?null:{projectFingerprint:t.projectFingerprint,definitions:t.definitions}}catch{return null}}function cm(e,t,n){if(e.projectFingerprint!==t)return null;let r=[];for(let i of e.definitions){let o=lm(i,n);if(!o)return null;r.push(o)}return r}function lm(e,t){return!ke(e)||typeof e.symbolId!="number"||typeof e.symbol!="string"||typeof e.documentId!="number"||typeof e.startLine!="number"||typeof e.startChar!="number"&&e.startChar!==void 0||typeof e.endLine!="number"||typeof e.endChar!="number"&&e.endChar!==void 0||e.relativePath!==t||typeof e.leaf!="string"||typeof e.parentTypeName!="string"&&e.parentTypeName!==null||typeof e.isFunctionLike!="boolean"||typeof e.isTypeLike!="boolean"||typeof e.kind!="number"&&e.kind!==null||typeof e.documentation!="string"&&e.documentation!==null||typeof e.enclosingSymbol!="string"&&e.enclosingSymbol!==null?null:{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,startChar:e.startChar,endLine:e.endLine,endChar:e.endChar,relativePath:e.relativePath,leaf:e.leaf,parentTypeName:e.parentTypeName,isFunctionLike:e.isFunctionLike,isTypeLike:e.isTypeLike,kind:e.kind,documentation:e.documentation,enclosingSymbol:e.enclosingSymbol}}function di(e,t,n,r={}){let i=Le(um(e,t),dm(e,t),{sort:!0,includeClassMemberFallbacks:r.includeClassMemberFallbacks}).map(js);return n&&(i=i.filter(n)),Us(e,t,i)}function um(e,t){return e.all(`SELECT
136
+ ${Ds(t.orderBy)}
137
+ ${As(t.limit)}`,...t.params??[])}function Ds(e){return e?`ORDER BY ${e}`:""}function As(e){return typeof e=="number"?`LIMIT ${e}`:""}function li(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function ui(e){if(!e)return null;let t=ks(e);if(t)return t.replace(/\n/g," ");let n=e.indexOf("|");if(n===-1)return e.replace(/\n/g," ");let r=e.slice(n+1);return(ks(r)??r).replace(/\n/g," ")}function ks(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function tm(e,t={}){if(ae(e.symbol)!==null)return t.includeClassMemberFallbacks===!0;let i=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(i)}function Le(e,t,n={}){let r=new Map;for(let o of t)e.length>0&&!tm(o,{includeClassMemberFallbacks:n.includeClassMemberFallbacks})||r.set(o.id,o);for(let o of e)r.set(o.id,o);let i=[...r.values()];return n.sort?i.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):i}function NE(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let r=t.get(n.leaf)??[];r.push(n),t.set(n.leaf,r)}return t}var nm=v("file-definitions",{clearGroups:["definition-catalog"]}),rm=ye("scoped-matched-definitions",{clearGroups:["definition-catalog"]}),im=v("file-function-like-definitions",{clearGroups:["definition-catalog"]}),Os=new WeakMap;function T(e,t,n={}){return n.includeClassMemberFallbacks?di(e,t,void 0,{includeClassMemberFallbacks:!0}):nm.get(e,t,()=>{let r=js(e,t);if(r)return r;let i=di(e,t),o=qe(e),s=Dn(e).forFile(t,{text:!0}).text;return o&&s&&Bs.write(e,t,he(e,t,s),{projectFingerprint:o,definitions:i.map(a=>({...a}))}),i})}function om(e,t){return im.get(e,t,()=>{let n=js(e,t);return n?n.filter(r=>r.isFunctionLike):di(e,t,r=>r.isFunctionLike)})}var Bs=le({kind:"file-definitions",invalidation:X("file-definitions"),serialize:sm,deserialize:am});function js(e,t){let n=qe(e);if(!n)return null;let r=Dn(e).forFile(t,{text:!0}).text;if(!r)return null;let i=Bs.read(e,t,he(e,t,r));return i?cm(i,n,t):null}function sm(e){return JSON.stringify(e)}function am(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.projectFingerprint!="string"||!Array.isArray(t.definitions)?null:{projectFingerprint:t.projectFingerprint,definitions:t.definitions}}catch{return null}}function cm(e,t,n){if(e.projectFingerprint!==t)return null;let r=[];for(let i of e.definitions){let o=lm(i,n);if(!o)return null;r.push(o)}return r}function lm(e,t){return!ke(e)||typeof e.symbolId!="number"||typeof e.symbol!="string"||typeof e.documentId!="number"||typeof e.startLine!="number"||typeof e.startChar!="number"&&e.startChar!==void 0||typeof e.endLine!="number"||typeof e.endChar!="number"&&e.endChar!==void 0||e.relativePath!==t||typeof e.leaf!="string"||typeof e.parentTypeName!="string"&&e.parentTypeName!==null||typeof e.isFunctionLike!="boolean"||typeof e.isTypeLike!="boolean"||typeof e.kind!="number"&&e.kind!==null||typeof e.documentation!="string"&&e.documentation!==null||typeof e.enclosingSymbol!="string"&&e.enclosingSymbol!==null?null:{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,startChar:e.startChar,endLine:e.endLine,endChar:e.endChar,relativePath:e.relativePath,leaf:e.leaf,parentTypeName:e.parentTypeName,isFunctionLike:e.isFunctionLike,isTypeLike:e.isTypeLike,kind:e.kind,documentation:e.documentation,enclosingSymbol:e.enclosingSymbol}}function di(e,t,n,r={}){let i=Le(um(e,t),dm(e,t),{sort:!0,includeClassMemberFallbacks:r.includeClassMemberFallbacks}).map(Vs);return n&&(i=i.filter(n)),Hs(e,t,i)}function um(e,t){return e.all(`SELECT
138
138
  gs.id,
139
139
  gs.symbol,
140
140
  der.document_id,
@@ -173,7 +173,7 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
173
173
  AND m.role = 1
174
174
  ${e.symbolNoiseFor("gs")}
175
175
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
176
- ORDER BY start_line, end_line`,t)}function js(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,startChar:e.start_char??0,endLine:e.end_line,endChar:e.end_char??0,relativePath:e.relative_path,leaf:K(e.symbol),parentTypeName:ae(e.symbol),isFunctionLike:jt(e.symbol),isTypeLike:et(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function xE(e,t={}){return pm(e,t.scope)}function pm(e,t){return ee(e,{scope:t,includeIgnored:!1}).flatMap(n=>T(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function vE(e,t){return ee(e,{scope:t,includeIgnored:!1}).flatMap(n=>om(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function NE(e,t){let n=rm.get(e,()=>new WeakMap),r=n.get(t.symbolMatches);r||(r=new Map,n.set(t.symbolMatches,r));let i=JSON.stringify({scope:t.scope??null,sqlPrefilter:t.sqlPrefilter??null}),o=r.get(i);if(o)return[...o];let s=Os(fm(e,t.scope,t.sqlPrefilter)),a=Os(mm(e,t.scope,t.sqlPrefilter)),c=new Set([...s.keys(),...a.keys()]),l=[];for(let u of[...c].sort()){if(e.isIgnored(u))continue;let d=Le(s.get(u)??[],a.get(u)??[],{sort:!0}).filter(p=>t.symbolMatches(p.symbol));d.length!==0&&l.push(...Us(e,u,d.map(js)))}return r.set(i,l),[...l]}function fm(e,t,n){let r=t?"AND d.relative_path LIKE ?":"",i=n?`AND ${Vs("gs",n)}`:"",o=t?[`%${t}%`]:[];return e.all(`SELECT
176
+ ORDER BY start_line, end_line`,t)}function Vs(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,startChar:e.start_char??0,endLine:e.end_line,endChar:e.end_char??0,relativePath:e.relative_path,leaf:K(e.symbol),parentTypeName:ae(e.symbol),isFunctionLike:jt(e.symbol),isTypeLike:tt(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function EE(e,t={}){return pm(e,t.scope)}function pm(e,t){return ee(e,{scope:t,includeIgnored:!1}).flatMap(n=>T(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function IE(e,t){return ee(e,{scope:t,includeIgnored:!1}).flatMap(n=>om(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function CE(e,t){let n=rm.get(e,()=>new WeakMap),r=n.get(t.symbolMatches);r||(r=new Map,n.set(t.symbolMatches,r));let i=JSON.stringify({scope:t.scope??null,sqlPrefilter:t.sqlPrefilter??null}),o=r.get(i);if(o)return[...o];let s=Ms(fm(e,t.scope,t.sqlPrefilter)),a=Ms(mm(e,t.scope,t.sqlPrefilter)),c=new Set([...s.keys(),...a.keys()]),l=[];for(let u of[...c].sort()){if(e.isIgnored(u))continue;let d=Le(s.get(u)??[],a.get(u)??[],{sort:!0}).filter(p=>t.symbolMatches(p.symbol));d.length!==0&&l.push(...Hs(e,u,d.map(Vs)))}return r.set(i,l),[...l]}function fm(e,t,n){let r=t?"AND d.relative_path LIKE ?":"",i=n?`AND ${Us("gs",n)}`:"",o=t?[`%${t}%`]:[];return e.all(`SELECT
177
177
  gs.id,
178
178
  gs.symbol,
179
179
  der.document_id,
@@ -194,7 +194,7 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
194
194
  ${r}
195
195
  ${i}
196
196
  ${e.symbolNoiseFor("gs")}
197
- ORDER BY d.relative_path, der.start_line, der.end_line`,...o)}function mm(e,t,n){let r=t?"AND d.relative_path LIKE ?":"",i=n?`AND ${Vs("gs",n)}`:"",o=t?[`%${t}%`]:[];return e.all(`SELECT
197
+ ORDER BY d.relative_path, der.start_line, der.end_line`,...o)}function mm(e,t,n){let r=t?"AND d.relative_path LIKE ?":"",i=n?`AND ${Us("gs",n)}`:"",o=t?[`%${t}%`]:[];return e.all(`SELECT
198
198
  gs.id,
199
199
  gs.symbol,
200
200
  c.document_id,
@@ -222,7 +222,7 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
222
222
  ${i}
223
223
  ${e.symbolNoiseFor("gs")}
224
224
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
225
- ORDER BY d.relative_path, start_line, end_line`,...o)}function gm(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function Vs(e,t){return t==="callable"?gm(e):ym(e)}function ym(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function Os(e){let t=new Map;for(let n of e){let r=t.get(n.relative_path);r?r.push(n):t.set(n.relative_path,[n])}return t}function EE(e,t,n={}){if(t.length===0)return[];let r=t.flatMap(i=>T(e,i)).filter(i=>!e.isIgnored(i.relativePath));return n.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),n.sort&&(r=r.sort((i,o)=>i.relativePath.localeCompare(o.relativePath)||i.startLine-o.startLine||i.endLine-o.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:Ve(i.symbol),signature:li(ui(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function hm(e){let t=new Map,n=e.map((r,i)=>({definition:r,index:i,span:r.endLine-r.startLine})).sort((r,i)=>r.span-i.span||r.index-i.index);for(let{definition:r}of n)for(let i=r.startLine;i<=r.endLine;i+=1)t.has(i)||t.set(i,r);return t}function Nt(e,t){let n=As.get(e);return n||(n=hm(e),As.set(e,n)),n.get(t)??null}function An(e,t){let n=T(e,t.relative_path).find(r=>r.symbolId===t.id);return n?{symbolId:n.symbolId,symbol:n.symbol,documentId:n.documentId,startLine:n.startLine,startChar:n.startChar,endLine:n.endLine,endChar:n.endChar,relativePath:n.relativePath}:{symbolId:t.id,symbol:t.symbol,documentId:t.document_id,startLine:t.start_line,startChar:t.start_char??0,endLine:t.end_line,endChar:t.end_char??0,relativePath:t.relative_path}}function Us(e,t,n){let r=Dn(e).forFile(t,{text:!0}).text,i=Lr(e,t);return i?Em(n,i,r):r?Sm(n,r):n}function Sm(e,t){let n=t.split(/\r?\n/),r=bm(e,n),i=xm(e,r),o=vm(i,n);return Nm(e,o)}function bm(e,t){let n=e.some(i=>On(i.symbol))?Pm(t):null,r=new Map;for(let i of e)r.set(i.symbolId,Fm(t,n,i));return r}function xm(e,t){return e.filter(n=>On(n.symbol)).map(n=>({definition:n,startLine:t.get(n.symbolId)??n.startLine})).sort((n,r)=>n.startLine-r.startLine||n.definition.startLine-r.definition.startLine||n.definition.symbol.localeCompare(r.definition.symbol))}function vm(e,t){let n=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],o=e[r+1],s=o?Math.max(i.startLine,o.startLine-1):t.length-1;n.set(i.definition.symbolId,{startLine:i.startLine,endLine:wm(t,i.definition,i.startLine,s)})}return n}function Nm(e,t){return e.map(n=>{let r=t.get(n.symbolId);return r?{...n,startLine:r.startLine,endLine:r.endLine}:n})}function Em(e,t,n=null){let r=new Map;for(let i of t){let o=r.get(i.name);o?o.push(i):r.set(i.name,[i])}return e.map(i=>{if(!Tm(i)||!i.leaf)return Ms(i,n);let o=r.get(i.leaf);if(!o||o.length===0)return Ms(i,n);let s=n?Im(i,o,n):null;if(s)return{...i,startLine:s.startLine,endLine:s.endLine};let a=o[0],c=Math.abs(a.startLine-i.startLine);for(let l=1;l<o.length;l+=1){let u=o[l],d=Math.abs(u.startLine-i.startLine);d<c&&(a=u,c=d)}return{...i,startLine:a.startLine,endLine:a.endLine}})}function Im(e,t,n){let r=Cm(e.symbol);if(!r)return null;let i=n.split(/\r?\n/),o=new RegExp(`\\b${re(r)}\\b`);for(let s of t){let a=_m(i,s.startLine);if(a&&o.test(a))return s}return null}function Cm(e){return e.match(/\/impl#\[([^\]]+)\]/)?.[1]??null}function _m(e,t){for(let n=t;n>=0;n-=1){let r=e[n]?.trim()??"";if(r){if(/^impl\b/.test(r))return Rm(e,n,t);if(/^(?:struct|enum|trait|mod)\b/.test(r))return null}}return null}function Rm(e,t,n){let r=[];for(let i=t;i<=n;i+=1){let o=e[i]??"";if(r.push(o),o.includes("{"))break}return r.join(" ")}function Tm(e){return On(e.symbol)?!0:et(e.symbol)==="term"&&ae(e.symbol)===null}function Ms(e,t){if(!t||!e.leaf||et(e.symbol)!=="term"||ae(e.symbol)!==null)return e;let n=re(e.leaf),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${n}\\b`),o=t.split(/\r?\n/).findIndex(s=>r.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function Fm(e,t,n){if(!On(n.symbol))return n.startLine;let r=Math.max(0,Math.min(n.startLine,e.length-1));if(!t)return r;let i=t.get(n.leaf);if(!i||i.length===0)return r;let o=null;for(let s of i){let a=Math.abs(s-n.startLine);(!o||a<o.distance)&&(o={line:s,distance:a})}return o?.line??r}function Pm(e){let t=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,n=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(a,c)=>{let l=o.get(a);if(!l){o.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let u of c.matchAll(t))u[1]&&s(u[1],a);for(let u of c.matchAll(n))u[1]&&s(u[1],a);let l=c.match(r);l?.[1]&&s(l[1],a);for(let u of c.matchAll(i))u[1]&&s(u[1],a)}return o}function wm(e,t,n,r){let i=Math.max(n,Math.min(e.length-1,r)),o=Math.max(n,Math.min(i,t.endLine)),s=0,a=0,c=!1;for(let l=n;l<=i;l+=1){let u=Lm(e[l]??"");for(let d of u)d==="{"?(s+=1,c=!0):d==="}"?s=Math.max(0,s-1):d==="("?a+=1:d===")"&&(a=Math.max(0,a-1));if(c&&s===0||!c&&a===0&&l>=o)return l}return o}function Lm(e){let t="",n=null,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i],s=e[i+1];if(!n&&o==="/"&&s==="/"){t+=" ".repeat(e.length-i);break}if(n){if(r){r=!1,t+=" ";continue}if(o==="\\"){r=!0,t+=" ";continue}o===n&&(n=null),t+=" ";continue}if(o==='"'||o==="'"||o==="`"){n=o,t+=" ";continue}t+=o}return t}function On(e){return e.includes("().")}function IE(e){let t=de(e);if("kind"in t)return[];let n=[];for(let r=t.descriptors.length-2;r>=0;r-=1){let i=t.descriptors[r];i?.suffix==="type"&&i.name&&n.push(i.name)}return n}var Hs=So({kind:"file-dependency-graph",invalidation:X("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:Bm}),km=v("file-dep-graph",{clearGroups:["whole-project"]});function Mn(e,t,n={}){let r=n.scipEdges??"all-references",i=n.sourceEdges??"imports-only",o=Om(t,r,i);return km.get(e,o,()=>{let s=new Set(ee(e,{includeIgnored:!1})),a=We(e),c=0,l=0,u=null,d=!1,p=0,f=0;return ge("file-dep-graph.product",()=>{if(a){let S=Hs.read(e,o,a);if(S){d=!0;let b=$m(S);return c=S.sourceFileCount,l=S.sourceEdgeCount,p=S.scipEdgeCount,f=b.size,u=S.sourceDependencyFingerprint,b}}let m=ge("file-dep-graph.source-imports",()=>{let S=Dm(e,s,t,i);return c=S.files.length,l=S.edges.length,u=S.fingerprint,S},()=>({scope:t??null,sourceEdges:i,files:c,edges:l})),g=new Map,y=(S,b)=>Hm(e,g,s,S,b);ge("file-dep-graph.scip-edges",()=>{for(let S of Um(e,t,r))p+=1,y(S.from_file,S.to_file)},()=>({scope:t??null,edges:p}));for(let S of m.edges)y(S.fromFile,S.toFile);return f=g.size,a&&Hs.write(e,o,a,{sourceDependencyFingerprint:m.fingerprint,sourceFileCount:m.files.length,sourceEdgeCount:m.edges.length,scipEdgeCount:p,graph:Mm(g)}),g},()=>({scope:t??null,available:a!==null,hit:d,files:c,sourceEdges:l,sourceEdgeMode:i,scipEdges:p,graphFiles:f,sourceDependencyFingerprint:u}))})}function Dm(e,t,n,r){let i=[],o=[];for(let s of t)if(!(n&&!s.includes(n))){i.push(s);for(let a of M(e,s))a.sourcePath&&o.push({fromFile:s,toFile:a.sourcePath});if(r==="imports-and-reexports")for(let a of je(e,s))a.sourcePath&&o.push({fromFile:s,toFile:a.sourcePath})}return{files:i,edges:o,fingerprint:Am(i,o)}}function Am(e,t){let n=t.map(r=>`${r.fromFile}\0${r.toFile}`).sort();return Ne(JSON.stringify({files:e,edges:n}))}function Om(e,t,n){return`edge-mode-v3:${t}:${n}:${e??"<all>"}`}function Mm(e){return[...e].map(([t,n])=>[t,[...n]])}function $m(e){return new Map(e.graph.map(([t,n])=>[t,new Set(n)]))}function Bm(e){let t=JSON.parse(e);return jm(t)?t:null}function jm(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.sourceDependencyFingerprint=="string"&&typeof t.sourceFileCount=="number"&&typeof t.sourceEdgeCount=="number"&&typeof t.scipEdgeCount=="number"&&Array.isArray(t.graph)&&t.graph.every(Vm)}function Vm(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(t=>typeof t=="string")}function Um(e,t,n){let r=t?"AND d1.relative_path LIKE ?":"",i=t?[`%${t}%`]:[],o=n==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
225
+ ORDER BY d.relative_path, start_line, end_line`,...o)}function gm(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function Us(e,t){return t==="callable"?gm(e):ym(e)}function ym(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function Ms(e){let t=new Map;for(let n of e){let r=t.get(n.relative_path);r?r.push(n):t.set(n.relative_path,[n])}return t}function _E(e,t,n={}){if(t.length===0)return[];let r=t.flatMap(i=>T(e,i)).filter(i=>!e.isIgnored(i.relativePath));return n.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),n.sort&&(r=r.sort((i,o)=>i.relativePath.localeCompare(o.relativePath)||i.startLine-o.startLine||i.endLine-o.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:Ve(i.symbol),signature:li(ui(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function hm(e){let t=new Map,n=e.map((r,i)=>({definition:r,index:i,span:r.endLine-r.startLine})).sort((r,i)=>r.span-i.span||r.index-i.index);for(let{definition:r}of n)for(let i=r.startLine;i<=r.endLine;i+=1)t.has(i)||t.set(i,r);return t}function Nt(e,t){let n=Os.get(e);return n||(n=hm(e),Os.set(e,n)),n.get(t)??null}function An(e,t){let n=T(e,t.relative_path).find(r=>r.symbolId===t.id);return n?{symbolId:n.symbolId,symbol:n.symbol,documentId:n.documentId,startLine:n.startLine,startChar:n.startChar,endLine:n.endLine,endChar:n.endChar,relativePath:n.relativePath}:{symbolId:t.id,symbol:t.symbol,documentId:t.document_id,startLine:t.start_line,startChar:t.start_char??0,endLine:t.end_line,endChar:t.end_char??0,relativePath:t.relative_path}}function Hs(e,t,n){let r=Dn(e).forFile(t,{text:!0}).text,i=Lr(e,t);return i?Em(n,i,r):r?Sm(n,r):n}function Sm(e,t){let n=t.split(/\r?\n/),r=bm(e,n),i=xm(e,r),o=vm(i,n);return Nm(e,o)}function bm(e,t){let n=e.some(i=>On(i.symbol))?Pm(t):null,r=new Map;for(let i of e)r.set(i.symbolId,Fm(t,n,i));return r}function xm(e,t){return e.filter(n=>On(n.symbol)).map(n=>({definition:n,startLine:t.get(n.symbolId)??n.startLine})).sort((n,r)=>n.startLine-r.startLine||n.definition.startLine-r.definition.startLine||n.definition.symbol.localeCompare(r.definition.symbol))}function vm(e,t){let n=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],o=e[r+1],s=o?Math.max(i.startLine,o.startLine-1):t.length-1;n.set(i.definition.symbolId,{startLine:i.startLine,endLine:wm(t,i.definition,i.startLine,s)})}return n}function Nm(e,t){return e.map(n=>{let r=t.get(n.symbolId);return r?{...n,startLine:r.startLine,endLine:r.endLine}:n})}function Em(e,t,n=null){let r=new Map;for(let i of t){let o=r.get(i.name);o?o.push(i):r.set(i.name,[i])}return e.map(i=>{if(!Tm(i)||!i.leaf)return $s(i,n);let o=r.get(i.leaf);if(!o||o.length===0)return $s(i,n);let s=n?Im(i,o,n):null;if(s)return{...i,startLine:s.startLine,endLine:s.endLine};let a=o[0],c=Math.abs(a.startLine-i.startLine);for(let l=1;l<o.length;l+=1){let u=o[l],d=Math.abs(u.startLine-i.startLine);d<c&&(a=u,c=d)}return{...i,startLine:a.startLine,endLine:a.endLine}})}function Im(e,t,n){let r=Cm(e.symbol);if(!r)return null;let i=n.split(/\r?\n/),o=new RegExp(`\\b${re(r)}\\b`);for(let s of t){let a=_m(i,s.startLine);if(a&&o.test(a))return s}return null}function Cm(e){return e.match(/\/impl#\[([^\]]+)\]/)?.[1]??null}function _m(e,t){for(let n=t;n>=0;n-=1){let r=e[n]?.trim()??"";if(r){if(/^impl\b/.test(r))return Rm(e,n,t);if(/^(?:struct|enum|trait|mod)\b/.test(r))return null}}return null}function Rm(e,t,n){let r=[];for(let i=t;i<=n;i+=1){let o=e[i]??"";if(r.push(o),o.includes("{"))break}return r.join(" ")}function Tm(e){return On(e.symbol)?!0:tt(e.symbol)==="term"&&ae(e.symbol)===null}function $s(e,t){if(!t||!e.leaf||tt(e.symbol)!=="term"||ae(e.symbol)!==null)return e;let n=re(e.leaf),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${n}\\b`),o=t.split(/\r?\n/).findIndex(s=>r.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function Fm(e,t,n){if(!On(n.symbol))return n.startLine;let r=Math.max(0,Math.min(n.startLine,e.length-1));if(!t)return r;let i=t.get(n.leaf);if(!i||i.length===0)return r;let o=null;for(let s of i){let a=Math.abs(s-n.startLine);(!o||a<o.distance)&&(o={line:s,distance:a})}return o?.line??r}function Pm(e){let t=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,n=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(a,c)=>{let l=o.get(a);if(!l){o.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let u of c.matchAll(t))u[1]&&s(u[1],a);for(let u of c.matchAll(n))u[1]&&s(u[1],a);let l=c.match(r);l?.[1]&&s(l[1],a);for(let u of c.matchAll(i))u[1]&&s(u[1],a)}return o}function wm(e,t,n,r){let i=Math.max(n,Math.min(e.length-1,r)),o=Math.max(n,Math.min(i,t.endLine)),s=0,a=0,c=!1;for(let l=n;l<=i;l+=1){let u=Lm(e[l]??"");for(let d of u)d==="{"?(s+=1,c=!0):d==="}"?s=Math.max(0,s-1):d==="("?a+=1:d===")"&&(a=Math.max(0,a-1));if(c&&s===0||!c&&a===0&&l>=o)return l}return o}function Lm(e){let t="",n=null,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i],s=e[i+1];if(!n&&o==="/"&&s==="/"){t+=" ".repeat(e.length-i);break}if(n){if(r){r=!1,t+=" ";continue}if(o==="\\"){r=!0,t+=" ";continue}o===n&&(n=null),t+=" ";continue}if(o==='"'||o==="'"||o==="`"){n=o,t+=" ";continue}t+=o}return t}function On(e){return e.includes("().")}function RE(e){let t=de(e);if("kind"in t)return[];let n=[];for(let r=t.descriptors.length-2;r>=0;r-=1){let i=t.descriptors[r];i?.suffix==="type"&&i.name&&n.push(i.name)}return n}var zs=bo({kind:"file-dependency-graph",invalidation:X("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:Bm}),km=v("file-dep-graph",{clearGroups:["whole-project"]});function Mn(e,t,n={}){let r=n.scipEdges??"all-references",i=n.sourceEdges??"imports-only",o=Om(t,r,i);return km.get(e,o,()=>{let s=new Set(ee(e,{includeIgnored:!1})),a=qe(e),c=0,l=0,u=null,d=!1,p=0,f=0;return ge("file-dep-graph.product",()=>{if(a){let S=zs.read(e,o,a);if(S){d=!0;let b=$m(S);return c=S.sourceFileCount,l=S.sourceEdgeCount,p=S.scipEdgeCount,f=b.size,u=S.sourceDependencyFingerprint,b}}let m=ge("file-dep-graph.source-imports",()=>{let S=Dm(e,s,t,i);return c=S.files.length,l=S.edges.length,u=S.fingerprint,S},()=>({scope:t??null,sourceEdges:i,files:c,edges:l})),g=new Map,y=(S,b)=>Hm(e,g,s,S,b);ge("file-dep-graph.scip-edges",()=>{for(let S of Um(e,t,r))p+=1,y(S.from_file,S.to_file)},()=>({scope:t??null,edges:p}));for(let S of m.edges)y(S.fromFile,S.toFile);return f=g.size,a&&zs.write(e,o,a,{sourceDependencyFingerprint:m.fingerprint,sourceFileCount:m.files.length,sourceEdgeCount:m.edges.length,scipEdgeCount:p,graph:Mm(g)}),g},()=>({scope:t??null,available:a!==null,hit:d,files:c,sourceEdges:l,sourceEdgeMode:i,scipEdges:p,graphFiles:f,sourceDependencyFingerprint:u}))})}function Dm(e,t,n,r){let i=[],o=[];for(let s of t)if(!(n&&!s.includes(n))){i.push(s);for(let a of M(e,s))a.sourcePath&&o.push({fromFile:s,toFile:a.sourcePath});if(r==="imports-and-reexports")for(let a of je(e,s))a.sourcePath&&o.push({fromFile:s,toFile:a.sourcePath})}return{files:i,edges:o,fingerprint:Am(i,o)}}function Am(e,t){let n=t.map(r=>`${r.fromFile}\0${r.toFile}`).sort();return Ne(JSON.stringify({files:e,edges:n}))}function Om(e,t,n){return`edge-mode-v3:${t}:${n}:${e??"<all>"}`}function Mm(e){return[...e].map(([t,n])=>[t,[...n]])}function $m(e){return new Map(e.graph.map(([t,n])=>[t,new Set(n)]))}function Bm(e){let t=JSON.parse(e);return jm(t)?t:null}function jm(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.sourceDependencyFingerprint=="string"&&typeof t.sourceFileCount=="number"&&typeof t.sourceEdgeCount=="number"&&typeof t.scipEdgeCount=="number"&&Array.isArray(t.graph)&&t.graph.every(Vm)}function Vm(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(t=>typeof t=="string")}function Um(e,t,n){let r=t?"AND d1.relative_path LIKE ?":"",i=t?[`%${t}%`]:[],o=n==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
226
226
  d1.relative_path AS from_file,
227
227
  d2.relative_path AS to_file
228
228
  FROM mentions m
@@ -240,8 +240,8 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
240
240
  WHERE d1.id != d2.id
241
241
  ${o}
242
242
  ${e.pathExclusionsFor("d1","d2")}
243
- ${r}`,...i)}function Hm(e,t,n,r,i){if(r===i||e.isIgnored(r)||e.isIgnored(i)||!n.has(i))return;let o=t.get(r);o||(o=new Set,t.set(r,o)),o.add(i)}var zm=v("symbol-resolution",{clearGroups:[]});function GE(e,t){return Wm(e,t).match}function Wm(e,t){return zm.get(e,t,()=>{let n=qs(e,t.trim()).filter(s=>!e.isIgnored(s.relative_path));if(n.length>0)return Et(e,n);let r=Ym(e,t);if(r&&!e.isIgnored(r.relative_path))return Et(e,[r]);let i=qm(e,t);if(i.length>0)return Et(e,i);let o=Km(e,t);return o.length>0?Et(e,o):Qm(e,t)})}function qm(e,t){let n=t.trim().replace(/\(\)$/u,""),r=n.lastIndexOf(":");if(r<=0||r===n.length-1||n.startsWith("local:"))return[];let i=n.slice(r+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(i))return[];let o=[`/${i}().`,`/${i}.`,`/${i}#`,`#${i}().`,`#${i}.`,`/${i}/`],s=`gs.display_name = ? OR ${o.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,a=[i,...o],c=Ue(e,{where:s,params:a,orderBy:"d.relative_path, der.start_line",limit:200}),l=c.length>0?[]:tt(e,{where:s,params:a,orderBy:"d.relative_path, start_line",limit:200}),u=Le(c,l).filter(d=>!e.isIgnored(d.relative_path)).filter(d=>Ve(d.symbol).replace(/\(\)$/u,"")===n);return[...new Map(u.map(d=>[`${d.symbol}\0${d.relative_path}`,d])).values()]}function Km(e,t){let n=$n(t),r=pi(n);if(!r)return[];let i=`%${r.path}%`,o=r.leaf;return Gm(e,i,o,n)}function Gm(e,t,n,r){let i=Le([],[...Xm(e,t,n),...Jm(e,t,n)]).filter(o=>!e.isIgnored(o.relative_path)).filter(o=>It(o,r)>1);return i.sort((o,s)=>It(s,r)-It(o,r)||o.end_line-o.start_line-(s.end_line-s.start_line)||o.start_line-s.start_line||o.symbol.localeCompare(s.symbol)),i}function Xm(e,t,n){return Ue(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function Jm(e,t,n){return tt(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function Qm(e,t){let n=$n(t),r=og(t),i=rg(e,r),o=sg(i,t,n).filter(a=>!e.isIgnored(a.relative_path));if(o.length>0)return Et(e,o);let s=[];for(let a of i){if(e.isIgnored(a.relative_path))continue;let c=ig(a,t,n,r);c<=0||s.push({row:a,score:c})}return s.sort((a,c)=>c.score-a.score||a.row.end_line-a.row.start_line-(c.row.end_line-c.row.start_line)||a.row.relative_path.localeCompare(c.row.relative_path)||a.row.symbol.localeCompare(c.row.symbol)),Et(e,s.map(a=>a.row))}function Et(e,t){let n=t.map(i=>An(e,i)),r=n[0]??null;return{match:r,candidates:r?Zm(n,r):[],total:n.length}}function Zm(e,t){let n=new Set([`${t.symbolId}:${t.relativePath}:${t.startLine}`]),r=[];for(let i of e){let o=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!n.has(o)&&(n.add(o),r.push({symbol:i.symbol,shortName:Ve(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),r.length>=5))break}return r}function Ym(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!n)return;let[,r,i,o]=n,s=ao(e,r,{allowMultiple:!1})[0]?.relativePath;if(!s)return;let a=Math.max(0,parseInt(i,10)-1),c=o?Math.max(a,parseInt(o,10)-1):a;return eg(e,s,a,c)??tg(e,s,a,c)}function eg(e,t,n,r){return Ue(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[t,n,r],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function tg(e,t,n,r){return tt(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[t,n,r],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function XE(e,t){let n=qs(e,t).find(r=>!e.isIgnored(r.relative_path));return n?An(e,n):null}function qs(e,t){let n=Ue(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, der.start_line"}),r=n.length>0?[]:tt(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, start_line"});return Le(n,r)}function Vt(e,t){if("symbol"in t&&"relativePath"in t)return t;let n=ng(e,t.symbolId)[0];return n?An(e,n):null}function ng(e,t){let n=Ue(e,{where:"gs.id = ?",params:[t],orderBy:"der.start_line, der.end_line"}),r=tt(e,{where:"gs.id = ?",params:[t],orderBy:"start_line, end_line"});return Le(n,r)}function rg(e,t){let n=t.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),r=t.flatMap(a=>{let c=`%${a}%`;return[c,c,c]}),i=n.join(`
244
- AND `),o=Ue(e,{where:i,params:r,limit:200}),s=tt(e,{where:i,params:r,limit:200});return Le(o,s)}function ig(e,t,n,r){let i=t.trim(),o=n,s=o.replace(/\(\)$/,""),a=t.toLowerCase(),c=n.toLowerCase(),l=c.replace(/\(\)$/,""),u=e.symbol,d=Ve(e.symbol),p=K(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),g=d.toLowerCase(),y=p.toLowerCase(),S=f.toLowerCase(),b=e.relative_path.toLowerCase(),N=/[/:.]/.test(n),E=pi(n),_=E?.leaf.toLowerCase(),h=0;return(u===i||u===o)&&(h+=1150),(d===i||d===o)&&(h+=1100),f===s&&(h+=1180),p===s&&(h+=1160),(`${p}()`===i||`${p}()`===o)&&(h+=955),(m===a||m===c)&&(h+=1e3),(g===a||g===c)&&(h+=950),(b===a||b===c)&&(h+=925),(b.endsWith(`/${c}`)||b.endsWith(`/${a}`))&&(h+=875),S===l&&(h+=850),y===l&&(h+=825),(`${y}()`===a||`${y}()`===c)&&(h+=820),(g.endsWith(`:${c}`)||g.endsWith(`:${l}`)||g.endsWith(`:${l}()`))&&(h+=800),m.includes(c)&&(h+=120),g.includes(c)&&(h+=140),b.includes(c)&&(h+=140),S.includes(c)&&(h+=110),r.every(I=>{let C=I.toLowerCase();return m.includes(C)||g.includes(C)||b.includes(C)||S.includes(C)})&&(h+=100+r.length*15),E&&b.includes(E.path.toLowerCase())&&(h+=360,_&&(y===_||`${y}()`===_||`${y}()`==`${_}()`)&&(h+=700),ci(e.symbol)&&(h+=180)),jt(e.symbol)&&y===l&&(h+=60),!N&&ws(e.symbol)&&(h-=160),h-=Math.min(50,Math.max(0,e.end_line-e.start_line)),h}function pi(e){let t=e.trim().replace(/\\/g,"/"),n=t.lastIndexOf("/");if(n<=0||n===t.length-1)return null;let r=t.slice(n+1).replace(/\(\)$/,"");return!r||r.includes(".")?null:{path:t.slice(0,n),leaf:r}}function $n(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function og(e){let t=$n(e),n=t.split(/[^A-Za-z0-9_]+/).map(r=>r.trim()).filter(r=>r.length>0);return n.length>0?[...new Set(n)]:[t]}function sg(e,t,n){let r=t.trim(),i=e.filter(a=>{let c=Ve(a.symbol),l=K(a.symbol),u=(a.display_name??"").trim();return a.symbol===r||c===r||c===n||l===r||l===n||`${l}()`===r||u===r||u===n||`${u}()`===r||It(a,n)>1||a.relative_path===r});if(i.length===0)return[];let o=n.replace(/\(\)$/u,""),s=i.filter(a=>K(a.symbol)===o);if(s.length>0){s.sort((c,l)=>zs(c,l,n));let a=s.filter(c=>jt(c.symbol));return a.length>0?a:s}return i.sort((a,c)=>zs(a,c,n)),i}function zs(e,t,n){return It(t,n)-It(e,n)||e.end_line-e.start_line-(t.end_line-t.start_line)||e.relative_path.localeCompare(t.relative_path)||e.symbol.localeCompare(t.symbol)}function It(e,t){let n=pi(t);if(!n)return 0;let r=e.relative_path.toLowerCase(),i=K(e.symbol).toLowerCase(),o=n.path.toLowerCase(),s=n.leaf.toLowerCase();return r.includes(o)?i!==s?1:ci(e.symbol)?ae(e.symbol)===null?5:4:ae(e.symbol)===null?3:2:0}function JE(e,t,n=5){let r=Ws(t);if(!r)return[];let i=Ue(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),o=new Map;for(let s of i){if(e.isIgnored(s.relative_path))continue;let a=Ve(s.symbol),c=K(s.symbol),l=s.display_name??c,u=[a,c,l].filter(f=>f.trim().length>0),d=Math.min(...u.map(f=>ag(Ws(f),r))),p=o.get(a);(!p||d<p.distance)&&o.set(a,{shortName:a,distance:d})}return[...o.values()].sort((s,a)=>s.distance-a.distance||s.shortName.localeCompare(a.shortName)).slice(0,n).map(s=>s.shortName)}function Ws(e){return $n(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function ag(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=Array.from({length:t.length+1},(r,i)=>i);for(let r=0;r<e.length;r++){let i=[r+1];for(let o=0;o<t.length;o++){let s=e[r]===t[o]?0:1;i[o+1]=Math.min(i[o]+1,n[o+1]+1,n[o]+s)}n=i}return n[t.length]}function oI(e,t){let n=Ks(e);return n?t.filter(r=>Ks(r.file)===n):t}function sI(e,t,n,r,i){let o=n.find(s=>s.file===t);if(o)return o;if(r){let s=i?.match(/^[A-Za-z_$][\w$]*/u)?.[0];if(!s)return null;let a=M(e,t),c=new Set(a.filter(p=>p.localName===s||p.importedName===s).map(p=>p.sourcePath).filter(p=>!!p));for(let p of n)for(let f of c)if(at(f,p.file))return p;let l=cg(x(e,t)??"",s);if(l.size===0)return null;let u=new Set(a.filter(p=>l.has(p.localName??p.importedName)).map(p=>p.sourcePath).filter(p=>!!p)),d=n.filter(p=>l.has(ae(p.symbol)??"")&&[...u].some(f=>at(f,p.file)));return d.length===1?d[0]:null}return n.length===1?n[0]:null}function cg(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),r=new Set,i=[new RegExp(`\\b${n}\\s*:\\s*([A-Za-z_$][\\w$]*)`,"gu"),new RegExp(`\\b${n}\\s*=\\s*(?:new\\s+)?([A-Za-z_$][\\w$]*)\\s*\\(`,"gu")];for(let o of i)for(let s of e.matchAll(o))r.add(s[1]);return r.size===1?r:new Set}function Ks(e){let t=H(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var lg=ye("global-leaf-index",{clearGroups:["whole-project"]});function fi(e){return lg.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
243
+ ${r}`,...i)}function Hm(e,t,n,r,i){if(r===i||e.isIgnored(r)||e.isIgnored(i)||!n.has(i))return;let o=t.get(r);o||(o=new Set,t.set(r,o)),o.add(i)}var zm=v("symbol-resolution",{clearGroups:[]});function QE(e,t){return Wm(e,t).match}function Wm(e,t){return zm.get(e,t,()=>{let n=Ks(e,t.trim()).filter(s=>!e.isIgnored(s.relative_path));if(n.length>0)return Et(e,n);let r=Ym(e,t);if(r&&!e.isIgnored(r.relative_path))return Et(e,[r]);let i=qm(e,t);if(i.length>0)return Et(e,i);let o=Km(e,t);return o.length>0?Et(e,o):Qm(e,t)})}function qm(e,t){let n=t.trim().replace(/\(\)$/u,""),r=n.lastIndexOf(":");if(r<=0||r===n.length-1||n.startsWith("local:"))return[];let i=n.slice(r+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(i))return[];let o=[`/${i}().`,`/${i}.`,`/${i}#`,`#${i}().`,`#${i}.`,`/${i}/`],s=`gs.display_name = ? OR ${o.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,a=[i,...o],c=Ue(e,{where:s,params:a,orderBy:"d.relative_path, der.start_line",limit:200}),l=c.length>0?[]:nt(e,{where:s,params:a,orderBy:"d.relative_path, start_line",limit:200}),u=Le(c,l).filter(d=>!e.isIgnored(d.relative_path)).filter(d=>Ve(d.symbol).replace(/\(\)$/u,"")===n);return[...new Map(u.map(d=>[`${d.symbol}\0${d.relative_path}`,d])).values()]}function Km(e,t){let n=$n(t),r=pi(n);if(!r)return[];let i=`%${r.path}%`,o=r.leaf;return Gm(e,i,o,n)}function Gm(e,t,n,r){let i=Le([],[...Xm(e,t,n),...Jm(e,t,n)]).filter(o=>!e.isIgnored(o.relative_path)).filter(o=>It(o,r)>1);return i.sort((o,s)=>It(s,r)-It(o,r)||o.end_line-o.start_line-(s.end_line-s.start_line)||o.start_line-s.start_line||o.symbol.localeCompare(s.symbol)),i}function Xm(e,t,n){return Ue(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function Jm(e,t,n){return nt(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function Qm(e,t){let n=$n(t),r=og(t),i=rg(e,r),o=sg(i,t,n).filter(a=>!e.isIgnored(a.relative_path));if(o.length>0)return Et(e,o);let s=[];for(let a of i){if(e.isIgnored(a.relative_path))continue;let c=ig(a,t,n,r);c<=0||s.push({row:a,score:c})}return s.sort((a,c)=>c.score-a.score||a.row.end_line-a.row.start_line-(c.row.end_line-c.row.start_line)||a.row.relative_path.localeCompare(c.row.relative_path)||a.row.symbol.localeCompare(c.row.symbol)),Et(e,s.map(a=>a.row))}function Et(e,t){let n=t.map(i=>An(e,i)),r=n[0]??null;return{match:r,candidates:r?Zm(n,r):[],total:n.length}}function Zm(e,t){let n=new Set([`${t.symbolId}:${t.relativePath}:${t.startLine}`]),r=[];for(let i of e){let o=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!n.has(o)&&(n.add(o),r.push({symbol:i.symbol,shortName:Ve(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),r.length>=5))break}return r}function Ym(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!n)return;let[,r,i,o]=n,s=co(e,r,{allowMultiple:!1})[0]?.relativePath;if(!s)return;let a=Math.max(0,parseInt(i,10)-1),c=o?Math.max(a,parseInt(o,10)-1):a;return eg(e,s,a,c)??tg(e,s,a,c)}function eg(e,t,n,r){return Ue(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[t,n,r],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function tg(e,t,n,r){return nt(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[t,n,r],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function ZE(e,t){let n=Ks(e,t).find(r=>!e.isIgnored(r.relative_path));return n?An(e,n):null}function Ks(e,t){let n=Ue(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, der.start_line"}),r=n.length>0?[]:nt(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, start_line"});return Le(n,r)}function Vt(e,t){if("symbol"in t&&"relativePath"in t)return t;let n=ng(e,t.symbolId)[0];return n?An(e,n):null}function ng(e,t){let n=Ue(e,{where:"gs.id = ?",params:[t],orderBy:"der.start_line, der.end_line"}),r=nt(e,{where:"gs.id = ?",params:[t],orderBy:"start_line, end_line"});return Le(n,r)}function rg(e,t){let n=t.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),r=t.flatMap(a=>{let c=`%${a}%`;return[c,c,c]}),i=n.join(`
244
+ AND `),o=Ue(e,{where:i,params:r,limit:200}),s=nt(e,{where:i,params:r,limit:200});return Le(o,s)}function ig(e,t,n,r){let i=t.trim(),o=n,s=o.replace(/\(\)$/,""),a=t.toLowerCase(),c=n.toLowerCase(),l=c.replace(/\(\)$/,""),u=e.symbol,d=Ve(e.symbol),p=K(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),g=d.toLowerCase(),y=p.toLowerCase(),S=f.toLowerCase(),b=e.relative_path.toLowerCase(),N=/[/:.]/.test(n),E=pi(n),_=E?.leaf.toLowerCase(),h=0;return(u===i||u===o)&&(h+=1150),(d===i||d===o)&&(h+=1100),f===s&&(h+=1180),p===s&&(h+=1160),(`${p}()`===i||`${p}()`===o)&&(h+=955),(m===a||m===c)&&(h+=1e3),(g===a||g===c)&&(h+=950),(b===a||b===c)&&(h+=925),(b.endsWith(`/${c}`)||b.endsWith(`/${a}`))&&(h+=875),S===l&&(h+=850),y===l&&(h+=825),(`${y}()`===a||`${y}()`===c)&&(h+=820),(g.endsWith(`:${c}`)||g.endsWith(`:${l}`)||g.endsWith(`:${l}()`))&&(h+=800),m.includes(c)&&(h+=120),g.includes(c)&&(h+=140),b.includes(c)&&(h+=140),S.includes(c)&&(h+=110),r.every(I=>{let C=I.toLowerCase();return m.includes(C)||g.includes(C)||b.includes(C)||S.includes(C)})&&(h+=100+r.length*15),E&&b.includes(E.path.toLowerCase())&&(h+=360,_&&(y===_||`${y}()`===_||`${y}()`==`${_}()`)&&(h+=700),ci(e.symbol)&&(h+=180)),jt(e.symbol)&&y===l&&(h+=60),!N&&Ls(e.symbol)&&(h-=160),h-=Math.min(50,Math.max(0,e.end_line-e.start_line)),h}function pi(e){let t=e.trim().replace(/\\/g,"/"),n=t.lastIndexOf("/");if(n<=0||n===t.length-1)return null;let r=t.slice(n+1).replace(/\(\)$/,"");return!r||r.includes(".")?null:{path:t.slice(0,n),leaf:r}}function $n(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function og(e){let t=$n(e),n=t.split(/[^A-Za-z0-9_]+/).map(r=>r.trim()).filter(r=>r.length>0);return n.length>0?[...new Set(n)]:[t]}function sg(e,t,n){let r=t.trim(),i=e.filter(a=>{let c=Ve(a.symbol),l=K(a.symbol),u=(a.display_name??"").trim();return a.symbol===r||c===r||c===n||l===r||l===n||`${l}()`===r||u===r||u===n||`${u}()`===r||It(a,n)>1||a.relative_path===r});if(i.length===0)return[];let o=n.replace(/\(\)$/u,""),s=i.filter(a=>K(a.symbol)===o);if(s.length>0){s.sort((c,l)=>Ws(c,l,n));let a=s.filter(c=>jt(c.symbol));return a.length>0?a:s}return i.sort((a,c)=>Ws(a,c,n)),i}function Ws(e,t,n){return It(t,n)-It(e,n)||e.end_line-e.start_line-(t.end_line-t.start_line)||e.relative_path.localeCompare(t.relative_path)||e.symbol.localeCompare(t.symbol)}function It(e,t){let n=pi(t);if(!n)return 0;let r=e.relative_path.toLowerCase(),i=K(e.symbol).toLowerCase(),o=n.path.toLowerCase(),s=n.leaf.toLowerCase();return r.includes(o)?i!==s?1:ci(e.symbol)?ae(e.symbol)===null?5:4:ae(e.symbol)===null?3:2:0}function YE(e,t,n=5){let r=qs(t);if(!r)return[];let i=Ue(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),o=new Map;for(let s of i){if(e.isIgnored(s.relative_path))continue;let a=Ve(s.symbol),c=K(s.symbol),l=s.display_name??c,u=[a,c,l].filter(f=>f.trim().length>0),d=Math.min(...u.map(f=>ag(qs(f),r))),p=o.get(a);(!p||d<p.distance)&&o.set(a,{shortName:a,distance:d})}return[...o.values()].sort((s,a)=>s.distance-a.distance||s.shortName.localeCompare(a.shortName)).slice(0,n).map(s=>s.shortName)}function qs(e){return $n(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function ag(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=Array.from({length:t.length+1},(r,i)=>i);for(let r=0;r<e.length;r++){let i=[r+1];for(let o=0;o<t.length;o++){let s=e[r]===t[o]?0:1;i[o+1]=Math.min(i[o]+1,n[o+1]+1,n[o]+s)}n=i}return n[t.length]}function cI(e,t){let n=Gs(e);return n?t.filter(r=>Gs(r.file)===n):t}function lI(e,t,n,r,i){let o=n.find(s=>s.file===t);if(o)return o;if(r){let s=i?.match(/^[A-Za-z_$][\w$]*/u)?.[0];if(!s)return null;let a=M(e,t),c=new Set(a.filter(p=>p.localName===s||p.importedName===s).map(p=>p.sourcePath).filter(p=>!!p));for(let p of n)for(let f of c)if(ct(f,p.file))return p;let l=cg(x(e,t)??"",s);if(l.size===0)return null;let u=new Set(a.filter(p=>l.has(p.localName??p.importedName)).map(p=>p.sourcePath).filter(p=>!!p)),d=n.filter(p=>l.has(ae(p.symbol)??"")&&[...u].some(f=>ct(f,p.file)));return d.length===1?d[0]:null}return n.length===1?n[0]:null}function cg(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),r=new Set,i=[new RegExp(`\\b${n}\\s*:\\s*([A-Za-z_$][\\w$]*)`,"gu"),new RegExp(`\\b${n}\\s*=\\s*(?:new\\s+)?([A-Za-z_$][\\w$]*)\\s*\\(`,"gu")];for(let o of i)for(let s of e.matchAll(o))r.add(s[1]);return r.size===1?r:new Set}function Gs(e){let t=H(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var lg=ye("global-leaf-index",{clearGroups:["whole-project"]});function fi(e){return lg.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
245
245
  COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
246
246
  FROM global_symbols gs
247
247
  LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
@@ -255,7 +255,7 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
255
255
  GROUP BY m.symbol_id
256
256
  ) mention_doc ON mention_doc.symbol_id = gs.id
257
257
  WHERE 1 = 1
258
- ${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=K(r.symbol);if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.some(s=>s.symbolId===r.id)||o.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}function Bn(e,t,n,r={}){if(!n)return[];let i=x(e,t);return i?i.indexOf(n)===-1?[]:(mi(e,t).get(n)??[]).filter(s=>!ug(s,r)):[]}function ug(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var dg=v("file-identifiers",{clearGroups:["whole-project","source-file"]});function Gs(e,t){let n=A(e,t);return n?n.fileIdentifiers:dg.get(e,t,()=>new Set(mi(e,t).keys()))}var pg=v("file-ident-lines",{clearGroups:["whole-project","source-file"]});function mi(e,t){let n=A(e,t);return n?n.identifierLineMap:pg.get(e,t,()=>mg(e,t))}var fg=v("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function pI(e,t){let n=A(e,t);return n?n.identifiersByLine:fg.get(e,t,()=>{let r=mi(e,t),i=0;for(let s of r.values()){let a=s[s.length-1];a!==void 0&&a>i&&(i=a)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,a]of r)for(let c of a)o[c].add(s);return o})}function mg(e,t){let n=new Map,r=(a,c)=>{let l=n.get(a);if(!l){n.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)},i=x(e,t);if(!i)return n;let o=Qr(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let a=0;a<o.length;a+=1){let c=o[a]??"";for(let l of c.matchAll(s))l[1]&&r(l[1],a)}return n}var Xs=/[A-Za-z_$][A-Za-z0-9_$]*/g,Js=/^[A-Za-z_$][A-Za-z0-9_$]*$/,gg=512;function gi(e){let t=[],n=!1;for(let r of e)r&&(n=!0,Js.test(r)||t.push(r));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:t}}function Qs(e,t){let n=yg(t)?t:gi(t);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;if(n.candidateNames.size<=gg){for(let i of n.candidateNames)if(i){if(Js.test(i)){if(hg(i).test(e))return!0;continue}if(e.includes(i))return!0}return!1}Xs.lastIndex=0;let r;for(;(r=Xs.exec(e))!==null;)if(n.candidateNames.has(r[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function yg(e){return"candidateNames"in e}function hg(e){return new RegExp(`(?<![A-Za-z_$0-9])${re(e)}(?![A-Za-z_$0-9])`)}var Sg=v("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function Ys(e,t){let n=qi(t);return Sg.get(e,n,()=>bg(e,n))}function bg(e,t){let n=new Map;for(let r of M(e,t)){if(!r.sourcePath)continue;let i=r.localName??r.importedName;if(i&&Zs(n,i,r.sourcePath),r.kind==="namespace")for(let o of r.usedMembers)Zs(n,o,r.sourcePath)}return n}function Zs(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function yi(e,t,n){let r=fi(e).get(n);if(!r||r.length===0)return[];if(r.length===1)return[Ut(r[0])];let i=r.filter(c=>c.file===t);if(i.length>0)return i.map(Ut);let o=Ys(e,t),s=o.get(n);if(s)for(let c of s){let l=r.filter(u=>at(c,u.file));if(l.length>0)return l.map(Ut)}let a=new Set;for(let c of o.values())for(let l of c)a.add(l);for(let c of a){let l=r.filter(u=>at(c,u.file));if(l.length>0&&l.length===r.length)return l.map(Ut)}return[]}function PI(e,t,n){let r=yi(e,t,n);if(r.length>0)return r;let i=fi(e).get(n);return!i||i.length===0?[]:i.map(Ut)}function ea(e,t,n={}){let r=xg(e,t);if(!r)return[];let i=Vt(e,t);if(n.semantic!==!1&&n.semanticEvidence){let s=n.semanticEvidence.references(e,{...i,leaf:r.identifier,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let a=new Map;for(let c of s){let l=a.get(c.file)??[];l.push(c.line),a.set(c.file,l)}return jn(e,a)}}let o=new Map;for(let s of z(e)){let a=vg(e,r,s);a.length>0&&o.set(s,a)}return jn(e,o)}function xg(e,t){let n=Vt(e,t);if(!n)return null;let r=K(n.symbol);return r?{symbolId:n.symbolId,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,identifier:r}:null}function vg(e,t,n){let r=x(e,n);return!r||r.indexOf(t.identifier)===-1?[]:n!==t.relativePath&&!yi(e,n,t.identifier).some(o=>o.symbolId===t.symbolId)?[]:Bn(e,n,t.identifier,n===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{})}function wI(e,t,n={}){let r=new Map;for(let c of t){if(!c.leaf)continue;let l=r.get(c.leaf)??[];l.push(c),r.set(c.leaf,l)}if(r.size===0)return new Map;let i=new Set(t.map(c=>c.symbolId)),o=new Set(r.keys()),s=gi(o),a=new Map;for(let c of z(e)){if(n.skipPath?.(c)||!Qs(x(e,c),s))continue;let l=Gs(e,c);if(l.size!==0){for(let u of l)if(r.has(u))for(let d of yi(e,c,u)){if(!i.has(d.symbolId)||c===d.relativePath)continue;let p=a.get(d.symbolId);p||(p=new Set,a.set(d.symbolId,p)),p.add(c)}}}return a}function Ut(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function jn(e,t){let n=[],r=new Set;for(let[i,o]of t){let s=T(e,i);for(let a of o){let c=Nt(s,a),l=`${i}|${a}|${c?.symbol??""}`;r.has(l)||(r.add(l),n.push({file:i,line:a,enclosingSymbol:c?.symbol??null}))}}return n}function kI(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
258
+ ${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=K(r.symbol);if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.some(s=>s.symbolId===r.id)||o.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}function Bn(e,t,n,r={}){if(!n)return[];let i=x(e,t);return i?i.indexOf(n)===-1?[]:(mi(e,t).get(n)??[]).filter(s=>!ug(s,r)):[]}function ug(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var dg=v("file-identifiers",{clearGroups:["whole-project","source-file"]});function Xs(e,t){let n=A(e,t);return n?n.fileIdentifiers:dg.get(e,t,()=>new Set(mi(e,t).keys()))}var pg=v("file-ident-lines",{clearGroups:["whole-project","source-file"]});function mi(e,t){let n=A(e,t);return n?n.identifierLineMap:pg.get(e,t,()=>mg(e,t))}var fg=v("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function gI(e,t){let n=A(e,t);return n?n.identifiersByLine:fg.get(e,t,()=>{let r=mi(e,t),i=0;for(let s of r.values()){let a=s[s.length-1];a!==void 0&&a>i&&(i=a)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,a]of r)for(let c of a)o[c].add(s);return o})}function mg(e,t){let n=new Map,r=(a,c)=>{let l=n.get(a);if(!l){n.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)},i=x(e,t);if(!i)return n;let o=Qr(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let a=0;a<o.length;a+=1){let c=o[a]??"";for(let l of c.matchAll(s))l[1]&&r(l[1],a)}return n}var Js=/[A-Za-z_$][A-Za-z0-9_$]*/g,Qs=/^[A-Za-z_$][A-Za-z0-9_$]*$/,gg=512;function gi(e){let t=[],n=!1;for(let r of e)r&&(n=!0,Qs.test(r)||t.push(r));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:t}}function Zs(e,t){let n=yg(t)?t:gi(t);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;if(n.candidateNames.size<=gg){for(let i of n.candidateNames)if(i){if(Qs.test(i)){if(hg(i).test(e))return!0;continue}if(e.includes(i))return!0}return!1}Js.lastIndex=0;let r;for(;(r=Js.exec(e))!==null;)if(n.candidateNames.has(r[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function yg(e){return"candidateNames"in e}function hg(e){return new RegExp(`(?<![A-Za-z_$0-9])${re(e)}(?![A-Za-z_$0-9])`)}var Sg=v("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function ea(e,t){let n=Ki(t);return Sg.get(e,n,()=>bg(e,n))}function bg(e,t){let n=new Map;for(let r of M(e,t)){if(!r.sourcePath)continue;let i=r.localName??r.importedName;if(i&&Ys(n,i,r.sourcePath),r.kind==="namespace")for(let o of r.usedMembers)Ys(n,o,r.sourcePath)}return n}function Ys(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function yi(e,t,n){let r=fi(e).get(n);if(!r||r.length===0)return[];if(r.length===1)return[Ut(r[0])];let i=r.filter(c=>c.file===t);if(i.length>0)return i.map(Ut);let o=ea(e,t),s=o.get(n);if(s)for(let c of s){let l=r.filter(u=>ct(c,u.file));if(l.length>0)return l.map(Ut)}let a=new Set;for(let c of o.values())for(let l of c)a.add(l);for(let c of a){let l=r.filter(u=>ct(c,u.file));if(l.length>0&&l.length===r.length)return l.map(Ut)}return[]}function kI(e,t,n){let r=yi(e,t,n);if(r.length>0)return r;let i=fi(e).get(n);return!i||i.length===0?[]:i.map(Ut)}function ta(e,t,n={}){let r=xg(e,t);if(!r)return[];let i=Vt(e,t);if(n.semantic!==!1&&n.semanticEvidence){let s=n.semanticEvidence.references(e,{...i,leaf:r.identifier,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let a=new Map;for(let c of s){let l=a.get(c.file)??[];l.push(c.line),a.set(c.file,l)}return jn(e,a)}}let o=new Map;for(let s of z(e)){let a=vg(e,r,s);a.length>0&&o.set(s,a)}return jn(e,o)}function xg(e,t){let n=Vt(e,t);if(!n)return null;let r=K(n.symbol);return r?{symbolId:n.symbolId,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,identifier:r}:null}function vg(e,t,n){let r=x(e,n);return!r||r.indexOf(t.identifier)===-1?[]:n!==t.relativePath&&!yi(e,n,t.identifier).some(o=>o.symbolId===t.symbolId)?[]:Bn(e,n,t.identifier,n===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{})}function DI(e,t,n={}){let r=new Map;for(let c of t){if(!c.leaf)continue;let l=r.get(c.leaf)??[];l.push(c),r.set(c.leaf,l)}if(r.size===0)return new Map;let i=new Set(t.map(c=>c.symbolId)),o=new Set(r.keys()),s=gi(o),a=new Map;for(let c of z(e)){if(n.skipPath?.(c)||!Zs(x(e,c),s))continue;let l=Xs(e,c);if(l.size!==0){for(let u of l)if(r.has(u))for(let d of yi(e,c,u)){if(!i.has(d.symbolId)||c===d.relativePath)continue;let p=a.get(d.symbolId);p||(p=new Set,a.set(d.symbolId,p)),p.add(c)}}}return a}function Ut(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function jn(e,t){let n=[],r=new Set;for(let[i,o]of t){let s=T(e,i);for(let a of o){let c=Nt(s,a),l=`${i}|${a}|${c?.symbol??""}`;r.has(l)||(r.add(l),n.push({file:i,line:a,enclosingSymbol:c?.symbol??null}))}}return n}function OI(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
259
259
  m.symbol_id,
260
260
  d.relative_path,
261
261
  COUNT(*) AS ref_count
@@ -265,16 +265,16 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
265
265
  WHERE m.role != 1
266
266
  ${r}
267
267
  ${e.pathExclusionsFor("d")}
268
- GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function DI(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
268
+ GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function MI(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
269
269
  FROM mentions m
270
270
  JOIN chunks c ON m.chunk_id = c.id
271
271
  JOIN documents d ON c.document_id = d.id
272
272
  WHERE m.role != 1
273
273
  ${r}
274
- ${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function AI(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id
274
+ ${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function $I(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id
275
275
  FROM mentions m
276
276
  WHERE m.role != 1
277
- ${r}`,...n??[])}).filter(n=>n.symbol_id!==null)}function ta(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
277
+ ${r}`,...n??[])}).filter(n=>n.symbol_id!==null)}function na(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
278
278
  c.start_line AS chunk_start, c.end_line AS chunk_end
279
279
  FROM mentions m
280
280
  JOIN chunks c ON m.chunk_id = c.id
@@ -282,7 +282,7 @@ ${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=Nf(c);d&&n.push({...d,start:a,e
282
282
  WHERE m.role != 1
283
283
  ${r}
284
284
  ${e.pathExclusionsFor("d")}
285
- ORDER BY d.relative_path, c.start_line`,...n??[])})}function Vn(e,t,n){if(!t)return n();if(t.length===0)return[];let r=[];for(let i=0;i<t.length;i+=750)r.push(...n(t.slice(i,i+750)));return r}function Ng(e,t){return Eg(e,[t]).get(t.symbolId)??[]}function Eg(e,t){let n=t.map(o=>({symbolId:o.symbolId,prelude:Tg(e,o)})).filter(o=>o.prelude!==null),r=Cg(e,n.map(o=>o.symbolId)),i=new Map;for(let{symbolId:o,prelude:s}of n){let a=Ig(e,r.get(o)??new Map,s.match,s.identifier);i.set(o,jn(e,a))}return i}function UI(e,t,n={}){return hi(e,t,n).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function hi(e,t,n={}){let r=ea(e,t,{semantic:n.semantic,semanticEvidence:n.semanticEvidence}),i=r.length>0?na(r,"source-attribution"):na(Ng(e,t),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function na(e,t){return e.map(n=>({...n,provenance:t}))}function Ig(e,t,n,r){let i=new Map;for(let[o,s]of t)i.set(o,_g(e,o,s,n,r));return i}function Cg(e,t){let n=new Map;for(let r of ta(e,t)){if(e.isIgnored(r.relative_path))continue;let i=n.get(r.symbol_id);i||(i=new Map,n.set(r.symbol_id,i));let o=i.get(r.relative_path);o||(o=[],i.set(r.relative_path,o)),o.push({start_line:r.chunk_start,end_line:r.chunk_end})}return n}function _g(e,t,n,r,i){let o=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},s=i?Bn(e,t,i,o):[];return n.flatMap(a=>Rg(s,a))}function Rg(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function Tg(e,t){let n=Vt(e,t);return n?{match:n,identifier:K(n.symbol)||null}:null}import{execFileSync as sa,spawnSync as Mg}from"child_process";import{platform as $g}from"os";import{resolve as Bg}from"path";import{createHash as Fg}from"crypto";import{existsSync as ra,renameSync as Pg,rmSync as wg,writeFileSync as Lg}from"fs";import{tmpdir as kg}from"os";import{join as Dg}from"path";var ia=`'use strict';
285
+ ORDER BY d.relative_path, c.start_line`,...n??[])})}function Vn(e,t,n){if(!t)return n();if(t.length===0)return[];let r=[];for(let i=0;i<t.length;i+=750)r.push(...n(t.slice(i,i+750)));return r}function Ng(e,t){return Eg(e,[t]).get(t.symbolId)??[]}function Eg(e,t){let n=t.map(o=>({symbolId:o.symbolId,prelude:Tg(e,o)})).filter(o=>o.prelude!==null),r=Cg(e,n.map(o=>o.symbolId)),i=new Map;for(let{symbolId:o,prelude:s}of n){let a=Ig(e,r.get(o)??new Map,s.match,s.identifier);i.set(o,jn(e,a))}return i}function WI(e,t,n={}){return hi(e,t,n).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function hi(e,t,n={}){let r=ta(e,t,{semantic:n.semantic,semanticEvidence:n.semanticEvidence}),i=r.length>0?ra(r,"source-attribution"):ra(Ng(e,t),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function ra(e,t){return e.map(n=>({...n,provenance:t}))}function Ig(e,t,n,r){let i=new Map;for(let[o,s]of t)i.set(o,_g(e,o,s,n,r));return i}function Cg(e,t){let n=new Map;for(let r of na(e,t)){if(e.isIgnored(r.relative_path))continue;let i=n.get(r.symbol_id);i||(i=new Map,n.set(r.symbol_id,i));let o=i.get(r.relative_path);o||(o=[],i.set(r.relative_path,o)),o.push({start_line:r.chunk_start,end_line:r.chunk_end})}return n}function _g(e,t,n,r,i){let o=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},s=i?Bn(e,t,i,o):[];return n.flatMap(a=>Rg(s,a))}function Rg(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function Tg(e,t){let n=Vt(e,t);return n?{match:n,identifier:K(n.symbol)||null}:null}import{execFileSync as aa,spawnSync as Mg}from"child_process";import{platform as $g}from"os";import{resolve as Bg}from"path";import{createHash as Fg}from"crypto";import{existsSync as ia,renameSync as Pg,rmSync as wg,writeFileSync as Lg}from"fs";import{tmpdir as kg}from"os";import{join as Dg}from"path";var oa=`'use strict';
286
286
  const NativeRegExp = globalThis.RegExp;
287
287
  const escapeLoneSeparator = (args) =>
288
288
  typeof args[0] === 'string' && args[0] === '\\\\' ? ['\\\\\\\\', ...args.slice(1)] : args;
@@ -294,17 +294,17 @@ globalThis.RegExp = new Proxy(NativeRegExp, {
294
294
  return Reflect.apply(target, thisArg, escapeLoneSeparator(args));
295
295
  },
296
296
  });
297
- `,Ag=/scip-python/i;function oa(e,t=process.platform){return t!=="win32"||!Ag.test(e)?[]:["--require",Og()]}function Og(e=kg()){let t=Fg("sha256").update(ia).digest("hex").slice(0,16),n=Dg(e,`codebaseiq-indexer-compat-${t}.cjs`);if(ra(n))return n;let r=`${n}.${process.pid}.tmp`;Lg(r,ia);try{Pg(r,n)}catch{if(wg(r,{force:!0}),!ra(n))throw new Error(`could not materialize indexer compatibility preload at ${n}`)}return n}var aa=$g()==="win32";function YI(e,t=Mg){try{return t(e,["--version"],{stdio:"ignore",timeout:1e4}).status===0}catch{return!1}}function ca(e){let t=aa?"where":"which";try{return sa(t,[e],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var jg=/\.(?:c|m)?js$/i,Vg=/\.(?:exe|com)$/i;function eC(e,t){return jg.test(e)?{binary:process.execPath,args:[...oa(e),e,...t]}:{binary:e,args:[...t]}}function Ug(e,t){return sa(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function la(e,t={}){let n=t.isWindows??aa,r=t.lookup??Ug,i;try{i=r(n?"where":"which",[e])}catch{return null}let o=i.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(!n){let s=o[0];return s?Bg(s):null}return o.find(s=>Vg.test(s))??null}import{execFileSync as da}from"child_process";import{createHash as Hg}from"crypto";import{existsSync as Un,statSync as zg}from"fs";import{createRequire as Wg}from"module";import{platform as qg}from"os";import{dirname as ua,join as Ht}from"path";var Kg=Wg(import.meta.url),dC={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function Si(e){return[e.indexerBinary,...e.binaryAliases??[]]}function Gg(e){let t=Si(e);return t.length===1?t[0]:t.join(" or ")}function bi(e){for(let t of Si(e)){let n=la(t);if(n)return n}return Jg(e)}function pC(e){return bi(e)!==null||Xg(e)}function Xg(e){return pa(e)!==null}function Jg(e){let t=pa(e);if(!t)return null;let r=JSON.parse(st(t,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return Ht(ua(t),r);for(let i of Si(e)){let o=r[i];if(o)return Ht(ua(t),o)}return null}function pa(e){if(!e.bundledNpmPackage)return null;try{return Kg.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function Qg(e,t){for(let n of e.projectLocalBinaries??[]){let r=Ht(t,n);if(Un(r))return r}return null}function Zg(e,t){for(let n of e.projectLocalBinaries??[]){let r=Ht(t,n);if(Un(r))return fa(t,n,r)}return null}function fC(e,t){let n=Yg(e,t);if(!n||n.canonicalPath!==t.canonicalPath||n.sha256!==t.sha256||n.size!==t.size||n.mtimeMs!==t.mtimeMs||n.device!==t.device||n.inode!==t.inode||n.executable!==t.executable)throw new Error(`refusing changed project-local indexer ${t.relativePath}; review the current file and rerun with --trust-project-tools`)}function Yg(e,t){try{return fa(e,t.relativePath,t.configuredPath)}catch{return null}}function fa(e,t,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=mr(e,t,r),o=gr(e,t,r),s=zg(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:t,sha256:Hg("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function ey(e,t,n={}){return(n.trustProjectTools?Zg(e,t)?.canonicalPath:null)??bi(e)}function mC(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||xi(n,t))return t;let r=ma(n,t);return r?{...t,DOTNET_ROOT:r}:t}function gC(e,t,n={}){let r=Gg(e),i=t?ey(e,t,n):bi(e);if(!i)return{language:e.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:e.installUrl,...t&&Qg(e,t)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(e.indexerBinary!=="scip-dotnet")return{language:e.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=ty(i);return{language:e.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:e.installUrl,note:o.note}}function ty(e){if(xi(e,process.env))return{runnable:!0};let t=ma(e,process.env);if(t)return{runnable:!0,note:`using .NET 9 runtime from ${t}`};let n=ga(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function ma(e,t){for(let n of ga(t))if(xi(e,{...t,DOTNET_ROOT:n}))return n;return null}function ga(e){let t=[],n=e.DOTNET_ROOT;if(n&&Un(n)&&t.push(n),qg()==="darwin"&&ca("brew"))try{let r=da("brew",["--prefix","dotnet@9"],{stdio:"pipe",windowsHide:!0,env:e,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=Ht(r,"libexec");Un(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function xi(e,t){try{return da(e,["--version"],{stdio:"pipe",windowsHide:!0,env:t,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var ny=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function Hn(e){let t=e.toLowerCase();return ny.some(n=>t.endsWith(n))}function Wn(e){let t=zn(e.projectFiles),n=new Set(t),r=new Map(e.snapshot.files.map(d=>[d.path,d])),i=e.snapshot.files.filter(d=>{let p=Gi(d.path,["typescript"]);return p==="config"||p==="ambient"}).map(d=>d.path),o=zn([...t,...i]),s=o.find(d=>!r.has(d)),a=new Set(e.snapshot.files.map(d=>d.path)).size!==e.snapshot.files.length,c=!s&&o.some(d=>ya(r.get(d))),l=Ne(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:zn(e.snapshot.typescriptProjects),membership:t})),u=new Map;return{identityFor(d,p){if(!n.has(d))return Ct("target-outside-project");if(a)return Ct("duplicate-input-path");if(s)return Ct("missing-input-fingerprint");if(c)return Ct("unreadable-input");let f=[],m,g;if(e.graph===null)f.push("dependency-graph-unavailable"),g="whole-project",m=o;else{let b=iy(d,e.graph,u);if(b.find(E=>!r.has(E)))return Ct("missing-input-fingerprint");if(m=zn([...b,...i]),m.some(E=>ya(r.get(E))))return Ct("unreadable-input");g="dependency-closure"}let y=m.map(b=>oy(r.get(b)));return{version:1,key:Ne(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:p,projectIdentity:l,inputs:y})),mode:g,inputFiles:m,reasons:f}}}}function ry(e,t){let n=new Set,r=[e];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let s of[...t.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function iy(e,t,n){let r=n.get(e);if(r)return r;let i=ry(e,t);return n.set(e,i),i}function oy(e){return{path:e.path,size:e.size,hash:e.hash}}function ya(e){return e.size<0||e.hash==="unreadable"}function Ct(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function zn(e){return[...new Set(e)].sort()}import{createRequire as sy}from"module";var ha=sy(import.meta.url),zt,qn;function ay(){if(zt!==void 0)return zt;try{zt=ha("ts-morph")}catch{zt=null}return zt}function Kn(){if(qn)return qn;let e=ay();if(!e)return"ts-morph:unavailable";let t="unknown";try{t=ha("ts-morph/package.json").version??"unknown"}catch{}return qn=`ts-morph:${t}:typescript:${e.ts.version}`,qn}function NC(e,t){return t.map(n=>({tsconfigPath:n,project:new e.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function EC(e,t,n){return{language:"typescript",availability:()=>({available:!1,reason:e,tsconfigPath:t,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var cy=ye("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function vi(e,t,n){let r=cy.get(e,()=>ly(e));if(!r)return null;let i=`${n}\0${t}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(t,n);return r.identities.set(i,s),s}function Wt(e){return ee(e,{includeIgnored:!1}).filter(Hn).sort()}function ly(e){try{if(!e.generation.metadataRaw)return null;let t=an(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=Xi(t.metadata.fingerprint);return n?{builder:Wn({projectFiles:Wt(e),snapshot:n,graph:Mn(e),engineIdentity:Kn()}),identities:new Map}:null}catch{return null}}function Gn(e,t){let n=new Map(e.map(i=>[i.symbol,i])),r=new Map(e.map(i=>[i.symbolId,[]]));for(let i of t.values())for(let o of i){let s=n.get(o.targetSymbol);s&&r.get(s.symbolId).push(o.location)}for(let[i,o]of r)r.set(i,uy(o));return r}function xa(e,t,n){let r=ba(e,t),i=ba(e,n),o=[...r].filter(d=>!i.has(d)).sort(),s=[...i].filter(d=>!r.has(d)).sort(),a=Sa(e,t),c=Sa(e,n),l=[...a].filter(d=>!c.has(d)).sort(),u=[...c].filter(d=>!a.has(d)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:l.length===0&&u.length===0,expectedCount:a.size,actualCount:c.size,missing:l,extra:u}}}function Sa(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function DC(e,t,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of e)for(let s of t.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,dy(s));return i}function ba(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function uy(e){let t=new Map;for(let n of e)t.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...t.values()].sort(va)}function dy(e){let t=new Map;for(let n of e){let{location:r}=n;t.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...t.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||va(n.location,r.location))}function va(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column}var Ni="typescript-reference-fragment-v3-incomplete-scan",Xn=le({kind:"typescript-reference-fragments",invalidation:X("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:fy});function zC(e,t,n,r=e){let i=Wt(e),o=Wn({projectFiles:i,snapshot:t,graph:Mn(e),engineIdentity:Kn()}),s=[...n].map(([a,c])=>({relativePath:a,contentHash:o.identityFor(a,Ni).key,value:[...c]}));if(s.some(a=>a.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Xn.writeBatch(r,s.map(a=>({...a,contentHash:a.contentHash}))),s.length}function WC(e,t,n,r){let i=t.filter(s=>Hn(s.relativePath));if(i.length===0)return qt("no TypeScript definitions");let o=qt("shadow did not run");return ge("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=qt("TypeScript reference fragment provider is unavailable"),o;let a=Wt(e),c=new Set(a),l=s.referenceFragmentsForFiles(a),u=a.filter(m=>!l.has(m));if(u.length>0)return o=qt(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let d=Gn(i,l),p=xa(i,py(n,c),d);if(!p.passed)return o={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...p},o;let f=[];for(let m of a){let g=vi(e,m,Ni);g?.key&&f.push({relativePath:m,contentHash:g.key,value:l.get(m)??[]})}return Xn.writeBatch(e,f),o={state:"passing",files:a.length,keyedFiles:f.length,writtenFiles:f.length,...p},o}catch(s){return o=qt(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function py(e,t){return new Map([...e].map(([n,r])=>[n,r.filter(i=>t.has(i.file))]))}function qC(e,t,n){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,a=0;return ge("typescript.reference-fragments.materialize",()=>{try{let c=Wt(e);i=c.length;let l=new Map,u=new Map,d=[];for(let m of c){let g=vi(e,m,Ni);if(!g?.key)return null;l.set(m,g.key);let y=Xn.read(e,m,g.key);y===null?(s+=1,d.push(m)):(o+=1,u.set(m,y))}if(s===0)return r="hit",{references:Gn(t,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a};let p=n(t[0].relativePath);if(!p.availability().available||!p.referenceFragmentsForFiles)return null;let f=p.referenceFragmentsForFiles(d);if(d.some(m=>!f.has(m)))return null;a=f.size,Xn.writeBatch(e,d.map(m=>({relativePath:m,contentHash:l.get(m),value:f.get(m)??[]})));for(let[m,g]of f)u.set(m,g);return r="computed",{references:Gn(t,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:a}))}function qt(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function fy(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(my)?null:t}catch{return null}}function my(e){if(!e||typeof e!="object")return!1;let t=e,n=t.location;return typeof t.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}function Na(e){let t=D(e);return gy(t)?"test":yy(t)?"worker":hy(t)?"entry":Sy(t)?"barrel":"source"}function gy(e){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(e)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(e)||/(?:^|\/)spec_[^/]+$/i.test(e)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(e)||/(?:^|\/)[^/]+_tests\.rs$/i.test(e)||/(?:^|\/)tests\.rs$/i.test(e)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(e)||/(?:^|\/)__tests__\//i.test(e)||/(?:^|\/)test\//i.test(e)||/(?:^|\/)tests\//i.test(e)||/(?:^|\/)__fixtures__\//i.test(e)||/(?:^|\/)__mocks__\//i.test(e)||/(?:^|\/)test-support\//i.test(e)||/(?:^|\/)test-utils\//i.test(e)||/(?:^|\/)testing\//i.test(e))}function yy(e){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(e)}function hy(e){let t=e.split("/"),n=t[t.length-1]??e;return n==="cli.ts"||n==="cli.js"||n==="postinstall.ts"||n==="postinstall.js"||n==="main.ts"||n==="main.js"||n==="main.rs"||n==="main.go"||n==="main.py"||n==="build.rs"||n==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(e)||/(?:^|\/)examples\/[^/]+\.rs$/.test(e)||/(?:^|\/)tests\/[^/]+\.rs$/.test(e)||/(?:^|\/)benches\/[^/]+\.rs$/.test(e)?!0:n==="index.ts"||n==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(e)?!0:t.length<=2:!1}function Sy(e){return e==="index.ts"||e==="index.js"||e.endsWith("/index.ts")||e.endsWith("/index.js")||e.endsWith("/mod.rs")||e.endsWith("/__init__.py")}function Jn(e){let t=e.replaceAll("\\","/");return Na(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}var by=4;function nt(e,t,n,r={}){return Ea(e,t,n,r.maxReexportDepth??by,0,new Set)}function Ea(e,t,n,r,i,o){let s=`${t}\0${n}`;if(o.has(s)||i>r)return[];o.add(s);let a=T(e,t).filter(c=>c.leaf===n);return a.length>0?a:je(e,t).flatMap(c=>c.sourcePath?c.kind==="named"&&!c.names.includes(n)?[]:Ea(e,c.sourcePath,n,r,i+1,new Set(o)):[])}import{createHash as cc}from"crypto";import{createHash as $y}from"crypto";var Qn=8;function _t(e,t,n){return Ri(Ia(e,t,Ci(n),0,new Set))}function _i(e,t,n){return Ei(e,t,n,0,new Set)}function Ia(e,t,n,r,i){if(r>Qn)return[];let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return o?Ca(e,t,o[1],o[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?_a(e,t,n,r,i):[]}function Ca(e,t,n,r,i,o){let s=[];for(let a of Ei(e,t,n,i+1,new Set(o))){let c=Iy(a.initializer);for(let l of c.namedChildren){if(l.type==="pair"){let u=l.childForFieldName("key")??l.namedChild(0);if(Cy(u)!==r)continue;let d=l.childForFieldName("value")??l.namedChild(1);d&&s.push(...Ia(e,a.definition.relativePath,Ci(d.text),i+1,new Set(o)));continue}if(/(?:method|function)/u.test(l.type)){if((l.childForFieldName("name")??l.namedChild(0))?.text!==r)continue;let d=Ny(e,a.definition.relativePath,r,l);s.push(...d.length>0?d:[xy(a.definition,r,l)]);continue}if(l.type==="spread_element"){let u=l.namedChild(0);if(!u)continue;for(let d of Ei(e,a.definition.relativePath,Ci(u.text),i+1,new Set(o)))s.push(...Ca(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(o)))}}}return Ri(s)}function xy(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function Ei(e,t,n,r,i){return r>Qn||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:_a(e,t,n,r,i).flatMap(o=>{let s=R(e,o.relativePath)?.rootNode,a=s?Ey(s,o.leaf):null;return a?[{definition:o,initializer:a}]:[]})}function _a(e,t,n,r,i){if(r>Qn)return[];let o=`${t}\0${n}`;if(i.has(o))return[];i.add(o);let s=T(e,t).filter(l=>l.leaf===n);if(s.length>0)return s;let a=vy(e,t,n);if(a.length>0)return a;let c=M(e,t).find(l=>l.localName===n&&l.sourcePath);if(c?.sourcePath){let l=c.kind==="namespace"||c.importedName==="default"?n:c.importedName;return Ii(e,c.sourcePath,l,r+1,new Set(i))}return Ii(e,t,n,r+1,new Set(i))}function vy(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(A(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ii(e,t,n,r,i){if(r>Qn)return[];let o=T(e,t).filter(s=>s.leaf===n);return o.length>0?o:Ri(je(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:Ii(e,s.sourcePath,n,r+1,new Set(i)):[]))}function Ny(e,t,n,r){return T(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Ey(e,t){let n=null;return Ra(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Iy(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Cy(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ci(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Ri(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function Ra(e,t){t(e);for(let n of e.namedChildren)Ra(n,t)}var _y=8;function fe(e,t){return t?Rt(e,t,0,new Set):null}function Rt(e,t,n,r){if(n>_y)return xe(t,"value-evaluation-depth");let i=Fa(t),o=Ly(i);if(o)return ky(e.file,i,o.term,o.value,o.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let c=i.namedChildren.map(l=>Rt(e,l,n+1,new Set(r)));if(c.length>=2&&c.every(l=>l!==null)){let l={kind:"concat",parts:c.map(d=>d.term)},u=c.map(d=>d.value).join("");return Dy(e.file,i,l,u,c.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",c)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return Py(e,s,i,n,r);let a=Ay(i);return a?wy(e,a.base,a.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Ry(e,i,n,r):xe(i,`unsupported-expression:${i.type}`)}function Ry(e,t,n,r){let o=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=Ty(e,o);if(s.length!==1)return xe(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let a=s[0],c=`${a.relativePath}\0${a.symbol}`;if(r.has(c))return xe(t,"call-return-cycle");let l=R(e.db,a.relativePath)?.rootNode;if(!l)return xe(t,"call-target-unparsed");let u=My(l,a.startLine,a.endLine);if(!u)return xe(t,"call-target-syntax-unavailable");let d=Fy(u);if(!d)return xe(t,"call-return-not-single-expression");let p=new Set(r);p.add(c);let f=Rt({db:e.db,file:a.relativePath,root:l},d,n+1,p);return f?Zn(t,"bounded-call-return",f,a.symbol):xe(t,"call-return-unresolved")}function Ty(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=T(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let o=M(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return o?.sourcePath?nt(e.db,o.sourcePath,o.importedName==="default"?t:o.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=M(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?nt(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Fy(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return Ta(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function Ta(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)Ta(e,r,n)}}function Py(e,t,n,r,i){let o=`${e.file}\0${t}`;if(i.has(o))return xe(n,"value-cycle");i.add(o);let s=Ti(e.root,t);if(s){let m=Rt(e,s,r+1,i);return m?Zn(n,"local-constant",m):xe(n,"non-foldable-local")}let a=M(e.db,e.file).find(m=>m.localName===t&&m.sourcePath);if(!a?.sourcePath)return pe(n,t,"unresolved-identifier");if(a.kind==="namespace")return pe(n,t,"namespace-import-requires-property");let c=a.importedName==="default"?t:a.importedName,l=nt(e.db,a.sourcePath,c);if(l.length!==1)return pe(n,t,l.length===0?"import-definition-missing":"import-definition-ambiguous");let u=l[0],d=R(e.db,u.relativePath)?.rootNode;if(!d)return pe(n,u.symbol,"import-definition-unparsed");let p=Ti(d,u.leaf);if(!p)return pe(n,u.symbol,"import-definition-non-value");let f=Rt({db:e.db,file:u.relativePath,root:d},p,r+1,i);return f?Zn(n,"imported-constant",f,u.symbol):pe(n,u.symbol,"import-value-unresolved")}function wy(e,t,n,r,i,o){let s=M(e.db,e.file).find(f=>f.localName===t&&f.sourcePath),a=e.file,c=t,l;if(s?.sourcePath){s.kind==="namespace"?(c=n[0]??"",n=n.slice(1)):c=s.importedName==="default"?t:s.importedName;let f=nt(e.db,s.sourcePath,c);if(f.length!==1)return pe(r,`${t}.${n.join(".")}`,f.length===0?"member-definition-missing":"member-definition-ambiguous");a=f[0].relativePath,c=f[0].leaf,l=f[0].symbol}let u=a===e.file?e.root:R(e.db,a)?.rootNode;if(!u)return pe(r,l??t,"member-definition-unparsed");let d=Ti(u,c);if(!d)return pe(r,l??t,"member-base-non-value");for(let f of n){let m=Fa(d);if(d=Oy(m,f),!d)return pe(r,l??`${t}.${n.join(".")}`,`member-property-missing:${f}`)}let p=Rt({db:e.db,file:a,root:u},d,i+1,o);return p?Zn(r,"member-constant",p,l):pe(r,l??t,"member-value-unresolved")}function Ly(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],o=0,s=/\$\{([^}]*)\}/gu;for(let a of r.matchAll(s)){let c=a.index??0;c>o&&i.push({kind:"literal",value:r.slice(o,c)}),i.push({kind:"unknown",reason:`template-hole:${a[1]?.trim()||"expression"}`}),o=c+a[0].length}return o<r.length&&i.push({kind:"literal",value:r.slice(o)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function ky(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Yn("direct-literal","direct",e,t)}}function Dy(e,t,n,r,i,o){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Yn("constant-concatenation","mechanically-derived",e,t),inputFactIds:o.flatMap(s=>s.derivation.inputFactIds),sourceSpans:o.flatMap(s=>s.derivation.sourceSpans)}}}function Zn(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function pe(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Yn(n,"heuristic","",e)}}function xe(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Yn(t,"heuristic","",e)}}function Yn(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function Ay(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function Ti(e,t){let n=null;return Fi(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let o=r.parent;!o||o.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(o.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Oy(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function Fa(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function My(e,t,n){let r=null;return Fi(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Fi(e,t){t(e);for(let n of e.namedChildren)Fi(n,t)}var ka=new Set(["delete","get","head","options","patch","post","put"]),By=/(?:^|\.)(?:app|router|server)$/u,jy=new Set(["findFirst","findMany","findUnique","from","get","select"]),Vy=new Set(["create","delete","insert","remove","update","upsert"]),Uy=new Set(["execute","query","raw"]),Li=[qy(),Wy(),Hy(),Ky(),Xy(),Jy(),Zy()],wi=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function Hy(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=zy(e.source),n=[];return me(e.root,r=>{if(r.type!=="call_expression")return;let i=Xt(r);if(!i)return;let o=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),a=s&&t.namespaces.has(s[1])?s[2]:null,c=o??a;if(!c||!wi.has(c))return;let l=rt(r),u=ce(l[0],e)??{value:l[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(c)?"process.exec":"process.spawn";n.push(B(e,r,"builtin.node-child-process",d,[{name:"operation",value:c,evidence:"literal"},{name:"executable",...u}],"exact","node-child-process-import"))}),n}}}function zy(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let c of e.matchAll(i))for(let l of(c[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(l);u&&wi.has(u[1])&&t.set(u[2]??u[1],u[1])}let o=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let c of e.matchAll(o))for(let l of(c[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(l);u&&wi.has(u[1])&&t.set(u[2]??u[1],u[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let c of e.matchAll(s))n.add(c[1]);let a=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let c of e.matchAll(a))n.add(c[1]);return{direct:t,namespaces:n}}function j(e,t){let n=R(e,t)?.rootNode;if(!n)return null;let r=x(e,t),i=T(e,t),o=A(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:ih(n),ownerAt:s=>{let a=i.filter(l=>l.startLine<=s&&l.endLine>=s).sort((l,u)=>l.endLine-l.startLine-(u.endLine-u.startLine)||l.startLine-u.startLine)[0];if(a)return{file:t,symbol:a.symbol,name:a.leaf,startLine:a.startLine,endLine:a.endLine};let c=o.filter(l=>l.startLine<=s&&l.endLine>=s).sort((l,u)=>l.endLine-l.startLine-(u.endLine-u.startLine)||l.startLine-u.startLine)[0];return{file:t,symbol:null,name:c?.name??null,startLine:c?.startLine??s,endLine:c?.endLine??s}}}}function Wy(){return{id:"builtin.effect-httpapi",supports:e=>Kt(e,"HttpApiEndpoint").size>0||Kt(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=Kt(e.source,"HttpApiEndpoint"),r=Kt(e.source,"HttpApiGroup"),i=Kt(e.source,"HttpApiBuilder");return me(e.root,o=>{if(o.type!=="call_expression")return;let s=Da(o);if(!s)return;let a=rt(o);if(n.has(s.receiver)&&ka.has(s.member)){let g=ce(a[0],e),y=ce(a[1],e),S=wa(o,r,"make",0,e);if(!g||!y||!S)return;let b=s.member.toUpperCase();t.push(B(e,o,"builtin.effect-httpapi","http.handle",[{name:"method",value:b,evidence:"literal"},{name:"path",...y}],ve([{name:"path",...y}]),"effect-httpapi-endpoint-declaration")),t.push(B(e,o,"builtin.effect-httpapi","framework.declare",Pi(S,g),ve(Pi(S,g)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let c=wa(o,i,"group",1,e),l=ce(a[0],e),u=a[1];if(!c||!l||!u)return;let d=Pi(c,l),p=_t(e.db,e.file,u.text),f=B(e,o,"builtin.effect-httpapi","framework.handle",d,p.length===1?ve(d):"candidate","effect-httpapi-handler-registration"),m=p[0];p.length===1&&m&&(f.owner={file:m.relativePath,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine}),t.push(f)}),t}}}function Pi(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function Kt(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(r)){let s=o[2]??"";if(Pa(s))for(let a of(o[1]??"").split(",")){let c=a.trim().replace(/^type\s+/u,""),l=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(c);l?.[1]===t&&n.add(l[2]??l[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(i)){let s=o[2]??"";s.endsWith(`/${t}`)&&Pa(s)&&n.add(o[1])}return n}function Pa(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function wa(e,t,n,r,i){let o=e.parent;for(;o;){if(o.type==="call_expression"){let s=La(o,t,n,r,i);if(s)return s;let a=o.childForFieldName("function")??o.namedChild(0),c=null;if(a&&me(a,l=>{!c&&l.type==="call_expression"&&(c=La(l,t,n,r,i))}),c)return c}o=o.parent}return null}function La(e,t,n,r,i){let o=Da(e);return!o||o.member!==n||!t.has(o.receiver)?null:ce(rt(e)[r],i)}function Da(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function qy(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||Gt(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!Gt(e.source,["fastapi","flask"]))return;t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=Xt(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",o=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=rt(n);if(i==="route"&&Gt(e.source,["axum"])){let p=ce(s[0],e),f=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!f)return;t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:f.toUpperCase(),evidence:"literal"},{name:"path",...p}],ve([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=ce(s[0],e);if(!p)return;let m=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),g=[...m?[{name:"method",value:m,evidence:"literal"}]:[],{name:"path",...p}];t.push(B(e,n,"builtin.http","http.request",g,m?ve(g):"candidate","call-expression"));return}if(!ka.has(i))return;let a=ce(s[0],e);if(!a)return;let c=i.toUpperCase();if(By.test(o)&&Gt(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:c,evidence:"literal"},{name:"path",...a}],ve([{name:"path",...a}]),"framework-adapter"));return}let u=th(e.source,["axios"]),d=o.split(".")[0]??"";u.has(d)&&t.push(B(e,n,"builtin.http","http.request",[{name:"method",value:c,evidence:"literal"},{name:"path",...a}],ve([{name:"path",...a}]),"client-adapter"))}),t}}}function Ky(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return me(e.root,r=>{if(r.type==="pair"){let o=r.childForFieldName("key")??r.namedChild(0),s=r.childForFieldName("value")??r.namedChild(1),a=o?.text.replace(/^['"`]|['"`]$/gu,"");if(a!=="name"&&a!=="id")return;let c=Aa(s,e),l=sh(r);if(!c||c.evidence!=="literal"||!l)return;let u=`handle\0${c.value}\0${l.startPosition.row}`;if(n.has(u))return;n.add(u),t.push(B(e,l,"builtin.capability-registry","registry.handle",[{name:"key",...c}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let o of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let s=o[1];if(!Gy(i,s,o.index))continue;let a=`reference\0${s}\0${r.startPosition.row}`;n.has(a)||(n.add(a),t.push(B(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:s,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function Gy(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function Xy(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type==="pair"){let o=oh(n);if(!o)return;let s=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),c=Aa(s,e);if(!c||!a||!Oa(a))return;let l=ki(a)?"exact":"candidate";t.push(B(e,n,"builtin.registry","registry.handle",[{name:"registry",value:o,evidence:"identifier"},{name:"key",...c}],ve([{name:"key",...c}],l),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(B(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Jy(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=ch(e.root);return me(e.root,r=>{if(r.type!=="call_expression")return;let i=Xt(r);if(!i)return;let o=i.split("."),s=o.at(-1)??"",a=rt(r),c=a[0]?.text??"",l=ah(s,c);if(!l)return;let u=Ma(o,n);if(!u)return;let d=Qy(a[0],e)??lh(c),p=uh(u,o,s,d);if(!p)return;let f=s==="insert"?"persistence-insert":l==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(c)?"persistence-skip-locked-claim":"persistence-adapter";t.push(B(e,r,"builtin.persistence",l,[{name:"resource",...p}],ve([{name:"resource",...p}]),f))}),t}}}function Qy(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:ce(e,t)}function Zy(){return{id:"builtin.queue",supports:e=>Gt(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type!=="call_expression")return;let r=Xt(n);if(!r)return;let i=r.split(".").at(-1)??"",o=rt(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let a=i==="send"||i==="subscribe"?nh(o[0],"topic",e):ce(o[0],e);a&&t.push(B(e,n,"builtin.queue",s,[{name:"address",...a}],ve([{name:"address",...a}]),"framework-adapter"))}),t}}}function B(e,t,n,r,i,o,s){let a=e.ownerAt(t.startPosition.row),c=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${$y("sha256").update(c).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:a,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:o,protocol:r.split(".")[0]??r,role:Yy(r),executionDomain:eh(e.file),derivation:{kind:o==="candidate"?"heuristic":o==="derived"?"mechanically-derived":"direct",rule:s,ruleVersion:"1",inputFactIds:i.flatMap(l=>l.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(l=>l.derivation?.sourceSpans??[])]},valuePrecision:i.some(l=>l.evidence==="expression")?"unknown":i.some(l=>l.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:Jn(e.file)}}function Yy(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function eh(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function Gt(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function th(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let s of e.matchAll(o)){let a=s[1]??s[2];a&&n.add(a)}}return n}function er(e,t,n,r,i,o,s){return B(e,t,n,r,i,o,s)}function Xt(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function rt(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ce(e,t){let n=fe(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function nh(e,t,n){if(!e)return null;let r=e.namedChildren.find(o=>o.type!=="pair"?!1:(o.childForFieldName("key")??o.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return ce(i,n)}function Aa(e,t){if(!e)return null;let n=ce(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function ve(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function rh(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function ih(e){let t=new Map;return me(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let o=rh(i);o!==null&&t.set(r.text,o)}),t}function oh(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function ki(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function Oa(e){return ki(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function sh(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&o&&Oa(o))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function Ma(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function ah(e,t){if(jy.has(e))return"database.read";if(Vy.has(e))return"database.write";if(!Uy.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function ch(e){let t=new Set;return me(e,n=>{if(n.type!=="call_expression")return;let r=Xt(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!Ma(i)))for(let o of rt(n)){if(!ki(o))continue;let a=(o.childForFieldName("parameters")??o.namedChildren.find(l=>/parameters/u.test(l.type)))?.namedChildren[0],c=a?$a(a):null;c&&t.add(c)}}),t}function $a(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?$a(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function lh(e){let t=Ba(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function uh(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let o=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return o?{value:o,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=Ba(r.value);return i?{value:i,evidence:r.evidence}:null}function Ba(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function me(e,t){t(e);for(let n of e.namedChildren)me(n,t)}var dh=v("resolved-call-syntax",{clearGroups:[]}),ph=v("resolved-call-sites",{clearGroups:[]});function Jt(e,t){return ph.get(e,t.symbolId,()=>fh(e,t))}function fh(e,t){let n=[],r=[],i=new Set,o=new Set;for(let s of hi(e,t,{semantic:!1})){i.add(s.file);let a=dh.get(e,s.file,()=>mh(e,s.file));if(!a){r.push({callee:t,file:s.file,line:s.line,reason:"ast-unavailable",candidates:0,referenceProvenance:s.provenance});continue}let c=(a.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=s.line&&d.endPosition.row>=s.line);if(c.length!==1){r.push({callee:t,file:s.file,line:s.line,reason:c.length===0?"call-not-found":"ambiguous-call",candidates:c.length,referenceProvenance:s.provenance});continue}let l=c[0],u=`${s.file}\0${l.callNode.startIndex}\0${l.callNode.endIndex}`;o.has(u)||(o.add(u),n.push({callee:t,caller:Nt(T(e,s.file),l.callNode.startPosition.row),file:s.file,line:s.line,startLine:l.callNode.startPosition.row,endLine:l.callNode.endPosition.row,targetText:l.targetNode.text,callNode:l.callNode,targetNode:l.targetNode,arguments:l.arguments,referenceProvenance:s.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function mh(e,t){let n=R(e,t)?.rootNode;if(!n)return null;let r=new Map;return ja(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let o=i.childForFieldName("function")??i.namedChild(0);if(!o)return;let s=Ce(o);if(!s)return;let a=i.childForFieldName("arguments")??i.namedChildren.find(u=>u.type==="arguments"),c={callNode:i,targetNode:o,arguments:a?.namedChildren??[]},l=r.get(s);l?l.push(c):r.set(s,[c])}),{byLeaf:r}}function ja(e,t){t(e);for(let n of e.namedChildren)ja(n,t)}var gh=v("call-parameter-value-flow",{clearGroups:[]});function Qt(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return gh.get(e,n,()=>yh(e,t))}function Zt(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function yh(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((c,l)=>({calleePosition:l,argumentText:c.text.trim(),reason:"caller-unavailable",proof:n}))};let r=R(e,t.caller.relativePath)?.rootNode,i=r?hh(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((c,l)=>({calleePosition:l,argumentText:c.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let o=Sh(i),s=[],a=[];return t.arguments.forEach((c,l)=>{let u=c.text.trim(),d=o.indexOf(u);d>=0?s.push({calleePosition:l,callerPosition:d,argumentText:u,proof:n}):a.push({calleePosition:l,argumentText:u,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:a}}function hh(e,t,n){let r=null;return Ua(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Sh(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Va)??[]}function Va(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Va(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Ua(e,t){t(e);for(let n of e.namedChildren)Ua(n,t)}var bh=8,xh=8;function za(e,t){let n=[],r=vh(e,n),i=r.summaries,o=Nh(e,t,i,n),s=Eh(e,t,n);return{observations:Dh([...o.observations,...s]),bodySummaries:i.size,discriminatorSummaries:o.summaries,filesInspected:r.filesInspected,errors:n}}function vh(e,t){let n=new Map,r=[],i=z(e);for(let o of i){let s=x(e,o);if(!/\bJSON\.stringify\s*\(/u.test(s)||!/\bbody\s*:/u.test(s))continue;let a=j(e,o);if(a)for(let[c,l]of Ih(a)){let u={definition:c,parameterIndexes:l,depth:0,proofSpans:[{file:o,startLine:c.startLine,endLine:c.endLine}]};n.set(c.symbol,u),r.push(u)}}for(;r.length>0;){let o=r.shift();if(!(o.depth>=bh))try{for(let s of Jt(e,o.definition).sites){if(!j(e,s.file))continue;let c=s.caller;if(!c)continue;let l=Zt(Qt(e,s),o.parameterIndexes);if(l.length===0)continue;let u={definition:c,parameterIndexes:Qa(l),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:s.file,startLine:s.startLine,endLine:s.endLine}]};Th(n,u)&&r.push(n.get(c.symbol))}}catch(s){t.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${Mi(s)}`)}}return{summaries:n,filesInspected:i.length}}function Nh(e,t,n,r){let i=new Map,o=[],s=[];for(let a of t){if(a.action!=="http.request"||a.strength==="candidate"||a.sourceScope!=="production")continue;let c=Wa(a);if(!c)continue;let l=j(e,a.source.file);if(!l)continue;let u=Ga(l.root,a.source.startLine),d=u.find(b=>b.startPosition.row===a.source.startLine)??u[0];if(!d)continue;let p=Oi(d);if(!p)continue;let f=_t(e,a.source.file,p.text);if(f.length!==1)continue;let m=n.get(f[0].symbol);if(!m)continue;let g=a.owner.symbol?T(e,a.owner.file).find(b=>b.symbol===a.owner.symbol):null;if(!g)continue;let y=Fh(l,g),S=nr(d);for(let b of m.parameterIndexes){let N=wh(l,S[b]);if(N)for(let E of Lh(N)){let _=Xa(E),h=Ja(E);if(!_||!h)continue;let I=y.indexOf(h.text.trim());if(I>=0){let k={definition:g,carrier:c,field:_,parameterIndex:I,depth:0,proofObservationIds:[a.id],proofSpans:[a.source,{file:a.source.file,startLine:E.startPosition.row,endLine:E.endPosition.row}]},$=Ha(k);i.has($)||(i.set($,k),o.push(k));continue}let C=fe(l,h);!C||C.evidence==="expression"||s.push(Ai(l,E,"carrier.publish",c,_,C.value,[a.id]))}}}for(;o.length>0;){let a=o.shift();if(!(a.depth>=xh))try{for(let c of Jt(e,a.definition).sites){let l=j(e,c.file);if(!l)continue;let u=c.callNode,d=nr(u)[a.parameterIndex];if(!d)continue;let p=fe(l,d);p&&p.evidence!=="expression"&&s.push(Ai(l,u,"carrier.publish",a.carrier,a.field,p.value,a.proofObservationIds));let f=c.caller;if(!f)continue;let m=Qt(e,c).transfers.find(S=>S.calleePosition===a.parameterIndex)?.callerPosition;if(m===void 0)continue;let g={...a,definition:f,parameterIndex:m,depth:a.depth+1,proofSpans:[...a.proofSpans,{file:c.file,startLine:c.startLine,endLine:c.endLine}]},y=Ha(g);i.has(y)||(i.set(y,g),o.push(g))}}catch(c){r.push(`builtin.carrier discriminator summary failed for ${a.definition.relativePath}: ${Mi(c)}`)}}return{observations:s,summaries:i.size}}function Eh(e,t,n){let r=[],i=t.filter(o=>o.action==="registry.handle"&&o.strength!=="candidate"&&o.sourceScope==="production");for(let o of t){if(o.action!=="http.handle"||o.strength==="candidate"||o.sourceScope!=="production")continue;let s=Wa(o);if(!s)continue;let a=j(e,o.source.file);if(!a)continue;let c=Ga(a.root,o.source.startLine)[0];if(c)for(let l of nr(c).slice(1)){let u=_t(e,o.source.file,l.text);for(let d of u)try{let p=j(e,d.relativePath);if(!p)continue;let f=tr(p.root,d.startLine,d.endLine);if(!f)continue;He(f,m=>{if(m.type!=="call_expression")return;let g=Oi(m);if(!g)return;let y=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(g.text.trim());if(!y)return;let S=y[1],b=y[2],N=_h(e,p,d,b);if(!N)return;let E=Rh(e,d.relativePath,S);for(let _ of i){let h=_.keyParts.find($=>$.name==="registry")?.value,I=_.keyParts.find($=>$.name==="key")?.value;if(!h||!I||!E.some($=>$.file===_.source.file&&$.binding===h))continue;let C=j(e,_.source.file),k=C?Ph(C.root,_.source.startLine):null;!C||!k||r.push(Ai(C,k,"carrier.consume",s,N,I,[o.id,_.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Mi(p)}`)}}}return r}function Ih(e){let t=T(e.db,e.file),n=new Map;return He(e.root,r=>{if(r.type!=="pair"||Xa(r)?.toLowerCase()!=="body")return;let i=Ja(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let o=Nt(t,r.startPosition.row),s=Ch(r);if(!o||!s)return;let a=qa(s),c=new Set;kh(i,a,c);let l=n.get(o.symbol)??new Set;a.forEach((u,d)=>{u&&c.has(u)&&l.add(d)}),l.size>0&&n.set(o.symbol,l)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((o,s)=>o-s)]]:[]})}function Ch(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function _h(e,t,n,r){let i=tr(t.root,n.startLine,n.endLine);if(!i)return null;let o=new RegExp(`\\.body\\??\\.${Di(r)}\\b`,"u");if(o.test(i.text))return r;let s=null;if(He(i,u=>{if(s||u.type!=="variable_declarator")return;let d=u.childForFieldName("name")??u.namedChild(0),p=u.childForFieldName("value")??u.namedChild(1);!d||!p||!new RegExp(`(?:^|[,{}])\\s*${Di(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||p.type==="call_expression"&&(s=Oi(p)?.text??null)}),!s)return null;let a=_t(e,n.relativePath,s);if(a.length!==1)return null;let c=j(e,a[0].relativePath),l=c?tr(c.root,a[0].startLine,a[0].endLine):null;return l&&o.test(l.text)&&new RegExp(`\\b${Di(r)}\\s*[,}]`,"u").test(l.text)?r:null}function Rh(e,t,n){let r=[];for(let i of _i(e,t,n)){let o=Yt(i.initializer);if(o.type==="call_expression")for(let s of nr(o)){let a=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(a))for(let c of _i(e,i.definition.relativePath,a))r.push({file:c.definition.relativePath,binding:c.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Ai(e,t,n,r,i,o,s){let c=er(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:o,evidence:"constant",term:{kind:"literal",value:o}}],"derived","http-body-registry-discriminator");return c.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...s],sourceSpans:[c.source]},c}function Wa(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Th(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Qa([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function Ha(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function Fh(e,t){let n=tr(e.root,t.startLine,t.endLine);return n?qa(n):[]}function qa(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Ka)??[]}function Ka(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Ka(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function tr(e,t,n){let r=null;return He(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Ph(e,t){let n=null;return He(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function Ga(e,t){let n=[];return He(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Oi(e){return e.childForFieldName("function")??e.namedChild(0)}function nr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function wh(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return Yt(t);let r=null;return He(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),Yt(r||t)}function Lh(e){let t=Yt(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function Xa(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ja(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function Yt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function kh(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Qa(e){return[...new Set(e)].sort((t,n)=>t-n)}function Dh(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Di(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Mi(e){return e instanceof Error?e.message:String(e)}function He(e,t){t(e);for(let n of e.namedChildren)He(n,t)}import{createHash as Ah}from"crypto";function Za(e,t){let n=new Map;for(let o of t){if(o.action!=="http.handle"||o.sourceScope!=="production")continue;let s=n.get(o.source.file)??[];s.push(o),n.set(o.source.file,s)}let r=[],i=Oh(e);for(let o of i.mounts)for(let s of o.targetFiles)for(let a of n.get(s)??[]){let c=a.keyParts.find(p=>p.name==="path");if(!c||c.evidence==="expression")continue;let l=$h(o.prefix.value,c.value),u=a.keyParts.map(p=>p.name==="path"?{name:"path",value:l,evidence:"constant",term:{kind:"concat",parts:[o.prefix.term??{kind:"literal",value:o.prefix.value},c.term??{kind:"literal",value:c.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[a.id],sourceSpans:[a.source,{file:o.file,startLine:o.line,endLine:o.line},...o.prefix.derivation?.sourceSpans??[],...c.derivation?.sourceSpans??[]]}}:p),d=`${a.id}\0${o.file}\0${o.line}\0${l}`;r.push({...a,id:`boundary:${Ah("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:u,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[a.id],sourceSpans:[a.source,{file:o.file,startLine:o.line,endLine:o.line}]},resolution:"unresolved"}),a.strength="candidate",a.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function Oh(e){let t=[],n=z(e);for(let r of n){let i=x(e,r);if(!Bh(i))continue;let o=j(e,r);o&&Ya(o.root,s=>{if(s.type!=="call_expression")return;let a=s.childForFieldName("function")??s.namedChild(0);if(!a||!/\.use$/u.test(a.text.replace(/\s+/gu,"")))return;let c=jh(s);if(c.length<2)return;let l=fe(o,c[0]);if(!l||l.evidence==="expression")return;let u=Mh(e,r,c[1]);u.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:l.value,evidence:l.evidence,term:l.term,derivation:l.derivation},targetFiles:u})})}return{mounts:t,filesInspected:n.length}}function Mh(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let o=M(e,t).find(c=>c.localName===i&&c.sourcePath);if(!o?.sourcePath)return[t];if(o.kind==="namespace")return[o.sourcePath];let s=o.importedName==="default"?i:o.importedName,a=nt(e,o.sourcePath,s);return[...new Set(a.map(c=>c.relativePath))]}function $h(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function Bh(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function jh(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Ya(e,t){t(e);for(let n of e.namedChildren)Ya(n,t)}import{createHash as Vh}from"crypto";var $i=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),Uh=8;function nc(e,t){let n=new Map,r=[],i=[],o=new Set,s=[],a=[];for(let c of t){if(c.action!=="http.request"||!c.owner.symbol||c.evidence!=="call-expression"&&c.evidence!=="client-adapter")continue;let l=T(e,c.owner.file).find(f=>f.symbol===c.owner.symbol);if(!l)continue;let u=j(e,l.relativePath);if(!u)continue;let d=ec(u,l),p={definition:l,...d,constantMethods:c.keyParts.flatMap(f=>f.name==="method"&&f.evidence!=="expression"&&$i.has(f.value.toUpperCase())?[f.value.toUpperCase()]:[]),depth:0,proofObservationIds:[c.id],proofSpans:[c.source]};tc(n,p)&&r.push(n.get(l.symbol))}for(;r.length>0;){let c=r.shift();if(!(c.depth>=Uh))try{let l=Jt(e,c.definition);a.push(...l.unresolved.map(u=>Hh(c,u)));for(let u of l.sites){let d=j(e,u.file);if(!d)continue;o.add(u.file);let p=u.callNode,f=Wh(c,p,d);f&&i.push(f);let m=u.caller;if(!m)continue;let g=ec(d,m),y=qh(e,c,u),S={definition:m,pathParameterIndexes:rr([...g.pathParameterIndexes,...y.pathParameterIndexes]),methodParameterIndexes:rr([...g.methodParameterIndexes,...y.methodParameterIndexes]),constantMethods:Tt([...c.constantMethods,...g.constantMethods]),depth:c.depth+1,proofObservationIds:Tt([...c.proofObservationIds,...f?[f.id]:[]]),proofSpans:[...c.proofSpans,{file:u.file,startLine:u.startLine,endLine:u.endLine}]};tc(n,S)&&r.push(n.get(m.symbol))}}catch(l){s.push(`builtin.http-summary failed for ${c.definition.relativePath}:${c.definition.startLine+1}: ${l instanceof Error?l.message:String(l)}`)}}return{observations:i,frontiers:zh(a),summaries:n.size,filesInspected:o.size,errors:s}}function Hh(e,t){let n=Tt([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${Vh("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:Jn(t.file)}}function zh(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function Wh(e,t,n){let r=ic(t),i=e.pathParameterIndexes.flatMap(d=>{let p=fe(n,r[d]);return p&&p.evidence!=="expression"&&Jh(p.value)?[{index:d,value:p}]:[]}),o=e.methodParameterIndexes.flatMap(d=>{let p=fe(n,r[d]),f=p?.value.toUpperCase();return p&&f&&p.evidence!=="expression"&&$i.has(f)?[{index:d,value:{...p,value:f}}]:[]}),s=Tt([...e.constantMethods,...o.map(d=>d.value.value)]);if(i.length!==1||s.length!==1)return null;let a=i[0].value,c=o.find(d=>d.value.value===s[0])?.value,l=[{name:"method",value:s[0],evidence:c?"constant":"literal",term:c?.term??{kind:"literal",value:s[0]},derivation:c?.derivation},{name:"path",value:a.value,evidence:"constant",term:a.term,derivation:a.derivation}],u=er(n,t,"builtin.http-summary","http.request",l,"derived","compiler-resolved-http-summary");return u.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,u.source]},u}function ec(e,t){let n=Xh(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=Gh(n),i=new Set,o=new Set,s=new Set;return Bi(n,a=>{if(a.type==="call_expression"&&((a.childForFieldName("function")??a.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let f=ic(a);en(f[0],r,i);let m=Kh(f[1],"method");if(m){en(m,r,o);let g=fe(e,m),y=g?.value.toUpperCase();y&&g?.evidence!=="expression"&&$i.has(y)&&s.add(y)}else en(f[1],r,o)}if(a.type!=="pair")return;let c=a.childForFieldName("key")??a.namedChild(0),l=a.childForFieldName("value")??a.namedChild(1),u=c?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(u==="url"||u==="path"||u==="endpoint")&&en(l,r,i),(u==="init"||u==="requestinit"||u==="options")&&en(l,r,o)}),{pathParameterIndexes:r.flatMap((a,c)=>a&&i.has(a)?[c]:[]),methodParameterIndexes:r.flatMap((a,c)=>a&&o.has(a)?[c]:[]),constantMethods:[...s].sort()}}function qh(e,t,n){let r=Qt(e,n);return{pathParameterIndexes:Zt(r,t.pathParameterIndexes),methodParameterIndexes:Zt(r,t.methodParameterIndexes)}}function tc(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=rr([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=rr([...n.methodParameterIndexes,...t.methodParameterIndexes]),o=Tt([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||o.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:o,depth:Math.min(n.depth,t.depth),proofObservationIds:Tt([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Kh(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function en(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Gh(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(rc)??[]}function rc(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?rc(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Xh(e,t,n){let r=null;return Bi(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function ic(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Jh(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function rr(e){return[...new Set(e)].sort((t,n)=>t-n)}function Tt(e){return[...new Set(e)].sort()}function Bi(e,t){t(e);for(let n of e.namedChildren)Bi(n,t)}import{createHash as Qh}from"crypto";function ac(e){let t=oc(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=oc(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?ji(r).flatMap(i=>{let o=t.get(i)?.[0];return o?[sc(r,o,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?ji(r).flatMap(i=>{let o=n.get(i)?.[0];return o?[sc(r,o,i,"queue.consume")]:[]}):[])}function oc(e){let t=new Map;for(let n of e)for(let r of ji(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function ji(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function sc(e,t,n,r){let i=`database:${n}`,o=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,o].join("\0");return{...e,id:`boundary:${Qh("sha256").update(s).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:o,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var Vi="runtime-boundaries-v15",sr=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],Zh=64;function Yh(e,t={}){let n=z(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(rS)),o=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===Vi&&o!==void 0&&o.length===t.previousGraph.coverage.filesScanned,a=s?o.filter(P=>r.has(P.file)&&!i.has(P.file)):[],c=new Set(a.flatMap(P=>P.observationIds)),l=s?t.previousGraph.observations.filter(P=>c.has(P.id)&&r.has(P.source.file)):[],u=s?n.filter(P=>i.has(P)):n,d=[],p=o?.reduce((P,dr)=>P+dr.observationIds.length,0)??0,f=performance.now(),m=eS(e,u);it(d,"direct-extraction",f,u.length,m.observations.length,{filesVisited:u.length,filesReused:a.length,factsReused:l.length,factsInvalidated:Math.max(0,p-l.length)});let g=[...a,...m.fileCoverage].sort((P,dr)=>P.file.localeCompare(dr.file)),y=nS(g),S=g.flatMap(P=>P.extractionErrors),b=tn([...l,...m.observations]),N=tn([...b,...ac(b)]);f=performance.now();let E=nc(e,N);it(d,"http-summary",f,N.length,E.observations.length,{filesVisited:E.filesInspected}),y.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:E.filesInspected,observations:E.observations.length,errors:E.errors.length}),S.push(...E.errors);let _=tn([...N,...E.observations]);f=performance.now();let h=Za(e,_);it(d,"http-mount",f,_.length,h.observations.length,{filesVisited:h.filesInspected});let I=tn([..._,...h.observations]);f=performance.now();let C=za(e,I);it(d,"carrier",f,I.length,C.observations.length,{filesVisited:C.filesInspected}),y.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:C.bodySummaries,observations:C.observations.length,errors:C.errors.length}),S.push(...C.errors);let k=tn([...I,...C.observations]);f=performance.now();let $=iS(k);it(d,"relations",f,k.length,$.length),f=performance.now();let Hi=sS(k,$);it(d,"links",f,$.length,Hi.length),aS(k,$),f=performance.now();let zi=uS([...cS(k,$),...E.frontiers]);return it(d,"frontiers",f,k.length,zi.length),{schemaVersion:2,extractorVersion:Vi,observations:k,relationGroups:$,links:Hi,frontiers:zi,coverage:{filesScanned:n.length,filesWithAst:g.filter(P=>P.hasAst).length,filesWithoutAst:g.filter(P=>!P.hasAst).length,...s?{filesReused:a.length}:{},extractors:[...y.values()],extractionErrors:S,phases:d},fileCoverage:g}}function it(e,t,n,r,i,o={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...o})}function eS(e,t){let n=[],r=[];for(let i of t){let o=x(e,i),s=Li.filter(l=>l.supports(o)),a=s.length>0?j(e,i):null,c={file:i,hasAst:a!==null||tS(i,o),observationIds:[],extractors:[],extractionErrors:[]};if(a)for(let l of s){let u={id:l.id,applicableFiles:1,observations:0,errors:0};try{let d=l.extract(a);u.observations=d.length,n.push(...d),c.observationIds.push(...d.map(p=>p.id))}catch(d){u.errors=1,c.extractionErrors.push(`${l.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}c.extractors.push(u)}r.push(c)}return{observations:n,fileCoverage:r}}function tS(e,t){return t?Se(e)?/<script\b/iu.test(t):H(e)!==null:!1}function nS(e){let t=new Map(Li.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function rS(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function iS(e){let t=new Map;for(let n of sr){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let o=dS(i,n.keyNames);if(!o)continue;let s=o.map(d=>`${d.name}=${uc(d.name,d.value)}`).join("\0"),a=i.sourceScope==="production"?"production":i.sourceScope,c=`${n.id}\0${a}\0${s}`,l=`boundary-group:${cc("sha256").update(c).digest("hex").slice(0,16)}`,u=t.get(l)??{id:l,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:o,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&u.producerIds.push(i.id),n.consumerActions.includes(i.action)&&u.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&u.declarationIds.push(i.id),u.derivation.inputFactIds.push(i.id),u.derivation.sourceSpans.push(i.source),t.set(l,u)}}return[...t.values()].map(oS).sort(fS)}function oS(e){return{...e,producerIds:ir(e.producerIds),consumerIds:ir(e.consumerIds),declarationIds:ir(e.declarationIds),derivation:{...e.derivation,inputFactIds:ir(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function sS(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let o=sr.find(a=>a.id===i.joinRule);if(!o?.traversable)continue;let s=o.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(o.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(o.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>Zh))for(let a of s)for(let c of i.consumerIds){let l=n.get(a),u=n.get(c);if(!l||!u||pS(l,u))continue;let d=l.strength==="derived"||u.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${a}\0${c}`,f={id:`boundary-link:${cc("sha256").update(p).digest("hex").slice(0,16)}`,from:a,to:c,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[a,c],sourceSpans:[l.source,u.source]}};r.set(f.id,f)}}return[...r.values()].sort(mS)}function aS(e,t){let n=new Set(t.filter(lc).flatMap(or)),r=new Set(t.filter(lS).flatMap(or));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function cS(e,t){let n=new Set(e.filter(o=>o.strength!=="candidate").map(o=>`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)),r=new Set(t.flatMap(or)),i=new Set(t.filter(lc).flatMap(or));return e.filter(o=>o.sourceScope==="production").filter(o=>o.strength!=="candidate"||!n.has(`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)).filter(o=>!i.has(o.id)).map(o=>{let s=o.keyParts.filter(c=>c.evidence==="expression"||c.value.length===0).map(c=>c.name),a=s.length>0?`${o.extractor} observed ${o.action}, but ${s.join(", ")} remained symbolic or unknown.`:o.resolution==="ambiguous"?`${o.extractor} established the address for ${o.action}, but more than one indexed peer has the same runtime key.`:r.has(o.id)?`${o.extractor} established the address for ${o.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${o.extractor} observed ${o.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:o.id,reason:a,missingKeyParts:s,sourceScope:o.sourceScope}}).sort((o,s)=>o.observationId.localeCompare(s.observationId))}function or(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function lc(e){let t=sr.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function lS(e){let t=sr.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function uS(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function dS(e,t){let n=[];for(let r of t){let i=e.keyParts.find(o=>o.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:uc(r,i.value)})}return n}function uc(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function pS(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function tn(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function ir(e){return[...new Set(e)].sort()}function fS(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function mS(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import gS from"better-sqlite3";var cr="codebaseiq_runtime_boundaries",ot="codebaseiq_runtime_observations",lr="codebaseiq_runtime_relation_groups",ur="codebaseiq_runtime_relation_participants";function yS(e,t){let n=new gS(ct(e));try{n.exec(`
297
+ `,Ag=/scip-python/i;function sa(e,t=process.platform){return t!=="win32"||!Ag.test(e)?[]:["--require",Og()]}function Og(e=kg()){let t=Fg("sha256").update(oa).digest("hex").slice(0,16),n=Dg(e,`codebaseiq-indexer-compat-${t}.cjs`);if(ia(n))return n;let r=`${n}.${process.pid}.tmp`;Lg(r,oa);try{Pg(r,n)}catch{if(wg(r,{force:!0}),!ia(n))throw new Error(`could not materialize indexer compatibility preload at ${n}`)}return n}var ca=$g()==="win32";function nC(e,t=Mg){try{return t(e,["--version"],{stdio:"ignore",timeout:1e4}).status===0}catch{return!1}}function la(e){let t=ca?"where":"which";try{return aa(t,[e],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var jg=/\.(?:c|m)?js$/i,Vg=/\.(?:exe|com)$/i;function rC(e,t){return jg.test(e)?{binary:process.execPath,args:[...sa(e),e,...t]}:{binary:e,args:[...t]}}function Ug(e,t){return aa(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function ua(e,t={}){let n=t.isWindows??ca,r=t.lookup??Ug,i;try{i=r(n?"where":"which",[e])}catch{return null}let o=i.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(!n){let s=o[0];return s?Bg(s):null}return o.find(s=>Vg.test(s))??null}import{execFileSync as pa}from"child_process";import{createHash as Hg}from"crypto";import{existsSync as Un,statSync as zg}from"fs";import{createRequire as Wg}from"module";import{platform as qg}from"os";import{dirname as da,join as Ht}from"path";var Kg=Wg(import.meta.url),mC={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function Si(e){return[e.indexerBinary,...e.binaryAliases??[]]}function Gg(e){let t=Si(e);return t.length===1?t[0]:t.join(" or ")}function bi(e){for(let t of Si(e)){let n=ua(t);if(n)return n}return Jg(e)}function gC(e){return bi(e)!==null||Xg(e)}function Xg(e){return fa(e)!==null}function Jg(e){let t=fa(e);if(!t)return null;let r=JSON.parse(at(t,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return Ht(da(t),r);for(let i of Si(e)){let o=r[i];if(o)return Ht(da(t),o)}return null}function fa(e){if(!e.bundledNpmPackage)return null;try{return Kg.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function Qg(e,t){for(let n of e.projectLocalBinaries??[]){let r=Ht(t,n);if(Un(r))return r}return null}function Zg(e,t){for(let n of e.projectLocalBinaries??[]){let r=Ht(t,n);if(Un(r))return ma(t,n,r)}return null}function yC(e,t){let n=Yg(e,t);if(!n||n.canonicalPath!==t.canonicalPath||n.sha256!==t.sha256||n.size!==t.size||n.mtimeMs!==t.mtimeMs||n.device!==t.device||n.inode!==t.inode||n.executable!==t.executable)throw new Error(`refusing changed project-local indexer ${t.relativePath}; review the current file and rerun with --trust-project-tools`)}function Yg(e,t){try{return ma(e,t.relativePath,t.configuredPath)}catch{return null}}function ma(e,t,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=mr(e,t,r),o=gr(e,t,r),s=zg(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:t,sha256:Hg("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function ey(e,t,n={}){return(n.trustProjectTools?Zg(e,t)?.canonicalPath:null)??bi(e)}function hC(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||xi(n,t))return t;let r=ga(n,t);return r?{...t,DOTNET_ROOT:r}:t}function SC(e,t,n={}){let r=Gg(e),i=t?ey(e,t,n):bi(e);if(!i)return{language:e.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:e.installUrl,...t&&Qg(e,t)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(e.indexerBinary!=="scip-dotnet")return{language:e.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=ty(i);return{language:e.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:e.installUrl,note:o.note}}function ty(e){if(xi(e,process.env))return{runnable:!0};let t=ga(e,process.env);if(t)return{runnable:!0,note:`using .NET 9 runtime from ${t}`};let n=ya(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function ga(e,t){for(let n of ya(t))if(xi(e,{...t,DOTNET_ROOT:n}))return n;return null}function ya(e){let t=[],n=e.DOTNET_ROOT;if(n&&Un(n)&&t.push(n),qg()==="darwin"&&la("brew"))try{let r=pa("brew",["--prefix","dotnet@9"],{stdio:"pipe",windowsHide:!0,env:e,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=Ht(r,"libexec");Un(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function xi(e,t){try{return pa(e,["--version"],{stdio:"pipe",windowsHide:!0,env:t,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var ny=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function Hn(e){let t=e.toLowerCase();return ny.some(n=>t.endsWith(n))}function Wn(e){let t=zn(e.projectFiles),n=new Set(t),r=new Map(e.snapshot.files.map(d=>[d.path,d])),i=e.snapshot.files.filter(d=>{let p=Xi(d.path,["typescript"]);return p==="config"||p==="ambient"}).map(d=>d.path),o=zn([...t,...i]),s=o.find(d=>!r.has(d)),a=new Set(e.snapshot.files.map(d=>d.path)).size!==e.snapshot.files.length,c=!s&&o.some(d=>ha(r.get(d))),l=Ne(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:zn(e.snapshot.typescriptProjects),membership:t})),u=new Map;return{identityFor(d,p){if(!n.has(d))return Ct("target-outside-project");if(a)return Ct("duplicate-input-path");if(s)return Ct("missing-input-fingerprint");if(c)return Ct("unreadable-input");let f=[],m,g;if(e.graph===null)f.push("dependency-graph-unavailable"),g="whole-project",m=o;else{let b=iy(d,e.graph,u);if(b.find(E=>!r.has(E)))return Ct("missing-input-fingerprint");if(m=zn([...b,...i]),m.some(E=>ha(r.get(E))))return Ct("unreadable-input");g="dependency-closure"}let y=m.map(b=>oy(r.get(b)));return{version:1,key:Ne(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:p,projectIdentity:l,inputs:y})),mode:g,inputFiles:m,reasons:f}}}}function ry(e,t){let n=new Set,r=[e];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let s of[...t.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function iy(e,t,n){let r=n.get(e);if(r)return r;let i=ry(e,t);return n.set(e,i),i}function oy(e){return{path:e.path,size:e.size,hash:e.hash}}function ha(e){return e.size<0||e.hash==="unreadable"}function Ct(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function zn(e){return[...new Set(e)].sort()}import{createRequire as sy}from"module";var Sa=sy(import.meta.url),zt,qn;function ay(){if(zt!==void 0)return zt;try{zt=Sa("ts-morph")}catch{zt=null}return zt}function Kn(){if(qn)return qn;let e=ay();if(!e)return"ts-morph:unavailable";let t="unknown";try{t=Sa("ts-morph/package.json").version??"unknown"}catch{}return qn=`ts-morph:${t}:typescript:${e.ts.version}`,qn}function CC(e,t){return t.map(n=>({tsconfigPath:n,project:new e.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function _C(e,t,n){return{language:"typescript",availability:()=>({available:!1,reason:e,tsconfigPath:t,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var cy=ye("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function vi(e,t,n){let r=cy.get(e,()=>ly(e));if(!r)return null;let i=`${n}\0${t}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(t,n);return r.identities.set(i,s),s}function Wt(e){return ee(e,{includeIgnored:!1}).filter(Hn).sort()}function ly(e){try{if(!e.generation.metadataRaw)return null;let t=an(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=Ji(t.metadata.fingerprint);return n?{builder:Wn({projectFiles:Wt(e),snapshot:n,graph:Mn(e),engineIdentity:Kn()}),identities:new Map}:null}catch{return null}}function Gn(e,t){let n=new Map(e.map(i=>[i.symbol,i])),r=new Map(e.map(i=>[i.symbolId,[]]));for(let i of t.values())for(let o of i){let s=n.get(o.targetSymbol);s&&r.get(s.symbolId).push(o.location)}for(let[i,o]of r)r.set(i,uy(o));return r}function va(e,t,n){let r=xa(e,t),i=xa(e,n),o=[...r].filter(d=>!i.has(d)).sort(),s=[...i].filter(d=>!r.has(d)).sort(),a=ba(e,t),c=ba(e,n),l=[...a].filter(d=>!c.has(d)).sort(),u=[...c].filter(d=>!a.has(d)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:l.length===0&&u.length===0,expectedCount:a.size,actualCount:c.size,missing:l,extra:u}}}function ba(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function MC(e,t,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of e)for(let s of t.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,dy(s));return i}function xa(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function uy(e){let t=new Map;for(let n of e)t.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...t.values()].sort(Na)}function dy(e){let t=new Map;for(let n of e){let{location:r}=n;t.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...t.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||Na(n.location,r.location))}function Na(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column}var Ni="typescript-reference-fragment-v3-incomplete-scan",Xn=le({kind:"typescript-reference-fragments",invalidation:X("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:fy});function KC(e,t,n,r=e){let i=Wt(e),o=Wn({projectFiles:i,snapshot:t,graph:Mn(e),engineIdentity:Kn()}),s=[...n].map(([a,c])=>({relativePath:a,contentHash:o.identityFor(a,Ni).key,value:[...c]}));if(s.some(a=>a.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Xn.writeBatch(r,s.map(a=>({...a,contentHash:a.contentHash}))),s.length}function GC(e,t,n,r){let i=t.filter(s=>Hn(s.relativePath));if(i.length===0)return qt("no TypeScript definitions");let o=qt("shadow did not run");return ge("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=qt("TypeScript reference fragment provider is unavailable"),o;let a=Wt(e),c=new Set(a),l=s.referenceFragmentsForFiles(a),u=a.filter(m=>!l.has(m));if(u.length>0)return o=qt(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let d=Gn(i,l),p=va(i,py(n,c),d);if(!p.passed)return o={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...p},o;let f=[];for(let m of a){let g=vi(e,m,Ni);g?.key&&f.push({relativePath:m,contentHash:g.key,value:l.get(m)??[]})}return Xn.writeBatch(e,f),o={state:"passing",files:a.length,keyedFiles:f.length,writtenFiles:f.length,...p},o}catch(s){return o=qt(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function py(e,t){return new Map([...e].map(([n,r])=>[n,r.filter(i=>t.has(i.file))]))}function XC(e,t,n){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,a=0;return ge("typescript.reference-fragments.materialize",()=>{try{let c=Wt(e);i=c.length;let l=new Map,u=new Map,d=[];for(let m of c){let g=vi(e,m,Ni);if(!g?.key)return null;l.set(m,g.key);let y=Xn.read(e,m,g.key);y===null?(s+=1,d.push(m)):(o+=1,u.set(m,y))}if(s===0)return r="hit",{references:Gn(t,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a};let p=n(t[0].relativePath);if(!p.availability().available||!p.referenceFragmentsForFiles)return null;let f=p.referenceFragmentsForFiles(d);if(d.some(m=>!f.has(m)))return null;a=f.size,Xn.writeBatch(e,d.map(m=>({relativePath:m,contentHash:l.get(m),value:f.get(m)??[]})));for(let[m,g]of f)u.set(m,g);return r="computed",{references:Gn(t,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:a}))}function qt(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function fy(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(my)?null:t}catch{return null}}function my(e){if(!e||typeof e!="object")return!1;let t=e,n=t.location;return typeof t.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}function Ea(e){let t=D(e);return gy(t)?"test":yy(t)?"worker":hy(t)?"entry":Sy(t)?"barrel":"source"}function gy(e){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(e)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(e)||/(?:^|\/)spec_[^/]+$/i.test(e)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(e)||/(?:^|\/)[^/]+_tests\.rs$/i.test(e)||/(?:^|\/)tests\.rs$/i.test(e)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(e)||/(?:^|\/)__tests__\//i.test(e)||/(?:^|\/)test\//i.test(e)||/(?:^|\/)tests\//i.test(e)||/(?:^|\/)__fixtures__\//i.test(e)||/(?:^|\/)__mocks__\//i.test(e)||/(?:^|\/)test-support\//i.test(e)||/(?:^|\/)test-utils\//i.test(e)||/(?:^|\/)testing\//i.test(e))}function yy(e){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(e)}function hy(e){let t=e.split("/"),n=t[t.length-1]??e;return n==="cli.ts"||n==="cli.js"||n==="postinstall.ts"||n==="postinstall.js"||n==="main.ts"||n==="main.js"||n==="main.rs"||n==="main.go"||n==="main.py"||n==="build.rs"||n==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(e)||/(?:^|\/)examples\/[^/]+\.rs$/.test(e)||/(?:^|\/)tests\/[^/]+\.rs$/.test(e)||/(?:^|\/)benches\/[^/]+\.rs$/.test(e)?!0:n==="index.ts"||n==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(e)?!0:t.length<=2:!1}function Sy(e){return e==="index.ts"||e==="index.js"||e.endsWith("/index.ts")||e.endsWith("/index.js")||e.endsWith("/mod.rs")||e.endsWith("/__init__.py")}function Jn(e){let t=e.replaceAll("\\","/");return Ea(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}var by=4;function rt(e,t,n,r={}){return Ia(e,t,n,r.maxReexportDepth??by,0,new Set)}function Ia(e,t,n,r,i,o){let s=`${t}\0${n}`;if(o.has(s)||i>r)return[];o.add(s);let a=T(e,t).filter(c=>c.leaf===n);return a.length>0?a:je(e,t).flatMap(c=>c.sourcePath?c.kind==="named"&&!c.names.includes(n)?[]:Ia(e,c.sourcePath,n,r,i+1,new Set(o)):[])}import{createHash as lc}from"crypto";import{createHash as $y}from"crypto";var Qn=8;function _t(e,t,n){return Ri(Ca(e,t,Ci(n),0,new Set))}function _i(e,t,n){return Ei(e,t,n,0,new Set)}function Ca(e,t,n,r,i){if(r>Qn)return[];let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return o?_a(e,t,o[1],o[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?Ra(e,t,n,r,i):[]}function _a(e,t,n,r,i,o){let s=[];for(let a of Ei(e,t,n,i+1,new Set(o))){let c=Iy(a.initializer);for(let l of c.namedChildren){if(l.type==="pair"){let u=l.childForFieldName("key")??l.namedChild(0);if(Cy(u)!==r)continue;let d=l.childForFieldName("value")??l.namedChild(1);d&&s.push(...Ca(e,a.definition.relativePath,Ci(d.text),i+1,new Set(o)));continue}if(/(?:method|function)/u.test(l.type)){if((l.childForFieldName("name")??l.namedChild(0))?.text!==r)continue;let d=Ny(e,a.definition.relativePath,r,l);s.push(...d.length>0?d:[xy(a.definition,r,l)]);continue}if(l.type==="spread_element"){let u=l.namedChild(0);if(!u)continue;for(let d of Ei(e,a.definition.relativePath,Ci(u.text),i+1,new Set(o)))s.push(..._a(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(o)))}}}return Ri(s)}function xy(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function Ei(e,t,n,r,i){return r>Qn||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:Ra(e,t,n,r,i).flatMap(o=>{let s=R(e,o.relativePath)?.rootNode,a=s?Ey(s,o.leaf):null;return a?[{definition:o,initializer:a}]:[]})}function Ra(e,t,n,r,i){if(r>Qn)return[];let o=`${t}\0${n}`;if(i.has(o))return[];i.add(o);let s=T(e,t).filter(l=>l.leaf===n);if(s.length>0)return s;let a=vy(e,t,n);if(a.length>0)return a;let c=M(e,t).find(l=>l.localName===n&&l.sourcePath);if(c?.sourcePath){let l=c.kind==="namespace"||c.importedName==="default"?n:c.importedName;return Ii(e,c.sourcePath,l,r+1,new Set(i))}return Ii(e,t,n,r+1,new Set(i))}function vy(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(A(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ii(e,t,n,r,i){if(r>Qn)return[];let o=T(e,t).filter(s=>s.leaf===n);return o.length>0?o:Ri(je(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:Ii(e,s.sourcePath,n,r+1,new Set(i)):[]))}function Ny(e,t,n,r){return T(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Ey(e,t){let n=null;return Ta(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Iy(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Cy(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ci(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Ri(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function Ta(e,t){t(e);for(let n of e.namedChildren)Ta(n,t)}var _y=8;function fe(e,t){return t?Rt(e,t,0,new Set):null}function Rt(e,t,n,r){if(n>_y)return xe(t,"value-evaluation-depth");let i=Pa(t),o=Ly(i);if(o)return ky(e.file,i,o.term,o.value,o.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let c=i.namedChildren.map(l=>Rt(e,l,n+1,new Set(r)));if(c.length>=2&&c.every(l=>l!==null)){let l={kind:"concat",parts:c.map(d=>d.term)},u=c.map(d=>d.value).join("");return Dy(e.file,i,l,u,c.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",c)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return Py(e,s,i,n,r);let a=Ay(i);return a?wy(e,a.base,a.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Ry(e,i,n,r):xe(i,`unsupported-expression:${i.type}`)}function Ry(e,t,n,r){let o=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=Ty(e,o);if(s.length!==1)return xe(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let a=s[0],c=`${a.relativePath}\0${a.symbol}`;if(r.has(c))return xe(t,"call-return-cycle");let l=R(e.db,a.relativePath)?.rootNode;if(!l)return xe(t,"call-target-unparsed");let u=My(l,a.startLine,a.endLine);if(!u)return xe(t,"call-target-syntax-unavailable");let d=Fy(u);if(!d)return xe(t,"call-return-not-single-expression");let p=new Set(r);p.add(c);let f=Rt({db:e.db,file:a.relativePath,root:l},d,n+1,p);return f?Zn(t,"bounded-call-return",f,a.symbol):xe(t,"call-return-unresolved")}function Ty(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=T(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let o=M(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return o?.sourcePath?rt(e.db,o.sourcePath,o.importedName==="default"?t:o.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=M(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?rt(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Fy(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return Fa(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function Fa(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)Fa(e,r,n)}}function Py(e,t,n,r,i){let o=`${e.file}\0${t}`;if(i.has(o))return xe(n,"value-cycle");i.add(o);let s=Ti(e.root,t);if(s){let m=Rt(e,s,r+1,i);return m?Zn(n,"local-constant",m):xe(n,"non-foldable-local")}let a=M(e.db,e.file).find(m=>m.localName===t&&m.sourcePath);if(!a?.sourcePath)return pe(n,t,"unresolved-identifier");if(a.kind==="namespace")return pe(n,t,"namespace-import-requires-property");let c=a.importedName==="default"?t:a.importedName,l=rt(e.db,a.sourcePath,c);if(l.length!==1)return pe(n,t,l.length===0?"import-definition-missing":"import-definition-ambiguous");let u=l[0],d=R(e.db,u.relativePath)?.rootNode;if(!d)return pe(n,u.symbol,"import-definition-unparsed");let p=Ti(d,u.leaf);if(!p)return pe(n,u.symbol,"import-definition-non-value");let f=Rt({db:e.db,file:u.relativePath,root:d},p,r+1,i);return f?Zn(n,"imported-constant",f,u.symbol):pe(n,u.symbol,"import-value-unresolved")}function wy(e,t,n,r,i,o){let s=M(e.db,e.file).find(f=>f.localName===t&&f.sourcePath),a=e.file,c=t,l;if(s?.sourcePath){s.kind==="namespace"?(c=n[0]??"",n=n.slice(1)):c=s.importedName==="default"?t:s.importedName;let f=rt(e.db,s.sourcePath,c);if(f.length!==1)return pe(r,`${t}.${n.join(".")}`,f.length===0?"member-definition-missing":"member-definition-ambiguous");a=f[0].relativePath,c=f[0].leaf,l=f[0].symbol}let u=a===e.file?e.root:R(e.db,a)?.rootNode;if(!u)return pe(r,l??t,"member-definition-unparsed");let d=Ti(u,c);if(!d)return pe(r,l??t,"member-base-non-value");for(let f of n){let m=Pa(d);if(d=Oy(m,f),!d)return pe(r,l??`${t}.${n.join(".")}`,`member-property-missing:${f}`)}let p=Rt({db:e.db,file:a,root:u},d,i+1,o);return p?Zn(r,"member-constant",p,l):pe(r,l??t,"member-value-unresolved")}function Ly(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],o=0,s=/\$\{([^}]*)\}/gu;for(let a of r.matchAll(s)){let c=a.index??0;c>o&&i.push({kind:"literal",value:r.slice(o,c)}),i.push({kind:"unknown",reason:`template-hole:${a[1]?.trim()||"expression"}`}),o=c+a[0].length}return o<r.length&&i.push({kind:"literal",value:r.slice(o)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function ky(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Yn("direct-literal","direct",e,t)}}function Dy(e,t,n,r,i,o){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Yn("constant-concatenation","mechanically-derived",e,t),inputFactIds:o.flatMap(s=>s.derivation.inputFactIds),sourceSpans:o.flatMap(s=>s.derivation.sourceSpans)}}}function Zn(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function pe(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Yn(n,"heuristic","",e)}}function xe(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Yn(t,"heuristic","",e)}}function Yn(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function Ay(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function Ti(e,t){let n=null;return Fi(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let o=r.parent;!o||o.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(o.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Oy(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function Pa(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function My(e,t,n){let r=null;return Fi(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Fi(e,t){t(e);for(let n of e.namedChildren)Fi(n,t)}var Da=new Set(["delete","get","head","options","patch","post","put"]),By=/(?:^|\.)(?:app|router|server)$/u,jy=new Set(["findFirst","findMany","findUnique","from","get","select"]),Vy=new Set(["create","delete","insert","remove","update","upsert"]),Uy=new Set(["execute","query","raw"]),Li=[qy(),Wy(),Hy(),Ky(),Xy(),Jy(),Zy()],wi=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function Hy(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=zy(e.source),n=[];return me(e.root,r=>{if(r.type!=="call_expression")return;let i=Xt(r);if(!i)return;let o=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),a=s&&t.namespaces.has(s[1])?s[2]:null,c=o??a;if(!c||!wi.has(c))return;let l=it(r),u=ce(l[0],e)??{value:l[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(c)?"process.exec":"process.spawn";n.push(B(e,r,"builtin.node-child-process",d,[{name:"operation",value:c,evidence:"literal"},{name:"executable",...u}],"exact","node-child-process-import"))}),n}}}function zy(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let c of e.matchAll(i))for(let l of(c[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(l);u&&wi.has(u[1])&&t.set(u[2]??u[1],u[1])}let o=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let c of e.matchAll(o))for(let l of(c[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(l);u&&wi.has(u[1])&&t.set(u[2]??u[1],u[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let c of e.matchAll(s))n.add(c[1]);let a=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let c of e.matchAll(a))n.add(c[1]);return{direct:t,namespaces:n}}function j(e,t){let n=R(e,t)?.rootNode;if(!n)return null;let r=x(e,t),i=T(e,t),o=A(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:ih(n),ownerAt:s=>{let a=i.filter(l=>l.startLine<=s&&l.endLine>=s).sort((l,u)=>l.endLine-l.startLine-(u.endLine-u.startLine)||l.startLine-u.startLine)[0];if(a)return{file:t,symbol:a.symbol,name:a.leaf,startLine:a.startLine,endLine:a.endLine};let c=o.filter(l=>l.startLine<=s&&l.endLine>=s).sort((l,u)=>l.endLine-l.startLine-(u.endLine-u.startLine)||l.startLine-u.startLine)[0];return{file:t,symbol:null,name:c?.name??null,startLine:c?.startLine??s,endLine:c?.endLine??s}}}}function Wy(){return{id:"builtin.effect-httpapi",supports:e=>Kt(e,"HttpApiEndpoint").size>0||Kt(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=Kt(e.source,"HttpApiEndpoint"),r=Kt(e.source,"HttpApiGroup"),i=Kt(e.source,"HttpApiBuilder");return me(e.root,o=>{if(o.type!=="call_expression")return;let s=Aa(o);if(!s)return;let a=it(o);if(n.has(s.receiver)&&Da.has(s.member)){let g=ce(a[0],e),y=ce(a[1],e),S=La(o,r,"make",0,e);if(!g||!y||!S)return;let b=s.member.toUpperCase();t.push(B(e,o,"builtin.effect-httpapi","http.handle",[{name:"method",value:b,evidence:"literal"},{name:"path",...y}],ve([{name:"path",...y}]),"effect-httpapi-endpoint-declaration")),t.push(B(e,o,"builtin.effect-httpapi","framework.declare",Pi(S,g),ve(Pi(S,g)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let c=La(o,i,"group",1,e),l=ce(a[0],e),u=a[1];if(!c||!l||!u)return;let d=Pi(c,l),p=_t(e.db,e.file,u.text),f=B(e,o,"builtin.effect-httpapi","framework.handle",d,p.length===1?ve(d):"candidate","effect-httpapi-handler-registration"),m=p[0];p.length===1&&m&&(f.owner={file:m.relativePath,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine}),t.push(f)}),t}}}function Pi(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function Kt(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(r)){let s=o[2]??"";if(wa(s))for(let a of(o[1]??"").split(",")){let c=a.trim().replace(/^type\s+/u,""),l=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(c);l?.[1]===t&&n.add(l[2]??l[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(i)){let s=o[2]??"";s.endsWith(`/${t}`)&&wa(s)&&n.add(o[1])}return n}function wa(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function La(e,t,n,r,i){let o=e.parent;for(;o;){if(o.type==="call_expression"){let s=ka(o,t,n,r,i);if(s)return s;let a=o.childForFieldName("function")??o.namedChild(0),c=null;if(a&&me(a,l=>{!c&&l.type==="call_expression"&&(c=ka(l,t,n,r,i))}),c)return c}o=o.parent}return null}function ka(e,t,n,r,i){let o=Aa(e);return!o||o.member!==n||!t.has(o.receiver)?null:ce(it(e)[r],i)}function Aa(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function qy(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||Gt(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!Gt(e.source,["fastapi","flask"]))return;t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=Xt(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",o=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=it(n);if(i==="route"&&Gt(e.source,["axum"])){let p=ce(s[0],e),f=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!f)return;t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:f.toUpperCase(),evidence:"literal"},{name:"path",...p}],ve([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=ce(s[0],e);if(!p)return;let m=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),g=[...m?[{name:"method",value:m,evidence:"literal"}]:[],{name:"path",...p}];t.push(B(e,n,"builtin.http","http.request",g,m?ve(g):"candidate","call-expression"));return}if(!Da.has(i))return;let a=ce(s[0],e);if(!a)return;let c=i.toUpperCase();if(By.test(o)&&Gt(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:c,evidence:"literal"},{name:"path",...a}],ve([{name:"path",...a}]),"framework-adapter"));return}let u=th(e.source,["axios"]),d=o.split(".")[0]??"";u.has(d)&&t.push(B(e,n,"builtin.http","http.request",[{name:"method",value:c,evidence:"literal"},{name:"path",...a}],ve([{name:"path",...a}]),"client-adapter"))}),t}}}function Ky(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return me(e.root,r=>{if(r.type==="pair"){let o=r.childForFieldName("key")??r.namedChild(0),s=r.childForFieldName("value")??r.namedChild(1),a=o?.text.replace(/^['"`]|['"`]$/gu,"");if(a!=="name"&&a!=="id")return;let c=Oa(s,e),l=sh(r);if(!c||c.evidence!=="literal"||!l)return;let u=`handle\0${c.value}\0${l.startPosition.row}`;if(n.has(u))return;n.add(u),t.push(B(e,l,"builtin.capability-registry","registry.handle",[{name:"key",...c}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let o of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let s=o[1];if(!Gy(i,s,o.index))continue;let a=`reference\0${s}\0${r.startPosition.row}`;n.has(a)||(n.add(a),t.push(B(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:s,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function Gy(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function Xy(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type==="pair"){let o=oh(n);if(!o)return;let s=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),c=Oa(s,e);if(!c||!a||!Ma(a))return;let l=ki(a)?"exact":"candidate";t.push(B(e,n,"builtin.registry","registry.handle",[{name:"registry",value:o,evidence:"identifier"},{name:"key",...c}],ve([{name:"key",...c}],l),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(B(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Jy(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=ch(e.root);return me(e.root,r=>{if(r.type!=="call_expression")return;let i=Xt(r);if(!i)return;let o=i.split("."),s=o.at(-1)??"",a=it(r),c=a[0]?.text??"",l=ah(s,c);if(!l)return;let u=$a(o,n);if(!u)return;let d=Qy(a[0],e)??lh(c),p=uh(u,o,s,d);if(!p)return;let f=s==="insert"?"persistence-insert":l==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(c)?"persistence-skip-locked-claim":"persistence-adapter";t.push(B(e,r,"builtin.persistence",l,[{name:"resource",...p}],ve([{name:"resource",...p}]),f))}),t}}}function Qy(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:ce(e,t)}function Zy(){return{id:"builtin.queue",supports:e=>Gt(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type!=="call_expression")return;let r=Xt(n);if(!r)return;let i=r.split(".").at(-1)??"",o=it(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let a=i==="send"||i==="subscribe"?nh(o[0],"topic",e):ce(o[0],e);a&&t.push(B(e,n,"builtin.queue",s,[{name:"address",...a}],ve([{name:"address",...a}]),"framework-adapter"))}),t}}}function B(e,t,n,r,i,o,s){let a=e.ownerAt(t.startPosition.row),c=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${$y("sha256").update(c).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:a,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:o,protocol:r.split(".")[0]??r,role:Yy(r),executionDomain:eh(e.file),derivation:{kind:o==="candidate"?"heuristic":o==="derived"?"mechanically-derived":"direct",rule:s,ruleVersion:"1",inputFactIds:i.flatMap(l=>l.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(l=>l.derivation?.sourceSpans??[])]},valuePrecision:i.some(l=>l.evidence==="expression")?"unknown":i.some(l=>l.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:Jn(e.file)}}function Yy(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function eh(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function Gt(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function th(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let s of e.matchAll(o)){let a=s[1]??s[2];a&&n.add(a)}}return n}function er(e,t,n,r,i,o,s){return B(e,t,n,r,i,o,s)}function Xt(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function it(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ce(e,t){let n=fe(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function nh(e,t,n){if(!e)return null;let r=e.namedChildren.find(o=>o.type!=="pair"?!1:(o.childForFieldName("key")??o.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return ce(i,n)}function Oa(e,t){if(!e)return null;let n=ce(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function ve(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function rh(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function ih(e){let t=new Map;return me(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let o=rh(i);o!==null&&t.set(r.text,o)}),t}function oh(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function ki(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function Ma(e){return ki(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function sh(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&o&&Ma(o))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function $a(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function ah(e,t){if(jy.has(e))return"database.read";if(Vy.has(e))return"database.write";if(!Uy.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function ch(e){let t=new Set;return me(e,n=>{if(n.type!=="call_expression")return;let r=Xt(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!$a(i)))for(let o of it(n)){if(!ki(o))continue;let a=(o.childForFieldName("parameters")??o.namedChildren.find(l=>/parameters/u.test(l.type)))?.namedChildren[0],c=a?Ba(a):null;c&&t.add(c)}}),t}function Ba(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Ba(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function lh(e){let t=ja(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function uh(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let o=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return o?{value:o,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=ja(r.value);return i?{value:i,evidence:r.evidence}:null}function ja(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function me(e,t){t(e);for(let n of e.namedChildren)me(n,t)}var dh=v("resolved-call-syntax",{clearGroups:[]}),ph=v("resolved-call-sites",{clearGroups:[]});function Jt(e,t){return ph.get(e,t.symbolId,()=>fh(e,t))}function fh(e,t){let n=[],r=[],i=new Set,o=new Set;for(let s of hi(e,t,{semantic:!1})){i.add(s.file);let a=dh.get(e,s.file,()=>mh(e,s.file));if(!a){r.push({callee:t,file:s.file,line:s.line,reason:"ast-unavailable",candidates:0,referenceProvenance:s.provenance});continue}let c=(a.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=s.line&&d.endPosition.row>=s.line);if(c.length!==1){r.push({callee:t,file:s.file,line:s.line,reason:c.length===0?"call-not-found":"ambiguous-call",candidates:c.length,referenceProvenance:s.provenance});continue}let l=c[0],u=`${s.file}\0${l.callNode.startIndex}\0${l.callNode.endIndex}`;o.has(u)||(o.add(u),n.push({callee:t,caller:Nt(T(e,s.file),l.callNode.startPosition.row),file:s.file,line:s.line,startLine:l.callNode.startPosition.row,endLine:l.callNode.endPosition.row,targetText:l.targetNode.text,callNode:l.callNode,targetNode:l.targetNode,arguments:l.arguments,referenceProvenance:s.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function mh(e,t){let n=R(e,t)?.rootNode;if(!n)return null;let r=new Map;return Va(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let o=i.childForFieldName("function")??i.namedChild(0);if(!o)return;let s=Ce(o);if(!s)return;let a=i.childForFieldName("arguments")??i.namedChildren.find(u=>u.type==="arguments"),c={callNode:i,targetNode:o,arguments:a?.namedChildren??[]},l=r.get(s);l?l.push(c):r.set(s,[c])}),{byLeaf:r}}function Va(e,t){t(e);for(let n of e.namedChildren)Va(n,t)}var gh=v("call-parameter-value-flow",{clearGroups:[]});function Qt(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return gh.get(e,n,()=>yh(e,t))}function Zt(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function yh(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((c,l)=>({calleePosition:l,argumentText:c.text.trim(),reason:"caller-unavailable",proof:n}))};let r=R(e,t.caller.relativePath)?.rootNode,i=r?hh(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((c,l)=>({calleePosition:l,argumentText:c.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let o=Sh(i),s=[],a=[];return t.arguments.forEach((c,l)=>{let u=c.text.trim(),d=o.indexOf(u);d>=0?s.push({calleePosition:l,callerPosition:d,argumentText:u,proof:n}):a.push({calleePosition:l,argumentText:u,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:a}}function hh(e,t,n){let r=null;return Ha(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Sh(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Ua)??[]}function Ua(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Ua(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Ha(e,t){t(e);for(let n of e.namedChildren)Ha(n,t)}var bh=8,xh=8;function Wa(e,t){let n=[],r=vh(e,n),i=r.summaries,o=Nh(e,t,i,n),s=Eh(e,t,n);return{observations:Dh([...o.observations,...s]),bodySummaries:i.size,discriminatorSummaries:o.summaries,filesInspected:r.filesInspected,errors:n}}function vh(e,t){let n=new Map,r=[],i=z(e);for(let o of i){let s=x(e,o);if(!/\bJSON\.stringify\s*\(/u.test(s)||!/\bbody\s*:/u.test(s))continue;let a=j(e,o);if(a)for(let[c,l]of Ih(a)){let u={definition:c,parameterIndexes:l,depth:0,proofSpans:[{file:o,startLine:c.startLine,endLine:c.endLine}]};n.set(c.symbol,u),r.push(u)}}for(;r.length>0;){let o=r.shift();if(!(o.depth>=bh))try{for(let s of Jt(e,o.definition).sites){if(!j(e,s.file))continue;let c=s.caller;if(!c)continue;let l=Zt(Qt(e,s),o.parameterIndexes);if(l.length===0)continue;let u={definition:c,parameterIndexes:Za(l),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:s.file,startLine:s.startLine,endLine:s.endLine}]};Th(n,u)&&r.push(n.get(c.symbol))}}catch(s){t.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${Mi(s)}`)}}return{summaries:n,filesInspected:i.length}}function Nh(e,t,n,r){let i=new Map,o=[],s=[];for(let a of t){if(a.action!=="http.request"||a.strength==="candidate"||a.sourceScope!=="production")continue;let c=qa(a);if(!c)continue;let l=j(e,a.source.file);if(!l)continue;let u=Xa(l.root,a.source.startLine),d=u.find(b=>b.startPosition.row===a.source.startLine)??u[0];if(!d)continue;let p=Oi(d);if(!p)continue;let f=_t(e,a.source.file,p.text);if(f.length!==1)continue;let m=n.get(f[0].symbol);if(!m)continue;let g=a.owner.symbol?T(e,a.owner.file).find(b=>b.symbol===a.owner.symbol):null;if(!g)continue;let y=Fh(l,g),S=nr(d);for(let b of m.parameterIndexes){let N=wh(l,S[b]);if(N)for(let E of Lh(N)){let _=Ja(E),h=Qa(E);if(!_||!h)continue;let I=y.indexOf(h.text.trim());if(I>=0){let k={definition:g,carrier:c,field:_,parameterIndex:I,depth:0,proofObservationIds:[a.id],proofSpans:[a.source,{file:a.source.file,startLine:E.startPosition.row,endLine:E.endPosition.row}]},$=za(k);i.has($)||(i.set($,k),o.push(k));continue}let C=fe(l,h);!C||C.evidence==="expression"||s.push(Ai(l,E,"carrier.publish",c,_,C.value,[a.id]))}}}for(;o.length>0;){let a=o.shift();if(!(a.depth>=xh))try{for(let c of Jt(e,a.definition).sites){let l=j(e,c.file);if(!l)continue;let u=c.callNode,d=nr(u)[a.parameterIndex];if(!d)continue;let p=fe(l,d);p&&p.evidence!=="expression"&&s.push(Ai(l,u,"carrier.publish",a.carrier,a.field,p.value,a.proofObservationIds));let f=c.caller;if(!f)continue;let m=Qt(e,c).transfers.find(S=>S.calleePosition===a.parameterIndex)?.callerPosition;if(m===void 0)continue;let g={...a,definition:f,parameterIndex:m,depth:a.depth+1,proofSpans:[...a.proofSpans,{file:c.file,startLine:c.startLine,endLine:c.endLine}]},y=za(g);i.has(y)||(i.set(y,g),o.push(g))}}catch(c){r.push(`builtin.carrier discriminator summary failed for ${a.definition.relativePath}: ${Mi(c)}`)}}return{observations:s,summaries:i.size}}function Eh(e,t,n){let r=[],i=t.filter(o=>o.action==="registry.handle"&&o.strength!=="candidate"&&o.sourceScope==="production");for(let o of t){if(o.action!=="http.handle"||o.strength==="candidate"||o.sourceScope!=="production")continue;let s=qa(o);if(!s)continue;let a=j(e,o.source.file);if(!a)continue;let c=Xa(a.root,o.source.startLine)[0];if(c)for(let l of nr(c).slice(1)){let u=_t(e,o.source.file,l.text);for(let d of u)try{let p=j(e,d.relativePath);if(!p)continue;let f=tr(p.root,d.startLine,d.endLine);if(!f)continue;He(f,m=>{if(m.type!=="call_expression")return;let g=Oi(m);if(!g)return;let y=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(g.text.trim());if(!y)return;let S=y[1],b=y[2],N=_h(e,p,d,b);if(!N)return;let E=Rh(e,d.relativePath,S);for(let _ of i){let h=_.keyParts.find($=>$.name==="registry")?.value,I=_.keyParts.find($=>$.name==="key")?.value;if(!h||!I||!E.some($=>$.file===_.source.file&&$.binding===h))continue;let C=j(e,_.source.file),k=C?Ph(C.root,_.source.startLine):null;!C||!k||r.push(Ai(C,k,"carrier.consume",s,N,I,[o.id,_.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Mi(p)}`)}}}return r}function Ih(e){let t=T(e.db,e.file),n=new Map;return He(e.root,r=>{if(r.type!=="pair"||Ja(r)?.toLowerCase()!=="body")return;let i=Qa(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let o=Nt(t,r.startPosition.row),s=Ch(r);if(!o||!s)return;let a=Ka(s),c=new Set;kh(i,a,c);let l=n.get(o.symbol)??new Set;a.forEach((u,d)=>{u&&c.has(u)&&l.add(d)}),l.size>0&&n.set(o.symbol,l)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((o,s)=>o-s)]]:[]})}function Ch(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function _h(e,t,n,r){let i=tr(t.root,n.startLine,n.endLine);if(!i)return null;let o=new RegExp(`\\.body\\??\\.${Di(r)}\\b`,"u");if(o.test(i.text))return r;let s=null;if(He(i,u=>{if(s||u.type!=="variable_declarator")return;let d=u.childForFieldName("name")??u.namedChild(0),p=u.childForFieldName("value")??u.namedChild(1);!d||!p||!new RegExp(`(?:^|[,{}])\\s*${Di(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||p.type==="call_expression"&&(s=Oi(p)?.text??null)}),!s)return null;let a=_t(e,n.relativePath,s);if(a.length!==1)return null;let c=j(e,a[0].relativePath),l=c?tr(c.root,a[0].startLine,a[0].endLine):null;return l&&o.test(l.text)&&new RegExp(`\\b${Di(r)}\\s*[,}]`,"u").test(l.text)?r:null}function Rh(e,t,n){let r=[];for(let i of _i(e,t,n)){let o=Yt(i.initializer);if(o.type==="call_expression")for(let s of nr(o)){let a=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(a))for(let c of _i(e,i.definition.relativePath,a))r.push({file:c.definition.relativePath,binding:c.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Ai(e,t,n,r,i,o,s){let c=er(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:o,evidence:"constant",term:{kind:"literal",value:o}}],"derived","http-body-registry-discriminator");return c.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...s],sourceSpans:[c.source]},c}function qa(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Th(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Za([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function za(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function Fh(e,t){let n=tr(e.root,t.startLine,t.endLine);return n?Ka(n):[]}function Ka(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Ga)??[]}function Ga(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Ga(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function tr(e,t,n){let r=null;return He(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Ph(e,t){let n=null;return He(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function Xa(e,t){let n=[];return He(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Oi(e){return e.childForFieldName("function")??e.namedChild(0)}function nr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function wh(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return Yt(t);let r=null;return He(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),Yt(r||t)}function Lh(e){let t=Yt(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function Ja(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Qa(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function Yt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function kh(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Za(e){return[...new Set(e)].sort((t,n)=>t-n)}function Dh(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Di(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Mi(e){return e instanceof Error?e.message:String(e)}function He(e,t){t(e);for(let n of e.namedChildren)He(n,t)}import{createHash as Ah}from"crypto";function Ya(e,t){let n=new Map;for(let o of t){if(o.action!=="http.handle"||o.sourceScope!=="production")continue;let s=n.get(o.source.file)??[];s.push(o),n.set(o.source.file,s)}let r=[],i=Oh(e);for(let o of i.mounts)for(let s of o.targetFiles)for(let a of n.get(s)??[]){let c=a.keyParts.find(p=>p.name==="path");if(!c||c.evidence==="expression")continue;let l=$h(o.prefix.value,c.value),u=a.keyParts.map(p=>p.name==="path"?{name:"path",value:l,evidence:"constant",term:{kind:"concat",parts:[o.prefix.term??{kind:"literal",value:o.prefix.value},c.term??{kind:"literal",value:c.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[a.id],sourceSpans:[a.source,{file:o.file,startLine:o.line,endLine:o.line},...o.prefix.derivation?.sourceSpans??[],...c.derivation?.sourceSpans??[]]}}:p),d=`${a.id}\0${o.file}\0${o.line}\0${l}`;r.push({...a,id:`boundary:${Ah("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:u,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[a.id],sourceSpans:[a.source,{file:o.file,startLine:o.line,endLine:o.line}]},resolution:"unresolved"}),a.strength="candidate",a.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function Oh(e){let t=[],n=z(e);for(let r of n){let i=x(e,r);if(!Bh(i))continue;let o=j(e,r);o&&ec(o.root,s=>{if(s.type!=="call_expression")return;let a=s.childForFieldName("function")??s.namedChild(0);if(!a||!/\.use$/u.test(a.text.replace(/\s+/gu,"")))return;let c=jh(s);if(c.length<2)return;let l=fe(o,c[0]);if(!l||l.evidence==="expression")return;let u=Mh(e,r,c[1]);u.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:l.value,evidence:l.evidence,term:l.term,derivation:l.derivation},targetFiles:u})})}return{mounts:t,filesInspected:n.length}}function Mh(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let o=M(e,t).find(c=>c.localName===i&&c.sourcePath);if(!o?.sourcePath)return[t];if(o.kind==="namespace")return[o.sourcePath];let s=o.importedName==="default"?i:o.importedName,a=rt(e,o.sourcePath,s);return[...new Set(a.map(c=>c.relativePath))]}function $h(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function Bh(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function jh(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ec(e,t){t(e);for(let n of e.namedChildren)ec(n,t)}import{createHash as Vh}from"crypto";var $i=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),Uh=8;function rc(e,t){let n=new Map,r=[],i=[],o=new Set,s=[],a=[];for(let c of t){if(c.action!=="http.request"||!c.owner.symbol||c.evidence!=="call-expression"&&c.evidence!=="client-adapter")continue;let l=T(e,c.owner.file).find(f=>f.symbol===c.owner.symbol);if(!l)continue;let u=j(e,l.relativePath);if(!u)continue;let d=tc(u,l),p={definition:l,...d,constantMethods:c.keyParts.flatMap(f=>f.name==="method"&&f.evidence!=="expression"&&$i.has(f.value.toUpperCase())?[f.value.toUpperCase()]:[]),depth:0,proofObservationIds:[c.id],proofSpans:[c.source]};nc(n,p)&&r.push(n.get(l.symbol))}for(;r.length>0;){let c=r.shift();if(!(c.depth>=Uh))try{let l=Jt(e,c.definition);a.push(...l.unresolved.map(u=>Hh(c,u)));for(let u of l.sites){let d=j(e,u.file);if(!d)continue;o.add(u.file);let p=u.callNode,f=Wh(c,p,d);f&&i.push(f);let m=u.caller;if(!m)continue;let g=tc(d,m),y=qh(e,c,u),S={definition:m,pathParameterIndexes:rr([...g.pathParameterIndexes,...y.pathParameterIndexes]),methodParameterIndexes:rr([...g.methodParameterIndexes,...y.methodParameterIndexes]),constantMethods:Tt([...c.constantMethods,...g.constantMethods]),depth:c.depth+1,proofObservationIds:Tt([...c.proofObservationIds,...f?[f.id]:[]]),proofSpans:[...c.proofSpans,{file:u.file,startLine:u.startLine,endLine:u.endLine}]};nc(n,S)&&r.push(n.get(m.symbol))}}catch(l){s.push(`builtin.http-summary failed for ${c.definition.relativePath}:${c.definition.startLine+1}: ${l instanceof Error?l.message:String(l)}`)}}return{observations:i,frontiers:zh(a),summaries:n.size,filesInspected:o.size,errors:s}}function Hh(e,t){let n=Tt([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${Vh("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:Jn(t.file)}}function zh(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function Wh(e,t,n){let r=oc(t),i=e.pathParameterIndexes.flatMap(d=>{let p=fe(n,r[d]);return p&&p.evidence!=="expression"&&Jh(p.value)?[{index:d,value:p}]:[]}),o=e.methodParameterIndexes.flatMap(d=>{let p=fe(n,r[d]),f=p?.value.toUpperCase();return p&&f&&p.evidence!=="expression"&&$i.has(f)?[{index:d,value:{...p,value:f}}]:[]}),s=Tt([...e.constantMethods,...o.map(d=>d.value.value)]);if(i.length!==1||s.length!==1)return null;let a=i[0].value,c=o.find(d=>d.value.value===s[0])?.value,l=[{name:"method",value:s[0],evidence:c?"constant":"literal",term:c?.term??{kind:"literal",value:s[0]},derivation:c?.derivation},{name:"path",value:a.value,evidence:"constant",term:a.term,derivation:a.derivation}],u=er(n,t,"builtin.http-summary","http.request",l,"derived","compiler-resolved-http-summary");return u.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,u.source]},u}function tc(e,t){let n=Xh(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=Gh(n),i=new Set,o=new Set,s=new Set;return Bi(n,a=>{if(a.type==="call_expression"&&((a.childForFieldName("function")??a.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let f=oc(a);en(f[0],r,i);let m=Kh(f[1],"method");if(m){en(m,r,o);let g=fe(e,m),y=g?.value.toUpperCase();y&&g?.evidence!=="expression"&&$i.has(y)&&s.add(y)}else en(f[1],r,o)}if(a.type!=="pair")return;let c=a.childForFieldName("key")??a.namedChild(0),l=a.childForFieldName("value")??a.namedChild(1),u=c?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(u==="url"||u==="path"||u==="endpoint")&&en(l,r,i),(u==="init"||u==="requestinit"||u==="options")&&en(l,r,o)}),{pathParameterIndexes:r.flatMap((a,c)=>a&&i.has(a)?[c]:[]),methodParameterIndexes:r.flatMap((a,c)=>a&&o.has(a)?[c]:[]),constantMethods:[...s].sort()}}function qh(e,t,n){let r=Qt(e,n);return{pathParameterIndexes:Zt(r,t.pathParameterIndexes),methodParameterIndexes:Zt(r,t.methodParameterIndexes)}}function nc(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=rr([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=rr([...n.methodParameterIndexes,...t.methodParameterIndexes]),o=Tt([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||o.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:o,depth:Math.min(n.depth,t.depth),proofObservationIds:Tt([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Kh(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function en(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Gh(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(ic)??[]}function ic(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?ic(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Xh(e,t,n){let r=null;return Bi(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function oc(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Jh(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function rr(e){return[...new Set(e)].sort((t,n)=>t-n)}function Tt(e){return[...new Set(e)].sort()}function Bi(e,t){t(e);for(let n of e.namedChildren)Bi(n,t)}import{createHash as Qh}from"crypto";function cc(e){let t=sc(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=sc(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?ji(r).flatMap(i=>{let o=t.get(i)?.[0];return o?[ac(r,o,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?ji(r).flatMap(i=>{let o=n.get(i)?.[0];return o?[ac(r,o,i,"queue.consume")]:[]}):[])}function sc(e){let t=new Map;for(let n of e)for(let r of ji(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function ji(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function ac(e,t,n,r){let i=`database:${n}`,o=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,o].join("\0");return{...e,id:`boundary:${Qh("sha256").update(s).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:o,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var Vi="runtime-boundaries-v15",sr=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],Zh=64;function Yh(e,t={}){let n=z(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(rS)),o=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===Vi&&o!==void 0&&o.length===t.previousGraph.coverage.filesScanned,a=s?o.filter(P=>r.has(P.file)&&!i.has(P.file)):[],c=new Set(a.flatMap(P=>P.observationIds)),l=s?t.previousGraph.observations.filter(P=>c.has(P.id)&&r.has(P.source.file)):[],u=s?n.filter(P=>i.has(P)):n,d=[],p=o?.reduce((P,dr)=>P+dr.observationIds.length,0)??0,f=performance.now(),m=eS(e,u);ot(d,"direct-extraction",f,u.length,m.observations.length,{filesVisited:u.length,filesReused:a.length,factsReused:l.length,factsInvalidated:Math.max(0,p-l.length)});let g=[...a,...m.fileCoverage].sort((P,dr)=>P.file.localeCompare(dr.file)),y=nS(g),S=g.flatMap(P=>P.extractionErrors),b=tn([...l,...m.observations]),N=tn([...b,...cc(b)]);f=performance.now();let E=rc(e,N);ot(d,"http-summary",f,N.length,E.observations.length,{filesVisited:E.filesInspected}),y.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:E.filesInspected,observations:E.observations.length,errors:E.errors.length}),S.push(...E.errors);let _=tn([...N,...E.observations]);f=performance.now();let h=Ya(e,_);ot(d,"http-mount",f,_.length,h.observations.length,{filesVisited:h.filesInspected});let I=tn([..._,...h.observations]);f=performance.now();let C=Wa(e,I);ot(d,"carrier",f,I.length,C.observations.length,{filesVisited:C.filesInspected}),y.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:C.bodySummaries,observations:C.observations.length,errors:C.errors.length}),S.push(...C.errors);let k=tn([...I,...C.observations]);f=performance.now();let $=iS(k);ot(d,"relations",f,k.length,$.length),f=performance.now();let Hi=sS(k,$);ot(d,"links",f,$.length,Hi.length),aS(k,$),f=performance.now();let zi=uS([...cS(k,$),...E.frontiers]);return ot(d,"frontiers",f,k.length,zi.length),{schemaVersion:2,extractorVersion:Vi,observations:k,relationGroups:$,links:Hi,frontiers:zi,coverage:{filesScanned:n.length,filesWithAst:g.filter(P=>P.hasAst).length,filesWithoutAst:g.filter(P=>!P.hasAst).length,...s?{filesReused:a.length}:{},extractors:[...y.values()],extractionErrors:S,phases:d},fileCoverage:g}}function ot(e,t,n,r,i,o={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...o})}function eS(e,t){let n=[],r=[];for(let i of t){let o=x(e,i),s=Li.filter(l=>l.supports(o)),a=s.length>0?j(e,i):null,c={file:i,hasAst:a!==null||tS(i,o),observationIds:[],extractors:[],extractionErrors:[]};if(a)for(let l of s){let u={id:l.id,applicableFiles:1,observations:0,errors:0};try{let d=l.extract(a);u.observations=d.length,n.push(...d),c.observationIds.push(...d.map(p=>p.id))}catch(d){u.errors=1,c.extractionErrors.push(`${l.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}c.extractors.push(u)}r.push(c)}return{observations:n,fileCoverage:r}}function tS(e,t){return t?Se(e)?/<script\b/iu.test(t):H(e)!==null:!1}function nS(e){let t=new Map(Li.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function rS(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function iS(e){let t=new Map;for(let n of sr){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let o=dS(i,n.keyNames);if(!o)continue;let s=o.map(d=>`${d.name}=${dc(d.name,d.value)}`).join("\0"),a=i.sourceScope==="production"?"production":i.sourceScope,c=`${n.id}\0${a}\0${s}`,l=`boundary-group:${lc("sha256").update(c).digest("hex").slice(0,16)}`,u=t.get(l)??{id:l,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:o,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&u.producerIds.push(i.id),n.consumerActions.includes(i.action)&&u.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&u.declarationIds.push(i.id),u.derivation.inputFactIds.push(i.id),u.derivation.sourceSpans.push(i.source),t.set(l,u)}}return[...t.values()].map(oS).sort(fS)}function oS(e){return{...e,producerIds:ir(e.producerIds),consumerIds:ir(e.consumerIds),declarationIds:ir(e.declarationIds),derivation:{...e.derivation,inputFactIds:ir(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function sS(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let o=sr.find(a=>a.id===i.joinRule);if(!o?.traversable)continue;let s=o.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(o.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(o.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>Zh))for(let a of s)for(let c of i.consumerIds){let l=n.get(a),u=n.get(c);if(!l||!u||pS(l,u))continue;let d=l.strength==="derived"||u.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${a}\0${c}`,f={id:`boundary-link:${lc("sha256").update(p).digest("hex").slice(0,16)}`,from:a,to:c,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[a,c],sourceSpans:[l.source,u.source]}};r.set(f.id,f)}}return[...r.values()].sort(mS)}function aS(e,t){let n=new Set(t.filter(uc).flatMap(or)),r=new Set(t.filter(lS).flatMap(or));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function cS(e,t){let n=new Set(e.filter(o=>o.strength!=="candidate").map(o=>`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)),r=new Set(t.flatMap(or)),i=new Set(t.filter(uc).flatMap(or));return e.filter(o=>o.sourceScope==="production").filter(o=>o.strength!=="candidate"||!n.has(`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)).filter(o=>!i.has(o.id)).map(o=>{let s=o.keyParts.filter(c=>c.evidence==="expression"||c.value.length===0).map(c=>c.name),a=s.length>0?`${o.extractor} observed ${o.action}, but ${s.join(", ")} remained symbolic or unknown.`:o.resolution==="ambiguous"?`${o.extractor} established the address for ${o.action}, but more than one indexed peer has the same runtime key.`:r.has(o.id)?`${o.extractor} established the address for ${o.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${o.extractor} observed ${o.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:o.id,reason:a,missingKeyParts:s,sourceScope:o.sourceScope}}).sort((o,s)=>o.observationId.localeCompare(s.observationId))}function or(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function uc(e){let t=sr.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function lS(e){let t=sr.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function uS(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function dS(e,t){let n=[];for(let r of t){let i=e.keyParts.find(o=>o.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:dc(r,i.value)})}return n}function dc(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function pS(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function tn(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function ir(e){return[...new Set(e)].sort()}function fS(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function mS(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import gS from"better-sqlite3";var cr="codebaseiq_runtime_boundaries",st="codebaseiq_runtime_observations",lr="codebaseiq_runtime_relation_groups",ur="codebaseiq_runtime_relation_participants";function yS(e,t){let n=new gS(lt(e));try{n.exec(`
298
298
  CREATE TABLE IF NOT EXISTS ${cr} (
299
299
  singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
300
300
  schema_version INTEGER NOT NULL,
301
301
  extractor_version TEXT NOT NULL,
302
302
  payload TEXT NOT NULL
303
303
  )
304
- `),SS(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${cr} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${ot}`).run(),n.prepare(`DELETE FROM ${ur}`).run(),n.prepare(`DELETE FROM ${lr}`).run();let r=n.prepare(`INSERT INTO ${ot}
304
+ `),SS(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${cr} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${st}`).run(),n.prepare(`DELETE FROM ${ur}`).run(),n.prepare(`DELETE FROM ${lr}`).run();let r=n.prepare(`INSERT INTO ${st}
305
305
  (id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
306
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${lr} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),o=n.prepare(`INSERT INTO ${ur} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let a of s.producerIds)o.run(s.id,a,"producer");for(let a of s.consumerIds)o.run(s.id,a,"consumer");for(let a of s.declarationIds)o.run(s.id,a,"declaration")}})()}finally{n.close()}}function hS(e,t={}){if(!bS(e,ot))return dc(e)?.observations??[];let n=[],r=[];return ar(n,r,"protocol",t.protocols),ar(n,r,"action",t.actions),ar(n,r,"source_scope",t.sourceScopes),ar(n,r,"file",t.files),e.all(`SELECT payload FROM ${ot}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(o=>xS(o.payload))}function SS(e){e.exec(`
307
- CREATE TABLE IF NOT EXISTS ${ot} (
306
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${lr} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),o=n.prepare(`INSERT INTO ${ur} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let a of s.producerIds)o.run(s.id,a,"producer");for(let a of s.consumerIds)o.run(s.id,a,"consumer");for(let a of s.declarationIds)o.run(s.id,a,"declaration")}})()}finally{n.close()}}function hS(e,t={}){if(!bS(e,st))return pc(e)?.observations??[];let n=[],r=[];return ar(n,r,"protocol",t.protocols),ar(n,r,"action",t.actions),ar(n,r,"source_scope",t.sourceScopes),ar(n,r,"file",t.files),e.all(`SELECT payload FROM ${st}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(o=>xS(o.payload))}function SS(e){e.exec(`
307
+ CREATE TABLE IF NOT EXISTS ${st} (
308
308
  id TEXT PRIMARY KEY,
309
309
  protocol TEXT NOT NULL,
310
310
  action TEXT NOT NULL,
@@ -319,9 +319,9 @@ globalThis.RegExp = new Proxy(NativeRegExp, {
319
319
  payload TEXT NOT NULL
320
320
  );
321
321
  CREATE INDEX IF NOT EXISTS idx_runtime_observations_protocol_action_scope
322
- ON ${ot}(protocol, action, source_scope);
322
+ ON ${st}(protocol, action, source_scope);
323
323
  CREATE INDEX IF NOT EXISTS idx_runtime_observations_file_line
324
- ON ${ot}(file, start_line);
324
+ ON ${st}(file, start_line);
325
325
 
326
326
  CREATE TABLE IF NOT EXISTS ${lr} (
327
327
  id TEXT PRIMARY KEY,
@@ -341,15 +341,15 @@ globalThis.RegExp = new Proxy(NativeRegExp, {
341
341
  );
342
342
  CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
343
343
  ON ${ur}(observation_id, participant_role);
344
- `)}function bS(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function ar(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function xS(e){try{return[JSON.parse(e)]}catch{return[]}}function dc(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",cr))return null;let n=e.get(`SELECT schema_version, payload FROM ${cr} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}import{spawn as IS}from"child_process";import{platform as Nc}from"os";import{performance as Ec}from"perf_hooks";import{execFileSync as mc}from"child_process";import{platform as vS}from"os";var gc=1e3,yc=2*1024*1024,NS=25;function hc(e,t,n=vc){let r=n.readIdentity(e),i=new Map;return r&&i.set(e,r),{rootPid:e,rootIdentity:r,ownsProcessGroup:t,knownMembers:i}}async function Sc(e,t,n=vc){if(!e.rootIdentity){let c=await nn(e,t.gracefulMs+t.forceMs,n);return{reaped:c,reason:c?"terminated":"identity-unavailable",detail:c?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let r=bc(e,n);if(r==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(r==="exited"&&!xc(e,n))return{reaped:!0,reason:"terminated"};if(n.platform==="win32"){try{n.terminateWindowsTree(e.rootPid)}catch(l){let u=await nn(e,t.forceMs,n);return{reaped:u,reason:u?"terminated":"signal-failed",detail:u?void 0:Ui(l)}}let c=await nn(e,t.forceMs,n);return{reaped:c,reason:c?"terminated":"deadline"}}let i=pc(e,"SIGTERM",n);if(await nn(e,t.gracefulMs,n))return{reaped:!0,reason:"terminated"};let s=pc(e,"SIGKILL",n);return await nn(e,t.forceMs,n)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:i?{reaped:!1,reason:i.reason,detail:i.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function bc(e,t){let n=t.readIdentity(e.rootPid);if(!n)return"exited";if(!e.rootIdentity||!sn(e.rootIdentity,n))return"mismatch";e.knownMembers.set(e.rootPid,n);for(let r of t.listDescendantPids(e.rootPid)){let i=t.readIdentity(r);i&&e.knownMembers.set(r,i)}return"owned"}function pc(e,t,n){let r=bc(e,n);if(r==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${t}.`};if(r==="owned"&&e.ownsProcessGroup)try{return n.signal(-e.rootPid,t),null}catch(o){if(!fc(o))return{reason:"signal-failed",detail:Ui(o)}}let i=null;for(let o of e.knownMembers.values()){let s=n.readIdentity(o.pid);if(!(!s||!sn(o,s)))try{n.signal(o.pid,t)}catch(a){!fc(a)&&i===null&&(i=Ui(a))}}return i===null?null:{reason:"signal-failed",detail:i}}async function nn(e,t,n){let r=n.now()+t;for(;xc(e,n);){if(n.now()>=r)return!1;await n.sleep(Math.min(NS,Math.max(1,r-n.now())))}return!0}function xc(e,t){if(!e.rootIdentity&&t.isProcessAlive(e.rootPid))return!0;for(let n of e.knownMembers.values()){let r=t.readIdentity(n.pid);if(r&&sn(n,r))return!0}return!!(e.ownsProcessGroup&&t.isProcessGroupAlive(e.rootPid))}function ES(e){let t=mc("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:gc,maxBuffer:yc,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),n=new Map;for(let s of t.split(/\r?\n/)){let a=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!a)continue;let c=Number(a[1]),l=Number(a[2]),u=n.get(l)??[];u.push(c),n.set(l,u)}let r=[],i=[...n.get(e)??[]],o=new Set;for(;i.length>0;){let s=i.pop();o.has(s)||(o.add(s),r.push(s),i.push(...n.get(s)??[]))}return r}function fc(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function Ui(e){return e instanceof Error?e.message:String(e)}var vc={platform:vS(),now:Date.now,readIdentity:Wi,isProcessAlive(e){try{return process.kill(e,0),!0}catch(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return ES(e)}catch{return[]}},signal(e,t){process.kill(e,t)},terminateWindowsTree(e){mc("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:gc,maxBuffer:yc,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(t=>setTimeout(t,e))}};var RR={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},on=class extends Error{constructor(n,r,i,o={}){super(i,o.cause===void 0?void 0:{cause:o.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=o.timedOut??!1,this.reaped=o.reaped??!1,this.stdout=o.stdout??"",this.stderr=o.stderr??"",this.stdoutTruncated=o.stdoutTruncated??!1,this.stderrTruncated=o.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function rn(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function Ic(e,t,n,r){let i=Math.max(0,r-n);i>0&&e.push(t.subarray(0,i))}function Cc(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function TR(e){rn(e.timeoutMs,"timeoutMs"),rn(e.maxStdoutBytes,"maxStdoutBytes"),rn(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;rn(t,"terminationGraceMs");let n=e.terminationForceMs??t;return rn(n,"terminationForceMs"),new Promise((r,i)=>{let o=Ec.now(),s;try{let h=Nc()!=="win32";s=IS(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:h?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(h){i(new on("spawn",e.label,`${e.label} could not start.`,{cause:h,reaped:!0}));return}let a=[],c=[],l=0,u=0,d=!1,p=!1,f=null,m=!1,g=Nc()!=="win32",y=s.pid===void 0?null:hc(s.pid,g),S=()=>{clearTimeout(E),e.signal?.removeEventListener("abort",_)},b=h=>{if(m||!f)return;m=!0,S();let I=Buffer.concat(a).toString("utf8"),C=Buffer.concat(c).toString("utf8"),k=h.reaped||!h.detail?"":` Process-tree cleanup failed: ${h.detail}`;i(new on(f.kind,e.label,`${f.message}${k}`,{timedOut:f.timedOut,reaped:h.reaped,stdout:I,stderr:C,stdoutTruncated:d,stderrTruncated:p}))},N=h=>{if(!(f||m)){if(f=h,!y){b({reaped:s.pid===void 0,reason:s.pid===void 0?"terminated":"identity-unavailable"});return}Sc(y,{gracefulMs:t,forceMs:n}).then(b,I=>{b({reaped:!1,reason:"signal-failed",detail:I instanceof Error?I.message:String(I)})})}},E=setTimeout(()=>{N({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);E.unref();let _=()=>{N({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",_,{once:!0}),e.signal?.aborted&&_(),s.stdout.on("data",h=>{let I=Buffer.isBuffer(h)?h:Buffer.from(h);e.outputLimitBehavior==="truncate-tail"?Cc(a,I,e.maxStdoutBytes):Ic(a,I,l,e.maxStdoutBytes),l+=I.length,l>e.maxStdoutBytes&&(d=!0,e.outputLimitBehavior!=="truncate-tail"&&N({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),s.stderr.on("data",h=>{let I=Buffer.isBuffer(h)?h:Buffer.from(h);e.outputLimitBehavior==="truncate-tail"?Cc(c,I,e.maxStderrBytes):Ic(c,I,u,e.maxStderrBytes),u+=I.length,u>e.maxStderrBytes&&(p=!0,e.outputLimitBehavior!=="truncate-tail"&&N({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),s.on("error",h=>{if(!m&&!f){if(s.pid===void 0){S(),m=!0,i(new on("spawn",e.label,`${e.label} could not start: ${h.message}`,{cause:h,reaped:!0}));return}N({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${h.message}`})}}),s.on("close",(h,I)=>{if(m||f)return;m=!0,S();let C=Buffer.concat(a).toString("utf8"),k=Buffer.concat(c).toString("utf8");r({status:h,signal:I,stdout:C,stderr:k,timedOut:!1,durationMs:Ec.now()-o,stdoutTruncated:d,stderrTruncated:p})}),e.input===void 0?s.stdin.end():s.stdin.end(e.input)})}function PR(e){return e.startsWith("local ")}import{zstdCompressSync as _S,zstdDecompressSync as RS}from"zlib";function DR(e){return _S(Buffer.from(JSON.stringify(e.map(t=>[t.symbol,t.roles,t.range,t.enclosingRange]))))}function Rc(e){let t;try{t=JSON.parse(RS(e).toString("utf8"))}catch{return null}return Array.isArray(t)?t.map(([n,r,i,o])=>({symbol:n,roles:r,range:i,enclosingRange:o})):null}function TS(e){return e.length===1&&e[0]===0}function AR(e,t){let n=e.all(`SELECT c.occurrences
344
+ `)}function bS(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function ar(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function xS(e){try{return[JSON.parse(e)]}catch{return[]}}function pc(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",cr))return null;let n=e.get(`SELECT schema_version, payload FROM ${cr} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}import{spawn as _S}from"child_process";import{platform as Nc}from"os";import{performance as Ec}from"perf_hooks";import{execFileSync as gc}from"child_process";import{platform as vS}from"os";var NS=1e3,yc=2*1024*1024,ES=1e4,IS=25;function hc(e,t,n=vc){let r=n.readIdentity(e),i=new Map;return r&&i.set(e,r),{rootPid:e,rootIdentity:r,ownsProcessGroup:t,knownMembers:i}}async function Sc(e,t,n=vc){if(!e.rootIdentity){let c=await nn(e,t.gracefulMs+t.forceMs,n);return{reaped:c,reason:c?"terminated":"identity-unavailable",detail:c?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let r=bc(e,n);if(r==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(r==="exited"&&!xc(e,n))return{reaped:!0,reason:"terminated"};if(n.platform==="win32"){try{n.terminateWindowsTree(e.rootPid)}catch(l){let u=await nn(e,t.forceMs,n);return{reaped:u,reason:u?"terminated":"signal-failed",detail:u?void 0:Ui(l)}}let c=await nn(e,t.forceMs,n);return{reaped:c,reason:c?"terminated":"deadline"}}let i=fc(e,"SIGTERM",n);if(await nn(e,t.gracefulMs,n))return{reaped:!0,reason:"terminated"};let s=fc(e,"SIGKILL",n);return await nn(e,t.forceMs,n)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:i?{reaped:!1,reason:i.reason,detail:i.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function bc(e,t){let n=t.readIdentity(e.rootPid);if(!n)return"exited";if(!e.rootIdentity||!sn(e.rootIdentity,n))return"mismatch";e.knownMembers.set(e.rootPid,n);for(let r of t.listDescendantPids(e.rootPid)){let i=t.readIdentity(r);i&&e.knownMembers.set(r,i)}return"owned"}function fc(e,t,n){let r=bc(e,n);if(r==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${t}.`};if(r==="owned"&&e.ownsProcessGroup)try{return n.signal(-e.rootPid,t),null}catch(o){if(!mc(o))return{reason:"signal-failed",detail:Ui(o)}}let i=null;for(let o of e.knownMembers.values()){let s=n.readIdentity(o.pid);if(!(!s||!sn(o,s)))try{n.signal(o.pid,t)}catch(a){!mc(a)&&i===null&&(i=Ui(a))}}return i===null?null:{reason:"signal-failed",detail:i}}async function nn(e,t,n){let r=n.now()+t;for(;xc(e,n);){if(n.now()>=r)return!1;await n.sleep(Math.min(IS,Math.max(1,r-n.now())))}return!0}function xc(e,t){if(!e.rootIdentity&&t.isProcessAlive(e.rootPid))return!0;for(let n of e.knownMembers.values()){let r=t.readIdentity(n.pid);if(r&&sn(n,r))return!0}return!!(e.ownsProcessGroup&&t.isProcessGroupAlive(e.rootPid))}function CS(e){let t=gc("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:NS,maxBuffer:yc,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),n=new Map;for(let s of t.split(/\r?\n/)){let a=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!a)continue;let c=Number(a[1]),l=Number(a[2]),u=n.get(l)??[];u.push(c),n.set(l,u)}let r=[],i=[...n.get(e)??[]],o=new Set;for(;i.length>0;){let s=i.pop();o.has(s)||(o.add(s),r.push(s),i.push(...n.get(s)??[]))}return r}function mc(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function Ui(e){return e instanceof Error?e.message:String(e)}var vc={platform:vS(),now:Date.now,readIdentity:qi,isProcessAlive(e){try{return process.kill(e,0),!0}catch(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return CS(e)}catch{return[]}},signal(e,t){process.kill(e,t)},terminateWindowsTree(e){gc("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:ES,maxBuffer:yc,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(t=>setTimeout(t,e))}};var PR={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:18e5},on=class extends Error{constructor(n,r,i,o={}){super(i,o.cause===void 0?void 0:{cause:o.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=o.timedOut??!1,this.reaped=o.reaped??!1,this.stdout=o.stdout??"",this.stderr=o.stderr??"",this.stdoutTruncated=o.stdoutTruncated??!1,this.stderrTruncated=o.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function rn(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function Ic(e,t,n,r){let i=Math.max(0,r-n);i>0&&e.push(t.subarray(0,i))}function Cc(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function wR(e){rn(e.timeoutMs,"timeoutMs"),rn(e.maxStdoutBytes,"maxStdoutBytes"),rn(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;rn(t,"terminationGraceMs");let n=e.terminationForceMs??t;return rn(n,"terminationForceMs"),new Promise((r,i)=>{let o=Ec.now(),s;try{let h=Nc()!=="win32";s=_S(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:h?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(h){i(new on("spawn",e.label,`${e.label} could not start.`,{cause:h,reaped:!0}));return}let a=[],c=[],l=0,u=0,d=!1,p=!1,f=null,m=!1,g=Nc()!=="win32",y=s.pid===void 0?null:hc(s.pid,g),S=()=>{clearTimeout(E),e.signal?.removeEventListener("abort",_)},b=h=>{if(m||!f)return;m=!0,S();let I=Buffer.concat(a).toString("utf8"),C=Buffer.concat(c).toString("utf8"),k=h.reaped||!h.detail?"":` Process-tree cleanup failed: ${h.detail}`;i(new on(f.kind,e.label,`${f.message}${k}`,{timedOut:f.timedOut,reaped:h.reaped,stdout:I,stderr:C,stdoutTruncated:d,stderrTruncated:p}))},N=h=>{if(!(f||m)){if(f=h,!y){b({reaped:s.pid===void 0,reason:s.pid===void 0?"terminated":"identity-unavailable"});return}Sc(y,{gracefulMs:t,forceMs:n}).then(b,I=>{b({reaped:!1,reason:"signal-failed",detail:I instanceof Error?I.message:String(I)})})}},E=setTimeout(()=>{N({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);E.unref();let _=()=>{N({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",_,{once:!0}),e.signal?.aborted&&_(),s.stdout.on("data",h=>{let I=Buffer.isBuffer(h)?h:Buffer.from(h);e.outputLimitBehavior==="truncate-tail"?Cc(a,I,e.maxStdoutBytes):Ic(a,I,l,e.maxStdoutBytes),l+=I.length,l>e.maxStdoutBytes&&(d=!0,e.outputLimitBehavior!=="truncate-tail"&&N({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),s.stderr.on("data",h=>{let I=Buffer.isBuffer(h)?h:Buffer.from(h);e.outputLimitBehavior==="truncate-tail"?Cc(c,I,e.maxStderrBytes):Ic(c,I,u,e.maxStderrBytes),u+=I.length,u>e.maxStderrBytes&&(p=!0,e.outputLimitBehavior!=="truncate-tail"&&N({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),s.on("error",h=>{if(!m&&!f){if(s.pid===void 0){S(),m=!0,i(new on("spawn",e.label,`${e.label} could not start: ${h.message}`,{cause:h,reaped:!0}));return}N({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${h.message}`})}}),s.on("close",(h,I)=>{if(m||f)return;m=!0,S();let C=Buffer.concat(a).toString("utf8"),k=Buffer.concat(c).toString("utf8");r({status:h,signal:I,stdout:C,stderr:k,timedOut:!1,durationMs:Ec.now()-o,stdoutTruncated:d,stderrTruncated:p})}),e.input===void 0?s.stdin.end():s.stdin.end(e.input)})}function kR(e){return e.startsWith("local ")}import{zstdCompressSync as TS,zstdDecompressSync as FS}from"zlib";function MR(e){return TS(Buffer.from(JSON.stringify(e.map(t=>[t.symbol,t.roles,t.range,t.enclosingRange]))))}function Rc(e){let t;try{t=JSON.parse(FS(e).toString("utf8"))}catch{return null}return Array.isArray(t)?t.map(([n,r,i,o])=>({symbol:n,roles:r,range:i,enclosingRange:o})):null}function PS(e){return e.length===1&&e[0]===0}function $R(e,t){let n=e.all(`SELECT c.occurrences
345
345
  FROM chunks c
346
346
  JOIN documents d ON d.id = c.document_id
347
347
  WHERE d.relative_path = ?
348
- ORDER BY c.chunk_index, c.id`,t),r=[];for(let i of n){if(TS(i.occurrences))continue;let o=Rc(i.occurrences);if(!o)return null;r.push(...o)}return r}function OR(e,t){let n=new Map(t.map(i=>[i,[]])),r=new Map;for(let i of _c([...n.keys()])){let o=e.all(`SELECT DISTINCT m.chunk_id, gs.symbol
348
+ ORDER BY c.chunk_index, c.id`,t),r=[];for(let i of n){if(PS(i.occurrences))continue;let o=Rc(i.occurrences);if(!o)return null;r.push(...o)}return r}function BR(e,t){let n=new Map(t.map(i=>[i,[]])),r=new Map;for(let i of _c([...n.keys()])){let o=e.all(`SELECT DISTINCT m.chunk_id, gs.symbol
349
349
  FROM mentions m
350
350
  JOIN global_symbols gs ON gs.id = m.symbol_id
351
351
  WHERE gs.symbol IN (${i.map(()=>"?").join(",")})`,...i);for(let s of o){let a=r.get(s.chunk_id)??[];a.push(s.symbol),r.set(s.chunk_id,a)}}for(let i of _c([...r.keys()])){let o=e.all(`SELECT c.id, d.relative_path, c.occurrences
352
352
  FROM chunks c
353
353
  JOIN documents d ON d.id = c.document_id
354
- WHERE c.id IN (${i.map(()=>"?").join(",")})`,...i);for(let s of o){let a=Rc(s.occurrences);if(!a){for(let c of r.get(s.id)??[])n.set(c,null);continue}for(let c of a)(c.roles&1)===0&&n.get(c.symbol)?.push({relativePath:s.relative_path,occurrence:c})}}return n}function _c(e){let t=[];for(let n=0;n<e.length;n+=750)t.push(e.slice(n,n+750));return t}export{v as a,ye as b,Ne as c,he as d,We as e,BS as f,jS as g,VS as h,US as i,HS as j,ee as k,ao as l,co as m,Do as n,bu as o,ht as p,be as q,le as r,So as s,X as t,x as u,Pt as v,Zc as w,nb as x,rb as y,re as z,Qr as A,Sv as B,bv as C,Zr as D,H as E,Se as F,QS as G,ZS as H,R as I,Lt as J,mt as K,kt as L,ul as M,A as N,Ul as O,Hl as P,Lr as Q,ql as R,Kl as S,Ex as T,qo as U,z as V,Ix as W,nv as X,xp as Y,Ln as Z,$N as _,je as $,M as aa,KN as ba,Mn as ca,Dn as da,de as ea,ae as fa,Ve as ga,K as ha,et as ia,ci as ja,jt as ka,ws as la,eE as ma,tE as na,nE as oa,rE as pa,li as qa,ui as ra,bE as sa,T as ta,xE as ua,pm as va,vE as wa,NE as xa,EE as ya,hm as za,Nt as Aa,IE as Ba,Na as Ca,Bn as Da,mi as Ea,pI as Fa,GE as Ga,Wm as Ha,XE as Ia,JE as Ja,kI as Ka,DI as La,AI as Ma,ta as Na,oI as Oa,sI as Pa,fi as Qa,gi as Ra,Qs as Sa,Ys as Ta,yi as Ua,PI as Va,xg as Wa,vg as Xa,wI as Ya,Ng as Za,Eg as _a,UI as $a,hi as ab,YI as bb,ca as cb,eC as db,la as eb,dC as fb,Gg as gb,bi as hb,pC as ib,Qg as jb,Zg as kb,fC as lb,mC as mb,gC as nb,PR as ob,DR as pb,AR as qb,OR as rb,Sc as sb,ny as tb,Hn as ub,ay as vb,NC as wb,EC as xb,DC as yb,Wn as zb,vi as Ab,zC as Bb,WC as Cb,qC as Db,Jn as Eb,nt as Fb,fe as Gb,Jt as Hb,Qt as Ib,Vi as Jb,Yh as Kb,yS as Lb,hS as Mb,dc as Nb,RR as Ob,on as Pb,TR as Qb};
355
- //# sourceMappingURL=chunk-FTTV7IRX.js.map
354
+ WHERE c.id IN (${i.map(()=>"?").join(",")})`,...i);for(let s of o){let a=Rc(s.occurrences);if(!a){for(let c of r.get(s.id)??[])n.set(c,null);continue}for(let c of a)(c.roles&1)===0&&n.get(c.symbol)?.push({relativePath:s.relative_path,occurrence:c})}}return n}function _c(e){let t=[];for(let n=0;n<e.length;n+=750)t.push(e.slice(n,n+750));return t}export{v as a,ye as b,Ne as c,he as d,qe as e,US as f,HS as g,zS as h,WS as i,qS as j,ee as k,co as l,lo as m,Ao as n,bu as o,ht as p,be as q,le as r,bo as s,X as t,x as u,Pt as v,Zc as w,ob as x,sb as y,re as z,Qr as A,vv as B,Nv as C,Zr as D,H as E,Se as F,eb as G,tb as H,R as I,Lt as J,mt as K,kt as L,ul as M,A as N,Ul as O,Hl as P,Lr as Q,ql as R,Kl as S,_x as T,Ko as U,z as V,Rx as W,ov as X,xp as Y,Ln as Z,VN as _,je as $,M as aa,JN as ba,Mn as ca,Dn as da,de as ea,ae as fa,Ve as ga,K as ha,tt as ia,ci as ja,jt as ka,Ls as la,rE as ma,iE as na,oE as oa,sE as pa,li as qa,ui as ra,NE as sa,T as ta,EE as ua,pm as va,IE as wa,CE as xa,_E as ya,hm as za,Nt as Aa,RE as Ba,Ea as Ca,Bn as Da,mi as Ea,gI as Fa,QE as Ga,Wm as Ha,ZE as Ia,YE as Ja,OI as Ka,MI as La,$I as Ma,na as Na,cI as Oa,lI as Pa,fi as Qa,gi as Ra,Zs as Sa,ea as Ta,yi as Ua,kI as Va,xg as Wa,vg as Xa,DI as Ya,Ng as Za,Eg as _a,WI as $a,hi as ab,nC as bb,la as cb,rC as db,ua as eb,mC as fb,Gg as gb,bi as hb,gC as ib,Qg as jb,Zg as kb,yC as lb,hC as mb,SC as nb,kR as ob,MR as pb,$R as qb,BR as rb,Sc as sb,ny as tb,Hn as ub,ay as vb,CC as wb,_C as xb,MC as yb,Wn as zb,vi as Ab,KC as Bb,GC as Cb,XC as Db,Jn as Eb,rt as Fb,fe as Gb,Jt as Hb,Qt as Ib,Vi as Jb,Yh as Kb,yS as Lb,hS as Mb,pc as Nb,PR as Ob,on as Pb,wR as Qb};
355
+ //# sourceMappingURL=chunk-FPUJRBHL.js.map