9remote 3.0.34 → 3.0.40

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 (478) hide show
  1. package/dist/cli.cjs +163 -161
  2. package/dist/extension/background.js +137 -88
  3. package/dist/extension/manifest.json +6 -5
  4. package/dist/extension/runner.js +606 -0
  5. package/dist/ptyDaemon.cjs +2 -2
  6. package/dist/server.cjs +725 -517
  7. package/dist/ui/assets/index-D_C1NTm1.js +8 -0
  8. package/dist/ui/index.html +1 -1
  9. package/dist/web/404.html +1 -1
  10. package/dist/web/__next.__PAGE__.txt +4 -4
  11. package/dist/web/__next._full.txt +17 -17
  12. package/dist/web/__next._head.txt +4 -4
  13. package/dist/web/__next._index.txt +10 -10
  14. package/dist/web/__next._tree.txt +3 -3
  15. package/dist/web/_next/static/chunks/{0fb7b532.2e7a08a3edb2d789.js → 025762a4.c49f8207624e1667.js} +1 -1
  16. package/dist/web/_next/static/chunks/101.bfb3898573e4245d.js +1 -0
  17. package/dist/web/_next/static/chunks/1342.3d5707800ea67dcb.js +1 -0
  18. package/dist/web/_next/static/chunks/153.d7a869e0874f32e0.js +1 -0
  19. package/dist/web/_next/static/chunks/1561.8d395206716b3967.js +1 -0
  20. package/dist/web/_next/static/chunks/{4314.6bbd89507909cad1.js → 1599.ed9aa4b461112c1a.js} +1 -1
  21. package/dist/web/_next/static/chunks/1694.7c4e72f21d4ce34c.js +1 -0
  22. package/dist/web/_next/static/chunks/1772-ef73c166e83f5eff.js +1 -0
  23. package/dist/web/_next/static/chunks/1878.724a4af779f951aa.js +138 -0
  24. package/dist/web/_next/static/chunks/1879.0252e2bd9153348f.js +1 -0
  25. package/dist/web/_next/static/chunks/1920-5ead25286846df83.js +1 -0
  26. package/dist/web/_next/static/chunks/1968-4d2969f0b7112e0b.js +32 -0
  27. package/dist/web/_next/static/chunks/2004.f975891d8a569296.js +24 -0
  28. package/dist/web/_next/static/chunks/2094.05efbc3414828946.js +1 -0
  29. package/dist/web/_next/static/chunks/2209.2ee6023fed2ac7a5.js +1 -0
  30. package/dist/web/_next/static/chunks/236.88ef102773dd3a91.js +1 -0
  31. package/dist/web/_next/static/chunks/2369.22023f63f0eaf8db.js +1 -0
  32. package/dist/web/_next/static/chunks/{6420.bfa7bc86d03dcefc.js → 2401.73a0315a75c7b051.js} +1 -1
  33. package/dist/web/_next/static/chunks/2427.3a468cdfabd25124.js +1 -0
  34. package/dist/web/_next/static/chunks/2436.da0ef064f744b8af.js +115 -0
  35. package/dist/web/_next/static/chunks/2488.87361126358794fd.js +1 -0
  36. package/dist/web/_next/static/chunks/2561.6c8eb8cf71429d5d.js +36 -0
  37. package/dist/web/_next/static/chunks/2581.d09a7f19c64e4b97.js +1 -0
  38. package/dist/web/_next/static/chunks/{8044.5f87392585c9f3e4.js → 2615.86c58079ec7c597c.js} +1 -1
  39. package/dist/web/_next/static/chunks/2934.0caeb8b2d8b67139.js +1 -0
  40. package/dist/web/_next/static/chunks/{6274.a3795ca6dacb3d62.js → 3011.fc80a2aad3ef8778.js} +2 -2
  41. package/dist/web/_next/static/chunks/3255.3c96f02d5eb06783.js +23 -0
  42. package/dist/web/_next/static/chunks/3284.e56b0102fb9a3920.js +62 -0
  43. package/dist/web/_next/static/chunks/329-15d3e36af1b2827f.js +1 -0
  44. package/dist/web/_next/static/chunks/3301.1f7e2bd5ccb55064.js +1 -0
  45. package/dist/web/_next/static/chunks/3314.b5b5b3cca99d832e.js +1 -0
  46. package/dist/web/_next/static/chunks/{20154aaa.868648f838e03bf1.js → 33d0405b.71576a1f83124ecd.js} +1 -1
  47. package/dist/web/_next/static/chunks/3428.8818e0ef88c0e743.js +1 -0
  48. package/dist/web/_next/static/chunks/3443.8d771dadb470603c.js +1 -0
  49. package/dist/web/_next/static/chunks/3704.bf80aa0d55f950d0.js +1 -0
  50. package/dist/web/_next/static/chunks/3916.141fb720bd1eee40.js +148 -0
  51. package/dist/web/_next/static/chunks/3973.e5c2013e2abeefd3.js +93 -0
  52. package/dist/web/_next/static/chunks/4065.7616cbd8f37a68e6.js +1 -0
  53. package/dist/web/_next/static/chunks/4129.a93c19870036f647.js +1 -0
  54. package/dist/web/_next/static/chunks/{6730.88fc6f2ccc49496c.js → 4171.b0e5c6dc86bc8a5f.js} +1 -1
  55. package/dist/web/_next/static/chunks/4330.a8740b63075e6886.js +1 -0
  56. package/dist/web/_next/static/chunks/4378.a0629cfcbc20c406.js +1 -0
  57. package/dist/web/_next/static/chunks/4553.cad71717d538a2e5.js +1 -0
  58. package/dist/web/_next/static/chunks/4589.9bd287581ccd378b.js +1 -0
  59. package/dist/web/_next/static/chunks/4594.53636acacf285911.js +34 -0
  60. package/dist/web/_next/static/chunks/466.908e4592c2b93997.js +77 -0
  61. package/dist/web/_next/static/chunks/468.2e48222bf3517040.js +1 -0
  62. package/dist/web/_next/static/chunks/4712.b7062faa67f544b5.js +1 -0
  63. package/dist/web/_next/static/chunks/{9675.be4a175f92aa2f26.js → 4724.e0dffedb6972b738.js} +1 -1
  64. package/dist/web/_next/static/chunks/482.a0b5af31d7354a82.js +1 -0
  65. package/dist/web/_next/static/chunks/4929.fce0c23972476c66.js +1 -0
  66. package/dist/web/_next/static/chunks/4964.5a41b2d776aee556.js +1 -0
  67. package/dist/web/_next/static/chunks/499.cf81a39b9e6ce4a4.js +94 -0
  68. package/dist/web/_next/static/chunks/{0a7753a9.4cb02a98e2e453b9.js → 4ff7191e.d68cdd8504937de5.js} +1 -1
  69. package/dist/web/_next/static/chunks/5035.f7175d1037807b62.js +90 -0
  70. package/dist/web/_next/static/chunks/5198.b8e3a08cb60bc349.js +1 -0
  71. package/dist/web/_next/static/chunks/5421.430fa3a5488e15a9.js +21 -0
  72. package/dist/web/_next/static/chunks/{9871-c277aedb0437cb82.js → 556-a8f04c41c5663ee8.js} +1 -1
  73. package/dist/web/_next/static/chunks/5587-fc5af8c76df14222.js +1 -0
  74. package/dist/web/_next/static/chunks/5710.b055a101d6b51ff3.js +27 -0
  75. package/dist/web/_next/static/chunks/5714.122f8cb7296bc9e1.js +1 -0
  76. package/dist/web/_next/static/chunks/5757.2c157c0924cea1c2.js +1 -0
  77. package/dist/web/_next/static/chunks/{3346-23aafd4add63869a.js → 5957-3d5d92b58dcc7d4e.js} +1 -1
  78. package/dist/web/_next/static/chunks/{565f33a6-fd3410bd29f39fdf.js → 5b8e7b36-a2678128cd5bdf5e.js} +1 -1
  79. package/dist/web/_next/static/chunks/6141-132d206408947c60.js +1 -0
  80. package/dist/web/_next/static/chunks/{7424.c8c9f85c8ea65885.js → 6181.6bdde6f59e3f2cea.js} +1 -1
  81. package/dist/web/_next/static/chunks/6221-cf883148bf8a4c1e.js +11 -0
  82. package/dist/web/_next/static/chunks/{3552.8dd9a3d2c3bcef65.js → 6372.51e578b15d566c0e.js} +2 -2
  83. package/dist/web/_next/static/chunks/6405.39e8b42a56b88bb5.js +1 -0
  84. package/dist/web/_next/static/chunks/641.7b1b12ccc56b3b3c.js +1 -0
  85. package/dist/web/_next/static/chunks/{6647.740ec32a32201eab.js → 6418.a86ca6012f0867ff.js} +1 -1
  86. package/dist/web/_next/static/chunks/{4924.3f5c77a103ac69a9.js → 6435.6aef0f9f1cc65be6.js} +1 -1
  87. package/dist/web/_next/static/chunks/6439.f02105d3687113e7.js +1 -0
  88. package/dist/web/_next/static/chunks/647.527b9a09373aab91.js +1 -0
  89. package/dist/web/_next/static/chunks/{8115.68d46fb961c724e0.js → 6470.7057ef6894a7f625.js} +16 -16
  90. package/dist/web/_next/static/chunks/6485.6ae2f3966cc25c9e.js +1 -0
  91. package/dist/web/_next/static/chunks/{6987.743a63813c6288ce.js → 6512.cc81f46437639a0e.js} +2 -2
  92. package/dist/web/_next/static/chunks/6520.73f10855f9d4b5a8.js +1 -0
  93. package/dist/web/_next/static/chunks/668.1ddcf2e38071ae57.js +24 -0
  94. package/dist/web/_next/static/chunks/6815.8126ae5481c3bfd8.js +1 -0
  95. package/dist/web/_next/static/chunks/6925-af784cffb03dd330.js +1 -0
  96. package/dist/web/_next/static/chunks/6e6d0562.6ebb8f7db67bd943.js +122 -0
  97. package/dist/web/_next/static/chunks/7058.affbacca3457f5a7.js +41 -0
  98. package/dist/web/_next/static/chunks/7207.72d8a01e77112af2.js +1 -0
  99. package/dist/web/_next/static/chunks/{4090.441fa61655da9b38.js → 7359.b09680f38f75e105.js} +1 -1
  100. package/dist/web/_next/static/chunks/7369.a824cc623274cf63.js +1 -0
  101. package/dist/web/_next/static/chunks/7489.24938d89538cd03e.js +1 -0
  102. package/dist/web/_next/static/chunks/{9641.f6f2982fc4b4735f.js → 7576.273c3d0faf5c3d02.js} +1 -1
  103. package/dist/web/_next/static/chunks/7620.5c5935fd937c0e84.js +1 -0
  104. package/dist/web/_next/static/chunks/7646.1c26e96ee36bc317.js +1 -0
  105. package/dist/web/_next/static/chunks/7712.cd8c3dc2d794d714.js +1 -0
  106. package/dist/web/_next/static/chunks/7812.aabc856212c93434.js +1 -0
  107. package/dist/web/_next/static/chunks/804.38f05d79313a8dcc.js +104 -0
  108. package/dist/web/_next/static/chunks/8126-0279fc9e17c08aff.js +1 -0
  109. package/dist/web/_next/static/chunks/820-99036fb63c5462c8.js +1 -0
  110. package/dist/web/_next/static/chunks/8304.936a74abe6f0a288.js +1 -0
  111. package/dist/web/_next/static/chunks/8314.7ff9d72cd8613f75.js +226 -0
  112. package/dist/web/_next/static/chunks/8390.5eda620e73ea6c5c.js +74 -0
  113. package/dist/web/_next/static/chunks/860.f7885efc630bcfd7.js +1 -0
  114. package/dist/web/_next/static/chunks/87c73c54-e11922cda838f8cc.js +1 -0
  115. package/dist/web/_next/static/chunks/887.15090f9a6a142a10.js +1 -0
  116. package/dist/web/_next/static/chunks/8977.1ab6ed8e2c098cf0.js +1 -0
  117. package/dist/web/_next/static/chunks/9121-3d281debd0f3e659.js +1 -0
  118. package/dist/web/_next/static/chunks/9491-6dc334192080d071.js +86 -0
  119. package/dist/web/_next/static/chunks/951ed0e8.98070dce91103a63.js +1 -0
  120. package/dist/web/_next/static/chunks/9651.d199fbbbc3de43b8.js +215 -0
  121. package/dist/web/_next/static/chunks/9692.dd07a90166f5e6ff.js +1 -0
  122. package/dist/web/_next/static/chunks/{6075.a6b8434732056526.js → 9700.c47024f592537718.js} +1 -1
  123. package/dist/web/_next/static/chunks/9711.cf7aaa7fa6ec7dd7.js +287 -0
  124. package/dist/web/_next/static/chunks/9736.63b4a559c8a23186.js +1 -0
  125. package/dist/web/_next/static/chunks/{bbfbfb6c.069db3c4cc981ed3.js → 98f82933.0c4f9e5e83926351.js} +1 -1
  126. package/dist/web/_next/static/chunks/{da9a53d6.df25e193f1f5bcae.js → a36ae3fc.d666935373d1f579.js} +4 -4
  127. package/dist/web/_next/static/chunks/{adcd17ec-9a2791632136b67b.js → ab6c8a12-9dac45de556d8a8d.js} +1 -1
  128. package/dist/web/_next/static/chunks/app/_global-error/page-2ece09c883187d82.js +1 -0
  129. package/dist/web/_next/static/chunks/app/_not-found/page-9f829d2c4beb1840.js +1 -0
  130. package/dist/web/_next/static/chunks/app/admin/access/page-45f45ad529e5b691.js +5 -0
  131. package/dist/web/_next/static/chunks/app/admin/login/page-382072b5b43d3c29.js +1 -0
  132. package/dist/web/_next/static/chunks/app/admin/ota/page-293c0743bd60f454.js +5 -0
  133. package/dist/web/_next/static/chunks/app/admin/page-fc676dae451dd646.js +5 -0
  134. package/dist/web/_next/static/chunks/app/admin/turn/page-2ab33033fc7f0919.js +5 -0
  135. package/dist/web/_next/static/chunks/app/dev/question/page-bafce0c9fd4e8488.js +1 -0
  136. package/dist/web/_next/static/chunks/app/download/{page-2811ea822a1e586a.js → page-a65d1c7fcf6397af.js} +1 -1
  137. package/dist/web/_next/static/chunks/app/layout-f1429d22e935695f.js +1 -0
  138. package/dist/web/_next/static/chunks/app/login/page-a5dd37d1cbbb394e.js +1 -0
  139. package/dist/web/_next/static/chunks/app/page-1e67d8a5f3775276.js +22 -0
  140. package/dist/web/_next/static/chunks/app/workspace/browse/page-2ece09c883187d82.js +1 -0
  141. package/dist/web/_next/static/chunks/app/workspace/editor/page-2ece09c883187d82.js +1 -0
  142. package/dist/web/_next/static/chunks/app/workspace/files/page-2ece09c883187d82.js +1 -0
  143. package/dist/web/_next/static/chunks/app/workspace/git/page-2ece09c883187d82.js +1 -0
  144. package/dist/web/_next/static/chunks/app/workspace/layout-d8bb677fa1caa5a7.js +20 -0
  145. package/dist/web/_next/static/chunks/app/workspace/mobile/page-2ece09c883187d82.js +1 -0
  146. package/dist/web/_next/static/chunks/app/workspace/page-2ece09c883187d82.js +1 -0
  147. package/dist/web/_next/static/chunks/app/workspace/pair/page-2ece09c883187d82.js +1 -0
  148. package/dist/web/_next/static/chunks/app/workspace/remote/page-2ece09c883187d82.js +1 -0
  149. package/dist/web/_next/static/chunks/app/workspace/terminal/[sessionId]/page-2ece09c883187d82.js +1 -0
  150. package/dist/web/_next/static/chunks/app/workspace/welcome/page-2ece09c883187d82.js +1 -0
  151. package/dist/web/_next/static/chunks/app/workspace/workspaces/page-2ece09c883187d82.js +1 -0
  152. package/dist/web/_next/static/chunks/b2b4fb58.d2a067fe7df4a0d0.js +1 -0
  153. package/dist/web/_next/static/chunks/baeaa4ff-8eac34d2e07d1bb3.js +1 -0
  154. package/dist/web/_next/static/chunks/{7c89255b.f727562586fa21cc.js → c2d9a0c9.b4e0bb73c2ed317c.js} +1 -1
  155. package/dist/web/_next/static/chunks/{a012e9f0.7dbb2fe05ec0b816.js → ccfb6294.add4177b76c37868.js} +11 -11
  156. package/dist/web/_next/static/chunks/{c7ea4e13.6153499d4c2fb1f2.js → db261188.134a04dd616706a4.js} +1 -1
  157. package/dist/web/_next/static/chunks/framework-59d2d1720fc2b396.js +1 -0
  158. package/dist/web/_next/static/chunks/main-app-72391b47e9393c1b.js +1 -0
  159. package/dist/web/_next/static/chunks/main-e10b0dbebb4de0a8.js +5 -0
  160. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/app-error-2ece09c883187d82.js +1 -0
  161. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/forbidden-2ece09c883187d82.js +1 -0
  162. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/global-error-48f06b4c48a1eef3.js +1 -0
  163. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/not-found-2ece09c883187d82.js +1 -0
  164. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/unauthorized-2ece09c883187d82.js +1 -0
  165. package/dist/web/_next/static/chunks/webpack-dd1f7a5ae02e5d84.js +1 -0
  166. package/dist/web/_next/static/css/{b496025c9cd768cc.css → 15730e9f7c5c55ef.css} +1 -1
  167. package/dist/web/_next/static/css/1c2cca827fa36d54.css +1 -0
  168. package/dist/web/_not-found/__next._full.txt +15 -15
  169. package/dist/web/_not-found/__next._head.txt +4 -4
  170. package/dist/web/_not-found/__next._index.txt +10 -10
  171. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  172. package/dist/web/_not-found/__next._not-found.txt +3 -3
  173. package/dist/web/_not-found/__next._tree.txt +3 -3
  174. package/dist/web/_not-found.html +1 -1
  175. package/dist/web/_not-found.txt +15 -15
  176. package/dist/web/admin/__next._full.txt +17 -17
  177. package/dist/web/admin/__next._head.txt +4 -4
  178. package/dist/web/admin/__next._index.txt +10 -10
  179. package/dist/web/admin/__next._tree.txt +3 -3
  180. package/dist/web/admin/__next.admin.__PAGE__.txt +4 -4
  181. package/dist/web/admin/__next.admin.txt +3 -3
  182. package/dist/web/admin/access/__next._full.txt +17 -17
  183. package/dist/web/admin/access/__next._head.txt +4 -4
  184. package/dist/web/admin/access/__next._index.txt +10 -10
  185. package/dist/web/admin/access/__next._tree.txt +3 -3
  186. package/dist/web/admin/access/__next.admin.access.__PAGE__.txt +4 -4
  187. package/dist/web/admin/access/__next.admin.access.txt +3 -3
  188. package/dist/web/admin/access/__next.admin.txt +3 -3
  189. package/dist/web/admin/access.html +1 -1
  190. package/dist/web/admin/access.txt +17 -17
  191. package/dist/web/admin/login/__next._full.txt +17 -17
  192. package/dist/web/admin/login/__next._head.txt +4 -4
  193. package/dist/web/admin/login/__next._index.txt +10 -10
  194. package/dist/web/admin/login/__next._tree.txt +3 -3
  195. package/dist/web/admin/login/__next.admin.login.__PAGE__.txt +4 -4
  196. package/dist/web/admin/login/__next.admin.login.txt +3 -3
  197. package/dist/web/admin/login/__next.admin.txt +3 -3
  198. package/dist/web/admin/login.html +1 -1
  199. package/dist/web/admin/login.txt +17 -17
  200. package/dist/web/admin/ota/__next._full.txt +17 -17
  201. package/dist/web/admin/ota/__next._head.txt +4 -4
  202. package/dist/web/admin/ota/__next._index.txt +10 -10
  203. package/dist/web/admin/ota/__next._tree.txt +3 -3
  204. package/dist/web/admin/ota/__next.admin.ota.__PAGE__.txt +4 -4
  205. package/dist/web/admin/ota/__next.admin.ota.txt +3 -3
  206. package/dist/web/admin/ota/__next.admin.txt +3 -3
  207. package/dist/web/admin/ota.html +1 -1
  208. package/dist/web/admin/ota.txt +17 -17
  209. package/dist/web/admin/turn/__next._full.txt +17 -17
  210. package/dist/web/admin/turn/__next._head.txt +4 -4
  211. package/dist/web/admin/turn/__next._index.txt +10 -10
  212. package/dist/web/admin/turn/__next._tree.txt +3 -3
  213. package/dist/web/admin/turn/__next.admin.turn.__PAGE__.txt +4 -4
  214. package/dist/web/admin/turn/__next.admin.turn.txt +3 -3
  215. package/dist/web/admin/turn/__next.admin.txt +3 -3
  216. package/dist/web/admin/turn.html +1 -1
  217. package/dist/web/admin/turn.txt +17 -17
  218. package/dist/web/admin.html +1 -1
  219. package/dist/web/admin.txt +17 -17
  220. package/dist/web/dev/question/__next._full.txt +17 -17
  221. package/dist/web/dev/question/__next._head.txt +4 -4
  222. package/dist/web/dev/question/__next._index.txt +10 -10
  223. package/dist/web/dev/question/__next._tree.txt +3 -3
  224. package/dist/web/dev/question/__next.dev.question.__PAGE__.txt +4 -4
  225. package/dist/web/dev/question/__next.dev.question.txt +3 -3
  226. package/dist/web/dev/question/__next.dev.txt +3 -3
  227. package/dist/web/dev/question.html +1 -1
  228. package/dist/web/dev/question.txt +17 -17
  229. package/dist/web/download/__next._full.txt +16 -16
  230. package/dist/web/download/__next._head.txt +4 -4
  231. package/dist/web/download/__next._index.txt +10 -10
  232. package/dist/web/download/__next._tree.txt +3 -3
  233. package/dist/web/download/__next.download.__PAGE__.txt +3 -3
  234. package/dist/web/download/__next.download.txt +3 -3
  235. package/dist/web/download.html +1 -1
  236. package/dist/web/download.txt +16 -16
  237. package/dist/web/index.html +1 -1
  238. package/dist/web/index.txt +17 -17
  239. package/dist/web/login/__next._full.txt +17 -17
  240. package/dist/web/login/__next._head.txt +4 -4
  241. package/dist/web/login/__next._index.txt +10 -10
  242. package/dist/web/login/__next._tree.txt +3 -3
  243. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  244. package/dist/web/login/__next.login.txt +3 -3
  245. package/dist/web/login.html +1 -1
  246. package/dist/web/login.txt +17 -17
  247. package/dist/web/workspace/__next._full.txt +17 -17
  248. package/dist/web/workspace/__next._head.txt +4 -4
  249. package/dist/web/workspace/__next._index.txt +10 -10
  250. package/dist/web/workspace/__next._tree.txt +3 -3
  251. package/dist/web/workspace/__next.workspace.__PAGE__.txt +2 -2
  252. package/dist/web/workspace/__next.workspace.txt +5 -5
  253. package/dist/web/workspace/browse/__next._full.txt +17 -17
  254. package/dist/web/workspace/browse/__next._head.txt +4 -4
  255. package/dist/web/workspace/browse/__next._index.txt +10 -10
  256. package/dist/web/workspace/browse/__next._tree.txt +3 -3
  257. package/dist/web/workspace/browse/__next.workspace.browse.__PAGE__.txt +2 -2
  258. package/dist/web/workspace/browse/__next.workspace.browse.txt +3 -3
  259. package/dist/web/workspace/browse/__next.workspace.txt +5 -5
  260. package/dist/web/workspace/browse.html +1 -1
  261. package/dist/web/workspace/browse.txt +17 -17
  262. package/dist/web/workspace/editor/__next._full.txt +17 -17
  263. package/dist/web/workspace/editor/__next._head.txt +4 -4
  264. package/dist/web/workspace/editor/__next._index.txt +10 -10
  265. package/dist/web/workspace/editor/__next._tree.txt +3 -3
  266. package/dist/web/workspace/editor/__next.workspace.editor.__PAGE__.txt +2 -2
  267. package/dist/web/workspace/editor/__next.workspace.editor.txt +3 -3
  268. package/dist/web/workspace/editor/__next.workspace.txt +5 -5
  269. package/dist/web/workspace/editor.html +1 -1
  270. package/dist/web/workspace/editor.txt +17 -17
  271. package/dist/web/workspace/files/__next._full.txt +17 -17
  272. package/dist/web/workspace/files/__next._head.txt +4 -4
  273. package/dist/web/workspace/files/__next._index.txt +10 -10
  274. package/dist/web/workspace/files/__next._tree.txt +3 -3
  275. package/dist/web/workspace/files/__next.workspace.files.__PAGE__.txt +2 -2
  276. package/dist/web/workspace/files/__next.workspace.files.txt +3 -3
  277. package/dist/web/workspace/files/__next.workspace.txt +5 -5
  278. package/dist/web/workspace/files.html +1 -1
  279. package/dist/web/workspace/files.txt +17 -17
  280. package/dist/web/workspace/git/__next._full.txt +17 -17
  281. package/dist/web/workspace/git/__next._head.txt +4 -4
  282. package/dist/web/workspace/git/__next._index.txt +10 -10
  283. package/dist/web/workspace/git/__next._tree.txt +3 -3
  284. package/dist/web/workspace/git/__next.workspace.git.__PAGE__.txt +2 -2
  285. package/dist/web/workspace/git/__next.workspace.git.txt +3 -3
  286. package/dist/web/workspace/git/__next.workspace.txt +5 -5
  287. package/dist/web/workspace/git.html +1 -1
  288. package/dist/web/workspace/git.txt +17 -17
  289. package/dist/web/workspace/mobile/__next._full.txt +17 -17
  290. package/dist/web/workspace/mobile/__next._head.txt +4 -4
  291. package/dist/web/workspace/mobile/__next._index.txt +10 -10
  292. package/dist/web/workspace/mobile/__next._tree.txt +3 -3
  293. package/dist/web/workspace/mobile/__next.workspace.mobile.__PAGE__.txt +2 -2
  294. package/dist/web/workspace/mobile/__next.workspace.mobile.txt +3 -3
  295. package/dist/web/workspace/mobile/__next.workspace.txt +5 -5
  296. package/dist/web/workspace/mobile.html +1 -1
  297. package/dist/web/workspace/mobile.txt +17 -17
  298. package/dist/web/workspace/pair/__next._full.txt +17 -17
  299. package/dist/web/workspace/pair/__next._head.txt +4 -4
  300. package/dist/web/workspace/pair/__next._index.txt +10 -10
  301. package/dist/web/workspace/pair/__next._tree.txt +3 -3
  302. package/dist/web/workspace/pair/__next.workspace.pair.__PAGE__.txt +2 -2
  303. package/dist/web/workspace/pair/__next.workspace.pair.txt +3 -3
  304. package/dist/web/workspace/pair/__next.workspace.txt +5 -5
  305. package/dist/web/workspace/pair.html +1 -1
  306. package/dist/web/workspace/pair.txt +17 -17
  307. package/dist/web/workspace/remote/__next._full.txt +17 -17
  308. package/dist/web/workspace/remote/__next._head.txt +4 -4
  309. package/dist/web/workspace/remote/__next._index.txt +10 -10
  310. package/dist/web/workspace/remote/__next._tree.txt +3 -3
  311. package/dist/web/workspace/remote/__next.workspace.remote.__PAGE__.txt +2 -2
  312. package/dist/web/workspace/remote/__next.workspace.remote.txt +3 -3
  313. package/dist/web/workspace/remote/__next.workspace.txt +5 -5
  314. package/dist/web/workspace/remote.html +1 -1
  315. package/dist/web/workspace/remote.txt +17 -17
  316. package/dist/web/workspace/terminal/default/__next._full.txt +26 -25
  317. package/dist/web/workspace/terminal/default/__next._head.txt +4 -4
  318. package/dist/web/workspace/terminal/default/__next._index.txt +10 -10
  319. package/dist/web/workspace/terminal/default/__next._tree.txt +3 -3
  320. package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.__PAGE__.txt +2 -2
  321. package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.txt +3 -3
  322. package/dist/web/workspace/terminal/default/__next.workspace.terminal.txt +3 -3
  323. package/dist/web/workspace/terminal/default/__next.workspace.txt +5 -5
  324. package/dist/web/workspace/terminal/default.html +1 -1
  325. package/dist/web/workspace/terminal/default.txt +26 -25
  326. package/dist/web/workspace/welcome/__next._full.txt +17 -17
  327. package/dist/web/workspace/welcome/__next._head.txt +4 -4
  328. package/dist/web/workspace/welcome/__next._index.txt +10 -10
  329. package/dist/web/workspace/welcome/__next._tree.txt +3 -3
  330. package/dist/web/workspace/welcome/__next.workspace.txt +5 -5
  331. package/dist/web/workspace/welcome/__next.workspace.welcome.__PAGE__.txt +2 -2
  332. package/dist/web/workspace/welcome/__next.workspace.welcome.txt +3 -3
  333. package/dist/web/workspace/welcome.html +1 -1
  334. package/dist/web/workspace/welcome.txt +17 -17
  335. package/dist/web/workspace/workspaces/__next._full.txt +17 -17
  336. package/dist/web/workspace/workspaces/__next._head.txt +4 -4
  337. package/dist/web/workspace/workspaces/__next._index.txt +10 -10
  338. package/dist/web/workspace/workspaces/__next._tree.txt +3 -3
  339. package/dist/web/workspace/workspaces/__next.workspace.txt +5 -5
  340. package/dist/web/workspace/workspaces/__next.workspace.workspaces.__PAGE__.txt +2 -2
  341. package/dist/web/workspace/workspaces/__next.workspace.workspaces.txt +3 -3
  342. package/dist/web/workspace/workspaces.html +1 -1
  343. package/dist/web/workspace/workspaces.txt +17 -17
  344. package/dist/web/workspace.html +1 -1
  345. package/dist/web/workspace.txt +17 -17
  346. package/package.json +1 -1
  347. package/dist/ui/assets/index-DbuftNJF.js +0 -8
  348. package/dist/web/_next/static/chunks/1050-b9af41e8856b58c0.js +0 -1
  349. package/dist/web/_next/static/chunks/1222.a2ce7d7f04241e2a.js +0 -1
  350. package/dist/web/_next/static/chunks/1228.046ad5fd038f5192.js +0 -1
  351. package/dist/web/_next/static/chunks/1243.1d11020940b8a88b.js +0 -1
  352. package/dist/web/_next/static/chunks/132.1ed2fce3a4b6f7ee.js +0 -1
  353. package/dist/web/_next/static/chunks/133.1106654a28b5afda.js +0 -1
  354. package/dist/web/_next/static/chunks/1385.086b560acb0d7a68.js +0 -115
  355. package/dist/web/_next/static/chunks/1642.cac26d30ac331cb4.js +0 -1
  356. package/dist/web/_next/static/chunks/1733.f06c240b3ef8a428.js +0 -77
  357. package/dist/web/_next/static/chunks/1750.09ca4eade7a6e5d3.js +0 -1
  358. package/dist/web/_next/static/chunks/1763.28beedca593b5e19.js +0 -138
  359. package/dist/web/_next/static/chunks/179.b9e8f385bd414d1c.js +0 -62
  360. package/dist/web/_next/static/chunks/1838.7c8990f903e3524a.js +0 -215
  361. package/dist/web/_next/static/chunks/2038.b7c72b442a1b2d92.js +0 -1
  362. package/dist/web/_next/static/chunks/2112.d72eefbdf81659b3.js +0 -23
  363. package/dist/web/_next/static/chunks/2125.61c6e4a3541e30ad.js +0 -1
  364. package/dist/web/_next/static/chunks/2129.61afb2f4ff59e46a.js +0 -24
  365. package/dist/web/_next/static/chunks/213.f07a816120a320ba.js +0 -1
  366. package/dist/web/_next/static/chunks/2179.3f55be0b79e3cca7.js +0 -1
  367. package/dist/web/_next/static/chunks/2180.23585bd3f3308f3a.js +0 -1
  368. package/dist/web/_next/static/chunks/2264.0fc1474d26067a01.js +0 -1
  369. package/dist/web/_next/static/chunks/2376.ed6302a91a9de1ae.js +0 -36
  370. package/dist/web/_next/static/chunks/2545.3ff192a933baf11e.js +0 -1
  371. package/dist/web/_next/static/chunks/2620.d17f4fac0eec88a5.js +0 -1
  372. package/dist/web/_next/static/chunks/2847.d3124853ca727b78.js +0 -1
  373. package/dist/web/_next/static/chunks/2849.360e2c64521fa795.js +0 -1
  374. package/dist/web/_next/static/chunks/3189.64c6546d621eec0b.js +0 -1
  375. package/dist/web/_next/static/chunks/3348-9ef29f9cedf6c0df.js +0 -1
  376. package/dist/web/_next/static/chunks/3429.98d7e79ff6d2a6ce.js +0 -1
  377. package/dist/web/_next/static/chunks/3514.9079bf49bb3e05c9.js +0 -1
  378. package/dist/web/_next/static/chunks/3606.b59e695fd05b4eb3.js +0 -74
  379. package/dist/web/_next/static/chunks/3736.4a5662ceeecc6acb.js +0 -94
  380. package/dist/web/_next/static/chunks/392.842b338137824bb8.js +0 -1
  381. package/dist/web/_next/static/chunks/4136-d7c1ff2da0833b42.js +0 -86
  382. package/dist/web/_next/static/chunks/4300-7d6c9b3328075562.js +0 -1
  383. package/dist/web/_next/static/chunks/4303.54c4aa0b89834fc6.js +0 -1
  384. package/dist/web/_next/static/chunks/4551.d0d6723cacfb90b9.js +0 -226
  385. package/dist/web/_next/static/chunks/4566.d8e009823b8647d1.js +0 -90
  386. package/dist/web/_next/static/chunks/4643.ddf3ea3a760e73a5.js +0 -1
  387. package/dist/web/_next/static/chunks/4930.42e564644c94a93b.js +0 -1
  388. package/dist/web/_next/static/chunks/5155.d7e8db52ab4c95e0.js +0 -27
  389. package/dist/web/_next/static/chunks/5158-267908d069475cdc.js +0 -32
  390. package/dist/web/_next/static/chunks/543.5636e97aa68eb9c8.js +0 -41
  391. package/dist/web/_next/static/chunks/5506.98304a1821200439.js +0 -1
  392. package/dist/web/_next/static/chunks/5622.5ead5e748ecedbd1.js +0 -1
  393. package/dist/web/_next/static/chunks/5708.22b4531ceebf3eca.js +0 -1
  394. package/dist/web/_next/static/chunks/5788-d4b8dc2ab68396b6.js +0 -1
  395. package/dist/web/_next/static/chunks/5804.ff72a927135eb74c.js +0 -93
  396. package/dist/web/_next/static/chunks/588.78e2528ff24df85c.js +0 -287
  397. package/dist/web/_next/static/chunks/6001.e5bcb28bb9ce6571.js +0 -1
  398. package/dist/web/_next/static/chunks/6180.82fa683aa16f21df.js +0 -1
  399. package/dist/web/_next/static/chunks/6276.aa48f74970f7ef3d.js +0 -1
  400. package/dist/web/_next/static/chunks/6419.99aa173d83f20370.js +0 -1
  401. package/dist/web/_next/static/chunks/6552-cebe84e4399a184f.js +0 -1
  402. package/dist/web/_next/static/chunks/6739.22a05398bfd34922.js +0 -1
  403. package/dist/web/_next/static/chunks/674.97a7237f011fb986.js +0 -1
  404. package/dist/web/_next/static/chunks/6742.bc3783b9784ead96.js +0 -1
  405. package/dist/web/_next/static/chunks/7202.dad90ce4a1d78f67.js +0 -1
  406. package/dist/web/_next/static/chunks/7233.0f252f6c1cce8058.js +0 -1
  407. package/dist/web/_next/static/chunks/7248.d89bf328a0dc1b4c.js +0 -1
  408. package/dist/web/_next/static/chunks/7263.6f224c3924155294.js +0 -1
  409. package/dist/web/_next/static/chunks/7341.6958eac888a96823.js +0 -34
  410. package/dist/web/_next/static/chunks/7507.28a3807b5d02a5c1.js +0 -1
  411. package/dist/web/_next/static/chunks/7811.19082afa63eb73ba.js +0 -1
  412. package/dist/web/_next/static/chunks/7853.d01982fa0afc1ee2.js +0 -24
  413. package/dist/web/_next/static/chunks/7908.432ab9feeb9ae756.js +0 -1
  414. package/dist/web/_next/static/chunks/7960.026e07028dd25edb.js +0 -1
  415. package/dist/web/_next/static/chunks/7967.6c62be01fad1603c.js +0 -1
  416. package/dist/web/_next/static/chunks/8054.feeb01b8acdb31d4.js +0 -1
  417. package/dist/web/_next/static/chunks/817.cd0f4d221eca4c8b.js +0 -104
  418. package/dist/web/_next/static/chunks/8207-45554e2570bc59e6.js +0 -1
  419. package/dist/web/_next/static/chunks/8467.290e9bde34b58e7c.js +0 -1
  420. package/dist/web/_next/static/chunks/8495.d6cea1be03635fa8.js +0 -148
  421. package/dist/web/_next/static/chunks/8638.237712645dcdcb8a.js +0 -1
  422. package/dist/web/_next/static/chunks/8669-8d1fb8dce08c886d.js +0 -11
  423. package/dist/web/_next/static/chunks/8716.1ad6febb58e8560e.js +0 -1
  424. package/dist/web/_next/static/chunks/8762-cb470d05070f5ead.js +0 -1
  425. package/dist/web/_next/static/chunks/8839.1ad64faf06fb4a33.js +0 -1
  426. package/dist/web/_next/static/chunks/8922-8660f73e9cd42406.js +0 -1
  427. package/dist/web/_next/static/chunks/910.43be9c3be85c7fa0.js +0 -21
  428. package/dist/web/_next/static/chunks/925.fe600c6039a3201d.js +0 -1
  429. package/dist/web/_next/static/chunks/9259.c450f561db04037d.js +0 -1
  430. package/dist/web/_next/static/chunks/9299.83236781dfa74eb0.js +0 -1
  431. package/dist/web/_next/static/chunks/9387.96263a2d1602a078.js +0 -1
  432. package/dist/web/_next/static/chunks/9568-0bfadca4fcb105aa.js +0 -1
  433. package/dist/web/_next/static/chunks/9860.05fa134ae44699e0.js +0 -1
  434. package/dist/web/_next/static/chunks/9b87412a.d2cfae4121762dec.js +0 -122
  435. package/dist/web/_next/static/chunks/a096f98a-5a93977f5f5de413.js +0 -1
  436. package/dist/web/_next/static/chunks/ab1da478.d051e56375dab6d8.js +0 -1
  437. package/dist/web/_next/static/chunks/app/_global-error/page-e656bb9bc0f3fd3d.js +0 -1
  438. package/dist/web/_next/static/chunks/app/_not-found/page-877523282abd5a7c.js +0 -1
  439. package/dist/web/_next/static/chunks/app/admin/access/page-65febd13b3d1fc91.js +0 -5
  440. package/dist/web/_next/static/chunks/app/admin/login/page-8ff8150184b7ccaa.js +0 -1
  441. package/dist/web/_next/static/chunks/app/admin/ota/page-d8766baa3680522d.js +0 -5
  442. package/dist/web/_next/static/chunks/app/admin/page-6237b1487c05f33e.js +0 -5
  443. package/dist/web/_next/static/chunks/app/admin/turn/page-6a6b695b67d59451.js +0 -5
  444. package/dist/web/_next/static/chunks/app/dev/question/page-bdedfcfce7a3c516.js +0 -1
  445. package/dist/web/_next/static/chunks/app/layout-a0e78c8427f97e4f.js +0 -1
  446. package/dist/web/_next/static/chunks/app/login/page-edc7457ddecf9262.js +0 -1
  447. package/dist/web/_next/static/chunks/app/page-b76772608a876c23.js +0 -22
  448. package/dist/web/_next/static/chunks/app/workspace/browse/page-e656bb9bc0f3fd3d.js +0 -1
  449. package/dist/web/_next/static/chunks/app/workspace/editor/page-e656bb9bc0f3fd3d.js +0 -1
  450. package/dist/web/_next/static/chunks/app/workspace/files/page-e656bb9bc0f3fd3d.js +0 -1
  451. package/dist/web/_next/static/chunks/app/workspace/git/page-e656bb9bc0f3fd3d.js +0 -1
  452. package/dist/web/_next/static/chunks/app/workspace/layout-0fd9ea03182e9c89.js +0 -15
  453. package/dist/web/_next/static/chunks/app/workspace/mobile/page-e656bb9bc0f3fd3d.js +0 -1
  454. package/dist/web/_next/static/chunks/app/workspace/page-e656bb9bc0f3fd3d.js +0 -1
  455. package/dist/web/_next/static/chunks/app/workspace/pair/page-e656bb9bc0f3fd3d.js +0 -1
  456. package/dist/web/_next/static/chunks/app/workspace/remote/page-e656bb9bc0f3fd3d.js +0 -1
  457. package/dist/web/_next/static/chunks/app/workspace/terminal/[sessionId]/page-e656bb9bc0f3fd3d.js +0 -1
  458. package/dist/web/_next/static/chunks/app/workspace/welcome/page-e656bb9bc0f3fd3d.js +0 -1
  459. package/dist/web/_next/static/chunks/app/workspace/workspaces/page-e656bb9bc0f3fd3d.js +0 -1
  460. package/dist/web/_next/static/chunks/c7879cf7-0d16fce1674078f9.js +0 -1
  461. package/dist/web/_next/static/chunks/cdcce140.7a440644c3dd52b8.js +0 -1
  462. package/dist/web/_next/static/chunks/framework-42053c69543a55f9.js +0 -1
  463. package/dist/web/_next/static/chunks/main-255c95c36766ce86.js +0 -5
  464. package/dist/web/_next/static/chunks/main-app-1831d4f902c3fcb9.js +0 -1
  465. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/app-error-e656bb9bc0f3fd3d.js +0 -1
  466. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/forbidden-e656bb9bc0f3fd3d.js +0 -1
  467. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/global-error-76800531999827bd.js +0 -1
  468. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/not-found-e656bb9bc0f3fd3d.js +0 -1
  469. package/dist/web/_next/static/chunks/next/dist/client/components/builtin/unauthorized-e656bb9bc0f3fd3d.js +0 -1
  470. package/dist/web/_next/static/chunks/webpack-f3500fd1fae71c88.js +0 -1
  471. package/dist/web/_next/static/css/1b307dedbb687210.css +0 -1
  472. package/dist/web/proxy.html +0 -179
  473. package/dist/web/sw-site.js +0 -283
  474. package/dist/web/swBridgeClaim.js +0 -57
  475. /package/dist/web/_next/static/{DdbafQkcX_ZaKRMjMeNKp → 55Oo1FQxj9HIxB7QE1XWG}/_buildManifest.js +0 -0
  476. /package/dist/web/_next/static/{DdbafQkcX_ZaKRMjMeNKp → 55Oo1FQxj9HIxB7QE1XWG}/_ssgManifest.js +0 -0
  477. /package/dist/web/_next/static/chunks/{1311.8c6b8930e22ceea0.js → 6153.8c6b8930e22ceea0.js} +0 -0
  478. /package/dist/web/_next/static/chunks/{3692.8c6b8930e22ceea0.js → 8534.8c6b8930e22ceea0.js} +0 -0
