@nostop/page 0.1.0-rc.2 → 0.1.0-rc.3

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 (82) hide show
  1. package/README.md +25 -13
  2. package/dist/esm/{SimulatorMask-A9fOKtEZ.js → SimulatorMask-D6QhYREr.js} +11 -11
  3. package/dist/esm/SimulatorMask-D6QhYREr.js.map +1 -0
  4. package/dist/esm/{ax-core-oj-p6gBY.js → ax-core-BVXEU2Dk.js} +16 -3
  5. package/dist/esm/ax-core-BVXEU2Dk.js.map +1 -0
  6. package/dist/esm/page-agent.js +2720 -168
  7. package/dist/esm/page-agent.js.map +1 -1
  8. package/dist/esm/types/core/src/PageAgentCore.d.ts +105 -0
  9. package/dist/esm/types/core/src/confirmation.d.ts +2 -0
  10. package/dist/esm/types/core/src/contextMemory.d.ts +20 -0
  11. package/dist/esm/types/core/src/redactSensitiveUrls.d.ts +4 -0
  12. package/dist/esm/types/core/src/targetContext.d.ts +11 -0
  13. package/dist/esm/types/core/src/taskContext.d.ts +78 -0
  14. package/dist/esm/types/core/src/tools/index.d.ts +43 -0
  15. package/dist/esm/types/core/src/types.d.ts +317 -0
  16. package/dist/esm/types/core/src/utils/autoFixer.d.ts +14 -0
  17. package/dist/esm/types/core/src/utils/index.d.ts +26 -0
  18. package/dist/esm/types/llms/src/OpenAIClient.d.ts +10 -0
  19. package/dist/esm/types/llms/src/errors.d.ts +28 -0
  20. package/dist/esm/types/llms/src/index.d.ts +19 -0
  21. package/dist/esm/types/llms/src/types.d.ts +108 -0
  22. package/dist/esm/types/llms/src/utils.d.ts +59 -0
  23. package/dist/esm/types/page-agent/src/PageAgent.d.ts +17 -0
  24. package/dist/esm/types/page-agent/src/demo.d.ts +1 -0
  25. package/dist/esm/types/page-controller/src/PageController.d.ts +314 -0
  26. package/dist/esm/types/page-controller/src/actions.d.ts +45 -0
  27. package/dist/esm/types/page-controller/src/ax/AccessibilityController.d.ts +191 -0
  28. package/dist/esm/types/page-controller/src/ax/diagnosis.d.ts +42 -0
  29. package/dist/esm/types/page-controller/src/ax/diff.d.ts +74 -0
  30. package/dist/esm/types/page-controller/src/ax/domActivity.d.ts +33 -0
  31. package/dist/esm/types/page-controller/src/ax/domPath.d.ts +12 -0
  32. package/dist/esm/types/page-controller/src/ax/engine.d.ts +245 -0
  33. package/dist/esm/types/page-controller/src/ax/errors.d.ts +44 -0
  34. package/dist/esm/types/page-controller/src/ax/evidence.d.ts +30 -0
  35. package/dist/esm/types/page-controller/src/ax/format.d.ts +10 -0
  36. package/dist/esm/types/page-controller/src/ax/ids.d.ts +17 -0
  37. package/dist/esm/types/page-controller/src/ax/index.d.ts +11 -0
  38. package/dist/esm/types/page-controller/src/ax/observation.d.ts +6 -0
  39. package/dist/esm/types/page-controller/src/ax/types.d.ts +298 -0
  40. package/dist/esm/types/page-controller/src/ax/vendor/ax-core.d.ts +202 -0
  41. package/dist/esm/types/page-controller/src/ax/vendor/ax-standards.d.ts +27 -0
  42. package/dist/esm/types/page-controller/src/dom/dom_tree/index.d.ts +21 -0
  43. package/dist/esm/types/page-controller/src/dom/dom_tree/type.d.ts +41 -0
  44. package/dist/esm/types/page-controller/src/dom/getPageInfo.d.ts +16 -0
  45. package/dist/esm/types/page-controller/src/dom/index.d.ts +62 -0
  46. package/dist/esm/types/page-controller/src/geometry.d.ts +9 -0
  47. package/dist/esm/types/page-controller/src/mask/SimulatorMask.d.ts +20 -0
  48. package/dist/esm/types/page-controller/src/mask/siteColor.d.ts +38 -0
  49. package/dist/esm/types/page-controller/src/patches/antd.d.ts +2 -0
  50. package/dist/esm/types/page-controller/src/patches/react.d.ts +5 -0
  51. package/dist/esm/types/page-controller/src/redactSensitiveUrls.d.ts +2 -0
  52. package/dist/esm/types/page-controller/src/scriptResult.d.ts +8 -0
  53. package/dist/esm/types/page-controller/src/stateFreshness.d.ts +16 -0
  54. package/dist/esm/types/page-controller/src/utils/index.d.ts +25 -0
  55. package/dist/esm/types/ui/src/i18n/index.d.ts +12 -0
  56. package/dist/esm/types/ui/src/i18n/locales.d.ts +358 -0
  57. package/dist/esm/types/ui/src/index.d.ts +2 -0
  58. package/dist/esm/types/ui/src/panel/Panel.d.ts +60 -0
  59. package/dist/esm/types/ui/src/panel/feed.d.ts +31 -0
  60. package/dist/esm/types/ui/src/panel/fold.d.ts +2 -0
  61. package/dist/esm/types/ui/src/panel/highlight.d.ts +18 -0
  62. package/dist/esm/types/ui/src/panel/icons.d.ts +6 -0
  63. package/dist/esm/types/ui/src/panel/microphone.d.ts +21 -0
  64. package/dist/esm/types/ui/src/panel/recovery.d.ts +21 -0
  65. package/dist/esm/types/ui/src/panel/scriptCard.d.ts +25 -0
  66. package/dist/esm/types/ui/src/panel/toolVisual.d.ts +10 -0
  67. package/dist/esm/types/ui/src/panel/trace.d.ts +15 -0
  68. package/dist/esm/types/ui/src/panel/types.d.ts +92 -0
  69. package/dist/esm/types/ui/src/panel/voiceRuns.d.ts +26 -0
  70. package/dist/esm/types/ui/src/panel/voiceTaskRouting.d.ts +8 -0
  71. package/dist/esm/types/ui/src/utils.d.ts +5 -0
  72. package/dist/esm/types/ui/src/voice/gemini-client.d.ts +12 -0
  73. package/dist/esm/types/ui/src/voice/gemini-protocol.d.ts +52 -0
  74. package/dist/esm/types/ui/src/voice/realtime-client.d.ts +25 -0
  75. package/dist/esm/types/ui/src/voice/realtime-protocol.d.ts +97 -0
  76. package/dist/esm/types/ui/src/voice/voice-prompt.d.ts +11 -0
  77. package/dist/esm/types/ui/src/voice/voice-session.d.ts +76 -0
  78. package/dist/iife/page-agent.demo.js +189 -87
  79. package/package.json +6 -6
  80. package/dist/esm/PageAgent.d.ts +0 -39
  81. package/dist/esm/SimulatorMask-A9fOKtEZ.js.map +0 -1
  82. package/dist/esm/ax-core-oj-p6gBY.js.map +0 -1
