@browserbasehq/orca 3.0.9-alpha-4 → 3.1.0-patch.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (655) hide show
  1. package/dist/esm/index.d.ts +3 -0
  2. package/dist/esm/index.js +3 -0
  3. package/dist/esm/lib/inference.d.ts +65 -0
  4. package/dist/esm/lib/inference.js +333 -0
  5. package/dist/esm/lib/inference.js.map +1 -0
  6. package/dist/esm/lib/inferenceLogUtils.d.ts +12 -0
  7. package/dist/esm/lib/inferenceLogUtils.js +92 -0
  8. package/dist/esm/lib/inferenceLogUtils.js.map +1 -0
  9. package/dist/esm/lib/logger.d.ts +69 -0
  10. package/dist/esm/lib/logger.js +323 -0
  11. package/dist/esm/lib/logger.js.map +1 -0
  12. package/dist/esm/lib/modelUtils.d.ts +14 -0
  13. package/dist/esm/lib/modelUtils.js +48 -0
  14. package/dist/esm/lib/modelUtils.js.map +1 -0
  15. package/dist/esm/lib/prompt.d.ts +14 -0
  16. package/dist/esm/lib/prompt.js +230 -0
  17. package/dist/esm/lib/prompt.js.map +1 -0
  18. package/dist/esm/lib/utils.d.ts +68 -0
  19. package/dist/esm/lib/utils.js +654 -0
  20. package/dist/esm/lib/utils.js.map +1 -0
  21. package/dist/esm/lib/v3/agent/AgentClient.d.ts +19 -0
  22. package/dist/esm/lib/v3/agent/AgentClient.js +17 -0
  23. package/dist/esm/lib/v3/agent/AgentClient.js.map +1 -0
  24. package/dist/esm/lib/v3/agent/AgentProvider.d.ts +20 -0
  25. package/dist/esm/lib/v3/agent/AgentProvider.js +77 -0
  26. package/dist/esm/lib/v3/agent/AgentProvider.js.map +1 -0
  27. package/dist/esm/lib/v3/agent/AnthropicCUAClient.d.ts +57 -0
  28. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js +822 -0
  29. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js.map +1 -0
  30. package/dist/esm/lib/v3/agent/GoogleCUAClient.d.ts +74 -0
  31. package/dist/esm/lib/v3/agent/GoogleCUAClient.js +799 -0
  32. package/dist/esm/lib/v3/agent/GoogleCUAClient.js.map +1 -0
  33. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.d.ts +71 -0
  34. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js +770 -0
  35. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js.map +1 -0
  36. package/dist/esm/lib/v3/agent/OpenAICUAClient.d.ts +69 -0
  37. package/dist/esm/lib/v3/agent/OpenAICUAClient.js +615 -0
  38. package/dist/esm/lib/v3/agent/OpenAICUAClient.js.map +1 -0
  39. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.d.ts +12 -0
  40. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js +186 -0
  41. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js.map +1 -0
  42. package/dist/esm/lib/v3/agent/tools/act.d.ts +13 -0
  43. package/dist/esm/lib/v3/agent/tools/act.js +49 -0
  44. package/dist/esm/lib/v3/agent/tools/act.js.map +1 -0
  45. package/dist/esm/lib/v3/agent/tools/ariaTree.d.ts +5 -0
  46. package/dist/esm/lib/v3/agent/tools/ariaTree.js +31 -0
  47. package/dist/esm/lib/v3/agent/tools/ariaTree.js.map +1 -0
  48. package/dist/esm/lib/v3/agent/tools/click.d.ts +6 -0
  49. package/dist/esm/lib/v3/agent/tools/click.js +104 -0
  50. package/dist/esm/lib/v3/agent/tools/click.js.map +1 -0
  51. package/dist/esm/lib/v3/agent/tools/clickAndHold.d.ts +14 -0
  52. package/dist/esm/lib/v3/agent/tools/clickAndHold.js +68 -0
  53. package/dist/esm/lib/v3/agent/tools/clickAndHold.js.map +1 -0
  54. package/dist/esm/lib/v3/agent/tools/dragAndDrop.d.ts +7 -0
  55. package/dist/esm/lib/v3/agent/tools/dragAndDrop.js +105 -0
  56. package/dist/esm/lib/v3/agent/tools/dragAndDrop.js.map +1 -0
  57. package/dist/esm/lib/v3/agent/tools/extract.d.ts +21 -0
  58. package/dist/esm/lib/v3/agent/tools/extract.js +93 -0
  59. package/dist/esm/lib/v3/agent/tools/extract.js.map +1 -0
  60. package/dist/esm/lib/v3/agent/tools/fillFormVision.d.ts +12 -0
  61. package/dist/esm/lib/v3/agent/tools/fillFormVision.js +143 -0
  62. package/dist/esm/lib/v3/agent/tools/fillFormVision.js.map +1 -0
  63. package/dist/esm/lib/v3/agent/tools/fillform.d.ts +13 -0
  64. package/dist/esm/lib/v3/agent/tools/fillform.js +56 -0
  65. package/dist/esm/lib/v3/agent/tools/fillform.js.map +1 -0
  66. package/dist/esm/lib/v3/agent/tools/goto.d.ts +12 -0
  67. package/dist/esm/lib/v3/agent/tools/goto.js +31 -0
  68. package/dist/esm/lib/v3/agent/tools/goto.js.map +1 -0
  69. package/dist/esm/lib/v3/agent/tools/index.d.ts +92 -0
  70. package/dist/esm/lib/v3/agent/tools/index.js +74 -0
  71. package/dist/esm/lib/v3/agent/tools/index.js.map +1 -0
  72. package/dist/esm/lib/v3/agent/tools/keys.d.ts +24 -0
  73. package/dist/esm/lib/v3/agent/tools/keys.js +60 -0
  74. package/dist/esm/lib/v3/agent/tools/keys.js.map +1 -0
  75. package/dist/esm/lib/v3/agent/tools/navback.d.ts +6 -0
  76. package/dist/esm/lib/v3/agent/tools/navback.js +23 -0
  77. package/dist/esm/lib/v3/agent/tools/navback.js.map +1 -0
  78. package/dist/esm/lib/v3/agent/tools/screenshot.d.ts +6 -0
  79. package/dist/esm/lib/v3/agent/tools/screenshot.js +26 -0
  80. package/dist/esm/lib/v3/agent/tools/screenshot.js.map +1 -0
  81. package/dist/esm/lib/v3/agent/tools/scroll.d.ts +19 -0
  82. package/dist/esm/lib/v3/agent/tools/scroll.js +142 -0
  83. package/dist/esm/lib/v3/agent/tools/scroll.js.map +1 -0
  84. package/dist/esm/lib/v3/agent/tools/search.d.ts +15 -0
  85. package/dist/esm/lib/v3/agent/tools/search.js +73 -0
  86. package/dist/esm/lib/v3/agent/tools/search.js.map +1 -0
  87. package/dist/esm/lib/v3/agent/tools/think.d.ts +6 -0
  88. package/dist/esm/lib/v3/agent/tools/think.js +24 -0
  89. package/dist/esm/lib/v3/agent/tools/think.js.map +1 -0
  90. package/dist/esm/lib/v3/agent/tools/type.d.ts +7 -0
  91. package/dist/esm/lib/v3/agent/tools/type.js +106 -0
  92. package/dist/esm/lib/v3/agent/tools/type.js.map +1 -0
  93. package/dist/esm/lib/v3/agent/tools/wait.d.ts +5 -0
  94. package/dist/esm/lib/v3/agent/tools/wait.js +53 -0
  95. package/dist/esm/lib/v3/agent/tools/wait.js.map +1 -0
  96. package/dist/esm/lib/v3/agent/utils/actionMapping.d.ts +3 -0
  97. package/dist/esm/lib/v3/agent/utils/actionMapping.js +100 -0
  98. package/dist/esm/lib/v3/agent/utils/actionMapping.js.map +1 -0
  99. package/dist/esm/lib/v3/agent/utils/coordinateNormalization.d.ts +13 -0
  100. package/dist/esm/lib/v3/agent/utils/coordinateNormalization.js +28 -0
  101. package/dist/esm/lib/v3/agent/utils/coordinateNormalization.js.map +1 -0
  102. package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.d.ts +10 -0
  103. package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.js +62 -0
  104. package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.js.map +1 -0
  105. package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.d.ts +25 -0
  106. package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.js +145 -0
  107. package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.js.map +1 -0
  108. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.d.ts +22 -0
  109. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js +101 -0
  110. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -0
  111. package/dist/esm/lib/v3/agent/utils/imageCompression.d.ts +53 -0
  112. package/dist/esm/lib/v3/agent/utils/imageCompression.js +204 -0
  113. package/dist/esm/lib/v3/agent/utils/imageCompression.js.map +1 -0
  114. package/dist/esm/lib/v3/agent/utils/messageProcessing.d.ts +12 -0
  115. package/dist/esm/lib/v3/agent/utils/messageProcessing.js +164 -0
  116. package/dist/esm/lib/v3/agent/utils/messageProcessing.js.map +1 -0
  117. package/dist/esm/lib/v3/agent/utils/screenshotHandler.d.ts +10 -0
  118. package/dist/esm/lib/v3/agent/utils/screenshotHandler.js +26 -0
  119. package/dist/esm/lib/v3/agent/utils/screenshotHandler.js.map +1 -0
  120. package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.d.ts +26 -0
  121. package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.js +79 -0
  122. package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.js.map +1 -0
  123. package/dist/esm/lib/v3/agent/utils/xpath.d.ts +11 -0
  124. package/dist/esm/lib/v3/agent/utils/xpath.js +19 -0
  125. package/dist/esm/lib/v3/agent/utils/xpath.js.map +1 -0
  126. package/dist/esm/lib/v3/api.d.ts +86 -0
  127. package/dist/esm/lib/v3/api.js +484 -0
  128. package/dist/esm/lib/v3/api.js.map +1 -0
  129. package/dist/esm/lib/v3/cache/ActCache.d.ts +23 -0
  130. package/dist/esm/lib/v3/cache/ActCache.js +292 -0
  131. package/dist/esm/lib/v3/cache/ActCache.js.map +1 -0
  132. package/dist/esm/lib/v3/cache/AgentCache.d.ts +109 -0
  133. package/dist/esm/lib/v3/cache/AgentCache.js +640 -0
  134. package/dist/esm/lib/v3/cache/AgentCache.js.map +1 -0
  135. package/dist/esm/lib/v3/cache/CacheStorage.d.ts +17 -0
  136. package/dist/esm/lib/v3/cache/CacheStorage.js +98 -0
  137. package/dist/esm/lib/v3/cache/CacheStorage.js.map +1 -0
  138. package/dist/esm/lib/v3/cache/serverAgentCache.d.ts +7 -0
  139. package/dist/esm/lib/v3/cache/serverAgentCache.js +49 -0
  140. package/dist/esm/lib/v3/cache/serverAgentCache.js.map +1 -0
  141. package/dist/esm/lib/v3/cache/utils.d.ts +15 -0
  142. package/dist/esm/lib/v3/cache/utils.js +39 -0
  143. package/dist/esm/lib/v3/cache/utils.js.map +1 -0
  144. package/dist/esm/lib/v3/dom/a11yScripts/index.d.ts +11 -0
  145. package/dist/esm/lib/v3/dom/a11yScripts/index.js +117 -0
  146. package/dist/esm/lib/v3/dom/a11yScripts/index.js.map +1 -0
  147. package/dist/esm/lib/v3/dom/build/a11yScripts.generated.d.ts +16 -0
  148. package/dist/esm/lib/v3/dom/build/a11yScripts.generated.js +20 -0
  149. package/dist/esm/lib/v3/dom/build/a11yScripts.generated.js.map +1 -0
  150. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.d.ts +52 -0
  151. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js +56 -0
  152. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js.map +1 -0
  153. package/dist/esm/lib/v3/dom/build/reRenderScriptContent.d.ts +1 -0
  154. package/dist/esm/lib/v3/dom/build/reRenderScriptContent.js +2 -0
  155. package/dist/esm/lib/v3/dom/build/reRenderScriptContent.js.map +1 -0
  156. package/dist/esm/lib/v3/dom/build/rerender-index.js +1 -0
  157. package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.d.ts +4 -0
  158. package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.js +8 -0
  159. package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.js.map +1 -0
  160. package/dist/esm/lib/v3/dom/build/scriptV3Content.d.ts +1 -0
  161. package/dist/esm/lib/v3/dom/build/scriptV3Content.js +2 -0
  162. package/dist/esm/lib/v3/dom/build/scriptV3Content.js.map +1 -0
  163. package/dist/esm/lib/v3/dom/build/v3-index.js +1 -0
  164. package/dist/esm/lib/v3/dom/genA11yScripts.d.ts +1 -0
  165. package/dist/esm/lib/v3/dom/genA11yScripts.js +54 -0
  166. package/dist/esm/lib/v3/dom/genA11yScripts.js.map +1 -0
  167. package/dist/esm/lib/v3/dom/genDomScripts.d.ts +1 -0
  168. package/dist/esm/lib/v3/dom/genDomScripts.js +38 -0
  169. package/dist/esm/lib/v3/dom/genDomScripts.js.map +1 -0
  170. package/dist/esm/lib/v3/dom/genLocatorScripts.d.ts +1 -0
  171. package/dist/esm/lib/v3/dom/genLocatorScripts.js +51 -0
  172. package/dist/esm/lib/v3/dom/genLocatorScripts.js.map +1 -0
  173. package/dist/esm/lib/v3/dom/genScreenshotScripts.d.ts +1 -0
  174. package/dist/esm/lib/v3/dom/genScreenshotScripts.js +37 -0
  175. package/dist/esm/lib/v3/dom/genScreenshotScripts.js.map +1 -0
  176. package/dist/esm/lib/v3/dom/index.d.ts +1 -0
  177. package/dist/esm/lib/v3/dom/index.js +2 -0
  178. package/dist/esm/lib/v3/dom/index.js.map +1 -0
  179. package/dist/esm/lib/v3/dom/locatorScripts/counts.d.ts +15 -0
  180. package/dist/esm/lib/v3/dom/locatorScripts/counts.js +272 -0
  181. package/dist/esm/lib/v3/dom/locatorScripts/counts.js.map +1 -0
  182. package/dist/esm/lib/v3/dom/locatorScripts/index.d.ts +4 -0
  183. package/dist/esm/lib/v3/dom/locatorScripts/index.js +5 -0
  184. package/dist/esm/lib/v3/dom/locatorScripts/index.js.map +1 -0
  185. package/dist/esm/lib/v3/dom/locatorScripts/scripts.d.ts +37 -0
  186. package/dist/esm/lib/v3/dom/locatorScripts/scripts.js +458 -0
  187. package/dist/esm/lib/v3/dom/locatorScripts/scripts.js.map +1 -0
  188. package/dist/esm/lib/v3/dom/locatorScripts/selectors.d.ts +4 -0
  189. package/dist/esm/lib/v3/dom/locatorScripts/selectors.js +283 -0
  190. package/dist/esm/lib/v3/dom/locatorScripts/selectors.js.map +1 -0
  191. package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.d.ts +19 -0
  192. package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.js +283 -0
  193. package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.js.map +1 -0
  194. package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.d.ts +76 -0
  195. package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.js +376 -0
  196. package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.js.map +1 -0
  197. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.d.ts +9 -0
  198. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js +196 -0
  199. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js.map +1 -0
  200. package/dist/esm/lib/v3/dom/piercer.entry.d.ts +1 -0
  201. package/dist/esm/lib/v3/dom/piercer.entry.js +3 -0
  202. package/dist/esm/lib/v3/dom/piercer.entry.js.map +1 -0
  203. package/dist/esm/lib/v3/dom/piercer.runtime.d.ts +23 -0
  204. package/dist/esm/lib/v3/dom/piercer.runtime.js +90 -0
  205. package/dist/esm/lib/v3/dom/piercer.runtime.js.map +1 -0
  206. package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.d.ts +1 -0
  207. package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.js +3 -0
  208. package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.js.map +1 -0
  209. package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.d.ts +1 -0
  210. package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.js +40 -0
  211. package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.js.map +1 -0
  212. package/dist/esm/lib/v3/dom/screenshotScripts/index.d.ts +1 -0
  213. package/dist/esm/lib/v3/dom/screenshotScripts/index.js +2 -0
  214. package/dist/esm/lib/v3/dom/screenshotScripts/index.js.map +1 -0
  215. package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.d.ts +8 -0
  216. package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.js +82 -0
  217. package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.js.map +1 -0
  218. package/dist/esm/lib/v3/external_clients/aisdk.d.ts +11 -0
  219. package/dist/esm/lib/v3/external_clients/aisdk.js +103 -0
  220. package/dist/esm/lib/v3/external_clients/aisdk.js.map +1 -0
  221. package/dist/esm/lib/v3/external_clients/customOpenAI.d.ts +18 -0
  222. package/dist/esm/lib/v3/external_clients/customOpenAI.js +220 -0
  223. package/dist/esm/lib/v3/external_clients/customOpenAI.js.map +1 -0
  224. package/dist/esm/lib/v3/flowLogger.d.ts +139 -0
  225. package/dist/esm/lib/v3/flowLogger.js +868 -0
  226. package/dist/esm/lib/v3/flowLogger.js.map +1 -0
  227. package/dist/esm/lib/v3/handlers/actHandler.d.ts +21 -0
  228. package/dist/esm/lib/v3/handlers/actHandler.js +340 -0
  229. package/dist/esm/lib/v3/handlers/actHandler.js.map +1 -0
  230. package/dist/esm/lib/v3/handlers/extractHandler.d.ts +31 -0
  231. package/dist/esm/lib/v3/handlers/extractHandler.js +139 -0
  232. package/dist/esm/lib/v3/handlers/extractHandler.js.map +1 -0
  233. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +24 -0
  234. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js +623 -0
  235. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -0
  236. package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.d.ts +2 -0
  237. package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.js +14 -0
  238. package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.js.map +1 -0
  239. package/dist/esm/lib/v3/handlers/observeHandler.d.ts +17 -0
  240. package/dist/esm/lib/v3/handlers/observeHandler.js +156 -0
  241. package/dist/esm/lib/v3/handlers/observeHandler.js.map +1 -0
  242. package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +32 -0
  243. package/dist/esm/lib/v3/handlers/v3AgentHandler.js +461 -0
  244. package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -0
  245. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.d.ts +33 -0
  246. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js +528 -0
  247. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -0
  248. package/dist/esm/lib/v3/index.d.ts +17 -0
  249. package/dist/esm/lib/v3/index.js +13 -0
  250. package/dist/esm/lib/v3/index.js.map +1 -0
  251. package/dist/esm/lib/v3/launch/browserbase.d.ts +7 -0
  252. package/dist/esm/lib/v3/launch/browserbase.js +46 -0
  253. package/dist/esm/lib/v3/launch/browserbase.js.map +1 -0
  254. package/dist/esm/lib/v3/launch/local.d.ts +15 -0
  255. package/dist/esm/lib/v3/launch/local.js +98 -0
  256. package/dist/esm/lib/v3/launch/local.js.map +1 -0
  257. package/dist/esm/lib/v3/llm/AnthropicClient.d.ts +16 -0
  258. package/dist/esm/lib/v3/llm/AnthropicClient.js +239 -0
  259. package/dist/esm/lib/v3/llm/AnthropicClient.js.map +1 -0
  260. package/dist/esm/lib/v3/llm/CerebrasClient.d.ts +17 -0
  261. package/dist/esm/lib/v3/llm/CerebrasClient.js +235 -0
  262. package/dist/esm/lib/v3/llm/CerebrasClient.js.map +1 -0
  263. package/dist/esm/lib/v3/llm/GoogleClient.d.ts +19 -0
  264. package/dist/esm/lib/v3/llm/GoogleClient.js +369 -0
  265. package/dist/esm/lib/v3/llm/GoogleClient.js.map +1 -0
  266. package/dist/esm/lib/v3/llm/GroqClient.d.ts +17 -0
  267. package/dist/esm/lib/v3/llm/GroqClient.js +236 -0
  268. package/dist/esm/lib/v3/llm/GroqClient.js.map +1 -0
  269. package/dist/esm/lib/v3/llm/LLMClient.d.ts +121 -0
  270. package/dist/esm/lib/v3/llm/LLMClient.js +23 -0
  271. package/dist/esm/lib/v3/llm/LLMClient.js.map +1 -0
  272. package/dist/esm/lib/v3/llm/LLMProvider.d.ts +13 -0
  273. package/dist/esm/lib/v3/llm/LLMProvider.js +194 -0
  274. package/dist/esm/lib/v3/llm/LLMProvider.js.map +1 -0
  275. package/dist/esm/lib/v3/llm/OpenAIClient.d.ts +15 -0
  276. package/dist/esm/lib/v3/llm/OpenAIClient.js +329 -0
  277. package/dist/esm/lib/v3/llm/OpenAIClient.js.map +1 -0
  278. package/dist/esm/lib/v3/llm/aisdk.d.ts +15 -0
  279. package/dist/esm/lib/v3/llm/aisdk.js +348 -0
  280. package/dist/esm/lib/v3/llm/aisdk.js.map +1 -0
  281. package/dist/esm/lib/v3/logger.d.ts +9 -0
  282. package/dist/esm/lib/v3/logger.js +96 -0
  283. package/dist/esm/lib/v3/logger.js.map +1 -0
  284. package/dist/esm/lib/v3/mcp/connection.d.ts +11 -0
  285. package/dist/esm/lib/v3/mcp/connection.js +49 -0
  286. package/dist/esm/lib/v3/mcp/connection.js.map +1 -0
  287. package/dist/esm/lib/v3/mcp/utils.d.ts +3 -0
  288. package/dist/esm/lib/v3/mcp/utils.js +36 -0
  289. package/dist/esm/lib/v3/mcp/utils.js.map +1 -0
  290. package/dist/esm/lib/v3/shutdown/cleanupLocal.d.ts +14 -0
  291. package/dist/esm/lib/v3/shutdown/cleanupLocal.js +30 -0
  292. package/dist/esm/lib/v3/shutdown/cleanupLocal.js.map +1 -0
  293. package/dist/esm/lib/v3/shutdown/supervisor.d.ts +9 -0
  294. package/dist/esm/lib/v3/shutdown/supervisor.js +156 -0
  295. package/dist/esm/lib/v3/shutdown/supervisor.js.map +1 -0
  296. package/dist/esm/lib/v3/shutdown/supervisorClient.d.ts +15 -0
  297. package/dist/esm/lib/v3/shutdown/supervisorClient.js +97 -0
  298. package/dist/esm/lib/v3/shutdown/supervisorClient.js.map +1 -0
  299. package/dist/esm/lib/v3/tests/agent-abort-signal.spec.js +113 -0
  300. package/dist/esm/lib/v3/tests/agent-abort-signal.spec.js.map +7 -0
  301. package/dist/esm/lib/v3/tests/agent-cache-self-heal.spec.js +80 -0
  302. package/dist/esm/lib/v3/tests/agent-cache-self-heal.spec.js.map +7 -0
  303. package/dist/esm/lib/v3/tests/agent-callbacks.spec.js +374 -0
  304. package/dist/esm/lib/v3/tests/agent-callbacks.spec.js.map +7 -0
  305. package/dist/esm/lib/v3/tests/agent-experimental-validation.spec.js +357 -0
  306. package/dist/esm/lib/v3/tests/agent-experimental-validation.spec.js.map +7 -0
  307. package/dist/esm/lib/v3/tests/agent-hybrid-mode.spec.js +247 -0
  308. package/dist/esm/lib/v3/tests/agent-hybrid-mode.spec.js.map +7 -0
  309. package/dist/esm/lib/v3/tests/agent-message-continuation.spec.js +105 -0
  310. package/dist/esm/lib/v3/tests/agent-message-continuation.spec.js.map +7 -0
  311. package/dist/esm/lib/v3/tests/agent-streaming.spec.js +126 -0
  312. package/dist/esm/lib/v3/tests/agent-streaming.spec.js.map +7 -0
  313. package/dist/esm/lib/v3/tests/cdp-session-detached.spec.js +44 -0
  314. package/dist/esm/lib/v3/tests/cdp-session-detached.spec.js.map +7 -0
  315. package/dist/esm/lib/v3/tests/click-count.spec.js +112 -0
  316. package/dist/esm/lib/v3/tests/click-count.spec.js.map +7 -0
  317. package/dist/esm/lib/v3/tests/connect-to-existing-browser.spec.js +54 -0
  318. package/dist/esm/lib/v3/tests/connect-to-existing-browser.spec.js.map +7 -0
  319. package/dist/esm/lib/v3/tests/context-addInitScript.spec.js +176 -0
  320. package/dist/esm/lib/v3/tests/context-addInitScript.spec.js.map +7 -0
  321. package/dist/esm/lib/v3/tests/default-page-tracking.spec.js +53 -0
  322. package/dist/esm/lib/v3/tests/default-page-tracking.spec.js.map +7 -0
  323. package/dist/esm/lib/v3/tests/downloads.spec.js +58 -0
  324. package/dist/esm/lib/v3/tests/downloads.spec.js.map +7 -0
  325. package/dist/esm/lib/v3/tests/envReporter.js +57 -0
  326. package/dist/esm/lib/v3/tests/envReporter.js.map +7 -0
  327. package/dist/esm/lib/v3/tests/frame-get-location-and-click.spec.js +53 -0
  328. package/dist/esm/lib/v3/tests/frame-get-location-and-click.spec.js.map +7 -0
  329. package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js +447 -0
  330. package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js.map +7 -0
  331. package/dist/esm/lib/v3/tests/keep-alive.child.js +92 -0
  332. package/dist/esm/lib/v3/tests/keep-alive.child.js.map +7 -0
  333. package/dist/esm/lib/v3/tests/keep-alive.helpers.js +532 -0
  334. package/dist/esm/lib/v3/tests/keep-alive.helpers.js.map +7 -0
  335. package/dist/esm/lib/v3/tests/keep-alive.spec.js +19 -0
  336. package/dist/esm/lib/v3/tests/keep-alive.spec.js.map +7 -0
  337. package/dist/esm/lib/v3/tests/keyboard.spec.js +296 -0
  338. package/dist/esm/lib/v3/tests/keyboard.spec.js.map +7 -0
  339. package/dist/esm/lib/v3/tests/locator-backend-node-id.spec.js +159 -0
  340. package/dist/esm/lib/v3/tests/locator-backend-node-id.spec.js.map +7 -0
  341. package/dist/esm/lib/v3/tests/locator-content-methods.spec.js +191 -0
  342. package/dist/esm/lib/v3/tests/locator-content-methods.spec.js.map +7 -0
  343. package/dist/esm/lib/v3/tests/locator-count-iframe.spec.js +108 -0
  344. package/dist/esm/lib/v3/tests/locator-count-iframe.spec.js.map +7 -0
  345. package/dist/esm/lib/v3/tests/locator-count.spec.js +71 -0
  346. package/dist/esm/lib/v3/tests/locator-count.spec.js.map +7 -0
  347. package/dist/esm/lib/v3/tests/locator-fill.spec.js +118 -0
  348. package/dist/esm/lib/v3/tests/locator-fill.spec.js.map +7 -0
  349. package/dist/esm/lib/v3/tests/locator-input-methods.spec.js +136 -0
  350. package/dist/esm/lib/v3/tests/locator-input-methods.spec.js.map +7 -0
  351. package/dist/esm/lib/v3/tests/locator-nth.spec.js +157 -0
  352. package/dist/esm/lib/v3/tests/locator-nth.spec.js.map +7 -0
  353. package/dist/esm/lib/v3/tests/locator-select-option.spec.js +242 -0
  354. package/dist/esm/lib/v3/tests/locator-select-option.spec.js.map +7 -0
  355. package/dist/esm/lib/v3/tests/logger-initialization.spec.js +552 -0
  356. package/dist/esm/lib/v3/tests/logger-initialization.spec.js.map +7 -0
  357. package/dist/esm/lib/v3/tests/multi-instance-logger.spec.js +269 -0
  358. package/dist/esm/lib/v3/tests/multi-instance-logger.spec.js.map +7 -0
  359. package/dist/esm/lib/v3/tests/nested-div.spec.js +23 -0
  360. package/dist/esm/lib/v3/tests/nested-div.spec.js.map +7 -0
  361. package/dist/esm/lib/v3/tests/page-addInitScript.spec.js +90 -0
  362. package/dist/esm/lib/v3/tests/page-addInitScript.spec.js.map +7 -0
  363. package/dist/esm/lib/v3/tests/page-console.spec.js +56 -0
  364. package/dist/esm/lib/v3/tests/page-console.spec.js.map +7 -0
  365. package/dist/esm/lib/v3/tests/page-drag-and-drop.spec.js +418 -0
  366. package/dist/esm/lib/v3/tests/page-drag-and-drop.spec.js.map +7 -0
  367. package/dist/esm/lib/v3/tests/page-goto-response.spec.js +35 -0
  368. package/dist/esm/lib/v3/tests/page-goto-response.spec.js.map +7 -0
  369. package/dist/esm/lib/v3/tests/page-hover.spec.js +167 -0
  370. package/dist/esm/lib/v3/tests/page-hover.spec.js.map +7 -0
  371. package/dist/esm/lib/v3/tests/page-screenshot.spec.js +273 -0
  372. package/dist/esm/lib/v3/tests/page-screenshot.spec.js.map +7 -0
  373. package/dist/esm/lib/v3/tests/page-scroll.spec.js +182 -0
  374. package/dist/esm/lib/v3/tests/page-scroll.spec.js.map +7 -0
  375. package/dist/esm/lib/v3/tests/page-send-cdp.spec.js +46 -0
  376. package/dist/esm/lib/v3/tests/page-send-cdp.spec.js.map +7 -0
  377. package/dist/esm/lib/v3/tests/perform-understudy-method.spec.js +98 -0
  378. package/dist/esm/lib/v3/tests/perform-understudy-method.spec.js.map +7 -0
  379. package/dist/esm/lib/v3/tests/setinputfiles.spec.js +126 -0
  380. package/dist/esm/lib/v3/tests/setinputfiles.spec.js.map +7 -0
  381. package/dist/esm/lib/v3/tests/shadow-iframe-oopif.spec.js +134 -0
  382. package/dist/esm/lib/v3/tests/shadow-iframe-oopif.spec.js.map +7 -0
  383. package/dist/esm/lib/v3/tests/shadow-iframe-spif.spec.js +134 -0
  384. package/dist/esm/lib/v3/tests/shadow-iframe-spif.spec.js.map +7 -0
  385. package/dist/esm/lib/v3/tests/testUtils.js +31 -0
  386. package/dist/esm/lib/v3/tests/testUtils.js.map +7 -0
  387. package/dist/esm/lib/v3/tests/text-selector-innermost.spec.js +100 -0
  388. package/dist/esm/lib/v3/tests/text-selector-innermost.spec.js.map +7 -0
  389. package/dist/esm/lib/v3/tests/timeouts.spec.js +32 -0
  390. package/dist/esm/lib/v3/tests/timeouts.spec.js.map +7 -0
  391. package/dist/esm/lib/v3/tests/user-data-dir.spec.js +43 -0
  392. package/dist/esm/lib/v3/tests/user-data-dir.spec.js.map +7 -0
  393. package/dist/esm/lib/v3/tests/v3.config.js +15 -0
  394. package/dist/esm/lib/v3/tests/v3.config.js.map +7 -0
  395. package/dist/esm/lib/v3/tests/v3.dynamic.config.js +43 -0
  396. package/dist/esm/lib/v3/tests/v3.dynamic.config.js.map +7 -0
  397. package/dist/esm/lib/v3/tests/v3.playwright.config.js +98 -0
  398. package/dist/esm/lib/v3/tests/v3.playwright.config.js.map +7 -0
  399. package/dist/esm/lib/v3/tests/wait-for-selector.spec.js +593 -0
  400. package/dist/esm/lib/v3/tests/wait-for-selector.spec.js.map +7 -0
  401. package/dist/esm/lib/v3/tests/wait-for-timeout.spec.js +97 -0
  402. package/dist/esm/lib/v3/tests/wait-for-timeout.spec.js.map +7 -0
  403. package/dist/esm/lib/v3/tests/xpath-for-location-deep.spec.js +77 -0
  404. package/dist/esm/lib/v3/tests/xpath-for-location-deep.spec.js.map +7 -0
  405. package/dist/esm/lib/v3/timeoutConfig.d.ts +2 -0
  406. package/dist/esm/lib/v3/timeoutConfig.js +27 -0
  407. package/dist/esm/lib/v3/timeoutConfig.js.map +1 -0
  408. package/dist/esm/lib/v3/types/private/agent.d.ts +6 -0
  409. package/dist/esm/lib/v3/types/private/agent.js +2 -0
  410. package/dist/esm/lib/v3/types/private/agent.js.map +1 -0
  411. package/dist/esm/lib/v3/types/private/api.d.ts +11 -0
  412. package/dist/esm/lib/v3/types/private/api.js +2 -0
  413. package/dist/esm/lib/v3/types/private/api.js.map +1 -0
  414. package/dist/esm/lib/v3/types/private/cache.d.ts +128 -0
  415. package/dist/esm/lib/v3/types/private/cache.js +2 -0
  416. package/dist/esm/lib/v3/types/private/cache.js.map +1 -0
  417. package/dist/esm/lib/v3/types/private/evaluator.d.ts +40 -0
  418. package/dist/esm/lib/v3/types/private/evaluator.js +2 -0
  419. package/dist/esm/lib/v3/types/private/evaluator.js.map +1 -0
  420. package/dist/esm/lib/v3/types/private/handlers.d.ts +38 -0
  421. package/dist/esm/lib/v3/types/private/handlers.js +16 -0
  422. package/dist/esm/lib/v3/types/private/handlers.js.map +1 -0
  423. package/dist/esm/lib/v3/types/private/index.d.ts +7 -0
  424. package/dist/esm/lib/v3/types/private/index.js +8 -0
  425. package/dist/esm/lib/v3/types/private/index.js.map +1 -0
  426. package/dist/esm/lib/v3/types/private/internal.d.ts +39 -0
  427. package/dist/esm/lib/v3/types/private/internal.js +2 -0
  428. package/dist/esm/lib/v3/types/private/internal.js.map +1 -0
  429. package/dist/esm/lib/v3/types/private/locator.d.ts +9 -0
  430. package/dist/esm/lib/v3/types/private/locator.js +2 -0
  431. package/dist/esm/lib/v3/types/private/locator.js.map +1 -0
  432. package/dist/esm/lib/v3/types/private/network.d.ts +34 -0
  433. package/dist/esm/lib/v3/types/private/network.js +3 -0
  434. package/dist/esm/lib/v3/types/private/network.js.map +1 -0
  435. package/dist/esm/lib/v3/types/private/shutdown.d.ts +31 -0
  436. package/dist/esm/lib/v3/types/private/shutdown.js +5 -0
  437. package/dist/esm/lib/v3/types/private/shutdown.js.map +1 -0
  438. package/dist/esm/lib/v3/types/private/shutdownErrors.d.ts +12 -0
  439. package/dist/esm/lib/v3/types/private/shutdownErrors.js +22 -0
  440. package/dist/esm/lib/v3/types/private/shutdownErrors.js.map +1 -0
  441. package/dist/esm/lib/v3/types/private/snapshot.d.ts +117 -0
  442. package/dist/esm/lib/v3/types/private/snapshot.js +2 -0
  443. package/dist/esm/lib/v3/types/private/snapshot.js.map +1 -0
  444. package/dist/esm/lib/v3/types/public/agent.d.ts +595 -0
  445. package/dist/esm/lib/v3/types/public/agent.js +15 -0
  446. package/dist/esm/lib/v3/types/public/agent.js.map +1 -0
  447. package/dist/esm/lib/v3/types/public/api.d.ts +1211 -0
  448. package/dist/esm/lib/v3/types/public/api.js +915 -0
  449. package/dist/esm/lib/v3/types/public/api.js.map +1 -0
  450. package/dist/esm/lib/v3/types/public/apiErrors.d.ts +18 -0
  451. package/dist/esm/lib/v3/types/public/apiErrors.js +32 -0
  452. package/dist/esm/lib/v3/types/public/apiErrors.js.map +1 -0
  453. package/dist/esm/lib/v3/types/public/index.d.ts +12 -0
  454. package/dist/esm/lib/v3/types/public/index.js +14 -0
  455. package/dist/esm/lib/v3/types/public/index.js.map +1 -0
  456. package/dist/esm/lib/v3/types/public/locator.d.ts +9 -0
  457. package/dist/esm/lib/v3/types/public/locator.js +2 -0
  458. package/dist/esm/lib/v3/types/public/locator.js.map +1 -0
  459. package/dist/esm/lib/v3/types/public/logs.d.ts +23 -0
  460. package/dist/esm/lib/v3/types/public/logs.js +13 -0
  461. package/dist/esm/lib/v3/types/public/logs.js.map +1 -0
  462. package/dist/esm/lib/v3/types/public/methods.d.ts +56 -0
  463. package/dist/esm/lib/v3/types/public/methods.js +15 -0
  464. package/dist/esm/lib/v3/types/public/methods.js.map +1 -0
  465. package/dist/esm/lib/v3/types/public/metrics.d.ts +27 -0
  466. package/dist/esm/lib/v3/types/public/metrics.js +2 -0
  467. package/dist/esm/lib/v3/types/public/metrics.js.map +1 -0
  468. package/dist/esm/lib/v3/types/public/model.d.ts +65 -0
  469. package/dist/esm/lib/v3/types/public/model.js +2 -0
  470. package/dist/esm/lib/v3/types/public/model.js.map +1 -0
  471. package/dist/esm/lib/v3/types/public/options.d.ts +70 -0
  472. package/dist/esm/lib/v3/types/public/options.js +4 -0
  473. package/dist/esm/lib/v3/types/public/options.js.map +1 -0
  474. package/dist/esm/lib/v3/types/public/page.d.ts +18 -0
  475. package/dist/esm/lib/v3/types/public/page.js +3 -0
  476. package/dist/esm/lib/v3/types/public/page.js.map +1 -0
  477. package/dist/esm/lib/v3/types/public/screenshotTypes.d.ts +25 -0
  478. package/dist/esm/lib/v3/types/public/screenshotTypes.js +2 -0
  479. package/dist/esm/lib/v3/types/public/screenshotTypes.js.map +1 -0
  480. package/dist/esm/lib/v3/types/public/sdkErrors.d.ts +152 -0
  481. package/dist/esm/lib/v3/types/public/sdkErrors.js +305 -0
  482. package/dist/esm/lib/v3/types/public/sdkErrors.js.map +1 -0
  483. package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.d.ts +15 -0
  484. package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.js +196 -0
  485. package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.js.map +1 -0
  486. package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.d.ts +8 -0
  487. package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.js +121 -0
  488. package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.js.map +1 -0
  489. package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.d.ts +77 -0
  490. package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js +336 -0
  491. package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js.map +1 -0
  492. package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.d.ts +7 -0
  493. package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.js +129 -0
  494. package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.js.map +1 -0
  495. package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.d.ts +46 -0
  496. package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.js +274 -0
  497. package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.js.map +1 -0
  498. package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.d.ts +24 -0
  499. package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.js +216 -0
  500. package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.js.map +1 -0
  501. package/dist/esm/lib/v3/understudy/a11y/snapshot/index.d.ts +4 -0
  502. package/dist/esm/lib/v3/understudy/a11y/snapshot/index.js +5 -0
  503. package/dist/esm/lib/v3/understudy/a11y/snapshot/index.js.map +1 -0
  504. package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.d.ts +16 -0
  505. package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.js +22 -0
  506. package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.js.map +1 -0
  507. package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.d.ts +28 -0
  508. package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.js +135 -0
  509. package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.js.map +1 -0
  510. package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.d.ts +26 -0
  511. package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.js +102 -0
  512. package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.js.map +1 -0
  513. package/dist/esm/lib/v3/understudy/a11yInvocation.d.ts +8 -0
  514. package/dist/esm/lib/v3/understudy/a11yInvocation.js +12 -0
  515. package/dist/esm/lib/v3/understudy/a11yInvocation.js.map +1 -0
  516. package/dist/esm/lib/v3/understudy/cdp.d.ts +69 -0
  517. package/dist/esm/lib/v3/understudy/cdp.js +251 -0
  518. package/dist/esm/lib/v3/understudy/cdp.js.map +1 -0
  519. package/dist/esm/lib/v3/understudy/consoleMessage.d.ts +22 -0
  520. package/dist/esm/lib/v3/understudy/consoleMessage.js +66 -0
  521. package/dist/esm/lib/v3/understudy/consoleMessage.js.map +1 -0
  522. package/dist/esm/lib/v3/understudy/context.d.ts +132 -0
  523. package/dist/esm/lib/v3/understudy/context.js +687 -0
  524. package/dist/esm/lib/v3/understudy/context.js.map +1 -0
  525. package/dist/esm/lib/v3/understudy/deepLocator.d.ts +87 -0
  526. package/dist/esm/lib/v3/understudy/deepLocator.js +218 -0
  527. package/dist/esm/lib/v3/understudy/deepLocator.js.map +1 -0
  528. package/dist/esm/lib/v3/understudy/executionContextRegistry.d.ts +15 -0
  529. package/dist/esm/lib/v3/understudy/executionContextRegistry.js +83 -0
  530. package/dist/esm/lib/v3/understudy/executionContextRegistry.js.map +1 -0
  531. package/dist/esm/lib/v3/understudy/fileUploadUtils.d.ts +13 -0
  532. package/dist/esm/lib/v3/understudy/fileUploadUtils.js +81 -0
  533. package/dist/esm/lib/v3/understudy/fileUploadUtils.js.map +1 -0
  534. package/dist/esm/lib/v3/understudy/frame.d.ts +69 -0
  535. package/dist/esm/lib/v3/understudy/frame.js +211 -0
  536. package/dist/esm/lib/v3/understudy/frame.js.map +1 -0
  537. package/dist/esm/lib/v3/understudy/frameLocator.d.ts +50 -0
  538. package/dist/esm/lib/v3/understudy/frameLocator.js +255 -0
  539. package/dist/esm/lib/v3/understudy/frameLocator.js.map +1 -0
  540. package/dist/esm/lib/v3/understudy/frameRegistry.d.ts +101 -0
  541. package/dist/esm/lib/v3/understudy/frameRegistry.js +298 -0
  542. package/dist/esm/lib/v3/understudy/frameRegistry.js.map +1 -0
  543. package/dist/esm/lib/v3/understudy/initScripts.d.ts +2 -0
  544. package/dist/esm/lib/v3/understudy/initScripts.js +33 -0
  545. package/dist/esm/lib/v3/understudy/initScripts.js.map +1 -0
  546. package/dist/esm/lib/v3/understudy/lifecycleWatcher.d.ts +64 -0
  547. package/dist/esm/lib/v3/understudy/lifecycleWatcher.js +245 -0
  548. package/dist/esm/lib/v3/understudy/lifecycleWatcher.js.map +1 -0
  549. package/dist/esm/lib/v3/understudy/locator.d.ts +194 -0
  550. package/dist/esm/lib/v3/understudy/locator.js +753 -0
  551. package/dist/esm/lib/v3/understudy/locator.js.map +1 -0
  552. package/dist/esm/lib/v3/understudy/locatorInvocation.d.ts +8 -0
  553. package/dist/esm/lib/v3/understudy/locatorInvocation.js +12 -0
  554. package/dist/esm/lib/v3/understudy/locatorInvocation.js.map +1 -0
  555. package/dist/esm/lib/v3/understudy/navigationResponseTracker.d.ts +84 -0
  556. package/dist/esm/lib/v3/understudy/navigationResponseTracker.js +224 -0
  557. package/dist/esm/lib/v3/understudy/navigationResponseTracker.js.map +1 -0
  558. package/dist/esm/lib/v3/understudy/networkManager.d.ts +53 -0
  559. package/dist/esm/lib/v3/understudy/networkManager.js +306 -0
  560. package/dist/esm/lib/v3/understudy/networkManager.js.map +1 -0
  561. package/dist/esm/lib/v3/understudy/page.d.ts +354 -0
  562. package/dist/esm/lib/v3/understudy/page.js +1941 -0
  563. package/dist/esm/lib/v3/understudy/page.js.map +1 -0
  564. package/dist/esm/lib/v3/understudy/piercer.d.ts +4 -0
  565. package/dist/esm/lib/v3/understudy/piercer.js +61 -0
  566. package/dist/esm/lib/v3/understudy/piercer.js.map +1 -0
  567. package/dist/esm/lib/v3/understudy/response.d.ts +137 -0
  568. package/dist/esm/lib/v3/understudy/response.js +330 -0
  569. package/dist/esm/lib/v3/understudy/response.js.map +1 -0
  570. package/dist/esm/lib/v3/understudy/screenshotUtils.d.ts +16 -0
  571. package/dist/esm/lib/v3/understudy/screenshotUtils.js +352 -0
  572. package/dist/esm/lib/v3/understudy/screenshotUtils.js.map +1 -0
  573. package/dist/esm/lib/v3/understudy/selectorResolver.d.ts +38 -0
  574. package/dist/esm/lib/v3/understudy/selectorResolver.js +296 -0
  575. package/dist/esm/lib/v3/understudy/selectorResolver.js.map +1 -0
  576. package/dist/esm/lib/v3/v3.d.ts +191 -0
  577. package/dist/esm/lib/v3/v3.js +1572 -0
  578. package/dist/esm/lib/v3/v3.js.map +1 -0
  579. package/dist/esm/lib/v3/zodCompat.d.ts +12 -0
  580. package/dist/esm/lib/v3/zodCompat.js +17 -0
  581. package/dist/esm/lib/v3/zodCompat.js.map +1 -0
  582. package/dist/esm/lib/v3Evaluator.d.ts +19 -0
  583. package/dist/esm/lib/v3Evaluator.js +210 -0
  584. package/dist/esm/lib/v3Evaluator.js.map +1 -0
  585. package/dist/esm/lib/version.d.ts +5 -0
  586. package/dist/esm/lib/version.js +6 -0
  587. package/dist/esm/lib/version.js.map +1 -0
  588. package/dist/esm/package.json +3 -0
  589. package/dist/esm/tests/agent-execution-model.test.js +139 -0
  590. package/dist/esm/tests/agent-execution-model.test.js.map +7 -0
  591. package/dist/esm/tests/browserbase-session-accessors.test.js +101 -0
  592. package/dist/esm/tests/browserbase-session-accessors.test.js.map +7 -0
  593. package/dist/esm/tests/cache-llm-resolution.test.js +187 -0
  594. package/dist/esm/tests/cache-llm-resolution.test.js.map +7 -0
  595. package/dist/esm/tests/helpers/mockCDPSession.js +27 -0
  596. package/dist/esm/tests/helpers/mockCDPSession.js.map +7 -0
  597. package/dist/esm/tests/llm-provider.test.js +57 -0
  598. package/dist/esm/tests/llm-provider.test.js.map +7 -0
  599. package/dist/esm/tests/model-deprecation.test.js +135 -0
  600. package/dist/esm/tests/model-deprecation.test.js.map +7 -0
  601. package/dist/esm/tests/model-utils.test.js +43 -0
  602. package/dist/esm/tests/model-utils.test.js.map +7 -0
  603. package/dist/esm/tests/page-snapshot.test.js +36 -0
  604. package/dist/esm/tests/page-snapshot.test.js.map +7 -0
  605. package/dist/esm/tests/public-api/export-surface.test.js +53 -0
  606. package/dist/esm/tests/public-api/export-surface.test.js.map +7 -0
  607. package/dist/esm/tests/public-api/llm-and-agents.test.js +128 -0
  608. package/dist/esm/tests/public-api/llm-and-agents.test.js.map +7 -0
  609. package/dist/esm/tests/public-api/public-error-types.test.js +71 -0
  610. package/dist/esm/tests/public-api/public-error-types.test.js.map +7 -0
  611. package/dist/esm/tests/public-api/public-types.test.js +74 -0
  612. package/dist/esm/tests/public-api/public-types.test.js.map +7 -0
  613. package/dist/esm/tests/public-api/runtime-utils.test.js +31 -0
  614. package/dist/esm/tests/public-api/runtime-utils.test.js.map +7 -0
  615. package/dist/esm/tests/public-api/schema-utils.test.js +78 -0
  616. package/dist/esm/tests/public-api/schema-utils.test.js.map +7 -0
  617. package/dist/esm/tests/public-api/timeout-error-types.test.js +81 -0
  618. package/dist/esm/tests/public-api/timeout-error-types.test.js.map +7 -0
  619. package/dist/esm/tests/public-api/tool-type-export.test.js +25 -0
  620. package/dist/esm/tests/public-api/tool-type-export.test.js.map +7 -0
  621. package/dist/esm/tests/public-api/v3-core.test.js +82 -0
  622. package/dist/esm/tests/public-api/v3-core.test.js.map +7 -0
  623. package/dist/esm/tests/safety-confirmation.test.js +134 -0
  624. package/dist/esm/tests/safety-confirmation.test.js.map +7 -0
  625. package/dist/esm/tests/snapshot-a11y-resolvers.test.js +348 -0
  626. package/dist/esm/tests/snapshot-a11y-resolvers.test.js.map +7 -0
  627. package/dist/esm/tests/snapshot-a11y-tree-utils.test.js +300 -0
  628. package/dist/esm/tests/snapshot-a11y-tree-utils.test.js.map +7 -0
  629. package/dist/esm/tests/snapshot-capture-orchestration.test.js +381 -0
  630. package/dist/esm/tests/snapshot-capture-orchestration.test.js.map +7 -0
  631. package/dist/esm/tests/snapshot-cbor.test.js +197 -0
  632. package/dist/esm/tests/snapshot-cbor.test.js.map +7 -0
  633. package/dist/esm/tests/snapshot-dom-session-builders.test.js +251 -0
  634. package/dist/esm/tests/snapshot-dom-session-builders.test.js.map +7 -0
  635. package/dist/esm/tests/snapshot-dom-tree-utils.test.js +109 -0
  636. package/dist/esm/tests/snapshot-dom-tree-utils.test.js.map +7 -0
  637. package/dist/esm/tests/snapshot-focus-selectors-utils.test.js +49 -0
  638. package/dist/esm/tests/snapshot-focus-selectors-utils.test.js.map +7 -0
  639. package/dist/esm/tests/snapshot-frame-merge.test.js +391 -0
  640. package/dist/esm/tests/snapshot-frame-merge.test.js.map +7 -0
  641. package/dist/esm/tests/snapshot-tree-format-utils.test.js +113 -0
  642. package/dist/esm/tests/snapshot-tree-format-utils.test.js.map +7 -0
  643. package/dist/esm/tests/snapshot-xpath-utils.test.js +79 -0
  644. package/dist/esm/tests/snapshot-xpath-utils.test.js.map +7 -0
  645. package/dist/esm/tests/timeout-handlers.test.js +850 -0
  646. package/dist/esm/tests/timeout-handlers.test.js.map +7 -0
  647. package/dist/esm/tests/xpath-parser.test.js +317 -0
  648. package/dist/esm/tests/xpath-parser.test.js.map +7 -0
  649. package/dist/esm/tests/xpath-resolver.test.js +73 -0
  650. package/dist/esm/tests/xpath-resolver.test.js.map +7 -0
  651. package/dist/esm/tests/zod-enum-compatibility.test.js +97 -0
  652. package/dist/esm/tests/zod-enum-compatibility.test.js.map +7 -0
  653. package/package.json +37 -24
  654. package/dist/index.d.ts +0 -4363
  655. package/dist/index.js +0 -76530
