failproofai 0.0.11-beta.8 → 0.0.11

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 (239) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/standalone/.next/build-manifest.json +6 -6
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/required-server-files.json +1 -1
  6. package/.next/standalone/.next/routes-manifest.json +6 -0
  7. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
  8. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  9. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  10. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  14. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  15. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  16. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  17. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
  19. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  20. package/.next/standalone/.next/server/app/_not-found/page.js +2 -2
  21. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  24. package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
  25. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  26. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  27. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  28. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  29. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  30. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  31. package/.next/standalone/.next/server/app/api/audit/invite/route/app-paths-manifest.json +3 -0
  32. package/.next/standalone/.next/server/app/api/audit/invite/route/build-manifest.json +9 -0
  33. package/.next/standalone/.next/server/app/api/audit/invite/route/server-reference-manifest.json +4 -0
  34. package/.next/standalone/.next/server/app/api/audit/invite/route.js +7 -0
  35. package/.next/standalone/.next/server/app/api/audit/invite/route.js.map +5 -0
  36. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -0
  37. package/.next/standalone/.next/server/app/api/audit/invite/route_client-reference-manifest.js +3 -0
  38. package/.next/standalone/.next/server/app/api/audit/run/route.js +1 -1
  39. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/auth/login-request/route.js +1 -1
  41. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +2 -2
  43. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/auth/logout/route.js +2 -2
  45. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/auth/reminder/route.js +2 -2
  47. package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/auth/status/route.js +2 -2
  49. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
  52. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  53. package/.next/standalone/.next/server/app/audit/page.js +2 -2
  54. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/app/index.html +1 -1
  57. package/.next/standalone/.next/server/app/index.rsc +15 -15
  58. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  59. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  60. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  61. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
  62. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  63. package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
  64. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  65. package/.next/standalone/.next/server/app/page.js +2 -2
  66. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
  69. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  70. package/.next/standalone/.next/server/app/policies/page.js +2 -2
  71. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
  74. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  75. package/.next/standalone/.next/server/app/project/[name]/page.js +3 -3
  76. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  78. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
  79. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  80. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  81. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +3 -3
  82. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
  85. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  86. package/.next/standalone/.next/server/app/projects/page.js +3 -3
  87. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  88. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  89. package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
  90. package/.next/standalone/.next/server/chunks/[externals]__1_g_b3t._.js +3 -0
  91. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dwpg-h._.js +3 -0
  92. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lnenda._.js +3 -0
  93. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13i_sva._.js +3 -0
  94. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1_mqemn._.js +1 -1
  95. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_audit_invite_route_actions_0-2n5sy.js +3 -0
  96. package/.next/standalone/.next/server/chunks/node_modules_0-tu4ot._.js +3 -0
  97. package/.next/standalone/.next/server/chunks/node_modules_0ttxbz7._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/node_modules_1bnh1y0._.js +3 -0
  99. package/.next/standalone/.next/server/chunks/node_modules_1epycqa._.js +3 -0
  100. package/.next/standalone/.next/server/chunks/node_modules_1wpdcgo._.js +3 -0
  101. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +3 -3
  102. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +1 -1
  104. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1d4gx_t._.js → [root-of-the-server]__00uwqi6._.js} +2 -2
  106. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0808sha._.js +4 -0
  107. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1cd25c7._.js → [root-of-the-server]__0e4-6d8._.js} +3 -3
  108. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ehe24g._.js +4 -0
  109. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1-scthx._.js → [root-of-the-server]__0f62vu9._.js} +2 -2
  110. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g253ve._.js +4 -0
  111. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0l13qf2._.js → [root-of-the-server]__0k65l27._.js} +1 -1
  112. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__15i0juc._.js → [root-of-the-server]__0kjb_s4._.js} +2 -2
  113. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vxf0_g._.js +4 -0
  114. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12mcauo._.js +4 -0
  115. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0989_dx._.js → [root-of-the-server]__1e-x7j4._.js} +2 -2
  116. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1mt35_w._.js +1 -1
  117. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pcxxwg._.js +2 -2
  118. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1uvfwgr._.js +4 -0
  119. package/.next/standalone/.next/server/chunks/ssr/_05whahf._.js +1 -1
  120. package/.next/standalone/.next/server/chunks/ssr/_0il3fl1._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +49 -21
  122. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  123. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
  124. package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_0ihmbv4.js +3 -0
  125. package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_1ao30b1.js +3 -0
  126. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +1 -1
  127. package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
  128. package/.next/standalone/.next/server/pages/404.html +1 -1
  129. package/.next/standalone/.next/server/pages/500.html +1 -1
  130. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/server-reference-manifest.json +10 -10
  132. package/.next/standalone/.next/static/chunks/{0d49wc5zca0u1.js → 02fywjt0by40a.js} +1 -1
  133. package/.next/standalone/.next/static/chunks/0f7d7hnbh4djs.js +1 -0
  134. package/.next/standalone/.next/static/chunks/0h7auy7hzjyhw.js +1 -0
  135. package/.next/standalone/.next/static/chunks/0xdx2ehtbdoeg.js +1 -0
  136. package/.next/standalone/.next/static/chunks/{1nd1e30h8s_mc.js → 1-a5rvq67k7ed.js} +1 -1
  137. package/.next/standalone/.next/static/chunks/{1m2yj97j7f_km.js → 15csyj1_rf0-w.js} +1 -1
  138. package/.next/standalone/.next/static/chunks/1o0xa47736gi9.css +2 -0
  139. package/.next/standalone/.next/static/chunks/24cv31x607n7k.js +1 -0
  140. package/.next/standalone/.next/static/chunks/{3w8d8k_dca5rp.js → 2h0dkzyy0vocp.js} +1 -1
  141. package/.next/standalone/.next/static/chunks/2n_s8v1ae38_a.js +69 -0
  142. package/.next/standalone/.next/static/chunks/2y-jmvrjxz60x.js +6 -0
  143. package/.next/standalone/.next/static/chunks/{24z-bgbisv379.js → 3eik_d9qrvoft.js} +1 -1
  144. package/.next/standalone/.next/static/chunks/3i27c3hcriawq.css +1 -0
  145. package/.next/standalone/.next/static/chunks/{0j969hb6nujdf.js → 3v61675vr6jav.js} +1 -1
  146. package/.next/standalone/.next/static/chunks/3zkg2s2vzxc3d.js +1 -0
  147. package/.next/standalone/.next/static/chunks/{turbopack-00qy7zfa7m--m.js → turbopack-3lrm4f20fz89b.js} +1 -1
  148. package/.next/standalone/app/api/audit/invite/route.ts +192 -0
  149. package/.next/standalone/app/api/audit/run/route.ts +35 -0
  150. package/.next/standalone/app/api/auth/login-request/route.ts +2 -2
  151. package/.next/standalone/app/api/auth/login-verify/route.ts +10 -2
  152. package/.next/standalone/app/audit/_components/audit-dashboard.tsx +39 -63
  153. package/.next/standalone/app/audit/_components/audit-poster.tsx +326 -0
  154. package/.next/standalone/app/audit/_components/auth-dialog.tsx +23 -49
  155. package/.next/standalone/app/audit/_components/come-back-better-section.tsx +336 -0
  156. package/.next/standalone/app/audit/_components/how-to-improve-section.tsx +187 -0
  157. package/.next/standalone/app/audit/_components/invite-dialog.tsx +230 -0
  158. package/.next/standalone/app/audit/_components/quirks-section.tsx +75 -0
  159. package/.next/standalone/app/audit/_components/share-templates.ts +63 -32
  160. package/.next/standalone/app/audit/_components/sigil.tsx +9 -66
  161. package/.next/standalone/app/audit/_components/strengths-section.tsx +20 -32
  162. package/.next/standalone/app/audit/audit-styles.css +778 -1786
  163. package/.next/standalone/app/components/sessions-list.tsx +77 -80
  164. package/.next/standalone/app/globals.css +241 -34
  165. package/.next/standalone/app/layout.tsx +1 -10
  166. package/.next/standalone/app/policies/hooks-client.tsx +45 -28
  167. package/.next/standalone/app/project/[name]/page.tsx +23 -79
  168. package/.next/standalone/app/projects/page.tsx +14 -23
  169. package/.next/standalone/assets/audit/poster-styles.css +1 -1
  170. package/.next/standalone/assets/audit/styles.css +11 -11
  171. package/.next/standalone/components/navbar.tsx +2 -37
  172. package/.next/standalone/components/reach-developers.tsx +10 -25
  173. package/.next/standalone/lib/auth/api-server-client.ts +28 -0
  174. package/.next/standalone/lib/client-telemetry.ts +4 -0
  175. package/.next/standalone/node_modules/@next/env/package.json +2 -2
  176. package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  177. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  178. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  179. package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
  180. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
  181. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  182. package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  183. package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
  184. package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  185. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  186. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  187. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  188. package/.next/standalone/node_modules/next/package.json +15 -15
  189. package/.next/standalone/package.json +19 -14
  190. package/.next/standalone/server.js +1 -1
  191. package/README.md +2 -2
  192. package/bin/failproofai.mjs +24 -5
  193. package/dist/cli.mjs +2328 -381
  194. package/lib/auth/api-server-client.ts +28 -0
  195. package/lib/client-telemetry.ts +4 -0
  196. package/package.json +19 -14
  197. package/scripts/launch.ts +30 -4
  198. package/scripts/postinstall.mjs +10 -1
  199. package/scripts/skew-log-filter.ts +46 -0
  200. package/scripts/validate-mdx.ts +139 -0
  201. package/src/audit/cli.ts +330 -0
  202. package/src/audit/open-browser.ts +69 -0
  203. package/src/audit/social-proof.ts +34 -0
  204. package/src/auth/cli.ts +16 -13
  205. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07tgnzi._.js +0 -3
  206. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0oeun7z._.js +0 -3
  207. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12pit4m._.js +0 -3
  208. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13ra2jq._.js +0 -3
  209. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1b9z5-i._.js +0 -3
  210. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ixjiy8._.js +0 -3
  211. package/.next/standalone/.next/server/chunks/_1-1804f._.js +0 -3
  212. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00jkjmt._.js +0 -4
  213. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013du6r._.js +0 -4
  214. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e85wxv._.js +0 -4
  215. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gfxvb1._.js +0 -3
  216. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1hlrq6y._.js +0 -4
  217. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ihxdo5._.js +0 -4
  218. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1vvfde2._.js +0 -4
  219. package/.next/standalone/.next/server/chunks/ssr/node_modules_html2canvas_dist_html2canvas_esm_1k58rb_.js +0 -3
  220. package/.next/standalone/.next/server/chunks/ssr/node_modules_html2canvas_dist_html2canvas_esm_1n-0xws.js +0 -3
  221. package/.next/standalone/.next/static/chunks/09ueq8s1as8xs.css +0 -2
  222. package/.next/standalone/.next/static/chunks/0qassxjx1ef04.js +0 -1
  223. package/.next/standalone/.next/static/chunks/0qxb5czqxe-vu.js +0 -1
  224. package/.next/standalone/.next/static/chunks/1dh06515j265n.js +0 -41
  225. package/.next/standalone/.next/static/chunks/29gs4efgi3hme.js +0 -6
  226. package/.next/standalone/.next/static/chunks/2mni177pnjx6u.js +0 -1
  227. package/.next/standalone/.next/static/chunks/2so39wg7mjbi7.js +0 -1
  228. package/.next/standalone/.next/static/chunks/3gti1qdk5epqn.js +0 -1
  229. package/.next/standalone/.next/static/chunks/3wycox197ouus.css +0 -1
  230. package/.next/standalone/app/audit/_components/findings-section.tsx +0 -135
  231. package/.next/standalone/app/audit/_components/identity-section.tsx +0 -126
  232. package/.next/standalone/app/audit/_components/policies-section.tsx +0 -194
  233. package/.next/standalone/app/audit/_components/return-section.tsx +0 -416
  234. package/.next/standalone/app/audit/_components/score-section.tsx +0 -179
  235. package/.next/standalone/app/audit/_components/share-dock.tsx +0 -265
  236. package/.next/standalone/app/audit/_components/show-off-cta.tsx +0 -135
  237. /package/.next/standalone/.next/static/{CVv2A0hMd24t0c0x3V-W_ → P_MIRSeoE296wkbE-Icin}/_buildManifest.js +0 -0
  238. /package/.next/standalone/.next/static/{CVv2A0hMd24t0c0x3V-W_ → P_MIRSeoE296wkbE-Icin}/_clientMiddlewareManifest.js +0 -0
  239. /package/.next/standalone/.next/static/{CVv2A0hMd24t0c0x3V-W_ → P_MIRSeoE296wkbE-Icin}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[3171,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(20039),e=a.i(66036);a.s(["default",0,function({error:a,reset:f}){return(0,c.useEffect)(()=>{(0,d.getTelemetryConfig)().then(b=>{(0,e.setClientTelemetryConfig)(b),(0,e.captureClientEvent)("client_error",{error_message:a.message,error_name:a.name,error_digest:a.digest,boundary:"global"})}).catch(()=>{})},[a]),(0,b.jsx)("html",{children:(0,b.jsx)("body",{children:(0,b.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,b.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,b.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,b.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:a.message||"An unexpected error occurred."}),(0,b.jsx)("button",{onClick:f,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])}];
1
+ module.exports=[3171,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(72850),e=a.i(66036);a.s(["default",0,function({error:a,reset:f}){return(0,c.useEffect)(()=>{(0,d.getTelemetryConfig)().then(b=>{(0,e.setClientTelemetryConfig)(b),(0,e.captureClientEvent)("client_error",{error_message:a.message,error_name:a.name,error_digest:a.digest,boundary:"global"})}).catch(()=>{})},[a]),(0,b.jsx)("html",{children:(0,b.jsx)("body",{children:(0,b.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,b.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,b.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,b.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:a.message||"An unexpected error occurred."}),(0,b.jsx)("button",{onClick:f,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])}];
2
2
 
3
3
  //# sourceMappingURL=app_global-error_tsx_1kp6l3x._.js.map
@@ -1,8 +1,8 @@
1
- module.exports=[22712,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(35112),e=a.i(38246),f=a.i(64831);let g=(0,f.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),h=(0,f.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),i=(0,f.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),j=(0,f.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var k=a.i(89027),l=a.i(85650),m=a.i(52562);let n=(0,f.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),o=(0,f.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var p=a.i(74215),q=a.i(65967),r=a.i(5050);let s=(0,r.createServerReference)("4079cb251c2f00dc122807c7d4b376ad5bc1371bce",r.callServer,void 0,r.findSourceMapURL,"getHookActivityAction"),t=(0,r.createServerReference)("606a4889f61ccd9b5bf043450be2048d403f2db686",r.callServer,void 0,r.findSourceMapURL,"searchHookActivityAction"),u=(0,r.createServerReference)("008a02610e1ab9e65b1bf57b2b4921af5ce307afc5",r.callServer,void 0,r.findSourceMapURL,"getHooksConfigAction"),v=(0,r.createServerReference)("60165c36b94bca8f799f9b2cdc3283828b4fdfe83f",r.callServer,void 0,r.findSourceMapURL,"togglePolicyAction"),w=(0,r.createServerReference)("60fd4c05a6ab5e462300b4306c38928ad36947c3f6",r.callServer,void 0,r.findSourceMapURL,"installHooksWebAction"),x=(0,r.createServerReference)("606e0d803bb5acc185ecc42ac00195b2e679c8c5aa",r.callServer,void 0,r.findSourceMapURL,"removeHooksWebAction"),y=(0,r.createServerReference)("6014215e177af476319cd8cfa7e895886d13f8714c",r.callServer,void 0,r.findSourceMapURL,"updatePolicyParamsAction");var z=a.i(6236),A=a.i(10765),B=a.i(90619),C=a.i(95947),D=a.i(87256),E=a.i(40695);function F({sessionId:a,transcriptPath:c,integration:d,cwd:f}){if(!a)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let g=a?a.slice(0,8):"—",h="codex"===d||(c?.includes("/.codex/")??!1),i="copilot"===d||(c?.includes("/.copilot/session-state/")??!1),j="cursor"===d||(c?.includes("/.cursor/")??!1),k="opencode"===d||(c?.includes("/.local/share/opencode/")??!1)||(c?.includes("/.opencode/")??!1),l="pi"===d||(c?.includes("/.pi/")??!1),m="gemini"===d||(c?.includes("/.gemini/")??!1);if(h||i||j||k||l||m){let c,d=f?(c=/^([A-Za-z]):[\\/](.*)$/.exec(f))?c[1]+"--"+c[2].replace(/[\\/]/g,"-"):f.replace(/[\\/]/g,"-"):h?"codex":i?"copilot":j?"cursor":k?"opencode":l?"pi":"gemini";return(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(d)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g})}let n=c?function(a){let b=a.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length<2)return null;let c=b[b.length-2];return!c||c.startsWith(".")?null:c}(c):null;return n?(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(n)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g}):(0,b.jsx)("span",{className:"text-muted-foreground font-mono",children:g})}function G({decision:a}){return"deny"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,b.jsx)(h,{className:"h-3 w-3"}),"Deny"]}):"instruct"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,b.jsx)(i,{className:"h-3 w-3"}),"Instruct"]}):(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,b.jsx)(g,{className:"h-3 w-3"}),"Allow"]})}function H({eventType:a}){return(0,b.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:a})}function I({integration:a}){if(!a)return null;let c=(0,D.getCliLabel)(a),d=(0,D.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${d}`,title:`Agent CLI: ${c}`,children:c})}function J({mode:a}){let c="default"===a;return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${c?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:a})}function K({ms:a}){return(0,b.jsx)("span",{className:`font-mono text-[0.7rem] ${a>500?"text-red-400":a>100?"text-amber-400":"text-muted-foreground"}`,children:a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`})}function L({text:a,field:d}){let[e,f]=(0,c.useState)(!1),{capture:g}=(0,A.usePostHog)(),h=async b=>{b.stopPropagation(),g("activity_copy_clicked",{field:d??"unknown"});try{await navigator.clipboard.writeText(a),f(!0),setTimeout(()=>f(!1),1500)}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),f(!0),setTimeout(()=>f(!1),1500)}};return(0,b.jsx)("button",{onClick:h,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:e?(0,b.jsx)(m.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(l.Copy,{className:"h-3 w-3"})})}function M({value:a,onChange:c}){return(0,b.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(d=>(0,b.jsx)("button",{onClick:()=>c(d.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${a===d.value?"deny"===d.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===d.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===d.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:d.label},d.value))})}function N({stats:a}){let c=a.totalEvents>0?a.denyCount/a.totalEvents*100:0,d=c.toFixed(c>=10?0:1),e=0===a.denyCount?"":c>=5?" is-deny":c>=2?" is-warn":"";return(0,b.jsxs)("div",{className:"stat-bar",role:"group","aria-label":"Activity stats",children:[(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"total events"}),(0,b.jsx)("span",{className:"value",children:a.totalEvents.toLocaleString()}),(0,b.jsx)("span",{className:"meta",children:"across all installed agents"})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"deny rate"}),(0,b.jsxs)("span",{className:`value${e}`,children:[d,"%"]}),(0,b.jsxs)("span",{className:"meta",children:[a.denyCount.toLocaleString()," of ",a.totalEvents.toLocaleString()," denied"]})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"top policy"}),(0,b.jsx)("span",{className:"value",style:{fontSize:16,fontWeight:500,color:a.topPolicy?"var(--accent-pink)":"var(--dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a.topPolicy??void 0,children:a.topPolicy??"—"}),(0,b.jsx)("span",{className:"meta",children:"most-evaluated policy in scope"})]})]})}function O({item:a}){return(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:11,className:"px-0 py-0",children:(0,b.jsxs)("div",{className:"activity-detail animate-expand text-xs",children:[(0,b.jsxs)("span",{className:"activity-detail-eyebrow",children:[(0,b.jsx)("span",{"aria-hidden":"true",children:"\\u25be"}),"event detail"]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.sessionId??"—"}),a.sessionId&&(0,b.jsx)(L,{text:a.sessionId,field:"session_id"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cwd??"—"}),a.cwd&&(0,b.jsx)(L,{text:a.cwd,field:"cwd"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,b.jsx)("span",{className:"font-mono text-foreground break-all",children:a.transcriptPath??"—"}),a.transcriptPath?.startsWith("opencode-db://")&&(0,b.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),a.policyNames&&a.policyNames.length>1&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.policyNames.join(", ")})]}),a.reason&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,b.jsx)("span",{className:"text-foreground",children:a.reason})]})]})})})}function P({hooksInstalled:a,onSwitchTab:d}){let{intervalSec:e}=(0,z.useAutoRefresh)(),{capture:f}=(0,A.usePostHog)(),g=(0,B.useUrlParams)(),h=(0,c.useRef)(!1),[i,l]=(0,c.useState)(()=>(0,C.paramToPage)(g.get("page"))),[m,n]=(0,c.useState)(null),[o,p]=(0,c.useState)(null),[r,u]=(0,c.useState)(()=>{let a=g.get("decision");return"allow"===a||"deny"===a||"instruct"===a?a:""}),[v,w]=(0,c.useState)(()=>g.get("event")??""),[x,y]=(0,c.useState)(()=>g.get("policy")??""),[E,L]=(0,c.useState)(()=>g.get("session")??""),[Q,R]=(0,c.useState)(()=>{let a=g.get("cli");return(0,D.isKnownCli)(a)?a:""}),S=(0,c.useRef)(null),T=(0,c.useRef)(!0),U=(0,c.useRef)({filterDecision:r,filterEventType:v,filterPolicy:x,filterSessionId:E,filterCli:Q});U.current={filterDecision:r,filterEventType:v,filterPolicy:x,filterSessionId:E,filterCli:Q},(0,c.useEffect)(()=>{if(!h.current){h.current=!0;return}g.setAll({decision:r||void 0,event:v||void 0,policy:x||void 0,session:E||void 0,cli:Q||void 0,page:(0,C.pageToParam)(i)})},[r,v,x,E,Q,i]);let V=""!==r||""!==v||""!==x||""!==E||""!==Q,W=(0,c.useCallback)(async a=>{try{let b,{filterDecision:c,filterEventType:d,filterPolicy:e,filterSessionId:f,filterCli:g}=U.current;b=""!==c||""!==d||""!==e||""!==f||""!==g?await t({decision:c||void 0,eventType:d||void 0,policyName:e||void 0,sessionId:f||void 0,integration:g||void 0},a):await s(a),n(b)}catch{}},[]);(0,c.useEffect)(()=>{W(i);let a=setInterval(()=>W(i),e>0?1e3*e:5e3);return()=>clearInterval(a)},[i,W,e]),(0,c.useEffect)(()=>(S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{if(l(1),p(null),W(1),T.current){T.current=!1;return}f("activity_filter_changed",{active_filter_count:+(""!==r)+ +(""!==v)+ +(""!==x)+ +(""!==E)+ +(""!==Q),has_decision:""!==r,has_event_type:""!==v,has_policy:""!==x,has_session:""!==E,has_cli:""!==Q,decision:r||null,event_type:v||null,cli:Q||null})},300),()=>{S.current&&clearTimeout(S.current)}),[r,v,x,E,Q]);let X=m?.entries??[],Y=m?.totalPages??1;return(0,b.jsxs)(b.Fragment,{children:[m?.stats&&m.stats.totalEvents>0&&(0,b.jsx)("div",{style:{marginBottom:18},children:(0,b.jsx)(N,{stats:m.stats})}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"filter-bar",children:[(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"decision"}),(0,b.jsx)(M,{value:r,onChange:u})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"event"}),(0,b.jsxs)("select",{value:v,onChange:a=>w(a.target.value),className:"filter-input",children:[(0,b.jsx)("option",{value:"",children:"all events"}),(0,b.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,b.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,b.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,b.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,b.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,b.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"cli"}),(0,b.jsxs)("select",{value:Q,onChange:a=>{let b=a.target.value;R(""===b||(0,D.isKnownCli)(b)?b:"")},className:"filter-input","aria-label":"Filter by CLI",children:[(0,b.jsx)("option",{value:"",children:"all clis"}),D.KNOWN_CLI_IDS.map(a=>(0,b.jsx)("option",{value:a,children:(0,D.getCliLabel)(a)},a))]})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"policy"}),(0,b.jsx)("input",{type:"text",value:x,onChange:a=>y(a.target.value),placeholder:"filter by policy\\u2026",className:"filter-input"})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"session"}),(0,b.jsx)("input",{type:"text",value:E,onChange:a=>L(a.target.value),placeholder:"filter by session…",className:"filter-input"})]}),V&&(0,b.jsx)("button",{type:"button",className:"filter-clear",onClick:()=>{u(""),w(""),R(""),y(""),L("")},"aria-label":"Clear all filters",children:"[ clear ]"})]}),0===X.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,b.jsx)(j,{className:"h-12 w-12 text-muted-foreground/30"}),!1===a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4 font-medium",children:"Policies are not installed"}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:["Go to the"," ",(0,b.jsx)("button",{className:"underline hover:text-foreground transition-colors",onClick:()=>d?.("policies"),children:"Policies tab"})," ","and click ",(0,b.jsx)("span",{className:"font-mono bg-muted px-1 rounded",children:"Install"})," to enable policy monitoring."]})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4",children:V?"No matching activity.":"Waiting for hook events…"})]}):(0,b.jsx)("div",{className:"overflow-x-auto activity-table-wrap",children:(0,b.jsxs)("table",{className:"w-full text-xs activity-table",style:{tableLayout:"fixed"},children:[(0,b.jsxs)("colgroup",{children:[(0,b.jsx)("col",{style:{width:32}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"7%"}}),(0,b.jsx)("col",{style:{width:"18%"}}),(0,b.jsx)("col",{style:{width:"22%"}}),(0,b.jsx)("col",{style:{width:"6%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"7%"}})]}),(0,b.jsx)("thead",{className:"activity-thead",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Decision"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Event"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"CLI"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Tool"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Policy"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Reason"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Duration"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Session"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Mode"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th text-right",children:"Time"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-border/30",children:X.map((a,d)=>{var e;let g,h="deny"===a.decision,i=o===d,j="instruct"===a.decision;return(0,b.jsxs)(c.default.Fragment,{children:[(0,b.jsxs)("tr",{onClick:()=>{p(a=>{let b=a===d?null:d,c=X[d];return f("activity_row_toggled",{expanded:null!==b,decision:c?.decision??null,policy_name:c?.policyName??null,event_type:c?.eventType??null}),b})},className:`cursor-pointer transition-colors ${h?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":j?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":d%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${i?"bg-muted/20":""}`,children:[(0,b.jsx)("td",{className:"px-4 py-2",children:(0,b.jsx)(k.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${i?"rotate-0":"-rotate-90"}`})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(G,{decision:a.decision})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(H,{eventType:a.eventType})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(I,{integration:a.integration})}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.toolName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.policyNames&&a.policyNames.length>1?(0,b.jsxs)("span",{title:a.policyNames.join(", "),children:[a.policyNames[0],(0,b.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",a.policyNames.length-1]})]}):a.policyName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate",title:a.reason??"",children:a.reason??"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(K,{ms:a.durationMs})}),(0,b.jsx)("td",{className:"px-3 py-2",title:a.sessionId??"",children:(0,b.jsx)(F,{sessionId:a.sessionId,transcriptPath:a.transcriptPath,integration:a.integration,cwd:a.cwd})}),(0,b.jsx)("td",{className:"px-3 py-2",children:a.permissionMode?(0,b.jsx)(J,{mode:a.permissionMode}):"—"}),(0,b.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",title:new Date(a.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(e=a.timestamp,(g=Date.now()-e)<6e4?`${Math.max(1,Math.floor(g/1e3))}s ago`:g<36e5?`${Math.floor(g/6e4)}m ago`:g<864e5?`${Math.floor(g/36e5)}h ago`:`${Math.floor(g/864e5)}d ago`)})]}),i&&(0,b.jsx)(O,{item:a})]},`${a.timestamp}-${d}`)})})]})}),(0,b.jsx)(q.default,{currentPage:i,totalPages:Y,onPageChange:a=>{f("activity_pagination_changed",{from_page:i,to_page:a,total_pages:Y}),l(a),p(null)}})]})]})}function Q({enabled:a,onChange:c,disabled:d}){return(0,b.jsx)("button",{onClick:c,disabled:d,className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors disabled:opacity-40 ${a?"bg-emerald-500":"bg-muted-foreground/30"}`,"aria-label":a?"Disable policy":"Enable policy",children:(0,b.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform ${a?"translate-x-3.5":"translate-x-0.5"}`})})}function R({policy:a,onClose:d,onSave:e}){let f=a.params??{},g=a.currentParams??{},[h,i]=(0,c.useState)(()=>{let a={};for(let[b,c]of Object.entries(f)){let d=b in g?g[b]:c.default;a[b]=d}return a});(0,c.useEffect)(()=>{let a=a=>{"Escape"===a.key&&d()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[d]);let j=(a,b)=>{i(c=>({...c,[a]:b}))};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:a=>{a.target===a.currentTarget&&d()},children:(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-mono font-semibold text-foreground",children:a.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]}),(0,b.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,b.jsx)(p.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"overflow-y-auto flex-1 px-4 py-4 space-y-4",children:Object.entries(f).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-semibold text-foreground mb-1 font-mono",children:a}),(0,b.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mb-1.5",children:c.description}),((a,c)=>{let d=h[a];if("boolean"===c.type)return(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!!d,onChange:b=>j(a,b.target.checked),className:"rounded border-border"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:c.description})]});if("number"===c.type)return(0,b.jsx)("input",{type:"number",value:"number"==typeof d?d:"",onChange:b=>j(a,Number(b.target.value)),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"});if("string[]"===c.type){let c=Array.isArray(d)?d.join("\n"):"";return(0,b.jsx)("textarea",{value:c,onChange:b=>j(a,b.target.value.split("\n").filter(a=>""!==a.trim())),rows:4,placeholder:"One entry per line",className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/40 resize-y"})}if("pattern[]"===c.type){let c=Array.isArray(d)?d:[];return(0,b.jsxs)("div",{className:"space-y-1.5",children:[c.map((d,e)=>(0,b.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,b.jsx)("input",{type:"text",value:d.regex,onChange:b=>{let d=[...c];d[e]={...d[e],regex:b.target.value},j(a,d)},placeholder:"regex",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("input",{type:"text",value:d.label,onChange:b=>{let d=[...c];d[e]={...d[e],label:b.target.value},j(a,d)},placeholder:"label",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("button",{onClick:()=>j(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,b.jsx)(p.X,{className:"h-3.5 w-3.5"})})]},e)),(0,b.jsx)("button",{onClick:()=>j(a,[...c,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,b.jsx)("input",{type:"text",value:"string"==typeof d?d:"",onChange:b=>j(a,b.target.value),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})})(a,c)]},a))}),(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,b.jsx)(E.Button,{variant:"outline",size:"sm",onClick:d,className:"h-7 text-xs",children:"Cancel"}),(0,b.jsx)(E.Button,{size:"sm",onClick:()=>e(h),className:"h-7 text-xs",children:"Save"})]})]})})}function S({message:a,onDismiss:c,onInstall:e,isPending:f}){let{capture:g}=(0,A.usePostHog)();return(0,d.createPortal)((0,b.jsxs)("div",{className:"fixed top-4 right-4 z-[9999] w-full max-w-sm",style:{animation:"slideInFromRight 0.25s ease-out"},children:[(0,b.jsx)("style",{children:`
1
+ module.exports=[22712,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(35112),e=a.i(38246),f=a.i(64831);let g=(0,f.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),h=(0,f.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),i=(0,f.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),j=(0,f.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var k=a.i(89027),l=a.i(85650),m=a.i(52562);let n=(0,f.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),o=(0,f.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var p=a.i(74215),q=a.i(65967),r=a.i(5050);let s=(0,r.createServerReference)("40cb578545ca16ca272e6cee536a1beb6ced1c20ae",r.callServer,void 0,r.findSourceMapURL,"getHookActivityAction"),t=(0,r.createServerReference)("60eae94ef10c13087319d3480f89e7ea4be834c6a7",r.callServer,void 0,r.findSourceMapURL,"searchHookActivityAction"),u=(0,r.createServerReference)("003575adc273e606668952bb88c9184fcc3702802e",r.callServer,void 0,r.findSourceMapURL,"getHooksConfigAction"),v=(0,r.createServerReference)("60ec1a66cf2a3594ef1af92d3d418b15bc54ace115",r.callServer,void 0,r.findSourceMapURL,"togglePolicyAction"),w=(0,r.createServerReference)("606410946ffa73db43321f1a4d00c39e8fc7bc8d18",r.callServer,void 0,r.findSourceMapURL,"installHooksWebAction"),x=(0,r.createServerReference)("60c9a0adaa922c76bedb3585258e25f0c4f003dc9e",r.callServer,void 0,r.findSourceMapURL,"removeHooksWebAction"),y=(0,r.createServerReference)("60d1f0ebc4b5811aab92442996d5e987130d9714de",r.callServer,void 0,r.findSourceMapURL,"updatePolicyParamsAction");var z=a.i(6236),A=a.i(10765),B=a.i(90619),C=a.i(95947),D=a.i(87256),E=a.i(40695);function F({sessionId:a,transcriptPath:c,integration:d,cwd:f}){if(!a)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let g=a?a.slice(0,8):"—",h="codex"===d||(c?.includes("/.codex/")??!1),i="copilot"===d||(c?.includes("/.copilot/session-state/")??!1),j="cursor"===d||(c?.includes("/.cursor/")??!1),k="opencode"===d||(c?.includes("/.local/share/opencode/")??!1)||(c?.includes("/.opencode/")??!1),l="pi"===d||(c?.includes("/.pi/")??!1),m="gemini"===d||(c?.includes("/.gemini/")??!1);if(h||i||j||k||l||m){let c,d=f?(c=/^([A-Za-z]):[\\/](.*)$/.exec(f))?c[1]+"--"+c[2].replace(/[\\/]/g,"-"):f.replace(/[\\/]/g,"-"):h?"codex":i?"copilot":j?"cursor":k?"opencode":l?"pi":"gemini";return(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(d)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g})}let n=c?function(a){let b=a.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length<2)return null;let c=b[b.length-2];return!c||c.startsWith(".")?null:c}(c):null;return n?(0,b.jsx)(e.default,{href:`/project/${encodeURIComponent(n)}/session/${encodeURIComponent(a)}`,className:"text-primary hover:underline font-mono",onClick:a=>a.stopPropagation(),children:g}):(0,b.jsx)("span",{className:"text-muted-foreground font-mono",children:g})}function G({decision:a}){return"deny"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,b.jsx)(h,{className:"h-3 w-3"}),"Deny"]}):"instruct"===a?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,b.jsx)(i,{className:"h-3 w-3"}),"Instruct"]}):(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,b.jsx)(g,{className:"h-3 w-3"}),"Allow"]})}function H({eventType:a}){return(0,b.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:a})}function I({integration:a}){if(!a)return null;let c=(0,D.getCliLabel)(a),d=(0,D.getCliBadgeClasses)(a);return(0,b.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${d}`,title:`Agent CLI: ${c}`,children:c})}function J({mode:a}){let c="default"===a;return(0,b.jsx)("span",{title:a,className:`inline-block max-w-full truncate rounded px-1.5 py-0.5 align-middle text-[0.6rem] font-medium border ${c?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:a})}function K({ms:a}){return(0,b.jsx)("span",{className:`font-mono text-[0.7rem] ${a>500?"text-red-400":a>100?"text-amber-400":"text-muted-foreground"}`,children:a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`})}function L({text:a,field:d}){let[e,f]=(0,c.useState)(!1),{capture:g}=(0,A.usePostHog)(),h=async b=>{b.stopPropagation(),g("activity_copy_clicked",{field:d??"unknown"});try{await navigator.clipboard.writeText(a),f(!0),setTimeout(()=>f(!1),1500)}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),f(!0),setTimeout(()=>f(!1),1500)}};return(0,b.jsx)("button",{onClick:h,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:e?(0,b.jsx)(m.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(l.Copy,{className:"h-3 w-3"})})}function M({value:a,onChange:c}){return(0,b.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(d=>(0,b.jsx)("button",{onClick:()=>c(d.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${a===d.value?"deny"===d.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===d.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===d.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:d.label},d.value))})}function N({stats:a}){let c=a.totalEvents>0?a.denyCount/a.totalEvents*100:0,d=c.toFixed(c>=10?0:1),e=0===a.denyCount?"":c>=5?" is-deny":c>=2?" is-warn":"";return(0,b.jsxs)("div",{className:"stat-bar",role:"group","aria-label":"Activity stats",children:[(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"total events"}),(0,b.jsx)("span",{className:"value",children:a.totalEvents.toLocaleString()}),(0,b.jsx)("span",{className:"meta",children:"across all installed agents"})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"deny rate"}),(0,b.jsxs)("span",{className:`value${e}`,children:[d,"%"]}),(0,b.jsxs)("span",{className:"meta",children:[a.denyCount.toLocaleString()," of ",a.totalEvents.toLocaleString()," denied"]})]}),(0,b.jsxs)("div",{className:"stat-cell",children:[(0,b.jsx)("span",{className:"eyebrow",children:"top policy"}),(0,b.jsx)("span",{className:"value",style:{fontSize:16,fontWeight:500,color:a.topPolicy?"var(--accent-pink)":"var(--dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a.topPolicy??void 0,children:a.topPolicy??"—"}),(0,b.jsx)("span",{className:"meta",children:"most-evaluated policy in scope"})]})]})}function O({item:a}){return(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:11,className:"px-0 py-0",children:(0,b.jsxs)("div",{className:"activity-detail animate-expand text-xs",children:[(0,b.jsxs)("span",{className:"activity-detail-eyebrow",children:[(0,b.jsx)("span",{"aria-hidden":"true",children:"\\u25be"}),"event detail"]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.sessionId??"—"}),a.sessionId&&(0,b.jsx)(L,{text:a.sessionId,field:"session_id"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.cwd??"—"}),a.cwd&&(0,b.jsx)(L,{text:a.cwd,field:"cwd"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,b.jsx)("span",{className:"font-mono text-foreground break-all",children:a.transcriptPath??"—"}),a.transcriptPath?.startsWith("opencode-db://")&&(0,b.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),a.policyNames&&a.policyNames.length>1&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,b.jsx)("span",{className:"font-mono text-foreground",children:a.policyNames.join(", ")})]}),a.reason&&(0,b.jsxs)("div",{style:{marginTop:8},children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,b.jsx)("span",{className:"text-foreground",children:a.reason})]})]})})})}function P({hooksInstalled:a,onSwitchTab:d}){let{intervalSec:e}=(0,z.useAutoRefresh)(),{capture:f}=(0,A.usePostHog)(),g=(0,B.useUrlParams)(),h=(0,c.useRef)(!1),[i,l]=(0,c.useState)(()=>(0,C.paramToPage)(g.get("page"))),[m,n]=(0,c.useState)(null),[o,p]=(0,c.useState)(null),[r,u]=(0,c.useState)(()=>{let a=g.get("decision");return"allow"===a||"deny"===a||"instruct"===a?a:""}),[v,w]=(0,c.useState)(()=>g.get("event")??""),[x,y]=(0,c.useState)(()=>g.get("policy")??""),[E,L]=(0,c.useState)(()=>g.get("session")??""),[Q,R]=(0,c.useState)(()=>{let a=g.get("cli");return(0,D.isKnownCli)(a)?a:""}),S=(0,c.useRef)(null),T=(0,c.useRef)(!0),U=(0,c.useRef)({filterDecision:r,filterEventType:v,filterPolicy:x,filterSessionId:E,filterCli:Q});U.current={filterDecision:r,filterEventType:v,filterPolicy:x,filterSessionId:E,filterCli:Q},(0,c.useEffect)(()=>{if(!h.current){h.current=!0;return}g.setAll({decision:r||void 0,event:v||void 0,policy:x||void 0,session:E||void 0,cli:Q||void 0,page:(0,C.pageToParam)(i)})},[r,v,x,E,Q,i]);let V=""!==r||""!==v||""!==x||""!==E||""!==Q,W=(0,c.useCallback)(async a=>{try{let b,{filterDecision:c,filterEventType:d,filterPolicy:e,filterSessionId:f,filterCli:g}=U.current;b=""!==c||""!==d||""!==e||""!==f||""!==g?await t({decision:c||void 0,eventType:d||void 0,policyName:e||void 0,sessionId:f||void 0,integration:g||void 0},a):await s(a),n(b)}catch{}},[]);(0,c.useEffect)(()=>{W(i);let a=setInterval(()=>W(i),e>0?1e3*e:5e3);return()=>clearInterval(a)},[i,W,e]),(0,c.useEffect)(()=>(S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{if(l(1),p(null),W(1),T.current){T.current=!1;return}f("activity_filter_changed",{active_filter_count:+(""!==r)+ +(""!==v)+ +(""!==x)+ +(""!==E)+ +(""!==Q),has_decision:""!==r,has_event_type:""!==v,has_policy:""!==x,has_session:""!==E,has_cli:""!==Q,decision:r||null,event_type:v||null,cli:Q||null})},300),()=>{S.current&&clearTimeout(S.current)}),[r,v,x,E,Q]);let X=m?.entries??[],Y=m?.totalPages??1;return(0,b.jsxs)(b.Fragment,{children:[m?.stats&&m.stats.totalEvents>0&&(0,b.jsx)("div",{style:{marginBottom:18},children:(0,b.jsx)(N,{stats:m.stats})}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"filter-bar",children:[(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"decision"}),(0,b.jsx)(M,{value:r,onChange:u})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"event"}),(0,b.jsxs)("select",{value:v,onChange:a=>w(a.target.value),className:"filter-input",children:[(0,b.jsx)("option",{value:"",children:"all events"}),(0,b.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,b.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,b.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,b.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,b.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,b.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]})]}),(0,b.jsxs)("div",{className:"filter-group",children:[(0,b.jsx)("span",{className:"filter-label",children:"cli"}),(0,b.jsxs)("select",{value:Q,onChange:a=>{let b=a.target.value;R(""===b||(0,D.isKnownCli)(b)?b:"")},className:"filter-input","aria-label":"Filter by CLI",children:[(0,b.jsx)("option",{value:"",children:"all clis"}),D.KNOWN_CLI_IDS.map(a=>(0,b.jsx)("option",{value:a,children:(0,D.getCliLabel)(a)},a))]})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"policy"}),(0,b.jsx)("input",{type:"text",value:x,onChange:a=>y(a.target.value),placeholder:"filter by policy\\u2026",className:"filter-input"})]}),(0,b.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,b.jsx)("span",{className:"filter-label",children:"session"}),(0,b.jsx)("input",{type:"text",value:E,onChange:a=>L(a.target.value),placeholder:"filter by session…",className:"filter-input"})]}),V&&(0,b.jsx)("button",{type:"button",className:"filter-clear",onClick:()=>{u(""),w(""),R(""),y(""),L("")},"aria-label":"Clear all filters",children:"[ clear ]"})]}),0===X.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,b.jsx)(j,{className:"h-12 w-12 text-muted-foreground/30"}),!1===a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4 font-medium",children:"Policies are not installed"}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:["Go to the"," ",(0,b.jsx)("button",{className:"underline hover:text-foreground transition-colors",onClick:()=>d?.("policies"),children:"Policies tab"})," ","and click ",(0,b.jsx)("span",{className:"font-mono bg-muted px-1 rounded",children:"Install"})," to enable policy monitoring."]})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-4",children:V?"No matching activity.":"Waiting for hook events…"})]}):(0,b.jsx)("div",{className:"overflow-x-auto activity-table-wrap",children:(0,b.jsxs)("table",{className:"w-full text-xs activity-table",style:{tableLayout:"fixed"},children:[(0,b.jsxs)("colgroup",{children:[(0,b.jsx)("col",{style:{width:32}}),(0,b.jsx)("col",{style:{width:"7%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"9%"}}),(0,b.jsx)("col",{style:{width:"13%"}}),(0,b.jsx)("col",{style:{width:"12%"}}),(0,b.jsx)("col",{style:{width:"11%"}}),(0,b.jsx)("col",{style:{width:"8%"}}),(0,b.jsx)("col",{style:{width:"8%"}})]}),(0,b.jsx)("thead",{className:"activity-thead",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Time"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Decision"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Event"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"CLI"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Tool"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Policy"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Reason"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Mode"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Duration"}),(0,b.jsx)("th",{className:"px-3 py-3 activity-th",children:"Session"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-border/30",children:X.map((a,d)=>{var e;let g,h="deny"===a.decision,i=o===d,j="instruct"===a.decision;return(0,b.jsxs)(c.default.Fragment,{children:[(0,b.jsxs)("tr",{onClick:()=>{p(a=>{let b=a===d?null:d,c=X[d];return f("activity_row_toggled",{expanded:null!==b,decision:c?.decision??null,policy_name:c?.policyName??null,event_type:c?.eventType??null}),b})},className:`activity-data-row cursor-pointer transition-colors ${h?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":j?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":d%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${i?"bg-muted/20":""}`,children:[(0,b.jsx)("td",{className:"px-4 py-2",children:(0,b.jsx)(k.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${i?"rotate-0":"-rotate-90"}`})}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground whitespace-nowrap",title:new Date(a.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(e=a.timestamp,(g=Date.now()-e)<6e4?`${Math.max(1,Math.floor(g/1e3))}s ago`:g<36e5?`${Math.floor(g/6e4)}m ago`:g<864e5?`${Math.floor(g/36e5)}h ago`:`${Math.floor(g/864e5)}d ago`)}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(G,{decision:a.decision})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(H,{eventType:a.eventType})}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(I,{integration:a.integration})}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.toolName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:a.policyNames&&a.policyNames.length>1?(0,b.jsxs)("span",{title:a.policyNames.join(", "),children:[a.policyNames[0],(0,b.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",a.policyNames.length-1]})]}):a.policyName??"—"}),(0,b.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate",title:a.reason??"",children:a.reason??"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:a.permissionMode?(0,b.jsx)(J,{mode:a.permissionMode}):"—"}),(0,b.jsx)("td",{className:"px-3 py-2",children:(0,b.jsx)(K,{ms:a.durationMs})}),(0,b.jsx)("td",{className:"px-3 py-2",title:a.sessionId??"",children:(0,b.jsx)(F,{sessionId:a.sessionId,transcriptPath:a.transcriptPath,integration:a.integration,cwd:a.cwd})})]}),i&&(0,b.jsx)(O,{item:a})]},`${a.timestamp}-${d}`)})})]})}),(0,b.jsx)(q.default,{currentPage:i,totalPages:Y,onPageChange:a=>{f("activity_pagination_changed",{from_page:i,to_page:a,total_pages:Y}),l(a),p(null)}})]})]})}function Q({enabled:a,onChange:c,disabled:d}){return(0,b.jsx)("button",{onClick:c,disabled:d,className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors disabled:opacity-40 ${a?"bg-emerald-500":"bg-muted-foreground/30"}`,"aria-label":a?"Disable policy":"Enable policy",children:(0,b.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform ${a?"translate-x-3.5":"translate-x-0.5"}`})})}function R({policy:a,onClose:d,onSave:e}){let f=a.params??{},g=a.currentParams??{},[h,i]=(0,c.useState)(()=>{let a={};for(let[b,c]of Object.entries(f)){let d=b in g?g[b]:c.default;a[b]=d}return a});(0,c.useEffect)(()=>{let a=a=>{"Escape"===a.key&&d()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[d]);let j=(a,b)=>{i(c=>({...c,[a]:b}))};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:a=>{a.target===a.currentTarget&&d()},children:(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-mono font-semibold text-foreground",children:a.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]}),(0,b.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,b.jsx)(p.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"overflow-y-auto flex-1 px-4 py-4 space-y-4",children:Object.entries(f).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-semibold text-foreground mb-1 font-mono",children:a}),(0,b.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mb-1.5",children:c.description}),((a,c)=>{let d=h[a];if("boolean"===c.type)return(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!!d,onChange:b=>j(a,b.target.checked),className:"rounded border-border"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:c.description})]});if("number"===c.type)return(0,b.jsx)("input",{type:"number",value:"number"==typeof d?d:"",onChange:b=>j(a,Number(b.target.value)),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"});if("string[]"===c.type){let c=Array.isArray(d)?d.join("\n"):"";return(0,b.jsx)("textarea",{value:c,onChange:b=>j(a,b.target.value.split("\n").filter(a=>""!==a.trim())),rows:4,placeholder:"One entry per line",className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/40 resize-y"})}if("pattern[]"===c.type){let c=Array.isArray(d)?d:[];return(0,b.jsxs)("div",{className:"space-y-1.5",children:[c.map((d,e)=>(0,b.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,b.jsx)("input",{type:"text",value:d.regex,onChange:b=>{let d=[...c];d[e]={...d[e],regex:b.target.value},j(a,d)},placeholder:"regex",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("input",{type:"text",value:d.label,onChange:b=>{let d=[...c];d[e]={...d[e],label:b.target.value},j(a,d)},placeholder:"label",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,b.jsx)("button",{onClick:()=>j(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,b.jsx)(p.X,{className:"h-3.5 w-3.5"})})]},e)),(0,b.jsx)("button",{onClick:()=>j(a,[...c,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,b.jsx)("input",{type:"text",value:"string"==typeof d?d:"",onChange:b=>j(a,b.target.value),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})})(a,c)]},a))}),(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,b.jsx)(E.Button,{variant:"outline",size:"sm",onClick:d,className:"h-7 text-xs",children:"Cancel"}),(0,b.jsx)(E.Button,{size:"sm",onClick:()=>e(h),className:"h-7 text-xs",children:"Save"})]})]})})}function S({message:a,onDismiss:c,onInstall:e,isPending:f}){let{capture:g}=(0,A.usePostHog)();return(0,d.createPortal)((0,b.jsxs)("div",{className:"fixed top-4 right-4 z-[9999] w-full max-w-sm",style:{animation:"slideInFromRight 0.25s ease-out"},children:[(0,b.jsx)("style",{children:`
2
2
  @keyframes slideInFromRight {
3
3
  from { transform: translateX(calc(100% + 1rem)); opacity: 0; }
4
4
  to { transform: translateX(0); opacity: 1; }
5
5
  }
6
- `}),(0,b.jsxs)("div",{className:"rounded-lg border border-red-500/40 bg-red-950/95 shadow-2xl shadow-red-900/40 overflow-hidden backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-red-600 via-red-400 to-red-600"}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"shrink-0 mt-0.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 ring-2 ring-red-500/30",children:(0,b.jsx)(p.X,{className:"h-3 w-3 text-white",strokeWidth:3})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-[0.65rem] font-bold uppercase tracking-widest text-red-400 mb-0.5",children:"Error"}),(0,b.jsx)("p",{className:"text-sm text-red-100 leading-snug",children:a})]}),(0,b.jsx)("button",{onClick:c,className:"shrink-0 -mt-0.5 -mr-0.5 rounded p-0.5 text-red-400/60 transition-colors hover:bg-red-500/20 hover:text-red-200","aria-label":"Dismiss",children:(0,b.jsx)(p.X,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)(E.Button,{size:"sm",onClick:()=>{g("hooks_install_from_error_clicked",{error_message:a.slice(0,200)}),c(),e()},disabled:f,className:"h-7 flex-1 border-0 bg-red-500 px-3 text-xs font-semibold text-white hover:bg-red-400 disabled:opacity-50",children:"Install hooks"}),(0,b.jsx)(E.Button,{variant:"ghost",size:"sm",onClick:c,className:"h-7 px-3 text-xs text-red-400 hover:bg-red-500/10 hover:text-red-200",children:"Dismiss"})]})]})]})]}),document.body)}function T({onHooksInstallChange:a}){let[d,e]=(0,c.useState)(null),[f,g]=(0,c.useTransition)(),[h,i]=(0,c.useState)(null),[k,l]=(0,c.useState)(null),[m,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(()=>new Set),s=(0,c.useRef)(!1),{capture:t}=(0,A.usePostHog)(),z=(0,c.useCallback)((a,b)=>{t("action_error_displayed",{error_type:a,error_message:b.slice(0,200)}),i(b)},[t]),B=(0,c.useCallback)(async()=>{try{let b=await u();e(b),a?.(b.clis.some(a=>a.installed))}catch{}},[a]);(0,c.useEffect)(()=>{B()},[B]),(0,c.useEffect)(()=>{d&&(s.current?r(new Set(d.clis.filter(a=>a.installed).map(a=>a.id))):(s.current=!0,r(new Set(d.clis.filter(a=>a.installed||a.detected).map(a=>a.id)))))},[d?.clis]);let C=(0,c.useMemo)(()=>new Set((d?.clis??[]).filter(a=>a.installed).map(a=>a.id)),[d?.clis]),F=(0,c.useMemo)(()=>{let a=[],b=[];for(let c of d?.clis??[]){let d=q.has(c.id);d&&!C.has(c.id)&&a.push(c.id),!d&&C.has(c.id)&&b.push(c.id)}return{toInstall:a,toRemove:b}},[d?.clis,q,C]),G=F.toInstall.length>0||F.toRemove.length>0,H=()=>{let{toInstall:a,toRemove:b}=F;(0!==a.length||0!==b.length)&&(t("cli_install_remove_submitted",{to_install:a,to_remove:b,count_install:a.length,count_remove:b.length}),g(async()=>{try{i(null),a.length>0&&await w("user",a),b.length>0&&await x("user",b)}catch(a){z("cli_apply",a instanceof Error?a.message:"Failed to apply changes.")}finally{await B()}}))};if(!d)return(0,b.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})});let I=d.clis.some(a=>a.installed),J=C.size,K=q.size,L=Array.from(new Set(d.policies.map(a=>a.category)));return(0,b.jsxs)(b.Fragment,{children:[m&&(0,b.jsx)(R,{policy:m,onClose:()=>{t("policy_config_modal_closed",{policy_name:m.name,action:"cancel"}),p(null)},onSave:a=>{if(!m)return;let b=m.name;p(null),g(async()=>{try{i(null),await y(b,a),await B()}catch(a){z("param_update",a instanceof Error?a.message:"Failed to save configuration.")}})}}),(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4 px-5 py-3.5 border-b border-border/60 bg-muted/10",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-wrap",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:`h-2 w-2 rounded-full transition-shadow ${I?"bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.6)]":"bg-muted-foreground/40"}`,"aria-hidden":!0}),(0,b.jsx)("span",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-foreground/90",children:"Integrations"})]}),(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("div",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-muted-foreground",children:[(0,b.jsx)("span",{className:"text-foreground tabular-nums",children:J.toString().padStart(2,"0")}),(0,b.jsxs)("span",{className:"opacity-50",children:[" / 0",d.clis.length," active"]})]}),G&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[0.65rem] uppercase tracking-[0.2em] font-mono text-pink-400",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-pink-400 animate-pulse"}),F.toInstall.length+F.toRemove.length," pending"]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsx)(E.Button,{variant:"outline",size:"sm",onClick:()=>{let a=Array.from(C).filter(a=>q.has(a));0!==a.length&&(t("cli_reinstall_submitted",{cli_ids:a,count:a.length}),g(async()=>{try{i(null),await w("user",a)}catch(a){z("cli_reinstall",a instanceof Error?a.message:"Failed to reinstall.")}finally{await B()}}))},disabled:f||0===K,className:"text-xs h-7 px-3 font-mono",children:"Reinstall"}),(0,b.jsx)(E.Button,{variant:"default",size:"sm",onClick:H,disabled:f||!G,className:"text-xs h-7 px-3 font-mono",children:"Apply changes"})]})]}),(0,b.jsx)("div",{className:"divide-y divide-border/30 border-b border-border/60",children:d.clis.map((a,c)=>{let e=q.has(a.id),g=C.has(a.id),h=e!==g,i=(0,D.getCliBadgeClasses)(a.id),j=i.split(" ").find(a=>a.startsWith("text-"))??"text-foreground";return(0,b.jsxs)("label",{className:`group relative flex items-center gap-3 pl-6 pr-5 py-3 cursor-pointer transition-colors hover:bg-muted/15 ${h?"bg-pink-500/[0.04]":""}`,children:[(0,b.jsx)("div",{className:`absolute left-0 top-0 bottom-0 w-[3px] ${j} bg-current transition-opacity ${e?"opacity-100":"opacity-25 group-hover:opacity-60"}`,"aria-hidden":!0}),(0,b.jsx)("div",{className:"font-mono text-[0.65rem] text-muted-foreground/40 tabular-nums w-6 select-none",children:(c+1).toString().padStart(2,"0")}),(0,b.jsxs)("div",{className:"relative shrink-0",children:[(0,b.jsx)("input",{type:"checkbox",checked:e,onChange:()=>{var b;return b=a.id,void r(a=>{let c=new Set(a),e=!c.has(b);e?c.add(b):c.delete(b);let f=d?.clis.find(a=>a.id===b);return t("cli_selection_toggled",{cli_id:b,checked:e,current_state:f?.installed?"installed":f?.detected?"detected":"inactive"}),c})},disabled:f,className:"sr-only peer","aria-label":`Toggle ${a.label}`}),(0,b.jsx)("div",{className:`h-[18px] w-[18px] rounded-sm border transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-primary/40 ${e?"bg-primary border-primary":"bg-background/50 border-border group-hover:border-foreground/40"}`,children:e&&(0,b.jsx)("svg",{viewBox:"0 0 18 18",className:"h-full w-full text-primary-foreground",fill:"none","aria-hidden":!0,children:(0,b.jsx)("path",{d:"M4 9.5L7.5 12.5L14 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),(0,b.jsx)("div",{className:"min-w-[150px] shrink-0",children:(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:a.label})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[g?(0,b.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border ${i}`,children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current shadow-[0_0_4px_currentColor]"}),"Active"]}):a.detected?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/60 text-muted-foreground/80 bg-muted/20",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current opacity-60"}),"Detected"]}):(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/30 text-muted-foreground/40",children:"Inactive"}),h&&(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-pink-500/40 text-pink-400 bg-pink-500/10",children:e?"+ install":"− remove"})]}),(0,b.jsx)("div",{className:"ml-auto hidden lg:block text-[0.7rem] font-mono text-muted-foreground/50 truncate max-w-[420px] group-hover:text-muted-foreground/80 transition-colors",title:a.settingsPath,children:a.settingsPath})]},a.id)})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/40 bg-muted/5",children:[(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-semibold text-foreground",children:d.enabledPolicies.length})," / ",d.policies.length+(d.customPolicies?.length??0)," ","policies enabled"]}),I&&(0,b.jsxs)("span",{className:"text-[0.65rem] text-muted-foreground/60",children:["· shared across ",J," active CLI",1===J?"":"s"]})]}),h&&(0,b.jsx)("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-xs text-red-400",children:h}),k&&(0,b.jsx)(S,{message:k,onDismiss:()=>l(null),onInstall:H,isPending:f}),L.map(a=>{let c=d.policies.filter(b=>b.category===a),h=c.filter(a=>a.enabled).length;return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[h," / ",c.length," enabled"]})]}),c.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"mt-0.5 shrink-0",children:(0,b.jsx)(Q,{enabled:a.enabled,onChange:()=>{var b,c;return b=a.name,c=a.enabled,void(!d||(!d.clis.some(a=>a.installed)?l("Policies are not installed. Install policies to continue."):(l(null),e(a=>a?{...a,policies:a.policies.map(a=>a.name===b?{...a,enabled:!c}:a),enabledPolicies:c?a.enabledPolicies.filter(a=>a!==b):[...a.enabledPolicies,b]}:a),g(async()=>{try{await v(b,!c)}catch{z("policy_toggle","Failed to save policy change."),B()}}))))},disabled:f})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:[(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name}),a.beta&&(0,b.jsx)("span",{className:"shrink-0 text-[0.6rem] px-1 py-0.5 rounded border bg-violet-500/10 text-violet-400 border-violet-500/20",children:"beta"})]}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:Object.entries(a.params).map(([c,d])=>{let e=a.currentParams?.[c]??d.default,f=JSON.stringify(e)!==JSON.stringify(d.default);return(0,b.jsxs)("span",{className:`inline-flex items-center gap-1 font-mono text-[0.6rem] px-1.5 py-0.5 rounded border ${f?"bg-primary/10 text-primary/70 border-primary/20":"bg-muted/40 text-muted-foreground/55 border-border/40"}`,children:[(0,b.jsxs)("span",{className:"opacity-70",children:[c,":"]}),(0,b.jsx)("span",{children:function(a,b){if("string[]"===a||"pattern[]"===a){let c=Array.isArray(b)?b:[];return 0===c.length?"none":"pattern[]"===a?`${c.length} pattern${1!==c.length?"s":""}`:1===c.length?String(c[0]).slice(0,24):`${c.length} values`}return"boolean"===a?b?"on":"off":null==b||""===b?"—":String(b).slice(0,32)}(d.type,e)})]},c)})})]}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("button",{className:"shrink-0 mt-0.5 text-muted-foreground hover:text-primary transition-colors",onClick:()=>{let b=Object.entries(a.params??{}).filter(([b,c])=>JSON.stringify(a.currentParams?.[b]??c.default)!==JSON.stringify(c.default)).length;t("policy_config_modal_opened",{policy_name:a.name,param_count:Object.keys(a.params??{}).length,has_customized_params:b>0,customized_count:b}),p(a)},title:"Edit parameters",children:(0,b.jsx)(n,{className:"h-3.5 w-3.5"})})]},a.name))]},a)}),d.customPoliciesPath&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:"Custom Policies"}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[d.customPolicies?.length??0," detected"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,b.jsx)(o,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:d.customPoliciesPath})]}),(0,b.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 border-b border-border/20 bg-muted/10",children:[(0,b.jsx)(j,{className:"h-3.5 w-3.5 text-muted-foreground/60 shrink-0 mt-0.5"}),(0,b.jsx)("p",{className:"text-[0.7rem] text-muted-foreground/70 leading-relaxed",children:"Custom policies are always active. To add, remove, or reorder them, edit the JS file above."})]}),d.customPolicies?.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"h-4 w-7 shrink-0 mt-0.5"}),(0,b.jsx)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[a.description&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope})]})]},a.name))]})]})]})}function U({activeTab:a,onChange:c}){return(0,b.jsx)("div",{className:"tabs",style:{padding:0,marginBottom:24},children:[{id:"activity",label:"Activity"},{id:"policies",label:"Configure"}].map(d=>(0,b.jsx)("button",{type:"button",onClick:()=>c(d.id),className:`tab${a===d.id?" is-active":""}`,children:d.label.toLowerCase()},d.id))})}a.s(["default",0,function({initialTab:a="activity"}){let d=(0,B.useUrlParams)(),{capture:e}=(0,A.usePostHog)(),[f,g]=(0,c.useState)(a),[h,i]=(0,c.useState)(void 0),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]);(0,c.useEffect)(()=>{u().then(a=>{i(a.clis.some(a=>a.installed)),k({enabled:a.enabledPolicies.length,total:a.policies.length+(a.customPolicies?.length??0)}),m(a.clis.filter(a=>a.installed).map(a=>a.label))}).catch(()=>i(void 0))},[]);let n=0===l.length?"Policy evaluations":l.length<=3?`Policy evaluations across ${l.join(", ")}`:`Policy evaluations across ${l.length} agents`,o=a=>{a!==f&&e("policies_tab_switched",{tab:a,from_tab:f}),g(a),d.setAll({tab:"activity"===a?void 0:a})};return(0,b.jsx)("main",{className:"report",children:(0,b.jsxs)("section",{className:"section","data-screen-label":"policies",children:[(0,b.jsxs)("h2",{className:"section-h",style:{textTransform:"none"},children:["activity"===f?"Policies":"what to stop them doing.","activity"===f&&(0,b.jsx)("span",{className:"section-h-dot","aria-hidden":!0})]}),"activity"===f?(0,b.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:32,flexWrap:"wrap",margin:"0 0 24px"},children:[(0,b.jsxs)("div",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,flex:"1 1 480px",minWidth:0},children:[n.toLowerCase(),j&&(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[" · ","enabled policies"," ",(0,b.jsxs)("span",{style:{color:"var(--ink)",fontVariantNumeric:"tabular-nums"},children:[j.enabled,"/",j.total]})]})]}),(0,b.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6,flex:"0 0 auto"},children:[(0,b.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:"0.22em",textTransform:"uppercase",color:"var(--dim)"},children:"want to change which policies fire?"}),(0,b.jsx)("button",{type:"button",className:"btn btn-primary",onClick:()=>o("policies"),children:"[ configure policies → ]"})]})]}):(0,b.jsx)("p",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,maxWidth:720,margin:"0 0 24px"},children:"switch policies on or off across your installed agent CLIs."}),(0,b.jsx)(U,{activeTab:f,onChange:o}),"activity"===f?(0,b.jsx)(P,{hooksInstalled:h,onSwitchTab:o}):(0,b.jsx)(T,{onHooksInstallChange:i})]})})}],22712)}];
6
+ `}),(0,b.jsxs)("div",{className:"rounded-lg border border-red-500/40 bg-red-950/95 shadow-2xl shadow-red-900/40 overflow-hidden backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-red-600 via-red-400 to-red-600"}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"shrink-0 mt-0.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 ring-2 ring-red-500/30",children:(0,b.jsx)(p.X,{className:"h-3 w-3 text-white",strokeWidth:3})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-[0.65rem] font-bold uppercase tracking-widest text-red-400 mb-0.5",children:"Error"}),(0,b.jsx)("p",{className:"text-sm text-red-100 leading-snug",children:a})]}),(0,b.jsx)("button",{onClick:c,className:"shrink-0 -mt-0.5 -mr-0.5 rounded p-0.5 text-red-400/60 transition-colors hover:bg-red-500/20 hover:text-red-200","aria-label":"Dismiss",children:(0,b.jsx)(p.X,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)(E.Button,{size:"sm",onClick:()=>{g("hooks_install_from_error_clicked",{error_message:a.slice(0,200)}),c(),e()},disabled:f,className:"h-7 flex-1 border-0 bg-red-500 px-3 text-xs font-semibold text-white hover:bg-red-400 disabled:opacity-50",children:"Install hooks"}),(0,b.jsx)(E.Button,{variant:"ghost",size:"sm",onClick:c,className:"h-7 px-3 text-xs text-red-400 hover:bg-red-500/10 hover:text-red-200",children:"Dismiss"})]})]})]})]}),document.body)}function T({onHooksInstallChange:a}){let[d,e]=(0,c.useState)(null),[f,g]=(0,c.useTransition)(),[h,i]=(0,c.useState)(null),[k,l]=(0,c.useState)(null),[m,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(()=>new Set),s=(0,c.useRef)(!1),{capture:t}=(0,A.usePostHog)(),z=(0,c.useCallback)((a,b)=>{t("action_error_displayed",{error_type:a,error_message:b.slice(0,200)}),i(b)},[t]),B=(0,c.useCallback)(async()=>{try{let b=await u();e(b),a?.(b.clis.some(a=>a.installed))}catch{}},[a]);(0,c.useEffect)(()=>{B()},[B]),(0,c.useEffect)(()=>{d&&(s.current?r(new Set(d.clis.filter(a=>a.installed).map(a=>a.id))):(s.current=!0,r(new Set(d.clis.filter(a=>a.installed||a.detected).map(a=>a.id)))))},[d?.clis]);let C=(0,c.useMemo)(()=>new Set((d?.clis??[]).filter(a=>a.installed).map(a=>a.id)),[d?.clis]),F=(0,c.useMemo)(()=>{let a=[],b=[];for(let c of d?.clis??[]){let d=q.has(c.id);d&&!C.has(c.id)&&a.push(c.id),!d&&C.has(c.id)&&b.push(c.id)}return{toInstall:a,toRemove:b}},[d?.clis,q,C]),G=F.toInstall.length>0||F.toRemove.length>0,H=()=>{let{toInstall:a,toRemove:b}=F;(0!==a.length||0!==b.length)&&(t("cli_install_remove_submitted",{to_install:a,to_remove:b,count_install:a.length,count_remove:b.length}),g(async()=>{try{i(null),a.length>0&&await w("user",a),b.length>0&&await x("user",b)}catch(a){z("cli_apply",a instanceof Error?a.message:"Failed to apply changes.")}finally{await B()}}))};if(!d)return(0,b.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})});let I=d.clis.some(a=>a.installed),J=C.size,K=q.size,L=Array.from(new Set(d.policies.map(a=>a.category)));return(0,b.jsxs)(b.Fragment,{children:[m&&(0,b.jsx)(R,{policy:m,onClose:()=>{t("policy_config_modal_closed",{policy_name:m.name,action:"cancel"}),p(null)},onSave:a=>{if(!m)return;let b=m.name;p(null),g(async()=>{try{i(null),await y(b,a),await B()}catch(a){z("param_update",a instanceof Error?a.message:"Failed to save configuration.")}})}}),(0,b.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4 px-5 py-3.5 border-b border-border/60 bg-muted/10",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-wrap",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:`h-2 w-2 rounded-full transition-shadow ${I?"bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.6)]":"bg-muted-foreground/40"}`,"aria-hidden":!0}),(0,b.jsx)("span",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-foreground/90",children:"Integrations"})]}),(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("div",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-muted-foreground",children:[(0,b.jsx)("span",{className:"text-foreground tabular-nums",children:J.toString().padStart(2,"0")}),(0,b.jsxs)("span",{className:"opacity-50",children:[" / 0",d.clis.length," active"]})]}),G&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[0.65rem] uppercase tracking-[0.2em] font-mono text-pink-400",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-pink-400 animate-pulse"}),F.toInstall.length+F.toRemove.length," pending"]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsx)(E.Button,{variant:"outline",size:"sm",onClick:()=>{let a=Array.from(C).filter(a=>q.has(a));0!==a.length&&(t("cli_reinstall_submitted",{cli_ids:a,count:a.length}),g(async()=>{try{i(null),await w("user",a)}catch(a){z("cli_reinstall",a instanceof Error?a.message:"Failed to reinstall.")}finally{await B()}}))},disabled:f||0===K,className:"text-xs h-7 px-3 font-mono",children:"Reinstall"}),(0,b.jsx)(E.Button,{variant:"default",size:"sm",onClick:H,disabled:f||!G,className:"text-xs h-7 px-3 font-mono",children:"Apply changes"})]})]}),(0,b.jsx)("div",{className:"divide-y divide-border/30 border-b border-border/60",children:d.clis.map((a,c)=>{let e=q.has(a.id),g=C.has(a.id),h=e!==g,i=(0,D.getCliBadgeClasses)(a.id),j=i.split(" ").find(a=>a.startsWith("text-"))??"text-foreground";return(0,b.jsxs)("label",{className:`group relative flex items-center gap-3 pl-6 pr-5 py-3 cursor-pointer transition-colors hover:bg-muted/15 ${h?"bg-pink-500/[0.04]":""}`,children:[(0,b.jsx)("div",{className:`absolute left-0 top-0 bottom-0 w-[3px] ${j} bg-current transition-opacity ${e?"opacity-100":"opacity-25 group-hover:opacity-60"}`,"aria-hidden":!0}),(0,b.jsx)("div",{className:"font-mono text-[0.65rem] text-muted-foreground/40 tabular-nums w-6 select-none",children:(c+1).toString().padStart(2,"0")}),(0,b.jsxs)("div",{className:"relative shrink-0",children:[(0,b.jsx)("input",{type:"checkbox",checked:e,onChange:()=>{var b;return b=a.id,void r(a=>{let c=new Set(a),e=!c.has(b);e?c.add(b):c.delete(b);let f=d?.clis.find(a=>a.id===b);return t("cli_selection_toggled",{cli_id:b,checked:e,current_state:f?.installed?"installed":f?.detected?"detected":"inactive"}),c})},disabled:f,className:"sr-only peer","aria-label":`Toggle ${a.label}`}),(0,b.jsx)("div",{className:`h-[18px] w-[18px] rounded-sm border transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-primary/40 ${e?"bg-primary border-primary":"bg-background/50 border-border group-hover:border-foreground/40"}`,children:e&&(0,b.jsx)("svg",{viewBox:"0 0 18 18",className:"h-full w-full text-primary-foreground",fill:"none","aria-hidden":!0,children:(0,b.jsx)("path",{d:"M4 9.5L7.5 12.5L14 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),(0,b.jsx)("div",{className:"min-w-[150px] shrink-0",children:(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:a.label})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[g?(0,b.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border ${i}`,children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current shadow-[0_0_4px_currentColor]"}),"Active"]}):a.detected?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/60 text-muted-foreground/80 bg-muted/20",children:[(0,b.jsx)("span",{className:"h-1 w-1 rounded-full bg-current opacity-60"}),"Detected"]}):(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/30 text-muted-foreground/40",children:"Inactive"}),h&&(0,b.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-pink-500/40 text-pink-400 bg-pink-500/10",children:e?"+ install":"− remove"})]}),(0,b.jsx)("div",{className:"ml-auto hidden lg:block text-[0.7rem] font-mono text-muted-foreground/50 truncate max-w-[420px] group-hover:text-muted-foreground/80 transition-colors",title:a.settingsPath,children:a.settingsPath})]},a.id)})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/40 bg-muted/5",children:[(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-semibold text-foreground",children:d.enabledPolicies.length})," / ",d.policies.length+(d.customPolicies?.length??0)," ","policies enabled"]}),I&&(0,b.jsxs)("span",{className:"text-[0.65rem] text-muted-foreground/60",children:["· shared across ",J," active CLI",1===J?"":"s"]})]}),h&&(0,b.jsx)("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-xs text-red-400",children:h}),k&&(0,b.jsx)(S,{message:k,onDismiss:()=>l(null),onInstall:H,isPending:f}),L.map(a=>{let c=d.policies.filter(b=>b.category===a),h=c.filter(a=>a.enabled).length;return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[h," / ",c.length," enabled"]})]}),c.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"mt-0.5 shrink-0",children:(0,b.jsx)(Q,{enabled:a.enabled,onChange:()=>{var b,c;return b=a.name,c=a.enabled,void(!d||(!d.clis.some(a=>a.installed)?l("Policies are not installed. Install policies to continue."):(l(null),e(a=>a?{...a,policies:a.policies.map(a=>a.name===b?{...a,enabled:!c}:a),enabledPolicies:c?a.enabledPolicies.filter(a=>a!==b):[...a.enabledPolicies,b]}:a),g(async()=>{try{await v(b,!c)}catch{z("policy_toggle","Failed to save policy change."),B()}}))))},disabled:f})}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:[(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name}),a.beta&&(0,b.jsx)("span",{className:"shrink-0 text-[0.6rem] px-1 py-0.5 rounded border bg-violet-500/10 text-violet-400 border-violet-500/20",children:"beta"})]}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:Object.entries(a.params).map(([c,d])=>{let e=a.currentParams?.[c]??d.default,f=JSON.stringify(e)!==JSON.stringify(d.default);return(0,b.jsxs)("span",{className:`inline-flex items-center gap-1 font-mono text-[0.6rem] px-1.5 py-0.5 rounded border ${f?"bg-primary/10 text-primary/70 border-primary/20":"bg-muted/40 text-muted-foreground/55 border-border/40"}`,children:[(0,b.jsxs)("span",{className:"opacity-70",children:[c,":"]}),(0,b.jsx)("span",{children:function(a,b){if("string[]"===a||"pattern[]"===a){let c=Array.isArray(b)?b:[];return 0===c.length?"none":"pattern[]"===a?`${c.length} pattern${1!==c.length?"s":""}`:1===c.length?String(c[0]).slice(0,24):`${c.length} values`}return"boolean"===a?b?"on":"off":null==b||""===b?"—":String(b).slice(0,32)}(d.type,e)})]},c)})})]}),a.params&&Object.keys(a.params).length>0&&(0,b.jsx)("button",{className:"shrink-0 mt-0.5 text-muted-foreground hover:text-primary transition-colors",onClick:()=>{let b=Object.entries(a.params??{}).filter(([b,c])=>JSON.stringify(a.currentParams?.[b]??c.default)!==JSON.stringify(c.default)).length;t("policy_config_modal_opened",{policy_name:a.name,param_count:Object.keys(a.params??{}).length,has_customized_params:b>0,customized_count:b}),p(a)},title:"Edit parameters",children:(0,b.jsx)(n,{className:"h-3.5 w-3.5"})})]},a.name))]},a)}),d.customPoliciesPath&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,b.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:"Custom Policies"}),(0,b.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[d.customPolicies?.length??0," detected"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,b.jsx)(o,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:d.customPoliciesPath})]}),(0,b.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 border-b border-border/20 bg-muted/10",children:[(0,b.jsx)(j,{className:"h-3.5 w-3.5 text-muted-foreground/60 shrink-0 mt-0.5"}),(0,b.jsx)("p",{className:"text-[0.7rem] text-muted-foreground/70 leading-relaxed",children:"Custom policies are always active. To add, remove, or reorder them, edit the JS file above."})]}),d.customPolicies?.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,b.jsx)("div",{className:"h-4 w-7 shrink-0 mt-0.5"}),(0,b.jsx)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:(0,b.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:a.name})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[a.description&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:a.description}),a.eventScope&&(0,b.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:a.eventScope})]})]},a.name))]})]})]})}function U({activeTab:a,onChange:c}){return(0,b.jsx)("div",{className:"tabs",style:{padding:0,marginBottom:24},children:[{id:"activity",label:"Activity"},{id:"policies",label:"Configure"}].map(d=>(0,b.jsx)("button",{type:"button",onClick:()=>c(d.id),className:`tab${a===d.id?" is-active":""}`,children:d.label.toLowerCase()},d.id))})}a.s(["default",0,function({initialTab:a="activity"}){let d=(0,B.useUrlParams)(),{capture:e}=(0,A.usePostHog)(),[f,g]=(0,c.useState)(a),[h,i]=(0,c.useState)(void 0),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]);(0,c.useEffect)(()=>{u().then(a=>{i(a.clis.some(a=>a.installed)),k({enabled:a.enabledPolicies.length,total:a.policies.length+(a.customPolicies?.length??0)}),m(a.clis.filter(a=>a.installed).map(a=>a.label))}).catch(()=>i(void 0))},[]);let n=0===l.length?"Policy evaluations":l.length<=3?`Policy evaluations across ${l.join(", ")}`:`Policy evaluations across ${l.length} agents`,o=a=>{a!==f&&e("policies_tab_switched",{tab:a,from_tab:f}),g(a),d.setAll({tab:"activity"===a?void 0:a})};return(0,b.jsx)("main",{className:"report",children:(0,b.jsxs)("section",{className:"section","data-screen-label":"policies",children:[(0,b.jsx)("h2",{style:{fontFamily:"var(--font-mono)",fontSize:24,fontWeight:600,letterSpacing:"-0.01em",color:"var(--ink)",margin:"0 0 16px"},children:"activity"===f?"Policies":"Configure Policies"}),"activity"===f?(0,b.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:32,flexWrap:"wrap",margin:"0 0 24px"},children:[(0,b.jsxs)("div",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,flex:"1 1 480px",minWidth:0},children:[n,j&&(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[" · ","enabled policies"," ",(0,b.jsxs)("span",{style:{color:"var(--ink)",fontVariantNumeric:"tabular-nums"},children:[j.enabled,"/",j.total]})]})]}),(0,b.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6,flex:"0 0 auto"},children:[(0,b.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:"0.22em",textTransform:"uppercase",color:"var(--dim)"},children:"want to change which policies fire?"}),(0,b.jsx)("button",{type:"button",className:"btn btn-primary",onClick:()=>o("policies"),children:"[ configure policies → ]"})]})]}):(0,b.jsx)("p",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,maxWidth:720,margin:"0 0 24px"},children:"switch policies on or off across your installed agent CLIs."}),(0,b.jsx)(U,{activeTab:f,onChange:o}),"activity"===f?(0,b.jsx)(P,{hooksInstalled:h,onSwitchTab:o}):(0,b.jsx)(T,{onHooksInstallChange:i})]})})}],22712)}];
7
7
 
8
8
  //# sourceMappingURL=app_policies_hooks-client_tsx_19dqvpc._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[3900,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_html-to-image_es_index_1ao30b1.js"].map(b=>a.l(b))).then(()=>b(63460)))}];
2
+
3
+ //# sourceMappingURL=node_modules_html-to-image_es_index_0ihmbv4.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[63460,a=>{"use strict";let b,c=(b=0,()=>(b+=1,`u${`0000${(1679616*Math.random()|0).toString(36)}`.slice(-4)}${b}`));function d(a){let b=[];for(let c=0,d=a.length;c<d;c++)b.push(a[c]);return b}let e=null;function f(a={}){return e||(e=a.includeStyleProperties?a.includeStyleProperties:d(window.getComputedStyle(document.documentElement)))}function g(a,b){let c=(a.ownerDocument.defaultView||window).getComputedStyle(a).getPropertyValue(b);return c?parseFloat(c.replace("px","")):0}function h(a,b={}){let c,d,e,f;return{width:b.width||(c=g(a,"border-left-width"),d=g(a,"border-right-width"),a.clientWidth+c+d),height:b.height||(e=g(a,"border-top-width"),f=g(a,"border-bottom-width"),a.clientHeight+e+f)}}function i(a){return new Promise((b,c)=>{let d=new Image;d.onload=()=>{d.decode().then(()=>{requestAnimationFrame(()=>b(d))})},d.onerror=c,d.crossOrigin="anonymous",d.decoding="async",d.src=a})}async function j(a){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(a)).then(encodeURIComponent).then(a=>`data:image/svg+xml;charset=utf-8,${a}`)}async function k(a,b,c){let d="http://www.w3.org/2000/svg",e=document.createElementNS(d,"svg"),f=document.createElementNS(d,"foreignObject");return e.setAttribute("width",`${b}`),e.setAttribute("height",`${c}`),e.setAttribute("viewBox",`0 0 ${b} ${c}`),f.setAttribute("width","100%"),f.setAttribute("height","100%"),f.setAttribute("x","0"),f.setAttribute("y","0"),f.setAttribute("externalResourcesRequired","true"),e.appendChild(f),f.appendChild(a),j(e)}let l=(a,b)=>{if(a instanceof b)return!0;let c=Object.getPrototypeOf(a);return null!==c&&(c.constructor.name===b.name||l(c,b))};function m(a,b,d,e){let g,h,i,j=window.getComputedStyle(a,d),k=j.getPropertyValue("content");if(""===k||"none"===k)return;let l=c();try{b.className=`${b.className} ${l}`}catch(a){return}let m=document.createElement("style");m.appendChild((g=`.${l}:${d}`,i=j.cssText?(h=j.getPropertyValue("content"),`${j.cssText} content: '${h.replace(/'|"/g,"")}';`):f(e).map(a=>{let b=j.getPropertyValue(a),c=j.getPropertyPriority(a);return`${a}: ${b}${c?" !important":""};`}).join(" "),document.createTextNode(`${g}{${i}}`))),b.appendChild(m)}let n="application/font-woff",o="image/jpeg",p={woff:n,woff2:n,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:o,jpeg:o,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function q(a){let b;return p[((b=/\.([^./]*?)$/g.exec(a))?b[1]:"").toLowerCase()]||""}function r(a){return -1!==a.search(/^(data:)/)}function s(a,b){return`data:${b};base64,${a}`}async function t(a,b,c){let d=await fetch(a,b);if(404===d.status)throw Error(`Resource "${d.url}" not found`);let e=await d.blob();return new Promise((a,b)=>{let f=new FileReader;f.onerror=b,f.onloadend=()=>{try{a(c({res:d,result:f.result}))}catch(a){b(a)}},f.readAsDataURL(e)})}let u={};async function v(a,b,c){var d,e,f;let g,h,i=(d=a,e=b,f=c.includeQueryParams,h=d.replace(/\?.*/,""),f&&(h=d),/ttf|otf|eot|woff2?/i.test(h)&&(h=h.replace(/.*\//,"")),e?`[${e}]${h}`:h);if(null!=u[i])return u[i];c.cacheBust&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());try{let d=await t(a,c.fetchRequestInit,({res:a,result:c})=>(b||(b=a.headers.get("Content-Type")||""),c.split(/,/)[1]));g=s(d,b)}catch(d){g=c.imagePlaceholder||"";let b=`Failed to fetch resource: ${a}`;d&&(b="string"==typeof d?d:d.message),b&&console.warn(b)}return u[i]=g,g}async function w(a){let b=a.toDataURL();return"data:,"===b?a.cloneNode(!1):i(b)}async function x(a,b){if(a.currentSrc){let b=document.createElement("canvas"),c=b.getContext("2d");return b.width=a.clientWidth,b.height=a.clientHeight,null==c||c.drawImage(a,0,0,b.width,b.height),i(b.toDataURL())}let c=a.poster,d=q(c);return i(await v(c,d,b))}async function y(a,b){var c;try{if(null==(c=null==a?void 0:a.contentDocument)?void 0:c.body)return await D(a.contentDocument.body,b,!0)}catch(a){}return a.cloneNode(!1)}async function z(a,b){return l(a,HTMLCanvasElement)?w(a):l(a,HTMLVideoElement)?x(a,b):l(a,HTMLIFrameElement)?y(a,b):a.cloneNode(A(a))}let A=a=>null!=a.tagName&&"SVG"===a.tagName.toUpperCase();async function B(a,b,c){var e,f;if(A(b))return b;let g=[];return 0===(g=null!=a.tagName&&"SLOT"===a.tagName.toUpperCase()&&a.assignedNodes?d(a.assignedNodes()):l(a,HTMLIFrameElement)&&(null==(e=a.contentDocument)?void 0:e.body)?d(a.contentDocument.body.childNodes):d((null!=(f=a.shadowRoot)?f:a).childNodes)).length||l(a,HTMLVideoElement)||await g.reduce((a,d)=>a.then(()=>D(d,c)).then(a=>{a&&b.appendChild(a)}),Promise.resolve()),b}async function C(a,b){let c=a.querySelectorAll?a.querySelectorAll("use"):[];if(0===c.length)return a;let d={};for(let e=0;e<c.length;e++){let f=c[e].getAttribute("xlink:href");if(f){let c=a.querySelector(f),e=document.querySelector(f);c||!e||d[f]||(d[f]=await D(e,b,!0))}}let e=Object.values(d);if(e.length){let b="http://www.w3.org/1999/xhtml",c=document.createElementNS(b,"svg");c.setAttribute("xmlns",b),c.style.position="absolute",c.style.width="0",c.style.height="0",c.style.overflow="hidden",c.style.display="none";let d=document.createElementNS(b,"defs");c.appendChild(d);for(let a=0;a<e.length;a++)d.appendChild(e[a]);a.appendChild(c)}return a}async function D(a,b,c){return c||!b.filter||b.filter(a)?Promise.resolve(a).then(a=>z(a,b)).then(c=>B(a,c,b)).then(c=>(function(a,b,c){if(l(b,Element)&&(!function(a,b,c){let d=b.style;if(!d)return;let e=window.getComputedStyle(a);e.cssText?(d.cssText=e.cssText,d.transformOrigin=e.transformOrigin):f(c).forEach(c=>{let f=e.getPropertyValue(c);if("font-size"===c&&f.endsWith("px")){let a=Math.floor(parseFloat(f.substring(0,f.length-2)))-.1;f=`${a}px`}l(a,HTMLIFrameElement)&&"display"===c&&"inline"===f&&(f="block"),"d"===c&&b.getAttribute("d")&&(f=`path(${b.getAttribute("d")})`),d.setProperty(c,f,e.getPropertyPriority(c))})}(a,b,c),m(a,b,":before",c),m(a,b,":after",c),l(a,HTMLTextAreaElement)&&(b.innerHTML=a.value),l(a,HTMLInputElement)&&b.setAttribute("value",a.value),l(a,HTMLSelectElement))){let c=Array.from(b.children).find(b=>a.value===b.getAttribute("value"));c&&c.setAttribute("selected","")}return b})(a,c,b)).then(a=>C(a,b)):null}let E=/url\((['"]?)([^'"]+?)\1\)/g,F=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,G=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function H(a,b,c,d,e){try{let f,g,h=c?function(a,b){if(a.match(/^[a-z]+:\/\//i))return a;if(a.match(/^\/\//))return window.location.protocol+a;if(a.match(/^[a-z]+:/i))return a;let c=document.implementation.createHTMLDocument(),d=c.createElement("base"),e=c.createElement("a");return c.head.appendChild(d),c.body.appendChild(e),b&&(d.href=b),e.href=a,e.href}(b,c):b,i=q(b);if(e){let a=await e(h);f=s(a,i)}else f=await v(h,i,d);return a.replace((g=b.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1"),RegExp(`(url\\(['"]?)(${g})(['"]?\\))`,"g")),`$1${f}$3`)}catch(a){}return a}function I(a){return -1!==a.search(E)}async function J(a,b,c){let d;if(!I(a))return a;let e=function(a,{preferredFontFormat:b}){return b?a.replace(G,a=>{for(;;){let[c,,d]=F.exec(a)||[];if(!d)return"";if(d===b)return`src: ${c};`}}):a}(a,c);return(d=[],e.replace(E,(a,b,c)=>(d.push(c),a)),d.filter(a=>!r(a))).reduce((a,d)=>a.then(a=>H(a,d,b,c)),Promise.resolve(e))}async function K(a,b,c){var d;let e=null==(d=b.style)?void 0:d.getPropertyValue(a);if(e){let d=await J(e,null,c);return b.style.setProperty(a,d,b.style.getPropertyPriority(a)),!0}return!1}async function L(a,b){await K("background",a,b)||await K("background-image",a,b),await K("mask",a,b)||await K("-webkit-mask",a,b)||await K("mask-image",a,b)||await K("-webkit-mask-image",a,b)}async function M(a,b){let c=l(a,HTMLImageElement);if(!(c&&!r(a.src))&&!(l(a,SVGImageElement)&&!r(a.href.baseVal)))return;let d=c?a.src:a.href.baseVal,e=await v(d,q(d),b);await new Promise((d,f)=>{a.onload=d,a.onerror=b.onImageErrorHandler?(...a)=>{try{d(b.onImageErrorHandler(...a))}catch(a){f(a)}}:f,a.decode&&(a.decode=d),"lazy"===a.loading&&(a.loading="eager"),c?(a.srcset="",a.src=e):a.href.baseVal=e})}async function N(a,b){let c=d(a.childNodes).map(a=>O(a,b));await Promise.all(c).then(()=>a)}async function O(a,b){l(a,Element)&&(await L(a,b),await M(a,b),await N(a,b))}let P={};async function Q(a){let b=P[a];if(null!=b)return b;let c=await fetch(a);return b={url:a,cssText:await c.text()},P[a]=b,b}async function R(a,b){let c=a.cssText,d=/url\(["']?([^"')]+)["']?\)/g;return Promise.all((c.match(/url\([^)]+\)/g)||[]).map(async e=>{let f=e.replace(d,"$1");return f.startsWith("https://")||(f=new URL(f,a.url).href),t(f,b.fetchRequestInit,({result:a})=>(c=c.replace(e,`url(${a})`),[e,a]))})).then(()=>c)}function S(a){if(null==a)return[];let b=[],c=a.replace(/(\/\*[\s\S]*?\*\/)/gi,""),d=RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let a=d.exec(c);if(null===a)break;b.push(a[0])}c=c.replace(d,"");let e=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,f=RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let a=e.exec(c);if(null===a){if(null===(a=f.exec(c)))break;e.lastIndex=f.lastIndex}else f.lastIndex=e.lastIndex;b.push(a[0])}return b}async function T(a,b){let c=[],e=[];return a.forEach(c=>{if("cssRules"in c)try{d(c.cssRules||[]).forEach((a,d)=>{if(a.type===CSSRule.IMPORT_RULE){let f=d+1,g=a.href,h=Q(g).then(a=>R(a,b)).then(a=>S(a).forEach(a=>{try{c.insertRule(a,a.startsWith("@import")?f+=1:c.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:a,error:b})}})).catch(a=>{console.error("Error loading remote css",a.toString())});e.push(h)}})}catch(f){let d=a.find(a=>null==a.href)||document.styleSheets[0];null!=c.href&&e.push(Q(c.href).then(a=>R(a,b)).then(a=>S(a).forEach(a=>{d.insertRule(a,d.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",f)}}),Promise.all(e).then(()=>(a.forEach(a=>{if("cssRules"in a)try{d(a.cssRules||[]).forEach(a=>{c.push(a)})}catch(b){console.error(`Error while reading CSS rules from ${a.href}`,b)}}),c))}async function U(a,b){if(null==a.ownerDocument)throw Error("Provided element is not within a Document");let c=d(a.ownerDocument.styleSheets);return(await T(c,b)).filter(a=>a.type===CSSRule.FONT_FACE_RULE).filter(a=>I(a.style.getPropertyValue("src")))}function V(a){return a.trim().replace(/["']/g,"")}async function W(a,b){let c,d=await U(a,b),e=(c=new Set,!function a(b){(b.style.fontFamily||getComputedStyle(b).fontFamily).split(",").forEach(a=>{c.add(V(a))}),Array.from(b.children).forEach(b=>{b instanceof HTMLElement&&a(b)})}(a),c);return(await Promise.all(d.filter(a=>e.has(V(a.style.fontFamily))).map(a=>{let c=a.parentStyleSheet?a.parentStyleSheet.href:null;return J(a.cssText,c,b)}))).join("\n")}async function X(a,b){let c=null!=b.fontEmbedCSS?b.fontEmbedCSS:b.skipFonts?null:await W(a,b);if(c){let b=document.createElement("style"),d=document.createTextNode(c);b.appendChild(d),a.firstChild?a.insertBefore(b,a.firstChild):a.appendChild(b)}}async function Y(a,b={}){let{width:c,height:d}=h(a,b),e=await D(a,b,!0);return await X(e,b),await O(e,b),!function(a,b){let{style:c}=a;b.backgroundColor&&(c.backgroundColor=b.backgroundColor),b.width&&(c.width=`${b.width}px`),b.height&&(c.height=`${b.height}px`);let d=b.style;null!=d&&Object.keys(d).forEach(a=>{c[a]=d[a]})}(e,b),await k(e,c,d)}async function Z(a,b={}){let{width:c,height:d}=h(a,b),e=await Y(a,b),f=await i(e),g=document.createElement("canvas"),j=g.getContext("2d"),k=b.pixelRatio||function(){let a,b;try{b=process}catch(a){}let c=b&&b.env?b.env.devicePixelRatio:null;return c&&Number.isNaN(a=parseInt(c,10))&&(a=1),a||window.devicePixelRatio||1}(),l=b.canvasWidth||c,m=b.canvasHeight||d;return g.width=l*k,g.height=m*k,!b.skipAutoScale&&(g.width>16384||g.height>16384)&&(g.width>16384&&g.height>16384?g.width>g.height?(g.height*=16384/g.width,g.width=16384):(g.width*=16384/g.height,g.height=16384):g.width>16384?(g.height*=16384/g.width,g.width=16384):(g.width*=16384/g.height,g.height=16384)),g.style.width=`${l}`,g.style.height=`${m}`,b.backgroundColor&&(j.fillStyle=b.backgroundColor,j.fillRect(0,0,g.width,g.height)),j.drawImage(f,0,0,g.width,g.height),g}async function $(a,b={}){let c=await Z(a,b);return await function(a,b={}){return new Promise(a.toBlob?c=>{a.toBlob(c,b.type?b.type:"image/png",b.quality?b.quality:1)}:c=>{let d=window.atob(a.toDataURL(b.type?b.type:void 0,b.quality?b.quality:void 0).split(",")[1]),e=d.length,f=new Uint8Array(e);for(let a=0;a<e;a+=1)f[a]=d.charCodeAt(a);c(new Blob([f],{type:b.type?b.type:"image/png"}))})}(c)}a.s(["toBlob",0,$],63460)}];
2
+
3
+ //# sourceMappingURL=node_modules_html-to-image_es_index_1ao30b1.js.map