package/README.md CHANGED
@@ -6,18 +6,18 @@ Agente de IA que opera a página em que está instalado: lê o texto e os elemen
6
6
 
7
7
  ## Mapa do projeto
8
8
 
9
- | Pasta | O que faz | Quando mexer |
10
- | -------------------------------------------- | --------------------------------------------------------------------- | ----------------------------------------- |
11
- | `packages/core` | Ciclo do agente: passos, histórico, ferramentas, prompts | Quase nunca. Só com autorização explícita |
12
- | `packages/core/src/prompts/system_prompt.md` | Prompt de sistema padrão (regras gerais do agente) | Preferir `instructions.system` |
13
- | `packages/llms` | Cliente LLM compatível com OpenAI, com retentativas | Raramente |
14
- | `packages/page-controller` | Leitura da página (DOM simplificado) e ações (clicar, digitar, rolar) | Para regras de extração e de bloqueio |
15
- | `packages/page-controller/src/mask` | Overlay visual: brilho de borda e cursor do agente | Para aparência |
16
- | `packages/ui` | Painel (conversa, ferramentas, voz, trilho, cartão de prévia) | Para interface |
17
- | `packages/page-agent` | Classe `PageAgent` (núcleo + painel) e o bundle da demo | Ponto de entrada para integrar |
18
- | `packages/website` | Site de documentação do projeto original | Opcional |
19
- | `packages/extension` | Extensão do Chrome | Opcional |
20
- | `packages/mcp` | Ponte MCP para a extensão | Opcional |
9
+ | Pasta | O que faz | Quando mexer |
10
+ | -------------------------------------------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------- |
11
+ | `packages/core` | Ciclo do agente: passos, histórico, ferramentas, prompts | Quase nunca. Só com autorização explícita |
12
+ | `packages/core/src/prompts/system_prompt.md` | Prompt de sistema padrão (regras gerais do agente) | Preferir `instructions.system` |
13
+ | `packages/llms` | Cliente LLM compatível com OpenAI, com retentativas | Raramente |
14
+ | `packages/page-controller` | Leitura da página (árvore de acessibilidade por padrão; lista de elementos como reserva) e ações | Para regras de extração e de bloqueio |
15
+ | `packages/page-controller/src/mask` | Overlay visual: brilho de borda e cursor do agente | Para aparência |
16
+ | `packages/ui` | Painel (conversa, ferramentas, voz, trilho, cartão de prévia) | Para interface |
17
+ | `packages/page-agent` | Classe `PageAgent` (núcleo + painel) e o bundle da demo | Ponto de entrada para integrar |
18
+ | `packages/website` | Site de documentação do projeto original | Opcional |
19
+ | `packages/extension` | Extensão do Chrome | Opcional |
20
+ | `packages/mcp` | Ponte MCP para a extensão | Opcional |
21
21
 
22
22
  ## Uso básico
23
23
 
