spana-test 0.11.0 → 0.13.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 (548) hide show
  1. package/.agents/skills/spana-testing/SKILL.md +0 -0
  2. package/LICENSE +0 -0
  3. package/README.md +5 -2
  4. package/dist/{accessibility-audit-YZOPUY3D.js → accessibility-audit-MHQ65DUD.js} +61 -12
  5. package/dist/accessibility-audit-MHQ65DUD.js.map +1 -0
  6. package/dist/agent/index.d.ts +3 -11
  7. package/dist/agent/index.d.ts.map +1 -0
  8. package/dist/agent/index.js +38 -15
  9. package/dist/agent/index.js.map +1 -1
  10. package/dist/{session-uT8xL03K.d.ts → agent/session.d.ts} +14 -46
  11. package/dist/agent/session.d.ts.map +1 -0
  12. package/dist/{agent-fixture-5C4MCWRD.js → agent-fixture-H6GOUHNX.js} +3 -3
  13. package/dist/{agent-fixture-5C4MCWRD.js.map → agent-fixture-H6GOUHNX.js.map} +0 -0
  14. package/dist/{allure-FGVR5LND.js → allure-XOM7BXL5.js} +5 -2
  15. package/dist/{allure-FGVR5LND.js.map → allure-XOM7BXL5.js.map} +1 -1
  16. package/dist/{android-6BOQTMM3.js → android-C2S4B4TH.js} +3 -3
  17. package/dist/{android-6BOQTMM3.js.map → android-C2S4B4TH.js.map} +0 -0
  18. package/dist/api/agent-fixture.d.ts +119 -0
  19. package/dist/api/agent-fixture.d.ts.map +1 -0
  20. package/dist/api/app.d.ts +399 -0
  21. package/dist/api/app.d.ts.map +1 -0
  22. package/dist/api/expect.d.ts +180 -0
  23. package/dist/api/expect.d.ts.map +1 -0
  24. package/dist/api/fixtures.d.ts +165 -0
  25. package/dist/api/fixtures.d.ts.map +1 -0
  26. package/dist/api/flow.d.ts +123 -0
  27. package/dist/api/flow.d.ts.map +1 -0
  28. package/dist/api/index.d.ts +4 -0
  29. package/dist/api/index.d.ts.map +1 -0
  30. package/dist/api/snapshots.d.ts +26 -0
  31. package/dist/api/snapshots.d.ts.map +1 -0
  32. package/dist/api/storybook.d.ts +18 -0
  33. package/dist/api/storybook.d.ts.map +1 -0
  34. package/dist/api/suite.d.ts +46 -0
  35. package/dist/api/suite.d.ts.map +1 -0
  36. package/dist/app-W6PRRBMD.js +13 -0
  37. package/dist/{app-RSDPDTKT.js.map → app-W6PRRBMD.js.map} +0 -0
  38. package/dist/appium-CC77BJNK.js +935 -0
  39. package/dist/appium-CC77BJNK.js.map +1 -0
  40. package/dist/{appium-server-66GVUL24.js → appium-server-M6CWWUWF.js} +5 -2
  41. package/dist/{appium-server-66GVUL24.js.map → appium-server-M6CWWUWF.js.map} +1 -1
  42. package/dist/{baseline-manager-5TIUCNP5.js → baseline-manager-LVUVH2MJ.js} +5 -2
  43. package/dist/{baseline-manager-5TIUCNP5.js.map → baseline-manager-LVUVH2MJ.js.map} +1 -1
  44. package/dist/bridge-server-S3DHK7XE.js +12 -0
  45. package/dist/{cache-command-PANUAEMZ.js.map → bridge-server-S3DHK7XE.js.map} +0 -0
  46. package/dist/{cache-command-PANUAEMZ.js → cache-command-OL7HUK2K.js} +3 -3
  47. package/dist/{chunk-DGUM43GV.js.map → cache-command-OL7HUK2K.js.map} +0 -0
  48. package/dist/channels/android-cdp.d.ts +71 -0
  49. package/dist/channels/android-cdp.d.ts.map +1 -0
  50. package/dist/channels/apple-webinspector.d.ts +85 -0
  51. package/dist/channels/apple-webinspector.d.ts.map +1 -0
  52. package/dist/channels/bidi-client.d.ts +79 -0
  53. package/dist/channels/bidi-client.d.ts.map +1 -0
  54. package/dist/channels/bridge-server.d.ts +69 -0
  55. package/dist/channels/bridge-server.d.ts.map +1 -0
  56. package/dist/channels/cdp-client.d.ts +115 -0
  57. package/dist/channels/cdp-client.d.ts.map +1 -0
  58. package/dist/channels/dom-channel.d.ts +246 -0
  59. package/dist/channels/dom-channel.d.ts.map +1 -0
  60. package/dist/channels/index.d.ts +8 -0
  61. package/dist/channels/index.d.ts.map +1 -0
  62. package/dist/channels/webkit-inspector.d.ts +85 -0
  63. package/dist/channels/webkit-inspector.d.ts.map +1 -0
  64. package/dist/channels/ws-server.d.ts +21 -0
  65. package/dist/channels/ws-server.d.ts.map +1 -0
  66. package/dist/chunk-27H6NDA5.js +845 -0
  67. package/dist/chunk-27H6NDA5.js.map +1 -0
  68. package/dist/{chunk-WV3ALL3H.js → chunk-2MA5G2VH.js} +6 -2
  69. package/dist/{chunk-WV3ALL3H.js.map → chunk-2MA5G2VH.js.map} +1 -1
  70. package/dist/chunk-4LJ3KYCX.js +94 -0
  71. package/dist/chunk-4LJ3KYCX.js.map +1 -0
  72. package/dist/chunk-5SDVP53E.js +1046 -0
  73. package/dist/chunk-5SDVP53E.js.map +1 -0
  74. package/dist/{chunk-FPQAJNE3.js → chunk-5T7LSBDM.js} +288 -101
  75. package/dist/chunk-5T7LSBDM.js.map +1 -0
  76. package/dist/chunk-6C2EILMC.js +2589 -0
  77. package/dist/chunk-6C2EILMC.js.map +1 -0
  78. package/dist/{chunk-3IZMPNE7.js → chunk-7IUD55GY.js} +1333 -941
  79. package/dist/chunk-7IUD55GY.js.map +1 -0
  80. package/dist/{chunk-JPZCZHL4.js → chunk-7Q7TSUNL.js} +6 -1
  81. package/dist/{chunk-JPZCZHL4.js.map → chunk-7Q7TSUNL.js.map} +1 -1
  82. package/dist/{chunk-X2TJP7LB.js → chunk-7WHQIQPM.js} +11 -1
  83. package/dist/chunk-7WHQIQPM.js.map +1 -0
  84. package/dist/chunk-A7Z52TDQ.js +97 -0
  85. package/dist/chunk-A7Z52TDQ.js.map +1 -0
  86. package/dist/{chunk-WZAQANN6.js → chunk-BUNMIMGA.js} +9 -3
  87. package/dist/{chunk-WZAQANN6.js.map → chunk-BUNMIMGA.js.map} +1 -1
  88. package/dist/chunk-DMF2BPPA.js +547 -0
  89. package/dist/chunk-DMF2BPPA.js.map +1 -0
  90. package/dist/{chunk-Z6K4QQAR.js → chunk-FHCOPLYB.js} +36 -7
  91. package/dist/chunk-FHCOPLYB.js.map +1 -0
  92. package/dist/{chunk-3SH5JQF7.js → chunk-FSPMFRJO.js} +6 -1
  93. package/dist/{chunk-3SH5JQF7.js.map → chunk-FSPMFRJO.js.map} +1 -1
  94. package/dist/chunk-FTXUQMGH.js +56 -0
  95. package/dist/chunk-FTXUQMGH.js.map +1 -0
  96. package/dist/chunk-FUXFXFBM.js +1962 -0
  97. package/dist/chunk-FUXFXFBM.js.map +1 -0
  98. package/dist/{chunk-SIJJVN2D.js → chunk-FV7ONGQ7.js} +9 -3
  99. package/dist/{chunk-SIJJVN2D.js.map → chunk-FV7ONGQ7.js.map} +1 -1
  100. package/dist/{chunk-VUNH4AJD.js → chunk-GDVHJBR2.js} +9 -5
  101. package/dist/{chunk-VUNH4AJD.js.map → chunk-GDVHJBR2.js.map} +1 -1
  102. package/dist/chunk-GLNTGHR6.js +330 -0
  103. package/dist/chunk-GLNTGHR6.js.map +1 -0
  104. package/dist/{chunk-OPTNFLBL.js → chunk-HIGFQRWM.js} +7 -1
  105. package/dist/{chunk-OPTNFLBL.js.map → chunk-HIGFQRWM.js.map} +1 -1
  106. package/dist/chunk-HJY5YN4N.js +272 -0
  107. package/dist/chunk-HJY5YN4N.js.map +1 -0
  108. package/dist/chunk-HNQLWFHL.js +40 -0
  109. package/dist/chunk-HNQLWFHL.js.map +1 -0
  110. package/dist/chunk-HUYC4OAL.js +72 -0
  111. package/dist/chunk-HUYC4OAL.js.map +1 -0
  112. package/dist/chunk-HWS3XUEF.js +109 -0
  113. package/dist/chunk-HWS3XUEF.js.map +1 -0
  114. package/dist/chunk-IDIHDVGC.js +328 -0
  115. package/dist/chunk-IDIHDVGC.js.map +1 -0
  116. package/dist/{chunk-4SA7JK5D.js → chunk-IUK3RJ6W.js} +38 -20
  117. package/dist/{chunk-4SA7JK5D.js.map → chunk-IUK3RJ6W.js.map} +1 -1
  118. package/dist/chunk-K4K2ACT2.js +179 -0
  119. package/dist/chunk-K4K2ACT2.js.map +1 -0
  120. package/dist/chunk-LKGF75QJ.js +654 -0
  121. package/dist/chunk-LKGF75QJ.js.map +1 -0
  122. package/dist/chunk-MAKZK7GY.js +935 -0
  123. package/dist/chunk-MAKZK7GY.js.map +1 -0
  124. package/dist/chunk-MPJCUL2B.js +154 -0
  125. package/dist/chunk-MPJCUL2B.js.map +1 -0
  126. package/dist/chunk-MUMIMDRJ.js +24 -0
  127. package/dist/chunk-MUMIMDRJ.js.map +1 -0
  128. package/dist/{chunk-KJPHH2TW.js → chunk-NHT3XSX3.js} +6 -1
  129. package/dist/{chunk-KJPHH2TW.js.map → chunk-NHT3XSX3.js.map} +1 -1
  130. package/dist/{chunk-6PTUVG6A.js → chunk-NWGA3R2E.js} +7 -18
  131. package/dist/chunk-NWGA3R2E.js.map +1 -0
  132. package/dist/{chunk-3FSZNKEF.js → chunk-NXET4BFJ.js} +7 -1
  133. package/dist/{chunk-3FSZNKEF.js.map → chunk-NXET4BFJ.js.map} +1 -1
  134. package/dist/chunk-PPRNCRTS.js +1104 -0
  135. package/dist/chunk-PPRNCRTS.js.map +1 -0
  136. package/dist/{chunk-64UZQP7Z.js → chunk-PRQTAIYA.js} +30 -4
  137. package/dist/chunk-PRQTAIYA.js.map +1 -0
  138. package/dist/{chunk-4KK4E3N3.js → chunk-RHQJSPOS.js} +1289 -187
  139. package/dist/chunk-RHQJSPOS.js.map +1 -0
  140. package/dist/{chunk-CY3DKTBZ.js → chunk-RIXZISMX.js} +6 -1
  141. package/dist/{chunk-CY3DKTBZ.js.map → chunk-RIXZISMX.js.map} +1 -1
  142. package/dist/{chunk-S7MSBZ3F.js → chunk-TFEXYI6N.js} +6 -1
  143. package/dist/{chunk-S7MSBZ3F.js.map → chunk-TFEXYI6N.js.map} +1 -1
  144. package/dist/chunk-U56N5JCJ.js +19842 -0
  145. package/dist/chunk-U56N5JCJ.js.map +1 -0
  146. package/dist/{chunk-IHVZKQQW.js → chunk-UKUXNFQP.js} +6 -1
  147. package/dist/{chunk-IHVZKQQW.js.map → chunk-UKUXNFQP.js.map} +1 -1
  148. package/dist/{chunk-SGZMO456.js → chunk-VWJNINPX.js} +667 -123
  149. package/dist/chunk-VWJNINPX.js.map +1 -0
  150. package/dist/chunk-WFC4DCFF.js +529 -0
  151. package/dist/chunk-WFC4DCFF.js.map +1 -0
  152. package/dist/{chunk-26NJXP55.js → chunk-WJH5K42V.js} +6 -2
  153. package/dist/{chunk-26NJXP55.js.map → chunk-WJH5K42V.js.map} +1 -1
  154. package/dist/chunk-X5FRYDZ3.js +91 -0
  155. package/dist/chunk-X5FRYDZ3.js.map +1 -0
  156. package/dist/{chunk-VP6V4XEJ.js → chunk-XD6A3VXB.js} +10 -5
  157. package/dist/{chunk-VP6V4XEJ.js.map → chunk-XD6A3VXB.js.map} +1 -1
  158. package/dist/{chunk-2AFWVHQK.js → chunk-XVL4FHXA.js} +6 -1
  159. package/dist/{chunk-2AFWVHQK.js.map → chunk-XVL4FHXA.js.map} +1 -1
  160. package/dist/chunk-YFTHJRDO.js +37 -0
  161. package/dist/chunk-YFTHJRDO.js.map +1 -0
  162. package/dist/{chunk-LAMTF4LX.js → chunk-ZIETAMAD.js} +6 -1
  163. package/dist/{chunk-LAMTF4LX.js.map → chunk-ZIETAMAD.js.map} +1 -1
  164. package/dist/cli/cache-command.d.ts +29 -0
  165. package/dist/cli/cache-command.d.ts.map +1 -0
  166. package/dist/cli/command-errors.d.ts +7 -0
  167. package/dist/cli/command-errors.d.ts.map +1 -0
  168. package/dist/cli/config-loader.d.ts +11 -0
  169. package/dist/cli/config-loader.d.ts.map +1 -0
  170. package/dist/cli/doctor-command.d.ts +64 -0
  171. package/dist/cli/doctor-command.d.ts.map +1 -0
  172. package/dist/cli/gen-types-command.d.ts +2 -0
  173. package/dist/cli/gen-types-command.d.ts.map +1 -0
  174. package/dist/cli/index.d.ts +2 -0
  175. package/dist/cli/index.d.ts.map +1 -0
  176. package/dist/cli/init-command.d.ts +7 -0
  177. package/dist/cli/init-command.d.ts.map +1 -0
  178. package/dist/cli/init-flow-command.d.ts +11 -0
  179. package/dist/cli/init-flow-command.d.ts.map +1 -0
  180. package/dist/cli/iteration.d.ts +44 -0
  181. package/dist/cli/iteration.d.ts.map +1 -0
  182. package/dist/cli/scaffolds.d.ts +13 -0
  183. package/dist/cli/scaffolds.d.ts.map +1 -0
  184. package/dist/cli/studio-command.d.ts +8 -0
  185. package/dist/cli/studio-command.d.ts.map +1 -0
  186. package/dist/cli/test-command.d.ts +61 -0
  187. package/dist/cli/test-command.d.ts.map +1 -0
  188. package/dist/cli/watch-mode.d.ts +9 -0
  189. package/dist/cli/watch-mode.d.ts.map +1 -0
  190. package/dist/cli.js +86 -30
  191. package/dist/cli.js.map +1 -1
  192. package/dist/cloud/browserstack.d.ts +9 -0
  193. package/dist/cloud/browserstack.d.ts.map +1 -0
  194. package/dist/cloud/common.d.ts +26 -0
  195. package/dist/cloud/common.d.ts.map +1 -0
  196. package/dist/cloud/provider.d.ts +21 -0
  197. package/dist/cloud/provider.d.ts.map +1 -0
  198. package/dist/cloud/saucelabs.d.ts +9 -0
  199. package/dist/cloud/saucelabs.d.ts.map +1 -0
  200. package/dist/{compiler-X6WTFMYF.js → compiler-44UW2FID.js} +7 -3
  201. package/dist/{compiler-X6WTFMYF.js.map → compiler-44UW2FID.js.map} +1 -1
  202. package/dist/config-loader-7W7OEWRG.js +10 -0
  203. package/dist/{config-loader-CNGIW2XK.js.map → config-loader-7W7OEWRG.js.map} +0 -0
  204. package/dist/{console-DIYEJSSP.js → console-T6TVZ65G.js} +8 -2
  205. package/dist/console-T6TVZ65G.js.map +1 -0
  206. package/dist/core/accessibility-audit.d.ts +29 -0
  207. package/dist/core/accessibility-audit.d.ts.map +1 -0
  208. package/dist/core/artifacts.d.ts +27 -0
  209. package/dist/core/artifacts.d.ts.map +1 -0
  210. package/dist/core/baseline-manager.d.ts +18 -0
  211. package/dist/core/baseline-manager.d.ts.map +1 -0
  212. package/dist/core/benchmark.d.ts +21 -0
  213. package/dist/core/benchmark.d.ts.map +1 -0
  214. package/dist/core/debug-repl.d.ts +17 -0
  215. package/dist/core/debug-repl.d.ts.map +1 -0
  216. package/dist/core/engine.d.ts +51 -0
  217. package/dist/core/engine.d.ts.map +1 -0
  218. package/dist/core/filters.d.ts +248 -0
  219. package/dist/core/filters.d.ts.map +1 -0
  220. package/dist/core/flow-generator.d.ts +13 -0
  221. package/dist/core/flow-generator.d.ts.map +1 -0
  222. package/dist/core/graphemes.d.ts +2 -0
  223. package/dist/core/graphemes.d.ts.map +1 -0
  224. package/dist/core/index.d.ts +6 -0
  225. package/dist/core/index.d.ts.map +1 -0
  226. package/dist/core/native-accel.d.ts +21 -0
  227. package/dist/core/native-accel.d.ts.map +1 -0
  228. package/dist/core/network-cache.d.ts +68 -0
  229. package/dist/core/network-cache.d.ts.map +1 -0
  230. package/dist/core/orchestrator.d.ts +44 -0
  231. package/dist/core/orchestrator.d.ts.map +1 -0
  232. package/dist/core/parallel.d.ts +42 -0
  233. package/dist/core/parallel.d.ts.map +1 -0
  234. package/dist/core/port-allocator.d.ts +16 -0
  235. package/dist/core/port-allocator.d.ts.map +1 -0
  236. package/dist/core/projects.d.ts +60 -0
  237. package/dist/core/projects.d.ts.map +1 -0
  238. package/dist/core/replay-cache.d.ts +127 -0
  239. package/dist/core/replay-cache.d.ts.map +1 -0
  240. package/dist/core/runner.d.ts +50 -0
  241. package/dist/core/runner.d.ts.map +1 -0
  242. package/dist/core/screenshot-compare.d.ts +50 -0
  243. package/dist/core/screenshot-compare.d.ts.map +1 -0
  244. package/dist/core/session-manager.d.ts +35 -0
  245. package/dist/core/session-manager.d.ts.map +1 -0
  246. package/dist/core/step-recorder.d.ts +20 -0
  247. package/dist/core/step-recorder.d.ts.map +1 -0
  248. package/dist/core/target-matrix.d.ts +29 -0
  249. package/dist/core/target-matrix.d.ts.map +1 -0
  250. package/dist/core/trace-viewer.d.ts +91 -0
  251. package/dist/core/trace-viewer.d.ts.map +1 -0
  252. package/dist/core/validator.d.ts +18 -0
  253. package/dist/core/validator.d.ts.map +1 -0
  254. package/dist/core/video-recorder.d.ts +120 -0
  255. package/dist/core/video-recorder.d.ts.map +1 -0
  256. package/dist/core/worker-pool.d.ts +87 -0
  257. package/dist/core/worker-pool.d.ts.map +1 -0
  258. package/dist/{daemon-manager-2EQDVUVM.js → daemon-manager-2SK5PHJR.js} +3 -3
  259. package/dist/{daemon-manager-2EQDVUVM.js.map → daemon-manager-2SK5PHJR.js.map} +0 -0
  260. package/dist/device/android.d.ts +66 -0
  261. package/dist/device/android.d.ts.map +1 -0
  262. package/dist/device/discover.d.ts +15 -0
  263. package/dist/device/discover.d.ts.map +1 -0
  264. package/dist/device/index.d.ts +4 -0
  265. package/dist/device/index.d.ts.map +1 -0
  266. package/dist/device/ios.d.ts +126 -0
  267. package/dist/device/ios.d.ts.map +1 -0
  268. package/dist/diagnostics/live-inspector.d.ts +121 -0
  269. package/dist/diagnostics/live-inspector.d.ts.map +1 -0
  270. package/dist/diagnostics/native-logs.d.ts +38 -0
  271. package/dist/diagnostics/native-logs.d.ts.map +1 -0
  272. package/dist/discover-6ULCTB5T.js +15 -0
  273. package/dist/{discover-NKDMB4UI.js.map → discover-6ULCTB5T.js.map} +0 -0
  274. package/dist/{doctor-command-6ZVJWCW7.js → doctor-command-4CQQLB7M.js} +24 -14
  275. package/dist/{doctor-command-6ZVJWCW7.js.map → doctor-command-4CQQLB7M.js.map} +1 -1
  276. package/dist/driver-3MEIFYST.js +19 -0
  277. package/dist/{filters-MQG2RMPX.js.map → driver-3MEIFYST.js.map} +0 -0
  278. package/dist/driver-QTIAADUZ.js +19 -0
  279. package/dist/{github-pr-YMWIPCCZ.js.map → driver-QTIAADUZ.js.map} +0 -0
  280. package/dist/drivers/adapter-registry.d.ts +96 -0
  281. package/dist/drivers/adapter-registry.d.ts.map +1 -0
  282. package/dist/drivers/appium/android.d.ts +22 -0
  283. package/dist/drivers/appium/android.d.ts.map +1 -0
  284. package/dist/drivers/appium/client.d.ts +26 -0
  285. package/dist/drivers/appium/client.d.ts.map +1 -0
  286. package/dist/drivers/appium/ios.d.ts +28 -0
  287. package/dist/drivers/appium/ios.d.ts.map +1 -0
  288. package/dist/drivers/appium/window-size.d.ts +8 -0
  289. package/dist/drivers/appium/window-size.d.ts.map +1 -0
  290. package/dist/drivers/browser-extensions.d.ts +62 -0
  291. package/dist/drivers/browser-extensions.d.ts.map +1 -0
  292. package/dist/drivers/cdp-browser.d.ts +129 -0
  293. package/dist/drivers/cdp-browser.d.ts.map +1 -0
  294. package/dist/drivers/common/xml-tokenizer.d.ts +26 -0
  295. package/dist/drivers/common/xml-tokenizer.d.ts.map +1 -0
  296. package/dist/drivers/device-controls.d.ts +36 -0
  297. package/dist/drivers/device-controls.d.ts.map +1 -0
  298. package/dist/drivers/electrobun.d.ts +47 -0
  299. package/dist/drivers/electrobun.d.ts.map +1 -0
  300. package/dist/drivers/electron.d.ts +36 -0
  301. package/dist/drivers/electron.d.ts.map +1 -0
  302. package/dist/drivers/index.d.ts +2 -0
  303. package/dist/drivers/index.d.ts.map +1 -0
  304. package/dist/drivers/launch-options.d.ts +10 -0
  305. package/dist/drivers/launch-options.d.ts.map +1 -0
  306. package/dist/drivers/network-profiles.d.ts +9 -0
  307. package/dist/drivers/network-profiles.d.ts.map +1 -0
  308. package/dist/drivers/playwright-parser.d.ts +16 -0
  309. package/dist/drivers/playwright-parser.d.ts.map +1 -0
  310. package/dist/drivers/playwright.d.ts +65 -0
  311. package/dist/drivers/playwright.d.ts.map +1 -0
  312. package/dist/drivers/raw-driver.d.ts +403 -0
  313. package/dist/drivers/raw-driver.d.ts.map +1 -0
  314. package/dist/drivers/uiautomator2/client.d.ts +77 -0
  315. package/dist/drivers/uiautomator2/client.d.ts.map +1 -0
  316. package/dist/drivers/uiautomator2/driver.d.ts +20 -0
  317. package/dist/drivers/uiautomator2/driver.d.ts.map +1 -0
  318. package/dist/drivers/uiautomator2/index.d.ts +5 -0
  319. package/dist/drivers/uiautomator2/index.d.ts.map +1 -0
  320. package/dist/drivers/uiautomator2/installer.d.ts +20 -0
  321. package/dist/drivers/uiautomator2/installer.d.ts.map +1 -0
  322. package/dist/drivers/uiautomator2/pagesource.d.ts +12 -0
  323. package/dist/drivers/uiautomator2/pagesource.d.ts.map +1 -0
  324. package/dist/drivers/wasm-utils.d.ts +100 -0
  325. package/dist/drivers/wasm-utils.d.ts.map +1 -0
  326. package/dist/drivers/wasm.d.ts +57 -0
  327. package/dist/drivers/wasm.d.ts.map +1 -0
  328. package/dist/drivers/wda/client.d.ts +116 -0
  329. package/dist/drivers/wda/client.d.ts.map +1 -0
  330. package/dist/drivers/wda/driver.d.ts +26 -0
  331. package/dist/drivers/wda/driver.d.ts.map +1 -0
  332. package/dist/drivers/wda/index.d.ts +5 -0
  333. package/dist/drivers/wda/index.d.ts.map +1 -0
  334. package/dist/drivers/wda/installer.d.ts +51 -0
  335. package/dist/drivers/wda/installer.d.ts.map +1 -0
  336. package/dist/drivers/wda/pagesource.d.ts +12 -0
  337. package/dist/drivers/wda/pagesource.d.ts.map +1 -0
  338. package/dist/electrobun-MPAHMSI2.js +15 -0
  339. package/dist/{installer-5UHTYQTB.js.map → electrobun-MPAHMSI2.js.map} +0 -0
  340. package/dist/electron-SQACDON3.js +9 -0
  341. package/dist/{ios-Y4TO5MBR.js.map → electron-SQACDON3.js.map} +0 -0
  342. package/dist/errors.d.ts +82 -0
  343. package/dist/errors.d.ts.map +1 -0
  344. package/dist/{filters-MQG2RMPX.js → filters-5DCGGJRN.js} +3 -3
  345. package/dist/{local-DM3YBSV5.js.map → filters-5DCGGJRN.js.map} +0 -0
  346. package/dist/gherkin/compiler.d.ts +3 -0
  347. package/dist/gherkin/compiler.d.ts.map +1 -0
  348. package/dist/gherkin/index.d.ts +7 -0
  349. package/dist/gherkin/index.d.ts.map +1 -0
  350. package/dist/gherkin/matcher.d.ts +9 -0
  351. package/dist/gherkin/matcher.d.ts.map +1 -0
  352. package/dist/gherkin/registry.d.ts +28 -0
  353. package/dist/gherkin/registry.d.ts.map +1 -0
  354. package/dist/gherkin/steps.d.ts +13 -31
  355. package/dist/gherkin/steps.d.ts.map +1 -0
  356. package/dist/gherkin/steps.js +5 -2
  357. package/dist/gherkin/steps.js.map +1 -1
  358. package/dist/gherkin/world.d.ts +15 -0
  359. package/dist/gherkin/world.d.ts.map +1 -0
  360. package/dist/{github-pr-YMWIPCCZ.js → github-pr-RYO6IAKD.js} +3 -3
  361. package/dist/{machine-6H25TRTU.js.map → github-pr-RYO6IAKD.js.map} +0 -0
  362. package/dist/{html-FLMWPFQD.js → html-KJ2QAGF4.js} +6 -3
  363. package/dist/{html-FLMWPFQD.js.map → html-KJ2QAGF4.js.map} +1 -1
  364. package/dist/index.d.ts +57 -2267
  365. package/dist/index.d.ts.map +1 -0
  366. package/dist/index.js +460 -69
  367. package/dist/index.js.map +1 -1
  368. package/dist/{init-command-Z3QREABL.js → init-command-V5VGN3IS.js} +5 -2
  369. package/dist/{init-command-Z3QREABL.js.map → init-command-V5VGN3IS.js.map} +1 -1
  370. package/dist/{init-flow-command-4EKRVTNT.js → init-flow-command-INYUCC6N.js} +6 -3
  371. package/dist/{init-flow-command-4EKRVTNT.js.map → init-flow-command-INYUCC6N.js.map} +1 -1
  372. package/dist/{installer-5UHTYQTB.js → installer-DMTY47SI.js} +5 -5
  373. package/dist/{provider-YIPU5K42.js.map → installer-DMTY47SI.js.map} +0 -0
  374. package/dist/installer-KL2NCILK.js +17 -0
  375. package/dist/{runner-WOVZWUQR.js.map → installer-KL2NCILK.js.map} +0 -0
  376. package/dist/{ios-Y4TO5MBR.js → ios-SZ4RBI7Q.js} +4 -4
  377. package/dist/{server-ING5D5ZJ.js.map → ios-SZ4RBI7Q.js.map} +0 -0
  378. package/dist/json-57Z2YSES.js +39 -0
  379. package/dist/json-57Z2YSES.js.map +1 -0
  380. package/dist/{junit-CGB3LKHD.js → junit-MHD5AXBU.js} +26 -6
  381. package/dist/junit-MHD5AXBU.js.map +1 -0
  382. package/dist/{local-DM3YBSV5.js → local-SWHWINSA.js} +11 -12
  383. package/dist/{session-5TNWVGQQ.js.map → local-SWHWINSA.js.map} +0 -0
  384. package/dist/{machine-6H25TRTU.js → machine-NOOFRT45.js} +3 -3
  385. package/dist/{validator-WO5IL7IY.js.map → machine-NOOFRT45.js.map} +0 -0
  386. package/dist/machine.d.ts +20 -0
  387. package/dist/machine.d.ts.map +1 -0
  388. package/dist/mcp/server.d.ts +73 -0
  389. package/dist/mcp/server.d.ts.map +1 -0
  390. package/dist/pagesource-KIQ5T5MA.js +9 -0
  391. package/dist/pagesource-KIQ5T5MA.js.map +1 -0
  392. package/dist/pagesource-KKG7WMFJ.js +9 -0
  393. package/dist/pagesource-KKG7WMFJ.js.map +1 -0
  394. package/dist/playwright-42QYIZEE.js +28 -0
  395. package/dist/playwright-42QYIZEE.js.map +1 -0
  396. package/dist/{provider-YIPU5K42.js → provider-CBAXZ2VA.js} +3 -3
  397. package/dist/provider-CBAXZ2VA.js.map +1 -0
  398. package/dist/{redact-U72BUBBR.js → redact-OG4M3IEU.js} +5 -2
  399. package/dist/{redact-U72BUBBR.js.map → redact-OG4M3IEU.js.map} +1 -1
  400. package/dist/report/allure.d.ts +3 -0
  401. package/dist/report/allure.d.ts.map +1 -0
  402. package/dist/report/classify-error.d.ts +7 -0
  403. package/dist/report/classify-error.d.ts.map +1 -0
  404. package/dist/report/code-frame.d.ts +16 -0
  405. package/dist/report/code-frame.d.ts.map +1 -0
  406. package/dist/report/console.d.ts +7 -0
  407. package/dist/report/console.d.ts.map +1 -0
  408. package/dist/report/failure-bundle.d.ts +66 -0
  409. package/dist/report/failure-bundle.d.ts.map +1 -0
  410. package/dist/report/failure-diagnostics.d.ts +11 -0
  411. package/dist/report/failure-diagnostics.d.ts.map +1 -0
  412. package/dist/report/github-pr.d.ts +20 -0
  413. package/dist/report/github-pr.d.ts.map +1 -0
  414. package/dist/report/html.d.ts +3 -0
  415. package/dist/report/html.d.ts.map +1 -0
  416. package/dist/report/index.d.ts +8 -0
  417. package/dist/report/index.d.ts.map +1 -0
  418. package/dist/report/json.d.ts +3 -0
  419. package/dist/report/json.d.ts.map +1 -0
  420. package/dist/report/junit.d.ts +3 -0
  421. package/dist/report/junit.d.ts.map +1 -0
  422. package/dist/report/redact.d.ts +29 -0
  423. package/dist/report/redact.d.ts.map +1 -0
  424. package/dist/report/selector-guardrails.d.ts +12 -0
  425. package/dist/report/selector-guardrails.d.ts.map +1 -0
  426. package/dist/report/types.d.ts +164 -0
  427. package/dist/report/types.d.ts.map +1 -0
  428. package/dist/{runner-WOVZWUQR.js → runner-ABGUVOJG.js} +5 -3
  429. package/dist/runner-ABGUVOJG.js.map +1 -0
  430. package/dist/runtime/appium-server.d.ts +34 -0
  431. package/dist/runtime/appium-server.d.ts.map +1 -0
  432. package/dist/runtime/appium.d.ts +5 -0
  433. package/dist/runtime/appium.d.ts.map +1 -0
  434. package/dist/runtime/capabilities.d.ts +19 -0
  435. package/dist/runtime/capabilities.d.ts.map +1 -0
  436. package/dist/runtime/daemon-manager.d.ts +83 -0
  437. package/dist/runtime/daemon-manager.d.ts.map +1 -0
  438. package/dist/runtime/local.d.ts +38 -0
  439. package/dist/runtime/local.d.ts.map +1 -0
  440. package/dist/runtime/types.d.ts +21 -0
  441. package/dist/runtime/types.d.ts.map +1 -0
  442. package/dist/runtime/web-server.d.ts +57 -0
  443. package/dist/runtime/web-server.d.ts.map +1 -0
  444. package/dist/schemas/config.d.ts +812 -0
  445. package/dist/schemas/config.d.ts.map +1 -0
  446. package/dist/schemas/device.d.ts +12 -0
  447. package/dist/schemas/device.d.ts.map +1 -0
  448. package/dist/schemas/element.d.ts +66 -0
  449. package/dist/schemas/element.d.ts.map +1 -0
  450. package/dist/schemas/index.d.ts +5 -0
  451. package/dist/schemas/index.d.ts.map +1 -0
  452. package/dist/schemas/selector.d.ts +193 -0
  453. package/dist/schemas/selector.d.ts.map +1 -0
  454. package/dist/screenshot-compare-BJRJHKNQ.js +12 -0
  455. package/dist/screenshot-compare-BJRJHKNQ.js.map +1 -0
  456. package/dist/server-2Y46CDVB.js +6749 -0
  457. package/dist/server-2Y46CDVB.js.map +1 -0
  458. package/dist/{server-ING5D5ZJ.js → server-ZCBZ4UYF.js} +3 -3
  459. package/dist/server-ZCBZ4UYF.js.map +1 -0
  460. package/dist/session-5XW6TKF4.js +39 -0
  461. package/dist/session-5XW6TKF4.js.map +1 -0
  462. package/dist/smart/auto-wait.d.ts +38 -0
  463. package/dist/smart/auto-wait.d.ts.map +1 -0
  464. package/dist/smart/channel-resolver.d.ts +90 -0
  465. package/dist/smart/channel-resolver.d.ts.map +1 -0
  466. package/dist/smart/coordinator.d.ts +162 -0
  467. package/dist/smart/coordinator.d.ts.map +1 -0
  468. package/dist/smart/diagnostics.d.ts +15 -0
  469. package/dist/smart/diagnostics.d.ts.map +1 -0
  470. package/dist/smart/element-matcher.d.ts +24 -0
  471. package/dist/smart/element-matcher.d.ts.map +1 -0
  472. package/dist/smart/hierarchy-cache.d.ts +16 -0
  473. package/dist/smart/hierarchy-cache.d.ts.map +1 -0
  474. package/dist/smart/index.d.ts +4 -0
  475. package/dist/smart/index.d.ts.map +1 -0
  476. package/dist/studio/api.d.ts +317 -0
  477. package/dist/studio/api.d.ts.map +1 -0
  478. package/dist/studio/context.d.ts +7 -0
  479. package/dist/studio/context.d.ts.map +1 -0
  480. package/dist/studio/core/element-tree.d.ts +15 -0
  481. package/dist/studio/core/element-tree.d.ts.map +1 -0
  482. package/dist/studio/effect-handler.d.ts +3 -0
  483. package/dist/studio/effect-handler.d.ts.map +1 -0
  484. package/dist/studio/procedures.d.ts +4 -0
  485. package/dist/studio/procedures.d.ts.map +1 -0
  486. package/dist/studio/recording-session.d.ts +31 -0
  487. package/dist/studio/recording-session.d.ts.map +1 -0
  488. package/dist/studio/routers/devices.d.ts +11 -0
  489. package/dist/studio/routers/devices.d.ts.map +1 -0
  490. package/dist/studio/routers/inspector.d.ts +104 -0
  491. package/dist/studio/routers/inspector.d.ts.map +1 -0
  492. package/dist/studio/routers/recording.d.ts +130 -0
  493. package/dist/studio/routers/recording.d.ts.map +1 -0
  494. package/dist/studio/routers/tests.d.ts +93 -0
  495. package/dist/studio/routers/tests.d.ts.map +1 -0
  496. package/dist/studio/server.d.ts +12 -0
  497. package/dist/studio/server.d.ts.map +1 -0
  498. package/dist/{studio-command-KK7A3KN6.js → studio-command-BNBOL424.js} +6 -3
  499. package/dist/{studio-command-KK7A3KN6.js.map → studio-command-BNBOL424.js.map} +1 -1
  500. package/dist/{test-command-QGIJBRH7.js → test-command-T4PLAZXU.js} +311 -1080
  501. package/dist/test-command-T4PLAZXU.js.map +1 -0
  502. package/dist/{validator-WO5IL7IY.js → validator-AJNOFBQM.js} +4 -4
  503. package/dist/validator-AJNOFBQM.js.map +1 -0
  504. package/dist/watch-mode-NR5MHNNL.js +10 -0
  505. package/dist/watch-mode-NR5MHNNL.js.map +1 -0
  506. package/native/darwin-arm64/libspana_native.dylib +0 -0
  507. package/native/darwin-x64/libspana_native.dylib +0 -0
  508. package/native/linux-arm64/libspana_native.so +0 -0
  509. package/native/linux-x64/libspana_native.so +0 -0
  510. package/native/win32-x64/spana_native.dll +0 -0
  511. package/package.json +16 -19
  512. package/studio-dist/assets/index-CHLA4F7b.css +2 -0
  513. package/studio-dist/assets/index-DXGUfzm3.js +23 -0
  514. package/studio-dist/index.html +2 -2
  515. package/dist/accessibility-audit-YZOPUY3D.js.map +0 -1
  516. package/dist/app-RSDPDTKT.js +0 -10
  517. package/dist/chunk-3IZMPNE7.js.map +0 -1
  518. package/dist/chunk-4KK4E3N3.js.map +0 -1
  519. package/dist/chunk-54ASKII6.js +0 -183
  520. package/dist/chunk-54ASKII6.js.map +0 -1
  521. package/dist/chunk-64UZQP7Z.js.map +0 -1
  522. package/dist/chunk-6PTUVG6A.js.map +0 -1
  523. package/dist/chunk-DGUM43GV.js +0 -11
  524. package/dist/chunk-FPQAJNE3.js.map +0 -1
  525. package/dist/chunk-FXBWACUT.js +0 -4378
  526. package/dist/chunk-FXBWACUT.js.map +0 -1
  527. package/dist/chunk-SGZMO456.js.map +0 -1
  528. package/dist/chunk-WS2TVNMY.js +0 -2494
  529. package/dist/chunk-WS2TVNMY.js.map +0 -1
  530. package/dist/chunk-X2TJP7LB.js.map +0 -1
  531. package/dist/chunk-XA6LWLZQ.js +0 -310
  532. package/dist/chunk-XA6LWLZQ.js.map +0 -1
  533. package/dist/chunk-Z6K4QQAR.js.map +0 -1
  534. package/dist/config-loader-CNGIW2XK.js +0 -9
  535. package/dist/console-DIYEJSSP.js.map +0 -1
  536. package/dist/discover-NKDMB4UI.js +0 -15
  537. package/dist/flow-DddAj1xv.d.ts +0 -1913
  538. package/dist/json-JMRPUVY2.js +0 -20
  539. package/dist/json-JMRPUVY2.js.map +0 -1
  540. package/dist/junit-CGB3LKHD.js.map +0 -1
  541. package/dist/screenshot-compare-POTXVUTL.js +0 -136
  542. package/dist/screenshot-compare-POTXVUTL.js.map +0 -1
  543. package/dist/server-JNQ2PLCC.js +0 -855
  544. package/dist/server-JNQ2PLCC.js.map +0 -1
  545. package/dist/session-5TNWVGQQ.js +0 -21
  546. package/dist/test-command-QGIJBRH7.js.map +0 -1
  547. package/studio-dist/assets/index-CBFsOh-9.js +0 -193
  548. package/studio-dist/assets/index-DH_18EyL.css +0 -1