@@ -0,0 +1,606 @@
1
+ // 9remote in-page runner (AutoAgent pattern): a STATIC content script — no
2
+ // eval anywhere (MV3 extension CSP blocks it) — exposing the engine's page
3
+ // primitives as named ops. Bodies mirror host/features/browserUse/snapshot.js
4
+ // and the in-page expressions of engine.js: change either side, change both.
5
+ // The ISOLATED world keeps window.__9rFast caching coherent across calls.
6
+ if (!window.__9rRunner) {
7
+ window.__9rRunner = true;
8
+
9
+ // ---- constants mirrored from host/features/browserUse/constants.js ----
10
+ const MAX_ELEMENTS = 248;
11
+ const PAGE_TEXT_CAP = 12000;
12
+ const READ_TOTAL_CAP = 200000;
13
+
14
+ const boot = () => {
15
+ if (!window.__9rFast) window.__9rFast = { ids: new WeakMap(), nodes: new Map(), next: 1 };
16
+ return window.__9rFast;
17
+ };
18
+
19
+ // ---- snapshotBody (mirrors snapshot.js snapshotBody) ----
20
+ const numWin = (v, dflt) => {
21
+ const n = Math.floor(Number(v));
22
+ return Number.isFinite(n) && n >= 0 ? n : dflt;
23
+ };
24
+ function snapshotBody(win = {}) {
25
+ const cache = boot();
26
+ const WIN_FROM = numWin(win.from, 0), WIN_LEN = Math.max(1, numWin(win.len, MAX_ELEMENTS)), WIN_CAP = Math.max(1, numWin(win.cap, MAX_ELEMENTS));
27
+ const identity = e => {
28
+ if (!cache.ids.has(e)) cache.ids.set(e, cache.next++);
29
+ const id = cache.ids.get(e); cache.nodes.set(id, e); return id;
30
+ };
31
+ for (const [id, e] of cache.nodes) if (!e.isConnected) cache.nodes.delete(id);
32
+ const safe = e => !['hidden'].includes(e.type);
33
+ const visible = e => !e.closest('[aria-hidden="true"],[inert]') &&
34
+ e.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true });
35
+ const name = (e, seen = new Set()) => {
36
+ if (!e || seen.has(e)) return '';
37
+ seen.add(e);
38
+ const referenced = (e.getAttribute('aria-labelledby') || '').split(/\s+/)
39
+ .map(id => name(document.getElementById(id), seen)).filter(Boolean).join(' ');
40
+ const slotText = e => [...e.querySelectorAll('slot')]
41
+ .map(s => [...s.assignedNodes()].map(n => n.textContent || '').join('')).join(' ').trim();
42
+ return referenced || e.getAttribute('aria-label') ||
43
+ [...(e.labels || [])].map(l => name(l, seen)).filter(Boolean).join(' ') ||
44
+ (['button', 'submit', 'reset'].includes(e.type) ? e.value : '') || e.getAttribute('alt') ||
45
+ (e.tagName === 'INPUT' ? '' : [...e.childNodes].map(n => n.nodeType === 3 ? n.textContent :
46
+ n.nodeType === 1 && n.getAttribute('aria-hidden') !== 'true' ? name(n, seen) : '').join(' ').trim() || slotText(e)) ||
47
+ e.getAttribute('title') || e.getAttribute('placeholder') || (e.tagName === 'IFRAME' ? ((() => { try { return (e.src ? 'iframe: ' + (new URL(e.src).hostname || e.src) : 'iframe'); } catch { return 'iframe'; } })()) : '');
48
+ };
49
+ const roles = ['button', 'link', 'checkbox', 'radio', 'switch', 'tab', 'menuitem', 'menuitemradio',
50
+ 'option', 'gridcell', 'combobox', 'textbox', 'searchbox', 'spinbutton'];
51
+ const selector = 'a[href],button,input,textarea,select,summary,iframe,[contenteditable="true"],[onclick],' +
52
+ roles.map(role => '[role="' + role + '"]').join(',');
53
+ const role = e => {
54
+ if (e.tagName === 'IFRAME') return 'iframe';
55
+ const explicit = e.getAttribute('role');
56
+ if (roles.includes(explicit)) return explicit;
57
+ if (e.tagName === 'BUTTON' || e.tagName === 'SUMMARY') return 'button';
58
+ if (e.tagName === 'A') return 'link';
59
+ if (e.tagName === 'SELECT') return 'combobox';
60
+ if (e.tagName === 'TEXTAREA' || e.isContentEditable) return 'textbox';
61
+ if (e.tagName === 'INPUT') {
62
+ if (['checkbox', 'radio'].includes(e.type)) return e.type;
63
+ if (['button', 'submit', 'reset', 'image'].includes(e.type)) return 'button';
64
+ if (e.type === 'search') return 'searchbox';
65
+ if (e.type === 'number') return 'spinbutton';
66
+ if (['text', 'email', 'url', 'tel', 'password'].includes(e.type)) return 'textbox';
67
+ }
68
+ return null;
69
+ };
70
+ cache.pageKey = () => [performance.timeOrigin, location.href, scrollX, scrollY, innerWidth, innerHeight,
71
+ [...document.querySelectorAll('input,textarea,select')].filter(e => safe(e) && e.type !== 'password')
72
+ .map(e => [identity(e), e.value, e.checked, e.selectedIndex, e.disabled, e.readOnly])];
73
+ const secCache = new WeakMap();
74
+ const ctxOf = e => {
75
+ const sec = e.closest('dialog,[role="dialog"],section,fieldset,form,nav,aside');
76
+ if (!sec) return null;
77
+ if (!secCache.has(sec)) {
78
+ const t = (sec.getAttribute('aria-label') || sec.querySelector('h1,h2,h3,h4,legend')?.textContent || '').trim();
79
+ secCache.set(sec, t.slice(0, 40));
80
+ }
81
+ const v = secCache.get(sec);
82
+ return v || null;
83
+ };
84
+ const SEG_SEL = 'section,nav,aside,main,article,dialog,form,fieldset,[role="dialog"],' +
85
+ '[role="region"],[role="group"],[role="tablist"],[role="tabpanel"],' +
86
+ '[role="navigation"],[role="complementary"],[role="banner"],' +
87
+ '[role="contentinfo"],[role="form"],[role="search"]';
88
+ const segName = s => {
89
+ const a = s.getAttribute('aria-label');
90
+ if (a) return a.slice(0, 40);
91
+ const h = s.querySelector('h1,h2,h3,h4,legend');
92
+ return h ? (h.textContent || '').trim().slice(0, 40) : null;
93
+ };
94
+ const pathCache = new WeakMap();
95
+ const pathOf = e => {
96
+ if (pathCache.has(e)) return pathCache.get(e);
97
+ const segs = []; let n = e.parentElement;
98
+ const doc = e.ownerDocument || document;
99
+ while (n && n !== doc.body && n !== doc.documentElement && segs.length < 4) {
100
+ if (n.matches(SEG_SEL)) { const s = segName(n); if (s) segs.unshift(s); }
101
+ n = n.parentElement;
102
+ }
103
+ if (doc !== document) segs.unshift('iframe');
104
+ const p = segs.length ? segs : null;
105
+ pathCache.set(e, p); return p;
106
+ };
107
+ const getRect = e => {
108
+ const r = e.getBoundingClientRect();
109
+ if (e.ownerDocument && e.ownerDocument !== document) {
110
+ try {
111
+ const fr = e.ownerDocument.defaultView?.frameElement?.getBoundingClientRect();
112
+ if (fr) return { x: fr.x + r.x, y: fr.y + r.y, width: r.width, height: r.height };
113
+ } catch { }
114
+ }
115
+ return { x: r.x, y: r.y, width: r.width, height: r.height };
116
+ };
117
+ const actions = [];
118
+ const deepQuery = (root, sel) => {
119
+ const found = [...root.querySelectorAll(sel)];
120
+ for (const e of root.querySelectorAll('*')) {
121
+ if (e.shadowRoot) found.push(...deepQuery(e.shadowRoot, sel));
122
+ if (e.tagName === 'IFRAME') {
123
+ try { if (e.contentDocument) found.push(...deepQuery(e.contentDocument, sel)); } catch { }
124
+ }
125
+ }
126
+ return found;
127
+ };
128
+ const pfxOf = e => {
129
+ const t = e.tagName ? e.tagName.toLowerCase() : '';
130
+ if (t === 'button' || t === 'summary') return 'btn';
131
+ if (t === 'a') return 'a';
132
+ if (t === 'input' || t === 'textarea') return 'inp';
133
+ if (t === 'select') return 'sel';
134
+ if (t === 'iframe') return 'ifr';
135
+ if (t === 'div') return 'div';
136
+ if (t === 'span') return 'span';
137
+ return t ? t.slice(0, 4) : 'e';
138
+ };
139
+ for (const e of deepQuery(document, selector)) {
140
+ if (!safe(e) || !visible(e) || e.matches(':disabled') || e.closest('[aria-disabled="true"]')) continue;
141
+ const r = getRect(e), x = r.x + r.width / 2, y = r.y + r.height / 2,
142
+ rname = role(e) || (e.hasAttribute('onclick') ? 'button' : null);
143
+ if (r.width <= 0 || r.height <= 0) continue;
144
+ if (e.type === 'file') {
145
+ actions.push({ node: identity(e), tag: 'input', pfx: 'inp', role: 'button', label: (name(e) || 'Choose file').replace(/\s+/g, ' ').trim(),
146
+ ctx: ctxOf(e), path: pathOf(e), rect: { x: r.x, y: r.y, w: r.width, h: r.height }, kind: 'upload', value: '' });
147
+ continue;
148
+ }
149
+ if (!rname) continue;
150
+ if (rname === 'gridcell' && e.querySelector('button,[role="button"]')) continue;
151
+ const base = { node: identity(e), tag: e.tagName.toLowerCase(), pfx: pfxOf(e), role: rname, label: (name(e) || rname).replace(/\s+/g, ' ').trim(),
152
+ ctx: ctxOf(e), path: pathOf(e), rect: { x: r.x, y: r.y, w: r.width, h: r.height },
153
+ href: (e.tagName === 'A' && e.href && !e.href.startsWith('javascript:')) ? e.href : undefined };
154
+ for (const key of ['checked', 'selected', 'expanded']) {
155
+ const value = e.getAttribute('aria-' + key);
156
+ if (value !== null) base[key] = value;
157
+ }
158
+ if (['checkbox', 'radio'].includes(e.type)) base.checked = String(e.checked);
159
+ if (e.tagName === 'SELECT') {
160
+ const selLabel = e.selectedOptions[0]?.label || 'Current';
161
+ for (const o of e.options) if (!o.selected && !o.disabled && !o.closest('optgroup[disabled]'))
162
+ actions.push({ ...base, kind: 'select', value: o.value,
163
+ current_value: [...e.selectedOptions].map(o => o.label).join(', '), label: selLabel + ' → ' + o.label });
164
+ } else {
165
+ const editable = !e.readOnly && e.getAttribute('aria-readonly') !== 'true' &&
166
+ (['textbox', 'searchbox', 'spinbutton'].includes(rname) ||
167
+ (rname === 'combobox' && ['INPUT', 'TEXTAREA'].includes(e.tagName)));
168
+ const value = e.type === 'password' ? (e.value ? '••••' : '') :
169
+ 'value' in e ? String(e.value) :
170
+ e.isContentEditable || rname === 'combobox' ? e.innerText.trim() : '';
171
+ actions.push({ ...base, kind: editable ? 'fill' : 'click', value });
172
+ if (editable) actions.push({ ...base, kind: 'click', value, label: 'Open ' + base.label });
173
+ }
174
+ }
175
+ const picked = new Set(actions.map(a => cache.nodes.get(a.node)));
176
+ const isMarked = e => e.hasAttribute('data-testid') || e.hasAttribute('data-test') ||
177
+ e.hasAttribute('data-ui-name') || e.hasAttribute('data-automation-id') || e.hasAttribute('data-filters-item');
178
+ const pointerCandidates = [];
179
+ for (const e of deepQuery(document, 'div,span,li,label')) {
180
+ if (pointerCandidates.length >= WIN_CAP) break;
181
+ if (e.matches(selector)) continue;
182
+ if (!safe(e) || !visible(e) || e.matches(':disabled') || e.closest('[aria-disabled="true"]')) continue;
183
+ const inner = e.querySelector('button,a,input,select,textarea,summary,[contenteditable="true"],[onclick],[role="button"],[role="checkbox"],[role="switch"]');
184
+ if (inner) {
185
+ const ghost = inner.matches('input[type="checkbox"],input[type="radio"]') &&
186
+ !inner.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true });
187
+ if (!ghost) continue;
188
+ }
189
+ const st = getComputedStyle(e);
190
+ if (st.pointerEvents === 'none' || (st.cursor !== 'pointer' && !isMarked(e))) continue;
191
+ const label = name(e);
192
+ if (!label) continue;
193
+ const r = getRect(e);
194
+ if (r.width <= 0 || r.height <= 0) continue;
195
+ if ([...picked].some(p => p.contains(e))) continue;
196
+ pointerCandidates.push({ el: e, base: { node: identity(e), tag: e.tagName.toLowerCase(), pfx: pfxOf(e), role: 'button', label: label.slice(0, 80).replace(/\s+/g, ' ').trim(),
197
+ ctx: ctxOf(e), path: pathOf(e), rect: { x: r.x, y: r.y, w: r.width, h: r.height } } });
198
+ picked.add(e);
199
+ }
200
+ for (const c of pointerCandidates) actions.push({ ...c.base, kind: 'click', value: '' });
201
+ const height = document.documentElement.scrollHeight;
202
+ const words = []; let length = 0;
203
+ const NOISE = 'nav,header,aside,form,button,select,option,label,dialog,' +
204
+ '[role="banner"],[role="navigation"],[role="complementary"],' +
205
+ '.ad,.ads,.advert,.cookie,.cookies,[class*="cookie-"],[id*="cookie"],.popup,.modal,.sidebar,.breadcrumb';
206
+ const collectText = (doc) => {
207
+ if (!doc?.body) return;
208
+ const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT);
209
+ const range = doc.createRange(); let node;
210
+ while ((node = walker.nextNode()) && length < PAGE_TEXT_CAP) {
211
+ const value = node.textContent.trim(), parent = node.parentElement;
212
+ if (!value || !parent || parent.closest('script,style,noscript,template') ||
213
+ parent.closest(NOISE) || !visible(parent)) continue;
214
+ range.selectNodeContents(node); const r = range.getBoundingClientRect();
215
+ if (r.width > 0 && r.height > 0) {
216
+ if (height <= innerHeight * 1.5 || (r.bottom >= -100 && r.top <= innerHeight + 400)) {
217
+ words.push(value); length += value.length;
218
+ }
219
+ }
220
+ }
221
+ };
222
+ collectText(document);
223
+ for (const f of document.querySelectorAll('iframe')) {
224
+ try { if (f.contentDocument) collectText(f.contentDocument); } catch { }
225
+ }
226
+ const text = words.join('\n').slice(0, PAGE_TEXT_CAP);
227
+ const headings = [];
228
+ for (const h of document.querySelectorAll('h1,h2,h3,h4')) {
229
+ if (headings.length >= 12) break;
230
+ const t = h.textContent.trim().slice(0, 60);
231
+ if (t) headings.push(t);
232
+ }
233
+ const page_key = cache.pageKey();
234
+ const total = actions.length;
235
+ const shown = actions.slice(WIN_FROM, WIN_FROM + WIN_LEN);
236
+ const omitted_actions = Math.max(0, total - (WIN_FROM + shown.length));
237
+ const semantics = shown.map(({ rect, ctx, path, ...action }) => action);
238
+ const frameCount = document.querySelectorAll('iframe').length;
239
+ const marker = [performance.timeOrigin, location.href, scrollX, scrollY, innerWidth, innerHeight,
240
+ document.title, text, semantics, page_key[6], frameCount];
241
+ const contentMarker = [performance.timeOrigin, location.href, innerWidth, innerHeight,
242
+ document.title, text, semantics, frameCount];
243
+ const actions2 = shown;
244
+ { const seq = new Map(); actions2.forEach(a => { const n = seq.get(a.node) || 0; seq.set(a.node, n + 1);
245
+ const p = a.pfx || 'e';
246
+ a.id = p + a.node + (n ? '-' + n : ''); }); }
247
+ const scrollStep = Math.max(400, Math.round(innerHeight * 0.85));
248
+ if (scrollY + innerHeight < height - 2) actions2.push({ id: 'scroll_down', kind: 'scroll', label: 'Scroll down', delta: scrollStep });
249
+ if (scrollY > 0) actions2.push({ id: 'scroll_up', kind: 'scroll', label: 'Scroll up', delta: -scrollStep });
250
+ actions2.push({ id: 'wait', kind: 'wait', label: 'Wait for the page to update' });
251
+ return { url: location.href, title: document.title, w: innerWidth, h: innerHeight, text, headings,
252
+ scroll: { y: scrollY, height }, actions: actions2, marker, contentMarker, page_key, omitted_actions,
253
+ total_elements: total, element_from: WIN_FROM };
254
+ }
255
+
256
+ // ---- ops ----
257
+ const OPS = {
258
+ snapshot: (win) => snapshotBody(win || {}),
259
+ marker: () => snapshotBody().marker,
260
+ readyState: () => document.readyState,
261
+ href: () => location.href,
262
+ iframeCount: () => document.querySelectorAll('iframe').length,
263
+ decorate: (p) => {
264
+ const c = window.__9rFast; if (!c) return;
265
+ const e = c.nodes.get(p.node);
266
+ const r = e?.getBoundingClientRect();
267
+ if (!r || !r.width) return;
268
+ document.getElementById('__9rFx')?.remove();
269
+ const box = document.createElement('div');
270
+ box.id = '__9rFx';
271
+ box.style.cssText = 'position:fixed;pointer-events:none;z-index:2147483647;' +
272
+ 'left:' + (r.x - 3) + 'px;top:' + (r.y - 3) + 'px;width:' + (r.width + 6) + 'px;height:' + (r.height + 6) +
273
+ 'px;border:2px solid #ff3b30;border-radius:4px;transition:opacity .3s';
274
+ const dot = document.createElement('div');
275
+ dot.style.cssText = 'position:fixed;pointer-events:none;z-index:2147483647;' +
276
+ 'width:16px;height:16px;border-radius:50%;background:#ff3b30;opacity:.85;' +
277
+ 'left:' + (p.x - 68) + 'px;top:' + (p.y - 68) + 'px;' +
278
+ 'transition:left .12s ease-out,top .12s ease-out,opacity .3s';
279
+ box.appendChild(dot);
280
+ (document.body || document.documentElement).append(box);
281
+ requestAnimationFrame(() => {
282
+ dot.style.left = (p.x - 8) + 'px';
283
+ dot.style.top = (p.y - 8) + 'px';
284
+ });
285
+ setTimeout(() => {
286
+ box.style.opacity = '0'; dot.style.opacity = '0';
287
+ setTimeout(() => { box.remove(); }, 320);
288
+ }, 240);
289
+ return true;
290
+ },
291
+ // Occlusion/visibility gate — mirrors engine.js resolve()
292
+ resolve: (action) => {
293
+ const c = window.__9rFast; if (!c) return null;
294
+ const e = c.nodes.get(action.node);
295
+ if (!e?.isConnected || e.matches(':disabled') || e.closest('[aria-disabled="true"],[inert]') ||
296
+ !e.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true })) return null;
297
+ if (action.kind === 'fill' && (e.readOnly || e.getAttribute('aria-readonly') === 'true')) return null;
298
+ const frameEl = e.ownerDocument !== document ? e.ownerDocument.defaultView?.frameElement : null;
299
+ const center = (rect) => ({ x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 });
300
+ let r = e.getBoundingClientRect();
301
+ if (frameEl) {
302
+ const fr = frameEl.getBoundingClientRect();
303
+ r = { x: fr.x + r.x, y: fr.y + r.y, width: r.width, height: r.height };
304
+ }
305
+ if (!r.width || !r.height) return null;
306
+ let p = center(r);
307
+ if (p.x < 0 || p.y < 0 || p.x >= innerWidth || p.y >= innerHeight) {
308
+ e.scrollIntoView({ block: 'center', inline: 'center' });
309
+ r = e.getBoundingClientRect();
310
+ if (frameEl) {
311
+ const fr = frameEl.getBoundingClientRect();
312
+ r = { x: fr.x + r.x, y: fr.y + r.y, width: r.width, height: r.height };
313
+ }
314
+ p = center(r);
315
+ if (!r.width || !r.height || p.x < 0 || p.y < 0 || p.x >= innerWidth || p.y >= innerHeight) return null;
316
+ }
317
+ if (action.kind !== 'fill') {
318
+ const hit = document.elementFromPoint(p.x, p.y);
319
+ if (!hit) return null;
320
+ const up = (el) => { const chain = []; let n = el;
321
+ while (n) { chain.push(n); n = n.assignedSlot || n.parentElement || (n.getRootNode()?.host || null); }
322
+ return chain; };
323
+ const hitChain = up(hit);
324
+ const isHit = e.contains(hit) || up(e).some((a) => a === hit) || hitChain.some((n) => n === e || e.contains(n)) ||
325
+ (frameEl && (hit === frameEl || frameEl.contains(hit) || hit.contains(frameEl)));
326
+ if (!isHit) return null;
327
+ }
328
+ if (action.kind === 'select') {
329
+ if (e.tagName !== 'SELECT' || ![...e.options].some(o => o.value === action.value && !o.disabled)) return null;
330
+ e.value = action.value;
331
+ e.dispatchEvent(new Event('input', { bubbles: true }));
332
+ e.dispatchEvent(new Event('change', { bubbles: true }));
333
+ }
334
+ return { x: p.x, y: p.y };
335
+ },
336
+ focus: (node) => { const e = window.__9rFast?.nodes.get(node); if (e) e.focus(); return true; },
337
+ verifyText: (node, text) => {
338
+ const e = window.__9rFast?.nodes.get(node); if (!e) return true;
339
+ const v = 'value' in e ? String(e.value) : (e.innerText || '');
340
+ return v.includes(text);
341
+ },
342
+ focusInsert: (node, text) => {
343
+ const e = window.__9rFast?.nodes.get(node); if (e) e.focus();
344
+ document.execCommand('insertText', false, text);
345
+ return true;
346
+ },
347
+ insertText: (text) => { document.execCommand('insertText', false, String(text ?? '')); return true; },
348
+ selectAll: () => { document.execCommand('selectAll', false, null); return true; },
349
+ scrollBy: (dy, behavior) => { window.scrollBy({ top: Number(dy) || 0, left: 0, behavior: behavior || 'instant' }); return true; },
350
+ scrollByPct: (pct) => { window.scrollBy({ top: Math.round(window.innerHeight * Number(pct || 0)), left: 0, behavior: 'instant' }); return true; },
351
+ scrollToY: (target) => { window.scrollTo({ top: Math.max(0, Number(target) - Math.round(window.innerHeight / 2)), left: 0, behavior: 'instant' }); return true; },
352
+ scrollToEdge: (edge) => {
353
+ const height = document.documentElement.scrollHeight;
354
+ window.scrollTo({ top: edge === 'top' ? 0 : height, left: 0, behavior: 'instant' });
355
+ return true;
356
+ },
357
+ historyGo: (delta) => { history.go(Number(delta) || 0); return true; },
358
+ jsClick: (node) => {
359
+ const e = window.__9rFast?.nodes.get(node);
360
+ if (!e?.isConnected || !e.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true })) return false;
361
+ e.scrollIntoView({ block: 'center' });
362
+ e.click();
363
+ return true;
364
+ },
365
+ scrollToAction: (node) => {
366
+ const e = window.__9rFast?.nodes.get(node);
367
+ if (!e?.isConnected) return false;
368
+ e.scrollIntoView({ block: 'center', inline: 'center', behavior: 'instant' });
369
+ return true;
370
+ },
371
+ scrollToText: (needle) => {
372
+ const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
373
+ let node;
374
+ const lower = String(needle).toLowerCase();
375
+ while ((node = walker.nextNode())) {
376
+ if (node.textContent.toLowerCase().includes(lower)) {
377
+ const el = node.parentElement;
378
+ if (el && el.isConnected) {
379
+ el.scrollIntoView({ block: 'center', inline: 'center', behavior: 'instant' });
380
+ return true;
381
+ }
382
+ }
383
+ }
384
+ return false;
385
+ },
386
+ scrollBurstStep: (delta, needles) => {
387
+ window.scrollBy({ top: Number(delta) || 0, left: 0, behavior: 'instant' });
388
+ const vis = [];
389
+ const w = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
390
+ let node;
391
+ while ((node = w.nextNode()) && vis.length < 400) {
392
+ const range = document.createRange();
393
+ range.selectNodeContents(node);
394
+ const b = range.getBoundingClientRect();
395
+ if (b.bottom >= 0 && b.top <= window.innerHeight && b.width > 0) vis.push(node.textContent);
396
+ }
397
+ const t = vis.join('\n');
398
+ return { y: Math.round(window.scrollY), hit: needles.length > 0 && needles.every((s) => t.includes(s)) };
399
+ },
400
+ scrollBurstTo: (needles) => new Promise(resolve => {
401
+ const step = Math.max(400, Math.round(window.innerHeight * 0.85));
402
+ const t0 = performance.now();
403
+ const visibleText = () => {
404
+ const vis = [];
405
+ const w = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
406
+ let node;
407
+ while ((node = w.nextNode()) && vis.length < 400) {
408
+ const range = document.createRange();
409
+ range.selectNodeContents(node);
410
+ const b = range.getBoundingClientRect();
411
+ if (b.bottom >= 0 && b.top <= window.innerHeight && b.width > 0) vis.push(node.textContent);
412
+ }
413
+ return vis.join('\n');
414
+ };
415
+ let hops = 0;
416
+ const hop = () => {
417
+ if (hops >= 60 || performance.now() - t0 > 3000) return resolve({ found: false, hops, y: Math.round(window.scrollY) });
418
+ const before = Math.round(window.scrollY);
419
+ window.scrollBy({ top: step, left: 0, behavior: 'instant' });
420
+ hops++;
421
+ if (Math.round(window.scrollY) === before && hops > 1) return resolve({ found: false, hops, y: before, bottom: true });
422
+ const t = visibleText();
423
+ if (needles.length && needles.every((s) => t.includes(s))) return resolve({ found: true, hops, y: Math.round(window.scrollY) });
424
+ setTimeout(hop, 0);
425
+ };
426
+ hop();
427
+ }),
428
+ stableDom: (quiet, min, cap) => new Promise(resolve => {
429
+ let ob = null, t = null;
430
+ const t0 = performance.now();
431
+ let last = t0;
432
+ const done = () => { if (t) clearTimeout(t); try { ob && ob.disconnect(); } catch { } resolve(1); };
433
+ if (!document.body) { setTimeout(done, Math.min(Math.max(min, quiet), cap)); return; }
434
+ const check = () => {
435
+ const now = performance.now();
436
+ if ((now - last >= quiet && now - t0 >= min) || now - t0 >= cap) return done();
437
+ t = setTimeout(check, 30);
438
+ };
439
+ ob = new MutationObserver(() => { last = performance.now(); });
440
+ ob.observe(document.body, { childList: true, subtree: true, attributes: true });
441
+ check();
442
+ }),
443
+ // Synthetic input (AutoAgent executor pattern) — isTrusted=false
444
+ mouse: (type, x, y) => {
445
+ const el = document.elementFromPoint(x, y) || document.body;
446
+ const px = { bubbles: true, cancelable: true, clientX: x, clientY: y, pointerType: 'mouse', isPrimary: true, view: window };
447
+ const mo = { bubbles: true, cancelable: true, clientX: x, clientY: y, button: 0, view: window };
448
+ if (type === 'move') {
449
+ el.dispatchEvent(new PointerEvent('pointermove', px));
450
+ el.dispatchEvent(new MouseEvent('mousemove', mo));
451
+ return true;
452
+ }
453
+ if (type === 'down') {
454
+ el.dispatchEvent(new PointerEvent('pointerover', px));
455
+ el.dispatchEvent(new MouseEvent('mouseover', mo));
456
+ el.dispatchEvent(new PointerEvent('pointerdown', px));
457
+ el.dispatchEvent(new MouseEvent('mousedown', { ...mo, buttons: 1 }));
458
+ if (typeof el.focus === 'function') el.focus({ preventScroll: true });
459
+ return true;
460
+ }
461
+ el.dispatchEvent(new PointerEvent('pointerup', px));
462
+ el.dispatchEvent(new MouseEvent('mouseup', mo));
463
+ if (typeof el.click === 'function') el.click();
464
+ else el.dispatchEvent(new MouseEvent('click', mo));
465
+ return true;
466
+ },
467
+ key: (p) => {
468
+ const vkOf = { Enter: 13, Escape: 27, Tab: 9, Backspace: 8, ArrowDown: 40, ArrowUp: 38, ArrowLeft: 37, ArrowRight: 39 };
469
+ const t = document.activeElement || document.body;
470
+ if (typeof t.focus === 'function') t.focus({ preventScroll: true });
471
+ if (p.commands && p.commands.includes('selectAll')) { document.execCommand('selectAll', false, null); return true; }
472
+ const key = p.key || '';
473
+ const vk = p.vk ?? vkOf[key] ?? (key.length === 1 ? key.toUpperCase().charCodeAt(0) : 0);
474
+ const ev = { key, code: p.code || key, keyCode: vk, which: vk, bubbles: true, cancelable: true, view: window,
475
+ ctrlKey: !!(p.modifiers & 2), altKey: !!(p.modifiers & 1), metaKey: !!(p.modifiers & 4), shiftKey: !!(p.modifiers & 8) };
476
+ t.dispatchEvent(new KeyboardEvent(p.type === 'keyDown' ? 'keydown' : 'keyup', ev));
477
+ if (p.type === 'keyDown' && key === 'Enter') {
478
+ const form = t instanceof HTMLInputElement && t.form;
479
+ if (form) {
480
+ const btn = form.querySelector('button[type="submit"], input[type="submit"]');
481
+ if (btn) btn.click(); else if (form.requestSubmit) form.requestSubmit();
482
+ } else if (t instanceof HTMLTextAreaElement) document.execCommand('insertLineBreak');
483
+ }
484
+ return true;
485
+ },
486
+ read: (parent, from, len) => {
487
+ const needle = String(parent || '').toLowerCase().slice(0, 40);
488
+ const fromNum = Math.max(0, Math.floor(Number(from) || 0));
489
+ const lenNum = len == null ? PAGE_TEXT_CAP : Math.min(READ_TOTAL_CAP, Math.max(1, Math.floor(Number(len) || 1)));
490
+ const visible = e => !e.closest('[aria-hidden="true"],[inert],[hidden],details:not([open]),template');
491
+ const NOISE = 'nav,header,aside,form,button,select,option,label,dialog,' +
492
+ '[role="banner"],[role="navigation"],[role="complementary"],[role="menu"],[role="listbox"],' +
493
+ '.select-menu,.select-menu-modal,details-menu,' +
494
+ '.ad,.ads,.advert,.cookie,.cookies,[class*="cookie-"],[id*="cookie"],.popup,.modal,.sidebar,.breadcrumb';
495
+ const SEG_SEL = 'section,nav,aside,main,article,dialog,form,fieldset,[role="dialog"],' +
496
+ '[role="region"],[role="group"],[role="tablist"],[role="tabpanel"],' +
497
+ '[role="navigation"],[role="complementary"],[role="banner"],' +
498
+ '[role="contentinfo"],[role="form"],[role="search"]';
499
+ const segName = s => { const a = s.getAttribute('aria-label'); if (a) return a.slice(0, 40);
500
+ const h = s.querySelector('h1,h2,h3,h4,legend'); return h ? (h.textContent || '').trim().slice(0, 40) : null; };
501
+ const deep = (root, sel) => { const f = [...root.querySelectorAll(sel)];
502
+ for (const e of root.querySelectorAll('*')) if (e.shadowRoot) f.push(...deep(e.shadowRoot, sel)); return f; };
503
+ const named = deep(document, SEG_SEL).map(segName).filter(Boolean);
504
+ let root = document.body;
505
+ if (needle === '') {
506
+ const solo = sel => { const f = deep(document, sel); return f.length === 1 ? f[0] : null; };
507
+ root = solo('article') || solo('main,[role="main"]') || root;
508
+ } else {
509
+ const hit = deep(document, SEG_SEL).find(s => { const n = segName(s); return n && n.toLowerCase().includes(needle); });
510
+ if (!hit) return { error: 'no section matches', sections: [...new Set(named)] };
511
+ root = hit;
512
+ }
513
+ const noiseSkip = c => { const n = c.closest(NOISE); return Boolean(n) && n !== root && !n.contains(root); };
514
+ const BLOCK = 'p,h1,h2,h3,h4,h5,h6,li,blockquote,pre,dt,dd,figure,table';
515
+ const isBlock = e => e.nodeType === 1 && e.matches(BLOCK);
516
+ const shortUrl = u => { try {
517
+ const url = new URL(u, location.href);
518
+ if (url.origin !== location.origin) return url.host + url.pathname + url.search + url.hash;
519
+ if (url.pathname === location.pathname && url.search === location.search) return url.hash || url.pathname;
520
+ return url.pathname + url.search + url.hash;
521
+ } catch { return u; } };
522
+ const inlineText = e => [...e.childNodes].map(n => n.nodeType === 3 ? n.textContent :
523
+ (n.nodeType === 1 && !isBlock(n) && !n.matches('script,style,noscript,template') && visible(n) && !noiseSkip(n)) ?
524
+ (n.tagName === 'A' && n.href && !n.href.startsWith('javascript:') ?
525
+ '[' + inlineText(n) + '](' + shortUrl(n.href) + ')' : inlineText(n)) : '').join(' ');
526
+ const clean = s => String(s || '').replace(/\s+/g, ' ').replace(/\s+([.,;:!?])/g, '$1').trim();
527
+ const lines = []; let length = 0;
528
+ const push = (raw, indent) => { const t = clean(raw); if (!t) return false;
529
+ const out = (indent ? ' '.repeat(indent) : '') + t; lines.push(out); length += out.length + 1;
530
+ return length >= READ_TOTAL_CAP; };
531
+ const descend = (el, liDepth) => {
532
+ const children = [...el.children].filter(c => !c.matches('script,style,noscript,template') && !noiseSkip(c) && visible(c));
533
+ let i = 0;
534
+ while (i < children.length) {
535
+ const c = children[i];
536
+ if (isBlock(c)) { if (blockLine(c, liDepth)) return true; i++; continue; }
537
+ let j = i; while (j < children.length && !isBlock(children[j]) && children[j].tagName === c.tagName && !children[j].children.length) j++;
538
+ if (j - i >= 2) {
539
+ const cells = children.slice(i, j).map(k => clean(inlineText(k))).filter(Boolean);
540
+ if (cells.length >= 2) { if (push(cells.join(' · '), liDepth)) return true; i = j; continue; }
541
+ }
542
+ if (c.querySelector(BLOCK)) { if (descend(c, liDepth)) return true; }
543
+ else {
544
+ const ks = [...c.children];
545
+ if (ks.length >= 2 && ks.every(k => k.tagName === ks[0].tagName && !k.children.length)) {
546
+ const cells = ks.map(k => clean(inlineText(k))).filter(Boolean);
547
+ if (cells.length >= 2) { if (push(cells.join(' · '), liDepth)) return true; i++; continue; }
548
+ }
549
+ if (push(inlineText(c), liDepth)) return true;
550
+ }
551
+ i++;
552
+ }
553
+ return false;
554
+ };
555
+ const blockLine = (b, liDepth) => {
556
+ const tag = b.tagName;
557
+ if (/^H[1-6]$/.test(tag)) return push('#'.repeat(+tag[1]) + ' ' + clean(b.textContent), 0);
558
+ if (tag === 'LI') {
559
+ const d = liDepth || 0;
560
+ const t = inlineText(b); if (t && push('- ' + t, d)) return true;
561
+ return b.querySelector(BLOCK) ? descend(b, d + 1) : false;
562
+ }
563
+ if (tag === 'TABLE') {
564
+ for (const tr of b.querySelectorAll('tr')) {
565
+ const cells = [...tr.children].map(td => clean(td.textContent)).filter(Boolean);
566
+ if (cells.length && push('| ' + cells.join(' | ') + ' |', liDepth || 0)) return true;
567
+ }
568
+ return false;
569
+ }
570
+ const t = inlineText(b); if (t && push(t, liDepth)) return true;
571
+ return b.querySelector(BLOCK) ? descend(b, liDepth) : false;
572
+ };
573
+ const directText = e => [...e.childNodes].filter(n => n.nodeType === 3).map(n => n.textContent).join(' ');
574
+ const t = directText(root); if (t) push(t, 0);
575
+ descend(root, 0);
576
+ let total = 0; for (const l of lines) total += l.length + 1;
577
+ let cum = 0, out = [], taken = 0;
578
+ for (const l of lines) {
579
+ cum += l.length + 1;
580
+ if (cum <= fromNum) continue;
581
+ let pushLine = l;
582
+ if (taken + pushLine.length > lenNum) {
583
+ pushLine = pushLine.slice(0, Math.max(0, lenNum - taken));
584
+ }
585
+ out.push(pushLine); taken += pushLine.length + 1;
586
+ if (taken >= lenNum) break;
587
+ }
588
+ return { url: location.href, title: document.title, text: out.join('\n'), total, sections: [...new Set(named)] };
589
+ }
590
+ };
591
+
592
+ chrome.runtime.onMessage.addListener((msg, _sender, sendResponse) => {
593
+ if (msg?.t !== "op") return false;
594
+ (async () => {
595
+ try {
596
+ const fn = OPS[msg.op];
597
+ if (!fn) return sendResponse({ ok: false, err: `unknown op: ${msg.op}` });
598
+ const v = await fn(...(msg.args || []));
599
+ sendResponse({ ok: true, v: v ?? null });
600
+ } catch (e) {
601
+ sendResponse({ ok: false, err: String(e?.message || e) });
602
+ }
603
+ })();
604
+ return true; // async reply
605
+ });
606
+ }