@epsilon-asi/actors 0.0.1

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 (381) hide show
  1. package/.ai/generators/_template.ts +37 -0
  2. package/.ai/generators/abstract.ts +24 -0
  3. package/.ai/generators/actor-task-form-filler.ts +140 -0
  4. package/.ai/generators/actor-task.ts +122 -0
  5. package/.ai/generators/auth-core.ts +126 -0
  6. package/.ai/generators/browser-runtime.ts +114 -0
  7. package/.ai/generators/cli-command.ts +96 -0
  8. package/.ai/generators/core-framework.ts +80 -0
  9. package/.ai/generators/docs.ts +92 -0
  10. package/.ai/generators/error-logging.ts +102 -0
  11. package/.ai/generators/extraction-helper.ts +96 -0
  12. package/.ai/generators/interaction-behavior.ts +129 -0
  13. package/.ai/generators/site-actor.ts +125 -0
  14. package/.ai/generators/site-login-flow.ts +117 -0
  15. package/.ai/generators/unit-test.ts +109 -0
  16. package/.ai/workflows/_template.ts +20 -0
  17. package/.ai/workflows/starter.ts +20 -0
  18. package/README.md +435 -0
  19. package/ai-gen.config.ts +67 -0
  20. package/dist/auth/AuthStateDetector.d.ts +6 -0
  21. package/dist/auth/AuthStateDetector.d.ts.map +1 -0
  22. package/dist/auth/AuthStateDetector.js +14 -0
  23. package/dist/auth/AuthStateDetector.js.map +1 -0
  24. package/dist/auth/CredentialsProvider.d.ts +22 -0
  25. package/dist/auth/CredentialsProvider.d.ts.map +1 -0
  26. package/dist/auth/CredentialsProvider.js +30 -0
  27. package/dist/auth/CredentialsProvider.js.map +1 -0
  28. package/dist/auth/LoginFlow.d.ts +27 -0
  29. package/dist/auth/LoginFlow.d.ts.map +1 -0
  30. package/dist/auth/LoginFlow.js +233 -0
  31. package/dist/auth/LoginFlow.js.map +1 -0
  32. package/dist/auth/LoginFlow.types.d.ts +123 -0
  33. package/dist/auth/LoginFlow.types.d.ts.map +1 -0
  34. package/dist/auth/LoginFlow.types.js +7 -0
  35. package/dist/auth/LoginFlow.types.js.map +1 -0
  36. package/dist/auth/SessionStore.d.ts +16 -0
  37. package/dist/auth/SessionStore.d.ts.map +1 -0
  38. package/dist/auth/SessionStore.js +8 -0
  39. package/dist/auth/SessionStore.js.map +1 -0
  40. package/dist/auth/index.d.ts +6 -0
  41. package/dist/auth/index.d.ts.map +1 -0
  42. package/dist/auth/index.js +6 -0
  43. package/dist/auth/index.js.map +1 -0
  44. package/dist/browser/BrowserFactory.d.ts +16 -0
  45. package/dist/browser/BrowserFactory.d.ts.map +1 -0
  46. package/dist/browser/BrowserFactory.js +209 -0
  47. package/dist/browser/BrowserFactory.js.map +1 -0
  48. package/dist/browser/BrowserSession.d.ts +15 -0
  49. package/dist/browser/BrowserSession.d.ts.map +1 -0
  50. package/dist/browser/BrowserSession.js +42 -0
  51. package/dist/browser/BrowserSession.js.map +1 -0
  52. package/dist/browser/PuppeteerLike.d.ts +45 -0
  53. package/dist/browser/PuppeteerLike.d.ts.map +1 -0
  54. package/dist/browser/PuppeteerLike.js +10 -0
  55. package/dist/browser/PuppeteerLike.js.map +1 -0
  56. package/dist/browser/RuntimeConfig.d.ts +82 -0
  57. package/dist/browser/RuntimeConfig.d.ts.map +1 -0
  58. package/dist/browser/RuntimeConfig.js +64 -0
  59. package/dist/browser/RuntimeConfig.js.map +1 -0
  60. package/dist/browser/index.d.ts +6 -0
  61. package/dist/browser/index.d.ts.map +1 -0
  62. package/dist/browser/index.js +6 -0
  63. package/dist/browser/index.js.map +1 -0
  64. package/dist/browser/profileValidation.d.ts +6 -0
  65. package/dist/browser/profileValidation.d.ts.map +1 -0
  66. package/dist/browser/profileValidation.js +59 -0
  67. package/dist/browser/profileValidation.js.map +1 -0
  68. package/dist/cli/run.d.ts +3 -0
  69. package/dist/cli/run.d.ts.map +1 -0
  70. package/dist/cli/run.js +103 -0
  71. package/dist/cli/run.js.map +1 -0
  72. package/dist/core/Actor.d.ts +54 -0
  73. package/dist/core/Actor.d.ts.map +1 -0
  74. package/dist/core/Actor.js +68 -0
  75. package/dist/core/Actor.js.map +1 -0
  76. package/dist/core/ActorContext.d.ts +32 -0
  77. package/dist/core/ActorContext.d.ts.map +1 -0
  78. package/dist/core/ActorContext.js +2 -0
  79. package/dist/core/ActorContext.js.map +1 -0
  80. package/dist/core/ActorRegistry.d.ts +8 -0
  81. package/dist/core/ActorRegistry.d.ts.map +1 -0
  82. package/dist/core/ActorRegistry.js +22 -0
  83. package/dist/core/ActorRegistry.js.map +1 -0
  84. package/dist/core/ActorRunner.d.ts +57 -0
  85. package/dist/core/ActorRunner.d.ts.map +1 -0
  86. package/dist/core/ActorRunner.js +157 -0
  87. package/dist/core/ActorRunner.js.map +1 -0
  88. package/dist/core/defineActor.d.ts +3 -0
  89. package/dist/core/defineActor.d.ts.map +1 -0
  90. package/dist/core/defineActor.js +4 -0
  91. package/dist/core/defineActor.js.map +1 -0
  92. package/dist/core/index.d.ts +6 -0
  93. package/dist/core/index.d.ts.map +1 -0
  94. package/dist/core/index.js +6 -0
  95. package/dist/core/index.js.map +1 -0
  96. package/dist/errors/AuthError.d.ts +5 -0
  97. package/dist/errors/AuthError.d.ts.map +1 -0
  98. package/dist/errors/AuthError.js +7 -0
  99. package/dist/errors/AuthError.js.map +1 -0
  100. package/dist/errors/AutomationError.d.ts +17 -0
  101. package/dist/errors/AutomationError.d.ts.map +1 -0
  102. package/dist/errors/AutomationError.js +17 -0
  103. package/dist/errors/AutomationError.js.map +1 -0
  104. package/dist/errors/ConfigError.d.ts +5 -0
  105. package/dist/errors/ConfigError.d.ts.map +1 -0
  106. package/dist/errors/ConfigError.js +7 -0
  107. package/dist/errors/ConfigError.js.map +1 -0
  108. package/dist/errors/ExtractionError.d.ts +5 -0
  109. package/dist/errors/ExtractionError.d.ts.map +1 -0
  110. package/dist/errors/ExtractionError.js +7 -0
  111. package/dist/errors/ExtractionError.js.map +1 -0
  112. package/dist/errors/NavigationError.d.ts +5 -0
  113. package/dist/errors/NavigationError.d.ts.map +1 -0
  114. package/dist/errors/NavigationError.js +7 -0
  115. package/dist/errors/NavigationError.js.map +1 -0
  116. package/dist/errors/SelectorError.d.ts +6 -0
  117. package/dist/errors/SelectorError.d.ts.map +1 -0
  118. package/dist/errors/SelectorError.js +9 -0
  119. package/dist/errors/SelectorError.js.map +1 -0
  120. package/dist/errors/index.d.ts +7 -0
  121. package/dist/errors/index.d.ts.map +1 -0
  122. package/dist/errors/index.js +7 -0
  123. package/dist/errors/index.js.map +1 -0
  124. package/dist/extraction/Extractor.d.ts +16 -0
  125. package/dist/extraction/Extractor.d.ts.map +1 -0
  126. package/dist/extraction/Extractor.js +54 -0
  127. package/dist/extraction/Extractor.js.map +1 -0
  128. package/dist/extraction/Pagination.d.ts +16 -0
  129. package/dist/extraction/Pagination.d.ts.map +1 -0
  130. package/dist/extraction/Pagination.js +36 -0
  131. package/dist/extraction/Pagination.js.map +1 -0
  132. package/dist/extraction/index.d.ts +3 -0
  133. package/dist/extraction/index.d.ts.map +1 -0
  134. package/dist/extraction/index.js +3 -0
  135. package/dist/extraction/index.js.map +1 -0
  136. package/dist/index.d.ts +10 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +10 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/interaction/FieldClearer.d.ts +7 -0
  141. package/dist/interaction/FieldClearer.d.ts.map +1 -0
  142. package/dist/interaction/FieldClearer.js +53 -0
  143. package/dist/interaction/FieldClearer.js.map +1 -0
  144. package/dist/interaction/Forms.d.ts +13 -0
  145. package/dist/interaction/Forms.d.ts.map +1 -0
  146. package/dist/interaction/Forms.js +22 -0
  147. package/dist/interaction/Forms.js.map +1 -0
  148. package/dist/interaction/GhostCursorAdapter.d.ts +27 -0
  149. package/dist/interaction/GhostCursorAdapter.d.ts.map +1 -0
  150. package/dist/interaction/GhostCursorAdapter.js +51 -0
  151. package/dist/interaction/GhostCursorAdapter.js.map +1 -0
  152. package/dist/interaction/HumanInteractor.d.ts +29 -0
  153. package/dist/interaction/HumanInteractor.d.ts.map +1 -0
  154. package/dist/interaction/HumanInteractor.js +2 -0
  155. package/dist/interaction/HumanInteractor.js.map +1 -0
  156. package/dist/interaction/HumanTyping.d.ts +43 -0
  157. package/dist/interaction/HumanTyping.d.ts.map +1 -0
  158. package/dist/interaction/HumanTyping.js +85 -0
  159. package/dist/interaction/HumanTyping.js.map +1 -0
  160. package/dist/interaction/NativePuppeteerInteractor.d.ts +20 -0
  161. package/dist/interaction/NativePuppeteerInteractor.d.ts.map +1 -0
  162. package/dist/interaction/NativePuppeteerInteractor.js +47 -0
  163. package/dist/interaction/NativePuppeteerInteractor.js.map +1 -0
  164. package/dist/interaction/Navigation.d.ts +17 -0
  165. package/dist/interaction/Navigation.d.ts.map +1 -0
  166. package/dist/interaction/Navigation.js +28 -0
  167. package/dist/interaction/Navigation.js.map +1 -0
  168. package/dist/interaction/PageAdapter.d.ts +32 -0
  169. package/dist/interaction/PageAdapter.d.ts.map +1 -0
  170. package/dist/interaction/PageAdapter.js +62 -0
  171. package/dist/interaction/PageAdapter.js.map +1 -0
  172. package/dist/interaction/Waits.d.ts +3 -0
  173. package/dist/interaction/Waits.d.ts.map +1 -0
  174. package/dist/interaction/Waits.js +4 -0
  175. package/dist/interaction/Waits.js.map +1 -0
  176. package/dist/interaction/index.d.ts +10 -0
  177. package/dist/interaction/index.d.ts.map +1 -0
  178. package/dist/interaction/index.js +10 -0
  179. package/dist/interaction/index.js.map +1 -0
  180. package/dist/interaction/textToKeystrokeEvents.d.ts +13 -0
  181. package/dist/interaction/textToKeystrokeEvents.d.ts.map +1 -0
  182. package/dist/interaction/textToKeystrokeEvents.js +15 -0
  183. package/dist/interaction/textToKeystrokeEvents.js.map +1 -0
  184. package/dist/logging/ConsoleLogger.d.ts +12 -0
  185. package/dist/logging/ConsoleLogger.d.ts.map +1 -0
  186. package/dist/logging/ConsoleLogger.js +42 -0
  187. package/dist/logging/ConsoleLogger.js.map +1 -0
  188. package/dist/logging/Logger.d.ts +14 -0
  189. package/dist/logging/Logger.d.ts.map +1 -0
  190. package/dist/logging/Logger.js +2 -0
  191. package/dist/logging/Logger.js.map +1 -0
  192. package/dist/logging/MemoryLogger.d.ts +10 -0
  193. package/dist/logging/MemoryLogger.d.ts.map +1 -0
  194. package/dist/logging/MemoryLogger.js +28 -0
  195. package/dist/logging/MemoryLogger.js.map +1 -0
  196. package/dist/logging/NullLogger.d.ts +8 -0
  197. package/dist/logging/NullLogger.d.ts.map +1 -0
  198. package/dist/logging/NullLogger.js +7 -0
  199. package/dist/logging/NullLogger.js.map +1 -0
  200. package/dist/logging/index.d.ts +5 -0
  201. package/dist/logging/index.d.ts.map +1 -0
  202. package/dist/logging/index.js +5 -0
  203. package/dist/logging/index.js.map +1 -0
  204. package/dist/sites/example/example.actor.d.ts +6 -0
  205. package/dist/sites/example/example.actor.d.ts.map +1 -0
  206. package/dist/sites/example/example.actor.js +47 -0
  207. package/dist/sites/example/example.actor.js.map +1 -0
  208. package/dist/sites/example/example.selectors.d.ts +18 -0
  209. package/dist/sites/example/example.selectors.d.ts.map +1 -0
  210. package/dist/sites/example/example.selectors.js +18 -0
  211. package/dist/sites/example/example.selectors.js.map +1 -0
  212. package/dist/sites/example/example.types.d.ts +16 -0
  213. package/dist/sites/example/example.types.d.ts.map +1 -0
  214. package/dist/sites/example/example.types.js +2 -0
  215. package/dist/sites/example/example.types.js.map +1 -0
  216. package/dist/sites/example/index.d.ts +4 -0
  217. package/dist/sites/example/index.d.ts.map +1 -0
  218. package/dist/sites/example/index.js +4 -0
  219. package/dist/sites/example/index.js.map +1 -0
  220. package/dist/sites/index.d.ts +4 -0
  221. package/dist/sites/index.d.ts.map +1 -0
  222. package/dist/sites/index.js +4 -0
  223. package/dist/sites/index.js.map +1 -0
  224. package/dist/sites/myvistage-com/index.d.ts +4 -0
  225. package/dist/sites/myvistage-com/index.d.ts.map +1 -0
  226. package/dist/sites/myvistage-com/index.js +4 -0
  227. package/dist/sites/myvistage-com/index.js.map +1 -0
  228. package/dist/sites/myvistage-com/myvistage-com.actor.d.ts +6 -0
  229. package/dist/sites/myvistage-com/myvistage-com.actor.d.ts.map +1 -0
  230. package/dist/sites/myvistage-com/myvistage-com.actor.js +44 -0
  231. package/dist/sites/myvistage-com/myvistage-com.actor.js.map +1 -0
  232. package/dist/sites/myvistage-com/myvistage-com.selectors.d.ts +15 -0
  233. package/dist/sites/myvistage-com/myvistage-com.selectors.d.ts.map +1 -0
  234. package/dist/sites/myvistage-com/myvistage-com.selectors.js +15 -0
  235. package/dist/sites/myvistage-com/myvistage-com.selectors.js.map +1 -0
  236. package/dist/sites/myvistage-com/myvistage-com.types.d.ts +16 -0
  237. package/dist/sites/myvistage-com/myvistage-com.types.d.ts.map +1 -0
  238. package/dist/sites/myvistage-com/myvistage-com.types.js +2 -0
  239. package/dist/sites/myvistage-com/myvistage-com.types.js.map +1 -0
  240. package/dist/sites/upwork-com/index.d.ts +6 -0
  241. package/dist/sites/upwork-com/index.d.ts.map +1 -0
  242. package/dist/sites/upwork-com/index.js +6 -0
  243. package/dist/sites/upwork-com/index.js.map +1 -0
  244. package/dist/sites/upwork-com/upwork-com.actor.d.ts +6 -0
  245. package/dist/sites/upwork-com/upwork-com.actor.d.ts.map +1 -0
  246. package/dist/sites/upwork-com/upwork-com.actor.js +82 -0
  247. package/dist/sites/upwork-com/upwork-com.actor.js.map +1 -0
  248. package/dist/sites/upwork-com/upwork-com.runner.d.ts +2 -0
  249. package/dist/sites/upwork-com/upwork-com.runner.d.ts.map +1 -0
  250. package/dist/sites/upwork-com/upwork-com.runner.js +14 -0
  251. package/dist/sites/upwork-com/upwork-com.runner.js.map +1 -0
  252. package/dist/sites/upwork-com/upwork-com.selectors.d.ts +11 -0
  253. package/dist/sites/upwork-com/upwork-com.selectors.d.ts.map +1 -0
  254. package/dist/sites/upwork-com/upwork-com.selectors.js +11 -0
  255. package/dist/sites/upwork-com/upwork-com.selectors.js.map +1 -0
  256. package/dist/sites/upwork-com/upwork-com.types.d.ts +88 -0
  257. package/dist/sites/upwork-com/upwork-com.types.d.ts.map +1 -0
  258. package/dist/sites/upwork-com/upwork-com.types.js +63 -0
  259. package/dist/sites/upwork-com/upwork-com.types.js.map +1 -0
  260. package/dist/sites/upwork-com/upwork-com.util.d.ts +4 -0
  261. package/dist/sites/upwork-com/upwork-com.util.d.ts.map +1 -0
  262. package/dist/sites/upwork-com/upwork-com.util.js +43 -0
  263. package/dist/sites/upwork-com/upwork-com.util.js.map +1 -0
  264. package/dist/utils/delay.d.ts +2 -0
  265. package/dist/utils/delay.d.ts.map +1 -0
  266. package/dist/utils/delay.js +6 -0
  267. package/dist/utils/delay.js.map +1 -0
  268. package/dist/utils/index.d.ts +6 -0
  269. package/dist/utils/index.d.ts.map +1 -0
  270. package/dist/utils/index.js +6 -0
  271. package/dist/utils/index.js.map +1 -0
  272. package/dist/utils/invariant.d.ts +2 -0
  273. package/dist/utils/invariant.d.ts.map +1 -0
  274. package/dist/utils/invariant.js +7 -0
  275. package/dist/utils/invariant.js.map +1 -0
  276. package/dist/utils/redact.d.ts +6 -0
  277. package/dist/utils/redact.d.ts.map +1 -0
  278. package/dist/utils/redact.js +40 -0
  279. package/dist/utils/redact.js.map +1 -0
  280. package/dist/utils/retry.d.ts +8 -0
  281. package/dist/utils/retry.d.ts.map +1 -0
  282. package/dist/utils/retry.js +23 -0
  283. package/dist/utils/retry.js.map +1 -0
  284. package/dist/utils/url.d.ts +2 -0
  285. package/dist/utils/url.d.ts.map +1 -0
  286. package/dist/utils/url.js +9 -0
  287. package/dist/utils/url.js.map +1 -0
  288. package/package.json +39 -0
  289. package/src/auth/AuthStateDetector.ts +18 -0
  290. package/src/auth/CredentialsProvider.ts +48 -0
  291. package/src/auth/LoginFlow.ts +332 -0
  292. package/src/auth/LoginFlow.types.ts +141 -0
  293. package/src/auth/SessionStore.ts +21 -0
  294. package/src/auth/index.ts +5 -0
  295. package/src/browser/BrowserFactory.ts +253 -0
  296. package/src/browser/BrowserSession.ts +50 -0
  297. package/src/browser/PuppeteerLike.ts +65 -0
  298. package/src/browser/RuntimeConfig.ts +152 -0
  299. package/src/browser/index.ts +5 -0
  300. package/src/browser/profileValidation.ts +73 -0
  301. package/src/cli/run.ts +112 -0
  302. package/src/core/Actor.ts +167 -0
  303. package/src/core/ActorContext.ts +34 -0
  304. package/src/core/ActorRegistry.ts +26 -0
  305. package/src/core/ActorRunner.ts +240 -0
  306. package/src/core/defineActor.ts +5 -0
  307. package/src/core/index.ts +5 -0
  308. package/src/errors/AuthError.ts +7 -0
  309. package/src/errors/AutomationError.ts +26 -0
  310. package/src/errors/ConfigError.ts +7 -0
  311. package/src/errors/ExtractionError.ts +7 -0
  312. package/src/errors/NavigationError.ts +7 -0
  313. package/src/errors/SelectorError.ts +10 -0
  314. package/src/errors/index.ts +6 -0
  315. package/src/extraction/Extractor.ts +65 -0
  316. package/src/extraction/Pagination.ts +47 -0
  317. package/src/extraction/index.ts +2 -0
  318. package/src/index.ts +9 -0
  319. package/src/interaction/FieldClearer.ts +73 -0
  320. package/src/interaction/Forms.ts +27 -0
  321. package/src/interaction/GhostCursorAdapter.ts +79 -0
  322. package/src/interaction/HumanInteractor.ts +32 -0
  323. package/src/interaction/HumanTyping.ts +157 -0
  324. package/src/interaction/NativePuppeteerInteractor.ts +68 -0
  325. package/src/interaction/Navigation.ts +37 -0
  326. package/src/interaction/PageAdapter.ts +86 -0
  327. package/src/interaction/Waits.ts +5 -0
  328. package/src/interaction/index.ts +9 -0
  329. package/src/logging/ConsoleLogger.ts +44 -0
  330. package/src/logging/Logger.ts +15 -0
  331. package/src/logging/MemoryLogger.ts +34 -0
  332. package/src/logging/NullLogger.ts +8 -0
  333. package/src/logging/index.ts +4 -0
  334. package/src/sites/example/example.actor.ts +53 -0
  335. package/src/sites/example/example.selectors.ts +17 -0
  336. package/src/sites/example/example.types.ts +18 -0
  337. package/src/sites/example/index.ts +3 -0
  338. package/src/sites/index.ts +3 -0
  339. package/src/sites/myvistage-com/index.ts +3 -0
  340. package/src/sites/myvistage-com/login-action-list.json +349 -0
  341. package/src/sites/myvistage-com/myvistage-com.actor.ts +50 -0
  342. package/src/sites/myvistage-com/myvistage-com.selectors.ts +14 -0
  343. package/src/sites/myvistage-com/myvistage-com.types.ts +18 -0
  344. package/src/sites/myvistage-com/post-comment-action.json +81 -0
  345. package/src/sites/upwork-com/index.ts +6 -0
  346. package/src/sites/upwork-com/upwork-com.actor.ts +97 -0
  347. package/src/sites/upwork-com/upwork-com.runner.ts +17 -0
  348. package/src/sites/upwork-com/upwork-com.selectors.ts +10 -0
  349. package/src/sites/upwork-com/upwork-com.types.ts +102 -0
  350. package/src/sites/upwork-com/upwork-com.util.ts +41 -0
  351. package/src/utils/delay.ts +4 -0
  352. package/src/utils/index.ts +5 -0
  353. package/src/utils/invariant.ts +7 -0
  354. package/src/utils/redact.ts +53 -0
  355. package/src/utils/retry.ts +31 -0
  356. package/src/utils/url.ts +7 -0
  357. package/tests/fixtures/FakeCredentialsProvider.ts +12 -0
  358. package/tests/fixtures/FakeCursor.ts +48 -0
  359. package/tests/fixtures/FakePage.ts +266 -0
  360. package/tests/fixtures/makeContext.ts +76 -0
  361. package/tests/unit/auth/AuthStateDetector.test.ts +80 -0
  362. package/tests/unit/auth/LoginFlow.test.ts +296 -0
  363. package/tests/unit/browser/BrowserFactory.test.ts +370 -0
  364. package/tests/unit/core/ActorRunner.test.ts +370 -0
  365. package/tests/unit/core/defineActor.test.ts +112 -0
  366. package/tests/unit/extraction/Extractor.test.ts +48 -0
  367. package/tests/unit/extraction/Pagination.test.ts +54 -0
  368. package/tests/unit/interaction/FieldClearer.test.ts +29 -0
  369. package/tests/unit/interaction/Forms.test.ts +35 -0
  370. package/tests/unit/interaction/GhostCursorAdapter.test.ts +68 -0
  371. package/tests/unit/interaction/HumanTyping.test.ts +54 -0
  372. package/tests/unit/interaction/NativePuppeteerInteractor.test.ts +22 -0
  373. package/tests/unit/interaction/PageAdapter.test.ts +25 -0
  374. package/tests/unit/logging/redact.test.ts +36 -0
  375. package/tests/unit/sites/myvistage-com.actor.test.ts +19 -0
  376. package/tests/unit/sites/myvistage-com.login.test.ts +22 -0
  377. package/tests/unit/sites/myvistage-com.postComment.test.ts +70 -0
  378. package/tests/unit/sites/upwork-com.login.test.ts +52 -0
  379. package/tsconfig.build.json +9 -0
  380. package/tsconfig.json +22 -0
  381. package/vitest.config.ts +12 -0