@@ -0,0 +1,52 @@
1
+ export declare const locatorScriptBootstrap = "if (!globalThis.__stagehandLocatorScripts) { var __stagehandLocatorScriptsFactory=(()=>{var M=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},j=(e,t,n,o)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let r of U(t))!Q.call(e,r)&&r!==n&&M(e,r,{get:()=>t[r],enumerable:!(o=K(t,r))||o.enumerable});return e};var J=e=>j(M({},\"__esModule\",{value:!0}),e);var Oe={};Z(Oe,{assignFilePayloadsToInputElement:()=>te,countCssMatchesPierce:()=>Me,countCssMatchesPrimary:()=>Ce,countTextMatches:()=>Le,countXPathMatchesMainWorld:()=>Pe,dispatchDomClick:()=>ne,ensureFileInputElement:()=>ee,fillElementValue:()=>se,focusElement:()=>le,isElementChecked:()=>ce,isElementVisible:()=>ae,prepareElementForTyping:()=>v,readElementInnerHTML:()=>me,readElementInnerText:()=>fe,readElementInputValue:()=>ue,readElementTextContent:()=>de,resolveCssSelector:()=>ve,resolveCssSelectorPierce:()=>Te,resolveTextSelector:()=>Re,resolveXPathMainWorld:()=>Ne,scrollElementToPercent:()=>oe,selectElementOptions:()=>ie,waitForSelector:()=>_e});function ee(){try{return(this.tagName?.toLowerCase()??\"\")!==\"input\"?!1:String(this.type??\"\").toLowerCase()===\"file\"}catch{return!1}}function te(e){try{let t=this;if(!t||t.tagName?.toLowerCase()!==\"input\"||(t.type??\"\").toLowerCase()!==\"file\")return!1;let n=(()=>{try{return new DataTransfer}catch{return null}})();if(!n)return!1;let o=Array.isArray(e)?e:[];for(let r of o){if(!r)continue;let l=r.name||\"upload.bin\",s=r.mimeType||\"application/octet-stream\",i=typeof r.lastModified==\"number\"?r.lastModified:Date.now(),a=window.atob(r.base64??\"\"),d=new Uint8Array(a.length);for(let p=0;p<a.length;p+=1)d[p]=a.charCodeAt(p);let f=new Blob([d],{type:s}),c=new File([f],l,{type:s,lastModified:i});n.items.add(c)}return t.files=n.files,t.dispatchEvent(new Event(\"input\",{bubbles:!0})),t.dispatchEvent(new Event(\"change\",{bubbles:!0})),!0}catch{return!1}}function ne(e){let t=e??{};try{let n=new MouseEvent(\"click\",{bubbles:!!t.bubbles,cancelable:!!t.cancelable,composed:!!t.composed,detail:typeof t.detail==\"number\"?t.detail:1,view:this?.ownerDocument?.defaultView??window});this.dispatchEvent(n)}catch{try{this.click()}catch{}}}function oe(e){let t=n=>{if(typeof n==\"number\"&&Number.isFinite(n))return n;let o=String(n??\"\").trim();if(!o)return 0;let r=parseFloat(o.replace(\"%\",\"\"));return Number.isNaN(r)||!Number.isFinite(r)?0:r};try{let n=Math.max(0,Math.min(t(e),100)),o=this,r=o.tagName?.toLowerCase()??\"\";if(r===\"html\"||r===\"body\"){let c=(o.ownerDocument?.scrollingElement||o.ownerDocument?.documentElement||o.ownerDocument?.body||document.scrollingElement||document.documentElement||document.body)?.scrollHeight??document.body.scrollHeight??0,p=o.ownerDocument?.defaultView?.innerHeight??window.innerHeight,w=Math.max(0,c-p)*(n/100);return o.ownerDocument?.defaultView?.scrollTo({top:w,left:o.ownerDocument?.defaultView?.scrollX??window.scrollX??0,behavior:\"smooth\"}),!0}let s=o.scrollHeight??0,i=o.clientHeight??0,d=Math.max(0,s-i)*(n/100);return o.scrollTo({top:d,left:o.scrollLeft??0,behavior:\"smooth\"}),!0}catch{return!1}}var H=new Set([\"color\",\"date\",\"datetime-local\",\"month\",\"range\",\"time\",\"week\"]),re=new Set([\"\",\"email\",\"number\",\"password\",\"search\",\"tel\",\"text\",\"url\"]);function v(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument||document,n=t.defaultView||window;try{typeof e.focus==\"function\"&&e.focus()}catch{}if(e instanceof n.HTMLInputElement||e instanceof n.HTMLTextAreaElement){try{if(typeof e.select==\"function\")return e.select(),!0}catch{}try{let o=(e.value??\"\").length;if(typeof e.setSelectionRange==\"function\")return e.setSelectionRange(0,o),!0}catch{}return!0}if(e.isContentEditable){let o=t.getSelection?.(),r=t.createRange?.();if(o&&r)try{r.selectNodeContents(e),o.removeAllRanges(),o.addRange(r)}catch{}return!0}return!1}catch{return!1}}function se(e){let t=this;if(!t.isConnected)return{status:\"error\",reason:\"notconnected\"};let o=(t.ownerDocument||document).defaultView||window,r=e??\"\";try{let l=s=>{let i;if(typeof o.InputEvent==\"function\")try{i=new o.InputEvent(\"input\",{bubbles:!0,composed:!0,data:s,inputType:\"insertText\"})}catch{i=new o.Event(\"input\",{bubbles:!0,composed:!0})}else i=new o.Event(\"input\",{bubbles:!0,composed:!0});t.dispatchEvent(i);let a=new o.Event(\"change\",{bubbles:!0});t.dispatchEvent(a)};if(t instanceof o.HTMLInputElement){let s=(t.type||\"\").toLowerCase();if(!re.has(s)&&!H.has(s))return{status:\"error\",reason:`unsupported-input-type:${s}`};let i=e;if(s===\"number\"){let a=e.trim();if(a!==\"\"&&Number.isNaN(Number(a)))return{status:\"error\",reason:\"invalid-number-value\"};i=a}if(r=i,H.has(s)){let a=e.trim();r=a,v.call(t);let d=o.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(d,\"value\")?.set;return typeof c==\"function\"?c.call(t,a):t.value=a,t._valueTracker?.setValue?.(a),t.value!==a?{status:\"error\",reason:\"malformed-value\"}:(l(a),{status:\"done\"})}return v.call(t),{status:\"needsinput\",value:i}}return t instanceof o.HTMLTextAreaElement?(v.call(t),r=e,{status:\"needsinput\",value:e}):t instanceof o.HTMLSelectElement?{status:\"error\",reason:\"unsupported-element\"}:t.isContentEditable?(v.call(t),r=e,{status:\"needsinput\",value:e}):{status:\"error\",reason:\"unsupported-element\"}}catch(l){let s=\"exception\";if(l&&typeof l==\"object\"){let i=l.message;typeof i==\"string\"&&i.trim().length>0&&(s=`exception:${i}`)}return{status:\"needsinput\",value:r,reason:s}}}function le(){try{typeof this.focus==\"function\"&&this.focus()}catch{}}function ie(e){try{if(!(this instanceof HTMLSelectElement))return[];let t=Array.isArray(e)?e:[e],n=new Set(t.map(s=>String(s??\"\").trim())),o=s=>{let i=(s.label||s.textContent||\"\").trim(),a=String(s.value??\"\").trim();return n.has(i)||n.has(a)};if(this.multiple)for(let s of Array.from(this.options))s.selected=o(s);else{let s=!1;for(let i of Array.from(this.options))!s&&o(i)?(i.selected=!0,this.value=i.value,s=!0):i.selected=!1}let r=new Event(\"input\",{bubbles:!0}),l=new Event(\"change\",{bubbles:!0});return this.dispatchEvent(r),this.dispatchEvent(l),Array.from(this.selectedOptions).map(s=>s.value)}catch{return[]}}function ae(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument?.defaultView?.getComputedStyle(e)??window.getComputedStyle(e);if(!t||t.display===\"none\"||t.visibility===\"hidden\")return!1;let n=parseFloat(t.opacity??\"1\");if(!Number.isFinite(n)||n===0)return!1;let o=e.getBoundingClientRect();return!(!o||Math.max(o.width,o.height)===0||e.getClientRects().length===0)}catch{return!1}}function ce(){try{let e=this;if((e.tagName||\"\").toLowerCase()===\"input\"){let o=e.type?.toLowerCase()??\"\";if(o===\"checkbox\"||o===\"radio\")return!!e.checked}let n=e.getAttribute?.(\"aria-checked\");return n!=null?n===\"true\":!1}catch{return!1}}function ue(){try{let e=this,t=(e.tagName||\"\").toLowerCase();return t===\"input\"||t===\"textarea\"||t===\"select\"?String(e.value??\"\"):e.isContentEditable?String(e.textContent??\"\"):\"\"}catch{return\"\"}}function de(){try{return String(this.textContent??\"\")}catch{return\"\"}}function me(){try{return String(this.innerHTML??\"\")}catch{return\"\"}}function fe(){try{let e=this,t=e.innerText;if(typeof t==\"string\"&&t.length>0)return t;let n=e.textContent;return typeof n==\"string\"?n:\"\"}catch{return\"\"}}function O(e){let t=String(e||\"\").trim().replace(/^xpath=/i,\"\");if(!t)return[];let n=[],o=0;for(;o<t.length;){let r=\"child\";t.startsWith(\"//\",o)?(r=\"desc\",o+=2):t[o]===\"/\"&&(r=\"child\",o+=1);let l=o,s=0,i=null;for(;o<t.length;){let c=t[o];if(i)c===i&&(i=null);else if(c===\"'\"||c==='\"')i=c;else if(c===\"[\")s++;else if(c===\"]\")s--;else if(c===\"/\"&&s===0)break;o+=1}let a=t.slice(l,o).trim();if(!a)continue;let{tag:d,predicates:f}=pe(a);n.push({axis:r,tag:d,predicates:f})}return n}function he(e){let t=[],n=0;for(;n<e.length;){if(e[n]!==\"[\"){n++;continue}n++;let o=n,r=null;for(;n<e.length;){let l=e[n];if(r)l===r&&(r=null);else if(l===\"'\"||l==='\"')r=l;else if(l===\"]\")break;n++}t.push(e.slice(o,n).trim()),n++}return t}function pe(e){let t=e.indexOf(\"[\");if(t===-1)return{tag:e===\"\"?\"*\":e.toLowerCase(),predicates:[]};let n=e.slice(0,t).trim(),o=n===\"\"?\"*\":n.toLowerCase(),r=e.slice(t),l=[];for(let s of he(r)){let i=T(s);i&&l.push(i)}return{tag:o,predicates:l}}function T(e){let t=e.trim();if(!t)return null;let n=A(t,\"or\");if(n.length>1){let l=n.map(s=>T(s)).filter(Boolean);return l.length!==n.length?null:{type:\"or\",predicates:l}}let o=A(t,\"and\");if(o.length>1){let l=o.map(s=>T(s)).filter(Boolean);return l.length!==o.length?null:{type:\"and\",predicates:l}}let r=we(t,\"not\");if(r!=null){let l=T(r);return l?{type:\"not\",predicate:l}:null}return ge(t)}function ge(e){let t=/^(?:'([^']*)'|\"([^\"]*)\")$/,n=\"[a-zA-Z_][\\\\w.-]*\",o=`(?:'([^']*)'|\"([^\"]*)\")`;if(/^\\d+$/.test(e))return{type:\"index\",index:Math.max(1,Number(e))};let r=e.match(new RegExp(`^normalize-space\\\\(\\\\s*@(${n})\\\\s*\\\\)\\\\s*=\\\\s*${o}$`));if(r)return{type:\"attrEquals\",name:r[1],value:r[2]??r[3]??\"\",normalize:!0};let l=e.match(new RegExp(`^normalize-space\\\\(\\\\s*(?:text\\\\(\\\\)|\\\\.)\\\\s*\\\\)\\\\s*=\\\\s*${o}$`));if(l)return{type:\"textEquals\",value:l[1]??l[2]??\"\",normalize:!0};let s=e.match(new RegExp(`^@(${n})\\\\s*=\\\\s*${o}$`));if(s)return{type:\"attrEquals\",name:s[1],value:s[2]??s[3]??\"\"};let i=e.match(new RegExp(`^@(${n})$`));if(i)return{type:\"attrExists\",name:i[1]};let a=e.match(new RegExp(`^contains\\\\(\\\\s*@(${n})\\\\s*,\\\\s*${o}\\\\s*\\\\)$`));if(a)return{type:\"attrContains\",name:a[1],value:a[2]??a[3]??\"\"};let d=e.match(new RegExp(`^starts-with\\\\(\\\\s*@(${n})\\\\s*,\\\\s*${o}\\\\s*\\\\)$`));if(d)return{type:\"attrStartsWith\",name:d[1],value:d[2]??d[3]??\"\"};let f=e.match(new RegExp(`^(?:text\\\\(\\\\)|\\\\.)\\\\s*=\\\\s*${o}$`));if(f)return{type:\"textEquals\",value:f[1]??f[2]??\"\"};let c=e.match(new RegExp(`^contains\\\\(\\\\s*(?:text\\\\(\\\\)|\\\\.)\\\\s*,\\\\s*${o}\\\\s*\\\\)$`));return c?{type:\"textContains\",value:c[1]??c[2]??\"\"}:(t.test(e),null)}function A(e,t){let n=[],o=0,r=0,l=null,s=0;for(;s<e.length;){let i=e[s];if(l){i===l&&(l=null),s+=1;continue}if(i===\"'\"||i==='\"'){l=i,s+=1;continue}if(i===\"(\"){r+=1,s+=1;continue}if(i===\")\"){r=Math.max(0,r-1),s+=1;continue}if(r===0&&Ee(e,s,t)){n.push(e.slice(o,s).trim()),s+=t.length,o=s;continue}s+=1}return n.push(e.slice(o).trim()),n.filter(i=>i.length>0)}function Ee(e,t,n){if(!e.startsWith(n,t))return!1;let o=t>0?e[t-1]:\" \";if(o===\"@\")return!1;let r=t+n.length<e.length?e[t+n.length]:\" \";return W(o)&&W(r)}function W(e){return!/[a-zA-Z0-9_.-]/.test(e)}function we(e,t){let n=`${t}(`;if(!e.startsWith(n)||!e.endsWith(\")\"))return null;let o=e.slice(n.length,-1);return ye(o)?o:null}function ye(e){let t=0,n=null;for(let o=0;o<e.length;o+=1){let r=e[o];if(n){r===n&&(n=null);continue}if(r===\"'\"||r==='\"'){n=r;continue}if(r===\"(\"?t+=1:r===\")\"&&(t-=1),t<0)return!1}return t===0}var be=e=>e.replace(/\\s+/g,\" \").trim();function _(e){return String(e.textContent??\"\")}function S(e,t){return t?be(e):e}function R(e,t){switch(t.type){case\"and\":return t.predicates.every(n=>R(e,n));case\"or\":return t.predicates.some(n=>R(e,n));case\"not\":return!R(e,t.predicate);case\"attrExists\":return e.getAttribute(t.name)!==null;case\"attrEquals\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize)===S(t.value,t.normalize)}case\"attrContains\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize).includes(S(t.value,t.normalize))}case\"attrStartsWith\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize).startsWith(S(t.value,t.normalize))}case\"textEquals\":return S(_(e),t.normalize)===S(t.value,t.normalize);case\"textContains\":return S(_(e),t.normalize).includes(S(t.value,t.normalize));case\"index\":return!0;default:return!0}}function q(e,t){let n=e;for(let o of t){if(!n.length)return[];if(o.type===\"index\"){let r=o.index-1;n=r>=0&&r<n.length?[n[r]]:[];continue}n=n.filter(r=>R(r,o))}return n}var P=e=>{let t=String(e??\"\").trim();return t?t.replace(/^xpath=/i,\"\").trim():\"\"};function I(e,t){return k(e,0,t)}function k(e,t,n){if(!Number.isFinite(t)||t<0)return null;let o=P(e);if(!o)return null;let r=Math.floor(t),l=n?.pierceShadow!==!1,s=l?z():null;if(!l)return X(o,r).value;if(!s?.hasShadow){let a=X(o,r);return a.error?N(o,s?.getClosedRoot)[r]??null:a.value}return N(o,s.getClosedRoot)[r]??null}function $(e,t){let n=P(e);if(!n)return 0;let o=t?.pierceShadow!==!1,r=o?z():null;if(!o)return F(n).count;if(!r?.hasShadow){let l=F(n);return l.error?N(n,r?.getClosedRoot).length:l.count}return N(n,r.getClosedRoot).length}function N(e,t){let n=P(e);if(!n)return[];let o=O(n);if(!o.length)return[];let r=t??null,l=[document];for(let s of o){let i=[],a=new Set;for(let d of l){if(!d)continue;let f=s.axis===\"child\"?L(d,r):Se(d,r);if(!f.length)continue;let c=f.filter(g=>xe(g,s)),p=q(c,s.predicates);for(let g of p)a.has(g)||(a.add(g),i.push(g))}if(!i.length)return[];l=i}return l}function xe(e,t){return t.tag===\"*\"?!0:e.localName===t.tag}function z(){let e=window.__stagehandV3__,t=e&&typeof e.getClosedRoot==\"function\"?o=>{try{return e.getClosedRoot(o)??null}catch{return null}}:null,n=!1;try{if(e&&typeof e.stats==\"function\"){let o=e.stats();n=(o?.open??0)>0||(o?.closed??0)>0}}catch{}if(!n)try{let o=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();)if(o.currentNode.shadowRoot){n=!0;break}}catch{}return{getClosedRoot:t,hasShadow:n}}function L(e,t){let n=[];if(!e)return n;if(e instanceof Document)return e.documentElement&&n.push(e.documentElement),n;if(e instanceof ShadowRoot||e instanceof DocumentFragment)return n.push(...Array.from(e.children??[])),n;if(e instanceof Element){n.push(...Array.from(e.children??[]));let o=e.shadowRoot;if(o&&n.push(...Array.from(o.children??[])),t){let r=t(e);r&&n.push(...Array.from(r.children??[]))}return n}return n}function Se(e,t){let n=[],o=new Set,r=[...L(e,t)].reverse();for(;r.length;){let l=r.pop();if(!l||o.has(l))continue;o.add(l),n.push(l);let s=L(l,t);for(let i=s.length-1;i>=0;i-=1)r.push(s[i])}return n}function X(e,t){try{return{value:document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(t),error:!1}}catch{return{value:null,error:!0}}}function F(e){try{return{count:document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength,error:!1}}catch{return{count:0,error:!0}}}var C=e=>{let t=Number(e??0);return!Number.isFinite(t)||t<0?0:Math.floor(t)},V=(e,t)=>{if(!e)return[];let n=new WeakSet,o=new Set,r=[],l=[document],s=i=>{if(!(!i||n.has(i)||r.length>=t)){n.add(i);try{let a=i.querySelectorAll(e);for(let d of a)if(!o.has(d)&&(o.add(d),r.push(d),r.length>=t))return}catch{}try{let d=(i instanceof Document?i:i.host?.ownerDocument??document).createTreeWalker(i,NodeFilter.SHOW_ELEMENT),f;for(;f=d.nextNode();){if(!(f instanceof Element))continue;let c=f.shadowRoot;c&&l.push(c)}}catch{}}};for(;l.length&&r.length<t;){let i=l.shift();i&&s(i)}return r};function ve(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t);return V(n,o+1)[o]??null}function Te(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t),r=window.__stagehandV3__;if(!r||typeof r.getClosedRoot!=\"function\")return V(n,o+1)[o]??null;let l=c=>{try{return r.getClosedRoot(c)??null}catch{return null}},s=new WeakSet,i=new Set,a=[],d=[document],f=c=>{if(!(!c||s.has(c)||a.length>=o+1)){s.add(c);try{let p=c.querySelectorAll(n);for(let g of p)if(!i.has(g)&&(i.add(g),a.push(g),a.length>=o+1))return}catch{}try{let g=(c instanceof Document?c:c.host?.ownerDocument??document).createTreeWalker(c,NodeFilter.SHOW_ELEMENT),w;for(;w=g.nextNode();){if(!(w instanceof Element))continue;let x=w.shadowRoot;x&&d.push(x);let y=l(w);y&&d.push(y)}}catch{}}};for(;d.length&&a.length<o+1;){let c=d.shift();c&&f(c)}return a[o]??null}function Re(e,t){let n=String(e??\"\");if(!n)return null;let o=n.toLowerCase(),r=C(t),l=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),s=u=>{if(!u)return!1;let h=u.tagName?.toUpperCase()??\"\";return l.has(h)},i=u=>{try{if(s(u))return\"\";let h=u.innerText;if(typeof h==\"string\"&&h.trim())return h.trim()}catch{}try{let h=u.textContent;if(typeof h==\"string\")return h.trim()}catch{}return\"\"},a=u=>{let h=i(u);return!!h&&h.toLowerCase().includes(o)},d=window.__stagehandV3__,f=d&&typeof d.getClosedRoot==\"function\"?u=>{try{return d.getClosedRoot(u)??null}catch{return null}}:u=>null,c=new WeakSet,p=[],g=[],w=u=>{!u||c.has(u)||(c.add(u),p.push(u))},x=u=>{try{return(u instanceof Document?u:u?.ownerDocument??document).createTreeWalker(u,NodeFilter.SHOW_ELEMENT)}catch{return null}};for(w(document);p.length;){let u=p.shift();if(!u)continue;u instanceof Element&&a(u)&&g.push({element:u,tag:u.tagName??\"\",id:u.id??\"\",className:u.className??\"\",text:i(u)});let h=x(u);if(!h)continue;let E;for(;E=h.nextNode();){if(!(E instanceof Element))continue;a(E)&&g.push({element:E,tag:E.tagName??\"\",id:E.id??\"\",className:E.className??\"\",text:i(E)});let b=E.shadowRoot;b&&w(b);let D=f(E);D&&w(D)}}let y=[];for(let u of g){let h=u.element,E=!1;for(let b of g)if(u!==b)try{if(h.contains(b.element)){E=!0;break}}catch{}E||y.push(u)}return y[r]?.element??null}function Ne(e,t){let n=C(t);return k(e,n,{pierceShadow:!0})}function Ce(e){let t=String(e??\"\").trim();if(!t)return 0;let n=new WeakSet,o=r=>{if(!r||n.has(r))return 0;n.add(r);let l=0;try{let s=r;typeof s.querySelectorAll==\"function\"&&(l+=s.querySelectorAll(t).length)}catch{}try{let i=(r instanceof Document?r:r?.ownerDocument??document).createTreeWalker(r,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();)a instanceof Element&&a.shadowRoot&&(l+=o(a.shadowRoot))}catch{}return l};try{return o(document)}catch{try{return document.querySelectorAll(t).length}catch{return 0}}}function Me(e){let t=String(e??\"\").trim();if(!t)return 0;let n=window.__stagehandV3__;if(!n||typeof n.getClosedRoot!=\"function\")try{return document.querySelectorAll(t).length}catch{return 0}let o=new WeakSet,r=[],l=a=>{!a||o.has(a)||(o.add(a),r.push(a))};l(document);let s=0,i=a=>{let d=a.shadowRoot;d&&l(d);try{let f=n.getClosedRoot(a);f&&l(f)}catch{}};for(;r.length;){let a=r.shift();if(a){try{let d=a;typeof d.querySelectorAll==\"function\"&&(s+=d.querySelectorAll(t).length)}catch{}try{let f=(a instanceof Document?a:a instanceof ShadowRoot?a.host?.ownerDocument??document:a.ownerDocument??document).createTreeWalker(a,NodeFilter.SHOW_ELEMENT),c;for(;c=f.nextNode();)c instanceof Element&&i(c)}catch{}}}return s}function Le(e){let t=String(e??\"\");if(!t)return{count:0,sample:[],error:null};let n=t.toLowerCase(),o=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),r=m=>{if(!m)return!1;let u=m.tagName?.toUpperCase()??\"\";return o.has(u)},l=m=>{try{if(r(m))return\"\";let u=m.innerText;if(typeof u==\"string\"&&u.trim())return u.trim()}catch{}try{let u=m.textContent;if(typeof u==\"string\")return u.trim()}catch{}return\"\"},s=m=>{let u=l(m);return!!u&&u.toLowerCase().includes(n)},i=window.__stagehandV3__,a=i&&typeof i.getClosedRoot==\"function\"?m=>{try{return i.getClosedRoot(m)??null}catch{return null}}:m=>null,d=new WeakSet,f=[],c=m=>{!m||d.has(m)||(d.add(m),f.push(m))},p=m=>{try{return(m instanceof Document?m:m?.ownerDocument??document).createTreeWalker(m,NodeFilter.SHOW_ELEMENT)}catch{return null}},g=[];for(c(document);f.length;){let m=f.shift();if(!m)continue;m instanceof Element&&s(m)&&g.push({element:m,tag:m.tagName??\"\",id:m.id??\"\",className:m.className??\"\",text:l(m)});let u=p(m);if(!u)continue;let h;for(;h=u.nextNode();){if(!(h instanceof Element))continue;s(h)&&g.push({element:h,tag:h.tagName??\"\",id:h.id??\"\",className:h.className??\"\",text:l(h)});let E=h.shadowRoot;E&&c(E);let b=a(h);b&&c(b)}}let w=[];for(let m of g){let u=m.element,h=!1;for(let E of g)if(m!==E)try{if(u.contains(E.element)){h=!0;break}}catch{}h||w.push(m)}let x=w.length,y=w.slice(0,5).map(m=>({tag:m.tag,id:m.id,class:m.className,text:m.text}));return{count:x,sample:y,error:null}}function Pe(e){return $(e,{pierceShadow:!0})}var ke=e=>e.startsWith(\"xpath=\")||e.startsWith(\"/\"),De=e=>{try{let t=window.__stagehandV3__;if(t&&typeof t.getClosedRoot==\"function\")return t.getClosedRoot(e)??null}catch{}return null},Y=e=>e.shadowRoot?e.shadowRoot:De(e),He=(e,t,n)=>{try{let l=e.querySelector(t);if(l)return l}catch{}if(!n)return null;let o=new WeakSet,r=[e];for(;r.length>0;){let l=r.shift();if(!(!l||o.has(l))){o.add(l);try{let s=l.querySelector(t);if(s)return s}catch{}try{let i=(l instanceof Document?l:l.host?.ownerDocument??document).createTreeWalker(l,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();){if(!(a instanceof Element))continue;let d=Y(a);d&&!o.has(d)&&r.push(d)}}catch{}}}return null},Ae=(e,t)=>I(e,{pierceShadow:t}),B=(e,t)=>ke(e)?Ae(e,t):He(document,e,t),G=(e,t)=>{if(t===\"detached\")return e===null;if(t===\"attached\")return e!==null;if(e===null)return!1;if(t===\"hidden\")try{let n=window.getComputedStyle(e),o=e.getBoundingClientRect();return n.display===\"none\"||n.visibility===\"hidden\"||n.opacity===\"0\"||o.width===0||o.height===0}catch{return!1}try{let n=window.getComputedStyle(e),o=e.getBoundingClientRect();return n.display!==\"none\"&&n.visibility!==\"hidden\"&&n.opacity!==\"0\"&&o.width>0&&o.height>0}catch{return!1}},We=(e,t)=>{let n=new WeakSet,o=l=>{let s=Y(l);if(s&&!n.has(s)){n.add(s);let i=new MutationObserver(e);i.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"style\",\"class\",\"hidden\",\"disabled\"]}),t.push(i);for(let a of Array.from(s.children))o(a)}for(let i of Array.from(l.children))o(i)},r=document.documentElement||document.body;r&&o(r)};function _e(e,t,n,o){let r=String(e??\"\").trim(),l=String(t??\"visible\")||\"visible\",s=typeof n==\"number\"&&n>0?n:3e4,i=o!==!1;return new Promise((a,d)=>{let f=null,c=null,p=!1,g=()=>{f!==null&&(clearTimeout(f),f=null)},w=B(r,i);if(G(w,l)){p=!0,a(!0);return}let x=[],y=()=>{for(let E of x)E.disconnect();c&&(document.removeEventListener(\"DOMContentLoaded\",c),c=null)},m=()=>{if(p)return;let E=B(r,i);G(E,l)&&(p=!0,g(),y(),a(!0))};if(!(document.body||document.documentElement)){c=()=>{document.removeEventListener(\"DOMContentLoaded\",c),c=null,m(),h()},document.addEventListener(\"DOMContentLoaded\",c),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s);return}let h=()=>{let E=document.body||document.documentElement;if(!E)return;let b=new MutationObserver(m);b.observe(E,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"style\",\"class\",\"hidden\",\"disabled\"]}),x.push(b),i&&We(m,x)};h(),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s)})}return J(Oe);})();\n globalThis.__stagehandLocatorScripts = __stagehandLocatorScriptsFactory;\n}";
2
+ export declare const locatorScriptSources: {
3
+ readonly assignFilePayloadsToInputElement: "function ce(e){try{let t=this;if(!t||t.tagName?.toLowerCase()!==\"input\"||(t.type??\"\").toLowerCase()!==\"file\")return!1;let n=(()=>{try{return new DataTransfer}catch{return null}})();if(!n)return!1;let o=Array.isArray(e)?e:[];for(let r of o){if(!r)continue;let l=r.name||\"upload.bin\",s=r.mimeType||\"application/octet-stream\",i=typeof r.lastModified==\"number\"?r.lastModified:Date.now(),a=window.atob(r.base64??\"\"),d=new Uint8Array(a.length);for(let p=0;p<a.length;p+=1)d[p]=a.charCodeAt(p);let f=new Blob([d],{type:s}),c=new File([f],l,{type:s,lastModified:i});n.items.add(c)}return t.files=n.files,t.dispatchEvent(new Event(\"input\",{bubbles:!0})),t.dispatchEvent(new Event(\"change\",{bubbles:!0})),!0}catch{return!1}}";
4
+ readonly countCssMatchesPierce: "function He(e){let t=String(e??\"\").trim();if(!t)return 0;let n=window.__stagehandV3__;if(!n||typeof n.getClosedRoot!=\"function\")try{return document.querySelectorAll(t).length}catch{return 0}let o=new WeakSet,r=[],l=a=>{!a||o.has(a)||(o.add(a),r.push(a))};l(document);let s=0,i=a=>{let d=a.shadowRoot;d&&l(d);try{let f=n.getClosedRoot(a);f&&l(f)}catch{}};for(;r.length;){let a=r.shift();if(a){try{let d=a;typeof d.querySelectorAll==\"function\"&&(s+=d.querySelectorAll(t).length)}catch{}try{let f=(a instanceof Document?a:a instanceof ShadowRoot?a.host?.ownerDocument??document:a.ownerDocument??document).createTreeWalker(a,NodeFilter.SHOW_ELEMENT),c;for(;c=f.nextNode();)c instanceof Element&&i(c)}catch{}}}return s}";
5
+ readonly countCssMatchesPrimary: "function De(e){let t=String(e??\"\").trim();if(!t)return 0;let n=new WeakSet,o=r=>{if(!r||n.has(r))return 0;n.add(r);let l=0;try{let s=r;typeof s.querySelectorAll==\"function\"&&(l+=s.querySelectorAll(t).length)}catch{}try{let i=(r instanceof Document?r:r?.ownerDocument??document).createTreeWalker(r,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();)a instanceof Element&&a.shadowRoot&&(l+=o(a.shadowRoot))}catch{}return l};try{return o(document)}catch{try{return document.querySelectorAll(t).length}catch{return 0}}}";
6
+ readonly countTextMatches: "function Ae(e){let t=String(e??\"\");if(!t)return{count:0,sample:[],error:null};let n=t.toLowerCase(),o=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),r=m=>{if(!m)return!1;let u=m.tagName?.toUpperCase()??\"\";return o.has(u)},l=m=>{try{if(r(m))return\"\";let u=m.innerText;if(typeof u==\"string\"&&u.trim())return u.trim()}catch{}try{let u=m.textContent;if(typeof u==\"string\")return u.trim()}catch{}return\"\"},s=m=>{let u=l(m);return!!u&&u.toLowerCase().includes(n)},i=window.__stagehandV3__,a=i&&typeof i.getClosedRoot==\"function\"?m=>{try{return i.getClosedRoot(m)??null}catch{return null}}:m=>null,d=new WeakSet,f=[],c=m=>{!m||d.has(m)||(d.add(m),f.push(m))},p=m=>{try{return(m instanceof Document?m:m?.ownerDocument??document).createTreeWalker(m,NodeFilter.SHOW_ELEMENT)}catch{return null}},g=[];for(c(document);f.length;){let m=f.shift();if(!m)continue;m instanceof Element&&s(m)&&g.push({element:m,tag:m.tagName??\"\",id:m.id??\"\",className:m.className??\"\",text:l(m)});let u=p(m);if(!u)continue;let h;for(;h=u.nextNode();){if(!(h instanceof Element))continue;s(h)&&g.push({element:h,tag:h.tagName??\"\",id:h.id??\"\",className:h.className??\"\",text:l(h)});let E=h.shadowRoot;E&&c(E);let b=a(h);b&&c(b)}}let w=[];for(let m of g){let u=m.element,h=!1;for(let E of g)if(m!==E)try{if(u.contains(E.element)){h=!0;break}}catch{}h||w.push(m)}let x=w.length,y=w.slice(0,5).map(m=>({tag:m.tag,id:m.id,class:m.className,text:m.text}));return{count:x,sample:y,error:null}}";
7
+ readonly countXPathMatchesMainWorld: "function We(e){return I(e,{pierceShadow:!0})}";
8
+ readonly dispatchDomClick: "function ue(e){let t=e??{};try{let n=new MouseEvent(\"click\",{bubbles:!!t.bubbles,cancelable:!!t.cancelable,composed:!!t.composed,detail:typeof t.detail==\"number\"?t.detail:1,view:this?.ownerDocument?.defaultView??window});this.dispatchEvent(n)}catch{try{this.click()}catch{}}}";
9
+ readonly ensureFileInputElement: "function ae(){try{return(this.tagName?.toLowerCase()??\"\")!==\"input\"?!1:String(this.type??\"\").toLowerCase()===\"file\"}catch{return!1}}";
10
+ readonly fillElementValue: "function me(e){let t=this;if(!t.isConnected)return{status:\"error\",reason:\"notconnected\"};let o=(t.ownerDocument||document).defaultView||window,r=e??\"\";try{let l=s=>{let i;if(typeof o.InputEvent==\"function\")try{i=new o.InputEvent(\"input\",{bubbles:!0,composed:!0,data:s,inputType:\"insertText\"})}catch{i=new o.Event(\"input\",{bubbles:!0,composed:!0})}else i=new o.Event(\"input\",{bubbles:!0,composed:!0});t.dispatchEvent(i);let a=new o.Event(\"change\",{bubbles:!0});t.dispatchEvent(a)};if(t instanceof o.HTMLInputElement){let s=(t.type||\"\").toLowerCase();if(!Y.has(s)&&!D.has(s))return{status:\"error\",reason:`unsupported-input-type:${s}`};let i=e;if(s===\"number\"){let a=e.trim();if(a!==\"\"&&Number.isNaN(Number(a)))return{status:\"error\",reason:\"invalid-number-value\"};i=a}if(r=i,D.has(s)){let a=e.trim();r=a,v.call(t);let d=o.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(d,\"value\")?.set;return typeof c==\"function\"?c.call(t,a):t.value=a,t._valueTracker?.setValue?.(a),t.value!==a?{status:\"error\",reason:\"malformed-value\"}:(l(a),{status:\"done\"})}return v.call(t),{status:\"needsinput\",value:i}}return t instanceof o.HTMLTextAreaElement?(v.call(t),r=e,{status:\"needsinput\",value:e}):t instanceof o.HTMLSelectElement?{status:\"error\",reason:\"unsupported-element\"}:t.isContentEditable?(v.call(t),r=e,{status:\"needsinput\",value:e}):{status:\"error\",reason:\"unsupported-element\"}}catch(l){let s=\"exception\";if(l&&typeof l==\"object\"){let i=l.message;typeof i==\"string\"&&i.trim().length>0&&(s=`exception:${i}`)}return{status:\"needsinput\",value:r,reason:s}}}";
11
+ readonly focusElement: "function fe(){try{typeof this.focus==\"function\"&&this.focus()}catch{}}";
12
+ readonly isElementChecked: "function ge(){try{let e=this;if((e.tagName||\"\").toLowerCase()===\"input\"){let o=e.type?.toLowerCase()??\"\";if(o===\"checkbox\"||o===\"radio\")return!!e.checked}let n=e.getAttribute?.(\"aria-checked\");return n!=null?n===\"true\":!1}catch{return!1}}";
13
+ readonly isElementVisible: "function pe(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument?.defaultView?.getComputedStyle(e)??window.getComputedStyle(e);if(!t||t.display===\"none\"||t.visibility===\"hidden\")return!1;let n=parseFloat(t.opacity??\"1\");if(!Number.isFinite(n)||n===0)return!1;let o=e.getBoundingClientRect();return!(!o||Math.max(o.width,o.height)===0||e.getClientRects().length===0)}catch{return!1}}";
14
+ readonly prepareElementForTyping: "function v(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument||document,n=t.defaultView||window;try{typeof e.focus==\"function\"&&e.focus()}catch{}if(e instanceof n.HTMLInputElement||e instanceof n.HTMLTextAreaElement){try{if(typeof e.select==\"function\")return e.select(),!0}catch{}try{let o=(e.value??\"\").length;if(typeof e.setSelectionRange==\"function\")return e.setSelectionRange(0,o),!0}catch{}return!0}if(e.isContentEditable){let o=t.getSelection?.(),r=t.createRange?.();if(o&&r)try{r.selectNodeContents(e),o.removeAllRanges(),o.addRange(r)}catch{}return!0}return!1}catch{return!1}}";
15
+ readonly readElementInnerHTML: "function ye(){try{return String(this.innerHTML??\"\")}catch{return\"\"}}";
16
+ readonly readElementInnerText: "function be(){try{let e=this,t=e.innerText;if(typeof t==\"string\"&&t.length>0)return t;let n=e.textContent;return typeof n==\"string\"?n:\"\"}catch{return\"\"}}";
17
+ readonly readElementInputValue: "function Ee(){try{let e=this,t=(e.tagName||\"\").toLowerCase();return t===\"input\"||t===\"textarea\"||t===\"select\"?String(e.value??\"\"):e.isContentEditable?String(e.textContent??\"\"):\"\"}catch{return\"\"}}";
18
+ readonly readElementTextContent: "function we(){try{return String(this.textContent??\"\")}catch{return\"\"}}";
19
+ readonly resolveCssSelector: "function Ne(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t);return z(n,o+1)[o]??null}";
20
+ readonly resolveCssSelectorPierce: "function Ce(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t),r=window.__stagehandV3__;if(!r||typeof r.getClosedRoot!=\"function\")return z(n,o+1)[o]??null;let l=c=>{try{return r.getClosedRoot(c)??null}catch{return null}},s=new WeakSet,i=new Set,a=[],d=[document],f=c=>{if(!(!c||s.has(c)||a.length>=o+1)){s.add(c);try{let p=c.querySelectorAll(n);for(let g of p)if(!i.has(g)&&(i.add(g),a.push(g),a.length>=o+1))return}catch{}try{let g=(c instanceof Document?c:c.host?.ownerDocument??document).createTreeWalker(c,NodeFilter.SHOW_ELEMENT),w;for(;w=g.nextNode();){if(!(w instanceof Element))continue;let x=w.shadowRoot;x&&d.push(x);let y=l(w);y&&d.push(y)}}catch{}}};for(;d.length&&a.length<o+1;){let c=d.shift();c&&f(c)}return a[o]??null}";
21
+ readonly resolveTextSelector: "function Me(e,t){let n=String(e??\"\");if(!n)return null;let o=n.toLowerCase(),r=C(t),l=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),s=u=>{if(!u)return!1;let h=u.tagName?.toUpperCase()??\"\";return l.has(h)},i=u=>{try{if(s(u))return\"\";let h=u.innerText;if(typeof h==\"string\"&&h.trim())return h.trim()}catch{}try{let h=u.textContent;if(typeof h==\"string\")return h.trim()}catch{}return\"\"},a=u=>{let h=i(u);return!!h&&h.toLowerCase().includes(o)},d=window.__stagehandV3__,f=d&&typeof d.getClosedRoot==\"function\"?u=>{try{return d.getClosedRoot(u)??null}catch{return null}}:u=>null,c=new WeakSet,p=[],g=[],w=u=>{!u||c.has(u)||(c.add(u),p.push(u))},x=u=>{try{return(u instanceof Document?u:u?.ownerDocument??document).createTreeWalker(u,NodeFilter.SHOW_ELEMENT)}catch{return null}};for(w(document);p.length;){let u=p.shift();if(!u)continue;u instanceof Element&&a(u)&&g.push({element:u,tag:u.tagName??\"\",id:u.id??\"\",className:u.className??\"\",text:i(u)});let h=x(u);if(!h)continue;let E;for(;E=h.nextNode();){if(!(E instanceof Element))continue;a(E)&&g.push({element:E,tag:E.tagName??\"\",id:E.id??\"\",className:E.className??\"\",text:i(E)});let b=E.shadowRoot;b&&w(b);let k=f(E);k&&w(k)}}let y=[];for(let u of g){let h=u.element,E=!1;for(let b of g)if(u!==b)try{if(h.contains(b.element)){E=!0;break}}catch{}E||y.push(u)}return y[r]?.element??null}";
22
+ readonly resolveXPathMainWorld: "function Le(e,t){let n=C(t);return P(e,n,{pierceShadow:!0})}";
23
+ readonly scrollElementToPercent: "function de(e){let t=n=>{if(typeof n==\"number\"&&Number.isFinite(n))return n;let o=String(n??\"\").trim();if(!o)return 0;let r=parseFloat(o.replace(\"%\",\"\"));return Number.isNaN(r)||!Number.isFinite(r)?0:r};try{let n=Math.max(0,Math.min(t(e),100)),o=this,r=o.tagName?.toLowerCase()??\"\";if(r===\"html\"||r===\"body\"){let c=(o.ownerDocument?.scrollingElement||o.ownerDocument?.documentElement||o.ownerDocument?.body||document.scrollingElement||document.documentElement||document.body)?.scrollHeight??document.body.scrollHeight??0,p=o.ownerDocument?.defaultView?.innerHeight??window.innerHeight,w=Math.max(0,c-p)*(n/100);return o.ownerDocument?.defaultView?.scrollTo({top:w,left:o.ownerDocument?.defaultView?.scrollX??window.scrollX??0,behavior:\"smooth\"}),!0}let s=o.scrollHeight??0,i=o.clientHeight??0,d=Math.max(0,s-i)*(n/100);return o.scrollTo({top:d,left:o.scrollLeft??0,behavior:\"smooth\"}),!0}catch{return!1}}";
24
+ readonly selectElementOptions: "function he(e){try{if(!(this instanceof HTMLSelectElement))return[];let t=Array.isArray(e)?e:[e],n=new Set(t.map(s=>String(s??\"\").trim())),o=s=>{let i=(s.label||s.textContent||\"\").trim(),a=String(s.value??\"\").trim();return n.has(i)||n.has(a)};if(this.multiple)for(let s of Array.from(this.options))s.selected=o(s);else{let s=!1;for(let i of Array.from(this.options))!s&&o(i)?(i.selected=!0,this.value=i.value,s=!0):i.selected=!1}let r=new Event(\"input\",{bubbles:!0}),l=new Event(\"change\",{bubbles:!0});return this.dispatchEvent(r),this.dispatchEvent(l),Array.from(this.selectedOptions).map(s=>s.value)}catch{return[]}}";
25
+ readonly waitForSelector: "function qe(e,t,n,o){let r=String(e??\"\").trim(),l=String(t??\"visible\")||\"visible\",s=typeof n==\"number\"&&n>0?n:3e4,i=o!==!1;return new Promise((a,d)=>{let f=null,c=null,p=!1,g=()=>{f!==null&&(clearTimeout(f),f=null)},w=V(r,i);if(B(w,l)){p=!0,a(!0);return}let x=[],y=()=>{for(let E of x)E.disconnect();c&&(document.removeEventListener(\"DOMContentLoaded\",c),c=null)},m=()=>{if(p)return;let E=V(r,i);B(E,l)&&(p=!0,g(),y(),a(!0))};if(!(document.body||document.documentElement)){c=()=>{document.removeEventListener(\"DOMContentLoaded\",c),c=null,m(),h()},document.addEventListener(\"DOMContentLoaded\",c),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s);return}let h=()=>{let E=document.body||document.documentElement;if(!E)return;let b=new MutationObserver(m);b.observe(E,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"style\",\"class\",\"hidden\",\"disabled\"]}),x.push(b),i&&ie(m,x)};h(),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s)})}";
26
+ };
27
+ export declare const locatorScriptGlobalRefs: {
28
+ readonly assignFilePayloadsToInputElement: "globalThis.__stagehandLocatorScripts.assignFilePayloadsToInputElement";
29
+ readonly countCssMatchesPierce: "globalThis.__stagehandLocatorScripts.countCssMatchesPierce";
30
+ readonly countCssMatchesPrimary: "globalThis.__stagehandLocatorScripts.countCssMatchesPrimary";
31
+ readonly countTextMatches: "globalThis.__stagehandLocatorScripts.countTextMatches";
32
+ readonly countXPathMatchesMainWorld: "globalThis.__stagehandLocatorScripts.countXPathMatchesMainWorld";
33
+ readonly dispatchDomClick: "globalThis.__stagehandLocatorScripts.dispatchDomClick";
34
+ readonly ensureFileInputElement: "globalThis.__stagehandLocatorScripts.ensureFileInputElement";
35
+ readonly fillElementValue: "globalThis.__stagehandLocatorScripts.fillElementValue";
36
+ readonly focusElement: "globalThis.__stagehandLocatorScripts.focusElement";
37
+ readonly isElementChecked: "globalThis.__stagehandLocatorScripts.isElementChecked";
38
+ readonly isElementVisible: "globalThis.__stagehandLocatorScripts.isElementVisible";
39
+ readonly prepareElementForTyping: "globalThis.__stagehandLocatorScripts.prepareElementForTyping";
40
+ readonly readElementInnerHTML: "globalThis.__stagehandLocatorScripts.readElementInnerHTML";
41
+ readonly readElementInnerText: "globalThis.__stagehandLocatorScripts.readElementInnerText";
42
+ readonly readElementInputValue: "globalThis.__stagehandLocatorScripts.readElementInputValue";
43
+ readonly readElementTextContent: "globalThis.__stagehandLocatorScripts.readElementTextContent";
44
+ readonly resolveCssSelector: "globalThis.__stagehandLocatorScripts.resolveCssSelector";
45
+ readonly resolveCssSelectorPierce: "globalThis.__stagehandLocatorScripts.resolveCssSelectorPierce";
46
+ readonly resolveTextSelector: "globalThis.__stagehandLocatorScripts.resolveTextSelector";
47
+ readonly resolveXPathMainWorld: "globalThis.__stagehandLocatorScripts.resolveXPathMainWorld";
48
+ readonly scrollElementToPercent: "globalThis.__stagehandLocatorScripts.scrollElementToPercent";
49
+ readonly selectElementOptions: "globalThis.__stagehandLocatorScripts.selectElementOptions";
50
+ readonly waitForSelector: "globalThis.__stagehandLocatorScripts.waitForSelector";
51
+ };
52
+ export type LocatorScriptName = keyof typeof locatorScriptSources;
@@ -0,0 +1,56 @@
1
+ /*
2
+ * AUTO-GENERATED FILE. DO NOT EDIT.
3
+ * Update sources in lib/v3/dom/locatorScripts and run genLocatorScripts.ts.
4
+ */
5
+ export const locatorScriptBootstrap = "if (!globalThis.__stagehandLocatorScripts) { var __stagehandLocatorScriptsFactory=(()=>{var M=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},j=(e,t,n,o)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let r of U(t))!Q.call(e,r)&&r!==n&&M(e,r,{get:()=>t[r],enumerable:!(o=K(t,r))||o.enumerable});return e};var J=e=>j(M({},\"__esModule\",{value:!0}),e);var Oe={};Z(Oe,{assignFilePayloadsToInputElement:()=>te,countCssMatchesPierce:()=>Me,countCssMatchesPrimary:()=>Ce,countTextMatches:()=>Le,countXPathMatchesMainWorld:()=>Pe,dispatchDomClick:()=>ne,ensureFileInputElement:()=>ee,fillElementValue:()=>se,focusElement:()=>le,isElementChecked:()=>ce,isElementVisible:()=>ae,prepareElementForTyping:()=>v,readElementInnerHTML:()=>me,readElementInnerText:()=>fe,readElementInputValue:()=>ue,readElementTextContent:()=>de,resolveCssSelector:()=>ve,resolveCssSelectorPierce:()=>Te,resolveTextSelector:()=>Re,resolveXPathMainWorld:()=>Ne,scrollElementToPercent:()=>oe,selectElementOptions:()=>ie,waitForSelector:()=>_e});function ee(){try{return(this.tagName?.toLowerCase()??\"\")!==\"input\"?!1:String(this.type??\"\").toLowerCase()===\"file\"}catch{return!1}}function te(e){try{let t=this;if(!t||t.tagName?.toLowerCase()!==\"input\"||(t.type??\"\").toLowerCase()!==\"file\")return!1;let n=(()=>{try{return new DataTransfer}catch{return null}})();if(!n)return!1;let o=Array.isArray(e)?e:[];for(let r of o){if(!r)continue;let l=r.name||\"upload.bin\",s=r.mimeType||\"application/octet-stream\",i=typeof r.lastModified==\"number\"?r.lastModified:Date.now(),a=window.atob(r.base64??\"\"),d=new Uint8Array(a.length);for(let p=0;p<a.length;p+=1)d[p]=a.charCodeAt(p);let f=new Blob([d],{type:s}),c=new File([f],l,{type:s,lastModified:i});n.items.add(c)}return t.files=n.files,t.dispatchEvent(new Event(\"input\",{bubbles:!0})),t.dispatchEvent(new Event(\"change\",{bubbles:!0})),!0}catch{return!1}}function ne(e){let t=e??{};try{let n=new MouseEvent(\"click\",{bubbles:!!t.bubbles,cancelable:!!t.cancelable,composed:!!t.composed,detail:typeof t.detail==\"number\"?t.detail:1,view:this?.ownerDocument?.defaultView??window});this.dispatchEvent(n)}catch{try{this.click()}catch{}}}function oe(e){let t=n=>{if(typeof n==\"number\"&&Number.isFinite(n))return n;let o=String(n??\"\").trim();if(!o)return 0;let r=parseFloat(o.replace(\"%\",\"\"));return Number.isNaN(r)||!Number.isFinite(r)?0:r};try{let n=Math.max(0,Math.min(t(e),100)),o=this,r=o.tagName?.toLowerCase()??\"\";if(r===\"html\"||r===\"body\"){let c=(o.ownerDocument?.scrollingElement||o.ownerDocument?.documentElement||o.ownerDocument?.body||document.scrollingElement||document.documentElement||document.body)?.scrollHeight??document.body.scrollHeight??0,p=o.ownerDocument?.defaultView?.innerHeight??window.innerHeight,w=Math.max(0,c-p)*(n/100);return o.ownerDocument?.defaultView?.scrollTo({top:w,left:o.ownerDocument?.defaultView?.scrollX??window.scrollX??0,behavior:\"smooth\"}),!0}let s=o.scrollHeight??0,i=o.clientHeight??0,d=Math.max(0,s-i)*(n/100);return o.scrollTo({top:d,left:o.scrollLeft??0,behavior:\"smooth\"}),!0}catch{return!1}}var H=new Set([\"color\",\"date\",\"datetime-local\",\"month\",\"range\",\"time\",\"week\"]),re=new Set([\"\",\"email\",\"number\",\"password\",\"search\",\"tel\",\"text\",\"url\"]);function v(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument||document,n=t.defaultView||window;try{typeof e.focus==\"function\"&&e.focus()}catch{}if(e instanceof n.HTMLInputElement||e instanceof n.HTMLTextAreaElement){try{if(typeof e.select==\"function\")return e.select(),!0}catch{}try{let o=(e.value??\"\").length;if(typeof e.setSelectionRange==\"function\")return e.setSelectionRange(0,o),!0}catch{}return!0}if(e.isContentEditable){let o=t.getSelection?.(),r=t.createRange?.();if(o&&r)try{r.selectNodeContents(e),o.removeAllRanges(),o.addRange(r)}catch{}return!0}return!1}catch{return!1}}function se(e){let t=this;if(!t.isConnected)return{status:\"error\",reason:\"notconnected\"};let o=(t.ownerDocument||document).defaultView||window,r=e??\"\";try{let l=s=>{let i;if(typeof o.InputEvent==\"function\")try{i=new o.InputEvent(\"input\",{bubbles:!0,composed:!0,data:s,inputType:\"insertText\"})}catch{i=new o.Event(\"input\",{bubbles:!0,composed:!0})}else i=new o.Event(\"input\",{bubbles:!0,composed:!0});t.dispatchEvent(i);let a=new o.Event(\"change\",{bubbles:!0});t.dispatchEvent(a)};if(t instanceof o.HTMLInputElement){let s=(t.type||\"\").toLowerCase();if(!re.has(s)&&!H.has(s))return{status:\"error\",reason:`unsupported-input-type:${s}`};let i=e;if(s===\"number\"){let a=e.trim();if(a!==\"\"&&Number.isNaN(Number(a)))return{status:\"error\",reason:\"invalid-number-value\"};i=a}if(r=i,H.has(s)){let a=e.trim();r=a,v.call(t);let d=o.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(d,\"value\")?.set;return typeof c==\"function\"?c.call(t,a):t.value=a,t._valueTracker?.setValue?.(a),t.value!==a?{status:\"error\",reason:\"malformed-value\"}:(l(a),{status:\"done\"})}return v.call(t),{status:\"needsinput\",value:i}}return t instanceof o.HTMLTextAreaElement?(v.call(t),r=e,{status:\"needsinput\",value:e}):t instanceof o.HTMLSelectElement?{status:\"error\",reason:\"unsupported-element\"}:t.isContentEditable?(v.call(t),r=e,{status:\"needsinput\",value:e}):{status:\"error\",reason:\"unsupported-element\"}}catch(l){let s=\"exception\";if(l&&typeof l==\"object\"){let i=l.message;typeof i==\"string\"&&i.trim().length>0&&(s=`exception:${i}`)}return{status:\"needsinput\",value:r,reason:s}}}function le(){try{typeof this.focus==\"function\"&&this.focus()}catch{}}function ie(e){try{if(!(this instanceof HTMLSelectElement))return[];let t=Array.isArray(e)?e:[e],n=new Set(t.map(s=>String(s??\"\").trim())),o=s=>{let i=(s.label||s.textContent||\"\").trim(),a=String(s.value??\"\").trim();return n.has(i)||n.has(a)};if(this.multiple)for(let s of Array.from(this.options))s.selected=o(s);else{let s=!1;for(let i of Array.from(this.options))!s&&o(i)?(i.selected=!0,this.value=i.value,s=!0):i.selected=!1}let r=new Event(\"input\",{bubbles:!0}),l=new Event(\"change\",{bubbles:!0});return this.dispatchEvent(r),this.dispatchEvent(l),Array.from(this.selectedOptions).map(s=>s.value)}catch{return[]}}function ae(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument?.defaultView?.getComputedStyle(e)??window.getComputedStyle(e);if(!t||t.display===\"none\"||t.visibility===\"hidden\")return!1;let n=parseFloat(t.opacity??\"1\");if(!Number.isFinite(n)||n===0)return!1;let o=e.getBoundingClientRect();return!(!o||Math.max(o.width,o.height)===0||e.getClientRects().length===0)}catch{return!1}}function ce(){try{let e=this;if((e.tagName||\"\").toLowerCase()===\"input\"){let o=e.type?.toLowerCase()??\"\";if(o===\"checkbox\"||o===\"radio\")return!!e.checked}let n=e.getAttribute?.(\"aria-checked\");return n!=null?n===\"true\":!1}catch{return!1}}function ue(){try{let e=this,t=(e.tagName||\"\").toLowerCase();return t===\"input\"||t===\"textarea\"||t===\"select\"?String(e.value??\"\"):e.isContentEditable?String(e.textContent??\"\"):\"\"}catch{return\"\"}}function de(){try{return String(this.textContent??\"\")}catch{return\"\"}}function me(){try{return String(this.innerHTML??\"\")}catch{return\"\"}}function fe(){try{let e=this,t=e.innerText;if(typeof t==\"string\"&&t.length>0)return t;let n=e.textContent;return typeof n==\"string\"?n:\"\"}catch{return\"\"}}function O(e){let t=String(e||\"\").trim().replace(/^xpath=/i,\"\");if(!t)return[];let n=[],o=0;for(;o<t.length;){let r=\"child\";t.startsWith(\"//\",o)?(r=\"desc\",o+=2):t[o]===\"/\"&&(r=\"child\",o+=1);let l=o,s=0,i=null;for(;o<t.length;){let c=t[o];if(i)c===i&&(i=null);else if(c===\"'\"||c==='\"')i=c;else if(c===\"[\")s++;else if(c===\"]\")s--;else if(c===\"/\"&&s===0)break;o+=1}let a=t.slice(l,o).trim();if(!a)continue;let{tag:d,predicates:f}=pe(a);n.push({axis:r,tag:d,predicates:f})}return n}function he(e){let t=[],n=0;for(;n<e.length;){if(e[n]!==\"[\"){n++;continue}n++;let o=n,r=null;for(;n<e.length;){let l=e[n];if(r)l===r&&(r=null);else if(l===\"'\"||l==='\"')r=l;else if(l===\"]\")break;n++}t.push(e.slice(o,n).trim()),n++}return t}function pe(e){let t=e.indexOf(\"[\");if(t===-1)return{tag:e===\"\"?\"*\":e.toLowerCase(),predicates:[]};let n=e.slice(0,t).trim(),o=n===\"\"?\"*\":n.toLowerCase(),r=e.slice(t),l=[];for(let s of he(r)){let i=T(s);i&&l.push(i)}return{tag:o,predicates:l}}function T(e){let t=e.trim();if(!t)return null;let n=A(t,\"or\");if(n.length>1){let l=n.map(s=>T(s)).filter(Boolean);return l.length!==n.length?null:{type:\"or\",predicates:l}}let o=A(t,\"and\");if(o.length>1){let l=o.map(s=>T(s)).filter(Boolean);return l.length!==o.length?null:{type:\"and\",predicates:l}}let r=we(t,\"not\");if(r!=null){let l=T(r);return l?{type:\"not\",predicate:l}:null}return ge(t)}function ge(e){let t=/^(?:'([^']*)'|\"([^\"]*)\")$/,n=\"[a-zA-Z_][\\\\w.-]*\",o=`(?:'([^']*)'|\"([^\"]*)\")`;if(/^\\d+$/.test(e))return{type:\"index\",index:Math.max(1,Number(e))};let r=e.match(new RegExp(`^normalize-space\\\\(\\\\s*@(${n})\\\\s*\\\\)\\\\s*=\\\\s*${o}$`));if(r)return{type:\"attrEquals\",name:r[1],value:r[2]??r[3]??\"\",normalize:!0};let l=e.match(new RegExp(`^normalize-space\\\\(\\\\s*(?:text\\\\(\\\\)|\\\\.)\\\\s*\\\\)\\\\s*=\\\\s*${o}$`));if(l)return{type:\"textEquals\",value:l[1]??l[2]??\"\",normalize:!0};let s=e.match(new RegExp(`^@(${n})\\\\s*=\\\\s*${o}$`));if(s)return{type:\"attrEquals\",name:s[1],value:s[2]??s[3]??\"\"};let i=e.match(new RegExp(`^@(${n})$`));if(i)return{type:\"attrExists\",name:i[1]};let a=e.match(new RegExp(`^contains\\\\(\\\\s*@(${n})\\\\s*,\\\\s*${o}\\\\s*\\\\)$`));if(a)return{type:\"attrContains\",name:a[1],value:a[2]??a[3]??\"\"};let d=e.match(new RegExp(`^starts-with\\\\(\\\\s*@(${n})\\\\s*,\\\\s*${o}\\\\s*\\\\)$`));if(d)return{type:\"attrStartsWith\",name:d[1],value:d[2]??d[3]??\"\"};let f=e.match(new RegExp(`^(?:text\\\\(\\\\)|\\\\.)\\\\s*=\\\\s*${o}$`));if(f)return{type:\"textEquals\",value:f[1]??f[2]??\"\"};let c=e.match(new RegExp(`^contains\\\\(\\\\s*(?:text\\\\(\\\\)|\\\\.)\\\\s*,\\\\s*${o}\\\\s*\\\\)$`));return c?{type:\"textContains\",value:c[1]??c[2]??\"\"}:(t.test(e),null)}function A(e,t){let n=[],o=0,r=0,l=null,s=0;for(;s<e.length;){let i=e[s];if(l){i===l&&(l=null),s+=1;continue}if(i===\"'\"||i==='\"'){l=i,s+=1;continue}if(i===\"(\"){r+=1,s+=1;continue}if(i===\")\"){r=Math.max(0,r-1),s+=1;continue}if(r===0&&Ee(e,s,t)){n.push(e.slice(o,s).trim()),s+=t.length,o=s;continue}s+=1}return n.push(e.slice(o).trim()),n.filter(i=>i.length>0)}function Ee(e,t,n){if(!e.startsWith(n,t))return!1;let o=t>0?e[t-1]:\" \";if(o===\"@\")return!1;let r=t+n.length<e.length?e[t+n.length]:\" \";return W(o)&&W(r)}function W(e){return!/[a-zA-Z0-9_.-]/.test(e)}function we(e,t){let n=`${t}(`;if(!e.startsWith(n)||!e.endsWith(\")\"))return null;let o=e.slice(n.length,-1);return ye(o)?o:null}function ye(e){let t=0,n=null;for(let o=0;o<e.length;o+=1){let r=e[o];if(n){r===n&&(n=null);continue}if(r===\"'\"||r==='\"'){n=r;continue}if(r===\"(\"?t+=1:r===\")\"&&(t-=1),t<0)return!1}return t===0}var be=e=>e.replace(/\\s+/g,\" \").trim();function _(e){return String(e.textContent??\"\")}function S(e,t){return t?be(e):e}function R(e,t){switch(t.type){case\"and\":return t.predicates.every(n=>R(e,n));case\"or\":return t.predicates.some(n=>R(e,n));case\"not\":return!R(e,t.predicate);case\"attrExists\":return e.getAttribute(t.name)!==null;case\"attrEquals\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize)===S(t.value,t.normalize)}case\"attrContains\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize).includes(S(t.value,t.normalize))}case\"attrStartsWith\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize).startsWith(S(t.value,t.normalize))}case\"textEquals\":return S(_(e),t.normalize)===S(t.value,t.normalize);case\"textContains\":return S(_(e),t.normalize).includes(S(t.value,t.normalize));case\"index\":return!0;default:return!0}}function q(e,t){let n=e;for(let o of t){if(!n.length)return[];if(o.type===\"index\"){let r=o.index-1;n=r>=0&&r<n.length?[n[r]]:[];continue}n=n.filter(r=>R(r,o))}return n}var P=e=>{let t=String(e??\"\").trim();return t?t.replace(/^xpath=/i,\"\").trim():\"\"};function I(e,t){return k(e,0,t)}function k(e,t,n){if(!Number.isFinite(t)||t<0)return null;let o=P(e);if(!o)return null;let r=Math.floor(t),l=n?.pierceShadow!==!1,s=l?z():null;if(!l)return X(o,r).value;if(!s?.hasShadow){let a=X(o,r);return a.error?N(o,s?.getClosedRoot)[r]??null:a.value}return N(o,s.getClosedRoot)[r]??null}function $(e,t){let n=P(e);if(!n)return 0;let o=t?.pierceShadow!==!1,r=o?z():null;if(!o)return F(n).count;if(!r?.hasShadow){let l=F(n);return l.error?N(n,r?.getClosedRoot).length:l.count}return N(n,r.getClosedRoot).length}function N(e,t){let n=P(e);if(!n)return[];let o=O(n);if(!o.length)return[];let r=t??null,l=[document];for(let s of o){let i=[],a=new Set;for(let d of l){if(!d)continue;let f=s.axis===\"child\"?L(d,r):Se(d,r);if(!f.length)continue;let c=f.filter(g=>xe(g,s)),p=q(c,s.predicates);for(let g of p)a.has(g)||(a.add(g),i.push(g))}if(!i.length)return[];l=i}return l}function xe(e,t){return t.tag===\"*\"?!0:e.localName===t.tag}function z(){let e=window.__stagehandV3__,t=e&&typeof e.getClosedRoot==\"function\"?o=>{try{return e.getClosedRoot(o)??null}catch{return null}}:null,n=!1;try{if(e&&typeof e.stats==\"function\"){let o=e.stats();n=(o?.open??0)>0||(o?.closed??0)>0}}catch{}if(!n)try{let o=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();)if(o.currentNode.shadowRoot){n=!0;break}}catch{}return{getClosedRoot:t,hasShadow:n}}function L(e,t){let n=[];if(!e)return n;if(e instanceof Document)return e.documentElement&&n.push(e.documentElement),n;if(e instanceof ShadowRoot||e instanceof DocumentFragment)return n.push(...Array.from(e.children??[])),n;if(e instanceof Element){n.push(...Array.from(e.children??[]));let o=e.shadowRoot;if(o&&n.push(...Array.from(o.children??[])),t){let r=t(e);r&&n.push(...Array.from(r.children??[]))}return n}return n}function Se(e,t){let n=[],o=new Set,r=[...L(e,t)].reverse();for(;r.length;){let l=r.pop();if(!l||o.has(l))continue;o.add(l),n.push(l);let s=L(l,t);for(let i=s.length-1;i>=0;i-=1)r.push(s[i])}return n}function X(e,t){try{return{value:document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(t),error:!1}}catch{return{value:null,error:!0}}}function F(e){try{return{count:document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength,error:!1}}catch{return{count:0,error:!0}}}var C=e=>{let t=Number(e??0);return!Number.isFinite(t)||t<0?0:Math.floor(t)},V=(e,t)=>{if(!e)return[];let n=new WeakSet,o=new Set,r=[],l=[document],s=i=>{if(!(!i||n.has(i)||r.length>=t)){n.add(i);try{let a=i.querySelectorAll(e);for(let d of a)if(!o.has(d)&&(o.add(d),r.push(d),r.length>=t))return}catch{}try{let d=(i instanceof Document?i:i.host?.ownerDocument??document).createTreeWalker(i,NodeFilter.SHOW_ELEMENT),f;for(;f=d.nextNode();){if(!(f instanceof Element))continue;let c=f.shadowRoot;c&&l.push(c)}}catch{}}};for(;l.length&&r.length<t;){let i=l.shift();i&&s(i)}return r};function ve(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t);return V(n,o+1)[o]??null}function Te(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t),r=window.__stagehandV3__;if(!r||typeof r.getClosedRoot!=\"function\")return V(n,o+1)[o]??null;let l=c=>{try{return r.getClosedRoot(c)??null}catch{return null}},s=new WeakSet,i=new Set,a=[],d=[document],f=c=>{if(!(!c||s.has(c)||a.length>=o+1)){s.add(c);try{let p=c.querySelectorAll(n);for(let g of p)if(!i.has(g)&&(i.add(g),a.push(g),a.length>=o+1))return}catch{}try{let g=(c instanceof Document?c:c.host?.ownerDocument??document).createTreeWalker(c,NodeFilter.SHOW_ELEMENT),w;for(;w=g.nextNode();){if(!(w instanceof Element))continue;let x=w.shadowRoot;x&&d.push(x);let y=l(w);y&&d.push(y)}}catch{}}};for(;d.length&&a.length<o+1;){let c=d.shift();c&&f(c)}return a[o]??null}function Re(e,t){let n=String(e??\"\");if(!n)return null;let o=n.toLowerCase(),r=C(t),l=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),s=u=>{if(!u)return!1;let h=u.tagName?.toUpperCase()??\"\";return l.has(h)},i=u=>{try{if(s(u))return\"\";let h=u.innerText;if(typeof h==\"string\"&&h.trim())return h.trim()}catch{}try{let h=u.textContent;if(typeof h==\"string\")return h.trim()}catch{}return\"\"},a=u=>{let h=i(u);return!!h&&h.toLowerCase().includes(o)},d=window.__stagehandV3__,f=d&&typeof d.getClosedRoot==\"function\"?u=>{try{return d.getClosedRoot(u)??null}catch{return null}}:u=>null,c=new WeakSet,p=[],g=[],w=u=>{!u||c.has(u)||(c.add(u),p.push(u))},x=u=>{try{return(u instanceof Document?u:u?.ownerDocument??document).createTreeWalker(u,NodeFilter.SHOW_ELEMENT)}catch{return null}};for(w(document);p.length;){let u=p.shift();if(!u)continue;u instanceof Element&&a(u)&&g.push({element:u,tag:u.tagName??\"\",id:u.id??\"\",className:u.className??\"\",text:i(u)});let h=x(u);if(!h)continue;let E;for(;E=h.nextNode();){if(!(E instanceof Element))continue;a(E)&&g.push({element:E,tag:E.tagName??\"\",id:E.id??\"\",className:E.className??\"\",text:i(E)});let b=E.shadowRoot;b&&w(b);let D=f(E);D&&w(D)}}let y=[];for(let u of g){let h=u.element,E=!1;for(let b of g)if(u!==b)try{if(h.contains(b.element)){E=!0;break}}catch{}E||y.push(u)}return y[r]?.element??null}function Ne(e,t){let n=C(t);return k(e,n,{pierceShadow:!0})}function Ce(e){let t=String(e??\"\").trim();if(!t)return 0;let n=new WeakSet,o=r=>{if(!r||n.has(r))return 0;n.add(r);let l=0;try{let s=r;typeof s.querySelectorAll==\"function\"&&(l+=s.querySelectorAll(t).length)}catch{}try{let i=(r instanceof Document?r:r?.ownerDocument??document).createTreeWalker(r,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();)a instanceof Element&&a.shadowRoot&&(l+=o(a.shadowRoot))}catch{}return l};try{return o(document)}catch{try{return document.querySelectorAll(t).length}catch{return 0}}}function Me(e){let t=String(e??\"\").trim();if(!t)return 0;let n=window.__stagehandV3__;if(!n||typeof n.getClosedRoot!=\"function\")try{return document.querySelectorAll(t).length}catch{return 0}let o=new WeakSet,r=[],l=a=>{!a||o.has(a)||(o.add(a),r.push(a))};l(document);let s=0,i=a=>{let d=a.shadowRoot;d&&l(d);try{let f=n.getClosedRoot(a);f&&l(f)}catch{}};for(;r.length;){let a=r.shift();if(a){try{let d=a;typeof d.querySelectorAll==\"function\"&&(s+=d.querySelectorAll(t).length)}catch{}try{let f=(a instanceof Document?a:a instanceof ShadowRoot?a.host?.ownerDocument??document:a.ownerDocument??document).createTreeWalker(a,NodeFilter.SHOW_ELEMENT),c;for(;c=f.nextNode();)c instanceof Element&&i(c)}catch{}}}return s}function Le(e){let t=String(e??\"\");if(!t)return{count:0,sample:[],error:null};let n=t.toLowerCase(),o=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),r=m=>{if(!m)return!1;let u=m.tagName?.toUpperCase()??\"\";return o.has(u)},l=m=>{try{if(r(m))return\"\";let u=m.innerText;if(typeof u==\"string\"&&u.trim())return u.trim()}catch{}try{let u=m.textContent;if(typeof u==\"string\")return u.trim()}catch{}return\"\"},s=m=>{let u=l(m);return!!u&&u.toLowerCase().includes(n)},i=window.__stagehandV3__,a=i&&typeof i.getClosedRoot==\"function\"?m=>{try{return i.getClosedRoot(m)??null}catch{return null}}:m=>null,d=new WeakSet,f=[],c=m=>{!m||d.has(m)||(d.add(m),f.push(m))},p=m=>{try{return(m instanceof Document?m:m?.ownerDocument??document).createTreeWalker(m,NodeFilter.SHOW_ELEMENT)}catch{return null}},g=[];for(c(document);f.length;){let m=f.shift();if(!m)continue;m instanceof Element&&s(m)&&g.push({element:m,tag:m.tagName??\"\",id:m.id??\"\",className:m.className??\"\",text:l(m)});let u=p(m);if(!u)continue;let h;for(;h=u.nextNode();){if(!(h instanceof Element))continue;s(h)&&g.push({element:h,tag:h.tagName??\"\",id:h.id??\"\",className:h.className??\"\",text:l(h)});let E=h.shadowRoot;E&&c(E);let b=a(h);b&&c(b)}}let w=[];for(let m of g){let u=m.element,h=!1;for(let E of g)if(m!==E)try{if(u.contains(E.element)){h=!0;break}}catch{}h||w.push(m)}let x=w.length,y=w.slice(0,5).map(m=>({tag:m.tag,id:m.id,class:m.className,text:m.text}));return{count:x,sample:y,error:null}}function Pe(e){return $(e,{pierceShadow:!0})}var ke=e=>e.startsWith(\"xpath=\")||e.startsWith(\"/\"),De=e=>{try{let t=window.__stagehandV3__;if(t&&typeof t.getClosedRoot==\"function\")return t.getClosedRoot(e)??null}catch{}return null},Y=e=>e.shadowRoot?e.shadowRoot:De(e),He=(e,t,n)=>{try{let l=e.querySelector(t);if(l)return l}catch{}if(!n)return null;let o=new WeakSet,r=[e];for(;r.length>0;){let l=r.shift();if(!(!l||o.has(l))){o.add(l);try{let s=l.querySelector(t);if(s)return s}catch{}try{let i=(l instanceof Document?l:l.host?.ownerDocument??document).createTreeWalker(l,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();){if(!(a instanceof Element))continue;let d=Y(a);d&&!o.has(d)&&r.push(d)}}catch{}}}return null},Ae=(e,t)=>I(e,{pierceShadow:t}),B=(e,t)=>ke(e)?Ae(e,t):He(document,e,t),G=(e,t)=>{if(t===\"detached\")return e===null;if(t===\"attached\")return e!==null;if(e===null)return!1;if(t===\"hidden\")try{let n=window.getComputedStyle(e),o=e.getBoundingClientRect();return n.display===\"none\"||n.visibility===\"hidden\"||n.opacity===\"0\"||o.width===0||o.height===0}catch{return!1}try{let n=window.getComputedStyle(e),o=e.getBoundingClientRect();return n.display!==\"none\"&&n.visibility!==\"hidden\"&&n.opacity!==\"0\"&&o.width>0&&o.height>0}catch{return!1}},We=(e,t)=>{let n=new WeakSet,o=l=>{let s=Y(l);if(s&&!n.has(s)){n.add(s);let i=new MutationObserver(e);i.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"style\",\"class\",\"hidden\",\"disabled\"]}),t.push(i);for(let a of Array.from(s.children))o(a)}for(let i of Array.from(l.children))o(i)},r=document.documentElement||document.body;r&&o(r)};function _e(e,t,n,o){let r=String(e??\"\").trim(),l=String(t??\"visible\")||\"visible\",s=typeof n==\"number\"&&n>0?n:3e4,i=o!==!1;return new Promise((a,d)=>{let f=null,c=null,p=!1,g=()=>{f!==null&&(clearTimeout(f),f=null)},w=B(r,i);if(G(w,l)){p=!0,a(!0);return}let x=[],y=()=>{for(let E of x)E.disconnect();c&&(document.removeEventListener(\"DOMContentLoaded\",c),c=null)},m=()=>{if(p)return;let E=B(r,i);G(E,l)&&(p=!0,g(),y(),a(!0))};if(!(document.body||document.documentElement)){c=()=>{document.removeEventListener(\"DOMContentLoaded\",c),c=null,m(),h()},document.addEventListener(\"DOMContentLoaded\",c),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s);return}let h=()=>{let E=document.body||document.documentElement;if(!E)return;let b=new MutationObserver(m);b.observe(E,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"style\",\"class\",\"hidden\",\"disabled\"]}),x.push(b),i&&We(m,x)};h(),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s)})}return J(Oe);})();\n globalThis.__stagehandLocatorScripts = __stagehandLocatorScriptsFactory;\n}";
6
+ export const locatorScriptSources = {
7
+ "assignFilePayloadsToInputElement": "function ce(e){try{let t=this;if(!t||t.tagName?.toLowerCase()!==\"input\"||(t.type??\"\").toLowerCase()!==\"file\")return!1;let n=(()=>{try{return new DataTransfer}catch{return null}})();if(!n)return!1;let o=Array.isArray(e)?e:[];for(let r of o){if(!r)continue;let l=r.name||\"upload.bin\",s=r.mimeType||\"application/octet-stream\",i=typeof r.lastModified==\"number\"?r.lastModified:Date.now(),a=window.atob(r.base64??\"\"),d=new Uint8Array(a.length);for(let p=0;p<a.length;p+=1)d[p]=a.charCodeAt(p);let f=new Blob([d],{type:s}),c=new File([f],l,{type:s,lastModified:i});n.items.add(c)}return t.files=n.files,t.dispatchEvent(new Event(\"input\",{bubbles:!0})),t.dispatchEvent(new Event(\"change\",{bubbles:!0})),!0}catch{return!1}}",
8
+ "countCssMatchesPierce": "function He(e){let t=String(e??\"\").trim();if(!t)return 0;let n=window.__stagehandV3__;if(!n||typeof n.getClosedRoot!=\"function\")try{return document.querySelectorAll(t).length}catch{return 0}let o=new WeakSet,r=[],l=a=>{!a||o.has(a)||(o.add(a),r.push(a))};l(document);let s=0,i=a=>{let d=a.shadowRoot;d&&l(d);try{let f=n.getClosedRoot(a);f&&l(f)}catch{}};for(;r.length;){let a=r.shift();if(a){try{let d=a;typeof d.querySelectorAll==\"function\"&&(s+=d.querySelectorAll(t).length)}catch{}try{let f=(a instanceof Document?a:a instanceof ShadowRoot?a.host?.ownerDocument??document:a.ownerDocument??document).createTreeWalker(a,NodeFilter.SHOW_ELEMENT),c;for(;c=f.nextNode();)c instanceof Element&&i(c)}catch{}}}return s}",
9
+ "countCssMatchesPrimary": "function De(e){let t=String(e??\"\").trim();if(!t)return 0;let n=new WeakSet,o=r=>{if(!r||n.has(r))return 0;n.add(r);let l=0;try{let s=r;typeof s.querySelectorAll==\"function\"&&(l+=s.querySelectorAll(t).length)}catch{}try{let i=(r instanceof Document?r:r?.ownerDocument??document).createTreeWalker(r,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();)a instanceof Element&&a.shadowRoot&&(l+=o(a.shadowRoot))}catch{}return l};try{return o(document)}catch{try{return document.querySelectorAll(t).length}catch{return 0}}}",
10
+ "countTextMatches": "function Ae(e){let t=String(e??\"\");if(!t)return{count:0,sample:[],error:null};let n=t.toLowerCase(),o=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),r=m=>{if(!m)return!1;let u=m.tagName?.toUpperCase()??\"\";return o.has(u)},l=m=>{try{if(r(m))return\"\";let u=m.innerText;if(typeof u==\"string\"&&u.trim())return u.trim()}catch{}try{let u=m.textContent;if(typeof u==\"string\")return u.trim()}catch{}return\"\"},s=m=>{let u=l(m);return!!u&&u.toLowerCase().includes(n)},i=window.__stagehandV3__,a=i&&typeof i.getClosedRoot==\"function\"?m=>{try{return i.getClosedRoot(m)??null}catch{return null}}:m=>null,d=new WeakSet,f=[],c=m=>{!m||d.has(m)||(d.add(m),f.push(m))},p=m=>{try{return(m instanceof Document?m:m?.ownerDocument??document).createTreeWalker(m,NodeFilter.SHOW_ELEMENT)}catch{return null}},g=[];for(c(document);f.length;){let m=f.shift();if(!m)continue;m instanceof Element&&s(m)&&g.push({element:m,tag:m.tagName??\"\",id:m.id??\"\",className:m.className??\"\",text:l(m)});let u=p(m);if(!u)continue;let h;for(;h=u.nextNode();){if(!(h instanceof Element))continue;s(h)&&g.push({element:h,tag:h.tagName??\"\",id:h.id??\"\",className:h.className??\"\",text:l(h)});let E=h.shadowRoot;E&&c(E);let b=a(h);b&&c(b)}}let w=[];for(let m of g){let u=m.element,h=!1;for(let E of g)if(m!==E)try{if(u.contains(E.element)){h=!0;break}}catch{}h||w.push(m)}let x=w.length,y=w.slice(0,5).map(m=>({tag:m.tag,id:m.id,class:m.className,text:m.text}));return{count:x,sample:y,error:null}}",
11
+ "countXPathMatchesMainWorld": "function We(e){return I(e,{pierceShadow:!0})}",
12
+ "dispatchDomClick": "function ue(e){let t=e??{};try{let n=new MouseEvent(\"click\",{bubbles:!!t.bubbles,cancelable:!!t.cancelable,composed:!!t.composed,detail:typeof t.detail==\"number\"?t.detail:1,view:this?.ownerDocument?.defaultView??window});this.dispatchEvent(n)}catch{try{this.click()}catch{}}}",
13
+ "ensureFileInputElement": "function ae(){try{return(this.tagName?.toLowerCase()??\"\")!==\"input\"?!1:String(this.type??\"\").toLowerCase()===\"file\"}catch{return!1}}",
14
+ "fillElementValue": "function me(e){let t=this;if(!t.isConnected)return{status:\"error\",reason:\"notconnected\"};let o=(t.ownerDocument||document).defaultView||window,r=e??\"\";try{let l=s=>{let i;if(typeof o.InputEvent==\"function\")try{i=new o.InputEvent(\"input\",{bubbles:!0,composed:!0,data:s,inputType:\"insertText\"})}catch{i=new o.Event(\"input\",{bubbles:!0,composed:!0})}else i=new o.Event(\"input\",{bubbles:!0,composed:!0});t.dispatchEvent(i);let a=new o.Event(\"change\",{bubbles:!0});t.dispatchEvent(a)};if(t instanceof o.HTMLInputElement){let s=(t.type||\"\").toLowerCase();if(!Y.has(s)&&!D.has(s))return{status:\"error\",reason:`unsupported-input-type:${s}`};let i=e;if(s===\"number\"){let a=e.trim();if(a!==\"\"&&Number.isNaN(Number(a)))return{status:\"error\",reason:\"invalid-number-value\"};i=a}if(r=i,D.has(s)){let a=e.trim();r=a,v.call(t);let d=o.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(d,\"value\")?.set;return typeof c==\"function\"?c.call(t,a):t.value=a,t._valueTracker?.setValue?.(a),t.value!==a?{status:\"error\",reason:\"malformed-value\"}:(l(a),{status:\"done\"})}return v.call(t),{status:\"needsinput\",value:i}}return t instanceof o.HTMLTextAreaElement?(v.call(t),r=e,{status:\"needsinput\",value:e}):t instanceof o.HTMLSelectElement?{status:\"error\",reason:\"unsupported-element\"}:t.isContentEditable?(v.call(t),r=e,{status:\"needsinput\",value:e}):{status:\"error\",reason:\"unsupported-element\"}}catch(l){let s=\"exception\";if(l&&typeof l==\"object\"){let i=l.message;typeof i==\"string\"&&i.trim().length>0&&(s=`exception:${i}`)}return{status:\"needsinput\",value:r,reason:s}}}",
15
+ "focusElement": "function fe(){try{typeof this.focus==\"function\"&&this.focus()}catch{}}",
16
+ "isElementChecked": "function ge(){try{let e=this;if((e.tagName||\"\").toLowerCase()===\"input\"){let o=e.type?.toLowerCase()??\"\";if(o===\"checkbox\"||o===\"radio\")return!!e.checked}let n=e.getAttribute?.(\"aria-checked\");return n!=null?n===\"true\":!1}catch{return!1}}",
17
+ "isElementVisible": "function pe(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument?.defaultView?.getComputedStyle(e)??window.getComputedStyle(e);if(!t||t.display===\"none\"||t.visibility===\"hidden\")return!1;let n=parseFloat(t.opacity??\"1\");if(!Number.isFinite(n)||n===0)return!1;let o=e.getBoundingClientRect();return!(!o||Math.max(o.width,o.height)===0||e.getClientRects().length===0)}catch{return!1}}",
18
+ "prepareElementForTyping": "function v(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument||document,n=t.defaultView||window;try{typeof e.focus==\"function\"&&e.focus()}catch{}if(e instanceof n.HTMLInputElement||e instanceof n.HTMLTextAreaElement){try{if(typeof e.select==\"function\")return e.select(),!0}catch{}try{let o=(e.value??\"\").length;if(typeof e.setSelectionRange==\"function\")return e.setSelectionRange(0,o),!0}catch{}return!0}if(e.isContentEditable){let o=t.getSelection?.(),r=t.createRange?.();if(o&&r)try{r.selectNodeContents(e),o.removeAllRanges(),o.addRange(r)}catch{}return!0}return!1}catch{return!1}}",
19
+ "readElementInnerHTML": "function ye(){try{return String(this.innerHTML??\"\")}catch{return\"\"}}",
20
+ "readElementInnerText": "function be(){try{let e=this,t=e.innerText;if(typeof t==\"string\"&&t.length>0)return t;let n=e.textContent;return typeof n==\"string\"?n:\"\"}catch{return\"\"}}",
21
+ "readElementInputValue": "function Ee(){try{let e=this,t=(e.tagName||\"\").toLowerCase();return t===\"input\"||t===\"textarea\"||t===\"select\"?String(e.value??\"\"):e.isContentEditable?String(e.textContent??\"\"):\"\"}catch{return\"\"}}",
22
+ "readElementTextContent": "function we(){try{return String(this.textContent??\"\")}catch{return\"\"}}",
23
+ "resolveCssSelector": "function Ne(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t);return z(n,o+1)[o]??null}",
24
+ "resolveCssSelectorPierce": "function Ce(e,t){let n=String(e??\"\").trim();if(!n)return null;let o=C(t),r=window.__stagehandV3__;if(!r||typeof r.getClosedRoot!=\"function\")return z(n,o+1)[o]??null;let l=c=>{try{return r.getClosedRoot(c)??null}catch{return null}},s=new WeakSet,i=new Set,a=[],d=[document],f=c=>{if(!(!c||s.has(c)||a.length>=o+1)){s.add(c);try{let p=c.querySelectorAll(n);for(let g of p)if(!i.has(g)&&(i.add(g),a.push(g),a.length>=o+1))return}catch{}try{let g=(c instanceof Document?c:c.host?.ownerDocument??document).createTreeWalker(c,NodeFilter.SHOW_ELEMENT),w;for(;w=g.nextNode();){if(!(w instanceof Element))continue;let x=w.shadowRoot;x&&d.push(x);let y=l(w);y&&d.push(y)}}catch{}}};for(;d.length&&a.length<o+1;){let c=d.shift();c&&f(c)}return a[o]??null}",
25
+ "resolveTextSelector": "function Me(e,t){let n=String(e??\"\");if(!n)return null;let o=n.toLowerCase(),r=C(t),l=new Set([\"SCRIPT\",\"STYLE\",\"TEMPLATE\",\"NOSCRIPT\",\"HEAD\",\"TITLE\",\"LINK\",\"META\",\"HTML\",\"BODY\"]),s=u=>{if(!u)return!1;let h=u.tagName?.toUpperCase()??\"\";return l.has(h)},i=u=>{try{if(s(u))return\"\";let h=u.innerText;if(typeof h==\"string\"&&h.trim())return h.trim()}catch{}try{let h=u.textContent;if(typeof h==\"string\")return h.trim()}catch{}return\"\"},a=u=>{let h=i(u);return!!h&&h.toLowerCase().includes(o)},d=window.__stagehandV3__,f=d&&typeof d.getClosedRoot==\"function\"?u=>{try{return d.getClosedRoot(u)??null}catch{return null}}:u=>null,c=new WeakSet,p=[],g=[],w=u=>{!u||c.has(u)||(c.add(u),p.push(u))},x=u=>{try{return(u instanceof Document?u:u?.ownerDocument??document).createTreeWalker(u,NodeFilter.SHOW_ELEMENT)}catch{return null}};for(w(document);p.length;){let u=p.shift();if(!u)continue;u instanceof Element&&a(u)&&g.push({element:u,tag:u.tagName??\"\",id:u.id??\"\",className:u.className??\"\",text:i(u)});let h=x(u);if(!h)continue;let E;for(;E=h.nextNode();){if(!(E instanceof Element))continue;a(E)&&g.push({element:E,tag:E.tagName??\"\",id:E.id??\"\",className:E.className??\"\",text:i(E)});let b=E.shadowRoot;b&&w(b);let k=f(E);k&&w(k)}}let y=[];for(let u of g){let h=u.element,E=!1;for(let b of g)if(u!==b)try{if(h.contains(b.element)){E=!0;break}}catch{}E||y.push(u)}return y[r]?.element??null}",
26
+ "resolveXPathMainWorld": "function Le(e,t){let n=C(t);return P(e,n,{pierceShadow:!0})}",
27
+ "scrollElementToPercent": "function de(e){let t=n=>{if(typeof n==\"number\"&&Number.isFinite(n))return n;let o=String(n??\"\").trim();if(!o)return 0;let r=parseFloat(o.replace(\"%\",\"\"));return Number.isNaN(r)||!Number.isFinite(r)?0:r};try{let n=Math.max(0,Math.min(t(e),100)),o=this,r=o.tagName?.toLowerCase()??\"\";if(r===\"html\"||r===\"body\"){let c=(o.ownerDocument?.scrollingElement||o.ownerDocument?.documentElement||o.ownerDocument?.body||document.scrollingElement||document.documentElement||document.body)?.scrollHeight??document.body.scrollHeight??0,p=o.ownerDocument?.defaultView?.innerHeight??window.innerHeight,w=Math.max(0,c-p)*(n/100);return o.ownerDocument?.defaultView?.scrollTo({top:w,left:o.ownerDocument?.defaultView?.scrollX??window.scrollX??0,behavior:\"smooth\"}),!0}let s=o.scrollHeight??0,i=o.clientHeight??0,d=Math.max(0,s-i)*(n/100);return o.scrollTo({top:d,left:o.scrollLeft??0,behavior:\"smooth\"}),!0}catch{return!1}}",
28
+ "selectElementOptions": "function he(e){try{if(!(this instanceof HTMLSelectElement))return[];let t=Array.isArray(e)?e:[e],n=new Set(t.map(s=>String(s??\"\").trim())),o=s=>{let i=(s.label||s.textContent||\"\").trim(),a=String(s.value??\"\").trim();return n.has(i)||n.has(a)};if(this.multiple)for(let s of Array.from(this.options))s.selected=o(s);else{let s=!1;for(let i of Array.from(this.options))!s&&o(i)?(i.selected=!0,this.value=i.value,s=!0):i.selected=!1}let r=new Event(\"input\",{bubbles:!0}),l=new Event(\"change\",{bubbles:!0});return this.dispatchEvent(r),this.dispatchEvent(l),Array.from(this.selectedOptions).map(s=>s.value)}catch{return[]}}",
29
+ "waitForSelector": "function qe(e,t,n,o){let r=String(e??\"\").trim(),l=String(t??\"visible\")||\"visible\",s=typeof n==\"number\"&&n>0?n:3e4,i=o!==!1;return new Promise((a,d)=>{let f=null,c=null,p=!1,g=()=>{f!==null&&(clearTimeout(f),f=null)},w=V(r,i);if(B(w,l)){p=!0,a(!0);return}let x=[],y=()=>{for(let E of x)E.disconnect();c&&(document.removeEventListener(\"DOMContentLoaded\",c),c=null)},m=()=>{if(p)return;let E=V(r,i);B(E,l)&&(p=!0,g(),y(),a(!0))};if(!(document.body||document.documentElement)){c=()=>{document.removeEventListener(\"DOMContentLoaded\",c),c=null,m(),h()},document.addEventListener(\"DOMContentLoaded\",c),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s);return}let h=()=>{let E=document.body||document.documentElement;if(!E)return;let b=new MutationObserver(m);b.observe(E,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"style\",\"class\",\"hidden\",\"disabled\"]}),x.push(b),i&&ie(m,x)};h(),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \"${r}\" to be ${l}`)))},s)})}"
30
+ };
31
+ export const locatorScriptGlobalRefs = {
32
+ "assignFilePayloadsToInputElement": "globalThis.__stagehandLocatorScripts.assignFilePayloadsToInputElement",
33
+ "countCssMatchesPierce": "globalThis.__stagehandLocatorScripts.countCssMatchesPierce",
34
+ "countCssMatchesPrimary": "globalThis.__stagehandLocatorScripts.countCssMatchesPrimary",
35
+ "countTextMatches": "globalThis.__stagehandLocatorScripts.countTextMatches",
36
+ "countXPathMatchesMainWorld": "globalThis.__stagehandLocatorScripts.countXPathMatchesMainWorld",
37
+ "dispatchDomClick": "globalThis.__stagehandLocatorScripts.dispatchDomClick",
38
+ "ensureFileInputElement": "globalThis.__stagehandLocatorScripts.ensureFileInputElement",
39
+ "fillElementValue": "globalThis.__stagehandLocatorScripts.fillElementValue",
40
+ "focusElement": "globalThis.__stagehandLocatorScripts.focusElement",
41
+ "isElementChecked": "globalThis.__stagehandLocatorScripts.isElementChecked",
42
+ "isElementVisible": "globalThis.__stagehandLocatorScripts.isElementVisible",
43
+ "prepareElementForTyping": "globalThis.__stagehandLocatorScripts.prepareElementForTyping",
44
+ "readElementInnerHTML": "globalThis.__stagehandLocatorScripts.readElementInnerHTML",
45
+ "readElementInnerText": "globalThis.__stagehandLocatorScripts.readElementInnerText",
46
+ "readElementInputValue": "globalThis.__stagehandLocatorScripts.readElementInputValue",
47
+ "readElementTextContent": "globalThis.__stagehandLocatorScripts.readElementTextContent",
48
+ "resolveCssSelector": "globalThis.__stagehandLocatorScripts.resolveCssSelector",
49
+ "resolveCssSelectorPierce": "globalThis.__stagehandLocatorScripts.resolveCssSelectorPierce",
50
+ "resolveTextSelector": "globalThis.__stagehandLocatorScripts.resolveTextSelector",
51
+ "resolveXPathMainWorld": "globalThis.__stagehandLocatorScripts.resolveXPathMainWorld",
52
+ "scrollElementToPercent": "globalThis.__stagehandLocatorScripts.scrollElementToPercent",
53
+ "selectElementOptions": "globalThis.__stagehandLocatorScripts.selectElementOptions",
54
+ "waitForSelector": "globalThis.__stagehandLocatorScripts.waitForSelector"
55
+ };
56
+ //# sourceMappingURL=locatorScripts.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locatorScripts.generated.js","sourceRoot":"","sources":["../../../../../../lib/v3/dom/build/locatorScripts.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,0rtBAA0rtB,CAAC;AACjutB,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,kCAAkC,EAAE,8tBAA8tB;IAClwB,uBAAuB,EAAE,ktBAAktB;IAC3uB,wBAAwB,EAAE,sgBAAsgB;IAChiB,kBAAkB,EAAE,ugDAAugD;IAC3hD,4BAA4B,EAAE,+CAA+C;IAC7E,kBAAkB,EAAE,yRAAyR;IAC7S,wBAAwB,EAAE,8IAA8I;IACxK,kBAAkB,EAAE,mlDAAmlD;IACvmD,cAAc,EAAE,0EAA0E;IAC1F,kBAAkB,EAAE,8PAA8P;IAClR,kBAAkB,EAAE,mZAAmZ;IACva,yBAAyB,EAAE,imBAAimB;IAC5nB,sBAAsB,EAAE,0EAA0E;IAClG,sBAAsB,EAAE,mKAAmK;IAC3L,uBAAuB,EAAE,qNAAqN;IAC9O,wBAAwB,EAAE,4EAA4E;IACtG,oBAAoB,EAAE,sGAAsG;IAC5H,0BAA0B,EAAE,8uBAA8uB;IAC1wB,qBAAqB,EAAE,o5CAAo5C;IAC36C,uBAAuB,EAAE,8DAA8D;IACvF,wBAAwB,EAAE,45BAA45B;IACt7B,sBAAsB,EAAE,snBAAsnB;IAC9oB,iBAAiB,EAAE,+lCAA+lC;CAC1mC,CAAC;AACX,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,kCAAkC,EAAE,uEAAuE;IAC3G,uBAAuB,EAAE,4DAA4D;IACrF,wBAAwB,EAAE,6DAA6D;IACvF,kBAAkB,EAAE,uDAAuD;IAC3E,4BAA4B,EAAE,iEAAiE;IAC/F,kBAAkB,EAAE,uDAAuD;IAC3E,wBAAwB,EAAE,6DAA6D;IACvF,kBAAkB,EAAE,uDAAuD;IAC3E,cAAc,EAAE,mDAAmD;IACnE,kBAAkB,EAAE,uDAAuD;IAC3E,kBAAkB,EAAE,uDAAuD;IAC3E,yBAAyB,EAAE,8DAA8D;IACzF,sBAAsB,EAAE,2DAA2D;IACnF,sBAAsB,EAAE,2DAA2D;IACnF,uBAAuB,EAAE,4DAA4D;IACrF,wBAAwB,EAAE,6DAA6D;IACvF,oBAAoB,EAAE,yDAAyD;IAC/E,0BAA0B,EAAE,+DAA+D;IAC3F,qBAAqB,EAAE,0DAA0D;IACjF,uBAAuB,EAAE,4DAA4D;IACrF,wBAAwB,EAAE,6DAA6D;IACvF,sBAAsB,EAAE,2DAA2D;IACnF,iBAAiB,EAAE,sDAAsD;CACjE,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE. DO NOT EDIT.\n * Update sources in lib/v3/dom/locatorScripts and run genLocatorScripts.ts.\n */\nexport const locatorScriptBootstrap = \"if (!globalThis.__stagehandLocatorScripts) { var __stagehandLocatorScriptsFactory=(()=>{var M=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},j=(e,t,n,o)=>{if(t&&typeof t==\\\"object\\\"||typeof t==\\\"function\\\")for(let r of U(t))!Q.call(e,r)&&r!==n&&M(e,r,{get:()=>t[r],enumerable:!(o=K(t,r))||o.enumerable});return e};var J=e=>j(M({},\\\"__esModule\\\",{value:!0}),e);var Oe={};Z(Oe,{assignFilePayloadsToInputElement:()=>te,countCssMatchesPierce:()=>Me,countCssMatchesPrimary:()=>Ce,countTextMatches:()=>Le,countXPathMatchesMainWorld:()=>Pe,dispatchDomClick:()=>ne,ensureFileInputElement:()=>ee,fillElementValue:()=>se,focusElement:()=>le,isElementChecked:()=>ce,isElementVisible:()=>ae,prepareElementForTyping:()=>v,readElementInnerHTML:()=>me,readElementInnerText:()=>fe,readElementInputValue:()=>ue,readElementTextContent:()=>de,resolveCssSelector:()=>ve,resolveCssSelectorPierce:()=>Te,resolveTextSelector:()=>Re,resolveXPathMainWorld:()=>Ne,scrollElementToPercent:()=>oe,selectElementOptions:()=>ie,waitForSelector:()=>_e});function ee(){try{return(this.tagName?.toLowerCase()??\\\"\\\")!==\\\"input\\\"?!1:String(this.type??\\\"\\\").toLowerCase()===\\\"file\\\"}catch{return!1}}function te(e){try{let t=this;if(!t||t.tagName?.toLowerCase()!==\\\"input\\\"||(t.type??\\\"\\\").toLowerCase()!==\\\"file\\\")return!1;let n=(()=>{try{return new DataTransfer}catch{return null}})();if(!n)return!1;let o=Array.isArray(e)?e:[];for(let r of o){if(!r)continue;let l=r.name||\\\"upload.bin\\\",s=r.mimeType||\\\"application/octet-stream\\\",i=typeof r.lastModified==\\\"number\\\"?r.lastModified:Date.now(),a=window.atob(r.base64??\\\"\\\"),d=new Uint8Array(a.length);for(let p=0;p<a.length;p+=1)d[p]=a.charCodeAt(p);let f=new Blob([d],{type:s}),c=new File([f],l,{type:s,lastModified:i});n.items.add(c)}return t.files=n.files,t.dispatchEvent(new Event(\\\"input\\\",{bubbles:!0})),t.dispatchEvent(new Event(\\\"change\\\",{bubbles:!0})),!0}catch{return!1}}function ne(e){let t=e??{};try{let n=new MouseEvent(\\\"click\\\",{bubbles:!!t.bubbles,cancelable:!!t.cancelable,composed:!!t.composed,detail:typeof t.detail==\\\"number\\\"?t.detail:1,view:this?.ownerDocument?.defaultView??window});this.dispatchEvent(n)}catch{try{this.click()}catch{}}}function oe(e){let t=n=>{if(typeof n==\\\"number\\\"&&Number.isFinite(n))return n;let o=String(n??\\\"\\\").trim();if(!o)return 0;let r=parseFloat(o.replace(\\\"%\\\",\\\"\\\"));return Number.isNaN(r)||!Number.isFinite(r)?0:r};try{let n=Math.max(0,Math.min(t(e),100)),o=this,r=o.tagName?.toLowerCase()??\\\"\\\";if(r===\\\"html\\\"||r===\\\"body\\\"){let c=(o.ownerDocument?.scrollingElement||o.ownerDocument?.documentElement||o.ownerDocument?.body||document.scrollingElement||document.documentElement||document.body)?.scrollHeight??document.body.scrollHeight??0,p=o.ownerDocument?.defaultView?.innerHeight??window.innerHeight,w=Math.max(0,c-p)*(n/100);return o.ownerDocument?.defaultView?.scrollTo({top:w,left:o.ownerDocument?.defaultView?.scrollX??window.scrollX??0,behavior:\\\"smooth\\\"}),!0}let s=o.scrollHeight??0,i=o.clientHeight??0,d=Math.max(0,s-i)*(n/100);return o.scrollTo({top:d,left:o.scrollLeft??0,behavior:\\\"smooth\\\"}),!0}catch{return!1}}var H=new Set([\\\"color\\\",\\\"date\\\",\\\"datetime-local\\\",\\\"month\\\",\\\"range\\\",\\\"time\\\",\\\"week\\\"]),re=new Set([\\\"\\\",\\\"email\\\",\\\"number\\\",\\\"password\\\",\\\"search\\\",\\\"tel\\\",\\\"text\\\",\\\"url\\\"]);function v(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument||document,n=t.defaultView||window;try{typeof e.focus==\\\"function\\\"&&e.focus()}catch{}if(e instanceof n.HTMLInputElement||e instanceof n.HTMLTextAreaElement){try{if(typeof e.select==\\\"function\\\")return e.select(),!0}catch{}try{let o=(e.value??\\\"\\\").length;if(typeof e.setSelectionRange==\\\"function\\\")return e.setSelectionRange(0,o),!0}catch{}return!0}if(e.isContentEditable){let o=t.getSelection?.(),r=t.createRange?.();if(o&&r)try{r.selectNodeContents(e),o.removeAllRanges(),o.addRange(r)}catch{}return!0}return!1}catch{return!1}}function se(e){let t=this;if(!t.isConnected)return{status:\\\"error\\\",reason:\\\"notconnected\\\"};let o=(t.ownerDocument||document).defaultView||window,r=e??\\\"\\\";try{let l=s=>{let i;if(typeof o.InputEvent==\\\"function\\\")try{i=new o.InputEvent(\\\"input\\\",{bubbles:!0,composed:!0,data:s,inputType:\\\"insertText\\\"})}catch{i=new o.Event(\\\"input\\\",{bubbles:!0,composed:!0})}else i=new o.Event(\\\"input\\\",{bubbles:!0,composed:!0});t.dispatchEvent(i);let a=new o.Event(\\\"change\\\",{bubbles:!0});t.dispatchEvent(a)};if(t instanceof o.HTMLInputElement){let s=(t.type||\\\"\\\").toLowerCase();if(!re.has(s)&&!H.has(s))return{status:\\\"error\\\",reason:`unsupported-input-type:${s}`};let i=e;if(s===\\\"number\\\"){let a=e.trim();if(a!==\\\"\\\"&&Number.isNaN(Number(a)))return{status:\\\"error\\\",reason:\\\"invalid-number-value\\\"};i=a}if(r=i,H.has(s)){let a=e.trim();r=a,v.call(t);let d=o.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(d,\\\"value\\\")?.set;return typeof c==\\\"function\\\"?c.call(t,a):t.value=a,t._valueTracker?.setValue?.(a),t.value!==a?{status:\\\"error\\\",reason:\\\"malformed-value\\\"}:(l(a),{status:\\\"done\\\"})}return v.call(t),{status:\\\"needsinput\\\",value:i}}return t instanceof o.HTMLTextAreaElement?(v.call(t),r=e,{status:\\\"needsinput\\\",value:e}):t instanceof o.HTMLSelectElement?{status:\\\"error\\\",reason:\\\"unsupported-element\\\"}:t.isContentEditable?(v.call(t),r=e,{status:\\\"needsinput\\\",value:e}):{status:\\\"error\\\",reason:\\\"unsupported-element\\\"}}catch(l){let s=\\\"exception\\\";if(l&&typeof l==\\\"object\\\"){let i=l.message;typeof i==\\\"string\\\"&&i.trim().length>0&&(s=`exception:${i}`)}return{status:\\\"needsinput\\\",value:r,reason:s}}}function le(){try{typeof this.focus==\\\"function\\\"&&this.focus()}catch{}}function ie(e){try{if(!(this instanceof HTMLSelectElement))return[];let t=Array.isArray(e)?e:[e],n=new Set(t.map(s=>String(s??\\\"\\\").trim())),o=s=>{let i=(s.label||s.textContent||\\\"\\\").trim(),a=String(s.value??\\\"\\\").trim();return n.has(i)||n.has(a)};if(this.multiple)for(let s of Array.from(this.options))s.selected=o(s);else{let s=!1;for(let i of Array.from(this.options))!s&&o(i)?(i.selected=!0,this.value=i.value,s=!0):i.selected=!1}let r=new Event(\\\"input\\\",{bubbles:!0}),l=new Event(\\\"change\\\",{bubbles:!0});return this.dispatchEvent(r),this.dispatchEvent(l),Array.from(this.selectedOptions).map(s=>s.value)}catch{return[]}}function ae(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument?.defaultView?.getComputedStyle(e)??window.getComputedStyle(e);if(!t||t.display===\\\"none\\\"||t.visibility===\\\"hidden\\\")return!1;let n=parseFloat(t.opacity??\\\"1\\\");if(!Number.isFinite(n)||n===0)return!1;let o=e.getBoundingClientRect();return!(!o||Math.max(o.width,o.height)===0||e.getClientRects().length===0)}catch{return!1}}function ce(){try{let e=this;if((e.tagName||\\\"\\\").toLowerCase()===\\\"input\\\"){let o=e.type?.toLowerCase()??\\\"\\\";if(o===\\\"checkbox\\\"||o===\\\"radio\\\")return!!e.checked}let n=e.getAttribute?.(\\\"aria-checked\\\");return n!=null?n===\\\"true\\\":!1}catch{return!1}}function ue(){try{let e=this,t=(e.tagName||\\\"\\\").toLowerCase();return t===\\\"input\\\"||t===\\\"textarea\\\"||t===\\\"select\\\"?String(e.value??\\\"\\\"):e.isContentEditable?String(e.textContent??\\\"\\\"):\\\"\\\"}catch{return\\\"\\\"}}function de(){try{return String(this.textContent??\\\"\\\")}catch{return\\\"\\\"}}function me(){try{return String(this.innerHTML??\\\"\\\")}catch{return\\\"\\\"}}function fe(){try{let e=this,t=e.innerText;if(typeof t==\\\"string\\\"&&t.length>0)return t;let n=e.textContent;return typeof n==\\\"string\\\"?n:\\\"\\\"}catch{return\\\"\\\"}}function O(e){let t=String(e||\\\"\\\").trim().replace(/^xpath=/i,\\\"\\\");if(!t)return[];let n=[],o=0;for(;o<t.length;){let r=\\\"child\\\";t.startsWith(\\\"//\\\",o)?(r=\\\"desc\\\",o+=2):t[o]===\\\"/\\\"&&(r=\\\"child\\\",o+=1);let l=o,s=0,i=null;for(;o<t.length;){let c=t[o];if(i)c===i&&(i=null);else if(c===\\\"'\\\"||c==='\\\"')i=c;else if(c===\\\"[\\\")s++;else if(c===\\\"]\\\")s--;else if(c===\\\"/\\\"&&s===0)break;o+=1}let a=t.slice(l,o).trim();if(!a)continue;let{tag:d,predicates:f}=pe(a);n.push({axis:r,tag:d,predicates:f})}return n}function he(e){let t=[],n=0;for(;n<e.length;){if(e[n]!==\\\"[\\\"){n++;continue}n++;let o=n,r=null;for(;n<e.length;){let l=e[n];if(r)l===r&&(r=null);else if(l===\\\"'\\\"||l==='\\\"')r=l;else if(l===\\\"]\\\")break;n++}t.push(e.slice(o,n).trim()),n++}return t}function pe(e){let t=e.indexOf(\\\"[\\\");if(t===-1)return{tag:e===\\\"\\\"?\\\"*\\\":e.toLowerCase(),predicates:[]};let n=e.slice(0,t).trim(),o=n===\\\"\\\"?\\\"*\\\":n.toLowerCase(),r=e.slice(t),l=[];for(let s of he(r)){let i=T(s);i&&l.push(i)}return{tag:o,predicates:l}}function T(e){let t=e.trim();if(!t)return null;let n=A(t,\\\"or\\\");if(n.length>1){let l=n.map(s=>T(s)).filter(Boolean);return l.length!==n.length?null:{type:\\\"or\\\",predicates:l}}let o=A(t,\\\"and\\\");if(o.length>1){let l=o.map(s=>T(s)).filter(Boolean);return l.length!==o.length?null:{type:\\\"and\\\",predicates:l}}let r=we(t,\\\"not\\\");if(r!=null){let l=T(r);return l?{type:\\\"not\\\",predicate:l}:null}return ge(t)}function ge(e){let t=/^(?:'([^']*)'|\\\"([^\\\"]*)\\\")$/,n=\\\"[a-zA-Z_][\\\\\\\\w.-]*\\\",o=`(?:'([^']*)'|\\\"([^\\\"]*)\\\")`;if(/^\\\\d+$/.test(e))return{type:\\\"index\\\",index:Math.max(1,Number(e))};let r=e.match(new RegExp(`^normalize-space\\\\\\\\(\\\\\\\\s*@(${n})\\\\\\\\s*\\\\\\\\)\\\\\\\\s*=\\\\\\\\s*${o}$`));if(r)return{type:\\\"attrEquals\\\",name:r[1],value:r[2]??r[3]??\\\"\\\",normalize:!0};let l=e.match(new RegExp(`^normalize-space\\\\\\\\(\\\\\\\\s*(?:text\\\\\\\\(\\\\\\\\)|\\\\\\\\.)\\\\\\\\s*\\\\\\\\)\\\\\\\\s*=\\\\\\\\s*${o}$`));if(l)return{type:\\\"textEquals\\\",value:l[1]??l[2]??\\\"\\\",normalize:!0};let s=e.match(new RegExp(`^@(${n})\\\\\\\\s*=\\\\\\\\s*${o}$`));if(s)return{type:\\\"attrEquals\\\",name:s[1],value:s[2]??s[3]??\\\"\\\"};let i=e.match(new RegExp(`^@(${n})$`));if(i)return{type:\\\"attrExists\\\",name:i[1]};let a=e.match(new RegExp(`^contains\\\\\\\\(\\\\\\\\s*@(${n})\\\\\\\\s*,\\\\\\\\s*${o}\\\\\\\\s*\\\\\\\\)$`));if(a)return{type:\\\"attrContains\\\",name:a[1],value:a[2]??a[3]??\\\"\\\"};let d=e.match(new RegExp(`^starts-with\\\\\\\\(\\\\\\\\s*@(${n})\\\\\\\\s*,\\\\\\\\s*${o}\\\\\\\\s*\\\\\\\\)$`));if(d)return{type:\\\"attrStartsWith\\\",name:d[1],value:d[2]??d[3]??\\\"\\\"};let f=e.match(new RegExp(`^(?:text\\\\\\\\(\\\\\\\\)|\\\\\\\\.)\\\\\\\\s*=\\\\\\\\s*${o}$`));if(f)return{type:\\\"textEquals\\\",value:f[1]??f[2]??\\\"\\\"};let c=e.match(new RegExp(`^contains\\\\\\\\(\\\\\\\\s*(?:text\\\\\\\\(\\\\\\\\)|\\\\\\\\.)\\\\\\\\s*,\\\\\\\\s*${o}\\\\\\\\s*\\\\\\\\)$`));return c?{type:\\\"textContains\\\",value:c[1]??c[2]??\\\"\\\"}:(t.test(e),null)}function A(e,t){let n=[],o=0,r=0,l=null,s=0;for(;s<e.length;){let i=e[s];if(l){i===l&&(l=null),s+=1;continue}if(i===\\\"'\\\"||i==='\\\"'){l=i,s+=1;continue}if(i===\\\"(\\\"){r+=1,s+=1;continue}if(i===\\\")\\\"){r=Math.max(0,r-1),s+=1;continue}if(r===0&&Ee(e,s,t)){n.push(e.slice(o,s).trim()),s+=t.length,o=s;continue}s+=1}return n.push(e.slice(o).trim()),n.filter(i=>i.length>0)}function Ee(e,t,n){if(!e.startsWith(n,t))return!1;let o=t>0?e[t-1]:\\\" \\\";if(o===\\\"@\\\")return!1;let r=t+n.length<e.length?e[t+n.length]:\\\" \\\";return W(o)&&W(r)}function W(e){return!/[a-zA-Z0-9_.-]/.test(e)}function we(e,t){let n=`${t}(`;if(!e.startsWith(n)||!e.endsWith(\\\")\\\"))return null;let o=e.slice(n.length,-1);return ye(o)?o:null}function ye(e){let t=0,n=null;for(let o=0;o<e.length;o+=1){let r=e[o];if(n){r===n&&(n=null);continue}if(r===\\\"'\\\"||r==='\\\"'){n=r;continue}if(r===\\\"(\\\"?t+=1:r===\\\")\\\"&&(t-=1),t<0)return!1}return t===0}var be=e=>e.replace(/\\\\s+/g,\\\" \\\").trim();function _(e){return String(e.textContent??\\\"\\\")}function S(e,t){return t?be(e):e}function R(e,t){switch(t.type){case\\\"and\\\":return t.predicates.every(n=>R(e,n));case\\\"or\\\":return t.predicates.some(n=>R(e,n));case\\\"not\\\":return!R(e,t.predicate);case\\\"attrExists\\\":return e.getAttribute(t.name)!==null;case\\\"attrEquals\\\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize)===S(t.value,t.normalize)}case\\\"attrContains\\\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize).includes(S(t.value,t.normalize))}case\\\"attrStartsWith\\\":{let n=e.getAttribute(t.name);return n===null?!1:S(n,t.normalize).startsWith(S(t.value,t.normalize))}case\\\"textEquals\\\":return S(_(e),t.normalize)===S(t.value,t.normalize);case\\\"textContains\\\":return S(_(e),t.normalize).includes(S(t.value,t.normalize));case\\\"index\\\":return!0;default:return!0}}function q(e,t){let n=e;for(let o of t){if(!n.length)return[];if(o.type===\\\"index\\\"){let r=o.index-1;n=r>=0&&r<n.length?[n[r]]:[];continue}n=n.filter(r=>R(r,o))}return n}var P=e=>{let t=String(e??\\\"\\\").trim();return t?t.replace(/^xpath=/i,\\\"\\\").trim():\\\"\\\"};function I(e,t){return k(e,0,t)}function k(e,t,n){if(!Number.isFinite(t)||t<0)return null;let o=P(e);if(!o)return null;let r=Math.floor(t),l=n?.pierceShadow!==!1,s=l?z():null;if(!l)return X(o,r).value;if(!s?.hasShadow){let a=X(o,r);return a.error?N(o,s?.getClosedRoot)[r]??null:a.value}return N(o,s.getClosedRoot)[r]??null}function $(e,t){let n=P(e);if(!n)return 0;let o=t?.pierceShadow!==!1,r=o?z():null;if(!o)return F(n).count;if(!r?.hasShadow){let l=F(n);return l.error?N(n,r?.getClosedRoot).length:l.count}return N(n,r.getClosedRoot).length}function N(e,t){let n=P(e);if(!n)return[];let o=O(n);if(!o.length)return[];let r=t??null,l=[document];for(let s of o){let i=[],a=new Set;for(let d of l){if(!d)continue;let f=s.axis===\\\"child\\\"?L(d,r):Se(d,r);if(!f.length)continue;let c=f.filter(g=>xe(g,s)),p=q(c,s.predicates);for(let g of p)a.has(g)||(a.add(g),i.push(g))}if(!i.length)return[];l=i}return l}function xe(e,t){return t.tag===\\\"*\\\"?!0:e.localName===t.tag}function z(){let e=window.__stagehandV3__,t=e&&typeof e.getClosedRoot==\\\"function\\\"?o=>{try{return e.getClosedRoot(o)??null}catch{return null}}:null,n=!1;try{if(e&&typeof e.stats==\\\"function\\\"){let o=e.stats();n=(o?.open??0)>0||(o?.closed??0)>0}}catch{}if(!n)try{let o=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();)if(o.currentNode.shadowRoot){n=!0;break}}catch{}return{getClosedRoot:t,hasShadow:n}}function L(e,t){let n=[];if(!e)return n;if(e instanceof Document)return e.documentElement&&n.push(e.documentElement),n;if(e instanceof ShadowRoot||e instanceof DocumentFragment)return n.push(...Array.from(e.children??[])),n;if(e instanceof Element){n.push(...Array.from(e.children??[]));let o=e.shadowRoot;if(o&&n.push(...Array.from(o.children??[])),t){let r=t(e);r&&n.push(...Array.from(r.children??[]))}return n}return n}function Se(e,t){let n=[],o=new Set,r=[...L(e,t)].reverse();for(;r.length;){let l=r.pop();if(!l||o.has(l))continue;o.add(l),n.push(l);let s=L(l,t);for(let i=s.length-1;i>=0;i-=1)r.push(s[i])}return n}function X(e,t){try{return{value:document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(t),error:!1}}catch{return{value:null,error:!0}}}function F(e){try{return{count:document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength,error:!1}}catch{return{count:0,error:!0}}}var C=e=>{let t=Number(e??0);return!Number.isFinite(t)||t<0?0:Math.floor(t)},V=(e,t)=>{if(!e)return[];let n=new WeakSet,o=new Set,r=[],l=[document],s=i=>{if(!(!i||n.has(i)||r.length>=t)){n.add(i);try{let a=i.querySelectorAll(e);for(let d of a)if(!o.has(d)&&(o.add(d),r.push(d),r.length>=t))return}catch{}try{let d=(i instanceof Document?i:i.host?.ownerDocument??document).createTreeWalker(i,NodeFilter.SHOW_ELEMENT),f;for(;f=d.nextNode();){if(!(f instanceof Element))continue;let c=f.shadowRoot;c&&l.push(c)}}catch{}}};for(;l.length&&r.length<t;){let i=l.shift();i&&s(i)}return r};function ve(e,t){let n=String(e??\\\"\\\").trim();if(!n)return null;let o=C(t);return V(n,o+1)[o]??null}function Te(e,t){let n=String(e??\\\"\\\").trim();if(!n)return null;let o=C(t),r=window.__stagehandV3__;if(!r||typeof r.getClosedRoot!=\\\"function\\\")return V(n,o+1)[o]??null;let l=c=>{try{return r.getClosedRoot(c)??null}catch{return null}},s=new WeakSet,i=new Set,a=[],d=[document],f=c=>{if(!(!c||s.has(c)||a.length>=o+1)){s.add(c);try{let p=c.querySelectorAll(n);for(let g of p)if(!i.has(g)&&(i.add(g),a.push(g),a.length>=o+1))return}catch{}try{let g=(c instanceof Document?c:c.host?.ownerDocument??document).createTreeWalker(c,NodeFilter.SHOW_ELEMENT),w;for(;w=g.nextNode();){if(!(w instanceof Element))continue;let x=w.shadowRoot;x&&d.push(x);let y=l(w);y&&d.push(y)}}catch{}}};for(;d.length&&a.length<o+1;){let c=d.shift();c&&f(c)}return a[o]??null}function Re(e,t){let n=String(e??\\\"\\\");if(!n)return null;let o=n.toLowerCase(),r=C(t),l=new Set([\\\"SCRIPT\\\",\\\"STYLE\\\",\\\"TEMPLATE\\\",\\\"NOSCRIPT\\\",\\\"HEAD\\\",\\\"TITLE\\\",\\\"LINK\\\",\\\"META\\\",\\\"HTML\\\",\\\"BODY\\\"]),s=u=>{if(!u)return!1;let h=u.tagName?.toUpperCase()??\\\"\\\";return l.has(h)},i=u=>{try{if(s(u))return\\\"\\\";let h=u.innerText;if(typeof h==\\\"string\\\"&&h.trim())return h.trim()}catch{}try{let h=u.textContent;if(typeof h==\\\"string\\\")return h.trim()}catch{}return\\\"\\\"},a=u=>{let h=i(u);return!!h&&h.toLowerCase().includes(o)},d=window.__stagehandV3__,f=d&&typeof d.getClosedRoot==\\\"function\\\"?u=>{try{return d.getClosedRoot(u)??null}catch{return null}}:u=>null,c=new WeakSet,p=[],g=[],w=u=>{!u||c.has(u)||(c.add(u),p.push(u))},x=u=>{try{return(u instanceof Document?u:u?.ownerDocument??document).createTreeWalker(u,NodeFilter.SHOW_ELEMENT)}catch{return null}};for(w(document);p.length;){let u=p.shift();if(!u)continue;u instanceof Element&&a(u)&&g.push({element:u,tag:u.tagName??\\\"\\\",id:u.id??\\\"\\\",className:u.className??\\\"\\\",text:i(u)});let h=x(u);if(!h)continue;let E;for(;E=h.nextNode();){if(!(E instanceof Element))continue;a(E)&&g.push({element:E,tag:E.tagName??\\\"\\\",id:E.id??\\\"\\\",className:E.className??\\\"\\\",text:i(E)});let b=E.shadowRoot;b&&w(b);let D=f(E);D&&w(D)}}let y=[];for(let u of g){let h=u.element,E=!1;for(let b of g)if(u!==b)try{if(h.contains(b.element)){E=!0;break}}catch{}E||y.push(u)}return y[r]?.element??null}function Ne(e,t){let n=C(t);return k(e,n,{pierceShadow:!0})}function Ce(e){let t=String(e??\\\"\\\").trim();if(!t)return 0;let n=new WeakSet,o=r=>{if(!r||n.has(r))return 0;n.add(r);let l=0;try{let s=r;typeof s.querySelectorAll==\\\"function\\\"&&(l+=s.querySelectorAll(t).length)}catch{}try{let i=(r instanceof Document?r:r?.ownerDocument??document).createTreeWalker(r,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();)a instanceof Element&&a.shadowRoot&&(l+=o(a.shadowRoot))}catch{}return l};try{return o(document)}catch{try{return document.querySelectorAll(t).length}catch{return 0}}}function Me(e){let t=String(e??\\\"\\\").trim();if(!t)return 0;let n=window.__stagehandV3__;if(!n||typeof n.getClosedRoot!=\\\"function\\\")try{return document.querySelectorAll(t).length}catch{return 0}let o=new WeakSet,r=[],l=a=>{!a||o.has(a)||(o.add(a),r.push(a))};l(document);let s=0,i=a=>{let d=a.shadowRoot;d&&l(d);try{let f=n.getClosedRoot(a);f&&l(f)}catch{}};for(;r.length;){let a=r.shift();if(a){try{let d=a;typeof d.querySelectorAll==\\\"function\\\"&&(s+=d.querySelectorAll(t).length)}catch{}try{let f=(a instanceof Document?a:a instanceof ShadowRoot?a.host?.ownerDocument??document:a.ownerDocument??document).createTreeWalker(a,NodeFilter.SHOW_ELEMENT),c;for(;c=f.nextNode();)c instanceof Element&&i(c)}catch{}}}return s}function Le(e){let t=String(e??\\\"\\\");if(!t)return{count:0,sample:[],error:null};let n=t.toLowerCase(),o=new Set([\\\"SCRIPT\\\",\\\"STYLE\\\",\\\"TEMPLATE\\\",\\\"NOSCRIPT\\\",\\\"HEAD\\\",\\\"TITLE\\\",\\\"LINK\\\",\\\"META\\\",\\\"HTML\\\",\\\"BODY\\\"]),r=m=>{if(!m)return!1;let u=m.tagName?.toUpperCase()??\\\"\\\";return o.has(u)},l=m=>{try{if(r(m))return\\\"\\\";let u=m.innerText;if(typeof u==\\\"string\\\"&&u.trim())return u.trim()}catch{}try{let u=m.textContent;if(typeof u==\\\"string\\\")return u.trim()}catch{}return\\\"\\\"},s=m=>{let u=l(m);return!!u&&u.toLowerCase().includes(n)},i=window.__stagehandV3__,a=i&&typeof i.getClosedRoot==\\\"function\\\"?m=>{try{return i.getClosedRoot(m)??null}catch{return null}}:m=>null,d=new WeakSet,f=[],c=m=>{!m||d.has(m)||(d.add(m),f.push(m))},p=m=>{try{return(m instanceof Document?m:m?.ownerDocument??document).createTreeWalker(m,NodeFilter.SHOW_ELEMENT)}catch{return null}},g=[];for(c(document);f.length;){let m=f.shift();if(!m)continue;m instanceof Element&&s(m)&&g.push({element:m,tag:m.tagName??\\\"\\\",id:m.id??\\\"\\\",className:m.className??\\\"\\\",text:l(m)});let u=p(m);if(!u)continue;let h;for(;h=u.nextNode();){if(!(h instanceof Element))continue;s(h)&&g.push({element:h,tag:h.tagName??\\\"\\\",id:h.id??\\\"\\\",className:h.className??\\\"\\\",text:l(h)});let E=h.shadowRoot;E&&c(E);let b=a(h);b&&c(b)}}let w=[];for(let m of g){let u=m.element,h=!1;for(let E of g)if(m!==E)try{if(u.contains(E.element)){h=!0;break}}catch{}h||w.push(m)}let x=w.length,y=w.slice(0,5).map(m=>({tag:m.tag,id:m.id,class:m.className,text:m.text}));return{count:x,sample:y,error:null}}function Pe(e){return $(e,{pierceShadow:!0})}var ke=e=>e.startsWith(\\\"xpath=\\\")||e.startsWith(\\\"/\\\"),De=e=>{try{let t=window.__stagehandV3__;if(t&&typeof t.getClosedRoot==\\\"function\\\")return t.getClosedRoot(e)??null}catch{}return null},Y=e=>e.shadowRoot?e.shadowRoot:De(e),He=(e,t,n)=>{try{let l=e.querySelector(t);if(l)return l}catch{}if(!n)return null;let o=new WeakSet,r=[e];for(;r.length>0;){let l=r.shift();if(!(!l||o.has(l))){o.add(l);try{let s=l.querySelector(t);if(s)return s}catch{}try{let i=(l instanceof Document?l:l.host?.ownerDocument??document).createTreeWalker(l,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();){if(!(a instanceof Element))continue;let d=Y(a);d&&!o.has(d)&&r.push(d)}}catch{}}}return null},Ae=(e,t)=>I(e,{pierceShadow:t}),B=(e,t)=>ke(e)?Ae(e,t):He(document,e,t),G=(e,t)=>{if(t===\\\"detached\\\")return e===null;if(t===\\\"attached\\\")return e!==null;if(e===null)return!1;if(t===\\\"hidden\\\")try{let n=window.getComputedStyle(e),o=e.getBoundingClientRect();return n.display===\\\"none\\\"||n.visibility===\\\"hidden\\\"||n.opacity===\\\"0\\\"||o.width===0||o.height===0}catch{return!1}try{let n=window.getComputedStyle(e),o=e.getBoundingClientRect();return n.display!==\\\"none\\\"&&n.visibility!==\\\"hidden\\\"&&n.opacity!==\\\"0\\\"&&o.width>0&&o.height>0}catch{return!1}},We=(e,t)=>{let n=new WeakSet,o=l=>{let s=Y(l);if(s&&!n.has(s)){n.add(s);let i=new MutationObserver(e);i.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\\\"style\\\",\\\"class\\\",\\\"hidden\\\",\\\"disabled\\\"]}),t.push(i);for(let a of Array.from(s.children))o(a)}for(let i of Array.from(l.children))o(i)},r=document.documentElement||document.body;r&&o(r)};function _e(e,t,n,o){let r=String(e??\\\"\\\").trim(),l=String(t??\\\"visible\\\")||\\\"visible\\\",s=typeof n==\\\"number\\\"&&n>0?n:3e4,i=o!==!1;return new Promise((a,d)=>{let f=null,c=null,p=!1,g=()=>{f!==null&&(clearTimeout(f),f=null)},w=B(r,i);if(G(w,l)){p=!0,a(!0);return}let x=[],y=()=>{for(let E of x)E.disconnect();c&&(document.removeEventListener(\\\"DOMContentLoaded\\\",c),c=null)},m=()=>{if(p)return;let E=B(r,i);G(E,l)&&(p=!0,g(),y(),a(!0))};if(!(document.body||document.documentElement)){c=()=>{document.removeEventListener(\\\"DOMContentLoaded\\\",c),c=null,m(),h()},document.addEventListener(\\\"DOMContentLoaded\\\",c),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \\\"${r}\\\" to be ${l}`)))},s);return}let h=()=>{let E=document.body||document.documentElement;if(!E)return;let b=new MutationObserver(m);b.observe(E,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\\\"style\\\",\\\"class\\\",\\\"hidden\\\",\\\"disabled\\\"]}),x.push(b),i&&We(m,x)};h(),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \\\"${r}\\\" to be ${l}`)))},s)})}return J(Oe);})();\\n globalThis.__stagehandLocatorScripts = __stagehandLocatorScriptsFactory;\\n}\";\nexport const locatorScriptSources = {\n \"assignFilePayloadsToInputElement\": \"function ce(e){try{let t=this;if(!t||t.tagName?.toLowerCase()!==\\\"input\\\"||(t.type??\\\"\\\").toLowerCase()!==\\\"file\\\")return!1;let n=(()=>{try{return new DataTransfer}catch{return null}})();if(!n)return!1;let o=Array.isArray(e)?e:[];for(let r of o){if(!r)continue;let l=r.name||\\\"upload.bin\\\",s=r.mimeType||\\\"application/octet-stream\\\",i=typeof r.lastModified==\\\"number\\\"?r.lastModified:Date.now(),a=window.atob(r.base64??\\\"\\\"),d=new Uint8Array(a.length);for(let p=0;p<a.length;p+=1)d[p]=a.charCodeAt(p);let f=new Blob([d],{type:s}),c=new File([f],l,{type:s,lastModified:i});n.items.add(c)}return t.files=n.files,t.dispatchEvent(new Event(\\\"input\\\",{bubbles:!0})),t.dispatchEvent(new Event(\\\"change\\\",{bubbles:!0})),!0}catch{return!1}}\",\n \"countCssMatchesPierce\": \"function He(e){let t=String(e??\\\"\\\").trim();if(!t)return 0;let n=window.__stagehandV3__;if(!n||typeof n.getClosedRoot!=\\\"function\\\")try{return document.querySelectorAll(t).length}catch{return 0}let o=new WeakSet,r=[],l=a=>{!a||o.has(a)||(o.add(a),r.push(a))};l(document);let s=0,i=a=>{let d=a.shadowRoot;d&&l(d);try{let f=n.getClosedRoot(a);f&&l(f)}catch{}};for(;r.length;){let a=r.shift();if(a){try{let d=a;typeof d.querySelectorAll==\\\"function\\\"&&(s+=d.querySelectorAll(t).length)}catch{}try{let f=(a instanceof Document?a:a instanceof ShadowRoot?a.host?.ownerDocument??document:a.ownerDocument??document).createTreeWalker(a,NodeFilter.SHOW_ELEMENT),c;for(;c=f.nextNode();)c instanceof Element&&i(c)}catch{}}}return s}\",\n \"countCssMatchesPrimary\": \"function De(e){let t=String(e??\\\"\\\").trim();if(!t)return 0;let n=new WeakSet,o=r=>{if(!r||n.has(r))return 0;n.add(r);let l=0;try{let s=r;typeof s.querySelectorAll==\\\"function\\\"&&(l+=s.querySelectorAll(t).length)}catch{}try{let i=(r instanceof Document?r:r?.ownerDocument??document).createTreeWalker(r,NodeFilter.SHOW_ELEMENT),a;for(;a=i.nextNode();)a instanceof Element&&a.shadowRoot&&(l+=o(a.shadowRoot))}catch{}return l};try{return o(document)}catch{try{return document.querySelectorAll(t).length}catch{return 0}}}\",\n \"countTextMatches\": \"function Ae(e){let t=String(e??\\\"\\\");if(!t)return{count:0,sample:[],error:null};let n=t.toLowerCase(),o=new Set([\\\"SCRIPT\\\",\\\"STYLE\\\",\\\"TEMPLATE\\\",\\\"NOSCRIPT\\\",\\\"HEAD\\\",\\\"TITLE\\\",\\\"LINK\\\",\\\"META\\\",\\\"HTML\\\",\\\"BODY\\\"]),r=m=>{if(!m)return!1;let u=m.tagName?.toUpperCase()??\\\"\\\";return o.has(u)},l=m=>{try{if(r(m))return\\\"\\\";let u=m.innerText;if(typeof u==\\\"string\\\"&&u.trim())return u.trim()}catch{}try{let u=m.textContent;if(typeof u==\\\"string\\\")return u.trim()}catch{}return\\\"\\\"},s=m=>{let u=l(m);return!!u&&u.toLowerCase().includes(n)},i=window.__stagehandV3__,a=i&&typeof i.getClosedRoot==\\\"function\\\"?m=>{try{return i.getClosedRoot(m)??null}catch{return null}}:m=>null,d=new WeakSet,f=[],c=m=>{!m||d.has(m)||(d.add(m),f.push(m))},p=m=>{try{return(m instanceof Document?m:m?.ownerDocument??document).createTreeWalker(m,NodeFilter.SHOW_ELEMENT)}catch{return null}},g=[];for(c(document);f.length;){let m=f.shift();if(!m)continue;m instanceof Element&&s(m)&&g.push({element:m,tag:m.tagName??\\\"\\\",id:m.id??\\\"\\\",className:m.className??\\\"\\\",text:l(m)});let u=p(m);if(!u)continue;let h;for(;h=u.nextNode();){if(!(h instanceof Element))continue;s(h)&&g.push({element:h,tag:h.tagName??\\\"\\\",id:h.id??\\\"\\\",className:h.className??\\\"\\\",text:l(h)});let E=h.shadowRoot;E&&c(E);let b=a(h);b&&c(b)}}let w=[];for(let m of g){let u=m.element,h=!1;for(let E of g)if(m!==E)try{if(u.contains(E.element)){h=!0;break}}catch{}h||w.push(m)}let x=w.length,y=w.slice(0,5).map(m=>({tag:m.tag,id:m.id,class:m.className,text:m.text}));return{count:x,sample:y,error:null}}\",\n \"countXPathMatchesMainWorld\": \"function We(e){return I(e,{pierceShadow:!0})}\",\n \"dispatchDomClick\": \"function ue(e){let t=e??{};try{let n=new MouseEvent(\\\"click\\\",{bubbles:!!t.bubbles,cancelable:!!t.cancelable,composed:!!t.composed,detail:typeof t.detail==\\\"number\\\"?t.detail:1,view:this?.ownerDocument?.defaultView??window});this.dispatchEvent(n)}catch{try{this.click()}catch{}}}\",\n \"ensureFileInputElement\": \"function ae(){try{return(this.tagName?.toLowerCase()??\\\"\\\")!==\\\"input\\\"?!1:String(this.type??\\\"\\\").toLowerCase()===\\\"file\\\"}catch{return!1}}\",\n \"fillElementValue\": \"function me(e){let t=this;if(!t.isConnected)return{status:\\\"error\\\",reason:\\\"notconnected\\\"};let o=(t.ownerDocument||document).defaultView||window,r=e??\\\"\\\";try{let l=s=>{let i;if(typeof o.InputEvent==\\\"function\\\")try{i=new o.InputEvent(\\\"input\\\",{bubbles:!0,composed:!0,data:s,inputType:\\\"insertText\\\"})}catch{i=new o.Event(\\\"input\\\",{bubbles:!0,composed:!0})}else i=new o.Event(\\\"input\\\",{bubbles:!0,composed:!0});t.dispatchEvent(i);let a=new o.Event(\\\"change\\\",{bubbles:!0});t.dispatchEvent(a)};if(t instanceof o.HTMLInputElement){let s=(t.type||\\\"\\\").toLowerCase();if(!Y.has(s)&&!D.has(s))return{status:\\\"error\\\",reason:`unsupported-input-type:${s}`};let i=e;if(s===\\\"number\\\"){let a=e.trim();if(a!==\\\"\\\"&&Number.isNaN(Number(a)))return{status:\\\"error\\\",reason:\\\"invalid-number-value\\\"};i=a}if(r=i,D.has(s)){let a=e.trim();r=a,v.call(t);let d=o.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(d,\\\"value\\\")?.set;return typeof c==\\\"function\\\"?c.call(t,a):t.value=a,t._valueTracker?.setValue?.(a),t.value!==a?{status:\\\"error\\\",reason:\\\"malformed-value\\\"}:(l(a),{status:\\\"done\\\"})}return v.call(t),{status:\\\"needsinput\\\",value:i}}return t instanceof o.HTMLTextAreaElement?(v.call(t),r=e,{status:\\\"needsinput\\\",value:e}):t instanceof o.HTMLSelectElement?{status:\\\"error\\\",reason:\\\"unsupported-element\\\"}:t.isContentEditable?(v.call(t),r=e,{status:\\\"needsinput\\\",value:e}):{status:\\\"error\\\",reason:\\\"unsupported-element\\\"}}catch(l){let s=\\\"exception\\\";if(l&&typeof l==\\\"object\\\"){let i=l.message;typeof i==\\\"string\\\"&&i.trim().length>0&&(s=`exception:${i}`)}return{status:\\\"needsinput\\\",value:r,reason:s}}}\",\n \"focusElement\": \"function fe(){try{typeof this.focus==\\\"function\\\"&&this.focus()}catch{}}\",\n \"isElementChecked\": \"function ge(){try{let e=this;if((e.tagName||\\\"\\\").toLowerCase()===\\\"input\\\"){let o=e.type?.toLowerCase()??\\\"\\\";if(o===\\\"checkbox\\\"||o===\\\"radio\\\")return!!e.checked}let n=e.getAttribute?.(\\\"aria-checked\\\");return n!=null?n===\\\"true\\\":!1}catch{return!1}}\",\n \"isElementVisible\": \"function pe(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument?.defaultView?.getComputedStyle(e)??window.getComputedStyle(e);if(!t||t.display===\\\"none\\\"||t.visibility===\\\"hidden\\\")return!1;let n=parseFloat(t.opacity??\\\"1\\\");if(!Number.isFinite(n)||n===0)return!1;let o=e.getBoundingClientRect();return!(!o||Math.max(o.width,o.height)===0||e.getClientRects().length===0)}catch{return!1}}\",\n \"prepareElementForTyping\": \"function v(){try{let e=this;if(!e.isConnected)return!1;let t=e.ownerDocument||document,n=t.defaultView||window;try{typeof e.focus==\\\"function\\\"&&e.focus()}catch{}if(e instanceof n.HTMLInputElement||e instanceof n.HTMLTextAreaElement){try{if(typeof e.select==\\\"function\\\")return e.select(),!0}catch{}try{let o=(e.value??\\\"\\\").length;if(typeof e.setSelectionRange==\\\"function\\\")return e.setSelectionRange(0,o),!0}catch{}return!0}if(e.isContentEditable){let o=t.getSelection?.(),r=t.createRange?.();if(o&&r)try{r.selectNodeContents(e),o.removeAllRanges(),o.addRange(r)}catch{}return!0}return!1}catch{return!1}}\",\n \"readElementInnerHTML\": \"function ye(){try{return String(this.innerHTML??\\\"\\\")}catch{return\\\"\\\"}}\",\n \"readElementInnerText\": \"function be(){try{let e=this,t=e.innerText;if(typeof t==\\\"string\\\"&&t.length>0)return t;let n=e.textContent;return typeof n==\\\"string\\\"?n:\\\"\\\"}catch{return\\\"\\\"}}\",\n \"readElementInputValue\": \"function Ee(){try{let e=this,t=(e.tagName||\\\"\\\").toLowerCase();return t===\\\"input\\\"||t===\\\"textarea\\\"||t===\\\"select\\\"?String(e.value??\\\"\\\"):e.isContentEditable?String(e.textContent??\\\"\\\"):\\\"\\\"}catch{return\\\"\\\"}}\",\n \"readElementTextContent\": \"function we(){try{return String(this.textContent??\\\"\\\")}catch{return\\\"\\\"}}\",\n \"resolveCssSelector\": \"function Ne(e,t){let n=String(e??\\\"\\\").trim();if(!n)return null;let o=C(t);return z(n,o+1)[o]??null}\",\n \"resolveCssSelectorPierce\": \"function Ce(e,t){let n=String(e??\\\"\\\").trim();if(!n)return null;let o=C(t),r=window.__stagehandV3__;if(!r||typeof r.getClosedRoot!=\\\"function\\\")return z(n,o+1)[o]??null;let l=c=>{try{return r.getClosedRoot(c)??null}catch{return null}},s=new WeakSet,i=new Set,a=[],d=[document],f=c=>{if(!(!c||s.has(c)||a.length>=o+1)){s.add(c);try{let p=c.querySelectorAll(n);for(let g of p)if(!i.has(g)&&(i.add(g),a.push(g),a.length>=o+1))return}catch{}try{let g=(c instanceof Document?c:c.host?.ownerDocument??document).createTreeWalker(c,NodeFilter.SHOW_ELEMENT),w;for(;w=g.nextNode();){if(!(w instanceof Element))continue;let x=w.shadowRoot;x&&d.push(x);let y=l(w);y&&d.push(y)}}catch{}}};for(;d.length&&a.length<o+1;){let c=d.shift();c&&f(c)}return a[o]??null}\",\n \"resolveTextSelector\": \"function Me(e,t){let n=String(e??\\\"\\\");if(!n)return null;let o=n.toLowerCase(),r=C(t),l=new Set([\\\"SCRIPT\\\",\\\"STYLE\\\",\\\"TEMPLATE\\\",\\\"NOSCRIPT\\\",\\\"HEAD\\\",\\\"TITLE\\\",\\\"LINK\\\",\\\"META\\\",\\\"HTML\\\",\\\"BODY\\\"]),s=u=>{if(!u)return!1;let h=u.tagName?.toUpperCase()??\\\"\\\";return l.has(h)},i=u=>{try{if(s(u))return\\\"\\\";let h=u.innerText;if(typeof h==\\\"string\\\"&&h.trim())return h.trim()}catch{}try{let h=u.textContent;if(typeof h==\\\"string\\\")return h.trim()}catch{}return\\\"\\\"},a=u=>{let h=i(u);return!!h&&h.toLowerCase().includes(o)},d=window.__stagehandV3__,f=d&&typeof d.getClosedRoot==\\\"function\\\"?u=>{try{return d.getClosedRoot(u)??null}catch{return null}}:u=>null,c=new WeakSet,p=[],g=[],w=u=>{!u||c.has(u)||(c.add(u),p.push(u))},x=u=>{try{return(u instanceof Document?u:u?.ownerDocument??document).createTreeWalker(u,NodeFilter.SHOW_ELEMENT)}catch{return null}};for(w(document);p.length;){let u=p.shift();if(!u)continue;u instanceof Element&&a(u)&&g.push({element:u,tag:u.tagName??\\\"\\\",id:u.id??\\\"\\\",className:u.className??\\\"\\\",text:i(u)});let h=x(u);if(!h)continue;let E;for(;E=h.nextNode();){if(!(E instanceof Element))continue;a(E)&&g.push({element:E,tag:E.tagName??\\\"\\\",id:E.id??\\\"\\\",className:E.className??\\\"\\\",text:i(E)});let b=E.shadowRoot;b&&w(b);let k=f(E);k&&w(k)}}let y=[];for(let u of g){let h=u.element,E=!1;for(let b of g)if(u!==b)try{if(h.contains(b.element)){E=!0;break}}catch{}E||y.push(u)}return y[r]?.element??null}\",\n \"resolveXPathMainWorld\": \"function Le(e,t){let n=C(t);return P(e,n,{pierceShadow:!0})}\",\n \"scrollElementToPercent\": \"function de(e){let t=n=>{if(typeof n==\\\"number\\\"&&Number.isFinite(n))return n;let o=String(n??\\\"\\\").trim();if(!o)return 0;let r=parseFloat(o.replace(\\\"%\\\",\\\"\\\"));return Number.isNaN(r)||!Number.isFinite(r)?0:r};try{let n=Math.max(0,Math.min(t(e),100)),o=this,r=o.tagName?.toLowerCase()??\\\"\\\";if(r===\\\"html\\\"||r===\\\"body\\\"){let c=(o.ownerDocument?.scrollingElement||o.ownerDocument?.documentElement||o.ownerDocument?.body||document.scrollingElement||document.documentElement||document.body)?.scrollHeight??document.body.scrollHeight??0,p=o.ownerDocument?.defaultView?.innerHeight??window.innerHeight,w=Math.max(0,c-p)*(n/100);return o.ownerDocument?.defaultView?.scrollTo({top:w,left:o.ownerDocument?.defaultView?.scrollX??window.scrollX??0,behavior:\\\"smooth\\\"}),!0}let s=o.scrollHeight??0,i=o.clientHeight??0,d=Math.max(0,s-i)*(n/100);return o.scrollTo({top:d,left:o.scrollLeft??0,behavior:\\\"smooth\\\"}),!0}catch{return!1}}\",\n \"selectElementOptions\": \"function he(e){try{if(!(this instanceof HTMLSelectElement))return[];let t=Array.isArray(e)?e:[e],n=new Set(t.map(s=>String(s??\\\"\\\").trim())),o=s=>{let i=(s.label||s.textContent||\\\"\\\").trim(),a=String(s.value??\\\"\\\").trim();return n.has(i)||n.has(a)};if(this.multiple)for(let s of Array.from(this.options))s.selected=o(s);else{let s=!1;for(let i of Array.from(this.options))!s&&o(i)?(i.selected=!0,this.value=i.value,s=!0):i.selected=!1}let r=new Event(\\\"input\\\",{bubbles:!0}),l=new Event(\\\"change\\\",{bubbles:!0});return this.dispatchEvent(r),this.dispatchEvent(l),Array.from(this.selectedOptions).map(s=>s.value)}catch{return[]}}\",\n \"waitForSelector\": \"function qe(e,t,n,o){let r=String(e??\\\"\\\").trim(),l=String(t??\\\"visible\\\")||\\\"visible\\\",s=typeof n==\\\"number\\\"&&n>0?n:3e4,i=o!==!1;return new Promise((a,d)=>{let f=null,c=null,p=!1,g=()=>{f!==null&&(clearTimeout(f),f=null)},w=V(r,i);if(B(w,l)){p=!0,a(!0);return}let x=[],y=()=>{for(let E of x)E.disconnect();c&&(document.removeEventListener(\\\"DOMContentLoaded\\\",c),c=null)},m=()=>{if(p)return;let E=V(r,i);B(E,l)&&(p=!0,g(),y(),a(!0))};if(!(document.body||document.documentElement)){c=()=>{document.removeEventListener(\\\"DOMContentLoaded\\\",c),c=null,m(),h()},document.addEventListener(\\\"DOMContentLoaded\\\",c),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \\\"${r}\\\" to be ${l}`)))},s);return}let h=()=>{let E=document.body||document.documentElement;if(!E)return;let b=new MutationObserver(m);b.observe(E,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\\\"style\\\",\\\"class\\\",\\\"hidden\\\",\\\"disabled\\\"]}),x.push(b),i&&ie(m,x)};h(),f=setTimeout(()=>{p||(p=!0,g(),y(),d(new Error(`waitForSelector: Timeout ${s}ms exceeded waiting for \\\"${r}\\\" to be ${l}`)))},s)})}\"\n} as const;\nexport const locatorScriptGlobalRefs = {\n \"assignFilePayloadsToInputElement\": \"globalThis.__stagehandLocatorScripts.assignFilePayloadsToInputElement\",\n \"countCssMatchesPierce\": \"globalThis.__stagehandLocatorScripts.countCssMatchesPierce\",\n \"countCssMatchesPrimary\": \"globalThis.__stagehandLocatorScripts.countCssMatchesPrimary\",\n \"countTextMatches\": \"globalThis.__stagehandLocatorScripts.countTextMatches\",\n \"countXPathMatchesMainWorld\": \"globalThis.__stagehandLocatorScripts.countXPathMatchesMainWorld\",\n \"dispatchDomClick\": \"globalThis.__stagehandLocatorScripts.dispatchDomClick\",\n \"ensureFileInputElement\": \"globalThis.__stagehandLocatorScripts.ensureFileInputElement\",\n \"fillElementValue\": \"globalThis.__stagehandLocatorScripts.fillElementValue\",\n \"focusElement\": \"globalThis.__stagehandLocatorScripts.focusElement\",\n \"isElementChecked\": \"globalThis.__stagehandLocatorScripts.isElementChecked\",\n \"isElementVisible\": \"globalThis.__stagehandLocatorScripts.isElementVisible\",\n \"prepareElementForTyping\": \"globalThis.__stagehandLocatorScripts.prepareElementForTyping\",\n \"readElementInnerHTML\": \"globalThis.__stagehandLocatorScripts.readElementInnerHTML\",\n \"readElementInnerText\": \"globalThis.__stagehandLocatorScripts.readElementInnerText\",\n \"readElementInputValue\": \"globalThis.__stagehandLocatorScripts.readElementInputValue\",\n \"readElementTextContent\": \"globalThis.__stagehandLocatorScripts.readElementTextContent\",\n \"resolveCssSelector\": \"globalThis.__stagehandLocatorScripts.resolveCssSelector\",\n \"resolveCssSelectorPierce\": \"globalThis.__stagehandLocatorScripts.resolveCssSelectorPierce\",\n \"resolveTextSelector\": \"globalThis.__stagehandLocatorScripts.resolveTextSelector\",\n \"resolveXPathMainWorld\": \"globalThis.__stagehandLocatorScripts.resolveXPathMainWorld\",\n \"scrollElementToPercent\": \"globalThis.__stagehandLocatorScripts.scrollElementToPercent\",\n \"selectElementOptions\": \"globalThis.__stagehandLocatorScripts.selectElementOptions\",\n \"waitForSelector\": \"globalThis.__stagehandLocatorScripts.waitForSelector\"\n} as const;\nexport type LocatorScriptName = keyof typeof locatorScriptSources;\n"]}
@@ -0,0 +1 @@
1
+ export declare const reRenderScriptContent = "(()=>{function s(){try{let o=window.__stagehandV3__;if(!o||typeof o.getClosedRoot!=\"function\")return;let t=[],r=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){let e=r.currentNode,n=e.tagName?.toLowerCase()??\"\";if(!n.includes(\"-\")||typeof customElements?.get!=\"function\"||!customElements.get(n))continue;let c=!!e.shadowRoot,i=!!o.getClosedRoot(e);c||i||t.push(e)}for(let e of t)try{let n=e.cloneNode(!0);e.replaceWith(n)}catch{}o.stats&&t.length&&console.info(\"[v3-piercer] rerender\",{count:t.length})}catch(o){console.info(\"[v3-piercer] rerender error\",{message:String(o??\"\")})}}s();})();\n";
@@ -0,0 +1,2 @@
1
+ export const reRenderScriptContent = "(()=>{function s(){try{let o=window.__stagehandV3__;if(!o||typeof o.getClosedRoot!=\"function\")return;let t=[],r=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){let e=r.currentNode,n=e.tagName?.toLowerCase()??\"\";if(!n.includes(\"-\")||typeof customElements?.get!=\"function\"||!customElements.get(n))continue;let c=!!e.shadowRoot,i=!!o.getClosedRoot(e);c||i||t.push(e)}for(let e of t)try{let n=e.cloneNode(!0);e.replaceWith(n)}catch{}o.stats&&t.length&&console.info(\"[v3-piercer] rerender\",{count:t.length})}catch(o){console.info(\"[v3-piercer] rerender error\",{message:String(o??\"\")})}}s();})();\n";
2
+ //# sourceMappingURL=reRenderScriptContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reRenderScriptContent.js","sourceRoot":"","sources":["../../../../../../lib/v3/dom/build/reRenderScriptContent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,goBAAgoB,CAAC","sourcesContent":["export const reRenderScriptContent = \"(()=>{function s(){try{let o=window.__stagehandV3__;if(!o||typeof o.getClosedRoot!=\\\"function\\\")return;let t=[],r=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){let e=r.currentNode,n=e.tagName?.toLowerCase()??\\\"\\\";if(!n.includes(\\\"-\\\")||typeof customElements?.get!=\\\"function\\\"||!customElements.get(n))continue;let c=!!e.shadowRoot,i=!!o.getClosedRoot(e);c||i||t.push(e)}for(let e of t)try{let n=e.cloneNode(!0);e.replaceWith(n)}catch{}o.stats&&t.length&&console.info(\\\"[v3-piercer] rerender\\\",{count:t.length})}catch(o){console.info(\\\"[v3-piercer] rerender error\\\",{message:String(o??\\\"\\\")})}}s();})();\\n\";"]}
@@ -0,0 +1 @@
1
+ (()=>{function s(){try{let o=window.__stagehandV3__;if(!o||typeof o.getClosedRoot!="function")return;let t=[],r=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){let e=r.currentNode,n=e.tagName?.toLowerCase()??"";if(!n.includes("-")||typeof customElements?.get!="function"||!customElements.get(n))continue;let c=!!e.shadowRoot,i=!!o.getClosedRoot(e);c||i||t.push(e)}for(let e of t)try{let n=e.cloneNode(!0);e.replaceWith(n)}catch{}o.stats&&t.length&&console.info("[v3-piercer] rerender",{count:t.length})}catch(o){console.info("[v3-piercer] rerender error",{message:String(o??"")})}}s();})();
@@ -0,0 +1,4 @@
1
+ export declare const screenshotScriptSources: {
2
+ readonly resolveMaskRect: "function h(r){function u(t,e){try{return t&&typeof t.closest==\"function\"?t.closest(e):null}catch{return null}}function s(t,e){try{return!!t&&typeof t.matches==\"function\"&&t.matches(e)}catch{return!1}}function c(t){let e=u(t,\"dialog[open]\");if(e)return e;let l=u(t,\"[popover]\");return l&&s(l,\":popover-open\")?l:null}if(!this||typeof this.getBoundingClientRect!=\"function\")return null;let n=this.getBoundingClientRect();if(!n)return null;let i=window.getComputedStyle(this);if(!i||i.visibility===\"hidden\"||i.display===\"none\"||n.width<=0||n.height<=0)return null;let o=c(this);if(o){let t=o.getBoundingClientRect();if(!t)return null;let e=null;if(r)try{let l=o.getAttribute(\"data-stagehand-mask-root\");l&&l.startsWith(r)?e=l:(e=r+\"_root_\"+Math.random().toString(36).slice(2),o.setAttribute(\"data-stagehand-mask-root\",e))}catch{e=null}return{x:n.left-t.left-(o.clientLeft||0)+(o.scrollLeft||0),y:n.top-t.top-(o.clientTop||0)+(o.scrollTop||0),width:n.width,height:n.height,rootToken:e}}return{x:n.left+window.scrollX,y:n.top+window.scrollY,width:n.width,height:n.height,rootToken:null}}";
3
+ };
4
+ export type ScreenshotScriptName = keyof typeof screenshotScriptSources;
@@ -0,0 +1,8 @@
1
+ /*
2
+ * AUTO-GENERATED FILE. DO NOT EDIT.
3
+ * Update sources in lib/v3/dom/screenshotScripts and run genScreenshotScripts.ts.
4
+ */
5
+ export const screenshotScriptSources = {
6
+ "resolveMaskRect": "function h(r){function u(t,e){try{return t&&typeof t.closest==\"function\"?t.closest(e):null}catch{return null}}function s(t,e){try{return!!t&&typeof t.matches==\"function\"&&t.matches(e)}catch{return!1}}function c(t){let e=u(t,\"dialog[open]\");if(e)return e;let l=u(t,\"[popover]\");return l&&s(l,\":popover-open\")?l:null}if(!this||typeof this.getBoundingClientRect!=\"function\")return null;let n=this.getBoundingClientRect();if(!n)return null;let i=window.getComputedStyle(this);if(!i||i.visibility===\"hidden\"||i.display===\"none\"||n.width<=0||n.height<=0)return null;let o=c(this);if(o){let t=o.getBoundingClientRect();if(!t)return null;let e=null;if(r)try{let l=o.getAttribute(\"data-stagehand-mask-root\");l&&l.startsWith(r)?e=l:(e=r+\"_root_\"+Math.random().toString(36).slice(2),o.setAttribute(\"data-stagehand-mask-root\",e))}catch{e=null}return{x:n.left-t.left-(o.clientLeft||0)+(o.scrollLeft||0),y:n.top-t.top-(o.clientTop||0)+(o.scrollTop||0),width:n.width,height:n.height,rootToken:e}}return{x:n.left+window.scrollX,y:n.top+window.scrollY,width:n.width,height:n.height,rootToken:null}}"
7
+ };
8
+ //# sourceMappingURL=screenshotScripts.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screenshotScripts.generated.js","sourceRoot":"","sources":["../../../../../../lib/v3/dom/build/screenshotScripts.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,iBAAiB,EAAE,ilCAAilC;CAC5lC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE. DO NOT EDIT.\n * Update sources in lib/v3/dom/screenshotScripts and run genScreenshotScripts.ts.\n */\nexport const screenshotScriptSources = {\n \"resolveMaskRect\": \"function h(r){function u(t,e){try{return t&&typeof t.closest==\\\"function\\\"?t.closest(e):null}catch{return null}}function s(t,e){try{return!!t&&typeof t.matches==\\\"function\\\"&&t.matches(e)}catch{return!1}}function c(t){let e=u(t,\\\"dialog[open]\\\");if(e)return e;let l=u(t,\\\"[popover]\\\");return l&&s(l,\\\":popover-open\\\")?l:null}if(!this||typeof this.getBoundingClientRect!=\\\"function\\\")return null;let n=this.getBoundingClientRect();if(!n)return null;let i=window.getComputedStyle(this);if(!i||i.visibility===\\\"hidden\\\"||i.display===\\\"none\\\"||n.width<=0||n.height<=0)return null;let o=c(this);if(o){let t=o.getBoundingClientRect();if(!t)return null;let e=null;if(r)try{let l=o.getAttribute(\\\"data-stagehand-mask-root\\\");l&&l.startsWith(r)?e=l:(e=r+\\\"_root_\\\"+Math.random().toString(36).slice(2),o.setAttribute(\\\"data-stagehand-mask-root\\\",e))}catch{e=null}return{x:n.left-t.left-(o.clientLeft||0)+(o.scrollLeft||0),y:n.top-t.top-(o.clientTop||0)+(o.scrollTop||0),width:n.width,height:n.height,rootToken:e}}return{x:n.left+window.scrollX,y:n.top+window.scrollY,width:n.width,height:n.height,rootToken:null}}\"\n} as const;\nexport type ScreenshotScriptName = keyof typeof screenshotScriptSources;\n"]}
@@ -0,0 +1 @@
1
+ export declare const v3ScriptContent = "(()=>{function s(c={}){let r=e=>{let{hostToRoot:o}=e;window.__stagehandV3__={getClosedRoot:a=>o.get(a),stats:()=>({installed:!0,url:location.href,isTop:window.top===window,open:e.openCount,closed:e.closedCount})}},n=Element.prototype.attachShadow;if(n.__v3Patched&&n.__v3State){n.__v3State.debug=!0,r(n.__v3State);return}let t={hostToRoot:new WeakMap,openCount:0,closedCount:0,debug:!0},l=n,d=function(e){let o=e?.mode??\"open\",a=l.call(this,e);try{t.hostToRoot.set(this,a),o===\"closed\"?t.closedCount++:t.openCount++,t.debug&&console.info(\"[v3-piercer] attachShadow\",{tag:this.tagName?.toLowerCase()??\"\",mode:o,url:location.href})}catch{}return a};if(d.__v3Patched=!0,d.__v3State=t,Object.defineProperty(Element.prototype,\"attachShadow\",{configurable:!0,writable:!0,value:d}),c.tagExisting)try{let e=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let o=e.currentNode;o.shadowRoot&&(t.hostToRoot.set(o,o.shadowRoot),t.openCount++)}}catch{}window.__stagehandV3Injected=!0,r(t),t.debug&&console.info(\"[v3-piercer] installed\",{url:location.href,isTop:window.top===window,readyState:document.readyState})}s({debug:!0,tagExisting:!1});})();\n";
@@ -0,0 +1,2 @@
1
+ export const v3ScriptContent = "(()=>{function s(c={}){let r=e=>{let{hostToRoot:o}=e;window.__stagehandV3__={getClosedRoot:a=>o.get(a),stats:()=>({installed:!0,url:location.href,isTop:window.top===window,open:e.openCount,closed:e.closedCount})}},n=Element.prototype.attachShadow;if(n.__v3Patched&&n.__v3State){n.__v3State.debug=!0,r(n.__v3State);return}let t={hostToRoot:new WeakMap,openCount:0,closedCount:0,debug:!0},l=n,d=function(e){let o=e?.mode??\"open\",a=l.call(this,e);try{t.hostToRoot.set(this,a),o===\"closed\"?t.closedCount++:t.openCount++,t.debug&&console.info(\"[v3-piercer] attachShadow\",{tag:this.tagName?.toLowerCase()??\"\",mode:o,url:location.href})}catch{}return a};if(d.__v3Patched=!0,d.__v3State=t,Object.defineProperty(Element.prototype,\"attachShadow\",{configurable:!0,writable:!0,value:d}),c.tagExisting)try{let e=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let o=e.currentNode;o.shadowRoot&&(t.hostToRoot.set(o,o.shadowRoot),t.openCount++)}}catch{}window.__stagehandV3Injected=!0,r(t),t.debug&&console.info(\"[v3-piercer] installed\",{url:location.href,isTop:window.top===window,readyState:document.readyState})}s({debug:!0,tagExisting:!1});})();\n";
2
+ //# sourceMappingURL=scriptV3Content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scriptV3Content.js","sourceRoot":"","sources":["../../../../../../lib/v3/dom/build/scriptV3Content.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,8pCAA8pC,CAAC","sourcesContent":["export const v3ScriptContent = \"(()=>{function s(c={}){let r=e=>{let{hostToRoot:o}=e;window.__stagehandV3__={getClosedRoot:a=>o.get(a),stats:()=>({installed:!0,url:location.href,isTop:window.top===window,open:e.openCount,closed:e.closedCount})}},n=Element.prototype.attachShadow;if(n.__v3Patched&&n.__v3State){n.__v3State.debug=!0,r(n.__v3State);return}let t={hostToRoot:new WeakMap,openCount:0,closedCount:0,debug:!0},l=n,d=function(e){let o=e?.mode??\\\"open\\\",a=l.call(this,e);try{t.hostToRoot.set(this,a),o===\\\"closed\\\"?t.closedCount++:t.openCount++,t.debug&&console.info(\\\"[v3-piercer] attachShadow\\\",{tag:this.tagName?.toLowerCase()??\\\"\\\",mode:o,url:location.href})}catch{}return a};if(d.__v3Patched=!0,d.__v3State=t,Object.defineProperty(Element.prototype,\\\"attachShadow\\\",{configurable:!0,writable:!0,value:d}),c.tagExisting)try{let e=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let o=e.currentNode;o.shadowRoot&&(t.hostToRoot.set(o,o.shadowRoot),t.openCount++)}}catch{}window.__stagehandV3Injected=!0,r(t),t.debug&&console.info(\\\"[v3-piercer] installed\\\",{url:location.href,isTop:window.top===window,readyState:document.readyState})}s({debug:!0,tagExisting:!1});})();\\n\";"]}
@@ -0,0 +1 @@
1
+ (()=>{function s(c={}){let r=e=>{let{hostToRoot:o}=e;window.__stagehandV3__={getClosedRoot:a=>o.get(a),stats:()=>({installed:!0,url:location.href,isTop:window.top===window,open:e.openCount,closed:e.closedCount})}},n=Element.prototype.attachShadow;if(n.__v3Patched&&n.__v3State){n.__v3State.debug=!0,r(n.__v3State);return}let t={hostToRoot:new WeakMap,openCount:0,closedCount:0,debug:!0},l=n,d=function(e){let o=e?.mode??"open",a=l.call(this,e);try{t.hostToRoot.set(this,a),o==="closed"?t.closedCount++:t.openCount++,t.debug&&console.info("[v3-piercer] attachShadow",{tag:this.tagName?.toLowerCase()??"",mode:o,url:location.href})}catch{}return a};if(d.__v3Patched=!0,d.__v3State=t,Object.defineProperty(Element.prototype,"attachShadow",{configurable:!0,writable:!0,value:d}),c.tagExisting)try{let e=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let o=e.currentNode;o.shadowRoot&&(t.hostToRoot.set(o,o.shadowRoot),t.openCount++)}}catch{}window.__stagehandV3Injected=!0,r(t),t.debug&&console.info("[v3-piercer] installed",{url:location.href,isTop:window.top===window,readyState:document.readyState})}s({debug:!0,tagExisting:!1});})();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import esbuild from "esbuild";
5
+ const here = path.dirname(fileURLToPath(import.meta.url));
6
+ const srcDir = path.join(here, "./a11yScripts");
7
+ const outDir = path.join(here, "./build");
8
+ const entry = path.join(srcDir, "index.ts");
9
+ const moduleOut = path.join(outDir, "a11yScripts.mjs");
10
+ const bundleOut = path.join(outDir, "a11yScripts.bundle.js");
11
+ async function main() {
12
+ fs.mkdirSync(outDir, { recursive: true });
13
+ esbuild.buildSync({
14
+ entryPoints: [entry],
15
+ bundle: true,
16
+ format: "esm",
17
+ platform: "browser",
18
+ target: "es2020",
19
+ minify: true,
20
+ outfile: moduleOut,
21
+ });
22
+ esbuild.buildSync({
23
+ entryPoints: [entry],
24
+ bundle: true,
25
+ format: "iife",
26
+ platform: "browser",
27
+ target: "es2020",
28
+ globalName: "__stagehandA11yScriptsFactory",
29
+ minify: true,
30
+ outfile: bundleOut,
31
+ });
32
+ const bundleRaw = fs.readFileSync(bundleOut, "utf8").trim();
33
+ const bootstrap = `if (!globalThis.__stagehandA11yScripts) { ${bundleRaw}\n globalThis.__stagehandA11yScripts = __stagehandA11yScriptsFactory;\n}`;
34
+ const compiledModule = (await import(pathToFileURL(moduleOut).href));
35
+ const entries = Object.entries(compiledModule).filter(([, value]) => typeof value === "function");
36
+ const sorted = entries.sort(([a], [b]) => a.localeCompare(b));
37
+ const scriptMap = Object.fromEntries(sorted.map(([name, fn]) => {
38
+ const callable = fn;
39
+ return [name, callable.toString()];
40
+ }));
41
+ const banner = `/*\n * AUTO-GENERATED FILE. DO NOT EDIT.\n * Update sources in lib/v3/dom/a11yScripts and run genA11yScripts.ts.\n */`;
42
+ const globalRefs = Object.fromEntries(sorted.map(([name]) => [name, `globalThis.__stagehandA11yScripts.${name}`]));
43
+ const content = `${banner}
44
+ export const a11yScriptBootstrap = ${JSON.stringify(bootstrap)};
45
+ export const a11yScriptSources = ${JSON.stringify(scriptMap, null, 2)} as const;
46
+ export const a11yScriptGlobalRefs = ${JSON.stringify(globalRefs, null, 2)} as const;
47
+ export type A11yScriptName = keyof typeof a11yScriptSources;
48
+ `;
49
+ fs.writeFileSync(path.join(outDir, "a11yScripts.generated.ts"), content);
50
+ await fs.promises.unlink(moduleOut).catch(() => { });
51
+ await fs.promises.unlink(bundleOut).catch(() => { });
52
+ }
53
+ void main();
54
+ //# sourceMappingURL=genA11yScripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genA11yScripts.js","sourceRoot":"","sources":["../../../../../lib/v3/dom/genA11yScripts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;AAChD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACvD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE7D,KAAK,UAAU,IAAI;IACjB,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1C,OAAO,CAAC,SAAS,CAAC;QAChB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,SAAS;KACnB,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,CAAC;QAChB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,+BAA+B;QAC3C,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,SAAS;KACnB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,MAAM,SAAS,GAAG,6CAA6C,SAAS,2EAA2E,CAAC;IAEpJ,MAAM,cAAc,GAAG,CAAC,MAAM,MAAM,CAClC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,CAC9B,CAA4B,CAAC;IAE9B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,MAAM,CACnD,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,UAAU,CAC3C,CAAC;IACF,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,MAAM,SAAS,GAA2B,MAAM,CAAC,WAAW,CAC1D,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;QACxB,MAAM,QAAQ,GAAG,EAAqC,CAAC;QACvD,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,MAAM,GAAG,uHAAuH,CAAC;IAEvI,MAAM,UAAU,GAA2B,MAAM,CAAC,WAAW,CAC3D,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,qCAAqC,IAAI,EAAE,CAAC,CAAC,CAC5E,CAAC;IAEF,MAAM,OAAO,GAAG,GAAG,MAAM;qCACU,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;mCAC3B,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;sCAC/B,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;;CAExE,CAAC;IAEA,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,0BAA0B,CAAC,EAAE,OAAO,CAAC,CAAC;IAEzE,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACpD,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,KAAK,IAAI,EAAE,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport esbuild from \"esbuild\";\n\nconst here = path.dirname(fileURLToPath(import.meta.url));\nconst srcDir = path.join(here, \"./a11yScripts\");\nconst outDir = path.join(here, \"./build\");\nconst entry = path.join(srcDir, \"index.ts\");\nconst moduleOut = path.join(outDir, \"a11yScripts.mjs\");\nconst bundleOut = path.join(outDir, \"a11yScripts.bundle.js\");\n\nasync function main(): Promise<void> {\n fs.mkdirSync(outDir, { recursive: true });\n\n esbuild.buildSync({\n entryPoints: [entry],\n bundle: true,\n format: \"esm\",\n platform: \"browser\",\n target: \"es2020\",\n minify: true,\n outfile: moduleOut,\n });\n\n esbuild.buildSync({\n entryPoints: [entry],\n bundle: true,\n format: \"iife\",\n platform: \"browser\",\n target: \"es2020\",\n globalName: \"__stagehandA11yScriptsFactory\",\n minify: true,\n outfile: bundleOut,\n });\n\n const bundleRaw = fs.readFileSync(bundleOut, \"utf8\").trim();\n const bootstrap = `if (!globalThis.__stagehandA11yScripts) { ${bundleRaw}\\n globalThis.__stagehandA11yScripts = __stagehandA11yScriptsFactory;\\n}`;\n\n const compiledModule = (await import(\n pathToFileURL(moduleOut).href\n )) as Record<string, unknown>;\n\n const entries = Object.entries(compiledModule).filter(\n ([, value]) => typeof value === \"function\",\n );\n const sorted = entries.sort(([a], [b]) => a.localeCompare(b));\n\n const scriptMap: Record<string, string> = Object.fromEntries(\n sorted.map(([name, fn]) => {\n const callable = fn as (...args: unknown[]) => unknown;\n return [name, callable.toString()];\n }),\n );\n\n const banner = `/*\\n * AUTO-GENERATED FILE. DO NOT EDIT.\\n * Update sources in lib/v3/dom/a11yScripts and run genA11yScripts.ts.\\n */`;\n\n const globalRefs: Record<string, string> = Object.fromEntries(\n sorted.map(([name]) => [name, `globalThis.__stagehandA11yScripts.${name}`]),\n );\n\n const content = `${banner}\nexport const a11yScriptBootstrap = ${JSON.stringify(bootstrap)};\nexport const a11yScriptSources = ${JSON.stringify(scriptMap, null, 2)} as const;\nexport const a11yScriptGlobalRefs = ${JSON.stringify(globalRefs, null, 2)} as const;\nexport type A11yScriptName = keyof typeof a11yScriptSources;\n`;\n\n fs.writeFileSync(path.join(outDir, \"a11yScripts.generated.ts\"), content);\n\n await fs.promises.unlink(moduleOut).catch(() => {});\n await fs.promises.unlink(bundleOut).catch(() => {});\n}\n\nvoid main();\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Build the v3 DOM script into a single JS file and then export its contents
3
+ * as a string constant (`v3ScriptContent`) for CDP injection (document-start).
4
+ */
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import esbuild from "esbuild";
9
+ const here = path.dirname(fileURLToPath(import.meta.url));
10
+ const outDir = path.join(here, "./build");
11
+ fs.mkdirSync(outDir, { recursive: true });
12
+ esbuild.buildSync({
13
+ entryPoints: [path.join(here, "piercer.entry.ts")],
14
+ bundle: true,
15
+ format: "iife",
16
+ platform: "browser",
17
+ target: "es2020",
18
+ minify: true,
19
+ legalComments: "none",
20
+ outfile: path.join(outDir, "v3-index.js"),
21
+ });
22
+ const script = fs.readFileSync(path.join(outDir, "v3-index.js"), "utf8");
23
+ const content = `export const v3ScriptContent = ${JSON.stringify(script)};`;
24
+ fs.writeFileSync(path.join(outDir, "scriptV3Content.ts"), content);
25
+ esbuild.buildSync({
26
+ entryPoints: [path.join(here, "rerenderMissingShadows.entry.ts")],
27
+ bundle: true,
28
+ format: "iife",
29
+ platform: "browser",
30
+ target: "es2020",
31
+ minify: true,
32
+ legalComments: "none",
33
+ outfile: path.join(outDir, "rerender-index.js"),
34
+ });
35
+ const rerenderScript = fs.readFileSync(path.join(outDir, "rerender-index.js"), "utf8");
36
+ const rerenderContent = `export const reRenderScriptContent = ${JSON.stringify(rerenderScript)};`;
37
+ fs.writeFileSync(path.join(outDir, "reRenderScriptContent.ts"), rerenderContent);
38
+ //# sourceMappingURL=genDomScripts.js.map