autokap 1.0.6 → 1.0.8

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 (347) hide show
  1. package/assets/chrome/ios-statusbar-comparison-reference.jpg +0 -0
  2. package/assets/chrome/ios-statusbar-dark-reference.jpg +0 -0
  3. package/assets/chrome/ios-statusbar-light-reference.jpg +0 -0
  4. package/assets/cursors/macos.svg +4 -0
  5. package/assets/cursors/windows.svg +15 -0
  6. package/assets/devices/ipad-pro-11-m4.json +52 -0
  7. package/assets/devices/iphone-16-pro.json +53 -0
  8. package/assets/devices/macbook-air-13.json +45 -0
  9. package/assets/frames/MacBook Air 13.svg +242 -0
  10. package/assets/frames/Status bar - iPhone.png +0 -0
  11. Menu bar- iPad.png +0 -0
  12. package/assets/frames/iPad Pro M4 11_.png +0 -0
  13. package/assets/frames/iPhone 16 Pro.png +0 -0
  14. package/assets/icons/Cellular Connection.svg +3 -0
  15. package/assets/icons/Union.svg +6 -0
  16. package/assets/icons/Wifi.svg +3 -0
  17. package/assets/icons/battery.svg +5 -0
  18. package/assets/icons/battery_charging.svg +8 -0
  19. package/assets/skill/OPCODE-REFERENCE.md +607 -0
  20. package/assets/skill/README.md +39 -0
  21. package/assets/skill/SKILL.md +453 -468
  22. package/assets/skill/STUDIO-SKILL.md +476 -0
  23. package/assets/skill/references/examples.md +104 -0
  24. package/assets/skill/references/interactive-demo.md +225 -0
  25. package/assets/skill/references/mock-data.md +178 -0
  26. package/dist/abort.d.ts +5 -0
  27. package/dist/abort.js +44 -0
  28. package/dist/action-verifier.d.ts +29 -0
  29. package/dist/action-verifier.js +133 -0
  30. package/dist/agent-action-recovery.d.ts +45 -0
  31. package/dist/agent-action-recovery.js +370 -0
  32. package/dist/agent-message-utils.d.ts +21 -0
  33. package/dist/agent-message-utils.js +77 -0
  34. package/dist/agent-url-utils.d.ts +30 -0
  35. package/dist/agent-url-utils.js +138 -0
  36. package/dist/agent.d.ts +226 -0
  37. package/dist/agent.js +6666 -0
  38. package/dist/ak-tree.d.ts +39 -0
  39. package/dist/ak-tree.js +368 -0
  40. package/dist/alt-text.d.ts +26 -0
  41. package/dist/alt-text.js +55 -0
  42. package/dist/auth-capture.d.ts +17 -0
  43. package/dist/auth-capture.js +164 -0
  44. package/dist/benchmark.d.ts +59 -0
  45. package/dist/benchmark.js +135 -0
  46. package/dist/billing-operation-logging.d.ts +38 -0
  47. package/dist/billing-operation-logging.js +248 -0
  48. package/dist/browser-bar.d.ts +48 -0
  49. package/dist/browser-bar.js +284 -0
  50. package/dist/browser-pool.d.ts +7 -0
  51. package/dist/browser-pool.js +15 -5
  52. package/dist/browser-utils.d.ts +31 -0
  53. package/dist/browser-utils.js +97 -0
  54. package/dist/browser.d.ts +76 -1
  55. package/dist/browser.js +1657 -39
  56. package/dist/capture-alt-text.d.ts +12 -0
  57. package/dist/capture-alt-text.js +52 -0
  58. package/dist/capture-encryption.d.ts +10 -0
  59. package/dist/capture-encryption.js +41 -0
  60. package/dist/capture-language-preflight.d.ts +41 -0
  61. package/dist/capture-language-preflight.js +300 -0
  62. package/dist/capture-llm-page-identity.d.ts +15 -0
  63. package/dist/capture-llm-page-identity.js +128 -0
  64. package/dist/capture-model-resolution.d.ts +9 -0
  65. package/dist/capture-model-resolution.js +21 -0
  66. package/dist/capture-page-identity.d.ts +7 -0
  67. package/dist/capture-page-identity.js +352 -0
  68. package/dist/capture-preset-credentials.d.ts +62 -0
  69. package/dist/capture-preset-credentials.js +184 -0
  70. package/dist/capture-request-plan.d.ts +58 -0
  71. package/dist/capture-request-plan.js +264 -0
  72. package/dist/capture-run-optimizer.d.ts +139 -0
  73. package/dist/capture-run-optimizer.js +863 -0
  74. package/dist/capture-selector-memory.d.ts +31 -0
  75. package/dist/capture-selector-memory.js +345 -0
  76. package/dist/capture-session-profile-encryption.d.ts +2 -0
  77. package/dist/capture-session-profile-encryption.js +22 -0
  78. package/dist/capture-step-timeout.d.ts +10 -0
  79. package/dist/capture-step-timeout.js +30 -0
  80. package/dist/capture-strategy.d.ts +36 -0
  81. package/dist/capture-strategy.js +95 -0
  82. package/dist/capture-studio-sync.d.ts +23 -0
  83. package/dist/capture-studio-sync.js +172 -0
  84. package/dist/capture-surface-contract.d.ts +36 -0
  85. package/dist/capture-surface-contract.js +299 -0
  86. package/dist/capture-transition-engine.d.ts +28 -0
  87. package/dist/capture-transition-engine.js +292 -0
  88. package/dist/capture-variant-state.d.ts +56 -0
  89. package/dist/capture-variant-state.js +182 -0
  90. package/dist/capture-verification.d.ts +35 -0
  91. package/dist/capture-verification.js +95 -0
  92. package/dist/capture-viewport-lock.d.ts +48 -0
  93. package/dist/capture-viewport-lock.js +74 -0
  94. package/dist/circuit-breaker.d.ts +42 -0
  95. package/dist/circuit-breaker.js +119 -0
  96. package/dist/cli-config.d.ts +8 -1
  97. package/dist/cli-config.js +62 -6
  98. package/dist/cli-contract.d.ts +15 -0
  99. package/dist/cli-contract.js +167 -0
  100. package/dist/cli-runner-local.d.ts +12 -0
  101. package/dist/cli-runner-local.js +102 -0
  102. package/dist/cli-runner.d.ts +34 -0
  103. package/dist/cli-runner.js +433 -0
  104. package/dist/cli-utils.d.ts +0 -1
  105. package/dist/cli-utils.js +2 -5
  106. package/dist/cli.js +1005 -252
  107. package/dist/clip-orchestrator.d.ts +148 -0
  108. package/dist/clip-orchestrator.js +957 -0
  109. package/dist/clip-postprocess.d.ts +42 -0
  110. package/dist/clip-postprocess.js +201 -0
  111. package/dist/cookie-dismiss.d.ts +2 -0
  112. package/dist/cookie-dismiss.js +48 -13
  113. package/dist/cost-logging.d.ts +35 -0
  114. package/dist/cost-logging.js +242 -0
  115. package/dist/cost-resolution-monitor.d.ts +16 -0
  116. package/dist/cost-resolution-monitor.js +34 -0
  117. package/dist/credential-templates.d.ts +5 -0
  118. package/dist/credential-templates.js +60 -0
  119. package/dist/cursor-overlay-script.d.ts +6 -0
  120. package/dist/cursor-overlay-script.js +169 -0
  121. package/dist/dom-css-purger.d.ts +65 -0
  122. package/dist/dom-css-purger.js +333 -0
  123. package/dist/dom-font-inliner.d.ts +45 -0
  124. package/dist/dom-font-inliner.js +148 -0
  125. package/dist/dom-patch-resolver.d.ts +52 -0
  126. package/dist/dom-patch-resolver.js +242 -0
  127. package/dist/dom-serializer.d.ts +82 -0
  128. package/dist/dom-serializer.js +378 -0
  129. package/dist/element-capture.d.ts +13 -0
  130. package/dist/element-capture.js +522 -0
  131. package/dist/env-validation.d.ts +5 -0
  132. package/dist/env-validation.js +29 -0
  133. package/dist/execution-schema.d.ts +4423 -0
  134. package/dist/execution-schema.js +507 -0
  135. package/dist/execution-types.d.ts +886 -0
  136. package/dist/execution-types.js +65 -0
  137. package/dist/fonts-loader.d.ts +14 -0
  138. package/dist/fonts-loader.js +55 -0
  139. package/dist/hybrid-navigator.d.ts +138 -0
  140. package/dist/hybrid-navigator.js +468 -0
  141. package/dist/index.d.ts +18 -0
  142. package/dist/index.js +17 -0
  143. package/dist/legacy/agent-action-recovery.d.ts +45 -0
  144. package/dist/legacy/agent-action-recovery.js +370 -0
  145. package/dist/legacy/agent-message-utils.d.ts +21 -0
  146. package/dist/legacy/agent-message-utils.js +77 -0
  147. package/dist/legacy/agent-url-utils.d.ts +30 -0
  148. package/dist/legacy/agent-url-utils.js +138 -0
  149. package/dist/legacy/agent.d.ts +226 -0
  150. package/dist/legacy/agent.js +6666 -0
  151. package/dist/legacy/clip-orchestrator.d.ts +148 -0
  152. package/dist/legacy/clip-orchestrator.js +957 -0
  153. package/dist/legacy/credential-templates.d.ts +5 -0
  154. package/dist/legacy/credential-templates.js +60 -0
  155. package/dist/legacy/hybrid-navigator.d.ts +138 -0
  156. package/dist/legacy/hybrid-navigator.js +468 -0
  157. package/dist/legacy/llm-usage.d.ts +17 -0
  158. package/dist/legacy/llm-usage.js +45 -0
  159. package/dist/legacy/prompt-cache.d.ts +10 -0
  160. package/dist/legacy/prompt-cache.js +24 -0
  161. package/dist/legacy/prompts.d.ts +175 -0
  162. package/dist/legacy/prompts.js +1038 -0
  163. package/dist/legacy/tools.d.ts +4 -0
  164. package/dist/legacy/tools.js +216 -0
  165. package/dist/legacy/video-agent.d.ts +143 -0
  166. package/dist/legacy/video-agent.js +4788 -0
  167. package/dist/legacy/video-observation.d.ts +36 -0
  168. package/dist/legacy/video-observation.js +192 -0
  169. package/dist/legacy/video-planner.d.ts +12 -0
  170. package/dist/legacy/video-planner.js +501 -0
  171. package/dist/legacy/video-prompts.d.ts +37 -0
  172. package/dist/legacy/video-prompts.js +569 -0
  173. package/dist/legacy/video-tools.d.ts +3 -0
  174. package/dist/legacy/video-tools.js +59 -0
  175. package/dist/legacy/video-variant-state.d.ts +29 -0
  176. package/dist/legacy/video-variant-state.js +80 -0
  177. package/dist/legacy/vision-model.d.ts +17 -0
  178. package/dist/legacy/vision-model.js +74 -0
  179. package/dist/llm-healer.d.ts +63 -0
  180. package/dist/llm-healer.js +166 -0
  181. package/dist/llm-provider.d.ts +29 -0
  182. package/dist/llm-provider.js +80 -0
  183. package/dist/llm-usage.d.ts +17 -0
  184. package/dist/llm-usage.js +45 -0
  185. package/dist/logger.d.ts +6 -2
  186. package/dist/logger.js +15 -1
  187. package/dist/mockup-html.d.ts +119 -0
  188. package/dist/mockup-html.js +263 -0
  189. package/dist/mockup.d.ts +187 -0
  190. package/dist/mockup.js +869 -0
  191. package/dist/mouse-animation.d.ts +46 -0
  192. package/dist/mouse-animation.js +114 -0
  193. package/dist/opcode-actions.d.ts +42 -0
  194. package/dist/opcode-actions.js +511 -0
  195. package/dist/opcode-runner.d.ts +51 -0
  196. package/dist/opcode-runner.js +770 -0
  197. package/dist/openrouter-client.d.ts +40 -0
  198. package/dist/openrouter-client.js +16 -0
  199. package/dist/overlay-engine.d.ts +24 -0
  200. package/dist/overlay-engine.js +176 -0
  201. package/dist/overlay-utils.d.ts +14 -0
  202. package/dist/overlay-utils.js +13 -0
  203. package/dist/postcondition.d.ts +16 -0
  204. package/dist/postcondition.js +269 -0
  205. package/dist/posthog.d.ts +4 -0
  206. package/dist/posthog.js +26 -0
  207. package/dist/program-patcher.d.ts +25 -0
  208. package/dist/program-patcher.js +44 -0
  209. package/dist/prompt-cache.d.ts +10 -0
  210. package/dist/prompt-cache.js +24 -0
  211. package/dist/prompts.d.ts +175 -0
  212. package/dist/prompts.js +1038 -0
  213. package/dist/provider-config.d.ts +12 -0
  214. package/dist/provider-config.js +15 -0
  215. package/dist/recovery-chain.d.ts +37 -0
  216. package/dist/recovery-chain.js +350 -0
  217. package/dist/remote-browser.d.ts +215 -0
  218. package/dist/remote-browser.js +360 -0
  219. package/dist/safari-browser-bar.d.ts +15 -0
  220. package/dist/safari-browser-bar.js +95 -0
  221. package/dist/safari-toolbar-asset.d.ts +15 -0
  222. package/dist/safari-toolbar-asset.js +12 -0
  223. package/dist/security.d.ts +21 -0
  224. package/dist/security.js +608 -0
  225. package/dist/selector-resolver.d.ts +34 -0
  226. package/dist/selector-resolver.js +181 -0
  227. package/dist/semantic-resolver.d.ts +35 -0
  228. package/dist/semantic-resolver.js +161 -0
  229. package/dist/server-capture-runtime.d.ts +125 -0
  230. package/dist/server-capture-runtime.js +585 -0
  231. package/dist/server-credit-usage.d.ts +12 -0
  232. package/dist/server-credit-usage.js +41 -0
  233. package/dist/server-posthog.d.ts +2 -0
  234. package/dist/server-posthog.js +16 -0
  235. package/dist/server-project-webhooks.d.ts +59 -0
  236. package/dist/server-project-webhooks.js +123 -0
  237. package/dist/server-screenshot-watermark.d.ts +7 -0
  238. package/dist/server-screenshot-watermark.js +60 -0
  239. package/dist/session-profile.d.ts +86 -0
  240. package/dist/session-profile.js +1536 -0
  241. package/dist/sf-pro-fonts.d.ts +4 -0
  242. package/dist/sf-pro-fonts.js +7 -0
  243. package/dist/sf-pro-symbols.d.ts +1 -0
  244. package/dist/sf-pro-symbols.js +55 -0
  245. package/dist/skill-packaging.d.ts +28 -0
  246. package/dist/skill-packaging.js +169 -0
  247. package/dist/smart-wait.d.ts +27 -0
  248. package/dist/smart-wait.js +81 -0
  249. package/dist/status-bar-l10n.d.ts +14 -0
  250. package/dist/status-bar-l10n.js +177 -0
  251. package/dist/status-bar-render.d.ts +20 -0
  252. package/dist/status-bar-render.js +410 -0
  253. package/dist/status-bar.d.ts +53 -0
  254. package/dist/status-bar.js +620 -0
  255. package/dist/svg-browser-bar.d.ts +33 -0
  256. package/dist/svg-browser-bar.js +206 -0
  257. package/dist/svg-status-bar.d.ts +36 -0
  258. package/dist/svg-status-bar.js +597 -0
  259. package/dist/svg-text.d.ts +61 -0
  260. package/dist/svg-text.js +118 -0
  261. package/dist/tools.d.ts +4 -0
  262. package/dist/tools.js +216 -0
  263. package/dist/types.d.ts +240 -5
  264. package/dist/types.js +23 -1
  265. package/dist/v2/action-verifier.d.ts +29 -0
  266. package/dist/v2/action-verifier.js +133 -0
  267. package/dist/v2/alt-text.d.ts +26 -0
  268. package/dist/v2/alt-text.js +55 -0
  269. package/dist/v2/benchmark.d.ts +59 -0
  270. package/dist/v2/benchmark.js +135 -0
  271. package/dist/v2/capture-strategy.d.ts +30 -0
  272. package/dist/v2/capture-strategy.js +67 -0
  273. package/dist/v2/capture-verification.d.ts +35 -0
  274. package/dist/v2/capture-verification.js +95 -0
  275. package/dist/v2/circuit-breaker.d.ts +42 -0
  276. package/dist/v2/circuit-breaker.js +119 -0
  277. package/dist/v2/cli-runner-local.d.ts +11 -0
  278. package/dist/v2/cli-runner-local.js +91 -0
  279. package/dist/v2/cli-runner.d.ts +34 -0
  280. package/dist/v2/cli-runner.js +300 -0
  281. package/dist/v2/compiler-prompts.d.ts +27 -0
  282. package/dist/v2/compiler-prompts.js +123 -0
  283. package/dist/v2/compiler.d.ts +37 -0
  284. package/dist/v2/compiler.js +147 -0
  285. package/dist/v2/explorer.d.ts +41 -0
  286. package/dist/v2/explorer.js +56 -0
  287. package/dist/v2/index.d.ts +37 -0
  288. package/dist/v2/index.js +31 -0
  289. package/dist/v2/llm-healer.d.ts +62 -0
  290. package/dist/v2/llm-healer.js +166 -0
  291. package/dist/v2/llm-provider.d.ts +29 -0
  292. package/dist/v2/llm-provider.js +80 -0
  293. package/dist/v2/opcode-runner.d.ts +47 -0
  294. package/dist/v2/opcode-runner.js +634 -0
  295. package/dist/v2/overlay-engine.d.ts +24 -0
  296. package/dist/v2/overlay-engine.js +150 -0
  297. package/dist/v2/postcondition.d.ts +16 -0
  298. package/dist/v2/postcondition.js +249 -0
  299. package/dist/v2/program-patcher.d.ts +25 -0
  300. package/dist/v2/program-patcher.js +44 -0
  301. package/dist/v2/recovery-chain.d.ts +30 -0
  302. package/dist/v2/recovery-chain.js +368 -0
  303. package/dist/v2/schema.d.ts +2580 -0
  304. package/dist/v2/schema.js +295 -0
  305. package/dist/v2/selector-resolver.d.ts +34 -0
  306. package/dist/v2/selector-resolver.js +181 -0
  307. package/dist/v2/semantic-resolver.d.ts +35 -0
  308. package/dist/v2/semantic-resolver.js +161 -0
  309. package/dist/v2/smart-wait.d.ts +27 -0
  310. package/dist/v2/smart-wait.js +81 -0
  311. package/dist/v2/types.d.ts +444 -0
  312. package/dist/v2/types.js +19 -0
  313. package/dist/v2/web-playwright-local.d.ts +69 -0
  314. package/dist/v2/web-playwright-local.js +392 -0
  315. package/dist/version.d.ts +1 -0
  316. package/dist/version.js +5 -0
  317. package/dist/video-agent.d.ts +143 -0
  318. package/dist/video-agent.js +4788 -0
  319. package/dist/video-observation.d.ts +36 -0
  320. package/dist/video-observation.js +192 -0
  321. package/dist/video-planner.d.ts +12 -0
  322. package/dist/video-planner.js +501 -0
  323. package/dist/video-prompts.d.ts +37 -0
  324. package/dist/video-prompts.js +554 -0
  325. package/dist/video-tools.d.ts +3 -0
  326. package/dist/video-tools.js +59 -0
  327. package/dist/video-variant-state.d.ts +29 -0
  328. package/dist/video-variant-state.js +80 -0
  329. package/dist/vision-model.d.ts +17 -0
  330. package/dist/vision-model.js +74 -0
  331. package/dist/web-playwright-local.d.ts +126 -0
  332. package/dist/web-playwright-local.js +819 -0
  333. package/dist/ws-auth.d.ts +20 -0
  334. package/dist/ws-auth.js +70 -0
  335. package/dist/ws-broadcast.d.ts +34 -0
  336. package/dist/ws-broadcast.js +85 -0
  337. package/dist/ws-connection-limits.d.ts +12 -0
  338. package/dist/ws-connection-limits.js +44 -0
  339. package/dist/ws-handler-utils.d.ts +32 -0
  340. package/dist/ws-handler-utils.js +139 -0
  341. package/dist/ws-handler.d.ts +10 -0
  342. package/dist/ws-handler.js +1793 -0
  343. package/dist/ws-metrics-server.d.ts +9 -0
  344. package/dist/ws-metrics-server.js +31 -0
  345. package/dist/ws-server.d.ts +9 -0
  346. package/dist/ws-server.js +92 -0
  347. package/package.json +142 -71
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Native SVG Chrome browser bar generator (no Playwright).
3
+ *
4
+ * Mirrors `generateBrowserBarHtml` in src/browser-bar.ts pixel for pixel.
5
+ * The original wraps an inline `<svg>` in a CSS-scaled `<div>` with HTML
6
+ * overlays for the page title, URL, and favicon. This module produces a
7
+ * single self-contained SVG at the final output pixel dimensions, with text
8
+ * rendered as native `<path>` via fontkit and an optional embedded favicon
9
+ * as `<image href="data:...">`.
10
+ */
11
+ import type { BrowserBarConfig } from './browser-bar.js';
12
+ export interface BrowserBarSvgOptions {
13
+ config: BrowserBarConfig;
14
+ /** Logical width (CSS pixels). */
15
+ width: number;
16
+ /** Logical height (CSS pixels). */
17
+ height: number;
18
+ /**
19
+ * Output pixel scale. The SVG's `viewBox` is set to the internal Chrome
20
+ * reference coordinate system; the SVG's `width`/`height` attributes are
21
+ * set to logical * pixelScale so librsvg rasterizes at output resolution.
22
+ */
23
+ pixelScale?: number;
24
+ /**
25
+ * Optional pre-fetched favicon, encoded as a `data:image/...;base64,...`
26
+ * URI. The caller is responsible for fetching the URL and converting it
27
+ * (mockup.ts handles this in the Sharp pipeline). When absent, the default
28
+ * grey globe icon is used.
29
+ */
30
+ tabIconDataUri?: string;
31
+ }
32
+ /** Generate a complete `<svg>` document for the Chrome browser bar. */
33
+ export declare function generateBrowserBarSvg(opts: BrowserBarSvgOptions): string;
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Native SVG Chrome browser bar generator (no Playwright).
3
+ *
4
+ * Mirrors `generateBrowserBarHtml` in src/browser-bar.ts pixel for pixel.
5
+ * The original wraps an inline `<svg>` in a CSS-scaled `<div>` with HTML
6
+ * overlays for the page title, URL, and favicon. This module produces a
7
+ * single self-contained SVG at the final output pixel dimensions, with text
8
+ * rendered as native `<path>` via fontkit and an optional embedded favicon
9
+ * as `<image href="data:...">`.
10
+ */
11
+ import { layoutText, measureText, } from './svg-text.js';
12
+ // ── Reference geometry (matches src/browser-bar.ts) ────────────────────
13
+ const REF_W = 2160;
14
+ const REF_H = 129;
15
+ const TAB_OVERFLOW_MR = 51;
16
+ const ADDR_BAR_ML = 174;
17
+ const ADDR_BAR_MR = 126;
18
+ const PROFILE_MR = 102;
19
+ const EAR_R_MR = 16.5;
20
+ // Title text box (matches the HTML overlay div)
21
+ const TITLE_LEFT = 187;
22
+ const TITLE_TOP = 15;
23
+ const TITLE_WIDTH = 260;
24
+ const TITLE_HEIGHT = 30;
25
+ const TITLE_FONT_SIZE = 18;
26
+ // URL text box
27
+ const URL_TOP = 69;
28
+ const URL_HEIGHT = 51;
29
+ const URL_FONT_SIZE = 19.5;
30
+ const URL_LEFT_OFFSET = 58; // from ADDR_BAR_ML
31
+ const URL_RIGHT_INSET = 18; // matches the HTML right calculation
32
+ const FAVICON_LEFT = 152;
33
+ const FAVICON_TOP = 18;
34
+ const FAVICON_BOX = 24;
35
+ const FAVICON_INNER = 21;
36
+ const TITLE_FONT = 'text-regular';
37
+ const URL_FONT = 'text-regular';
38
+ /** Generate a complete `<svg>` document for the Chrome browser bar. */
39
+ export function generateBrowserBarSvg(opts) {
40
+ const { width, height, config } = opts;
41
+ const ps = opts.pixelScale ?? 1;
42
+ const isDark = config.colorScheme === 'dark';
43
+ const title = config.pageTitle || 'New Tab';
44
+ const rawUrl = config.url || 'example.com';
45
+ const url = rawUrl.replace(/^https?:\/\//, '').replace(/\/$/, '');
46
+ // Derived layout: scale + dynamic right-anchored elements at the reference
47
+ // viewBox (the final SVG width is set on the outer <svg> element so the
48
+ // browser/librsvg renders at the requested pixel size).
49
+ const s = height / REF_H;
50
+ const iw = Math.round(width / s); // internal width at reference scale
51
+ const tabOverflowX = iw - TAB_OVERFLOW_MR;
52
+ const addrBarW = iw - ADDR_BAR_ML - ADDR_BAR_MR;
53
+ const profileX = iw - PROFILE_MR;
54
+ const earRX = iw - EAR_R_MR;
55
+ const dx = iw - REF_W;
56
+ // Color tokens (mirror the HTML)
57
+ const tabStripBg = isDark ? '#1F2020' : '#DEDEDE';
58
+ const tabBg = isDark ? '#3C3C3C' : '#FFFFFF';
59
+ const toolbarBg = isDark ? '#3C3C3C' : '#FFFFFF';
60
+ const addrBarBg = isDark ? '#282828' : '#F1F1F1';
61
+ const addrIconBg = isDark ? '#3C3C3C' : '#FFFFFF';
62
+ const borderColor = isDark ? '#454746' : '#CFCFCF';
63
+ const textColor = isDark ? '#E3E3E3' : '#1D1D1D';
64
+ const textSec = isDark ? '#C7C7C7' : '#5F6368';
65
+ const iconActive = isDark ? '#C7C7C7' : '#5F6368';
66
+ const iconDis = isDark ? '#7B7B7B' : '#BBBFC4';
67
+ // ── Tab strip + traffic lights + tab shape ─────────────────────────
68
+ const tabStrip = `
69
+ <g>
70
+ <rect width="${iw}" height="60" fill="${tabStripBg}"/>
71
+ <circle cx="40.5" cy="30.75" r="9" fill="#EC6A5E"/>
72
+ <circle cx="40.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
73
+ <circle cx="70.5" cy="30.75" r="9" fill="#F4BF4F"/>
74
+ <circle cx="70.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
75
+ <circle cx="100.5" cy="30.75" r="9" fill="#61C554"/>
76
+ <circle cx="100.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
77
+ <path d="M120 60C129.941 60 138 51.9411 138 42V60H120Z" fill="${tabBg}"/>
78
+ <path d="M138 24C138 15.7157 144.716 9 153 9H471C479.284 9 486 15.7157 486 24V60H138V24Z" fill="${tabBg}"/>
79
+ <path d="M457.668 35.5689L456.431 34.3314L460.762 30.0001L456.431 25.6689L457.668 24.4314L461.999 28.7626L466.331 24.4314L467.568 25.6689L463.237 30.0001L467.568 34.3314L466.331 35.5689L461.999 31.2376L457.668 35.5689Z" fill="${textColor}"/>
80
+ <path d="M504 60C494.059 60 486 51.9411 486 42V60H504Z" fill="${tabBg}"/>
81
+ <path d="M513.327 31.1749H506.877V28.8249H513.327V22.3499H515.677V28.8249H522.152V31.1749H515.677V37.6249H513.327V31.1749Z" fill="${iconActive}"/>
82
+ <rect x="${tabOverflowX}" y="9" width="42" height="42" rx="15" fill="${tabBg}"/>
83
+ <path d="M${tabOverflowX + 21} 33.95L${tabOverflowX + 14.4} 27.35L${tabOverflowX + 16.07} 25.675L${tabOverflowX + 21} 30.625L${tabOverflowX + 25.92} 25.7L${tabOverflowX + 27.6} 27.375L${tabOverflowX + 21} 33.95Z" fill="${textColor}"/>
84
+ </g>`;
85
+ const bottomEars = `
86
+ <path d="M16.5 60C7.3873 60 0 67.3873 0 76.5V60H16.5Z" fill="${tabStripBg}"/>
87
+ <path d="M${earRX} 60C${earRX + 9.11} 60 ${iw} 67.3873 ${iw} 76.5V60H${earRX}Z" fill="${tabStripBg}"/>`;
88
+ // ── Toolbar (back, forward, reload, address bar pill, sliders icon) ─
89
+ const toolbar = `
90
+ <g clip-path="url(#bb_clip_toolbar)">
91
+ <path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z" fill="${toolbarBg}"/>
92
+ <path d="M28.3125 95.625L34.5938 101.906L33 103.5L24 94.5L33 85.5L34.5938 87.0938L28.3125 93.375H42V95.625H28.3125Z" fill="${iconDis}"/>
93
+ <path d="M91.6875 95.625L85.4062 101.906L87 103.5L96 94.5L87 85.5L85.4062 87.0938L91.6875 93.375H78V95.625H91.6875Z" fill="${iconDis}"/>
94
+ <path d="M141 103.5C138.5 103.5 136.375 102.625 134.625 100.875C132.875 99.125 132 97 132 94.5C132 92 132.875 89.875 134.625 88.125C136.375 86.375 138.5 85.5 141 85.5C142.354 85.5 143.609 85.7812 144.766 86.3438C145.922 86.9062 146.917 87.6562 147.75 88.5938V85.5H150V93H142.5V90.75H146.594C145.99 89.8333 145.198 89.1042 144.219 88.5625C143.24 88.0208 142.167 87.75 141 87.75C139.125 87.75 137.531 88.4062 136.219 89.7188C134.906 91.0312 134.25 92.625 134.25 94.5C134.25 96.375 134.906 97.9688 136.219 99.2812C137.531 100.594 139.125 101.25 141 101.25C142.75 101.25 144.25 100.672 145.5 99.5156C146.75 98.3594 147.469 96.9375 147.656 95.25H149.969C149.781 97.5833 148.833 99.5417 147.125 101.125C145.417 102.708 143.375 103.5 141 103.5Z" fill="${iconActive}"/>
95
+ <rect x="${ADDR_BAR_ML}" y="69" width="${addrBarW}" height="51" rx="25.5" fill="${addrBarBg}"/>
96
+ <rect x="${ADDR_BAR_ML + 7.5}" y="76.5" width="36" height="36" rx="18" fill="${addrIconBg}"/>
97
+ <g transform="translate(${ADDR_BAR_ML + 16.5},${76.5 + 9}) scale(1.5)">
98
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M9.5 6.70898C10.8806 6.70898 11.9998 7.82848 12 9.20898C12 10.5897 10.8807 11.709 9.5 11.709C8.11929 11.709 7 10.5897 7 9.20898C7.00024 7.82848 8.11944 6.70898 9.5 6.70898ZM9.5 8.20898C8.94786 8.20898 8.50024 8.6569 8.5 9.20898C8.5 9.76127 8.94772 10.209 9.5 10.209C10.0523 10.209 10.5 9.76127 10.5 9.20898C10.4998 8.6569 10.0521 8.20898 9.5 8.20898Z" fill="${iconActive}"/>
99
+ <path d="M6 10H0V8.5H6V10Z" fill="${iconActive}"/>
100
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 0C3.88071 0 5 1.11929 5 2.5C5 3.88071 3.88071 5 2.5 5C1.11929 5 0 3.88071 0 2.5C0 1.11929 1.11929 0 2.5 0ZM2.5 1.5C1.94772 1.5 1.5 1.94772 1.5 2.5C1.5 3.05228 1.94772 3.5 2.5 3.5C3.05228 3.5 3.5 3.05228 3.5 2.5C3.5 1.94772 3.05228 1.5 2.5 1.5Z" fill="${iconActive}"/>
101
+ <path d="M12 3.20898H6V1.70898H12V3.20898Z" fill="${iconActive}"/>
102
+ </g>
103
+ <path transform="translate(${dx},0)" d="M1994 100.344L1998 97.9688L2002.03 100.344L2000.97 95.8438L2004.44 92.875L1999.84 92.4688L1998 88.1875L1996.16 92.4688L1991.56 92.875L1995.06 95.8438L1994 100.344ZM1990.59 105L1992.56 96.6875L1986 91.0938L1994.62 90.3438L1998 82.5L2001.38 90.375L2010 91.0938L2003.44 96.6875L2005.41 105L1998 100.594L1990.59 105Z" fill="${iconActive}"/>
104
+ <rect x="${profileX}" y="79.5" width="30" height="30" rx="15" fill="url(#bb_profile_grad)"/>
105
+ <rect x="${profileX + 0.75}" y="80.25" width="28.5" height="28.5" rx="14.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
106
+ <path transform="translate(${dx},0)" d="M2127 105.404C2126.38 105.404 2125.85 105.183 2125.41 104.743C2124.97 104.302 2124.75 103.773 2124.75 103.154C2124.75 102.535 2124.97 102.005 2125.41 101.565C2125.85 101.124 2126.38 100.904 2127 100.904C2127.62 100.904 2128.15 101.124 2128.59 101.565C2129.03 102.005 2129.25 102.535 2129.25 103.154C2129.25 103.773 2129.03 104.302 2128.59 104.743C2128.15 105.183 2127.62 105.404 2127 105.404ZM2127 96.7499C2126.38 96.7499 2125.85 96.5296 2125.41 96.089C2124.97 95.6484 2124.75 95.1187 2124.75 94.5C2124.75 93.8812 2124.97 93.3516 2125.41 92.9109C2125.85 92.4703 2126.38 92.25 2127 92.25C2127.62 92.25 2128.15 92.4703 2128.59 92.9109C2129.03 93.3516 2129.25 93.8812 2129.25 94.5C2129.25 95.1187 2129.03 95.6484 2128.59 96.089C2128.15 96.5296 2127.62 96.7499 2127 96.7499ZM2127 88.0961C2126.38 88.0961 2125.85 87.8758 2125.41 87.4351C2124.97 86.9945 2124.75 86.4649 2124.75 85.8461C2124.75 85.2274 2124.97 84.6977 2125.41 84.2571C2125.85 83.8165 2126.38 83.5962 2127 83.5962C2127.62 83.5962 2128.15 83.8165 2128.59 84.2571C2129.03 84.6977 2129.25 85.2274 2129.25 85.8461C2129.25 86.4649 2129.03 86.9945 2128.59 87.4351C2128.15 87.8758 2127.62 88.0961 2127 88.0961Z" fill="${iconActive}"/>
107
+ </g>`;
108
+ const toolbarBorder = `<path d="M0 60H${iw}H0M${iw} 130.5H0V127.5H${iw}V130.5ZM${iw} 127.5M0 129V60V129M0 129M${iw} 60V129V60" fill="${borderColor}" mask="url(#bb_mask_toolbar)"/>`;
109
+ // ── Title text (centered vertically in TITLE_HEIGHT box) ────────────
110
+ const titleEllipsized = ellipsizeText(title, TITLE_FONT, TITLE_FONT_SIZE, TITLE_WIDTH);
111
+ const titleMeasure = measureText({ text: titleEllipsized, fontId: TITLE_FONT, fontSize: TITLE_FONT_SIZE });
112
+ const titleBaselineY = TITLE_TOP + (TITLE_HEIGHT + TITLE_FONT_SIZE * 0.7) / 2;
113
+ const titleLayout = layoutText({
114
+ text: titleEllipsized,
115
+ fontId: TITLE_FONT,
116
+ fontSize: TITLE_FONT_SIZE,
117
+ x: TITLE_LEFT,
118
+ baselineY: titleBaselineY,
119
+ });
120
+ void titleMeasure;
121
+ const titleSvg = `<path d="${titleLayout.pathData}" fill="${textColor}"/>`;
122
+ // ── URL text (vertically centered in URL_HEIGHT box) ────────────────
123
+ const urlLeft = ADDR_BAR_ML + URL_LEFT_OFFSET;
124
+ const urlBoxWidth = ADDR_BAR_ML + addrBarW - URL_RIGHT_INSET - urlLeft;
125
+ const urlEllipsized = ellipsizeText(url, URL_FONT, URL_FONT_SIZE, urlBoxWidth);
126
+ const urlBaselineY = URL_TOP + (URL_HEIGHT + URL_FONT_SIZE * 0.7) / 2;
127
+ const urlLayout = layoutText({
128
+ text: urlEllipsized,
129
+ fontId: URL_FONT,
130
+ fontSize: URL_FONT_SIZE,
131
+ x: urlLeft,
132
+ baselineY: urlBaselineY,
133
+ });
134
+ const urlSvg = `<path d="${urlLayout.pathData}" fill="${textSec}"/>`;
135
+ // ── Favicon (embedded image or default globe) ───────────────────────
136
+ let faviconSvg;
137
+ const innerOffset = (FAVICON_BOX - FAVICON_INNER) / 2;
138
+ if (opts.tabIconDataUri) {
139
+ // <image> with data URI — librsvg supports this. The original HTML uses
140
+ // border-radius:4px + object-fit:contain on a 21×21 img. SVG <image>
141
+ // honors preserveAspectRatio (default xMidYMid meet ≈ contain) and we
142
+ // clip to a rounded rect via clipPath.
143
+ faviconSvg = `<g clip-path="url(#bb_clip_favicon)"><image href="${escapeAttr(opts.tabIconDataUri)}" x="${FAVICON_LEFT + innerOffset}" y="${FAVICON_TOP + innerOffset}" width="${FAVICON_INNER}" height="${FAVICON_INNER}" preserveAspectRatio="xMidYMid meet"/></g>`;
144
+ }
145
+ else {
146
+ // Default grey globe (matches the HTML fallback exactly)
147
+ const cx = FAVICON_LEFT + FAVICON_BOX / 2;
148
+ const cy = FAVICON_TOP + FAVICON_BOX / 2;
149
+ faviconSvg = `<g transform="translate(${cx - 10.5},${cy - 10.5}) scale(${21 / 16})"><circle cx="8" cy="8" r="6.5" fill="none" stroke="${iconActive}" stroke-width="1.2"/><ellipse cx="8" cy="8" rx="3" ry="6.5" fill="none" stroke="${iconActive}" stroke-width="1.2"/><line x1="1.5" y1="8" x2="14.5" y2="8" stroke="${iconActive}" stroke-width="1.2"/></g>`;
150
+ }
151
+ // ── <defs> ──────────────────────────────────────────────────────────
152
+ const defs = `
153
+ <defs>
154
+ <linearGradient id="bb_profile_grad" x1="${profileX + 15}" y1="109.5" x2="${profileX + 15}" y2="79.5" gradientUnits="userSpaceOnUse">
155
+ <stop stop-color="#D5D8E4"/>
156
+ <stop offset="0.45" stop-color="#D1CAD6"/>
157
+ <stop offset="1" stop-color="#B7BAD1"/>
158
+ </linearGradient>
159
+ <mask id="bb_mask_toolbar" fill="white">
160
+ <path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z"/>
161
+ </mask>
162
+ <clipPath id="bb_clip_toolbar">
163
+ <path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z"/>
164
+ </clipPath>
165
+ <clipPath id="bb_clip_favicon">
166
+ <rect x="${FAVICON_LEFT + innerOffset}" y="${FAVICON_TOP + innerOffset}" width="${FAVICON_INNER}" height="${FAVICON_INNER}" rx="4" ry="4"/>
167
+ </clipPath>
168
+ </defs>`;
169
+ const outW = Math.round(width * ps);
170
+ const outH = Math.round(height * ps);
171
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${outW}" height="${outH}" viewBox="0 0 ${iw} ${REF_H}" shape-rendering="geometricPrecision" text-rendering="geometricPrecision">
172
+ ${tabStrip}
173
+ ${bottomEars}
174
+ ${toolbar}
175
+ ${toolbarBorder}
176
+ ${faviconSvg}
177
+ ${titleSvg}
178
+ ${urlSvg}
179
+ ${defs}
180
+ </svg>`;
181
+ }
182
+ // ── Helpers ────────────────────────────────────────────────────────────
183
+ function ellipsizeText(text, fontId, fontSize, maxW) {
184
+ if (maxW <= 0)
185
+ return '';
186
+ const measured = measureText({ text, fontId, fontSize });
187
+ if (measured.width <= maxW)
188
+ return text;
189
+ let lo = 0;
190
+ let hi = text.length;
191
+ while (lo < hi) {
192
+ const mid = (lo + hi + 1) >> 1;
193
+ const candidate = `${text.slice(0, mid)}…`;
194
+ if (measureText({ text: candidate, fontId, fontSize }).width <= maxW) {
195
+ lo = mid;
196
+ }
197
+ else {
198
+ hi = mid - 1;
199
+ }
200
+ }
201
+ return lo === 0 ? '…' : `${text.slice(0, lo)}…`;
202
+ }
203
+ function escapeAttr(s) {
204
+ return s.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;');
205
+ }
206
+ //# sourceMappingURL=svg-browser-bar.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Native SVG status bar generator (no Playwright).
3
+ *
4
+ * Mirrors `generateStatusBarHtml` in src/status-bar.ts pixel for pixel, but
5
+ * emits a self-contained SVG document instead of HTML/CSS. The SVG is meant
6
+ * to be rasterized via Sharp inside applyDeviceFrameSharp.
7
+ *
8
+ * Layout strategy:
9
+ * - Each status bar variant translates its flexbox layout into explicit
10
+ * positioning math: text widths come from svg-text.measureText, icons
11
+ * have known viewBox dimensions.
12
+ * - Icons are inlined as `<path>` elements re-using the exact same path
13
+ * data Apple ships in iOS status bar SVG assets (signal/wifi/battery).
14
+ * - Text is converted to native `<path>` via svg-text.layoutText so the
15
+ * SVG is fully self-contained and font-installation independent.
16
+ */
17
+ import type { StatusBarConfig, StatusBarLayout, StatusBarDeviceType } from './status-bar.js';
18
+ export interface StatusBarSvgOptions {
19
+ config: StatusBarConfig;
20
+ /** Logical width (CSS pixels). Matches the screen rect's logical width. */
21
+ width: number;
22
+ /** Logical height (CSS pixels). Matches the status-bar logical height. */
23
+ height: number;
24
+ scale: number;
25
+ deviceType: StatusBarDeviceType;
26
+ layout?: StatusBarLayout;
27
+ /**
28
+ * Output pixel scale. The SVG's `viewBox` is set to logical coordinates so
29
+ * the layout math is identical to the Playwright HTML pipeline; the SVG's
30
+ * `width`/`height` attributes are set to logical * pixelScale so librsvg
31
+ * rasterizes at the requested output resolution. Defaults to 1.
32
+ */
33
+ pixelScale?: number;
34
+ }
35
+ /** Generate a complete `<svg>` document for the requested status bar variant. */
36
+ export declare function generateStatusBarSvg(opts: StatusBarSvgOptions): string;