@@ -0,0 +1,7 @@
1
+ import { AutomationError } from './AutomationError.js';
2
+ export class AuthError extends AutomationError {
3
+ constructor(message, meta = {}) {
4
+ super(message, meta);
5
+ }
6
+ }
7
+ //# sourceMappingURL=AuthError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthError.js","sourceRoot":"","sources":["../../src/errors/AuthError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,sBAAsB,CAAC;AAEjF,MAAM,OAAO,SAAU,SAAQ,eAAe;IAC5C,YAAY,OAAe,EAAE,OAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ export interface AutomationErrorMeta {
2
+ actorId?: string;
3
+ taskName?: string;
4
+ url?: string;
5
+ screenshotPath?: string;
6
+ cause?: unknown;
7
+ details?: Record<string, unknown>;
8
+ }
9
+ export declare class AutomationError extends Error {
10
+ readonly actorId: string | undefined;
11
+ readonly taskName: string | undefined;
12
+ readonly url: string | undefined;
13
+ readonly screenshotPath: string | undefined;
14
+ readonly details: Record<string, unknown> | undefined;
15
+ constructor(message: string, meta?: AutomationErrorMeta);
16
+ }
17
+ //# sourceMappingURL=AutomationError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutomationError.d.ts","sourceRoot":"","sources":["../../src/errors/AutomationError.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;gBAE1C,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB;CAS5D"}
@@ -0,0 +1,17 @@
1
+ export class AutomationError extends Error {
2
+ actorId;
3
+ taskName;
4
+ url;
5
+ screenshotPath;
6
+ details;
7
+ constructor(message, meta = {}) {
8
+ super(message, meta.cause instanceof Error ? { cause: meta.cause } : undefined);
9
+ this.name = new.target.name;
10
+ this.actorId = meta.actorId;
11
+ this.taskName = meta.taskName;
12
+ this.url = meta.url;
13
+ this.screenshotPath = meta.screenshotPath;
14
+ this.details = meta.details;
15
+ }
16
+ }
17
+ //# sourceMappingURL=AutomationError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutomationError.js","sourceRoot":"","sources":["../../src/errors/AutomationError.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,OAAO,CAAqB;IAC5B,QAAQ,CAAqB;IAC7B,GAAG,CAAqB;IACxB,cAAc,CAAqB;IACnC,OAAO,CAAsC;IAEtD,YAAY,OAAe,EAAE,OAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAChF,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { AutomationError, type AutomationErrorMeta } from './AutomationError.js';
2
+ export declare class ConfigError extends AutomationError {
3
+ constructor(message: string, meta?: AutomationErrorMeta);
4
+ }
5
+ //# sourceMappingURL=ConfigError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigError.d.ts","sourceRoot":"","sources":["../../src/errors/ConfigError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,qBAAa,WAAY,SAAQ,eAAe;gBAClC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB;CAG5D"}
@@ -0,0 +1,7 @@
1
+ import { AutomationError } from './AutomationError.js';
2
+ export class ConfigError extends AutomationError {
3
+ constructor(message, meta = {}) {
4
+ super(message, meta);
5
+ }
6
+ }
7
+ //# sourceMappingURL=ConfigError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigError.js","sourceRoot":"","sources":["../../src/errors/ConfigError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,sBAAsB,CAAC;AAEjF,MAAM,OAAO,WAAY,SAAQ,eAAe;IAC9C,YAAY,OAAe,EAAE,OAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { AutomationError, type AutomationErrorMeta } from './AutomationError.js';
2
+ export declare class ExtractionError extends AutomationError {
3
+ constructor(message: string, meta?: AutomationErrorMeta);
4
+ }
5
+ //# sourceMappingURL=ExtractionError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtractionError.d.ts","sourceRoot":"","sources":["../../src/errors/ExtractionError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,qBAAa,eAAgB,SAAQ,eAAe;gBACtC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB;CAG5D"}
@@ -0,0 +1,7 @@
1
+ import { AutomationError } from './AutomationError.js';
2
+ export class ExtractionError extends AutomationError {
3
+ constructor(message, meta = {}) {
4
+ super(message, meta);
5
+ }
6
+ }
7
+ //# sourceMappingURL=ExtractionError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtractionError.js","sourceRoot":"","sources":["../../src/errors/ExtractionError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,sBAAsB,CAAC;AAEjF,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAClD,YAAY,OAAe,EAAE,OAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { AutomationError, type AutomationErrorMeta } from './AutomationError.js';
2
+ export declare class NavigationError extends AutomationError {
3
+ constructor(message: string, meta?: AutomationErrorMeta);
4
+ }
5
+ //# sourceMappingURL=NavigationError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationError.d.ts","sourceRoot":"","sources":["../../src/errors/NavigationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,qBAAa,eAAgB,SAAQ,eAAe;gBACtC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB;CAG5D"}
@@ -0,0 +1,7 @@
1
+ import { AutomationError } from './AutomationError.js';
2
+ export class NavigationError extends AutomationError {
3
+ constructor(message, meta = {}) {
4
+ super(message, meta);
5
+ }
6
+ }
7
+ //# sourceMappingURL=NavigationError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationError.js","sourceRoot":"","sources":["../../src/errors/NavigationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,sBAAsB,CAAC;AAEjF,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAClD,YAAY,OAAe,EAAE,OAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { AutomationError, type AutomationErrorMeta } from './AutomationError.js';
2
+ export declare class SelectorError extends AutomationError {
3
+ readonly selector: string | undefined;
4
+ constructor(message: string, selector?: string, meta?: AutomationErrorMeta);
5
+ }
6
+ //# sourceMappingURL=SelectorError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectorError.d.ts","sourceRoot":"","sources":["../../src/errors/SelectorError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,qBAAa,aAAc,SAAQ,eAAe;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE1B,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB;CAI/E"}
@@ -0,0 +1,9 @@
1
+ import { AutomationError } from './AutomationError.js';
2
+ export class SelectorError extends AutomationError {
3
+ selector;
4
+ constructor(message, selector, meta = {}) {
5
+ super(message, meta);
6
+ this.selector = selector;
7
+ }
8
+ }
9
+ //# sourceMappingURL=SelectorError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectorError.js","sourceRoot":"","sources":["../../src/errors/SelectorError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,sBAAsB,CAAC;AAEjF,MAAM,OAAO,aAAc,SAAQ,eAAe;IACvC,QAAQ,CAAqB;IAEtC,YAAY,OAAe,EAAE,QAAiB,EAAE,OAA4B,EAAE;QAC5E,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ export * from './AutomationError.js';
2
+ export * from './AuthError.js';
3
+ export * from './ConfigError.js';
4
+ export * from './ExtractionError.js';
5
+ export * from './NavigationError.js';
6
+ export * from './SelectorError.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './AutomationError.js';
2
+ export * from './AuthError.js';
3
+ export * from './ConfigError.js';
4
+ export * from './ExtractionError.js';
5
+ export * from './NavigationError.js';
6
+ export * from './SelectorError.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { PageAdapter } from '../interaction/PageAdapter.js';
2
+ export interface TableData {
3
+ headers: string[];
4
+ rows: Array<Record<string, string>>;
5
+ }
6
+ export declare class Extractor {
7
+ private readonly page;
8
+ constructor(page: PageAdapter);
9
+ text(selector: string): Promise<string>;
10
+ textList(selector: string): Promise<string[]>;
11
+ attr(selector: string, name: string): Promise<string | null>;
12
+ hrefs(selector: string): Promise<string[]>;
13
+ jsonLd<T = unknown>(): Promise<T[]>;
14
+ table(tableSelector: string): Promise<TableData>;
15
+ }
16
+ //# sourceMappingURL=Extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Extractor.d.ts","sourceRoot":"","sources":["../../src/extraction/Extractor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrC;AAED,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,WAAW;IAE9C,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI7C,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAItD,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAS1C,MAAM,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC;IAcnC,KAAK,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAkBvD"}
@@ -0,0 +1,54 @@
1
+ import { ExtractionError } from '../errors/ExtractionError.js';
2
+ export class Extractor {
3
+ page;
4
+ constructor(page) {
5
+ this.page = page;
6
+ }
7
+ text(selector) {
8
+ return this.page.text(selector);
9
+ }
10
+ textList(selector) {
11
+ return this.page.textAll(selector);
12
+ }
13
+ attr(selector, name) {
14
+ return this.page.attr(selector, name);
15
+ }
16
+ async hrefs(selector) {
17
+ const page = this.page.raw();
18
+ return page.$$eval(selector, elements => elements
19
+ .map(element => element.getAttribute('href'))
20
+ .filter((href) => href !== null && href.length > 0));
21
+ }
22
+ async jsonLd() {
23
+ const page = this.page.raw();
24
+ return page.$$eval('script[type="application/ld+json"]', elements => elements.flatMap(element => {
25
+ try {
26
+ const text = element.textContent ?? '';
27
+ return text.length > 0 ? [JSON.parse(text)] : [];
28
+ }
29
+ catch {
30
+ return [];
31
+ }
32
+ }));
33
+ }
34
+ async table(tableSelector) {
35
+ try {
36
+ return await this.page.raw().$eval(tableSelector, table => {
37
+ const headerCells = Array.from(table.querySelectorAll('thead th'));
38
+ const headers = headerCells.map(cell => (cell.textContent ?? '').replace(/\s+/g, ' ').trim());
39
+ const rows = Array.from(table.querySelectorAll('tbody tr')).map(row => {
40
+ const cells = Array.from(row.querySelectorAll('td'));
41
+ return Object.fromEntries(cells.map((cell, index) => [
42
+ headers[index] ?? `column_${index + 1}`,
43
+ (cell.textContent ?? '').replace(/\s+/g, ' ').trim()
44
+ ]));
45
+ });
46
+ return { headers, rows };
47
+ });
48
+ }
49
+ catch (error) {
50
+ throw new ExtractionError(`Could not extract table from selector: ${tableSelector}`, { cause: error });
51
+ }
52
+ }
53
+ }
54
+ //# sourceMappingURL=Extractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Extractor.js","sourceRoot":"","sources":["../../src/extraction/Extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQ/D,MAAM,OAAO,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AAC;YACf,MAAM,IAAI,eAAe,CAAC,0CAA0C,aAAa,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACzG,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ import type { HumanInteractor } from '../interaction/HumanInteractor.js';
2
+ import type { PageAdapter } from '../interaction/PageAdapter.js';
3
+ export interface CollectPagesOptions<T> {
4
+ nextSelector: string;
5
+ extractPage: () => Promise<T[]>;
6
+ maxPages?: number;
7
+ dedupeBy?: (item: T) => string;
8
+ waitAfterNextMs?: number;
9
+ }
10
+ export declare class Pagination {
11
+ private readonly page;
12
+ private readonly interactor;
13
+ constructor(page: PageAdapter, interactor: HumanInteractor);
14
+ collectPages<T>(options: CollectPagesOptions<T>): Promise<T[]>;
15
+ }
16
+ //# sourceMappingURL=Pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/extraction/Pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,UAAU;IAEnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,eAAe;IAGxC,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;CA6BrE"}
@@ -0,0 +1,36 @@
1
+ export class Pagination {
2
+ page;
3
+ interactor;
4
+ constructor(page, interactor) {
5
+ this.page = page;
6
+ this.interactor = interactor;
7
+ }
8
+ async collectPages(options) {
9
+ const allItems = [];
10
+ const seen = new Set();
11
+ const maxPages = options.maxPages ?? Number.POSITIVE_INFINITY;
12
+ for (let pageNumber = 1; pageNumber <= maxPages; pageNumber += 1) {
13
+ const pageItems = await options.extractPage();
14
+ for (const item of pageItems) {
15
+ const key = options.dedupeBy?.(item);
16
+ if (key !== undefined) {
17
+ if (seen.has(key))
18
+ continue;
19
+ seen.add(key);
20
+ }
21
+ allItems.push(item);
22
+ }
23
+ if (pageNumber >= maxPages)
24
+ break;
25
+ const hasNext = await this.page.exists(options.nextSelector, { timeout: 500 });
26
+ if (!hasNext)
27
+ break;
28
+ await this.interactor.click(options.nextSelector);
29
+ if ((options.waitAfterNextMs ?? 0) > 0) {
30
+ await new Promise(resolve => setTimeout(resolve, options.waitAfterNextMs));
31
+ }
32
+ }
33
+ return allItems;
34
+ }
35
+ }
36
+ //# sourceMappingURL=Pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../src/extraction/Pagination.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,UAAU;IAEF;IACA;IAFnB,YACmB,IAAiB,EACjB,UAA2B;QAD3B,SAAI,GAAJ,IAAI,CAAa;QACjB,eAAU,GAAV,UAAU,CAAiB;IAC3C,CAAC;IAEJ,KAAK,CAAC,YAAY,CAAI,OAA+B;QACnD,MAAM,QAAQ,GAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,iBAAiB,CAAC;QAE9D,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,IAAI,QAAQ,EAAE,UAAU,IAAI,CAAC,EAAE,CAAC;YACjE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;YAC9C,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;gBAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;gBACrC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;oBACtB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;wBAAE,SAAS;oBAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAChB,CAAC;gBACD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;YAED,IAAI,UAAU,IAAI,QAAQ;gBAAE,MAAM;YAElC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;YAC/E,IAAI,CAAC,OAAO;gBAAE,MAAM;YAEpB,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAClD,IAAI,CAAC,OAAO,CAAC,eAAe,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export * from './Extractor.js';
2
+ export * from './Pagination.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extraction/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './Extractor.js';
2
+ export * from './Pagination.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extraction/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export * from './auth/index.js';
2
+ export * from './browser/index.js';
3
+ export * from './core/index.js';
4
+ export * from './errors/index.js';
5
+ export * from './extraction/index.js';
6
+ export * from './interaction/index.js';
7
+ export * from './logging/index.js';
8
+ export * from './sites/index.js';
9
+ export * from './utils/index.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export * from './auth/index.js';
2
+ export * from './browser/index.js';
3
+ export * from './core/index.js';
4
+ export * from './errors/index.js';
5
+ export * from './extraction/index.js';
6
+ export * from './interaction/index.js';
7
+ export * from './logging/index.js';
8
+ export * from './sites/index.js';
9
+ export * from './utils/index.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { PageLike } from '../browser/PuppeteerLike.js';
2
+ export type ClearFieldStrategy = 'select-delete' | 'dom-value';
3
+ export interface ClearFieldOptions {
4
+ strategy?: ClearFieldStrategy;
5
+ }
6
+ export declare function clearField(page: PageLike, selector: string, options?: ClearFieldOptions): Promise<void>;
7
+ //# sourceMappingURL=FieldClearer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldClearer.d.ts","sourceRoot":"","sources":["../../src/interaction/FieldClearer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,WAAW,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWjH"}
@@ -0,0 +1,53 @@
1
+ export async function clearField(page, selector, options = {}) {
2
+ const strategy = options.strategy ?? 'select-delete';
3
+ if (strategy === 'dom-value') {
4
+ await clearFieldValueInDom(page, selector);
5
+ return;
6
+ }
7
+ await selectFieldContents(page, selector);
8
+ await page.keyboard.press('Backspace');
9
+ await clearFieldValueInDom(page, selector);
10
+ }
11
+ async function selectFieldContents(page, selector) {
12
+ await page.$eval(selector, element => {
13
+ const target = element;
14
+ target.focus();
15
+ if (typeof target.select === 'function') {
16
+ target.select();
17
+ target.dispatchEvent(new Event('select', { bubbles: true }));
18
+ return;
19
+ }
20
+ if (typeof target.value === 'string' && typeof target.setSelectionRange === 'function') {
21
+ target.setSelectionRange(0, target.value.length);
22
+ target.dispatchEvent(new Event('select', { bubbles: true }));
23
+ return;
24
+ }
25
+ if (target.isContentEditable) {
26
+ const range = document.createRange();
27
+ range.selectNodeContents(target);
28
+ const selection = window.getSelection();
29
+ selection?.removeAllRanges();
30
+ selection?.addRange(range);
31
+ target.dispatchEvent(new Event('select', { bubbles: true }));
32
+ }
33
+ });
34
+ }
35
+ async function clearFieldValueInDom(page, selector) {
36
+ await page.$eval(selector, element => {
37
+ const target = element;
38
+ let changed = false;
39
+ if (typeof target.value === 'string' && target.value.length > 0) {
40
+ target.value = '';
41
+ changed = true;
42
+ }
43
+ else if (target.isContentEditable && (target.textContent ?? '').length > 0) {
44
+ target.textContent = '';
45
+ changed = true;
46
+ }
47
+ if (changed) {
48
+ target.dispatchEvent(new Event('input', { bubbles: true }));
49
+ target.dispatchEvent(new Event('change', { bubbles: true }));
50
+ }
51
+ });
52
+ }
53
+ //# sourceMappingURL=FieldClearer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldClearer.js","sourceRoot":"","sources":["../../src/interaction/FieldClearer.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAc,EAAE,QAAgB,EAAE,UAA6B,EAAE;IAChG,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;IAErD,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC7B,MAAM,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IAED,MAAM,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACvC,MAAM,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,IAAc,EAAE,QAAgB;IACjE,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,E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C;QAC3D,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChE,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;YAClB,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;aAAM,IAAI,MAAM,CAAC,iBAAiB,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7E,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC;YACxB,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAC5D,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { HumanInteractor, HumanTypeOptions } from './HumanInteractor.js';
2
+ import type { PageAdapter } from './PageAdapter.js';
3
+ export interface FillTextOptions extends HumanTypeOptions {
4
+ required?: boolean;
5
+ }
6
+ export declare class FormFiller {
7
+ private readonly page;
8
+ private readonly interactor;
9
+ constructor(page: PageAdapter, interactor: HumanInteractor);
10
+ fillText(selector: string, value: string, options?: FillTextOptions): Promise<void>;
11
+ click(selector: string): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=Forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Forms.d.ts","sourceRoot":"","sources":["../../src/interaction/Forms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,UAAU;IAEnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,eAAe;IAGxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IASvF,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"}
@@ -0,0 +1,22 @@
1
+ import { SelectorError } from '../errors/SelectorError.js';
2
+ export class FormFiller {
3
+ page;
4
+ interactor;
5
+ constructor(page, interactor) {
6
+ this.page = page;
7
+ this.interactor = interactor;
8
+ }
9
+ async fillText(selector, value, options = {}) {
10
+ const exists = await this.page.exists(selector, { timeout: options.timeoutMs ?? 5_000 });
11
+ if (!exists && (options.required ?? true)) {
12
+ throw new SelectorError(`Required form field not found: ${selector}`, selector);
13
+ }
14
+ if (!exists)
15
+ return;
16
+ await this.interactor.type(selector, value, options);
17
+ }
18
+ async click(selector) {
19
+ await this.interactor.click(selector);
20
+ }
21
+ }
22
+ //# sourceMappingURL=Forms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Forms.js","sourceRoot":"","sources":["../../src/interaction/Forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,MAAM,OAAO,UAAU;IAEF;IACA;IAFnB,YACmB,IAAiB,EACjB,UAA2B;QAD3B,SAAI,GAAJ,IAAI,CAAa;QACjB,eAAU,GAAV,UAAU,CAAiB;IAC3C,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,KAAa,EAAE,UAA2B,EAAE;QAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC;QACzF,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,aAAa,CAAC,kCAAkC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;QAClF,CAAC;QACD,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,QAAgB;QAC1B,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ import type { PageLike } from '../browser/PuppeteerLike.js';
2
+ import type { HumanClickOptions, HumanInteractor, HumanMoveOptions, HumanTypeOptions } from './HumanInteractor.js';
3
+ import { HumanTyper, type HumanTypingOptions, type RandomFunction, type SleepFunction } from './HumanTyping.js';
4
+ export interface GhostCursorLike {
5
+ click(selector?: string, options?: Record<string, unknown>): Promise<void>;
6
+ move(selector: string, options?: Record<string, unknown>): Promise<void>;
7
+ }
8
+ export interface GhostCursorAdapterOptions {
9
+ cursor?: GhostCursorLike;
10
+ cursorOptions?: Record<string, unknown>;
11
+ typing?: HumanTypingOptions;
12
+ typer?: HumanTyper;
13
+ sleep?: SleepFunction;
14
+ random?: RandomFunction;
15
+ }
16
+ export declare class GhostCursorAdapter implements HumanInteractor {
17
+ private readonly page;
18
+ private readonly cursor;
19
+ private readonly typer;
20
+ private readonly typingDefaults;
21
+ constructor(page: PageLike, options?: GhostCursorAdapterOptions);
22
+ click(selector: string, options?: HumanClickOptions): Promise<void>;
23
+ move(selector: string, options?: HumanMoveOptions): Promise<void>;
24
+ type(selector: string, value: string, options?: HumanTypeOptions): Promise<void>;
25
+ scrollIntoView(selector: string): Promise<void>;
26
+ }
27
+ //# sourceMappingURL=GhostCursorAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GhostCursorAdapter.d.ts","sourceRoot":"","sources":["../../src/interaction/GhostCursorAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,UAAU,EAA2B,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzI,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAMD,qBAAa,kBAAmB,YAAW,eAAe;IAK5C,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiC;gBAEnC,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAE,yBAA8B;IAU9E,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBpF,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKtD"}
@@ -0,0 +1,51 @@
1
+ import { GhostCursor } from 'ghost-cursor';
2
+ import { clearField } from './FieldClearer.js';
3
+ import { HumanTyper, mergeHumanTypingOptions } from './HumanTyping.js';
4
+ function selectorWaitOptions(timeoutMs) {
5
+ return timeoutMs === undefined ? undefined : { timeout: timeoutMs };
6
+ }
7
+ export class GhostCursorAdapter {
8
+ page;
9
+ cursor;
10
+ typer;
11
+ typingDefaults;
12
+ constructor(page, options = {}) {
13
+ this.page = page;
14
+ this.cursor = options.cursor ?? new GhostCursor(page, options.cursorOptions);
15
+ this.typingDefaults = options.typing;
16
+ this.typer = options.typer ?? new HumanTyper({
17
+ ...(options.typing !== undefined ? { defaults: options.typing } : {}),
18
+ ...(options.sleep !== undefined ? { sleep: options.sleep } : {}),
19
+ ...(options.random !== undefined ? { random: options.random } : {})
20
+ });
21
+ }
22
+ async click(selector, options = {}) {
23
+ if (options.waitForSelector !== false) {
24
+ await this.page.waitForSelector(selector, selectorWaitOptions(options.timeoutMs));
25
+ }
26
+ await this.cursor.click(selector, options.cursorOptions);
27
+ }
28
+ async move(selector, options = {}) {
29
+ await this.page.waitForSelector(selector, selectorWaitOptions(options.timeoutMs));
30
+ await this.cursor.move(selector, options.cursorOptions);
31
+ }
32
+ async type(selector, value, options = {}) {
33
+ await this.page.waitForSelector(selector, selectorWaitOptions(options.timeoutMs));
34
+ if (options.clickBeforeTyping ?? true) {
35
+ await this.click(selector, options.timeoutMs === undefined ? undefined : { timeoutMs: options.timeoutMs });
36
+ }
37
+ else {
38
+ await this.page.focus(selector);
39
+ }
40
+ if (options.clear ?? true) {
41
+ await clearField(this.page, selector, options.clearMethod === undefined ? undefined : { strategy: options.clearMethod });
42
+ }
43
+ await this.typer.type(this.page.keyboard, value, mergeHumanTypingOptions(this.typingDefaults, options.typing), options.delayMs);
44
+ }
45
+ async scrollIntoView(selector) {
46
+ await this.page.$eval(selector, element => {
47
+ element.scrollIntoView({ block: 'center', inline: 'center', behavior: 'instant' });
48
+ });
49
+ }
50
+ }
51
+ //# sourceMappingURL=GhostCursorAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GhostCursorAdapter.js","sourceRoot":"","sources":["../../src/interaction/GhostCursorAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAoE,MAAM,kBAAkB,CAAC;AAgBzI,SAAS,mBAAmB,CAAC,SAA6B;IACxD,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACtE,CAAC;AAED,MAAM,OAAO,kBAAkB;IAKA;IAJZ,MAAM,CAAkB;IACxB,KAAK,CAAa;IAClB,cAAc,CAAiC;IAEhE,YAA6B,IAAc,EAAE,UAAqC,EAAE;QAAvD,SAAI,GAAJ,IAAI,CAAU;QACzC,IAAI,CAAC,MAAM,GAAG,OAAO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