@@ -0,0 +1,935 @@
1
+ import {
2
+ SPANA_INJECTED_RUNTIME_SCRIPT,
3
+ SPANA_RUNTIME_MISSING_SENTINEL,
4
+ buildDomFillScript,
5
+ buildDomQueryScript,
6
+ buildDomScrollIntoViewScript,
7
+ buildDomTapScript,
8
+ buildDomWaitForHiddenScript,
9
+ buildDomWaitForMatchScript,
10
+ buildDomWaitForSelectorScript,
11
+ buildEvaluateExpression,
12
+ buildInjectedCallScript
13
+ } from "./chunk-VWJNINPX.js";
14
+ import {
15
+ init_esm_shims
16
+ } from "./chunk-FTXUQMGH.js";
17
+
18
+ // src/channels/cdp-client.ts
19
+ init_esm_shims();
20
+ var WS_OPEN = 1;
21
+ function defaultWebSocketFactory(url) {
22
+ return new WebSocket(url);
23
+ }
24
+ function selectCdpTarget(targets, filter) {
25
+ const attachable = targets.filter((t) => Boolean(t.webSocketDebuggerUrl));
26
+ if (attachable.length === 0) return void 0;
27
+ if (filter) {
28
+ const matched = attachable.find((t) => {
29
+ const hay = `${t.title ?? ""} ${t.url ?? ""}`;
30
+ return typeof filter === "string" ? hay.includes(filter) : filter.test(hay);
31
+ });
32
+ if (matched) return matched;
33
+ }
34
+ const pageTarget = attachable.find(
35
+ (t) => (t.type === "page" || t.type === "webview" || !t.type) && !(t.url ?? "").startsWith("devtools://")
36
+ );
37
+ return pageTarget ?? attachable[0];
38
+ }
39
+ var CdpDomChannel = class {
40
+ kind = "cdp";
41
+ endpointUrl;
42
+ explicitWsUrl;
43
+ targetFilter;
44
+ timeoutMs;
45
+ fetchFn;
46
+ createWebSocket;
47
+ ws = null;
48
+ connected = false;
49
+ nextId = 1;
50
+ pending = /* @__PURE__ */ new Map();
51
+ eventListeners = /* @__PURE__ */ new Map();
52
+ currentTargetId = null;
53
+ activeSessionId = null;
54
+ childSessions = /* @__PURE__ */ new Map();
55
+ frameOffsetResolver;
56
+ constructor(options) {
57
+ this.endpointUrl = options.endpointUrl.replace(/\/+$/, "");
58
+ this.explicitWsUrl = options.webSocketUrl;
59
+ this.targetFilter = options.targetFilter;
60
+ this.timeoutMs = options.timeoutMs ?? 1e4;
61
+ this.fetchFn = options.fetchFn ?? fetch;
62
+ this.createWebSocket = options.createWebSocket ?? defaultWebSocketFactory;
63
+ }
64
+ isConnected() {
65
+ return this.connected && this.ws !== null && this.ws.readyState === WS_OPEN;
66
+ }
67
+ async listTargets() {
68
+ const raw = await this.fetchTargets();
69
+ return raw.map((t) => ({
70
+ id: t.id,
71
+ title: t.title,
72
+ url: t.url,
73
+ type: t.type
74
+ }));
75
+ }
76
+ async fetchTargets() {
77
+ for (const path of ["/json/list", "/json"]) {
78
+ try {
79
+ const res = await this.fetchFn(`${this.endpointUrl}${path}`);
80
+ if (!res.ok) continue;
81
+ const data = await res.json();
82
+ if (Array.isArray(data)) {
83
+ return data;
84
+ }
85
+ } catch {
86
+ }
87
+ }
88
+ throw new Error(`CDP: unable to list targets from ${this.endpointUrl}`);
89
+ }
90
+ async selectTarget(targetId) {
91
+ const targets = await this.fetchTargets();
92
+ const target = targets.find((t) => t.id === targetId && t.webSocketDebuggerUrl);
93
+ if (!target || !target.webSocketDebuggerUrl) {
94
+ throw new Error(`CDP: target "${targetId}" not found or has no webSocketDebuggerUrl`);
95
+ }
96
+ await this.disconnect();
97
+ this.currentTargetId = target.id;
98
+ await this.openSocket(target.webSocketDebuggerUrl);
99
+ }
100
+ async connect() {
101
+ if (this.isConnected()) return;
102
+ let wsUrl = this.explicitWsUrl;
103
+ if (!wsUrl) {
104
+ const targets = await this.fetchTargets();
105
+ const chosen = selectCdpTarget(targets, this.targetFilter);
106
+ if (!chosen?.webSocketDebuggerUrl) {
107
+ throw new Error(`CDP: no debuggable page/webview target found at ${this.endpointUrl}`);
108
+ }
109
+ this.currentTargetId = chosen.id;
110
+ wsUrl = chosen.webSocketDebuggerUrl;
111
+ }
112
+ await this.openSocket(wsUrl);
113
+ }
114
+ async openSocket(wsUrl) {
115
+ await new Promise((resolve, reject) => {
116
+ const ws = this.createWebSocket(wsUrl);
117
+ this.ws = ws;
118
+ let settled = false;
119
+ const timer = setTimeout(() => {
120
+ if (settled) return;
121
+ settled = true;
122
+ reject(
123
+ new Error(`CDP: WebSocket connection to ${wsUrl} timed out after ${this.timeoutMs}ms`)
124
+ );
125
+ }, this.timeoutMs);
126
+ const onOpen = () => {
127
+ if (settled) return;
128
+ settled = true;
129
+ clearTimeout(timer);
130
+ this.connected = true;
131
+ resolve();
132
+ };
133
+ const onError = (err) => {
134
+ const error = new Error(
135
+ `CDP WebSocket error: ${err instanceof Error ? err.message : String(err)}`
136
+ );
137
+ if (!settled) {
138
+ settled = true;
139
+ clearTimeout(timer);
140
+ reject(error);
141
+ }
142
+ };
143
+ const onClose = () => {
144
+ this.connected = false;
145
+ this.rejectAllPending(new Error("CDP WebSocket closed"));
146
+ };
147
+ const onMessage = (event) => {
148
+ const raw = typeof event.data === "string" ? event.data : String(event.data ?? "");
149
+ let parsed;
150
+ try {
151
+ parsed = JSON.parse(raw);
152
+ } catch {
153
+ return;
154
+ }
155
+ const id = parsed["id"];
156
+ if (typeof id === "number") {
157
+ const entry = this.pending.get(id);
158
+ if (!entry) return;
159
+ this.pending.delete(id);
160
+ clearTimeout(entry.timer);
161
+ if (parsed["error"]) {
162
+ const msg = parsed["error"].message ?? JSON.stringify(parsed["error"]);
163
+ entry.reject(new Error(`CDP error: ${msg}`));
164
+ } else {
165
+ entry.resolve(parsed["result"]);
166
+ }
167
+ return;
168
+ }
169
+ const method = parsed["method"];
170
+ if (typeof method === "string") {
171
+ const listeners = this.eventListeners.get(method);
172
+ if (listeners && listeners.size > 0) {
173
+ const params = parsed["params"];
174
+ const sessionId = typeof parsed["sessionId"] === "string" ? parsed["sessionId"] : void 0;
175
+ for (const fn of listeners) {
176
+ try {
177
+ fn(params, sessionId);
178
+ } catch {
179
+ }
180
+ }
181
+ }
182
+ }
183
+ };
184
+ ws.addEventListener("open", onOpen);
185
+ ws.addEventListener("error", onError);
186
+ ws.addEventListener("close", onClose);
187
+ ws.addEventListener("message", onMessage);
188
+ if (ws.readyState === WS_OPEN) {
189
+ onOpen();
190
+ }
191
+ });
192
+ }
193
+ rejectAllPending(error) {
194
+ for (const [, entry] of this.pending) {
195
+ clearTimeout(entry.timer);
196
+ entry.reject(error);
197
+ }
198
+ this.pending.clear();
199
+ }
200
+ setSessionId(sessionId) {
201
+ this.activeSessionId = sessionId;
202
+ }
203
+ get sessionId() {
204
+ return this.activeSessionId;
205
+ }
206
+ /** Register an attached cross-origin iframe (OOPIF) flattened CDP session. */
207
+ addChildSession(sessionId, meta) {
208
+ this.childSessions.set(sessionId, { sessionId, ...meta });
209
+ }
210
+ removeChildSession(sessionId) {
211
+ this.childSessions.delete(sessionId);
212
+ }
213
+ clearChildSessions() {
214
+ this.childSessions.clear();
215
+ }
216
+ getChildSessions() {
217
+ return Array.from(this.childSessions.values());
218
+ }
219
+ useInjectedRuntime = false;
220
+ enableInjectedRuntime(enabled = true) {
221
+ this.useInjectedRuntime = enabled;
222
+ }
223
+ async invokeDom(sessionId, method, args, fallbackScript, timeoutMs) {
224
+ if (!this.useInjectedRuntime) {
225
+ return this.evaluateOnSessionWithTimeout(sessionId, fallbackScript(), timeoutMs);
226
+ }
227
+ const callExpr = buildInjectedCallScript(method, ...args);
228
+ const res = await this.evaluateOnSessionWithTimeout(
229
+ sessionId,
230
+ callExpr,
231
+ timeoutMs
232
+ );
233
+ if (res !== SPANA_RUNTIME_MISSING_SENTINEL) {
234
+ return res;
235
+ }
236
+ await this.evaluateOnSessionWithTimeout(sessionId, SPANA_INJECTED_RUNTIME_SCRIPT, timeoutMs);
237
+ return this.evaluateOnSessionWithTimeout(sessionId, callExpr, timeoutMs);
238
+ }
239
+ setFrameOffsetResolver(resolver) {
240
+ this.frameOffsetResolver = resolver;
241
+ }
242
+ onEvent(method, listener) {
243
+ let set = this.eventListeners.get(method);
244
+ if (!set) {
245
+ set = /* @__PURE__ */ new Set();
246
+ this.eventListeners.set(method, set);
247
+ }
248
+ set.add(listener);
249
+ return () => {
250
+ set?.delete(listener);
251
+ };
252
+ }
253
+ waitForEvent(method, timeoutMs = this.timeoutMs, predicate) {
254
+ return new Promise((resolve, reject) => {
255
+ const timer = setTimeout(() => {
256
+ off();
257
+ reject(new Error(`CDP event "${method}" timed out after ${timeoutMs}ms`));
258
+ }, timeoutMs);
259
+ const off = this.onEvent(method, (params, sessionId) => {
260
+ if (predicate && !predicate(params, sessionId)) return;
261
+ clearTimeout(timer);
262
+ off();
263
+ resolve(params);
264
+ });
265
+ });
266
+ }
267
+ async sendCommand(method, params = {}, sessionId, timeoutMs) {
268
+ if (!this.isConnected()) {
269
+ await this.connect();
270
+ }
271
+ const ws = this.ws;
272
+ const id = this.nextId++;
273
+ const resolvedSessionId = sessionId === void 0 ? this.activeSessionId : sessionId;
274
+ const effectiveTimeout = timeoutMs ?? this.timeoutMs;
275
+ return new Promise((resolve, reject) => {
276
+ const timer = setTimeout(() => {
277
+ this.pending.delete(id);
278
+ reject(new Error(`CDP command "${method}" timed out after ${effectiveTimeout}ms`));
279
+ }, effectiveTimeout);
280
+ this.pending.set(id, { resolve, reject, timer });
281
+ const payload = { id, method, params };
282
+ if (resolvedSessionId) {
283
+ payload["sessionId"] = resolvedSessionId;
284
+ }
285
+ ws.send(JSON.stringify(payload));
286
+ });
287
+ }
288
+ async evaluateOnSessionWithTimeout(sessionId, script, timeoutMs, args = [], contextId, maxAttempts = 3) {
289
+ const expression = buildEvaluateExpression(script, args);
290
+ const effectiveTimeout = timeoutMs ?? this.timeoutMs;
291
+ const deadline = Date.now() + effectiveTimeout;
292
+ let lastError;
293
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
294
+ const remaining = Math.max(250, deadline - Date.now());
295
+ try {
296
+ const evalParams = {
297
+ expression,
298
+ returnByValue: true,
299
+ awaitPromise: true
300
+ };
301
+ if (contextId !== void 0) {
302
+ evalParams["contextId"] = contextId;
303
+ }
304
+ const response = await this.sendCommand("Runtime.evaluate", evalParams, sessionId, remaining);
305
+ if (response?.exceptionDetails) {
306
+ const detail = response.exceptionDetails.exception?.description ?? response.exceptionDetails.text ?? "Evaluation threw an exception";
307
+ throw new Error(`CDP evaluate failed: ${detail}`);
308
+ }
309
+ if (response?.wasThrown) {
310
+ throw new Error(
311
+ `CDP evaluate failed: ${response.result?.description ?? "Evaluation threw an exception"}`
312
+ );
313
+ }
314
+ return response?.result?.value;
315
+ } catch (err) {
316
+ const msg = err instanceof Error ? err.message : String(err);
317
+ const isContextDestroyed = /Execution context was destroyed|Cannot find context with specified id|Inspected target navigated or closed/i.test(
318
+ msg
319
+ );
320
+ if (isContextDestroyed && attempt < maxAttempts - 1 && Date.now() < deadline) {
321
+ lastError = new Error(
322
+ `CDP evaluate failed because navigation destroyed the execution context: ${msg}`
323
+ );
324
+ await new Promise((r) => setTimeout(r, 80));
325
+ continue;
326
+ }
327
+ throw err;
328
+ }
329
+ }
330
+ throw lastError ?? new Error("CDP evaluate failed: execution context was destroyed");
331
+ }
332
+ /** Single-attempt evaluate that fails immediately on navigation instead of sleeping/retrying. */
333
+ async evaluateFast(script, ...args) {
334
+ return this.evaluateOnSessionWithTimeout(void 0, script, 2e3, args, void 0, 1);
335
+ }
336
+ async evaluateOnSession(sessionId, script, ...args) {
337
+ return this.evaluateOnSessionWithTimeout(sessionId, script, void 0, args);
338
+ }
339
+ async evaluate(script, ...args) {
340
+ return this.evaluateOnSession(void 0, script, ...args);
341
+ }
342
+ async applyChildOffset(matches, child) {
343
+ const offset = this.frameOffsetResolver ? await this.frameOffsetResolver(child).catch(() => ({ x: 0, y: 0 })) : { x: 0, y: 0 };
344
+ return matches.map((m) => ({
345
+ ...m,
346
+ inIframe: true,
347
+ rect: {
348
+ ...m.rect,
349
+ x: m.rect.x + offset.x,
350
+ y: m.rect.y + offset.y
351
+ }
352
+ }));
353
+ }
354
+ hasExplicitFrame(selector) {
355
+ return typeof selector === "object" && selector !== null && "frame" in selector && Boolean(selector.frame);
356
+ }
357
+ stripFrameFromSelector(selector) {
358
+ if (this.hasExplicitFrame(selector)) {
359
+ const { frame: _frame, ...rest } = selector;
360
+ return rest;
361
+ }
362
+ return selector;
363
+ }
364
+ applyFrameOffset(matches, offset) {
365
+ return matches.map((m) => ({
366
+ ...m,
367
+ inIframe: true,
368
+ rect: {
369
+ ...m.rect,
370
+ x: m.rect.x + offset.x,
371
+ y: m.rect.y + offset.y
372
+ }
373
+ }));
374
+ }
375
+ /**
376
+ * Resolve in-process cross-origin child frames (e.g. same-site subdomains such as
377
+ * `notes.app.localhost` embedded in `studio.app.localhost`). Chromium places same-site
378
+ * iframes in the same renderer process (so no OOPIF target/session is created), while
379
+ * Same-Origin Policy still blocks `iframe.contentDocument` from JS in the top document.
380
+ * Using `Page.getFrameTree` + `Page.createIsolatedWorld` accesses them cleanly via CDP.
381
+ */
382
+ async resolveInProcessChildFrames(selector) {
383
+ if (!this.hasExplicitFrame(selector)) return [];
384
+ const frameSel = selector.frame;
385
+ const treeRes = await this.sendCommand("Page.getFrameTree").catch(() => null);
386
+ if (!treeRes?.frameTree?.childFrames?.length) return [];
387
+ const flatFrames = [];
388
+ const walk = (nodes) => {
389
+ if (!Array.isArray(nodes)) return;
390
+ for (const n of nodes) {
391
+ if (n?.frame?.id) {
392
+ flatFrames.push({
393
+ id: n.frame.id,
394
+ url: n.frame.url ?? "",
395
+ name: n.frame.name ?? ""
396
+ });
397
+ }
398
+ if (n?.childFrames) walk(n.childFrames);
399
+ }
400
+ };
401
+ walk(treeRes.frameTree.childFrames);
402
+ if (flatFrames.length === 0) return [];
403
+ const iframeInfos = await this.evaluateOnSession(
404
+ void 0,
405
+ `((fSel) => {
406
+ try {
407
+ const iframes = Array.from(document.querySelectorAll("iframe"));
408
+ const matched = [];
409
+ for (const el of iframes) {
410
+ let ok = false;
411
+ if (typeof fSel === "string") {
412
+ if (el.getAttribute("title") === fSel || el.getAttribute("aria-label") === fSel || el.getAttribute("name") === fSel) ok = true;
413
+ else { try { if (el.matches(fSel)) ok = true; } catch {} }
414
+ } else if (fSel && typeof fSel === "object") {
415
+ if (fSel.css) {
416
+ try { if (el.matches(fSel.css)) ok = true; } catch {}
417
+ } else if (fSel.testID && (el.getAttribute("data-testid") === fSel.testID || el.getAttribute("testID") === fSel.testID)) {
418
+ ok = true;
419
+ } else if (fSel.accessibilityLabel && (el.getAttribute("aria-label") === fSel.accessibilityLabel || el.getAttribute("title") === fSel.accessibilityLabel)) {
420
+ ok = true;
421
+ } else if (fSel.text && (el.getAttribute("title") === fSel.text || el.getAttribute("aria-label") === fSel.text)) {
422
+ ok = true;
423
+ }
424
+ }
425
+ if (ok) {
426
+ const r = el.getBoundingClientRect();
427
+ matched.push({ src: el.src || "", name: el.getAttribute("name") || "", x: r.left, y: r.top });
428
+ }
429
+ }
430
+ return matched;
431
+ } catch { return []; }
432
+ })(${JSON.stringify(frameSel)})`
433
+ ).catch(() => []);
434
+ if (iframeInfos.length === 0) return [];
435
+ const out = [];
436
+ for (const info of iframeInfos) {
437
+ const match = flatFrames.find((f) => {
438
+ if (info.name && f.name && f.name === info.name) return true;
439
+ if (!info.src || !f.url) return false;
440
+ try {
441
+ const a = new URL(info.src);
442
+ const b = new URL(f.url);
443
+ return a.origin === b.origin && (b.pathname === a.pathname || f.url.startsWith(info.src));
444
+ } catch {
445
+ return f.url === info.src || f.url.startsWith(info.src);
446
+ }
447
+ }) ?? flatFrames.find((f) => {
448
+ if (!info.src || !f.url) return false;
449
+ try {
450
+ return new URL(info.src).origin === new URL(f.url).origin;
451
+ } catch {
452
+ return false;
453
+ }
454
+ });
455
+ if (match && !out.some((x) => x.frameId === match.id)) {
456
+ out.push({ frameId: match.id, url: match.url, offset: { x: info.x, y: info.y } });
457
+ }
458
+ }
459
+ return out;
460
+ }
461
+ async evaluateInProcessFrame(frameId, script, timeoutMs) {
462
+ const world = await this.sendCommand(
463
+ "Page.createIsolatedWorld",
464
+ {
465
+ frameId,
466
+ worldName: "spana-frame",
467
+ grantUniveralAccess: false
468
+ }
469
+ );
470
+ return this.evaluateOnSessionWithTimeout(
471
+ void 0,
472
+ script,
473
+ timeoutMs,
474
+ [],
475
+ world.executionContextId
476
+ );
477
+ }
478
+ async resolveMatchingChildSessions(selector) {
479
+ const all = Array.from(this.childSessions.values());
480
+ if (all.length === 0) return [];
481
+ if (typeof selector !== "object" || selector === null || !("frame" in selector) || !selector.frame) {
482
+ return all;
483
+ }
484
+ const frameSel = selector.frame;
485
+ const hints = [];
486
+ if (typeof frameSel === "string") hints.push(frameSel);
487
+ else if (typeof frameSel === "object" && frameSel !== null) {
488
+ if ("css" in frameSel && frameSel.css) hints.push(frameSel.css);
489
+ if ("testID" in frameSel && frameSel.testID) hints.push(frameSel.testID);
490
+ if ("accessibilityLabel" in frameSel && frameSel.accessibilityLabel) {
491
+ hints.push(frameSel.accessibilityLabel);
492
+ }
493
+ if ("text" in frameSel && frameSel.text) hints.push(frameSel.text);
494
+ }
495
+ const iframeSrcs = await this.evaluateOnSession(
496
+ void 0,
497
+ `((fSel) => {
498
+ try {
499
+ const iframes = Array.from(document.querySelectorAll("iframe"));
500
+ const matched = [];
501
+ for (const el of iframes) {
502
+ if (typeof fSel === "string") {
503
+ if (el.getAttribute("title") === fSel || el.getAttribute("aria-label") === fSel || el.getAttribute("name") === fSel || el.matches(fSel)) {
504
+ if (el.src) matched.push(el.src);
505
+ }
506
+ } else if (fSel && typeof fSel === "object") {
507
+ if (fSel.css) {
508
+ try { if (el.matches(fSel.css) && el.src) matched.push(el.src); } catch {}
509
+ } else if (fSel.testID && (el.getAttribute("data-testid") === fSel.testID || el.getAttribute("testID") === fSel.testID)) {
510
+ if (el.src) matched.push(el.src);
511
+ } else if (fSel.accessibilityLabel && (el.getAttribute("aria-label") === fSel.accessibilityLabel || el.getAttribute("title") === fSel.accessibilityLabel)) {
512
+ if (el.src) matched.push(el.src);
513
+ }
514
+ }
515
+ }
516
+ return matched;
517
+ } catch { return []; }
518
+ })(${JSON.stringify(frameSel)})`
519
+ ).catch(() => []);
520
+ if (iframeSrcs.length > 0) {
521
+ const matched = all.filter(
522
+ (c) => c.url && iframeSrcs.some((src) => {
523
+ try {
524
+ const a = new URL(src);
525
+ const b = new URL(c.url);
526
+ return a.origin === b.origin && (b.pathname === a.pathname || c.url.startsWith(src));
527
+ } catch {
528
+ return c.url.includes(src) || src.includes(c.url);
529
+ }
530
+ })
531
+ );
532
+ if (matched.length > 0) return matched;
533
+ }
534
+ if (hints.length > 0) {
535
+ const byHint = all.filter((c) => c.url && hints.some((h) => c.url.includes(h)));
536
+ if (byHint.length > 0) return byHint;
537
+ }
538
+ return all;
539
+ }
540
+ async query(selector) {
541
+ const fallback = () => buildDomQueryScript(selector);
542
+ const result = await this.invokeDom(
543
+ void 0,
544
+ "query",
545
+ [selector],
546
+ fallback
547
+ );
548
+ if (Array.isArray(result) && result.length > 0) return result;
549
+ const innerSel = this.stripFrameFromSelector(selector);
550
+ const childFallback = () => buildDomQueryScript(innerSel);
551
+ if (this.childSessions.size > 0) {
552
+ const candidates = await this.resolveMatchingChildSessions(selector);
553
+ for (const child of candidates) {
554
+ const childRes = await this.invokeDom(
555
+ child.sessionId,
556
+ "query",
557
+ [innerSel],
558
+ childFallback
559
+ ).catch(() => []);
560
+ if (Array.isArray(childRes) && childRes.length > 0) {
561
+ return this.applyChildOffset(childRes, child);
562
+ }
563
+ }
564
+ }
565
+ if (this.hasExplicitFrame(selector)) {
566
+ const inProcessFrames = await this.resolveInProcessChildFrames(selector);
567
+ for (const frame of inProcessFrames) {
568
+ const frameRes = await this.evaluateInProcessFrame(
569
+ frame.frameId,
570
+ childFallback()
571
+ ).catch(() => []);
572
+ if (Array.isArray(frameRes) && frameRes.length > 0) {
573
+ return this.applyFrameOffset(frameRes, frame.offset);
574
+ }
575
+ }
576
+ }
577
+ return [];
578
+ }
579
+ async waitForSelector(selector, opts) {
580
+ const rpcTimeout = Math.max((opts?.timeoutMs ?? 5e3) + 5e3, this.timeoutMs);
581
+ const fallback = () => buildDomWaitForSelectorScript(selector, opts);
582
+ const explicitFrame = this.hasExplicitFrame(selector);
583
+ if (this.childSessions.size === 0 && !explicitFrame) {
584
+ const result = await this.invokeDom(
585
+ void 0,
586
+ "waitForSelector",
587
+ [selector, opts ?? {}],
588
+ fallback,
589
+ rpcTimeout
590
+ );
591
+ return Array.isArray(result) ? result : [];
592
+ }
593
+ const immediate = await this.query(selector);
594
+ const filtered = immediate.filter((m) => m.visible && (!opts?.forAction || m.enabled));
595
+ if (filtered.length > 0 && !opts?.forAction) return filtered;
596
+ const innerSel = this.stripFrameFromSelector(selector);
597
+ const childFallback = () => buildDomWaitForSelectorScript(innerSel, opts);
598
+ const candidates = this.childSessions.size > 0 ? await this.resolveMatchingChildSessions(selector) : [];
599
+ const inProcessFrames = explicitFrame ? await this.resolveInProcessChildFrames(selector) : [];
600
+ const racers = [
601
+ this.invokeDom(
602
+ void 0,
603
+ "waitForSelector",
604
+ [selector, opts ?? {}],
605
+ fallback,
606
+ rpcTimeout
607
+ ).catch(() => []),
608
+ ...candidates.map(async (child) => {
609
+ const res = await this.invokeDom(
610
+ child.sessionId,
611
+ "waitForSelector",
612
+ [innerSel, opts ?? {}],
613
+ childFallback,
614
+ rpcTimeout
615
+ ).catch(() => []);
616
+ return Array.isArray(res) && res.length > 0 ? this.applyChildOffset(res, child) : [];
617
+ }),
618
+ ...inProcessFrames.map(async (frame) => {
619
+ const res = await this.evaluateInProcessFrame(
620
+ frame.frameId,
621
+ childFallback(),
622
+ rpcTimeout
623
+ ).catch(() => []);
624
+ return Array.isArray(res) && res.length > 0 ? this.applyFrameOffset(res, frame.offset) : [];
625
+ })
626
+ ];
627
+ if (explicitFrame && candidates.length === 0 && inProcessFrames.length === 0) {
628
+ const deadline = Date.now() + (opts?.timeoutMs ?? 5e3);
629
+ racers.push(
630
+ (async () => {
631
+ while (Date.now() < deadline) {
632
+ await new Promise((r) => setTimeout(r, 60));
633
+ const appeared = await this.resolveInProcessChildFrames(selector);
634
+ if (appeared.length > 0) {
635
+ const remaining = Math.max(200, deadline - Date.now());
636
+ const waitScript = buildDomWaitForSelectorScript(innerSel, {
637
+ ...opts,
638
+ timeoutMs: remaining
639
+ });
640
+ for (const frame of appeared) {
641
+ const res = await this.evaluateInProcessFrame(
642
+ frame.frameId,
643
+ waitScript,
644
+ remaining + 2e3
645
+ ).catch(() => []);
646
+ if (Array.isArray(res) && res.length > 0) {
647
+ return this.applyFrameOffset(res, frame.offset);
648
+ }
649
+ }
650
+ }
651
+ }
652
+ return [];
653
+ })()
654
+ );
655
+ }
656
+ return new Promise((resolve) => {
657
+ let remaining = racers.length;
658
+ let resolved = false;
659
+ for (const p of racers) {
660
+ void p.then((matches) => {
661
+ if (resolved) return;
662
+ if (Array.isArray(matches) && matches.length > 0) {
663
+ resolved = true;
664
+ resolve(matches);
665
+ return;
666
+ }
667
+ remaining -= 1;
668
+ if (remaining <= 0) {
669
+ resolved = true;
670
+ resolve([]);
671
+ }
672
+ });
673
+ }
674
+ });
675
+ }
676
+ async waitForHidden(selector, opts) {
677
+ const rpcTimeout = Math.max((opts?.timeoutMs ?? 5e3) + 5e3, this.timeoutMs);
678
+ const fallback = () => buildDomWaitForHiddenScript(selector, opts);
679
+ const explicitFrame = this.hasExplicitFrame(selector);
680
+ const inProcessFrames = explicitFrame ? await this.resolveInProcessChildFrames(selector) : [];
681
+ if (inProcessFrames.length > 0) {
682
+ const innerSel2 = this.stripFrameFromSelector(selector);
683
+ const childFallback2 = () => buildDomWaitForHiddenScript(innerSel2, opts);
684
+ for (const frame of inProcessFrames) {
685
+ const ok = Boolean(
686
+ await this.evaluateInProcessFrame(
687
+ frame.frameId,
688
+ childFallback2(),
689
+ rpcTimeout
690
+ ).catch(() => true)
691
+ );
692
+ if (!ok) return false;
693
+ }
694
+ return true;
695
+ }
696
+ const mainHidden = Boolean(
697
+ await this.invokeDom(
698
+ void 0,
699
+ "waitForHidden",
700
+ [selector, opts ?? {}],
701
+ fallback,
702
+ rpcTimeout
703
+ )
704
+ );
705
+ if (!mainHidden || this.childSessions.size === 0) return mainHidden;
706
+ const innerSel = this.stripFrameFromSelector(selector);
707
+ const childFallback = () => buildDomWaitForHiddenScript(innerSel, opts);
708
+ const candidates = await this.resolveMatchingChildSessions(selector);
709
+ for (const child of candidates) {
710
+ const ok = Boolean(
711
+ await this.invokeDom(
712
+ child.sessionId,
713
+ "waitForHidden",
714
+ [innerSel, opts ?? {}],
715
+ childFallback,
716
+ rpcTimeout
717
+ ).catch(() => true)
718
+ );
719
+ if (!ok) return false;
720
+ }
721
+ return true;
722
+ }
723
+ async waitForMatch(selector, opts) {
724
+ const rpcTimeout = Math.max((opts?.timeoutMs ?? 5e3) + 5e3, this.timeoutMs);
725
+ const fallback = () => buildDomWaitForMatchScript(selector, opts);
726
+ const explicitFrame = this.hasExplicitFrame(selector);
727
+ const innerSel = this.stripFrameFromSelector(selector);
728
+ const childFallback = () => buildDomWaitForMatchScript(innerSel, opts);
729
+ if (explicitFrame) {
730
+ const inProcessFrames = await this.resolveInProcessChildFrames(selector);
731
+ if (inProcessFrames.length > 0) {
732
+ let lastRes = { matched: false };
733
+ for (const frame of inProcessFrames) {
734
+ const frameRes = await this.evaluateInProcessFrame(
735
+ frame.frameId,
736
+ childFallback(),
737
+ rpcTimeout
738
+ ).catch(() => ({ matched: false }));
739
+ if (frameRes?.matched) return frameRes;
740
+ lastRes = frameRes;
741
+ }
742
+ return lastRes;
743
+ }
744
+ }
745
+ if (this.childSessions.size > 0) {
746
+ const candidates = await this.resolveMatchingChildSessions(selector);
747
+ if (explicitFrame && candidates.length > 0) {
748
+ let lastRes = { matched: false };
749
+ for (const child of candidates) {
750
+ const childRes = await this.invokeDom(
751
+ child.sessionId,
752
+ "waitForMatch",
753
+ [innerSel, opts],
754
+ childFallback,
755
+ rpcTimeout
756
+ ).catch(() => ({ matched: false }));
757
+ if (childRes?.matched) return childRes;
758
+ lastRes = childRes;
759
+ }
760
+ return lastRes;
761
+ }
762
+ }
763
+ const result = await this.invokeDom(
764
+ void 0,
765
+ "waitForMatch",
766
+ [selector, opts],
767
+ fallback,
768
+ rpcTimeout
769
+ );
770
+ if (result && typeof result === "object" && result.matched) return result;
771
+ if (this.childSessions.size > 0) {
772
+ const candidates = await this.resolveMatchingChildSessions(selector);
773
+ for (const child of candidates) {
774
+ const childRes = await this.invokeDom(
775
+ child.sessionId,
776
+ "waitForMatch",
777
+ [innerSel, opts],
778
+ childFallback,
779
+ rpcTimeout
780
+ ).catch(() => ({ matched: false }));
781
+ if (childRes?.matched) return childRes;
782
+ }
783
+ }
784
+ return result && typeof result === "object" ? result : { matched: false };
785
+ }
786
+ async fillDom(selector, value, opts) {
787
+ const rpcTimeout = Math.max((opts?.timeoutMs ?? 5e3) + 5e3, this.timeoutMs);
788
+ const fallback = () => buildDomFillScript(selector, value, opts);
789
+ const explicitFrame = this.hasExplicitFrame(selector);
790
+ const innerSel = this.stripFrameFromSelector(selector);
791
+ const childFallback = () => buildDomFillScript(innerSel, value, opts);
792
+ if (explicitFrame) {
793
+ const inProcessFrames = await this.resolveInProcessChildFrames(selector);
794
+ if (inProcessFrames.length > 0) {
795
+ for (const frame of inProcessFrames) {
796
+ const ok = Boolean(
797
+ await this.evaluateInProcessFrame(
798
+ frame.frameId,
799
+ childFallback(),
800
+ rpcTimeout
801
+ ).catch(() => false)
802
+ );
803
+ if (ok) return true;
804
+ }
805
+ return false;
806
+ }
807
+ }
808
+ const mainFilled = Boolean(
809
+ await this.invokeDom(
810
+ void 0,
811
+ "fill",
812
+ [selector, value, opts ?? {}],
813
+ fallback,
814
+ rpcTimeout
815
+ )
816
+ );
817
+ if (mainFilled || this.childSessions.size === 0) return mainFilled;
818
+ const candidates = await this.resolveMatchingChildSessions(selector);
819
+ for (const child of candidates) {
820
+ const ok = Boolean(
821
+ await this.invokeDom(
822
+ child.sessionId,
823
+ "fill",
824
+ [innerSel, value, opts ?? {}],
825
+ childFallback,
826
+ rpcTimeout
827
+ ).catch(() => false)
828
+ );
829
+ if (ok) return true;
830
+ }
831
+ return false;
832
+ }
833
+ async tapDom(selector) {
834
+ const fallback = () => buildDomTapScript(selector);
835
+ const mainTapped = Boolean(
836
+ await this.invokeDom(void 0, "tap", [selector], fallback)
837
+ );
838
+ const explicitFrame = this.hasExplicitFrame(selector);
839
+ if (mainTapped || this.childSessions.size === 0 && !explicitFrame) return mainTapped;
840
+ const innerSel = this.stripFrameFromSelector(selector);
841
+ const childFallback = () => buildDomTapScript(innerSel);
842
+ if (this.childSessions.size > 0) {
843
+ const candidates = await this.resolveMatchingChildSessions(selector);
844
+ for (const child of candidates) {
845
+ const ok = Boolean(
846
+ await this.invokeDom(child.sessionId, "tap", [innerSel], childFallback).catch(
847
+ () => false
848
+ )
849
+ );
850
+ if (ok) return true;
851
+ }
852
+ }
853
+ if (explicitFrame) {
854
+ const inProcessFrames = await this.resolveInProcessChildFrames(selector);
855
+ for (const frame of inProcessFrames) {
856
+ const ok = Boolean(
857
+ await this.evaluateInProcessFrame(frame.frameId, childFallback()).catch(
858
+ () => false
859
+ )
860
+ );
861
+ if (ok) return true;
862
+ }
863
+ }
864
+ return false;
865
+ }
866
+ async scrollIntoView(selector) {
867
+ const fallback = () => buildDomScrollIntoViewScript(selector);
868
+ const result = await this.invokeDom(
869
+ void 0,
870
+ "scrollIntoView",
871
+ [selector],
872
+ fallback
873
+ );
874
+ if (result) return result;
875
+ const innerSel = this.stripFrameFromSelector(selector);
876
+ const childFallback = () => buildDomScrollIntoViewScript(innerSel);
877
+ if (this.childSessions.size > 0) {
878
+ const candidates = await this.resolveMatchingChildSessions(selector);
879
+ for (const child of candidates) {
880
+ const childRes = await this.invokeDom(
881
+ child.sessionId,
882
+ "scrollIntoView",
883
+ [innerSel],
884
+ childFallback
885
+ ).catch(() => null);
886
+ if (childRes) {
887
+ const adjusted = await this.applyChildOffset([childRes], child);
888
+ return adjusted[0] ?? null;
889
+ }
890
+ }
891
+ }
892
+ if (this.hasExplicitFrame(selector)) {
893
+ const inProcessFrames = await this.resolveInProcessChildFrames(selector);
894
+ for (const frame of inProcessFrames) {
895
+ const frameRes = await this.evaluateInProcessFrame(
896
+ frame.frameId,
897
+ childFallback()
898
+ ).catch(() => null);
899
+ if (frameRes) {
900
+ const adjusted = this.applyFrameOffset([frameRes], frame.offset);
901
+ return adjusted[0] ?? null;
902
+ }
903
+ }
904
+ }
905
+ return null;
906
+ }
907
+ async reload() {
908
+ await this.sendCommand("Page.reload", { ignoreCache: false }).catch(async () => {
909
+ await this.evaluate("window.location.reload()");
910
+ });
911
+ }
912
+ async disconnect() {
913
+ this.connected = false;
914
+ this.rejectAllPending(new Error("CDP channel disconnected"));
915
+ if (this.ws) {
916
+ try {
917
+ this.ws.close();
918
+ } catch {
919
+ }
920
+ this.ws = null;
921
+ }
922
+ }
923
+ get targetId() {
924
+ return this.currentTargetId;
925
+ }
926
+ };
927
+ function createCdpDomChannel(options) {
928
+ return new CdpDomChannel(options);
929
+ }
930
+
931
+ export {
932
+ CdpDomChannel,
933
+ createCdpDomChannel
934
+ };
935
+ //# sourceMappingURL=chunk-MAKZK7GY.js.map