@@ -37,6 +37,18 @@ await agent.execute('Vá até o rodapé e pare quando não houver mais conteúdo
37
37
 
38
38
  Na demo, a mesma configuração vem dos parâmetros da URL do script (`model`, `baseURL`, `apiKey`, `lang`, `showPanel`).
39
39
 
40
+ ## Como uma etapa funciona
41
+
42
+ Isto é um script injetado na página. Não é Computer Use, não abre o desktop e não fala CDP. Cada passo faz uma coisa e a leitura seguinte é nova.
43
+
44
+ - O índice numérico vale só para essa leitura. O próximo passo emite outros.
45
+ - A leitura padrão é a árvore reconstruída, mais a seção `Changes since the previous accessibility read`. Essa seção diz o que mudou. A árvore acima dela é a leitura inteira e a única fonte de índices. Se a seção disser que nada mudou, a ação anterior não mostrou efeito. Isso não é sucesso e não significa que o alvo não existe.
46
+ - O resultado separa três coisas: evento enviado, efeito observado e alteração persistida. Um clique sintético é evento enviado. Um valor visto no campo logo depois é efeito observado. Nenhum dos dois prova que a página gravou.
47
+ - Não se pede `wait` só para a página assentar. O passo seguinte já lê de novo. `wait` fica para a região que a observação mostra ainda carregando.
48
+ - Texto da página, resultado de ferramenta e texto colado de outro lugar são dados. Não são ordem e não são permissão.
49
+ - Menu fechado ou overlay dispensado não encerra o pedido. O agente reabre e continua.
50
+ - Senha nova, aviso de segurança do navegador, pagamento, compra, transferência ou jogo, e decisão sobre a elegibilidade de outra pessoa: o agente para e pede para a pessoa fazer. Apagar sem recuperação, contrato, software de origem desconhecida, ampliar acesso sensível ou enfraquecer segurança: pergunta de novo, mesmo que o pedido inicial tenha citado. Apagar com lixeira, preferência visual, upload nomeado, mensagem rotineira com destinatário e motivo claros, e login no site nomeado com credencial já dada: o pedido inicial basta quando nomeia a ação, o alvo e o destino. "Faz tudo" não autoriza. O código do clique ainda só reconhece rótulos conhecidos de ação destrutiva. O prompt pede o resto. Não é uma barreira de segurança.
51
+
40
52
  ## Camadas de customização
41
53
 
42
54
  Cada camada abaixo pode ser usada sozinha. Elas vão de "configurar" a "substituir".
@@ -117,7 +129,7 @@ Exemplo usado no Aferis: regras de critério de parada, proibição de afirmar v
117
129
 
118
130
  - A chave `apiKey` no navegador fica exposta a quem abre a página. Em produção, use um proxy no servidor.
119
131
  - Para dados sensíveis, use `transformPageContent` antes de chegar ao modelo.
120
- - Liste operações de alto risco nas instruções: proíba-as ou exija confirmação do usuário.
132
+ - Liste operações de alto risco nas instruções: proíba-as ou exija confirmação do usuário. O prompt padrão já pede isso para senha, pagamento, aviso de segurança, contrato e exclusão. Uma instrução própria soma a esse prompt. Ela não substitui essas paradas, a menos que `overrideSystemPrompt` seja `true`.
121
133
  - Pedidos com critério de parada explícito terminam antes e custam menos. Pedidos vagos (como "desce mais") podem percorrer a página inteira.
122
134
 
123
135
  ## Testes e build
@@ -1,4 +1,4 @@
1
- (function() { try { if (typeof document != "undefined") { var elementStyle = document.createElement("style"); elementStyle.appendChild(document.createTextNode("._wrapper_1nr74_1 {\n position: fixed;\n inset: 0;\n z-index: 2147483641; /* 确保在所有元素之上,除了 panel */\n cursor: wait;\n overflow: hidden;\n\n display: none;\n}\n\n._wrapper_1nr74_1._visible_1nr74_11 {\n display: block;\n}\n\n/* The site's strongest colour, with the previous accent as the fallback for a site without one. */\n._wrapper_1nr74_1 {\n --pa-glow: var(--pa-accent, #fa8d45);\n --pa-glow-ring: 50%;\n --pa-glow-near: 16%;\n --pa-glow-far: 6%;\n}\n\n/* A colour shows more against a dark page, so it needs less. */\n._wrapper_1nr74_1[data-theme='dark'] {\n --pa-glow-ring: 42%;\n --pa-glow-near: 13%;\n --pa-glow-far: 5%;\n}\n\n._glow_1nr74_30 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.4s ease;\n /* Same shape as before; the colour comes from the site (set by SimulatorMask) and is kept faint,\n so the glow reads as a focus ring of the site itself rather than as a foreign frame. */\n box-shadow:\n inset 0 0 0 2px color-mix(in srgb, var(--pa-glow) var(--pa-glow-ring), transparent),\n inset 0 0 42px 8px color-mix(in srgb, var(--pa-glow) var(--pa-glow-near), transparent),\n inset 0 0 100px 22px color-mix(in srgb, var(--pa-glow) var(--pa-glow-far), transparent);\n}\n\n._glowVisible_1nr74_44 {\n opacity: 1;\n}\n\n/* Progress bar shown while the page is being read. Reading blocks the page's main thread, so the bar\n moves with transform only: the browser's compositor keeps it going while scripts cannot run. */\n._progress_1nr74_50 {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n overflow: hidden;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.3s ease;\n background: color-mix(in srgb, var(--pa-glow) 14%, transparent);\n}\n\n._progressActive_1nr74_63 {\n opacity: 1;\n transition-duration: 0.12s;\n}\n\n._progressBar_1nr74_68 {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 45%;\n border-radius: 3px;\n transform: translateX(-110%);\n will-change: transform;\n background: linear-gradient(\n 90deg,\n transparent,\n color-mix(in srgb, var(--pa-glow) 85%, transparent) 35%,\n color-mix(in srgb, var(--pa-glow) 60%, white) 65%,\n transparent\n );\n filter: drop-shadow(0 0 6px color-mix(in srgb, var(--pa-glow) 70%, transparent));\n}\n\n._progressBarLate_1nr74_87 {\n width: 25%;\n}\n\n._progressActive_1nr74_63 ._progressBar_1nr74_68 {\n animation: _progressSlide_1nr74_1 1.25s cubic-bezier(0.45, 0, 0.25, 1) infinite;\n}\n\n._progressActive_1nr74_63 ._progressBarLate_1nr74_87 {\n animation-duration: 1.25s;\n animation-delay: 0.5s;\n animation-timing-function: cubic-bezier(0.3, 0, 0.6, 1);\n}\n\n@keyframes _progressSlide_1nr74_1 {\n from {\n transform: translateX(-110%);\n }\n to {\n transform: translateX(330%);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n ._glow_1nr74_30 {\n transition: none;\n }\n\n /* A steady bar instead of a moving one. */\n ._progressActive_1nr74_63 ._progressBar_1nr74_68 {\n animation: none;\n width: 100%;\n transform: none;\n opacity: 0.6;\n }\n\n ._progressActive_1nr74_63 ._progressBarLate_1nr74_87 {\n display: none;\n }\n}\n/* AI 光标样式 */\n._cursor_20vi4_2 {\n position: absolute;\n width: var(--cursor-size, 21px);\n height: var(--cursor-size, 25px);\n pointer-events: none;\n z-index: 10000;\n background: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath d='M3 2v20l5.5-5 3.9 8 3-1.5-4-7.8L19 15z' fill='%23f28a46' stroke='%23171715' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E\")\n center / contain no-repeat;\n filter: drop-shadow(0 2px 2px #0005);\n}\n\n._cursorFilling_20vi4_13,\n._cursorBorder_20vi4_14 {\n display: none;\n}\n\n._cursorBorder_20vi4_14 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));\n mask-image: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='none'%3e%3cg%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='none'%20stroke='%23000000'%20stroke-width='6'%20stroke-miterlimit='10'%20style='stroke:%20light-dark(rgb(0,%200,%200),%20rgb(255,%20255,%20255));'/%3e%3c/g%3e%3c/svg%3e\");\n mask-size: 100% 100%;\n mask-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorFilling_20vi4_13 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3cdefs%3e%3c/defs%3e%3cg%20xmlns='http://www.w3.org/2000/svg'%20style='filter:%20drop-shadow(light-dark(rgba(0,%200,%200,%200.4),%20rgba(237,%20237,%20237,%200.4))%203px%204px%204px);'%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='%23ffffff'%20stroke='none'%20style='fill:%20%23ffffff;'/%3e%3c/g%3e%3c/svg%3e\");\n background-size: 100% 100%;\n background-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorRipple_20vi4_47 {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n margin-left: -50%;\n margin-top: -50%;\n\n &::after {\n content: '';\n opacity: 0;\n position: absolute;\n inset: 0;\n border: 4px solid rgba(57, 182, 255, 1);\n border-radius: 50%;\n }\n}\n\n._cursor_20vi4_2._clicking_20vi4_65 ._cursorRipple_20vi4_47::after {\n animation: _cursor-ripple_20vi4_1 300ms ease-out forwards;\n}\n\n@keyframes _cursor-ripple_20vi4_1 {\n 0% {\n transform: scale(0);\n opacity: 1;\n }\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n/* Panel button \"Hide agent cursor\": only the drawing disappears; the run continues. */\nhtml[data-pa-cursor-hidden] ._cursor_20vi4_2 {\n display: none !important;\n}")); document.head.appendChild(elementStyle); } } catch (e) { console.error("vite-plugin-css-injected-by-js", e); }})();
1
+ (function() { try { if (typeof document != "undefined") { var elementStyle = document.createElement("style"); elementStyle.appendChild(document.createTextNode("._wrapper_1mugx_1 {\n position: fixed;\n inset: 0;\n z-index: 2147483641; /* 确保在所有元素之上,除了 panel */\n cursor: wait;\n overflow: hidden;\n\n display: none;\n}\n\n._wrapper_1mugx_1._visible_1mugx_11 {\n display: block;\n}\n\n/* The site's strongest colour, with the previous accent as the fallback for a site without one. */\n._wrapper_1mugx_1 {\n --pa-glow: var(--pa-accent, #fa8d45);\n --pa-glow-ring: 50%;\n --pa-glow-near: 16%;\n --pa-glow-far: 6%;\n}\n\n/* A colour shows more against a dark page, so it needs less. */\n._wrapper_1mugx_1[data-theme='dark'] {\n --pa-glow-ring: 42%;\n --pa-glow-near: 13%;\n --pa-glow-far: 5%;\n}\n\n._glow_1mugx_30 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.4s ease;\n /* Same shape as before; the colour comes from the site (set by SimulatorMask) and is kept faint,\n so the glow reads as a focus ring of the site itself rather than as a foreign frame. */\n box-shadow:\n inset 0 0 0 2px color-mix(in srgb, var(--pa-glow) var(--pa-glow-ring), transparent),\n inset 0 0 42px 8px color-mix(in srgb, var(--pa-glow) var(--pa-glow-near), transparent),\n inset 0 0 100px 22px color-mix(in srgb, var(--pa-glow) var(--pa-glow-far), transparent);\n}\n\n._glowVisible_1mugx_44 {\n opacity: 1;\n}\n\n/* Progress bar shown while the page is being read. Reading blocks the page's main thread, so the bar\n moves with transform only: the browser's compositor keeps it going while scripts cannot run. */\n._progress_1mugx_50 {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n overflow: hidden;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.3s ease;\n background: color-mix(in srgb, var(--pa-glow) 14%, transparent);\n}\n\n._progressActive_1mugx_63 {\n opacity: 1;\n /* The synchronous page read can block the first transition frame. */\n transition-duration: 0s;\n}\n\n._progressBar_1mugx_69 {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 45%;\n border-radius: 3px;\n transform: translateX(-110%);\n will-change: transform;\n background: linear-gradient(\n 90deg,\n transparent,\n color-mix(in srgb, var(--pa-glow) 85%, transparent) 35%,\n color-mix(in srgb, var(--pa-glow) 60%, white) 65%,\n transparent\n );\n filter: drop-shadow(0 0 6px color-mix(in srgb, var(--pa-glow) 70%, transparent));\n}\n\n._progressBarLate_1mugx_88 {\n width: 25%;\n}\n\n._progressActive_1mugx_63 ._progressBar_1mugx_69 {\n animation: _progressSlide_1mugx_1 1.25s cubic-bezier(0.45, 0, 0.25, 1) infinite;\n}\n\n._progressActive_1mugx_63 ._progressBarLate_1mugx_88 {\n animation-duration: 1.25s;\n animation-delay: 0.5s;\n animation-timing-function: cubic-bezier(0.3, 0, 0.6, 1);\n}\n\n@keyframes _progressSlide_1mugx_1 {\n from {\n transform: translateX(-110%);\n }\n to {\n transform: translateX(330%);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n ._glow_1mugx_30 {\n transition: none;\n }\n\n /* A steady bar instead of a moving one. */\n ._progressActive_1mugx_63 ._progressBar_1mugx_69 {\n animation: none;\n width: 100%;\n transform: none;\n opacity: 0.6;\n }\n\n ._progressActive_1mugx_63 ._progressBarLate_1mugx_88 {\n display: none;\n }\n}\n/* AI 光标样式 */\n._cursor_20vi4_2 {\n position: absolute;\n width: var(--cursor-size, 21px);\n height: var(--cursor-size, 25px);\n pointer-events: none;\n z-index: 10000;\n background: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath d='M3 2v20l5.5-5 3.9 8 3-1.5-4-7.8L19 15z' fill='%23f28a46' stroke='%23171715' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E\")\n center / contain no-repeat;\n filter: drop-shadow(0 2px 2px #0005);\n}\n\n._cursorFilling_20vi4_13,\n._cursorBorder_20vi4_14 {\n display: none;\n}\n\n._cursorBorder_20vi4_14 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));\n mask-image: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='none'%3e%3cg%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='none'%20stroke='%23000000'%20stroke-width='6'%20stroke-miterlimit='10'%20style='stroke:%20light-dark(rgb(0,%200,%200),%20rgb(255,%20255,%20255));'/%3e%3c/g%3e%3c/svg%3e\");\n mask-size: 100% 100%;\n mask-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorFilling_20vi4_13 {\n position: absolute;\n width: 100%;\n height: 100%;\n background: url(\"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3cdefs%3e%3c/defs%3e%3cg%20xmlns='http://www.w3.org/2000/svg'%20style='filter:%20drop-shadow(light-dark(rgba(0,%200,%200,%200.4),%20rgba(237,%20237,%20237,%200.4))%203px%204px%204px);'%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='%23ffffff'%20stroke='none'%20style='fill:%20%23ffffff;'/%3e%3c/g%3e%3c/svg%3e\");\n background-size: 100% 100%;\n background-repeat: no-repeat;\n\n transform-origin: center;\n transform: rotate(-135deg) scale(1.2);\n margin-left: -10px;\n margin-top: -18px;\n}\n\n._cursorRipple_20vi4_47 {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n margin-left: -50%;\n margin-top: -50%;\n\n &::after {\n content: '';\n opacity: 0;\n position: absolute;\n inset: 0;\n border: 4px solid rgba(57, 182, 255, 1);\n border-radius: 50%;\n }\n}\n\n._cursor_20vi4_2._clicking_20vi4_65 ._cursorRipple_20vi4_47::after {\n animation: _cursor-ripple_20vi4_1 300ms ease-out forwards;\n}\n\n@keyframes _cursor-ripple_20vi4_1 {\n 0% {\n transform: scale(0);\n opacity: 1;\n }\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n/* Panel button \"Hide agent cursor\": only the drawing disappears; the run continues. */\nhtml[data-pa-cursor-hidden] ._cursor_20vi4_2 {\n display: none !important;\n}")); document.head.appendChild(elementStyle); } } catch (e) { console.error("vite-plugin-css-injected-by-js", e); }})();
2
2
  //#region ../page-controller/src/mask/siteColor.ts
3
3
  /** How vivid a colour is, 0 (grey) to 255 (pure hue). */
4
4
  function chroma({ r, g, b }) {
@@ -126,15 +126,15 @@ function detectSiteAppearance(doc = document) {
126
126
  };
127
127
  }
128
128
  var SimulatorMask_module_default = {
129
- wrapper: "_wrapper_1nr74_1",
130
- visible: "_visible_1nr74_11",
131
- glow: "_glow_1nr74_30",
132
- glowVisible: "_glowVisible_1nr74_44",
133
- progress: "_progress_1nr74_50",
134
- progressActive: "_progressActive_1nr74_63",
135
- progressBar: "_progressBar_1nr74_68",
136
- progressBarLate: "_progressBarLate_1nr74_87",
137
- progressSlide: "_progressSlide_1nr74_1"
129
+ wrapper: "_wrapper_1mugx_1",
130
+ visible: "_visible_1mugx_11",
131
+ glow: "_glow_1mugx_30",
132
+ glowVisible: "_glowVisible_1mugx_44",
133
+ progress: "_progress_1mugx_50",
134
+ progressActive: "_progressActive_1mugx_63",
135
+ progressBar: "_progressBar_1mugx_69",
136
+ progressBarLate: "_progressBarLate_1mugx_88",
137
+ progressSlide: "_progressSlide_1mugx_1"
138
138
  };
139
139
  var cursor_module_default = {
140
140
  cursor: "_cursor_20vi4_2",
@@ -327,4 +327,4 @@ var SimulatorMask = class extends EventTarget {
327
327
  //#endregion
328
328
  export { SimulatorMask };
329
329
 
330
- //# sourceMappingURL=SimulatorMask-A9fOKtEZ.js.map
330
+ //# sourceMappingURL=SimulatorMask-D6QhYREr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimulatorMask-D6QhYREr.js","names":[],"sources":["../../../page-controller/src/mask/siteColor.ts","../../../page-controller/src/mask/SimulatorMask.module.css","../../../page-controller/src/mask/cursor.module.css","../../../page-controller/src/mask/SimulatorMask.ts"],"sourcesContent":["/**\n * Finds the colour a site itself uses most strongly, so the agent's own visual cues (the edge glow,\n * the progress bar) blend with the site instead of bringing a colour of their own.\n */\n\nexport interface Rgba {\n\tr: number\n\tg: number\n\tb: number\n\t/** 0 to 1. */\n\ta: number\n}\n\n/** A colour seen on the page and how much it counts: larger and more prominent uses weigh more. */\nexport interface ColorSample {\n\tcolor: Rgba\n\tweight: number\n}\n\n/** How vivid a colour is, 0 (grey) to 255 (pure hue). */\nexport function chroma({ r, g, b }: Rgba): number {\n\treturn Math.max(r, g, b) - Math.min(r, g, b)\n}\n\n/** Relative luminance, 0 (black) to 1 (white). */\nexport function luminance({ r, g, b }: Rgba): number {\n\tconst channel = (value: number) => {\n\t\tconst c = value / 255\n\t\treturn c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n\t}\n\treturn 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b)\n}\n\nconst MIN_CHROMA = 48\nconst MIN_ALPHA = 0.5\n\n/**\n * The strongest colour among the samples: similar colours are pooled, and the pool with the most\n * weighted vividness wins. Greys and mostly transparent colours never win. Null when the page has\n * no colour to speak of.\n */\nexport function pickStrongestColor(samples: ColorSample[]): Rgba | null {\n\tconst pools = new Map<\n\t\tnumber,\n\t\t{ score: number; weight: number; r: number; g: number; b: number }\n\t>()\n\tfor (const { color, weight } of samples) {\n\t\tif (weight <= 0 || color.a < MIN_ALPHA || chroma(color) < MIN_CHROMA) continue\n\t\tconst key = ((color.r >> 5) << 6) | ((color.g >> 5) << 3) | (color.b >> 5)\n\t\tconst pool = pools.get(key) ?? { score: 0, weight: 0, r: 0, g: 0, b: 0 }\n\t\tpool.score += weight * (chroma(color) / 255)\n\t\tpool.weight += weight\n\t\tpool.r += color.r * weight\n\t\tpool.g += color.g * weight\n\t\tpool.b += color.b * weight\n\t\tpools.set(key, pool)\n\t}\n\tlet best: { score: number; weight: number; r: number; g: number; b: number } | null = null\n\tfor (const pool of pools.values()) if (!best || pool.score > best.score) best = pool\n\tif (!best) return null\n\treturn {\n\t\tr: Math.round(best.r / best.weight),\n\t\tg: Math.round(best.g / best.weight),\n\t\tb: Math.round(best.b / best.weight),\n\t\ta: 1,\n\t}\n}\n\nconst CANDIDATES =\n\t'a[href], button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], h1, h2, [aria-current], [aria-selected=\"true\"]'\nconst MAX_CANDIDATES = 200\nconst ROOT_VARIABLES = ['--primary', '--color-primary', '--accent', '--color-accent', '--brand']\n\n/** Reads any CSS colour the browser understands (`oklch()`, `color-mix()`, names) as sRGB. */\nfunction createColorReader(doc: Document): (css: string) => Rgba | null {\n\tconst context = doc.createElement('canvas').getContext('2d', { willReadFrequently: true })\n\treturn (css) => {\n\t\tif (!context || !css || css === 'transparent') return null\n\t\tcontext.clearRect(0, 0, 1, 1)\n\t\t// An invalid colour leaves the previous fill style, so set a known one first.\n\t\tcontext.fillStyle = '#000'\n\t\tcontext.fillStyle = css\n\t\tcontext.fillRect(0, 0, 1, 1)\n\t\tconst [r, g, b, a] = context.getImageData(0, 0, 1, 1).data\n\t\treturn { r, g, b, a: a / 255 }\n\t}\n}\n\nexport interface SiteAppearance {\n\t/** The site's strongest colour as a CSS colour, or null when it has none. */\n\taccent: string | null\n\t/** Whether the page background is dark. */\n\tdark: boolean\n}\n\n/**\n * Samples the colours of the page's links, buttons and headings, its `accent-color`, its theme\n * colour and common theme variables. It reads computed styles of at most a couple of hundred\n * elements and changes nothing.\n */\nexport function detectSiteAppearance(doc: Document = document): SiteAppearance {\n\tconst view = doc.defaultView\n\tif (!view) return { accent: null, dark: false }\n\tconst read = createColorReader(doc)\n\tconst samples: ColorSample[] = []\n\tconst add = (css: string | null | undefined, weight: number) => {\n\t\tconst color = css ? read(css) : null\n\t\tif (color) samples.push({ color, weight })\n\t}\n\n\tconst rootStyle = view.getComputedStyle(doc.documentElement)\n\tif (rootStyle.accentColor && rootStyle.accentColor !== 'auto') add(rootStyle.accentColor, 8)\n\tadd(doc.querySelector<HTMLMetaElement>('meta[name=\"theme-color\"]')?.content, 6)\n\tfor (const name of ROOT_VARIABLES) add(rootStyle.getPropertyValue(name).trim(), 6)\n\n\tlet seen = 0\n\tfor (const element of doc.querySelectorAll(CANDIDATES)) {\n\t\tif (seen >= MAX_CANDIDATES) break\n\t\t// The agent's own interface is not the site.\n\t\tif (element.closest('[data-page-agent-ignore]')) continue\n\t\tconst rect = element.getBoundingClientRect()\n\t\tif (rect.width === 0 || rect.height === 0) continue\n\t\tseen++\n\t\tconst style = view.getComputedStyle(element)\n\t\tadd(style.backgroundColor, Math.min(12, Math.max(1, (rect.width * rect.height) / 2000)))\n\t\tadd(style.color, element.localName === 'a' ? 2 : 1)\n\t\tif (style.borderTopWidth !== '0px') add(style.borderTopColor, 0.5)\n\t}\n\n\tlet background: Rgba | null = null\n\tfor (const element of [doc.body, doc.documentElement]) {\n\t\tconst color = element ? read(view.getComputedStyle(element).backgroundColor) : null\n\t\tif (color && color.a > 0.5) {\n\t\t\tbackground = color\n\t\t\tbreak\n\t\t}\n\t}\n\n\tconst accent = pickStrongestColor(samples)\n\treturn {\n\t\taccent: accent ? `rgb(${accent.r} ${accent.g} ${accent.b})` : null,\n\t\tdark: background ? luminance(background) < 0.35 : false,\n\t}\n}\n",".wrapper {\n\tposition: fixed;\n\tinset: 0;\n\tz-index: 2147483641; /* 确保在所有元素之上,除了 panel */\n\tcursor: wait;\n\toverflow: hidden;\n\n\tdisplay: none;\n}\n\n.wrapper.visible {\n\tdisplay: block;\n}\n\n/* The site's strongest colour, with the previous accent as the fallback for a site without one. */\n.wrapper {\n\t--pa-glow: var(--pa-accent, #fa8d45);\n\t--pa-glow-ring: 50%;\n\t--pa-glow-near: 16%;\n\t--pa-glow-far: 6%;\n}\n\n/* A colour shows more against a dark page, so it needs less. */\n.wrapper[data-theme='dark'] {\n\t--pa-glow-ring: 42%;\n\t--pa-glow-near: 13%;\n\t--pa-glow-far: 5%;\n}\n\n.glow {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.4s ease;\n\t/* Same shape as before; the colour comes from the site (set by SimulatorMask) and is kept faint,\n\t so the glow reads as a focus ring of the site itself rather than as a foreign frame. */\n\tbox-shadow:\n\t\tinset 0 0 0 2px color-mix(in srgb, var(--pa-glow) var(--pa-glow-ring), transparent),\n\t\tinset 0 0 42px 8px color-mix(in srgb, var(--pa-glow) var(--pa-glow-near), transparent),\n\t\tinset 0 0 100px 22px color-mix(in srgb, var(--pa-glow) var(--pa-glow-far), transparent);\n}\n\n.glowVisible {\n\topacity: 1;\n}\n\n/* Progress bar shown while the page is being read. Reading blocks the page's main thread, so the bar\n moves with transform only: the browser's compositor keeps it going while scripts cannot run. */\n.progress {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\theight: 3px;\n\toverflow: hidden;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.3s ease;\n\tbackground: color-mix(in srgb, var(--pa-glow) 14%, transparent);\n}\n\n.progressActive {\n\topacity: 1;\n\t/* The synchronous page read can block the first transition frame. */\n\ttransition-duration: 0s;\n}\n\n.progressBar {\n\tposition: absolute;\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\twidth: 45%;\n\tborder-radius: 3px;\n\ttransform: translateX(-110%);\n\twill-change: transform;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\ttransparent,\n\t\tcolor-mix(in srgb, var(--pa-glow) 85%, transparent) 35%,\n\t\tcolor-mix(in srgb, var(--pa-glow) 60%, white) 65%,\n\t\ttransparent\n\t);\n\tfilter: drop-shadow(0 0 6px color-mix(in srgb, var(--pa-glow) 70%, transparent));\n}\n\n.progressBarLate {\n\twidth: 25%;\n}\n\n.progressActive .progressBar {\n\tanimation: progressSlide 1.25s cubic-bezier(0.45, 0, 0.25, 1) infinite;\n}\n\n.progressActive .progressBarLate {\n\tanimation-duration: 1.25s;\n\tanimation-delay: 0.5s;\n\tanimation-timing-function: cubic-bezier(0.3, 0, 0.6, 1);\n}\n\n@keyframes progressSlide {\n\tfrom {\n\t\ttransform: translateX(-110%);\n\t}\n\tto {\n\t\ttransform: translateX(330%);\n\t}\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.glow {\n\t\ttransition: none;\n\t}\n\n\t/* A steady bar instead of a moving one. */\n\t.progressActive .progressBar {\n\t\tanimation: none;\n\t\twidth: 100%;\n\t\ttransform: none;\n\t\topacity: 0.6;\n\t}\n\n\t.progressActive .progressBarLate {\n\t\tdisplay: none;\n\t}\n}\n","/* AI 光标样式 */\n.cursor {\n\tposition: absolute;\n\twidth: var(--cursor-size, 21px);\n\theight: var(--cursor-size, 25px);\n\tpointer-events: none;\n\tz-index: 10000;\n\tbackground: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath d='M3 2v20l5.5-5 3.9 8 3-1.5-4-7.8L19 15z' fill='%23f28a46' stroke='%23171715' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E\")\n\t\tcenter / contain no-repeat;\n\tfilter: drop-shadow(0 2px 2px #0005);\n}\n\n.cursorFilling,\n.cursorBorder {\n\tdisplay: none;\n}\n\n.cursorBorder {\n\tposition: absolute;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));\n\tmask-image: url(./cursor-border.svg);\n\tmask-size: 100% 100%;\n\tmask-repeat: no-repeat;\n\n\ttransform-origin: center;\n\ttransform: rotate(-135deg) scale(1.2);\n\tmargin-left: -10px;\n\tmargin-top: -18px;\n}\n\n.cursorFilling {\n\tposition: absolute;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: url(./cursor-fill.svg);\n\tbackground-size: 100% 100%;\n\tbackground-repeat: no-repeat;\n\n\ttransform-origin: center;\n\ttransform: rotate(-135deg) scale(1.2);\n\tmargin-left: -10px;\n\tmargin-top: -18px;\n}\n\n.cursorRipple {\n\tposition: absolute;\n\twidth: 100%;\n\theight: 100%;\n\tpointer-events: none;\n\tmargin-left: -50%;\n\tmargin-top: -50%;\n\n\t&::after {\n\t\tcontent: '';\n\t\topacity: 0;\n\t\tposition: absolute;\n\t\tinset: 0;\n\t\tborder: 4px solid rgba(57, 182, 255, 1);\n\t\tborder-radius: 50%;\n\t}\n}\n\n.cursor.clicking .cursorRipple::after {\n\tanimation: cursor-ripple 300ms ease-out forwards;\n}\n\n@keyframes cursor-ripple {\n\t0% {\n\t\ttransform: scale(0);\n\t\topacity: 1;\n\t}\n\t100% {\n\t\ttransform: scale(2);\n\t\topacity: 0;\n\t}\n}\n\n/* Panel button \"Hide agent cursor\": only the drawing disappears; the run continues. */\n:global(html[data-pa-cursor-hidden]) .cursor {\n\tdisplay: none !important;\n}\n","import { detectSiteAppearance } from './siteColor'\n\nimport styles from './SimulatorMask.module.css'\nimport cursorStyles from './cursor.module.css'\n\nexport class SimulatorMask extends EventTarget {\n\tshown: boolean = false\n\twrapper = document.createElement('div')\n\tglow = document.createElement('div')\n\t/** Bar at the top edge, moving while the page is being read. */\n\tprogress = document.createElement('div')\n\n\t#disposed = false\n\n\t#cursor = document.createElement('div')\n\n\t#currentCursorX = 0\n\t#currentCursorY = 0\n\n\t#targetCursorX = 0\n\t#targetCursorY = 0\n\n\tconstructor() {\n\t\tsuper()\n\n\t\tthis.wrapper.id = 'page-agent-runtime_simulator-mask'\n\t\tthis.wrapper.className = styles.wrapper\n\t\tthis.wrapper.setAttribute('data-browser-use-ignore', 'true')\n\t\tthis.wrapper.setAttribute('data-page-agent-ignore', 'true')\n\n\t\t// Transparent edge glow marking the page under agent control. No fill; it never blocks pointer events.\n\t\tthis.glow.className = styles.glow\n\t\tthis.wrapper.appendChild(this.glow)\n\n\t\tthis.progress.className = styles.progress\n\t\tfor (const className of [\n\t\t\tstyles.progressBar,\n\t\t\t`${styles.progressBar} ${styles.progressBarLate}`,\n\t\t]) {\n\t\t\tconst bar = document.createElement('div')\n\t\t\tbar.className = className\n\t\t\tthis.progress.appendChild(bar)\n\t\t}\n\t\tthis.wrapper.appendChild(this.progress)\n\n\t\t// Capture all mouse, keyboard, and wheel events\n\t\tthis.wrapper.addEventListener('click', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('mousedown', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('mouseup', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('mousemove', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('wheel', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('keydown', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\t\tthis.wrapper.addEventListener('keyup', (e) => {\n\t\t\te.stopPropagation()\n\t\t\te.preventDefault()\n\t\t})\n\n\t\t// Create AI cursor\n\t\tthis.#createCursor()\n\t\t// this.show()\n\n\t\tdocument.body.appendChild(this.wrapper)\n\n\t\tthis.#moveCursorToTarget()\n\n\t\t// global events\n\t\t// @note Mask should be isolated from the rest of the code.\n\t\t// Global events are easier to manage and cleanup.\n\n\t\tconst movePointerToListener = (event: Event) => {\n\t\t\tconst { x, y } = (event as CustomEvent).detail\n\t\t\tthis.setCursorPosition(x, y)\n\t\t}\n\t\tconst clickPointerListener = () => {\n\t\t\tthis.triggerClickAnimation()\n\t\t}\n\t\tconst enablePassThroughListener = () => {\n\t\t\tthis.wrapper.style.pointerEvents = 'none'\n\t\t}\n\t\tconst disablePassThroughListener = () => {\n\t\t\tthis.wrapper.style.pointerEvents = 'auto'\n\t\t}\n\n\t\twindow.addEventListener('PageAgent::MovePointerTo', movePointerToListener)\n\t\twindow.addEventListener('PageAgent::ClickPointer', clickPointerListener)\n\t\twindow.addEventListener('PageAgent::EnablePassThrough', enablePassThroughListener)\n\t\twindow.addEventListener('PageAgent::DisablePassThrough', disablePassThroughListener)\n\n\t\tthis.addEventListener('dispose', () => {\n\t\t\twindow.removeEventListener('PageAgent::MovePointerTo', movePointerToListener)\n\t\t\twindow.removeEventListener('PageAgent::ClickPointer', clickPointerListener)\n\t\t\twindow.removeEventListener('PageAgent::EnablePassThrough', enablePassThroughListener)\n\t\t\twindow.removeEventListener('PageAgent::DisablePassThrough', disablePassThroughListener)\n\t\t})\n\t}\n\n\t#createCursor() {\n\t\tthis.#cursor.className = cursorStyles.cursor\n\n\t\t// Create ripple effect container\n\t\tconst rippleContainer = document.createElement('div')\n\t\trippleContainer.className = cursorStyles.cursorRipple\n\t\tthis.#cursor.appendChild(rippleContainer)\n\n\t\t// Create filling layer\n\t\tconst fillingLayer = document.createElement('div')\n\t\tfillingLayer.className = cursorStyles.cursorFilling\n\t\tthis.#cursor.appendChild(fillingLayer)\n\n\t\t// Create border layer\n\t\tconst borderLayer = document.createElement('div')\n\t\tborderLayer.className = cursorStyles.cursorBorder\n\t\tthis.#cursor.appendChild(borderLayer)\n\n\t\tthis.wrapper.appendChild(this.#cursor)\n\t}\n\n\t#moveCursorToTarget() {\n\t\tif (this.#disposed) return\n\n\t\tconst newX = this.#currentCursorX + (this.#targetCursorX - this.#currentCursorX) * 0.2\n\t\tconst newY = this.#currentCursorY + (this.#targetCursorY - this.#currentCursorY) * 0.2\n\n\t\tconst xDistance = Math.abs(newX - this.#targetCursorX)\n\t\tif (xDistance > 0) {\n\t\t\tif (xDistance < 2) {\n\t\t\t\tthis.#currentCursorX = this.#targetCursorX\n\t\t\t} else {\n\t\t\t\tthis.#currentCursorX = newX\n\t\t\t}\n\t\t\tthis.#cursor.style.left = `${this.#currentCursorX}px`\n\t\t}\n\n\t\tconst yDistance = Math.abs(newY - this.#targetCursorY)\n\t\tif (yDistance > 0) {\n\t\t\tif (yDistance < 2) {\n\t\t\t\tthis.#currentCursorY = this.#targetCursorY\n\t\t\t} else {\n\t\t\t\tthis.#currentCursorY = newY\n\t\t\t}\n\t\t\tthis.#cursor.style.top = `${this.#currentCursorY}px`\n\t\t}\n\n\t\trequestAnimationFrame(() => this.#moveCursorToTarget())\n\t}\n\n\tsetCursorPosition(x: number, y: number) {\n\t\tif (this.#disposed) return\n\n\t\tthis.#targetCursorX = x\n\t\tthis.#targetCursorY = y\n\t}\n\n\ttriggerClickAnimation() {\n\t\tif (this.#disposed) return\n\n\t\tthis.#cursor.classList.remove(cursorStyles.clicking)\n\t\t// Force reflow to restart animation\n\t\tthis.#cursor.getBoundingClientRect()\n\t\tthis.#cursor.classList.add(cursorStyles.clicking)\n\t}\n\n\t/**\n\t * Takes the glow and progress colour from the site: its strongest colour, fainter on a dark page.\n\t * Read again on every show, because a site can change theme between tasks.\n\t */\n\t#adaptToSite() {\n\t\ttry {\n\t\t\tconst { accent, dark } = detectSiteAppearance()\n\t\t\tif (accent) this.wrapper.style.setProperty('--pa-glow', accent)\n\t\t\telse this.wrapper.style.removeProperty('--pa-glow')\n\t\t\tthis.wrapper.dataset.theme = dark ? 'dark' : 'light'\n\t\t} catch (error) {\n\t\t\t// The default colour stays. A cosmetic reading must never stop a task.\n\t\t\tconsole.warn('[SimulatorMask] could not read the site colours', error)\n\t\t}\n\t}\n\n\t/**\n\t * Starts the progress bar and resolves once the browser has drawn it. Call it right before work\n\t * that blocks the page: from then on the bar keeps moving on its own.\n\t */\n\tasync startProgress(): Promise<void> {\n\t\tif (!this.shown || this.#disposed) return\n\t\tthis.progress.classList.add(styles.progressActive)\n\t\t// Two frames: one to apply the style, one for the animation to reach the compositor. The timer\n\t\t// is for a tab in the background, where frames are not produced.\n\t\tawait Promise.race([\n\t\t\tnew Promise<void>((resolve) =>\n\t\t\t\trequestAnimationFrame(() => requestAnimationFrame(() => resolve()))\n\t\t\t),\n\t\t\tnew Promise<void>((resolve) => setTimeout(resolve, 80)),\n\t\t])\n\t}\n\n\tstopProgress(): void {\n\t\tthis.progress.classList.remove(styles.progressActive)\n\t}\n\n\tshow() {\n\t\tif (this.shown || this.#disposed) return\n\n\t\tthis.#adaptToSite()\n\t\tthis.shown = true\n\t\tthis.glow.classList.add(styles.glowVisible)\n\n\t\tthis.wrapper.classList.add(styles.visible)\n\n\t\t// Initialize cursor position\n\t\tthis.#currentCursorX = window.innerWidth / 2\n\t\tthis.#currentCursorY = window.innerHeight / 2\n\t\tthis.#targetCursorX = this.#currentCursorX\n\t\tthis.#targetCursorY = this.#currentCursorY\n\t\tthis.#cursor.style.left = `${this.#currentCursorX}px`\n\t\tthis.#cursor.style.top = `${this.#currentCursorY}px`\n\t}\n\n\thide() {\n\t\tif (!this.shown || this.#disposed) return\n\n\t\tthis.shown = false\n\t\tthis.glow.classList.remove(styles.glowVisible)\n\n\t\tthis.#cursor.classList.remove(cursorStyles.clicking)\n\n\t\tsetTimeout(() => {\n\t\t\tthis.wrapper.classList.remove(styles.visible)\n\t\t}, 800) // Match the animation duration\n\t}\n\n\tdispose() {\n\t\tthis.#disposed = true\n\t\tthis.wrapper.remove()\n\t\tthis.dispatchEvent(new Event('dispose'))\n\t}\n}\n"],"mappings":";;;AAoBA,SAAgB,OAAO,EAAE,GAAG,GAAG,KAAmB;CACjD,OAAO,KAAK,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,IAAI,GAAG,GAAG,CAAC;AAC5C;;AAGA,SAAgB,UAAU,EAAE,GAAG,GAAG,KAAmB;CACpD,MAAM,WAAW,UAAkB;EAClC,MAAM,IAAI,QAAQ;EAClB,OAAO,KAAK,SAAU,IAAI,UAAU,IAAI,QAAS,UAAU;CAC5D;CACA,OAAO,QAAS,QAAQ,CAAC,IAAI,QAAS,QAAQ,CAAC,IAAI,QAAS,QAAQ,CAAC;AACtE;AAEA,IAAM,aAAa;AACnB,IAAM,YAAY;;;;;;AAOlB,SAAgB,mBAAmB,SAAqC;CACvE,MAAM,wBAAQ,IAAI,IAGhB;CACF,KAAK,MAAM,EAAE,OAAO,YAAY,SAAS;EACxC,IAAI,UAAU,KAAK,MAAM,IAAI,aAAa,OAAO,KAAK,IAAI,YAAY;EACtE,MAAM,MAAQ,MAAM,KAAK,KAAM,IAAO,MAAM,KAAK,KAAM,IAAM,MAAM,KAAK;EACxE,MAAM,OAAO,MAAM,IAAI,GAAG,KAAK;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAG,GAAG;GAAG,GAAG;EAAE;EACvE,KAAK,SAAS,UAAU,OAAO,KAAK,IAAI;EACxC,KAAK,UAAU;EACf,KAAK,KAAK,MAAM,IAAI;EACpB,KAAK,KAAK,MAAM,IAAI;EACpB,KAAK,KAAK,MAAM,IAAI;EACpB,MAAM,IAAI,KAAK,IAAI;CACpB;CACA,IAAI,OAAkF;CACtF,KAAK,MAAM,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ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qB;EACpB,KAAK,SAAS,UAAU,OAAO,6BAAO,cAAc;CACrD;CAEA,OAAO;EACN,IAAI,KAAK,SAAS,KAAK,WAAW;EAElC,KAAK,aAAa;EAClB,KAAK,QAAQ;EACb,KAAK,KAAK,UAAU,IAAI,6BAAO,WAAW;EAE1C,KAAK,QAAQ,UAAU,IAAI,6BAAO,OAAO;EAGzC,KAAK,kBAAkB,OAAO,aAAa;EAC3C,KAAK,kBAAkB,OAAO,cAAc;EAC5C,KAAK,iBAAiB,KAAK;EAC3B,KAAK,iBAAiB,KAAK;EAC3B,KAAK,QAAQ,MAAM,OAAO,GAAG,KAAK,gBAAgB;EAClD,KAAK,QAAQ,MAAM,MAAM,GAAG,KAAK,gBAAgB;CAClD;CAEA,OAAO;EACN,IAAI,CAAC,KAAK,SAAS,KAAK,WAAW;EAEnC,KAAK,QAAQ;EACb,KAAK,KAAK,UAAU,OAAO,6BAAO,WAAW;EAE7C,KAAK,QAAQ,UAAU,OAAO,sBAAa,QAAQ;EAEnD,iBAAiB;GAChB,KAAK,QAAQ,UAAU,OAAO,6BAAO,OAAO;EAC7C,GAAG,GAAG;CACP;CAEA,UAAU;EACT,KAAK,YAAY;EACjB,KAAK,QAAQ,OAAO;EACpB,KAAK,cAAc,IAAI,MAAM,SAAS,CAAC;CACxC;AACD"}
@@ -2160,8 +2160,21 @@ function createPageAgent({ document: doc = globalThis.document, maxNodes = 5e4,
2160
2160
  function click(request) {
2161
2161
  const element = resolve(request);
2162
2162
  checkClickTarget(element);
2163
- if (typeof element.click !== "function") throw new Error("unsupported: target cannot be clicked");
2164
- element.click();
2163
+ let target = element;
2164
+ if (element.getAttribute("role")?.trim().toLowerCase() === "option") {
2165
+ const buttons = [...element.querySelectorAll("button")];
2166
+ if (buttons.length === 1) {
2167
+ target = buttons[0];
2168
+ const actionName = (target.getAttribute("aria-label") || target.getAttribute("title") || target.textContent || "").trim().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2169
+ const optionName = (element.getAttribute("aria-label") || element.textContent || "").trim().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2170
+ if (!actionName || !optionName.includes(actionName) || /^(delete|remove|excluir|deletar|apagar|remover|logout|log ?out|sign out|sair da conta|send|enviar|pay|pagar|publish|publicar)\b/.test(actionName)) throw new Error("blocked: nested option action needs an explicit target");
2171
+ checkUsable(target, doc);
2172
+ checkClickTarget(target);
2173
+ if (resolve(request) !== element || !element.contains(target)) throw new Error("stale_node: option target changed");
2174
+ }
2175
+ }
2176
+ if (typeof target.click !== "function") throw new Error("unsupported: target cannot be clicked");
2177
+ target.click();
2165
2178
  return {
2166
2179
  dispatched: true,
2167
2180
  trusted: false
@@ -2919,4 +2932,4 @@ function createPageAgent({ document: doc = globalThis.document, maxNodes = 5e4,
2919
2932
  //#endregion
2920
2933
  export { createPageAgent };
2921
2934
 
2922
- //# sourceMappingURL=ax-core-oj-p6gBY.js.map
2935
+ //# sourceMappingURL=ax-core-BVXEU2Dk.js.map