shieldcortex 2.20.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (691) hide show
  1. package/README.md +228 -380
  2. package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
  3. package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +5 -5
  4. package/dashboard/.next/standalone/dashboard/.next/prerender-manifest.json +3 -3
  5. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error/page/build-manifest.json +3 -3
  6. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
  7. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
  8. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page/build-manifest.json +3 -3
  14. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
  16. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +3 -3
  17. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  18. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  20. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
  24. package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +4 -4
  25. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  26. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +4 -4
  27. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  28. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +3 -3
  29. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  30. package/dashboard/.next/standalone/dashboard/.next/server/app/page/build-manifest.json +3 -3
  31. package/dashboard/.next/standalone/dashboard/.next/server/app/page/react-loadable-manifest.json +2 -2
  32. package/dashboard/.next/standalone/dashboard/.next/server/app/page.js.nft.json +1 -1
  33. package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  34. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_next_dist_esm_build_templates_app-page_f7d4354e.js +1 -1
  35. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_next_dist_fe6a9400._.js +1 -1
  36. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/[root-of-the-server]__c95102dd._.js +1 -1
  37. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_1cd9d700._.js +1 -1
  38. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_3051539d._.js +11 -0
  39. package/dashboard/.next/standalone/dashboard/.next/server/middleware-build-manifest.js +3 -3
  40. package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
  41. package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
  42. package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.js +1 -1
  43. package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.json +1 -1
  44. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{d334b69bff7779be.js → 215ce64499260c25.js} +1 -1
  45. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{acf32ffeb20e4854.js → 39e59c45c12073c2.js} +1 -1
  46. package/dashboard/.next/standalone/dashboard/.next/static/chunks/3cc7e8d4f73cf5d2.js +1 -0
  47. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{da96df828f9a0188.js → 6ba7a5c1a80a6791.js} +1 -1
  48. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{fc4e920d4281c89e.js → 7d08316952ccdcef.js} +1 -1
  49. package/dashboard/.next/standalone/dashboard/.next/static/chunks/be6970da20a17c0b.js +9 -0
  50. package/dashboard/.next/standalone/dashboard/.next/static/chunks/da64d159c042f5ae.js +1 -0
  51. package/dashboard/.next/standalone/dashboard/.next/static/chunks/e63d2228780629dd.css +3 -0
  52. package/dashboard/.next/standalone/dashboard/.next/static/chunks/f69fd1c5e71fbbfd.js +1 -0
  53. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{26118d592a545e00.js → fa5217550a8ab9a6.js} +2 -2
  54. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{turbopack-7cf1ece01d32a474.js → turbopack-c2d84e7d37269ac1.js} +1 -1
  55. package/dist/api/control.d.ts +0 -1
  56. package/dist/api/control.js +0 -1
  57. package/dist/api/events.d.ts +0 -1
  58. package/dist/api/events.js +0 -1
  59. package/dist/api/session-token.d.ts +0 -1
  60. package/dist/api/session-token.js +0 -1
  61. package/dist/api/version.d.ts +0 -1
  62. package/dist/api/version.js +0 -1
  63. package/dist/api/visualization-server.d.ts +0 -1
  64. package/dist/api/visualization-server.js +117 -3
  65. package/dist/audit/env-scanner.d.ts +0 -1
  66. package/dist/audit/env-scanner.js +0 -1
  67. package/dist/audit/index.d.ts +0 -1
  68. package/dist/audit/index.js +0 -1
  69. package/dist/audit/mcp-config-scanner.d.ts +0 -1
  70. package/dist/audit/mcp-config-scanner.js +0 -1
  71. package/dist/audit/memory-scanner.d.ts +0 -1
  72. package/dist/audit/memory-scanner.js +0 -1
  73. package/dist/audit/report-formatter.d.ts +0 -1
  74. package/dist/audit/report-formatter.js +0 -1
  75. package/dist/audit/rules-file-scanner.d.ts +0 -1
  76. package/dist/audit/rules-file-scanner.js +0 -1
  77. package/dist/audit/types.d.ts +0 -1
  78. package/dist/audit/types.js +0 -1
  79. package/dist/cli/audit.d.ts +0 -1
  80. package/dist/cli/audit.js +0 -1
  81. package/dist/cli/doctor.d.ts +0 -1
  82. package/dist/cli/doctor.js +0 -1
  83. package/dist/cli/iron-dome.d.ts +0 -1
  84. package/dist/cli/iron-dome.js +0 -1
  85. package/dist/cloud/cli.d.ts +0 -1
  86. package/dist/cloud/cli.js +0 -1
  87. package/dist/cloud/config.d.ts +0 -1
  88. package/dist/cloud/config.js +1 -2
  89. package/dist/cloud/iron-dome-sync.d.ts +0 -1
  90. package/dist/cloud/iron-dome-sync.js +0 -1
  91. package/dist/cloud/quarantine-sync.d.ts +0 -1
  92. package/dist/cloud/quarantine-sync.js +0 -1
  93. package/dist/cloud/sync-queue.d.ts +0 -1
  94. package/dist/cloud/sync-queue.js +0 -1
  95. package/dist/cloud/sync.d.ts +0 -1
  96. package/dist/cloud/sync.js +0 -1
  97. package/dist/cloud/verify.d.ts +0 -1
  98. package/dist/cloud/verify.js +0 -1
  99. package/dist/context/project-context.d.ts +0 -1
  100. package/dist/context/project-context.js +0 -1
  101. package/dist/database/init.d.ts +0 -1
  102. package/dist/database/init.js +0 -1
  103. package/dist/defence/audit/export.d.ts +0 -1
  104. package/dist/defence/audit/export.js +0 -1
  105. package/dist/defence/audit/index.d.ts +0 -1
  106. package/dist/defence/audit/index.js +0 -1
  107. package/dist/defence/audit/logger.d.ts +0 -1
  108. package/dist/defence/audit/logger.js +0 -1
  109. package/dist/defence/audit/queries.d.ts +22 -1
  110. package/dist/defence/audit/queries.js +179 -1
  111. package/dist/defence/credential-leak/entropy.d.ts +0 -1
  112. package/dist/defence/credential-leak/entropy.js +0 -1
  113. package/dist/defence/credential-leak/index.d.ts +0 -1
  114. package/dist/defence/credential-leak/index.js +0 -1
  115. package/dist/defence/credential-leak/patterns.d.ts +0 -1
  116. package/dist/defence/credential-leak/patterns.js +0 -1
  117. package/dist/defence/custom-patterns/store.d.ts +0 -1
  118. package/dist/defence/custom-patterns/store.js +0 -1
  119. package/dist/defence/custom-rules/store.d.ts +0 -1
  120. package/dist/defence/custom-rules/store.js +0 -1
  121. package/dist/defence/firewall/anomaly-scorer.d.ts +0 -1
  122. package/dist/defence/firewall/anomaly-scorer.js +0 -1
  123. package/dist/defence/firewall/encoding-detector.d.ts +0 -1
  124. package/dist/defence/firewall/encoding-detector.js +0 -1
  125. package/dist/defence/firewall/index.d.ts +0 -1
  126. package/dist/defence/firewall/index.js +0 -1
  127. package/dist/defence/firewall/instruction-detector.d.ts +0 -1
  128. package/dist/defence/firewall/instruction-detector.js +0 -1
  129. package/dist/defence/firewall/privilege-detector.d.ts +0 -1
  130. package/dist/defence/firewall/privilege-detector.js +0 -1
  131. package/dist/defence/fragmentation/assembly-detector.d.ts +0 -1
  132. package/dist/defence/fragmentation/assembly-detector.js +0 -1
  133. package/dist/defence/fragmentation/entity-extractor.d.ts +0 -1
  134. package/dist/defence/fragmentation/entity-extractor.js +0 -1
  135. package/dist/defence/fragmentation/index.d.ts +0 -1
  136. package/dist/defence/fragmentation/index.js +0 -1
  137. package/dist/defence/fragmentation/temporal-analyzer.d.ts +0 -1
  138. package/dist/defence/fragmentation/temporal-analyzer.js +0 -1
  139. package/dist/defence/index.d.ts +0 -1
  140. package/dist/defence/index.js +0 -1
  141. package/dist/defence/input-sanitisation/index.d.ts +0 -1
  142. package/dist/defence/input-sanitisation/index.js +0 -1
  143. package/dist/defence/iron-dome/action-gate.d.ts +0 -1
  144. package/dist/defence/iron-dome/action-gate.js +0 -1
  145. package/dist/defence/iron-dome/audit.d.ts +0 -1
  146. package/dist/defence/iron-dome/audit.js +0 -1
  147. package/dist/defence/iron-dome/config.d.ts +0 -1
  148. package/dist/defence/iron-dome/config.js +0 -1
  149. package/dist/defence/iron-dome/confirmation-gate.d.ts +0 -1
  150. package/dist/defence/iron-dome/confirmation-gate.js +0 -1
  151. package/dist/defence/iron-dome/custom-policies.d.ts +0 -1
  152. package/dist/defence/iron-dome/custom-policies.js +0 -1
  153. package/dist/defence/iron-dome/gateway.d.ts +0 -1
  154. package/dist/defence/iron-dome/gateway.js +0 -1
  155. package/dist/defence/iron-dome/index.d.ts +0 -1
  156. package/dist/defence/iron-dome/index.js +0 -1
  157. package/dist/defence/iron-dome/injection-scanner.d.ts +0 -1
  158. package/dist/defence/iron-dome/injection-scanner.js +0 -1
  159. package/dist/defence/iron-dome/kill-switch.d.ts +0 -1
  160. package/dist/defence/iron-dome/kill-switch.js +0 -1
  161. package/dist/defence/iron-dome/pii-guard.d.ts +0 -1
  162. package/dist/defence/iron-dome/pii-guard.js +0 -1
  163. package/dist/defence/pipeline.d.ts +0 -1
  164. package/dist/defence/pipeline.js +0 -1
  165. package/dist/defence/quarantine/auto-expire.d.ts +0 -1
  166. package/dist/defence/quarantine/auto-expire.js +0 -1
  167. package/dist/defence/scanner/index.d.ts +0 -1
  168. package/dist/defence/scanner/index.js +0 -1
  169. package/dist/defence/scanner/scan-existing.d.ts +0 -1
  170. package/dist/defence/scanner/scan-existing.js +0 -1
  171. package/dist/defence/sensitivity/classifier.d.ts +0 -1
  172. package/dist/defence/sensitivity/classifier.js +0 -1
  173. package/dist/defence/sensitivity/index.d.ts +0 -1
  174. package/dist/defence/sensitivity/index.js +0 -1
  175. package/dist/defence/sensitivity/patterns.d.ts +0 -1
  176. package/dist/defence/sensitivity/patterns.js +0 -1
  177. package/dist/defence/sensitivity/redaction.d.ts +0 -1
  178. package/dist/defence/sensitivity/redaction.js +0 -1
  179. package/dist/defence/skill-scanner/deep-scan.d.ts +0 -1
  180. package/dist/defence/skill-scanner/deep-scan.js +0 -1
  181. package/dist/defence/skill-scanner/discover.d.ts +0 -1
  182. package/dist/defence/skill-scanner/discover.js +0 -1
  183. package/dist/defence/skill-scanner/index.d.ts +0 -1
  184. package/dist/defence/skill-scanner/index.js +0 -1
  185. package/dist/defence/skill-scanner/parser.d.ts +0 -1
  186. package/dist/defence/skill-scanner/parser.js +0 -1
  187. package/dist/defence/skill-scanner/patterns.d.ts +0 -1
  188. package/dist/defence/skill-scanner/patterns.js +0 -1
  189. package/dist/defence/skill-scanner/scan-skill.d.ts +0 -1
  190. package/dist/defence/skill-scanner/scan-skill.js +0 -1
  191. package/dist/defence/tool-response-scanner.d.ts +0 -1
  192. package/dist/defence/tool-response-scanner.js +0 -1
  193. package/dist/defence/trust/access-control.d.ts +0 -1
  194. package/dist/defence/trust/access-control.js +0 -1
  195. package/dist/defence/trust/agent-scorer.d.ts +0 -1
  196. package/dist/defence/trust/agent-scorer.js +0 -1
  197. package/dist/defence/trust/env-detector.d.ts +0 -1
  198. package/dist/defence/trust/env-detector.js +0 -1
  199. package/dist/defence/trust/index.d.ts +0 -1
  200. package/dist/defence/trust/index.js +0 -1
  201. package/dist/defence/trust/recall-filter.d.ts +0 -1
  202. package/dist/defence/trust/recall-filter.js +0 -1
  203. package/dist/defence/trust/source-scorer.d.ts +0 -1
  204. package/dist/defence/trust/source-scorer.js +0 -1
  205. package/dist/defence/types.d.ts +0 -1
  206. package/dist/defence/types.js +0 -1
  207. package/dist/embeddings/generator.d.ts +0 -1
  208. package/dist/embeddings/generator.js +0 -1
  209. package/dist/embeddings/index.d.ts +0 -1
  210. package/dist/embeddings/index.js +0 -1
  211. package/dist/embeddings/worker.d.ts +0 -1
  212. package/dist/embeddings/worker.js +0 -1
  213. package/dist/errors.d.ts +0 -1
  214. package/dist/errors.js +0 -1
  215. package/dist/events/webhooks.d.ts +0 -1
  216. package/dist/events/webhooks.js +0 -1
  217. package/dist/graph/backfill.d.ts +0 -1
  218. package/dist/graph/backfill.js +0 -1
  219. package/dist/graph/extract.d.ts +0 -1
  220. package/dist/graph/extract.js +0 -1
  221. package/dist/graph/resolve.d.ts +0 -1
  222. package/dist/graph/resolve.js +0 -1
  223. package/dist/index.d.ts +1 -1
  224. package/dist/index.js +10 -2
  225. package/dist/integrations/index.d.ts +0 -1
  226. package/dist/integrations/index.js +0 -1
  227. package/dist/integrations/langchain.d.ts +0 -1
  228. package/dist/integrations/langchain.js +0 -1
  229. package/dist/integrations/openclaw.d.ts +0 -1
  230. package/dist/integrations/openclaw.js +0 -1
  231. package/dist/integrations/universal.d.ts +0 -1
  232. package/dist/integrations/universal.js +0 -1
  233. package/dist/lib.d.ts +0 -1
  234. package/dist/lib.js +0 -1
  235. package/dist/license/cli.d.ts +0 -1
  236. package/dist/license/cli.js +0 -1
  237. package/dist/license/gate.d.ts +0 -1
  238. package/dist/license/gate.js +0 -1
  239. package/dist/license/index.d.ts +0 -1
  240. package/dist/license/index.js +0 -1
  241. package/dist/license/keys.d.ts +0 -1
  242. package/dist/license/keys.js +0 -1
  243. package/dist/license/store.d.ts +0 -1
  244. package/dist/license/store.js +0 -1
  245. package/dist/license/types.d.ts +0 -1
  246. package/dist/license/types.js +0 -1
  247. package/dist/license/validate.d.ts +0 -1
  248. package/dist/license/validate.js +0 -1
  249. package/dist/license/verify.d.ts +0 -1
  250. package/dist/license/verify.js +0 -1
  251. package/dist/memory/activation.d.ts +0 -1
  252. package/dist/memory/activation.js +0 -1
  253. package/dist/memory/consolidate.d.ts +0 -1
  254. package/dist/memory/consolidate.js +0 -1
  255. package/dist/memory/contradiction.d.ts +0 -1
  256. package/dist/memory/contradiction.js +0 -1
  257. package/dist/memory/decay.d.ts +0 -1
  258. package/dist/memory/decay.js +0 -1
  259. package/dist/memory/embedding-cache.d.ts +0 -1
  260. package/dist/memory/embedding-cache.js +0 -1
  261. package/dist/memory/embedding.d.ts +7 -2
  262. package/dist/memory/embedding.js +68 -7
  263. package/dist/memory/expiry.d.ts +0 -1
  264. package/dist/memory/expiry.js +0 -1
  265. package/dist/memory/salience.d.ts +0 -1
  266. package/dist/memory/salience.js +0 -1
  267. package/dist/memory/similarity.d.ts +0 -1
  268. package/dist/memory/similarity.js +0 -1
  269. package/dist/memory/store.d.ts +3 -1
  270. package/dist/memory/store.js +204 -123
  271. package/dist/memory/types.d.ts +21 -1
  272. package/dist/memory/types.js +0 -1
  273. package/dist/server.d.ts +0 -1
  274. package/dist/server.js +0 -1
  275. package/dist/service/install.d.ts +0 -1
  276. package/dist/service/install.js +0 -1
  277. package/dist/service/templates.d.ts +0 -1
  278. package/dist/service/templates.js +0 -1
  279. package/dist/setup/claude-md.d.ts +0 -1
  280. package/dist/setup/claude-md.js +0 -1
  281. package/dist/setup/copilot.d.ts +0 -1
  282. package/dist/setup/copilot.js +0 -1
  283. package/dist/setup/doctor.d.ts +0 -1
  284. package/dist/setup/doctor.js +0 -1
  285. package/dist/setup/hooks.d.ts +3 -1
  286. package/dist/setup/hooks.js +76 -12
  287. package/dist/setup/migrate.d.ts +0 -1
  288. package/dist/setup/migrate.js +0 -1
  289. package/dist/setup/openclaw.d.ts +0 -1
  290. package/dist/setup/openclaw.js +0 -1
  291. package/dist/setup/quickstart.d.ts +8 -0
  292. package/dist/setup/quickstart.js +108 -0
  293. package/dist/setup/settings-hooks.d.ts +0 -1
  294. package/dist/setup/settings-hooks.js +0 -1
  295. package/dist/setup/status.d.ts +0 -1
  296. package/dist/setup/status.js +0 -1
  297. package/dist/setup/uninstall.d.ts +0 -1
  298. package/dist/setup/uninstall.js +0 -1
  299. package/dist/tools/context.d.ts +0 -1
  300. package/dist/tools/context.js +0 -1
  301. package/dist/tools/forget.d.ts +0 -1
  302. package/dist/tools/forget.js +0 -1
  303. package/dist/tools/graph.d.ts +0 -1
  304. package/dist/tools/graph.js +0 -1
  305. package/dist/tools/recall.d.ts +0 -1
  306. package/dist/tools/recall.js +1 -1
  307. package/dist/tools/remember.d.ts +0 -1
  308. package/dist/tools/remember.js +0 -1
  309. package/dist/worker/brain-worker.d.ts +1 -1
  310. package/dist/worker/brain-worker.js +9 -2
  311. package/dist/worker/link-discovery.d.ts +0 -1
  312. package/dist/worker/link-discovery.js +0 -1
  313. package/dist/worker/predictive-consolidation.d.ts +0 -1
  314. package/dist/worker/predictive-consolidation.js +0 -1
  315. package/dist/worker/types.d.ts +0 -1
  316. package/dist/worker/types.js +0 -1
  317. package/hooks/openclaw/cortex-memory/handler.ts +62 -8
  318. package/package.json +9 -8
  319. package/scripts/run-jest.mjs +45 -0
  320. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_25b1b286._.js +0 -11
  321. package/dashboard/.next/standalone/dashboard/.next/static/chunks/364656baa57adaa7.js +0 -1
  322. package/dashboard/.next/standalone/dashboard/.next/static/chunks/6a6ccfb7834de00a.js +0 -9
  323. package/dashboard/.next/standalone/dashboard/.next/static/chunks/6b11a7d29e9abffd.js +0 -1
  324. package/dashboard/.next/standalone/dashboard/.next/static/chunks/ab13d81ce0e121f2.css +0 -3
  325. package/dashboard/.next/standalone/dashboard/.next/static/chunks/cf05262adfab5818.js +0 -1
  326. package/dist/__tests__/consolidation-merge.test.d.ts +0 -9
  327. package/dist/__tests__/consolidation-merge.test.d.ts.map +0 -1
  328. package/dist/__tests__/consolidation-merge.test.js +0 -137
  329. package/dist/__tests__/consolidation-merge.test.js.map +0 -1
  330. package/dist/__tests__/contradictions.test.d.ts +0 -8
  331. package/dist/__tests__/contradictions.test.d.ts.map +0 -1
  332. package/dist/__tests__/contradictions.test.js +0 -78
  333. package/dist/__tests__/contradictions.test.js.map +0 -1
  334. package/dist/__tests__/format-memory.test.d.ts +0 -11
  335. package/dist/__tests__/format-memory.test.d.ts.map +0 -1
  336. package/dist/__tests__/format-memory.test.js +0 -69
  337. package/dist/__tests__/format-memory.test.js.map +0 -1
  338. package/dist/__tests__/salience-evolution.test.d.ts +0 -7
  339. package/dist/__tests__/salience-evolution.test.d.ts.map +0 -1
  340. package/dist/__tests__/salience-evolution.test.js +0 -151
  341. package/dist/__tests__/salience-evolution.test.js.map +0 -1
  342. package/dist/__tests__/store.test.d.ts +0 -7
  343. package/dist/__tests__/store.test.d.ts.map +0 -1
  344. package/dist/__tests__/store.test.js +0 -583
  345. package/dist/__tests__/store.test.js.map +0 -1
  346. package/dist/api/control.d.ts.map +0 -1
  347. package/dist/api/control.js.map +0 -1
  348. package/dist/api/events.d.ts.map +0 -1
  349. package/dist/api/events.js.map +0 -1
  350. package/dist/api/session-token.d.ts.map +0 -1
  351. package/dist/api/session-token.js.map +0 -1
  352. package/dist/api/version.d.ts.map +0 -1
  353. package/dist/api/version.js.map +0 -1
  354. package/dist/api/visualization-server.d.ts.map +0 -1
  355. package/dist/api/visualization-server.js.map +0 -1
  356. package/dist/audit/env-scanner.d.ts.map +0 -1
  357. package/dist/audit/env-scanner.js.map +0 -1
  358. package/dist/audit/index.d.ts.map +0 -1
  359. package/dist/audit/index.js.map +0 -1
  360. package/dist/audit/mcp-config-scanner.d.ts.map +0 -1
  361. package/dist/audit/mcp-config-scanner.js.map +0 -1
  362. package/dist/audit/memory-scanner.d.ts.map +0 -1
  363. package/dist/audit/memory-scanner.js.map +0 -1
  364. package/dist/audit/report-formatter.d.ts.map +0 -1
  365. package/dist/audit/report-formatter.js.map +0 -1
  366. package/dist/audit/rules-file-scanner.d.ts.map +0 -1
  367. package/dist/audit/rules-file-scanner.js.map +0 -1
  368. package/dist/audit/types.d.ts.map +0 -1
  369. package/dist/audit/types.js.map +0 -1
  370. package/dist/cli/audit.d.ts.map +0 -1
  371. package/dist/cli/audit.js.map +0 -1
  372. package/dist/cli/doctor.d.ts.map +0 -1
  373. package/dist/cli/doctor.js.map +0 -1
  374. package/dist/cli/iron-dome.d.ts.map +0 -1
  375. package/dist/cli/iron-dome.js.map +0 -1
  376. package/dist/cloud/cli.d.ts.map +0 -1
  377. package/dist/cloud/cli.js.map +0 -1
  378. package/dist/cloud/config.d.ts.map +0 -1
  379. package/dist/cloud/config.js.map +0 -1
  380. package/dist/cloud/iron-dome-sync.d.ts.map +0 -1
  381. package/dist/cloud/iron-dome-sync.js.map +0 -1
  382. package/dist/cloud/quarantine-sync.d.ts.map +0 -1
  383. package/dist/cloud/quarantine-sync.js.map +0 -1
  384. package/dist/cloud/sync-queue.d.ts.map +0 -1
  385. package/dist/cloud/sync-queue.js.map +0 -1
  386. package/dist/cloud/sync.d.ts.map +0 -1
  387. package/dist/cloud/sync.js.map +0 -1
  388. package/dist/cloud/verify.d.ts.map +0 -1
  389. package/dist/cloud/verify.js.map +0 -1
  390. package/dist/context/project-context.d.ts.map +0 -1
  391. package/dist/context/project-context.js.map +0 -1
  392. package/dist/database/init.d.ts.map +0 -1
  393. package/dist/database/init.js.map +0 -1
  394. package/dist/defence/__tests__/access-control.test.d.ts +0 -5
  395. package/dist/defence/__tests__/access-control.test.d.ts.map +0 -1
  396. package/dist/defence/__tests__/access-control.test.js +0 -89
  397. package/dist/defence/__tests__/access-control.test.js.map +0 -1
  398. package/dist/defence/__tests__/agent-scorer.test.d.ts +0 -5
  399. package/dist/defence/__tests__/agent-scorer.test.d.ts.map +0 -1
  400. package/dist/defence/__tests__/agent-scorer.test.js +0 -75
  401. package/dist/defence/__tests__/agent-scorer.test.js.map +0 -1
  402. package/dist/defence/__tests__/credential-leak.test.d.ts +0 -8
  403. package/dist/defence/__tests__/credential-leak.test.d.ts.map +0 -1
  404. package/dist/defence/__tests__/credential-leak.test.js +0 -403
  405. package/dist/defence/__tests__/credential-leak.test.js.map +0 -1
  406. package/dist/defence/__tests__/env-detector.test.d.ts +0 -5
  407. package/dist/defence/__tests__/env-detector.test.d.ts.map +0 -1
  408. package/dist/defence/__tests__/env-detector.test.js +0 -100
  409. package/dist/defence/__tests__/env-detector.test.js.map +0 -1
  410. package/dist/defence/__tests__/firewall.test.d.ts +0 -8
  411. package/dist/defence/__tests__/firewall.test.d.ts.map +0 -1
  412. package/dist/defence/__tests__/firewall.test.js +0 -123
  413. package/dist/defence/__tests__/firewall.test.js.map +0 -1
  414. package/dist/defence/__tests__/fragmentation.test.d.ts +0 -7
  415. package/dist/defence/__tests__/fragmentation.test.d.ts.map +0 -1
  416. package/dist/defence/__tests__/fragmentation.test.js +0 -51
  417. package/dist/defence/__tests__/fragmentation.test.js.map +0 -1
  418. package/dist/defence/__tests__/pipeline.test.d.ts +0 -8
  419. package/dist/defence/__tests__/pipeline.test.d.ts.map +0 -1
  420. package/dist/defence/__tests__/pipeline.test.js +0 -106
  421. package/dist/defence/__tests__/pipeline.test.js.map +0 -1
  422. package/dist/defence/__tests__/sensitivity.test.d.ts +0 -7
  423. package/dist/defence/__tests__/sensitivity.test.d.ts.map +0 -1
  424. package/dist/defence/__tests__/sensitivity.test.js +0 -61
  425. package/dist/defence/__tests__/sensitivity.test.js.map +0 -1
  426. package/dist/defence/__tests__/tool-response-scanner.test.d.ts +0 -8
  427. package/dist/defence/__tests__/tool-response-scanner.test.d.ts.map +0 -1
  428. package/dist/defence/__tests__/tool-response-scanner.test.js +0 -106
  429. package/dist/defence/__tests__/tool-response-scanner.test.js.map +0 -1
  430. package/dist/defence/__tests__/trust.test.d.ts +0 -7
  431. package/dist/defence/__tests__/trust.test.d.ts.map +0 -1
  432. package/dist/defence/__tests__/trust.test.js +0 -50
  433. package/dist/defence/__tests__/trust.test.js.map +0 -1
  434. package/dist/defence/__tests__/verify.test.d.ts +0 -7
  435. package/dist/defence/__tests__/verify.test.d.ts.map +0 -1
  436. package/dist/defence/__tests__/verify.test.js +0 -143
  437. package/dist/defence/__tests__/verify.test.js.map +0 -1
  438. package/dist/defence/audit/export.d.ts.map +0 -1
  439. package/dist/defence/audit/export.js.map +0 -1
  440. package/dist/defence/audit/index.d.ts.map +0 -1
  441. package/dist/defence/audit/index.js.map +0 -1
  442. package/dist/defence/audit/logger.d.ts.map +0 -1
  443. package/dist/defence/audit/logger.js.map +0 -1
  444. package/dist/defence/audit/queries.d.ts.map +0 -1
  445. package/dist/defence/audit/queries.js.map +0 -1
  446. package/dist/defence/credential-leak/entropy.d.ts.map +0 -1
  447. package/dist/defence/credential-leak/entropy.js.map +0 -1
  448. package/dist/defence/credential-leak/index.d.ts.map +0 -1
  449. package/dist/defence/credential-leak/index.js.map +0 -1
  450. package/dist/defence/credential-leak/patterns.d.ts.map +0 -1
  451. package/dist/defence/credential-leak/patterns.js.map +0 -1
  452. package/dist/defence/custom-patterns/store.d.ts.map +0 -1
  453. package/dist/defence/custom-patterns/store.js.map +0 -1
  454. package/dist/defence/custom-rules/store.d.ts.map +0 -1
  455. package/dist/defence/custom-rules/store.js.map +0 -1
  456. package/dist/defence/firewall/anomaly-scorer.d.ts.map +0 -1
  457. package/dist/defence/firewall/anomaly-scorer.js.map +0 -1
  458. package/dist/defence/firewall/encoding-detector.d.ts.map +0 -1
  459. package/dist/defence/firewall/encoding-detector.js.map +0 -1
  460. package/dist/defence/firewall/index.d.ts.map +0 -1
  461. package/dist/defence/firewall/index.js.map +0 -1
  462. package/dist/defence/firewall/instruction-detector.d.ts.map +0 -1
  463. package/dist/defence/firewall/instruction-detector.js.map +0 -1
  464. package/dist/defence/firewall/privilege-detector.d.ts.map +0 -1
  465. package/dist/defence/firewall/privilege-detector.js.map +0 -1
  466. package/dist/defence/fragmentation/assembly-detector.d.ts.map +0 -1
  467. package/dist/defence/fragmentation/assembly-detector.js.map +0 -1
  468. package/dist/defence/fragmentation/entity-extractor.d.ts.map +0 -1
  469. package/dist/defence/fragmentation/entity-extractor.js.map +0 -1
  470. package/dist/defence/fragmentation/index.d.ts.map +0 -1
  471. package/dist/defence/fragmentation/index.js.map +0 -1
  472. package/dist/defence/fragmentation/temporal-analyzer.d.ts.map +0 -1
  473. package/dist/defence/fragmentation/temporal-analyzer.js.map +0 -1
  474. package/dist/defence/index.d.ts.map +0 -1
  475. package/dist/defence/index.js.map +0 -1
  476. package/dist/defence/input-sanitisation/index.d.ts.map +0 -1
  477. package/dist/defence/input-sanitisation/index.js.map +0 -1
  478. package/dist/defence/iron-dome/__tests__/action-gate.test.d.ts +0 -5
  479. package/dist/defence/iron-dome/__tests__/action-gate.test.d.ts.map +0 -1
  480. package/dist/defence/iron-dome/__tests__/action-gate.test.js +0 -71
  481. package/dist/defence/iron-dome/__tests__/action-gate.test.js.map +0 -1
  482. package/dist/defence/iron-dome/__tests__/confirmation-gate.test.d.ts +0 -5
  483. package/dist/defence/iron-dome/__tests__/confirmation-gate.test.d.ts.map +0 -1
  484. package/dist/defence/iron-dome/__tests__/confirmation-gate.test.js +0 -144
  485. package/dist/defence/iron-dome/__tests__/confirmation-gate.test.js.map +0 -1
  486. package/dist/defence/iron-dome/__tests__/gateway.test.d.ts +0 -5
  487. package/dist/defence/iron-dome/__tests__/gateway.test.d.ts.map +0 -1
  488. package/dist/defence/iron-dome/__tests__/gateway.test.js +0 -60
  489. package/dist/defence/iron-dome/__tests__/gateway.test.js.map +0 -1
  490. package/dist/defence/iron-dome/__tests__/injection-scanner.test.d.ts +0 -7
  491. package/dist/defence/iron-dome/__tests__/injection-scanner.test.d.ts.map +0 -1
  492. package/dist/defence/iron-dome/__tests__/injection-scanner.test.js +0 -230
  493. package/dist/defence/iron-dome/__tests__/injection-scanner.test.js.map +0 -1
  494. package/dist/defence/iron-dome/__tests__/pii-guard.test.d.ts +0 -5
  495. package/dist/defence/iron-dome/__tests__/pii-guard.test.d.ts.map +0 -1
  496. package/dist/defence/iron-dome/__tests__/pii-guard.test.js +0 -130
  497. package/dist/defence/iron-dome/__tests__/pii-guard.test.js.map +0 -1
  498. package/dist/defence/iron-dome/action-gate.d.ts.map +0 -1
  499. package/dist/defence/iron-dome/action-gate.js.map +0 -1
  500. package/dist/defence/iron-dome/audit.d.ts.map +0 -1
  501. package/dist/defence/iron-dome/audit.js.map +0 -1
  502. package/dist/defence/iron-dome/config.d.ts.map +0 -1
  503. package/dist/defence/iron-dome/config.js.map +0 -1
  504. package/dist/defence/iron-dome/confirmation-gate.d.ts.map +0 -1
  505. package/dist/defence/iron-dome/confirmation-gate.js.map +0 -1
  506. package/dist/defence/iron-dome/custom-policies.d.ts.map +0 -1
  507. package/dist/defence/iron-dome/custom-policies.js.map +0 -1
  508. package/dist/defence/iron-dome/gateway.d.ts.map +0 -1
  509. package/dist/defence/iron-dome/gateway.js.map +0 -1
  510. package/dist/defence/iron-dome/index.d.ts.map +0 -1
  511. package/dist/defence/iron-dome/index.js.map +0 -1
  512. package/dist/defence/iron-dome/injection-scanner.d.ts.map +0 -1
  513. package/dist/defence/iron-dome/injection-scanner.js.map +0 -1
  514. package/dist/defence/iron-dome/kill-switch.d.ts.map +0 -1
  515. package/dist/defence/iron-dome/kill-switch.js.map +0 -1
  516. package/dist/defence/iron-dome/pii-guard.d.ts.map +0 -1
  517. package/dist/defence/iron-dome/pii-guard.js.map +0 -1
  518. package/dist/defence/pipeline.d.ts.map +0 -1
  519. package/dist/defence/pipeline.js.map +0 -1
  520. package/dist/defence/quarantine/auto-expire.d.ts.map +0 -1
  521. package/dist/defence/quarantine/auto-expire.js.map +0 -1
  522. package/dist/defence/scanner/index.d.ts.map +0 -1
  523. package/dist/defence/scanner/index.js.map +0 -1
  524. package/dist/defence/scanner/scan-existing.d.ts.map +0 -1
  525. package/dist/defence/scanner/scan-existing.js.map +0 -1
  526. package/dist/defence/sensitivity/classifier.d.ts.map +0 -1
  527. package/dist/defence/sensitivity/classifier.js.map +0 -1
  528. package/dist/defence/sensitivity/index.d.ts.map +0 -1
  529. package/dist/defence/sensitivity/index.js.map +0 -1
  530. package/dist/defence/sensitivity/patterns.d.ts.map +0 -1
  531. package/dist/defence/sensitivity/patterns.js.map +0 -1
  532. package/dist/defence/sensitivity/redaction.d.ts.map +0 -1
  533. package/dist/defence/sensitivity/redaction.js.map +0 -1
  534. package/dist/defence/skill-scanner/__tests__/skill-scanner.test.d.ts +0 -12
  535. package/dist/defence/skill-scanner/__tests__/skill-scanner.test.d.ts.map +0 -1
  536. package/dist/defence/skill-scanner/__tests__/skill-scanner.test.js +0 -471
  537. package/dist/defence/skill-scanner/__tests__/skill-scanner.test.js.map +0 -1
  538. package/dist/defence/skill-scanner/deep-scan.d.ts.map +0 -1
  539. package/dist/defence/skill-scanner/deep-scan.js.map +0 -1
  540. package/dist/defence/skill-scanner/discover.d.ts.map +0 -1
  541. package/dist/defence/skill-scanner/discover.js.map +0 -1
  542. package/dist/defence/skill-scanner/index.d.ts.map +0 -1
  543. package/dist/defence/skill-scanner/index.js.map +0 -1
  544. package/dist/defence/skill-scanner/parser.d.ts.map +0 -1
  545. package/dist/defence/skill-scanner/parser.js.map +0 -1
  546. package/dist/defence/skill-scanner/patterns.d.ts.map +0 -1
  547. package/dist/defence/skill-scanner/patterns.js.map +0 -1
  548. package/dist/defence/skill-scanner/scan-skill.d.ts.map +0 -1
  549. package/dist/defence/skill-scanner/scan-skill.js.map +0 -1
  550. package/dist/defence/tool-response-scanner.d.ts.map +0 -1
  551. package/dist/defence/tool-response-scanner.js.map +0 -1
  552. package/dist/defence/trust/access-control.d.ts.map +0 -1
  553. package/dist/defence/trust/access-control.js.map +0 -1
  554. package/dist/defence/trust/agent-scorer.d.ts.map +0 -1
  555. package/dist/defence/trust/agent-scorer.js.map +0 -1
  556. package/dist/defence/trust/env-detector.d.ts.map +0 -1
  557. package/dist/defence/trust/env-detector.js.map +0 -1
  558. package/dist/defence/trust/index.d.ts.map +0 -1
  559. package/dist/defence/trust/index.js.map +0 -1
  560. package/dist/defence/trust/recall-filter.d.ts.map +0 -1
  561. package/dist/defence/trust/recall-filter.js.map +0 -1
  562. package/dist/defence/trust/source-scorer.d.ts.map +0 -1
  563. package/dist/defence/trust/source-scorer.js.map +0 -1
  564. package/dist/defence/types.d.ts.map +0 -1
  565. package/dist/defence/types.js.map +0 -1
  566. package/dist/embeddings/generator.d.ts.map +0 -1
  567. package/dist/embeddings/generator.js.map +0 -1
  568. package/dist/embeddings/index.d.ts.map +0 -1
  569. package/dist/embeddings/index.js.map +0 -1
  570. package/dist/embeddings/worker.d.ts.map +0 -1
  571. package/dist/embeddings/worker.js.map +0 -1
  572. package/dist/errors.d.ts.map +0 -1
  573. package/dist/errors.js.map +0 -1
  574. package/dist/events/webhooks.d.ts.map +0 -1
  575. package/dist/events/webhooks.js.map +0 -1
  576. package/dist/graph/backfill.d.ts.map +0 -1
  577. package/dist/graph/backfill.js.map +0 -1
  578. package/dist/graph/extract.d.ts.map +0 -1
  579. package/dist/graph/extract.js.map +0 -1
  580. package/dist/graph/resolve.d.ts.map +0 -1
  581. package/dist/graph/resolve.js.map +0 -1
  582. package/dist/index.d.ts.map +0 -1
  583. package/dist/index.js.map +0 -1
  584. package/dist/integrations/__tests__/openclaw.test.d.ts +0 -2
  585. package/dist/integrations/__tests__/openclaw.test.d.ts.map +0 -1
  586. package/dist/integrations/__tests__/openclaw.test.js +0 -72
  587. package/dist/integrations/__tests__/openclaw.test.js.map +0 -1
  588. package/dist/integrations/__tests__/universal.test.d.ts +0 -2
  589. package/dist/integrations/__tests__/universal.test.d.ts.map +0 -1
  590. package/dist/integrations/__tests__/universal.test.js +0 -144
  591. package/dist/integrations/__tests__/universal.test.js.map +0 -1
  592. package/dist/integrations/index.d.ts.map +0 -1
  593. package/dist/integrations/index.js.map +0 -1
  594. package/dist/integrations/langchain.d.ts.map +0 -1
  595. package/dist/integrations/langchain.js.map +0 -1
  596. package/dist/integrations/openclaw.d.ts.map +0 -1
  597. package/dist/integrations/openclaw.js.map +0 -1
  598. package/dist/integrations/universal.d.ts.map +0 -1
  599. package/dist/integrations/universal.js.map +0 -1
  600. package/dist/lib.d.ts.map +0 -1
  601. package/dist/lib.js.map +0 -1
  602. package/dist/license/__tests__/feature-gating.test.d.ts +0 -10
  603. package/dist/license/__tests__/feature-gating.test.d.ts.map +0 -1
  604. package/dist/license/__tests__/feature-gating.test.js +0 -188
  605. package/dist/license/__tests__/feature-gating.test.js.map +0 -1
  606. package/dist/license/cli.d.ts.map +0 -1
  607. package/dist/license/cli.js.map +0 -1
  608. package/dist/license/gate.d.ts.map +0 -1
  609. package/dist/license/gate.js.map +0 -1
  610. package/dist/license/index.d.ts.map +0 -1
  611. package/dist/license/index.js.map +0 -1
  612. package/dist/license/keys.d.ts.map +0 -1
  613. package/dist/license/keys.js.map +0 -1
  614. package/dist/license/store.d.ts.map +0 -1
  615. package/dist/license/store.js.map +0 -1
  616. package/dist/license/types.d.ts.map +0 -1
  617. package/dist/license/types.js.map +0 -1
  618. package/dist/license/validate.d.ts.map +0 -1
  619. package/dist/license/validate.js.map +0 -1
  620. package/dist/license/verify.d.ts.map +0 -1
  621. package/dist/license/verify.js.map +0 -1
  622. package/dist/memory/activation.d.ts.map +0 -1
  623. package/dist/memory/activation.js.map +0 -1
  624. package/dist/memory/consolidate.d.ts.map +0 -1
  625. package/dist/memory/consolidate.js.map +0 -1
  626. package/dist/memory/contradiction.d.ts.map +0 -1
  627. package/dist/memory/contradiction.js.map +0 -1
  628. package/dist/memory/decay.d.ts.map +0 -1
  629. package/dist/memory/decay.js.map +0 -1
  630. package/dist/memory/embedding-cache.d.ts.map +0 -1
  631. package/dist/memory/embedding-cache.js.map +0 -1
  632. package/dist/memory/embedding.d.ts.map +0 -1
  633. package/dist/memory/embedding.js.map +0 -1
  634. package/dist/memory/expiry.d.ts.map +0 -1
  635. package/dist/memory/expiry.js.map +0 -1
  636. package/dist/memory/salience.d.ts.map +0 -1
  637. package/dist/memory/salience.js.map +0 -1
  638. package/dist/memory/similarity.d.ts.map +0 -1
  639. package/dist/memory/similarity.js.map +0 -1
  640. package/dist/memory/store.d.ts.map +0 -1
  641. package/dist/memory/store.js.map +0 -1
  642. package/dist/memory/types.d.ts.map +0 -1
  643. package/dist/memory/types.js.map +0 -1
  644. package/dist/server.d.ts.map +0 -1
  645. package/dist/server.js.map +0 -1
  646. package/dist/service/install.d.ts.map +0 -1
  647. package/dist/service/install.js.map +0 -1
  648. package/dist/service/templates.d.ts.map +0 -1
  649. package/dist/service/templates.js.map +0 -1
  650. package/dist/setup/claude-md.d.ts.map +0 -1
  651. package/dist/setup/claude-md.js.map +0 -1
  652. package/dist/setup/copilot.d.ts.map +0 -1
  653. package/dist/setup/copilot.js.map +0 -1
  654. package/dist/setup/doctor.d.ts.map +0 -1
  655. package/dist/setup/doctor.js.map +0 -1
  656. package/dist/setup/hooks.d.ts.map +0 -1
  657. package/dist/setup/hooks.js.map +0 -1
  658. package/dist/setup/migrate.d.ts.map +0 -1
  659. package/dist/setup/migrate.js.map +0 -1
  660. package/dist/setup/openclaw.d.ts.map +0 -1
  661. package/dist/setup/openclaw.js.map +0 -1
  662. package/dist/setup/settings-hooks.d.ts.map +0 -1
  663. package/dist/setup/settings-hooks.js.map +0 -1
  664. package/dist/setup/status.d.ts.map +0 -1
  665. package/dist/setup/status.js.map +0 -1
  666. package/dist/setup/uninstall.d.ts.map +0 -1
  667. package/dist/setup/uninstall.js.map +0 -1
  668. package/dist/tools/context.d.ts.map +0 -1
  669. package/dist/tools/context.js.map +0 -1
  670. package/dist/tools/forget.d.ts.map +0 -1
  671. package/dist/tools/forget.js.map +0 -1
  672. package/dist/tools/graph.d.ts.map +0 -1
  673. package/dist/tools/graph.js.map +0 -1
  674. package/dist/tools/recall.d.ts.map +0 -1
  675. package/dist/tools/recall.js.map +0 -1
  676. package/dist/tools/remember.d.ts.map +0 -1
  677. package/dist/tools/remember.js.map +0 -1
  678. package/dist/worker/brain-worker.d.ts.map +0 -1
  679. package/dist/worker/brain-worker.js.map +0 -1
  680. package/dist/worker/link-discovery.d.ts.map +0 -1
  681. package/dist/worker/link-discovery.js.map +0 -1
  682. package/dist/worker/predictive-consolidation.d.ts.map +0 -1
  683. package/dist/worker/predictive-consolidation.js.map +0 -1
  684. package/dist/worker/types.d.ts.map +0 -1
  685. package/dist/worker/types.js.map +0 -1
  686. package/plugins/openclaw/README.md +0 -93
  687. package/plugins/openclaw/index.ts +0 -432
  688. package/plugins/openclaw/openclaw.plugin.json +0 -10
  689. /package/dashboard/.next/standalone/dashboard/.next/static/{aFo1BShJENvQZgqpWRJaw → ljjBNdtxDUABGiIMYNYT6}/_buildManifest.js +0 -0
  690. /package/dashboard/.next/standalone/dashboard/.next/static/{aFo1BShJENvQZgqpWRJaw → ljjBNdtxDUABGiIMYNYT6}/_clientMiddlewareManifest.json +0 -0
  691. /package/dashboard/.next/standalone/dashboard/.next/static/{aFo1BShJENvQZgqpWRJaw → ljjBNdtxDUABGiIMYNYT6}/_ssgManifest.js +0 -0
@@ -1,9 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23733,e=>{"use strict";let t,s,a,i,r,n,l,o;var c,d=e.i(27493),u=e.i(4),h=e.i(22534);let m=(0,u.createContext)({});function x(e){let t=(0,u.useRef)(null);return null===t.current&&(t.current=e()),t.current}let p="u">typeof window,f=p?u.useLayoutEffect:u.useEffect,g=(0,u.createContext)(null);function y(e){return"object"==typeof e&&null!==e}function v(e){return y(e)&&"offsetHeight"in e}var b=u;let j=(0,u.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function w(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class N extends b.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,s=v(e)&&e.offsetWidth||0,a=v(e)&&e.offsetHeight||0,i=this.props.sizeRef.current;i.height=t.offsetHeight||0,i.width=t.offsetWidth||0,i.top=t.offsetTop,i.left=t.offsetLeft,i.right=s-i.width-i.left,i.bottom=a-i.height-i.top}return null}componentDidUpdate(){}render(){return this.props.children}}function k({children:e,isPresent:t,anchorX:s,anchorY:a,root:i}){let r=(0,b.useId)(),n=(0,b.useRef)(null),l=(0,b.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:o}=(0,b.useContext)(j),c=function(...e){return u.useCallback(function(...e){return t=>{let s=!1,a=e.map(e=>{let a=w(e,t);return s||"function"!=typeof a||(s=!0),a});if(s)return()=>{for(let t=0;t<a.length;t++){let s=a[t];"function"==typeof s?s():w(e[t],null)}}}}(...e),e)}(n,e.props?.ref??e?.ref);return(0,b.useInsertionEffect)(()=>{let{width:e,height:c,top:d,left:u,right:h,bottom:m}=l.current;if(t||!n.current||!e||!c)return;let x="left"===s?`left: ${u}`:`right: ${h}`,p="bottom"===a?`bottom: ${m}`:`top: ${d}`;n.current.dataset.motionPopId=r;let f=document.createElement("style");o&&(f.nonce=o);let g=i??document.head;return g.appendChild(f),f.sheet&&f.sheet.insertRule(`
2
- [data-motion-pop-id="${r}"] {
3
- position: absolute !important;
4
- width: ${e}px !important;
5
- height: ${c}px !important;
6
- ${x}px !important;
7
- ${p}px !important;
8
- }
9
- `),()=>{g.contains(f)&&g.removeChild(f)}},[t]),(0,d.jsx)(N,{isPresent:t,childRef:n,sizeRef:l,children:b.cloneElement(e,{ref:c})})}let S=({children:e,initial:t,isPresent:s,onExitComplete:a,custom:i,presenceAffectsLayout:r,mode:n,anchorX:l,anchorY:o,root:c})=>{let h=x(C),m=(0,u.useId)(),p=!0,f=(0,u.useMemo)(()=>(p=!1,{id:m,initial:t,isPresent:s,custom:i,onExitComplete:e=>{for(let t of(h.set(e,!0),h.values()))if(!t)return;a&&a()},register:e=>(h.set(e,!1),()=>h.delete(e))}),[s,h,a]);return r&&p&&(f={...f}),(0,u.useMemo)(()=>{h.forEach((e,t)=>h.set(t,!1))},[s]),u.useEffect(()=>{s||h.size||!a||a()},[s]),"popLayout"===n&&(e=(0,d.jsx)(k,{isPresent:s,anchorX:l,anchorY:o,root:c,children:e})),(0,d.jsx)(g.Provider,{value:f,children:e})};function C(){return new Map}function T(e=!0){let t=(0,u.useContext)(g);if(null===t)return[!0,null];let{isPresent:s,onExitComplete:a,register:i}=t,r=(0,u.useId)();(0,u.useEffect)(()=>{if(e)return i(r)},[e]);let n=(0,u.useCallback)(()=>e&&a&&a(r),[r,a,e]);return!s&&a?[!1,n]:[!0]}let P=e=>e.key||"";function A(e){let t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&t.push(e)}),t}let M=({children:e,custom:t,initial:s=!0,onExitComplete:a,presenceAffectsLayout:i=!0,mode:r="sync",propagate:n=!1,anchorX:l="left",anchorY:o="top",root:c})=>{let[h,p]=T(n),g=(0,u.useMemo)(()=>A(e),[e]),y=n&&!h?[]:g.map(P),v=(0,u.useRef)(!0),b=(0,u.useRef)(g),j=x(()=>new Map),w=(0,u.useRef)(new Set),[N,k]=(0,u.useState)(g),[C,M]=(0,u.useState)(g);f(()=>{v.current=!1,b.current=g;for(let e=0;e<C.length;e++){let t=P(C[e]);y.includes(t)?(j.delete(t),w.current.delete(t)):!0!==j.get(t)&&j.set(t,!1)}},[C,y.length,y.join("-")]);let E=[];if(g!==N){let e=[...g];for(let t=0;t<C.length;t++){let s=C[t],a=P(s);y.includes(a)||(e.splice(t,0,s),E.push(s))}return"wait"===r&&E.length&&(e=E),M(A(e)),k(g),null}let{forceRender:D}=(0,u.useContext)(m);return(0,d.jsx)(d.Fragment,{children:C.map(e=>{let u=P(e),m=(!n||!!h)&&(g===C||y.includes(u));return(0,d.jsx)(S,{isPresent:m,initial:(!v.current||!!s)&&void 0,custom:t,presenceAffectsLayout:i,mode:r,root:c,onExitComplete:m?void 0:()=>{if(w.current.has(u)||(w.current.add(u),!j.has(u)))return;j.set(u,!0);let e=!0;j.forEach(t=>{t||(e=!1)}),e&&(D?.(),M(b.current),n&&p?.(),a&&a())},anchorX:l,anchorY:o,children:e},u)})})},E=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],D=new Set(E),L=(e,t,s)=>s>t?t:s<e?e:s,F={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},R={...F,transform:e=>L(0,1,e)},$={...F,default:1},z=e=>Math.round(1e5*e)/1e5,_=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,V=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,I=(e,t)=>s=>!!("string"==typeof s&&V.test(s)&&s.startsWith(e)||t&&null!=s&&Object.prototype.hasOwnProperty.call(s,t)),O=(e,t,s)=>a=>{if("string"!=typeof a)return a;let[i,r,n,l]=a.match(_);return{[e]:parseFloat(i),[t]:parseFloat(r),[s]:parseFloat(n),alpha:void 0!==l?parseFloat(l):1}},B={...F,transform:e=>Math.round(L(0,255,e))},U={test:I("rgb","red"),parse:O("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:a=1})=>"rgba("+B.transform(e)+", "+B.transform(t)+", "+B.transform(s)+", "+z(R.transform(a))+")"},q={test:I("#"),parse:function(e){let t="",s="",a="",i="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),a=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),a=e.substring(3,4),i=e.substring(4,5),t+=t,s+=s,a+=a,i+=i),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(a,16),alpha:i?parseInt(i,16)/255:1}},transform:U.transform},K=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),W=K("deg"),Q=K("%"),H=K("px"),X=K("vh"),Y=K("vw"),G={...Q,parse:e=>Q.parse(e)/100,transform:e=>Q.transform(100*e)},J={test:I("hsl","hue"),parse:O("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:a=1})=>"hsla("+Math.round(e)+", "+Q.transform(z(t))+", "+Q.transform(z(s))+", "+z(R.transform(a))+")"},Z={test:e=>U.test(e)||q.test(e)||J.test(e),parse:e=>U.test(e)?U.parse(e):J.test(e)?J.parse(e):q.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?U.transform(e):J.transform(e),getAnimatableNone:e=>{let t=Z.parse(e);return t.alpha=0,Z.transform(t)}},ee=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,et="number",es="color",ea=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ei(e){let t=e.toString(),s=[],a={color:[],number:[],var:[]},i=[],r=0,n=t.replace(ea,e=>(Z.test(e)?(a.color.push(r),i.push(es),s.push(Z.parse(e))):e.startsWith("var(")?(a.var.push(r),i.push("var"),s.push(e)):(a.number.push(r),i.push(et),s.push(parseFloat(e))),++r,"${}")).split("${}");return{values:s,split:n,indexes:a,types:i}}function er(e){return ei(e).values}function en(e){let{split:t,types:s}=ei(e),a=t.length;return e=>{let i="";for(let r=0;r<a;r++)if(i+=t[r],void 0!==e[r]){let t=s[r];t===et?i+=z(e[r]):t===es?i+=Z.transform(e[r]):i+=e[r]}return i}}let el=e=>"number"==typeof e?0:Z.test(e)?Z.getAnimatableNone(e):e,eo={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(_)?.length||0)+(e.match(ee)?.length||0)>0},parse:er,createTransformer:en,getAnimatableNone:function(e){let t=er(e);return en(e)(t.map(el))}},ec=new Set(["brightness","contrast","saturate","opacity"]);function ed(e){let[t,s]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[a]=s.match(_)||[];if(!a)return e;let i=s.replace(a,""),r=+!!ec.has(t);return a!==s&&(r*=100),t+"("+r+i+")"}let eu=/\b([a-z-]*)\(.*?\)/gu,eh={...eo,getAnimatableNone:e=>{let t=e.match(eu);return t?t.map(ed).join(" "):e}},em={...F,transform:Math.round},ex={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,rotate:W,rotateX:W,rotateY:W,rotateZ:W,scale:$,scaleX:$,scaleY:$,scaleZ:$,skew:W,skewX:W,skewY:W,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:R,originX:G,originY:G,originZ:H,zIndex:em,fillOpacity:R,strokeOpacity:R,numOctaves:em},ep={...ex,color:Z,backgroundColor:Z,outlineColor:Z,fill:Z,stroke:Z,borderColor:Z,borderTopColor:Z,borderRightColor:Z,borderBottomColor:Z,borderLeftColor:Z,filter:eh,WebkitFilter:eh},ef=e=>ep[e],eg=()=>({translate:0,scale:1,origin:0,originPoint:0}),ey=()=>({x:eg(),y:eg()}),ev=()=>({min:0,max:0}),eb=()=>({x:ev(),y:ev()}),ej=e=>!!(e&&e.getVelocity),ew=new Set(["width","height","top","left","right","bottom",...E]),eN=e=>t=>t.test(e),ek=[F,H,Q,W,Y,X,{test:e=>"auto"===e,parse:e=>e}],eS=e=>ek.find(eN(e)),eC=()=>{},eT=()=>{};h.default;let eP=e=>t=>"string"==typeof t&&t.startsWith(e),eA=eP("--"),eM=eP("var(--"),eE=e=>!!eM(e)&&eD.test(e.split("/*")[0].trim()),eD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function eL(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let eF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,eR=e=>180*e/Math.PI,e$=e=>e_(eR(Math.atan2(e[1],e[0]))),ez={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:e$,rotateZ:e$,skewX:e=>eR(Math.atan(e[1])),skewY:e=>eR(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},e_=e=>((e%=360)<0&&(e+=360),e),eV=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),eI=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),eO={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:eV,scaleY:eI,scale:e=>(eV(e)+eI(e))/2,rotateX:e=>e_(eR(Math.atan2(e[6],e[5]))),rotateY:e=>e_(eR(Math.atan2(-e[2],e[0]))),rotateZ:e$,rotate:e$,skewX:e=>eR(Math.atan(e[4])),skewY:e=>eR(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eB(e){return+!!e.includes("scale")}function eU(e,t){let s,a;if(!e||"none"===e)return eB(t);let i=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(i)s=eO,a=i;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=ez,a=t}if(!a)return eB(t);let r=s[t],n=a[1].split(",").map(eq);return"function"==typeof r?r(n):n[r]}function eq(e){return parseFloat(e.trim())}let eK=e=>e===F||e===H,eW=new Set(["x","y","z"]),eQ=E.filter(e=>!eW.has(e)),eH={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>eU(t,"x"),y:(e,{transform:t})=>eU(t,"y")};eH.translateX=eH.x,eH.translateY=eH.y;let eX=e=>e,eY={},eG=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function eJ(e,t){let s=!1,a=!0,i={delta:0,timestamp:0,isProcessing:!1},r=()=>s=!0,n=eG.reduce((e,s)=>(e[s]=function(e,t){let s=new Set,a=new Set,i=!1,r=!1,n=new WeakSet,l={delta:0,timestamp:0,isProcessing:!1},o=0;function c(t){n.has(t)&&(d.schedule(t),e()),o++,t(l)}let d={schedule:(e,t=!1,r=!1)=>{let l=r&&i?s:a;return t&&n.add(e),l.has(e)||l.add(e),e},cancel:e=>{a.delete(e),n.delete(e)},process:e=>{if(l=e,i){r=!0;return}i=!0,[s,a]=[a,s],s.forEach(c),t,o=0,s.clear(),i=!1,r&&(r=!1,d.process(e))}};return d}(r,t?s:void 0),e),{}),{setup:l,read:o,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:m,postRender:x}=n,p=()=>{let r=eY.useManualTiming?i.timestamp:performance.now();s=!1,eY.useManualTiming||(i.delta=a?1e3/60:Math.max(Math.min(r-i.timestamp,40),1)),i.timestamp=r,i.isProcessing=!0,l.process(i),o.process(i),c.process(i),d.process(i),u.process(i),h.process(i),m.process(i),x.process(i),i.isProcessing=!1,s&&t&&(a=!1,e(p))};return{schedule:eG.reduce((t,r)=>{let l=n[r];return t[r]=(t,r=!1,n=!1)=>(!s&&(s=!0,a=!0,i.isProcessing||e(p)),l.schedule(t,r,n)),t},{}),cancel:e=>{for(let t=0;t<eG.length;t++)n[eG[t]].cancel(e)},state:i,steps:n}}let{schedule:eZ,cancel:e0,state:e1,steps:e2}=eJ("u">typeof requestAnimationFrame?requestAnimationFrame:eX,!0),e5=new Set,e4=!1,e3=!1,e6=!1;function e8(){if(e3){let e=Array.from(e5).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),s=new Map;t.forEach(e=>{let t,a=(t=[],eQ.forEach(s=>{let a=e.getValue(s);void 0!==a&&(t.push([s,a.get()]),a.set(+!!s.startsWith("scale")))}),t);a.length&&(s.set(e,a),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=s.get(e);t&&t.forEach(([t,s])=>{e.getValue(t)?.set(s)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}e3=!1,e4=!1,e5.forEach(e=>e.complete(e6)),e5.clear()}function e7(){e5.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(e3=!0)})}class e9{constructor(e,t,s,a,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=a,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(e5.add(this),e4||(e4=!0,eZ.read(e7),eZ.resolveKeyframes(e8))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:s,motionValue:a}=this;if(null===e[0]){let i=a?.get(),r=e[e.length-1];if(void 0!==i)e[0]=i;else if(s&&t){let a=s.readValue(t,r);null!=a&&(e[0]=a)}void 0===e[0]&&(e[0]=r),a&&void 0===i&&a.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),e5.delete(this)}cancel(){"scheduled"===this.state&&(e5.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function te(e,t){let s=ef(e);return s!==eh&&(s=eo),s.getAnimatableNone?s.getAnimatableNone(t):void 0}let tt=new Set(["auto","none","0"]);class ts extends e9{constructor(e,t,s,a,i){super(e,t,s,a,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let a=e[s];if("string"==typeof a&&eE(a=a.trim())){let i=function e(t,s,a=1){eT(a<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[i,r]=function(e){let t=eF.exec(e);if(!t)return[,];let[,s,a,i]=t;return[`--${s??a}`,i]}(t);if(!i)return;let n=window.getComputedStyle(s).getPropertyValue(i);if(n){let e=n.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return eE(r)?e(r,s,a+1):r}(a,t.current);void 0!==i&&(e[s]=i),s===e.length-1&&(this.finalKeyframe=a)}}if(this.resolveNoneKeyframes(),!ew.has(s)||2!==e.length)return;let[a,i]=e,r=eS(a),n=eS(i);if(eL(a)!==eL(i)&&eH[s]){this.needsMeasurement=!0;return}if(r!==n)if(eK(r)&&eK(n))for(let t=0;t<e.length;t++){let s=e[t];"string"==typeof s&&(e[t]=parseFloat(s))}else eH[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,s=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&s.push(t);s.length&&function(e,t,s){let a,i=0;for(;i<e.length&&!a;){let t=e[i];"string"==typeof t&&!tt.has(t)&&ei(t).values.length&&(a=e[i]),i++}if(a&&s)for(let i of t)e[i]=te(s,a)}(e,s,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;"height"===s&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=eH[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let a=t[t.length-1];void 0!==a&&e.getValue(s,a).jump(a,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;let a=e.getValue(t);a&&a.jump(this.measuredOrigin,!1);let i=s.length-1,r=s[i];s[i]=eH[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,s])=>{e.getValue(t).set(s)}),this.resolveNoneKeyframes()}}function ta(e,t){-1===e.indexOf(t)&&e.push(t)}function ti(e,t){let s=e.indexOf(t);s>-1&&e.splice(s,1)}class tr{constructor(){this.subscriptions=[]}add(e){return ta(this.subscriptions,e),()=>ti(this.subscriptions,e)}notify(e,t,s){let a=this.subscriptions.length;if(a)if(1===a)this.subscriptions[0](e,t,s);else for(let i=0;i<a;i++){let a=this.subscriptions[i];a&&a(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:tn}=eJ(queueMicrotask,!1);function tl(){t=void 0}let to={now:()=>(void 0===t&&to.set(e1.isProcessing||eY.useManualTiming?e1.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(tl)}};class tc{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=to.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=to.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new tr);let s=this.events[e].add(t);return"change"===e?()=>{s(),eZ.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return l&&l.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=to.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let s=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),s?1e3/s*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function td(e,t){return new tc(e,t)}let tu=[...ek,Z,eo],th={current:null},tm={current:!1},tx="u">typeof window,tp=new WeakMap;function tf(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function tg(e){return"string"==typeof e||Array.isArray(e)}let ty=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tv=["initial",...ty];function tb(e){return tf(e.animate)||tv.some(t=>tg(e[t]))}function tj(e){return!!(tb(e)||e.variants)}function tw(e){let t=[{},{}];return e?.values.forEach((e,s)=>{t[0][s]=e.get(),t[1][s]=e.getVelocity()}),t}function tN(e,t,s,a){if("function"==typeof t){let[i,r]=tw(a);t=t(void 0!==s?s:e.custom,i,r)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,r]=tw(a);t=t(void 0!==s?s:e.custom,i,r)}return t}let tk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],tS={};class tC{scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:a,blockInitialAnimation:i,visualState:r},n={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=e9,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=to.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,eZ.render(this.render,!1,!0))};const{latestValues:l,renderState:o}=r;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=o,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=a,this.options=n,this.blockInitialAnimation=!!i,this.isControllingVariants=tb(t),this.isVariantNode=tj(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in d){const t=d[e];void 0!==l[e]&&ej(t)&&t.set(l[e])}}mount(e){this.current=e,tp.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(tm.current||function(){if(tm.current=!0,tx)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>th.current=e.matches;e.addEventListener("change",t),t()}else th.current=!1}(),this.shouldReduceMotion=th.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),e0(this.notifyUpdate),e0(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let s;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let a=D.has(e);a&&this.onBindTransform&&this.onBindTransform();let i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&eZ.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in tS){let t=tS[e];if(!t)continue;let{isEnabled:s,Feature:a}=t;if(!this.features[e]&&a&&s(this.props)&&(this.features[e]=new a(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):eb()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<tk.length;t++){let s=tk[t];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);let a=e["on"+s];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=function(e,t,s){for(let a in t){let i=t[a],r=s[a];if(ej(i))e.addValue(a,i);else if(ej(r))e.addValue(a,td(i,{owner:e}));else if(r!==i)if(e.hasValue(a)){let t=e.getValue(a);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(a);e.addValue(a,td(void 0!==t?t:i,{owner:e}))}}for(let a in s)void 0===t[a]&&e.removeValue(a);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return void 0===s&&void 0!==t&&(s=td(null===t?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=s){let a,i;if("string"==typeof s&&(a=s,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(a)||(i=s,/^0[^.\s]+$/u.test(i))))s=parseFloat(s);else{let a;a=s,!tu.find(eN(a))&&eo.test(t)&&(s=te(e,t))}this.setBaseTarget(e,ej(s)?s.get():s)}return ej(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:s}=this.props;if("string"==typeof s||"object"==typeof s){let a=tN(this.props,s,this.presenceContext?.custom);a&&(t=a[e])}if(s&&void 0!==t)return t;let a=this.getBaseTargetFromProps(this.props,e);return void 0===a||ej(a)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:a}on(e,t){return this.events[e]||(this.events[e]=new tr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){tn.render(this.render)}}class tT extends tC{constructor(){super(...arguments),this.KeyframeResolver=ts}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;ej(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function tP(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let tA=(e,t)=>t&&"number"==typeof e?t.transform(e):e,tM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tE=E.length;function tD(e,t,s){let{style:a,vars:i,transformOrigin:r}=e,n=!1,l=!1;for(let e in t){let s=t[e];if(D.has(e)){n=!0;continue}if(eA(e)){i[e]=s;continue}{let t=tA(s,ex[e]);e.startsWith("origin")?(l=!0,r[e]=t):a[e]=t}}if(!t.transform&&(n||s?a.transform=function(e,t,s){let a="",i=!0;for(let r=0;r<tE;r++){let n=E[r],l=e[n];if(void 0===l)continue;let o=!0;if("number"==typeof l)o=l===+!!n.startsWith("scale");else{let e=parseFloat(l);o=n.startsWith("scale")?1===e:0===e}if(!o||s){let e=tA(l,ex[n]);if(!o){i=!1;let t=tM[n]||n;a+=`${t}(${e}) `}s&&(t[n]=e)}}return a=a.trim(),s?a=s(t,i?"":a):i&&(a="none"),a}(t,e.transform,s):a.transform&&(a.transform="none")),l){let{originX:e="50%",originY:t="50%",originZ:s=0}=r;a.transformOrigin=`${e} ${t} ${s}`}}let tL={offset:"stroke-dashoffset",array:"stroke-dasharray"},tF={offset:"strokeDashoffset",array:"strokeDasharray"},tR=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function t$(e,{attrX:t,attrY:s,attrScale:a,pathLength:i,pathSpacing:r=1,pathOffset:n=0,...l},o,c,d){if(tD(e,l,c),o){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:u,style:h}=e;for(let e of(u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox),tR))void 0!==u[e]&&(h[e]=u[e],delete u[e]);void 0!==t&&(u.x=t),void 0!==s&&(u.y=s),void 0!==a&&(u.scale=a),void 0!==i&&function(e,t,s=1,a=0,i=!0){e.pathLength=1;let r=i?tL:tF;e[r.offset]=`${-a}`,e[r.array]=`${t} ${s}`}(u,i,r,n,!1)}let tz=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),t_=e=>"string"==typeof e&&"svg"===e.toLowerCase();function tV(e,{style:t,vars:s},a,i){let r,n=e.style;for(r in t)n[r]=t[r];for(r in i?.applyProjectionStyles(n,a),s)n.setProperty(r,s[r])}function tI(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let tO={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!H.test(e))return e;else e=parseFloat(e);let s=tI(e,t.target.x),a=tI(e,t.target.y);return`${s}% ${a}%`}},tB=(e,t,s)=>e+(t-e)*s,tU={borderRadius:{...tO,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:tO,borderTopRightRadius:tO,borderBottomLeftRadius:tO,borderBottomRightRadius:tO,boxShadow:{correct:(e,{treeScale:t,projectionDelta:s})=>{let a=eo.parse(e);if(a.length>5)return e;let i=eo.createTransformer(e),r=+("number"!=typeof a[0]),n=s.x.scale*t.x,l=s.y.scale*t.y;a[0+r]/=n,a[1+r]/=l;let o=tB(n,l,.5);return"number"==typeof a[2+r]&&(a[2+r]/=o),"number"==typeof a[3+r]&&(a[3+r]/=o),i(a)}}};function tq(e,{layout:t,layoutId:s}){return D.has(e)||e.startsWith("origin")||(t||void 0!==s)&&(!!tU[e]||"opacity"===e)}function tK(e,t,s){let a=e.style,i=t?.style,r={};if(!a)return r;for(let t in a)(ej(a[t])||i&&ej(i[t])||tq(t,e)||s?.getValue(t)?.liveStyle!==void 0)&&(r[t]=a[t]);return r}function tW(e,t,s){let a=tK(e,t,s);for(let s in e)(ej(e[s])||ej(t[s]))&&(a[-1!==E.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return a}class tQ extends tT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=eb}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(D.has(t)){let e=ef(t);return e&&e.default||0}return t=tz.has(t)?t:tP(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return tW(e,t,s)}build(e,t,s){t$(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,a){for(let s in tV(e,t,void 0,a),t.attrs)e.setAttribute(tz.has(s)?s:tP(s),t.attrs[s])}mount(e){this.isSVGTag=t_(e.tagName),super.mount(e)}}function tH({top:e,left:t,right:s,bottom:a}){return{x:{min:t,max:s},y:{min:e,max:a}}}function tX(e){return void 0===e||1===e}function tY({scale:e,scaleX:t,scaleY:s}){return!tX(e)||!tX(t)||!tX(s)}function tG(e){return tY(e)||tJ(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tJ(e){var t,s;return(t=e.x)&&"0%"!==t||(s=e.y)&&"0%"!==s}function tZ(e,t,s,a,i){return void 0!==i&&(e=a+i*(e-a)),a+s*(e-a)+t}function t0(e,t=0,s=1,a,i){e.min=tZ(e.min,t,s,a,i),e.max=tZ(e.max,t,s,a,i)}function t1(e,{x:t,y:s}){t0(e.x,t.translate,t.scale,t.originPoint),t0(e.y,s.translate,s.scale,s.originPoint)}function t2(e,t){e.min=e.min+t,e.max=e.max+t}function t5(e,t,s,a,i=.5){let r=tB(e.min,e.max,i);t0(e,t,s,r,a)}function t4(e,t){t5(e.x,t.x,t.scaleX,t.scale,t.originX),t5(e.y,t.y,t.scaleY,t.scale,t.originY)}function t3(e,t){return tH(function(e,t){if(!t)return e;let s=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:a.y,right:a.x}}(e.getBoundingClientRect(),t))}class t6 extends tT{constructor(){super(...arguments),this.type="html",this.renderInstance=tV}readValueFromInstance(e,t){if(D.has(t))return this.projection?.isProjecting?eB(t):((e,t)=>{let{transform:s="none"}=getComputedStyle(e);return eU(s,t)})(e,t);{let s=window.getComputedStyle(e),a=(eA(t)?s.getPropertyValue(t):s[t])||0;return"string"==typeof a?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:t}){return t3(e,t)}build(e,t,s){tD(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return tK(e,t,s)}}let t8=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function t7(e){if("string"!=typeof e||e.includes("-"));else if(t8.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let t9=(0,u.createContext)({strict:!1}),se=(0,u.createContext)({});function st(e){return Array.isArray(e)?e.join(" "):e}let ss=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function sa(e,t,s){for(let a in t)ej(t[a])||tq(a,s)||(e[a]=t[a])}let si=()=>({...ss(),attrs:{}}),sr=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function sn(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||sr.has(e)}let sl=e=>!sn(e);try{c=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof c&&(sl=e=>e.startsWith("on")?!sn(e):c(e))}catch{}function so(e){return ej(e)?e.get():e}let sc=e=>(t,s)=>{let a=(0,u.useContext)(se),i=(0,u.useContext)(g),r=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},s,a,i){return{latestValues:function(e,t,s,a){let i={},r=a(e,{});for(let e in r)i[e]=so(r[e]);let{initial:n,animate:l}=e,o=tb(e),c=tj(e);t&&c&&!o&&!1!==e.inherit&&(void 0===n&&(n=t.initial),void 0===l&&(l=t.animate));let d=!!s&&!1===s.initial,u=(d=d||!1===n)?l:n;if(u&&"boolean"!=typeof u&&!tf(u)){let t=Array.isArray(u)?u:[u];for(let s=0;s<t.length;s++){let a=tN(e,t[s]);if(a){let{transitionEnd:e,transition:t,...s}=a;for(let e in s){let t=s[e];if(Array.isArray(t)){let e=d?t.length-1:0;t=t[e]}null!==t&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}(s,a,i,e),renderState:t()}})(e,t,a,i);return s?r():x(r)},sd=sc({scrapeMotionValuesFromProps:tK,createRenderState:ss}),su=sc({scrapeMotionValuesFromProps:tW,createRenderState:si}),sh={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},sm=!1;function sx(){return!function(){if(sm)return;let e={};for(let t in sh)e[t]={isEnabled:e=>sh[t].some(t=>!!e[t])};tS=e,sm=!0}(),tS}let sp=Symbol.for("motionComponentSymbol"),sf="data-"+tP("framerAppearId"),sg=(0,u.createContext)({});function sy(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function sv(e,{forwardMotionProps:t=!1,type:s}={},a,i){a&&function(e){let t=sx();for(let s in e)t[s]={...t[s],...e[s]};tS=t}(a);let r=s?"svg"===s:t7(e),n=r?su:sd;function l(s,a){var l;let o,c,h,x={...(0,u.useContext)(j),...s,layoutId:function({layoutId:e}){let t=(0,u.useContext)(m).id;return t&&void 0!==e?t+"-"+e:e}(s)},{isStatic:y}=x,v=function(e){let{initial:t,animate:s}=function(e,t){if(tb(e)){let{initial:t,animate:s}=e;return{initial:!1===t||tg(t)?t:void 0,animate:tg(s)?s:void 0}}return!1!==e.inherit?t:{}}(e,(0,u.useContext)(se));return(0,u.useMemo)(()=>({initial:t,animate:s}),[st(t),st(s)])}(s),b=n(s,y);if(!y&&p){(0,u.useContext)(t9).strict;let t=function(e){let{drag:t,layout:s}=sx();if(!t&&!s)return{};let a={...t,...s};return{MeasureLayout:t?.isEnabled(e)||s?.isEnabled(e)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}(x);o=t.MeasureLayout,v.visualElement=function(e,t,s,a,i,r){let{visualElement:n}=(0,u.useContext)(se),l=(0,u.useContext)(t9),o=(0,u.useContext)(g),c=(0,u.useContext)(j).reducedMotion,d=(0,u.useRef)(null),h=(0,u.useRef)(!1);a=a||l.renderer,!d.current&&a&&(d.current=a(e,{visualState:t,parent:n,props:s,presenceContext:o,blockInitialAnimation:!!o&&!1===o.initial,reducedMotionConfig:c,isSVG:r}),h.current&&d.current&&(d.current.manuallyAnimateOnMount=!0));let m=d.current,x=(0,u.useContext)(sg);m&&!m.projection&&i&&("html"===m.type||"svg"===m.type)&&function(e,t,s,a){let{layoutId:i,layout:r,drag:n,dragConstraints:l,layoutScroll:o,layoutRoot:c,layoutCrossfade:d}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:r,alwaysMeasureLayout:!!n||l&&sy(l),visualElement:e,animationType:"string"==typeof r?r:"both",initialPromotionConfig:a,crossfade:d,layoutScroll:o,layoutRoot:c})}(d.current,s,i,x);let p=(0,u.useRef)(!1);(0,u.useInsertionEffect)(()=>{m&&p.current&&m.update(s,o)});let y=s[sf],v=(0,u.useRef)(!!y&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return f(()=>{h.current=!0,m&&(p.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,u.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),v.current=!1),m.enteringChildren=void 0)}),m}(e,b,x,i,t.ProjectionNode,r)}return(0,d.jsxs)(se.Provider,{value:v,children:[o&&v.visualElement?(0,d.jsx)(o,{visualElement:v.visualElement,...x}):null,function(e,t,s,{latestValues:a},i,r=!1,n){let l=(n??t7(e)?function(e,t,s,a){let i=(0,u.useMemo)(()=>{let s=si();return t$(s,t,t_(a),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){let t={};sa(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let s,a,i={},r=(s=e.style||{},sa(a={},s,e),Object.assign(a,function({transformTemplate:e},t){return(0,u.useMemo)(()=>{let s=ss();return tD(s,t,e),Object.assign({},s.vars,s.style)},[t])}(e,t)),a);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=r,i})(t,a,i,e),o=function(e,t,s){let a={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&(sl(i)||!0===s&&sn(i)||!t&&!sn(i)||e.draggable&&i.startsWith("onDrag"))&&(a[i]=e[i]);return a}(t,"string"==typeof e,r),c=e!==u.Fragment?{...o,...l,ref:s}:{},{children:d}=t,h=(0,u.useMemo)(()=>ej(d)?d.get():d,[d]);return(0,u.createElement)(e,{...c,children:h})}(e,s,(l=v.visualElement,c=(0,u.useRef)(a),(0,u.useInsertionEffect)(()=>{c.current=a}),h=(0,u.useRef)(null),(0,u.useCallback)(e=>{e&&b.onMount?.(e),l&&(e?l.mount(e):l.unmount());let t=c.current;if("function"==typeof t)if(e){let s=t(e);"function"==typeof s&&(h.current=s)}else h.current?(h.current(),h.current=null):t(e);else t&&(t.current=e)},[l])),b,y,t,r)]})}l.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let o=(0,u.forwardRef)(l);return o[sp]=e,o}class sb{constructor(e){this.isMounted=!1,this.node=e}update(){}}function sj(e,t,s){let a=e.getProps();return tN(a,t,void 0!==s?s:a.custom,e)}function sw(e,t){return e?.[t]??e?.default??e}let sN=e=>Array.isArray(e);function sk(e,t){let s=e.getValue("willChange");if(ej(s)&&s.add)return s.add(t);if(!s&&eY.WillChange){let s=new eY.WillChange("auto");e.addValue("willChange",s),s.add(t)}}let sS=e=>1e3*e,sC=(e,t)=>s=>t(e(s)),sT=(...e)=>e.reduce(sC),sP={layout:0,mainThread:0,waapi:0};function sA(e,t,s){return(s<0&&(s+=1),s>1&&(s-=1),s<1/6)?e+(t-e)*6*s:s<.5?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function sM(e,t){return s=>s>0?t:e}let sE=(e,t,s)=>{let a=e*e,i=s*(t*t-a)+a;return i<0?0:Math.sqrt(i)},sD=[q,U,J];function sL(e){let t=sD.find(t=>t.test(e));if(eC(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let s=t.parse(e);return t===J&&(s=function({hue:e,saturation:t,lightness:s,alpha:a}){e/=360,s/=100;let i=0,r=0,n=0;if(t/=100){let a=s<.5?s*(1+t):s+t-s*t,l=2*s-a;i=sA(l,a,e+1/3),r=sA(l,a,e),n=sA(l,a,e-1/3)}else i=r=n=s;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*n),alpha:a}}(s)),s}let sF=(e,t)=>{let s=sL(e),a=sL(t);if(!s||!a)return sM(e,t);let i={...s};return e=>(i.red=sE(s.red,a.red,e),i.green=sE(s.green,a.green,e),i.blue=sE(s.blue,a.blue,e),i.alpha=tB(s.alpha,a.alpha,e),U.transform(i))},sR=new Set(["none","hidden"]);function s$(e,t){return s=>tB(e,t,s)}function sz(e){return"number"==typeof e?s$:"string"==typeof e?eE(e)?sM:Z.test(e)?sF:sI:Array.isArray(e)?s_:"object"==typeof e?Z.test(e)?sF:sV:sM}function s_(e,t){let s=[...e],a=s.length,i=e.map((e,s)=>sz(e)(e,t[s]));return e=>{for(let t=0;t<a;t++)s[t]=i[t](e);return s}}function sV(e,t){let s={...e,...t},a={};for(let i in s)void 0!==e[i]&&void 0!==t[i]&&(a[i]=sz(e[i])(e[i],t[i]));return e=>{for(let t in a)s[t]=a[t](e);return s}}let sI=(e,t)=>{let s=eo.createTransformer(t),a=ei(e),i=ei(t);if(!(a.indexes.var.length===i.indexes.var.length&&a.indexes.color.length===i.indexes.color.length&&a.indexes.number.length>=i.indexes.number.length))return eC(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),sM(e,t);if(sR.has(e)&&!i.values.length||sR.has(t)&&!a.values.length)return sR.has(e)?s=>s<=0?e:t:s=>s>=1?t:e;return sT(s_(function(e,t){let s=[],a={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let r=t.types[i],n=e.indexes[r][a[r]],l=e.values[n]??0;s[i]=l,a[r]++}return s}(a,i),i.values),s)};function sO(e,t,s){return"number"==typeof e&&"number"==typeof t&&"number"==typeof s?tB(e,t,s):sz(e)(e,t)}let sB=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>eZ.update(t,e),stop:()=>e0(t),now:()=>e1.isProcessing?e1.timestamp:to.now()}},sU=(e,t,s=10)=>{let a="",i=Math.max(Math.round(t/s),2);for(let t=0;t<i;t++)a+=Math.round(1e4*e(t/(i-1)))/1e4+", ";return`linear(${a.substring(0,a.length-2)})`};function sq(e){let t=0,s=e.next(t);for(;!s.done&&t<2e4;)t+=50,s=e.next(t);return t>=2e4?1/0:t}function sK(e,t,s){var a,i;let r=Math.max(t-5,0);return a=s-e(r),(i=t-r)?1e3/i*a:0}let sW=.01,sQ=2,sH=.005,sX=.5;function sY(e,t){return e*Math.sqrt(1-t*t)}let sG=["duration","bounce"],sJ=["stiffness","damping","mass"];function sZ(e,t){return t.some(t=>void 0!==e[t])}function s0(e=.3,t=.3){let s,a="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:i,restDelta:r}=a,n=a.keyframes[0],l=a.keyframes[a.keyframes.length-1],o={done:!1,value:n},{stiffness:c,damping:d,mass:u,duration:h,velocity:m,isResolvedFromDuration:x}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!sZ(e,sJ)&&sZ(e,sG))if(e.visualDuration){let s=2*Math.PI/(1.2*e.visualDuration),a=s*s,i=2*L(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:1,stiffness:a,damping:i}}else{let s=function({duration:e=800,bounce:t=.3,velocity:s=0,mass:a=1}){let i,r;eC(e<=sS(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let n=1-t;n=L(.05,1,n),e=L(.01,10,e/1e3),n<1?(i=t=>{let a=t*n,i=a*e;return .001-(a-s)/sY(t,n)*Math.exp(-i)},r=t=>{let a=t*n*e,r=Math.pow(n,2)*Math.pow(t,2)*e,l=Math.exp(-a),o=sY(Math.pow(t,2),n);return(a*s+s-r)*l*(-i(t)+.001>0?-1:1)/o}):(i=t=>-.001+Math.exp(-t*e)*((t-s)*e+1),r=t=>e*e*(s-t)*Math.exp(-t*e));let l=function(e,t,s){let a=s;for(let s=1;s<12;s++)a-=e(a)/t(a);return a}(i,r,5/e);if(e=sS(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(l,2)*a;return{stiffness:t,damping:2*n*Math.sqrt(a*t),duration:e}}}(e);(t={...t,...s,mass:1}).isResolvedFromDuration=!0}return t}({...a,velocity:-((a.velocity||0)/1e3)}),p=m||0,f=d/(2*Math.sqrt(c*u)),g=l-n,y=Math.sqrt(c/u)/1e3,v=5>Math.abs(g);if(i||(i=v?sW:sQ),r||(r=v?sH:sX),f<1){let e=sY(y,f);s=t=>l-Math.exp(-f*y*t)*((p+f*y*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(1===f)s=e=>l-Math.exp(-y*e)*(g+(p+y*g)*e);else{let e=y*Math.sqrt(f*f-1);s=t=>{let s=Math.exp(-f*y*t),a=Math.min(e*t,300);return l-s*((p+f*y*g)*Math.sinh(a)+e*g*Math.cosh(a))/e}}let b={calculatedDuration:x&&h||null,next:e=>{let t=s(e);if(x)o.done=e>=h;else{let a=0===e?p:0;f<1&&(a=0===e?sS(p):sK(s,e,t));let n=Math.abs(l-t)<=r;o.done=Math.abs(a)<=i&&n}return o.value=o.done?l:t,o},toString:()=>{let e=Math.min(sq(b),2e4),t=sU(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function s1({keyframes:e,velocity:t=0,power:s=.8,timeConstant:a=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:n,min:l,max:o,restDelta:c=.5,restSpeed:d}){let u,h,m=e[0],x={done:!1,value:m},p=s*t,f=m+p,g=void 0===n?f:n(f);g!==f&&(p=g-m);let y=e=>-p*Math.exp(-e/a),v=e=>g+y(e),b=e=>{let t=y(e),s=v(e);x.done=Math.abs(t)<=c,x.value=x.done?g:s},j=e=>{let t;if(t=x.value,void 0!==l&&t<l||void 0!==o&&t>o){var s;u=e,h=s0({keyframes:[x.value,(s=x.value,void 0===l?o:void 0===o||Math.abs(l-s)<Math.abs(o-s)?l:o)],velocity:sK(v,e,x.value),damping:i,stiffness:r,restDelta:c,restSpeed:d})}};return j(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==u||(t=!0,b(e),j(e)),void 0!==u&&e>=u)?h.next(e-u):(t||b(e),x)}}}s0.applyToOptions=e=>{let t=function(e,t=100,s){let a=s({...e,keyframes:[0,t]}),i=Math.min(sq(a),2e4);return{type:"keyframes",ease:e=>a.next(i*e).value/t,duration:i/1e3}}(e,100,s0);return e.ease=t.ease,e.duration=sS(t.duration),e.type="keyframes",e};let s2=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e;function s5(e,t,s,a){return e===t&&s===a?eX:i=>0===i||1===i?i:s2(function(e,t,s,a,i){let r,n,l=0;do(r=s2(n=t+(s-t)/2,a,i)-e)>0?s=n:t=n;while(Math.abs(r)>1e-7&&++l<12)return n}(i,0,1,e,s),t,a)}let s4=s5(.42,0,1,1),s3=s5(0,0,.58,1),s6=s5(.42,0,.58,1),s8=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,s7=e=>t=>1-e(1-t),s9=s5(.33,1.53,.69,.99),ae=s7(s9),at=s8(ae),as=e=>(e*=2)<1?.5*ae(e):.5*(2-Math.pow(2,-10*(e-1))),aa=e=>1-Math.sin(Math.acos(e)),ai=s7(aa),ar=s8(aa),an=e=>Array.isArray(e)&&"number"==typeof e[0],al={linear:eX,easeIn:s4,easeInOut:s6,easeOut:s3,circIn:aa,circInOut:ar,circOut:ai,backIn:ae,backInOut:at,backOut:s9,anticipate:as},ao=e=>{if(an(e)){eT(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,s,a,i]=e;return s5(t,s,a,i)}return"string"==typeof e?(eT(void 0!==al[e],`Invalid easing type '${e}'`,"invalid-easing-type"),al[e]):e},ac=(e,t,s)=>{let a=t-e;return 0===a?1:(s-e)/a};function ad({duration:e=300,keyframes:t,times:s,ease:a="easeInOut"}){var i;let r,n=Array.isArray(a)&&"number"!=typeof a[0]?a.map(ao):ao(a),l={done:!1,value:t[0]},o=function(e,t,{clamp:s=!0,ease:a,mixer:i}={}){let r=e.length;if(eT(r===t.length,"Both input and output ranges must be the same length","range-length"),1===r)return()=>t[0];if(2===r&&t[0]===t[1])return()=>t[1];let n=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());let l=function(e,t,s){let a=[],i=s||eY.mix||sO,r=e.length-1;for(let s=0;s<r;s++){let r=i(e[s],e[s+1]);t&&(r=sT(Array.isArray(t)?t[s]||eX:t,r)),a.push(r)}return a}(t,a,i),o=l.length,c=s=>{if(n&&s<e[0])return t[0];let a=0;if(o>1)for(;a<e.length-2&&!(s<e[a+1]);a++);let i=ac(e[a],e[a+1],s);return l[a](i)};return s?t=>c(L(e[0],e[r-1],t)):c}((i=s&&s.length===t.length?s:(!function(e,t){let s=e[e.length-1];for(let a=1;a<=t;a++){let i=ac(0,t,a);e.push(tB(s,1,i))}}(r=[0],t.length-1),r),i.map(t=>t*e)),t,{ease:Array.isArray(n)?n:t.map(()=>n||s6).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(l.value=o(t),l.done=t>=e,l)}}let au=e=>null!==e;function ah(e,{repeat:t,repeatType:s="loop"},a,i=1){let r=e.filter(au),n=i<0||t&&"loop"!==s&&t%2==1?0:r.length-1;return n&&void 0!==a?a:r[n]}let am={decay:s1,inertia:s1,tween:ad,keyframes:ad,spring:s0};function ax(e){"string"==typeof e.type&&(e.type=am[e.type])}class ap{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let af=e=>e/100;class ag extends ap{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==to.now()&&this.tick(to.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},sP.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;ax(e);let{type:t=ad,repeat:s=0,repeatDelay:a=0,repeatType:i,velocity:r=0}=e,{keyframes:n}=e,l=t||ad;l!==ad&&"number"!=typeof n[0]&&(this.mixKeyframes=sT(af,sO(n[0],n[1])),n=[0,100]);let o=l({...e,keyframes:n});"mirror"===i&&(this.mirroredGenerator=l({...e,keyframes:[...n].reverse(),velocity:-r})),null===o.calculatedDuration&&(o.calculatedDuration=sq(o));let{calculatedDuration:c}=o;this.calculatedDuration=c,this.resolvedDuration=c+a,this.totalDuration=this.resolvedDuration*(s+1)-a,this.generator=o}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:s,totalDuration:a,mixKeyframes:i,mirroredGenerator:r,resolvedDuration:n,calculatedDuration:l}=this;if(null===this.startTime)return s.next(0);let{delay:o=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:m,onUpdate:x,finalKeyframe:p}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-a/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let f=this.currentTime-o*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?f<0:f>a;this.currentTime=Math.max(f,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=a);let y=this.currentTime,v=s;if(d){let e=Math.min(this.currentTime,a)/n,t=Math.floor(e),s=e%1;!s&&e>=1&&(s=1),1===s&&t--,(t=Math.min(t,d+1))%2&&("reverse"===u?(s=1-s,h&&(s-=h/n)):"mirror"===u&&(v=r)),y=L(0,1,s)*n}let b=g?{done:!1,value:c[0]}:v.next(y);i&&(b.value=i(b.value));let{done:j}=b;g||null===l||(j=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&j);return w&&m!==s1&&(b.value=ah(c,this.options,p,this.speed)),x&&x(b.value),w&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=sS(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(to.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=sB,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let s=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=s):null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(to.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,sP.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function ay(e){let t;return()=>(void 0===t&&(t=e()),t)}let av=ay(()=>void 0!==window.ScrollTimeline),ab={},aj=(s=ay(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>ab.linearEasing??s()),aw=([e,t,s,a])=>`cubic-bezier(${e}, ${t}, ${s}, ${a})`,aN={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:aw([0,.65,.55,1]),circOut:aw([.55,0,1,.45]),backIn:aw([.31,.01,.66,-.59]),backOut:aw([.33,1.53,.69,.99])};function ak(e){return"function"==typeof e&&"applyToOptions"in e}class aS extends ap{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:a,pseudoElement:i,allowFlatten:r=!1,finalKeyframe:n,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=r,this.options=e,eT("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const o=function({type:e,...t}){return ak(e)&&aj()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,s,{delay:a=0,duration:i=300,repeat:r=0,repeatType:n="loop",ease:l="easeOut",times:o}={},c){let d={[t]:s};o&&(d.offset=o);let u=function e(t,s){if(t)return"function"==typeof t?aj()?sU(t,s):"ease-out":an(t)?aw(t):Array.isArray(t)?t.map(t=>e(t,s)||aN.easeOut):aN[t]}(l,i);Array.isArray(u)&&(d.easing=u);let h={delay:a,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:r+1,direction:"reverse"===n?"alternate":"normal"};c&&(h.pseudoElement=c);let m=e.animate(d,h);return m}(t,s,a,o,i),!1===o.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=ah(a,this.options,n,this.speed);this.updateMotionValue?this.updateMotionValue(e):s.startsWith("--")?t.style.setProperty(s,e):t.style[s]=e,this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=sS(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&av())?(this.animation.timeline=e,eX):t(this)}}let aC={anticipate:as,backInOut:at,circInOut:ar};class aT extends aS{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in aC&&(e.ease=aC[e.ease])}(e),ax(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:s,onComplete:a,element:i,...r}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let n=new ag({...r,autoplay:!1}),l=Math.max(10,to.now()-this.startTime),o=L(0,10,l-10);t.setWithVelocity(n.sample(Math.max(0,l-o)).value,n.sample(l).value,o),n.stop()}}let aP=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(eo.test(e)||"0"===e)&&!e.startsWith("url("));function aA(e){e.duration=0,e.type="keyframes"}let aM=new Set(["opacity","clipPath","filter","transform"]),aE=ay(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class aD extends ap{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:r="loop",keyframes:n,name:l,motionValue:o,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=to.now();const u={autoplay:e,delay:t,type:s,repeat:a,repeatDelay:i,repeatType:r,name:l,motionValue:o,element:c,...d},h=c?.KeyframeResolver||e9;this.keyframeResolver=new h(n,(e,t,s)=>this.onKeyframesResolved(e,t,u,!s),l,o,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,s,a){this.keyframeResolver=void 0;let{name:i,type:r,velocity:n,delay:l,isHandoff:o,onUpdate:c}=s;this.resolvedAt=to.now(),!function(e,t,s,a){let i=e[0];if(null===i)return!1;if("display"===t||"visibility"===t)return!0;let r=e[e.length-1],n=aP(i,t),l=aP(r,t);return eC(n===l,`You are trying to animate ${t} from "${i}" to "${r}". "${n?r:i}" is not an animatable value.`,"value-not-animatable"),!!n&&!!l&&(function(e){let t=e[0];if(1===e.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}(e)||("spring"===s||ak(s))&&a)}(e,i,r,n)&&((eY.instantAnimations||!l)&&c?.(ah(e,s,t)),e[0]=e[e.length-1],aA(s),s.repeat=0);let d={startTime:a?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},u=!o&&function(e){let{motionValue:t,name:s,repeatDelay:a,repeatType:i,damping:r,type:n}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:o}=t.owner.getProps();return aE()&&s&&aM.has(s)&&("transform"!==s||!o)&&!l&&!a&&"mirror"!==i&&0!==r&&"inertia"!==n}(d),h=d.motionValue?.owner?.current,m=u?new aT({...d,element:h}):new ag(d);m.finished.then(()=>{this.notifyFinished()}).catch(eX),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),e6=!0,e7(),e8(),e6=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let aL={type:"spring",stiffness:500,damping:25,restSpeed:10},aF={type:"keyframes",duration:.8},aR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},a$=e=>null!==e,az=(e,t,s,a={},i,r)=>n=>{let l=sw(a,e)||{},o=l.delay||a.delay||0,{elapsed:c=0}=a;c-=sS(o);let d={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-c,onUpdate:e=>{t.set(e),l.onUpdate&&l.onUpdate(e)},onComplete:()=>{n(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:i};!function({when:e,delay:t,delayChildren:s,staggerChildren:a,staggerDirection:i,repeat:r,repeatType:n,repeatDelay:l,from:o,elapsed:c,...d}){return!!Object.keys(d).length}(l)&&Object.assign(d,((e,{keyframes:t})=>t.length>2?aF:D.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:aL:aR)(e,d)),d.duration&&(d.duration=sS(d.duration)),d.repeatDelay&&(d.repeatDelay=sS(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if(!1!==d.type&&(0!==d.duration||d.repeatDelay)||(aA(d),0===d.delay&&(u=!0)),(eY.instantAnimations||eY.skipAnimations)&&(u=!0,aA(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,u&&!r&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:s="loop"},a){let i=e.filter(a$),r=t&&"loop"!==s&&t%2==1?0:i.length-1;return i[r]}(d.keyframes,l);if(void 0!==e)return void eZ.update(()=>{d.onUpdate(e),d.onComplete()})}return l.isSync?new ag(d):new aD(d)};function a_(e,t,{delay:s=0,transitionOverride:a,type:i}={}){let{transition:r=e.getDefaultTransition(),transitionEnd:n,...l}=t;a&&(r=a);let o=[],c=i&&e.animationState&&e.animationState.getState()[i];for(let t in l){let a=e.getValue(t,e.latestValues[t]??null),i=l[t];if(void 0===i||c&&function({protectedKeys:e,needsAnimating:t},s){let a=e.hasOwnProperty(s)&&!0!==t[s];return t[s]=!1,a}(c,t))continue;let n={delay:s,...sw(r||{},t)},d=a.get();if(void 0!==d&&!a.isAnimating&&!Array.isArray(i)&&i===d&&!n.velocity)continue;let u=!1;if(window.MotionHandoffAnimation){let s=e.props[sf];if(s){let e=window.MotionHandoffAnimation(s,t,eZ);null!==e&&(n.startTime=e,u=!0)}}sk(e,t),a.start(az(t,a,i,e.shouldReduceMotion&&ew.has(t)?{type:!1}:n,e,u));let h=a.animation;h&&o.push(h)}return n&&Promise.all(o).then(()=>{eZ.update(()=>{n&&function(e,t){let{transitionEnd:s={},transition:a={},...i}=sj(e,t)||{};for(let t in i={...i,...s}){var r;let s=sN(r=i[t])?r[r.length-1]||0:r;e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,td(s))}}(e,n)})}),o}function aV(e,t,s,a=0,i=1){let r=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),n=e.size,l=(n-1)*a;return"function"==typeof s?s(r,n):1===i?r*a:l-r*a}function aI(e,t,s={}){let a=sj(e,t,"exit"===s.type?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=a||{};s.transitionOverride&&(i=s.transitionOverride);let r=a?()=>Promise.all(a_(e,a,s)):()=>Promise.resolve(),n=e.variantChildren&&e.variantChildren.size?(a=0)=>{let{delayChildren:r=0,staggerChildren:n,staggerDirection:l}=i;return function(e,t,s=0,a=0,i=0,r=1,n){let l=[];for(let o of e.variantChildren)o.notify("AnimationStart",t),l.push(aI(o,t,{...n,delay:s+("function"==typeof a?0:a)+aV(e.variantChildren,o,a,i,r)}).then(()=>o.notify("AnimationComplete",t)));return Promise.all(l)}(e,t,a,r,n,l,s)}:()=>Promise.resolve(),{when:l}=i;if(!l)return Promise.all([r(),n(s.delay)]);{let[e,t]="beforeChildren"===l?[r,n]:[n,r];return e().then(()=>t())}}let aO=tv.length;function aB(e,t){if(!Array.isArray(t))return!1;let s=t.length;if(s!==e.length)return!1;for(let a=0;a<s;a++)if(t[a]!==e[a])return!1;return!0}let aU=[...ty].reverse(),aq=ty.length;function aK(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function aW(){return{animate:aK(!0),whileInView:aK(),whileHover:aK(),whileTap:aK(),whileDrag:aK(),whileFocus:aK(),exit:aK()}}let aQ=0;function aH(e){return[e("x"),e("y")]}let aX=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function aY(e){return aX.has(e.tagName)||!0===e.isContentEditable}function aG(e,t,s,a={passive:!0}){return e.addEventListener(t,s,a),()=>e.removeEventListener(t,s)}let aJ={x:!1,y:!1};function aZ(e){return e.max-e.min}function a0(e,t,s,a=.5){e.origin=a,e.originPoint=tB(t.min,t.max,e.origin),e.scale=aZ(s)/aZ(t),e.translate=tB(s.min,s.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function a1(e,t,s,a){a0(e.x,t.x,s.x,a?a.originX:void 0),a0(e.y,t.y,s.y,a?a.originY:void 0)}function a2(e,t,s){e.min=s.min+t.min,e.max=e.min+aZ(t)}function a5(e,t,s){e.min=t.min-s.min,e.max=e.min+aZ(t)}function a4(e,t,s){a5(e.x,t.x,s.x),a5(e.y,t.y,s.y)}let a3=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function a6(e){return{point:{x:e.pageX,y:e.pageY}}}function a8(e,t,s,a){return aG(e,t,e=>a3(e)&&s(e,a6(e)),a)}let a7=({current:e})=>e?e.ownerDocument.defaultView:null,a9=(e,t)=>Math.abs(e-t),ie=new Set(["auto","scroll"]);class it{constructor(e,t,{transformPagePoint:s,contextWindow:a=window,dragSnapToOrigin:i=!1,distanceThreshold:r=3,element:n}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=ii(this.lastMoveEventInfo,this.history),a=null!==this.startEvent,i=(e=s.offset,t={x:0,y:0},Math.sqrt(a9(e.x,t.x)**2+a9(e.y,t.y)**2)>=this.distanceThreshold);if(!a&&!i)return;let{point:r}=s,{timestamp:n}=e1;this.history.push({...r,timestamp:n});let{onStart:l,onMove:o}=this.handlers;a||(l&&l(this.lastMoveEvent,s),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,s)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=is(t,this.transformPagePoint),eZ.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:s,onSessionEnd:a,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=ii("pointercancel"===e.type?this.lastMoveEventInfo:is(t,this.transformPagePoint),this.history);this.startEvent&&s&&s(e,r),a&&a(e,r)},!a3(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=r,this.contextWindow=a||window;const l=is(a6(e),this.transformPagePoint),{point:o}=l,{timestamp:c}=e1;this.history=[{...o,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,ii(l,this.history)),this.removeListeners=sT(a8(this.contextWindow,"pointermove",this.handlePointerMove),a8(this.contextWindow,"pointerup",this.handlePointerUp),a8(this.contextWindow,"pointercancel",this.handlePointerUp)),n&&this.startScrollTracking(n)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(ie.has(e.overflowX)||ie.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let s=e===window,a=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:a.x-t.x,y:a.y-t.y};(0!==i.x||0!==i.y)&&(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,a),eZ.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),e0(this.updatePoint)}}function is(e,t){return t?{point:t(e.point)}:e}function ia(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ii({point:e},t){return{point:e,delta:ia(e,ir(t)),offset:ia(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,a=null,i=ir(e);for(;s>=0&&(a=e[s],!(i.timestamp-a.timestamp>sS(.1)));)s--;if(!a)return{x:0,y:0};let r=(i.timestamp-a.timestamp)/1e3;if(0===r)return{x:0,y:0};let n={x:(i.x-a.x)/r,y:(i.y-a.y)/r};return n.x===1/0&&(n.x=0),n.y===1/0&&(n.y=0),n}(t,.1)}}function ir(e){return e[e.length-1]}function il(e,t,s){return{min:void 0!==t?e.min+t:void 0,max:void 0!==s?e.max+s-(e.max-e.min):void 0}}function io(e,t){let s=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,a]=[a,s]),{min:s,max:a}}function ic(e,t,s){return{min:id(e,t),max:id(e,s)}}function id(e,t){return"number"==typeof e?e:e[t]||0}let iu=new WeakMap;class ih{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=eb(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){let{presenceContext:a}=this.visualElement;if(a&&!1===a.isPresent)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(a6(e).point)):this.pauseAnimation()},r=(e,t)=>{this.stopAnimation();let{drag:s,dragPropagation:a,onDragStart:i}=this.getProps();if(s&&!a&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(aJ[e])return null;else return aJ[e]=!0,()=>{aJ[e]=!1};return aJ.x||aJ.y?null:(aJ.x=aJ.y=!0,()=>{aJ.x=aJ.y=!1})}(s),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),aH(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Q.test(t)){let{projection:s}=this.visualElement;if(s&&s.layout){let a=s.layout.layoutBox[e];a&&(t=aZ(a)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&eZ.postRender(()=>i(e,t)),sk(this.visualElement,"transform");let{animationState:r}=this.visualElement;r&&r.setActive("whileDrag",!0)},n=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:s,dragDirectionLock:a,onDirectionLock:i,onDrag:r}=this.getProps();if(!s&&!this.openDragLock)return;let{offset:n}=t;if(a&&null===this.currentDirection){this.currentDirection=function(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}(n),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,n),this.updateAxis("y",t.point,n),this.visualElement.render(),r&&r(e,t)},l=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},o=()=>aH(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new it(e,{onSessionStart:i,onStart:r,onMove:n,onSessionEnd:l,resumeAnimation:o},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:s,contextWindow:a7(this.visualElement),element:this.visualElement.current})}stop(e,t){let s=e||this.latestPointerEvent,a=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!a||!s)return;let{velocity:r}=a;this.startAnimation(r);let{onDragEnd:n}=this.getProps();n&&eZ.postRender(()=>n(s,a))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,s){let{drag:a}=this.getProps();if(!s||!im(e,a,this.currentDirection))return;let i=this.getAxisMotionValue(e),r=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:t,max:s},a){return void 0!==t&&e<t?e=a?tB(t,e,a.min):Math.max(e,t):void 0!==s&&e>s&&(e=a?tB(s,e,a.max):Math.min(e,s)),e}(r,this.constraints[e],this.elastic[e])),i.set(r)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;e&&sy(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=function(e,{top:t,left:s,bottom:a,right:i}){return{x:il(e.x,s,i),y:il(e.y,t,a)}}(s.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:ic(e,"left","right"),y:ic(e,"top","bottom")}}(t),a!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&aH(e=>{var t,a;let i;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=s.layoutBox[e],a=this.constraints[e],i={},void 0!==a.min&&(i.min=a.min-t.min),void 0!==a.max&&(i.max=a.max-t.min),i))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!sy(t))return!1;let a=t.current;eT(null!==a,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let r=function(e,t,s){let a=t3(e,s),{scroll:i}=t;return i&&(t2(a.x,i.offset.x),t2(a.y,i.offset.y)),a}(a,i.root,this.visualElement.getTransformPagePoint()),n=(e=i.layout.layoutBox,{x:io(e.x,r.x),y:io(e.y,r.y)});if(s){let e=s(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(n));this.hasMutatedConstraints=!!e,e&&(n=tH(e))}return n}startAnimation(e){let{drag:t,dragMomentum:s,dragElastic:a,dragTransition:i,dragSnapToOrigin:r,onDragTransitionEnd:n}=this.getProps(),l=this.constraints||{};return Promise.all(aH(n=>{if(!im(n,t,this.currentDirection))return;let o=l&&l[n]||{};r&&(o={min:0,max:0});let c={type:"inertia",velocity:s?e[n]:0,bounceStiffness:a?200:1e6,bounceDamping:a?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...o};return this.startAxisValueAnimation(n,c)})).then(n)}startAxisValueAnimation(e,t){let s=this.getAxisMotionValue(e);return sk(this.visualElement,e),s.start(az(e,s,0,t,this.visualElement,!1))}stopAnimation(){aH(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){aH(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps();return s[t]||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){aH(t=>{let{drag:s}=this.getProps();if(!im(t,s,this.currentDirection))return;let{projection:a}=this.visualElement,i=this.getAxisMotionValue(t);if(a&&a.layout){let{min:s,max:r}=a.layout.layoutBox[t],n=i.get()||0;i.set(e[t]-tB(s,r,.5)+n)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!sy(t)||!s||!this.constraints)return;this.stopAnimation();let a={x:0,y:0};aH(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var s,i;let r,n,l,o=t.get();a[e]=(s={min:o,max:o},i=this.constraints[e],r=.5,n=aZ(s),(l=aZ(i))>n?r=ac(i.min,i.max-n,s.min):n>l&&(r=ac(s.min,s.max-l,i.min)),L(0,1,r))}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),aH(t=>{if(!im(t,e,null))return;let s=this.getAxisMotionValue(t),{min:i,max:r}=this.constraints[t];s.set(tB(i,r,a[t]))})}addListeners(){if(!this.visualElement.current)return;iu.set(this.visualElement,this);let e=this.visualElement.current,t=a8(e,"pointerdown",t=>{let{drag:s,dragListener:a=!0}=this.getProps(),i=t.target,r=i!==e&&aY(i);s&&a&&!r&&this.start(t)}),s=()=>{let{dragConstraints:e}=this.getProps();sy(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,i=a.addEventListener("measure",s);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),eZ.read(s);let r=aG(window,"resize",()=>this.scalePositionWithinConstraints()),n=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(aH(t=>{let s=this.getAxisMotionValue(t);s&&(this.originPoint[t]+=e[t].translate,s.set(s.get()+e[t].translate))}),this.visualElement.render())});return()=>{r(),t(),i(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:a=!1,dragConstraints:i=!1,dragElastic:r=.35,dragMomentum:n=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:a,dragConstraints:i,dragElastic:r,dragMomentum:n}}}function im(e,t,s){return(!0===t||t===e)&&(null===s||s===e)}let ix=e=>(t,s)=>{e&&eZ.postRender(()=>e(t,s))},ip={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var ig=u;let iy=!1;class iv extends ig.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:a}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),s&&s.register&&a&&s.register(i),iy&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ip.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:s,drag:a,isPresent:i}=this.props,{projection:r}=s;return r&&(r.isPresent=i,e.layoutDependency!==t&&r.setOptions({...r.options,layoutDependency:t}),iy=!0,a||e.layoutDependency!==t||void 0===t||e.isPresent!==i?r.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?r.promote():r.relegate()||eZ.postRender(()=>{let e=r.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),tn.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:a}=e;iy=!0,a&&(a.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(a),s&&s.deregister&&s.deregister(a))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function ib(e){let[t,s]=T(),a=(0,ig.useContext)(m);return(0,d.jsx)(iv,{...e,layoutGroup:a,switchLayoutGroup:(0,ig.useContext)(sg),isPresent:t,safeToRemove:s})}function ij(e,t,s,a,i){return e-=t,e=a+1/s*(e-a),void 0!==i&&(e=a+1/i*(e-a)),e}function iw(e,t,[s,a,i],r,n){!function(e,t=0,s=1,a=.5,i,r=e,n=e){if(Q.test(t)&&(t=parseFloat(t),t=tB(n.min,n.max,t/100)-n.min),"number"!=typeof t)return;let l=tB(r.min,r.max,a);e===r&&(l-=t),e.min=ij(e.min,t,s,l,i),e.max=ij(e.max,t,s,l,i)}(e,t[s],t[a],t[i],t.scale,r,n)}let iN=["x","scaleX","originX"],ik=["y","scaleY","originY"];function iS(e,t,s,a){iw(e.x,t,iN,s?s.x:void 0,a?a.x:void 0),iw(e.y,t,ik,s?s.y:void 0,a?a.y:void 0)}function iC(e,t){e.min=t.min,e.max=t.max}function iT(e,t){iC(e.x,t.x),iC(e.y,t.y)}function iP(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function iA(e){return 0===e.translate&&1===e.scale}function iM(e){return iA(e.x)&&iA(e.y)}function iE(e,t){return e.min===t.min&&e.max===t.max}function iD(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function iL(e,t){return iD(e.x,t.x)&&iD(e.y,t.y)}function iF(e){return aZ(e.x)/aZ(e.y)}function iR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let i$=["TopLeft","TopRight","BottomLeft","BottomRight"],iz=i$.length,i_=e=>"string"==typeof e?parseFloat(e):e,iV=e=>"number"==typeof e||H.test(e);function iI(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let iO=iU(0,.5,ai),iB=iU(.5,.95,eX);function iU(e,t,s){return a=>a<e?0:a>t?1:s(ac(e,t,a))}function iq(e){return y(e)&&"ownerSVGElement"in e}let iK=(e,t)=>e.depth-t.depth;class iW{constructor(){this.children=[],this.isDirty=!1}add(e){ta(this.children,e),this.isDirty=!0}remove(e){ti(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(iK),this.isDirty=!1,this.children.forEach(e)}}class iQ{constructor(){this.members=[]}add(e){ta(this.members,e),e.scheduleRender()}remove(e){if(ti(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,s=this.members.findIndex(t=>e===t);if(0===s)return!1;for(let e=s;e>=0;e--){let s=this.members[e];if(!1!==s.isPresent){t=s;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender();let a=s.options.layoutDependency,i=e.options.layoutDependency;(void 0===a||void 0===i||a!==i)&&(e.resumeFrom=s,t&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:r}=e.options;!1===r&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:s}=e;t.onExitComplete&&t.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let iH=["","X","Y","Z"],iX=0;function iY(e,t,s,a){let{latestValues:i}=t;i[e]&&(s[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function iG({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(e={},s=t?.()){this.id=iX++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(i0),this.nodes.forEach(i8),this.nodes.forEach(i7),this.nodes.forEach(i1)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new iW)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tr),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let s=this.eventHandlers.get(e);s&&s.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=iq(t)&&!(iq(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:s,layout:a,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(a||s)&&(this.isLayoutDirty=!0),e){let s,a=0,i=()=>this.root.updateBlockedByResize=!1;eZ.read(()=>{a=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==a){let t,r;a=e,this.root.updateBlockedByResize=!0,s&&s(),t=to.now(),r=({timestamp:e})=>{let s=e-t;s>=250&&(e0(r),i(s-250))},eZ.setup(r,!0),s=()=>e0(r),ip.hasAnimatedSinceResize&&(ip.hasAnimatedSinceResize=!1,this.nodes.forEach(i6))}})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&i&&(s||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:s,layout:a})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let r=this.options.transition||i.getDefaultTransition()||ri,{onLayoutAnimationStart:n,onLayoutAnimationComplete:l}=i.getProps(),o=!this.targetLayout||!iL(this.targetLayout,a),c=!t&&s;if(this.options.layoutRoot||this.resumeFrom||c||t&&(o||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...sw(r,"layout"),onPlay:n,onComplete:l};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||i6(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=a})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),e0(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(i9),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:s}=t.options;if(!s)return;let a=s.props[sf];if(window.MotionHasOptimisedAnimation(a,"transform")){let{layout:e,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(a,"transform",eZ,!(e||s))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:s}=this.options;if(void 0===t&&!s)return;let a=this.getTransformTemplate();this.prevTransformTemplateValue=a?a(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(i5);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(i4);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(i3),this.nodes.forEach(iJ),this.nodes.forEach(iZ)):this.nodes.forEach(i4),this.clearAllSnapshots();let e=to.now();e1.delta=L(0,1e3/60,e-e1.timestamp),e1.timestamp=e,e1.isProcessing=!0,e2.update.process(e1),e2.preRender.process(e1),e2.render.process(e1),e1.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,tn.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(i2),this.sharedNodes.forEach(re)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,eZ.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){eZ.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||aZ(this.snapshot.measuredBox.x)||aZ(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=eb(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=a(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!iM(this.projectionDelta),s=this.getTransformTemplate(),a=s?s(this.latestValues,""):void 0,r=a!==this.prevTransformTemplateValue;e&&this.instance&&(t||tG(this.latestValues)||r)&&(i(this.instance,a),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let s=this.measurePageBox(),a=this.removeElementScroll(s);return e&&(a=this.removeTransform(a)),rl((t=a).x),rl(t.y),{animationId:this.root.animationId,measuredBox:s,layoutBox:a,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return eb();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(rc))){let{scroll:e}=this.root;e&&(t2(t.x,e.offset.x),t2(t.y,e.offset.y))}return t}removeElementScroll(e){let t=eb();if(iT(t,e),this.scroll?.wasRoot)return t;for(let s=0;s<this.path.length;s++){let a=this.path[s],{scroll:i,options:r}=a;a!==this.root&&i&&r.layoutScroll&&(i.wasRoot&&iT(t,e),t2(t.x,i.offset.x),t2(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let s=eb();iT(s,e);for(let e=0;e<this.path.length;e++){let a=this.path[e];!t&&a.options.layoutScroll&&a.scroll&&a!==a.root&&t4(s,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),tG(a.latestValues)&&t4(s,a.latestValues)}return tG(this.latestValues)&&t4(s,this.latestValues),s}removeTransform(e){let t=eb();iT(t,e);for(let e=0;e<this.path.length;e++){let s=this.path[e];if(!s.instance||!tG(s.latestValues))continue;tY(s.latestValues)&&s.updateSnapshot();let a=eb();iT(a,s.measurePageBox()),iS(t,s.latestValues,s.snapshot?s.snapshot.layoutBox:void 0,a)}return tG(this.latestValues)&&iS(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==e1.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let s=!!this.resumingFrom||this!==t;if(!(e||s&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:a,layoutId:i}=this.options;if(!this.layout||!(a||i))return;this.resolvedRelativeTargetAt=e1.timestamp;let r=this.getClosestProjectingParent();if(r&&this.linkedParentVersion!==r.layoutVersion&&!r.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(r&&r.layout?this.createRelativeTarget(r,this.layout.layoutBox,r.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=eb(),this.targetWithTransforms=eb()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var n,l,o;this.forceRelativeParentToResolveTarget(),n=this.target,l=this.relativeTarget,o=this.relativeParent.target,a2(n.x,l.x,o.x),a2(n.y,l.y,o.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):iT(this.target,this.layout.layoutBox),t1(this.target,this.targetDelta)):iT(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,r&&!!r.resumingFrom==!!this.resumingFrom&&!r.options.layoutScroll&&r.target&&1!==this.animationProgress?this.createRelativeTarget(r,this.target,r.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||tY(this.parent.latestValues)||tJ(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,s){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=eb(),this.relativeTargetOrigin=eb(),a4(this.relativeTargetOrigin,t,s),iT(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,s=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(s=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(s=!1),this.resolvedRelativeTargetAt===e1.timestamp&&(s=!1),s)return;let{layout:a,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(a||i))return;iT(this.layoutCorrected,this.layout.layoutBox);let r=this.treeScale.x,n=this.treeScale.y;!function(e,t,s,a=!1){let i,r,n=s.length;if(n){t.x=t.y=1;for(let l=0;l<n;l++){r=(i=s[l]).projectionDelta;let{visualElement:n}=i.options;(!n||!n.props.style||"contents"!==n.props.style.display)&&(a&&i.options.layoutScroll&&i.scroll&&i!==i.root&&t4(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),r&&(t.x*=r.x.scale,t.y*=r.y.scale,t1(e,r)),a&&tG(i.latestValues)&&t4(e,i.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=eb());let{target:l}=e;if(!l){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(iP(this.prevProjectionDelta.x,this.projectionDelta.x),iP(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),a1(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===r&&this.treeScale.y===n&&iR(this.projectionDelta.x,this.prevProjectionDelta.x)&&iR(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ey(),this.projectionDelta=ey(),this.projectionDeltaWithTransform=ey()}setAnimationOrigin(e,t=!1){let s,a=this.snapshot,i=a?a.latestValues:{},r={...this.latestValues},n=ey();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let l=eb(),o=(a?a.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=!!(o&&!d&&!0===this.options.crossfade&&!this.path.some(ra));this.animationProgress=0,this.mixTargetDelta=t=>{let a=t/1e3;if(rt(n.x,e.x,a),rt(n.y,e.y,a),this.setTargetDelta(n),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,m,x,p,f;a4(l,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,x=this.relativeTargetOrigin,p=l,f=a,rs(m.x,x.x,p.x,f),rs(m.y,x.y,p.y,f),s&&(c=this.relativeTarget,h=s,iE(c.x,h.x)&&iE(c.y,h.y))&&(this.isProjectionDirty=!1),s||(s=eb()),iT(s,this.relativeTarget)}o&&(this.animationValues=r,function(e,t,s,a,i,r){i?(e.opacity=tB(0,s.opacity??1,iO(a)),e.opacityExit=tB(t.opacity??1,0,iB(a))):r&&(e.opacity=tB(t.opacity??1,s.opacity??1,a));for(let i=0;i<iz;i++){let r=`border${i$[i]}Radius`,n=iI(t,r),l=iI(s,r);(void 0!==n||void 0!==l)&&(n||(n=0),l||(l=0),0===n||0===l||iV(n)===iV(l)?(e[r]=Math.max(tB(i_(n),i_(l),a),0),(Q.test(l)||Q.test(n))&&(e[r]+="%")):e[r]=l)}(t.rotate||s.rotate)&&(e.rotate=tB(t.rotate||0,s.rotate||0,a))}(r,i,this.latestValues,a,u,d)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=a},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(e0(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=eZ.update(()=>{var t,s,a;let i;ip.hasAnimatedSinceResize=!0,sP.layout++,this.motionValue||(this.motionValue=td(0)),this.currentAnimation=(t=this.motionValue,s=[0,1e3],a={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{sP.layout--},onComplete:()=>{sP.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(i=ej(t)?t:td(t)).start(az("",i,s,a)),i.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:s,layout:a,latestValues:i}=e;if(t&&s&&a){if(this!==e&&this.layout&&a&&ro(this.options.animationType,this.layout.layoutBox,a.layoutBox)){s=this.target||eb();let t=aZ(this.layout.layoutBox.x);s.x.min=e.target.x.min,s.x.max=s.x.min+t;let a=aZ(this.layout.layoutBox.y);s.y.min=e.target.y.min,s.y.max=s.y.min+a}iT(t,s),t4(t,i),a1(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new iQ),this.sharedNodes.get(e).add(t);let s=t.options.initialPromotionConfig;t.promote({transition:s?s.transition:void 0,preserveFollowOpacity:s&&s.shouldPreserveFollowOpacity?s.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:s}={}){let a=this.getStack();a&&a.promote(this,s),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:s}=e;if((s.z||s.rotate||s.rotateX||s.rotateY||s.rotateZ||s.skewX||s.skewY)&&(t=!0),!t)return;let a={};s.z&&iY("z",e,a,this.animationValues);for(let t=0;t<iH.length;t++)iY(`rotate${iH[t]}`,e,a,this.animationValues),iY(`skew${iH[t]}`,e,a,this.animationValues);for(let t in e.render(),a)e.setStaticValue(t,a[t]),this.animationValues&&(this.animationValues[t]=a[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let s=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=so(t?.pointerEvents)||"",e.transform=s?s(this.latestValues,""):"none";return}let a=this.getLead();if(!this.projectionDelta||!this.layout||!a.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=so(t?.pointerEvents)||""),this.hasProjected&&!tG(this.latestValues)&&(e.transform=s?s({},""):"none",this.hasProjected=!1);return}e.visibility="";let i=a.animationValues||a.latestValues;this.applyTransformsToTarget();let r=function(e,t,s){let a="",i=e.x.translate/t.x,r=e.y.translate/t.y,n=s?.z||0;if((i||r||n)&&(a=`translate3d(${i}px, ${r}px, ${n}px) `),(1!==t.x||1!==t.y)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),s){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:r,skewX:n,skewY:l}=s;e&&(a=`perspective(${e}px) ${a}`),t&&(a+=`rotate(${t}deg) `),i&&(a+=`rotateX(${i}deg) `),r&&(a+=`rotateY(${r}deg) `),n&&(a+=`skewX(${n}deg) `),l&&(a+=`skewY(${l}deg) `)}let l=e.x.scale*t.x,o=e.y.scale*t.y;return(1!==l||1!==o)&&(a+=`scale(${l}, ${o})`),a||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);s&&(r=s(i,r)),e.transform=r;let{x:n,y:l}=this.projectionDelta;for(let t in e.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,a.animationValues?e.opacity=a===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=a===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,tU){if(void 0===i[t])continue;let{correct:s,applyTo:n,isCSSVariable:l}=tU[t],o="none"===r?i[t]:s(i[t],a);if(n){let t=n.length;for(let s=0;s<t;s++)e[n[s]]=o}else l?this.options.visualElement.renderState.vars[t]=o:e[t]=o}this.options.layoutId&&(e.pointerEvents=a===this?so(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(i5),this.root.sharedNodes.clear()}}}function iJ(e){e.updateLayout()}function iZ(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:s,measuredBox:a}=e.layout,{animationType:i}=e.options,r=t.source!==e.layout.source;"size"===i?aH(e=>{let a=r?t.measuredBox[e]:t.layoutBox[e],i=aZ(a);a.min=s[e].min,a.max=a.min+i}):ro(i,t.layoutBox,s)&&aH(a=>{let i=r?t.measuredBox[a]:t.layoutBox[a],n=aZ(s[a]);i.max=i.min+n,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[a].max=e.relativeTarget[a].min+n)});let n=ey();a1(n,s,t.layoutBox);let l=ey();r?a1(l,e.applyTransform(a,!0),t.measuredBox):a1(l,s,t.layoutBox);let o=!iM(n),c=!1;if(!e.resumeFrom){let a=e.getClosestProjectingParent();if(a&&!a.resumeFrom){let{snapshot:i,layout:r}=a;if(i&&r){let n=eb();a4(n,t.layoutBox,i.layoutBox);let l=eb();a4(l,s,r.layoutBox),iL(n,l)||(c=!0),a.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=n,e.relativeParent=a)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:l,layoutDelta:n,hasLayoutChanged:o,hasRelativeLayoutChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function i0(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function i1(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function i2(e){e.clearSnapshot()}function i5(e){e.clearMeasurements()}function i4(e){e.isLayoutDirty=!1}function i3(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function i6(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function i8(e){e.resolveTargetDelta()}function i7(e){e.calcProjection()}function i9(e){e.resetSkewAndRotation()}function re(e){e.removeLeadSnapshot()}function rt(e,t,s){e.translate=tB(t.translate,0,s),e.scale=tB(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function rs(e,t,s,a){e.min=tB(t.min,s.min,a),e.max=tB(t.max,s.max,a)}function ra(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let ri={duration:.45,ease:[.4,0,.1,1]},rr=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),rn=rr("applewebkit/")&&!rr("chrome/")?Math.round:eX;function rl(e){e.min=rn(e.min),e.max=rn(e.max)}function ro(e,t,s){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(iF(t)-iF(s)))}function rc(e){return e!==e.root&&e.scroll?.wasRoot}let rd=iG({attachResizeListener:(e,t)=>aG(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),ru={current:void 0},rh=iG({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ru.current){let e=new rd({});e.mount(window),e.setOptions({layoutScroll:!0}),ru.current=e}return ru.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function rm(e,t){let s=function(e,t,s){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,s=(void 0)??t.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(e=>null!=e)}(e),a=new AbortController;return[s,{passive:!0,...t,signal:a.signal},()=>a.abort()]}function rx(e){return!("touch"===e.pointerType||aJ.x||aJ.y)}function rp(e,t,s){let{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover","Start"===s);let i=a["onHover"+s];i&&eZ.postRender(()=>i(t,a6(t)))}let rf=(e,t)=>!!t&&(e===t||rf(e,t.parentElement)),rg=new WeakSet;function ry(e){return t=>{"Enter"===t.key&&e(t)}}function rv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function rb(e){return a3(e)&&!(aJ.x||aJ.y)}function rj(e,t,s){let{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap","Start"===s);let i=a["onTap"+("End"===s?"":s)];i&&eZ.postRender(()=>i(t,a6(t)))}let rw=new WeakMap,rN=new WeakMap,rk=e=>{let t=rw.get(e.target);t&&t(e)},rS=e=>{e.forEach(rk)},rC={some:0,all:1},rT=function(e,t){if("u"<typeof Proxy)return sv;let s=new Map,a=(s,a)=>sv(s,a,e,t);return new Proxy((e,t)=>a(e,t),{get:(i,r)=>"create"===r?a:(s.has(r)||s.set(r,sv(r,void 0,e,t)),s.get(r))})}({animation:{Feature:class extends sb{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:s})=>(function(e,t,s={}){let a;if(e.notify("AnimationStart",t),Array.isArray(t))a=Promise.all(t.map(t=>aI(e,t,s)));else if("string"==typeof t)a=aI(e,t,s);else{let i="function"==typeof t?sj(e,t,s.custom):t;a=Promise.all(a_(e,i,s))}return a.then(()=>{e.notify("AnimationComplete",t)})})(e,t,s))),s=aW(),a=!0,i=t=>(s,a)=>{let i=sj(e,a,"exit"===t?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...a}=i;s={...s,...a,...t}}return s};function r(r){let{props:n}=e,l=function e(t){if(!t)return;if(!t.isControllingVariants){let s=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(s.initial=t.props.initial),s}let s={};for(let e=0;e<aO;e++){let a=tv[e],i=t.props[a];(tg(i)||!1===i)&&(s[a]=i)}return s}(e.parent)||{},o=[],c=new Set,d={},u=1/0;for(let t=0;t<aq;t++){var h,m;let x=aU[t],p=s[x],f=void 0!==n[x]?n[x]:l[x],g=tg(f),y=x===r?p.isActive:null;!1===y&&(u=t);let v=f===l[x]&&f!==n[x]&&g;if(v&&a&&e.manuallyAnimateOnMount&&(v=!1),p.protectedKeys={...d},!p.isActive&&null===y||!f&&!p.prevProp||tf(f)||"boolean"==typeof f)continue;let b=(h=p.prevProp,"string"==typeof(m=f)?m!==h:!!Array.isArray(m)&&!aB(m,h)),j=b||x===r&&p.isActive&&!v&&g||t>u&&g,w=!1,N=Array.isArray(f)?f:[f],k=N.reduce(i(x),{});!1===y&&(k={});let{prevResolvedValues:S={}}=p,C={...S,...k},T=t=>{j=!0,c.has(t)&&(w=!0,c.delete(t)),p.needsAnimating[t]=!0;let s=e.getValue(t);s&&(s.liveStyle=!1)};for(let e in C){let t=k[e],s=S[e];if(!d.hasOwnProperty(e))(sN(t)&&sN(s)?aB(t,s):t===s)?void 0!==t&&c.has(e)?T(e):p.protectedKeys[e]=!0:null!=t?T(e):c.add(e)}p.prevProp=f,p.prevResolvedValues=k,p.isActive&&(d={...d,...k}),a&&e.blockInitialAnimation&&(j=!1);let P=v&&b,A=!P||w;j&&A&&o.push(...N.map(t=>{let s={type:x};if("string"==typeof t&&a&&!P&&e.manuallyAnimateOnMount&&e.parent){let{parent:a}=e,i=sj(a,t);if(a.enteringChildren&&i){let{delayChildren:t}=i.transition||{};s.delay=aV(a.enteringChildren,e,t)}}return{animation:t,options:s}}))}if(c.size){let t={};if("boolean"!=typeof n.initial){let s=sj(e,Array.isArray(n.initial)?n.initial[0]:n.initial);s&&s.transition&&(t.transition=s.transition)}c.forEach(s=>{let a=e.getBaseTarget(s),i=e.getValue(s);i&&(i.liveStyle=!0),t[s]=a??null}),o.push({animation:t})}let x=!!o.length;return a&&(!1===n.initial||n.initial===n.animate)&&!e.manuallyAnimateOnMount&&(x=!1),a=!1,x?t(o):Promise.resolve()}return{animateChanges:r,setActive:function(t,a){if(s[t].isActive===a)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,a)),s[t].isActive=a;let i=r(t);for(let e in s)s[e].protectedKeys={};return i},setAnimateFunction:function(s){t=s(e)},getState:()=>s,reset:()=>{s=aW()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();tf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends sb{constructor(){super(...arguments),this.id=aQ++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;let a=this.node.animationState.setActive("exit",!e);t&&!e&&a.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends sb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:s={}}=this.node.getProps(),{root:a,margin:i,amount:r="some",once:n}=s,l={root:a?a.current:void 0,rootMargin:i,threshold:"number"==typeof r?r:rC[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,n&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:s,onViewportLeave:a}=this.node.getProps(),i=t?s:a;i&&i(e)};return e=this.node.current,t=function({root:e,...t}){let s=e||document;rN.has(s)||rN.set(s,{});let a=rN.get(s),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(rS,{root:e,...t})),a[i]}(l),rw.set(e,o),t.observe(e),()=>{rw.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends sb{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[a,i,r]=rm(e,s),n=e=>{let a=e.currentTarget;if(!rb(e))return;rg.add(a);let r=t(a,e),n=(e,t)=>{window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",o),rg.has(a)&&rg.delete(a),rb(e)&&"function"==typeof r&&r(e,{success:t})},l=e=>{n(e,a===window||a===document||s.useGlobalTarget||rf(a,e.target))},o=e=>{n(e,!1)};window.addEventListener("pointerup",l,i),window.addEventListener("pointercancel",o,i)};return a.forEach(e=>{(s.useGlobalTarget?window:e).addEventListener("pointerdown",n,i),v(e)&&(e.addEventListener("focus",e=>((e,t)=>{let s=e.currentTarget;if(!s)return;let a=ry(()=>{if(rg.has(s))return;rv(s,"down");let e=ry(()=>{rv(s,"up")});s.addEventListener("keyup",e,t),s.addEventListener("blur",()=>rv(s,"cancel"),t)});s.addEventListener("keydown",a,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",a),t)})(e,i)),aY(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),r}(e,(e,t)=>(rj(this.node,t,"Start"),(e,{success:t})=>rj(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends sb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=sT(aG(this.node.current,"focus",()=>this.onFocus()),aG(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends sb{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[a,i,r]=rm(e,s),n=e=>{if(!rx(e))return;let{target:s}=e,a=t(s,e);if("function"!=typeof a||!s)return;let r=e=>{rx(e)&&(a(e),s.removeEventListener("pointerleave",r))};s.addEventListener("pointerleave",r,i)};return a.forEach(e=>{e.addEventListener("pointerenter",n,i)}),r}(e,(e,t)=>(rp(this.node,t,"Start"),e=>rp(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends sb{constructor(){super(...arguments),this.removePointerDownListener=eX}onPointerDown(e){this.session=new it(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:a7(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:a}=this.node.getProps();return{onSessionStart:ix(e),onStart:ix(t),onMove:s,onEnd:(e,t)=>{delete this.session,a&&eZ.postRender(()=>a(e,t))}}}mount(){this.removePointerDownListener=a8(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends sb{constructor(e){super(e),this.removeGroupControls=eX,this.removeListeners=eX,this.controls=new ih(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||eX}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:rh,MeasureLayout:ib},layout:{ProjectionNode:rh,MeasureLayout:ib}},(e,t)=>t.isSVG??t7(e)?new tQ(t):new t6(t,{allowProjection:e!==u.Fragment}));var rP=e.i(74133),rA=e.i(88069),rM=e.i(42098);function rE(e,t=300){let[s,a]=(0,u.useState)(e);return(0,u.useEffect)(()=>{let s=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(s)}},[e,t]),s}var rD=e.i(45688),rL=e.i(88969);let rF=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function rR(e){if(!e||e.length<2)return[];let t=await (0,rL.authFetch)(`${rF}/api/suggestions?q=${encodeURIComponent(e)}&limit=8`);if(!t.ok)throw Error("Failed to fetch suggestions");return(await t.json()).suggestions}function r$(){for(var e,t,s=0,a="",i=arguments.length;s<i;s++)(e=arguments[s])&&(t=function e(t){var s,a,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(s=0;s<r;s++)t[s]&&(a=e(t[s]))&&(i&&(i+=" "),i+=a)}else for(a in t)t[a]&&(i&&(i+=" "),i+=a);return i}(e))&&(a&&(a+=" "),a+=t);return a}let rz=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),r_=[],rV=(e,t,s)=>{if(0==e.length-t)return s.classGroupId;let a=e[t],i=s.nextPart.get(a);if(i){let s=rV(e,t+1,i);if(s)return s}let r=s.validators;if(null===r)return;let n=0===t?e.join("-"):e.slice(t).join("-"),l=r.length;for(let e=0;e<l;e++){let t=r[e];if(t.validator(n))return t.classGroupId}},rI=(e,t)=>{let s=rz();for(let a in e)rO(e[a],s,a,t);return s},rO=(e,t,s,a)=>{let i=e.length;for(let r=0;r<i;r++)rB(e[r],t,s,a)},rB=(e,t,s,a)=>{"string"==typeof e?rU(e,t,s):"function"==typeof e?rq(e,t,s,a):rK(e,t,s,a)},rU=(e,t,s)=>{(""===e?t:rW(t,e)).classGroupId=s},rq=(e,t,s,a)=>{rQ(e)?rO(e(a),t,s,a):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:s,validator:e}))},rK=(e,t,s,a)=>{let i=Object.entries(e),r=i.length;for(let e=0;e<r;e++){let[r,n]=i[e];rO(n,rW(t,r),s,a)}},rW=(e,t)=>{let s=e,a=t.split("-"),i=a.length;for(let e=0;e<i;e++){let t=a[e],i=s.nextPart.get(t);i||(i=rz(),s.nextPart.set(t,i)),s=i}return s},rQ=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,rH=[],rX=(e,t,s,a,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:a,isExternal:i}),rY=/\s+/,rG=e=>{let t;if("string"==typeof e)return e;let s="";for(let a=0;a<e.length;a++)e[a]&&(t=rG(e[a]))&&(s&&(s+=" "),s+=t);return s},rJ=[],rZ=e=>{let t=t=>t[e]||rJ;return t.isThemeGetter=!0,t},r0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,r1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,r2=/^\d+\/\d+$/,r5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,r3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,r6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,r7=e=>r2.test(e),r9=e=>!!e&&!Number.isNaN(Number(e)),ne=e=>!!e&&Number.isInteger(Number(e)),nt=e=>e.endsWith("%")&&r9(e.slice(0,-1)),ns=e=>r5.test(e),na=()=>!0,ni=e=>r4.test(e)&&!r3.test(e),nr=()=>!1,nn=e=>r6.test(e),nl=e=>r8.test(e),no=e=>!nd(e)&&!nf(e),nc=e=>nN(e,nT,nr),nd=e=>r0.test(e),nu=e=>nN(e,nP,ni),nh=e=>nN(e,nA,r9),nm=e=>nN(e,nS,nr),nx=e=>nN(e,nC,nl),np=e=>nN(e,nE,nn),nf=e=>r1.test(e),ng=e=>nk(e,nP),ny=e=>nk(e,nM),nv=e=>nk(e,nS),nb=e=>nk(e,nT),nj=e=>nk(e,nC),nw=e=>nk(e,nE,!0),nN=(e,t,s)=>{let a=r0.exec(e);return!!a&&(a[1]?t(a[1]):s(a[2]))},nk=(e,t,s=!1)=>{let a=r1.exec(e);return!!a&&(a[1]?t(a[1]):s)},nS=e=>"position"===e||"percentage"===e,nC=e=>"image"===e||"url"===e,nT=e=>"length"===e||"size"===e||"bg-size"===e,nP=e=>"length"===e,nA=e=>"number"===e,nM=e=>"family-name"===e,nE=e=>"shadow"===e,nD=((e,...t)=>{let s,a,i,r,n=e=>{let t=a(e);if(t)return t;let r=((e,t)=>{let{parseClassName:s,getClassGroupId:a,getConflictingClassGroupIds:i,sortModifiers:r}=t,n=[],l=e.trim().split(rY),o="";for(let e=l.length-1;e>=0;e-=1){let t=l[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:m}=s(t);if(c){o=t+(o.length>0?" "+o:o);continue}let x=!!m,p=a(x?h.substring(0,m):h);if(!p){if(!x||!(p=a(h))){o=t+(o.length>0?" "+o:o);continue}x=!1}let f=0===d.length?"":1===d.length?d[0]:r(d).join(":"),g=u?f+"!":f,y=g+p;if(n.indexOf(y)>-1)continue;n.push(y);let v=i(p,x);for(let e=0;e<v.length;++e){let t=v[e];n.push(g+t)}o=t+(o.length>0?" "+o:o)}return o})(e,s);return i(e,r),r};return r=l=>{var o;let c;return a=(s={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,s=Object.create(null),a=Object.create(null),i=(i,r)=>{s[i]=r,++t>e&&(t=0,a=s,s=Object.create(null))};return{get(e){let t=s[e];return void 0!==t?t:void 0!==(t=a[e])?(i(e,t),t):void 0},set(e,t){e in s?s[e]=t:i(e,t)}}})((o=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:s}=e,a=e=>{let t,s=[],a=0,i=0,r=0,n=e.length;for(let l=0;l<n;l++){let n=e[l];if(0===a&&0===i){if(":"===n){s.push(e.slice(r,l)),r=l+1;continue}if("/"===n){t=l;continue}}"["===n?a++:"]"===n?a--:"("===n?i++:")"===n&&i--}let l=0===s.length?e:e.slice(r),o=l,c=!1;return l.endsWith("!")?(o=l.slice(0,-1),c=!0):l.startsWith("!")&&(o=l.slice(1),c=!0),rX(s,c,o,t&&t>r?t-r:void 0)};if(t){let e=t+":",s=a;a=t=>t.startsWith(e)?s(t.slice(e.length)):rX(rH,!1,t,void 0,!0)}if(s){let e=a;a=t=>s({className:t,parseClassName:e})}return a})(o),sortModifiers:(c=new Map,o.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],s=[];for(let a=0;a<e.length;a++){let i=e[a],r="["===i[0],n=c.has(i);r||n?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(i)):s.push(i)}return s.length>0&&(s.sort(),t.push(...s)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:s}=e;return rI(s,t)})(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var s;let t,a,i;return -1===(s=e).slice(1,-1).indexOf(":")?void 0:(a=(t=s.slice(1,-1)).indexOf(":"),(i=t.slice(0,a))?"arbitrary.."+i:void 0)}let a=e.split("-"),i=+(""===a[0]&&a.length>1);return rV(a,i,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=a[e],i=s[e];if(t){if(i){let e=Array(i.length+t.length);for(let t=0;t<i.length;t++)e[t]=i[t];for(let s=0;s<t.length;s++)e[i.length+s]=t[s];return e}return t}return i||r_}return s[e]||r_}}})(o)}).cache.get,i=s.cache.set,r=n,n(l)},(...e)=>r(((...e)=>{let t,s,a=0,i="";for(;a<e.length;)(t=e[a++])&&(s=rG(t))&&(i&&(i+=" "),i+=s);return i})(...e))})(()=>{let e=rZ("color"),t=rZ("font"),s=rZ("text"),a=rZ("font-weight"),i=rZ("tracking"),r=rZ("leading"),n=rZ("breakpoint"),l=rZ("container"),o=rZ("spacing"),c=rZ("radius"),d=rZ("shadow"),u=rZ("inset-shadow"),h=rZ("text-shadow"),m=rZ("drop-shadow"),x=rZ("blur"),p=rZ("perspective"),f=rZ("aspect"),g=rZ("ease"),y=rZ("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...b(),nf,nd],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],k=()=>[nf,nd,o],S=()=>[r7,"full","auto",...k()],C=()=>[ne,"none","subgrid",nf,nd],T=()=>["auto",{span:["full",ne,nf,nd]},ne,nf,nd],P=()=>[ne,"auto",nf,nd],A=()=>["auto","min","max","fr",nf,nd],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],E=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...k()],L=()=>[r7,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],F=()=>[e,nf,nd],R=()=>[...b(),nv,nm,{position:[nf,nd]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",nb,nc,{size:[nf,nd]}],_=()=>[nt,ng,nu],V=()=>["","none","full",c,nf,nd],I=()=>["",r9,ng,nu],O=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[r9,nt,nv,nm],q=()=>["","none",x,nf,nd],K=()=>["none",r9,nf,nd],W=()=>["none",r9,nf,nd],Q=()=>[r9,nf,nd],H=()=>[r7,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ns],breakpoint:[ns],color:[na],container:[ns],"drop-shadow":[ns],ease:["in","out","in-out"],font:[no],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ns],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ns],shadow:[ns],spacing:["px",r9],text:[ns],"text-shadow":[ns],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",r7,nd,nf,f]}],container:["container"],columns:[{columns:[r9,nd,nf,l]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{start:S()}],end:[{end:S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[ne,"auto",nf,nd]}],basis:[{basis:[r7,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[r9,r7,"auto","initial","none",nd]}],grow:[{grow:["",r9,nf,nd]}],shrink:[{shrink:["",r9,nf,nd]}],order:[{order:[ne,"first","last","none",nf,nd]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...E(),"baseline"]}],"place-self":[{"place-self":["auto",...E()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[l,"screen",...L()]}],"min-w":[{"min-w":[l,"screen","none",...L()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[n]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",s,ng,nu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,nf,nh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nt,nd]}],"font-family":[{font:[ny,nd,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,nf,nd]}],"line-clamp":[{"line-clamp":[r9,"none",nf,nh]}],leading:[{leading:[r,...k()]}],"list-image":[{"list-image":["none",nf,nd]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",nf,nd]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[r9,"from-font","auto",nf,nu]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[r9,"auto",nf,nd]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",nf,nd]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",nf,nd]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ne,nf,nd],radial:["",nf,nd],conic:[ne,nf,nd]},nj,nx]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:_()}],"gradient-via-pos":[{via:_()}],"gradient-to-pos":[{to:_()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...O(),"hidden","none"]}],"divide-style":[{divide:[...O(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[r9,nf,nd]}],"outline-w":[{outline:["",r9,ng,nu]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,nw,np]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",u,nw,np]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[r9,nu]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",h,nw,np]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[r9,nf,nd]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[r9]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[nf,nd]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[r9]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",nf,nd]}],filter:[{filter:["","none",nf,nd]}],blur:[{blur:q()}],brightness:[{brightness:[r9,nf,nd]}],contrast:[{contrast:[r9,nf,nd]}],"drop-shadow":[{"drop-shadow":["","none",m,nw,np]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",r9,nf,nd]}],"hue-rotate":[{"hue-rotate":[r9,nf,nd]}],invert:[{invert:["",r9,nf,nd]}],saturate:[{saturate:[r9,nf,nd]}],sepia:[{sepia:["",r9,nf,nd]}],"backdrop-filter":[{"backdrop-filter":["","none",nf,nd]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[r9,nf,nd]}],"backdrop-contrast":[{"backdrop-contrast":[r9,nf,nd]}],"backdrop-grayscale":[{"backdrop-grayscale":["",r9,nf,nd]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[r9,nf,nd]}],"backdrop-invert":[{"backdrop-invert":["",r9,nf,nd]}],"backdrop-opacity":[{"backdrop-opacity":[r9,nf,nd]}],"backdrop-saturate":[{"backdrop-saturate":[r9,nf,nd]}],"backdrop-sepia":[{"backdrop-sepia":["",r9,nf,nd]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",nf,nd]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[r9,"initial",nf,nd]}],ease:[{ease:["linear","initial",g,nf,nd]}],delay:[{delay:[r9,nf,nd]}],animate:[{animate:["none",y,nf,nd]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,nf,nd]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:Q()}],"skew-x":[{"skew-x":Q()}],"skew-y":[{"skew-y":Q()}],transform:[{transform:[nf,nd,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",nf,nd]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",nf,nd]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[r9,ng,nu,nh]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function nL(...e){return nD(r$(e))}function nF({className:e,...t}){return(0,d.jsx)("div",{"data-slot":"card",className:nL("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function nR({className:e,...t}){return(0,d.jsx)("div",{"data-slot":"card-header",className:nL("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function n$({className:e,...t}){return(0,d.jsx)("div",{"data-slot":"card-title",className:nL("leading-none font-semibold",e),...t})}function nz({className:e,...t}){return(0,d.jsx)("div",{"data-slot":"card-content",className:nL("px-6",e),...t})}function n_(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var nV=Symbol.for("react.lazy"),nI=u[" use ".trim().toString()];function nO(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===nV&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var nB=((o=u.forwardRef((e,t)=>{let{children:s,...a}=e;if(nO(s)&&"function"==typeof nI&&(s=nI(s._payload)),u.isValidElement(s)){var i;let e,r,n=(i=s,(r=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(r=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),l=function(e,t){let s={...t};for(let a in t){let i=e[a],r=t[a];/^on[A-Z]/.test(a)?i&&r?s[a]=(...e)=>{let t=r(...e);return i(...e),t}:i&&(s[a]=i):"style"===a?s[a]={...i,...r}:"className"===a&&(s[a]=[i,r].filter(Boolean).join(" "))}return{...e,...s}}(a,s.props);return s.type!==u.Fragment&&(l.ref=t?function(...e){return t=>{let s=!1,a=e.map(e=>{let a=n_(e,t);return s||"function"!=typeof a||(s=!0),a});if(s)return()=>{for(let t=0;t<a.length;t++){let s=a[t];"function"==typeof s?s():n_(e[t],null)}}}}(t,n):n),u.cloneElement(s,l)}return u.Children.count(s)>1?u.Children.only(null):null})).displayName="Slot.SlotClone",a=o,(i=u.forwardRef((e,t)=>{let{children:s,...i}=e;nO(s)&&"function"==typeof nI&&(s=nI(s._payload));let r=u.Children.toArray(s),n=r.find(nq);if(n){let e=n.props.children,s=r.map(t=>t!==n?t:u.Children.count(e)>1?u.Children.only(null):u.isValidElement(e)?e.props.children:null);return(0,d.jsx)(a,{...i,ref:t,children:u.isValidElement(e)?u.cloneElement(e,void 0,s):null})}return(0,d.jsx)(a,{...i,ref:t,children:s})})).displayName="Slot.Slot",i),nU=Symbol("radix.slottable");function nq(e){return u.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===nU}let nK=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,nW=(r="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",n={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},e=>{var t;if((null==n?void 0:n.variants)==null)return r$(r,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:s,defaultVariants:a}=n,i=Object.keys(s).map(t=>{let i=null==e?void 0:e[t],r=null==a?void 0:a[t];if(null===i)return null;let n=nK(i)||nK(r);return s[t][n]}),l=e&&Object.entries(e).reduce((e,t)=>{let[s,a]=t;return void 0===a||(e[s]=a),e},{});return r$(r,i,null==n||null==(t=n.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:s,className:i,...r}=t;return Object.entries(r).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...a,...l}[t]):({...a,...l})[t]===s})?[...e,s,i]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function nQ({className:e,variant:t="default",size:s="default",asChild:a=!1,...i}){return(0,d.jsx)(a?nB:"button",{"data-slot":"button","data-variant":t,"data-size":s,className:nL(nW({variant:t,size:s,className:e})),...i})}function nH({className:e,type:t,...s}){return(0,d.jsx)("input",{type:t,"data-slot":"input",className:nL("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...s})}var nX=e.i(97358),nY=e.i(33368),nG=e.i(24929);let nJ=(0,nG.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),nZ=(0,nG.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),n0={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},n1=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function n2({memory:e,links:t=[],memories:s=[],onClose:a,onReinforce:i,onSelectMemory:r,isReinforcing:n=!1,reinforceSuccess:l=!1}){let[o,c]=(0,u.useState)(!1),[h,m]=(0,u.useState)(!1),[x,p]=(0,u.useState)(null),[f,g]=(0,u.useState)(!1),[y,v]=(0,u.useState)(e.title),[b,j]=(0,u.useState)(e.content),[w,N]=(0,u.useState)(e.category),[k,S]=(0,u.useState)((e.tags||[]).join(", ")),[C,T]=(0,u.useState)(!1),P=(0,rA.useEditMemory)(),A=(0,rA.useDeleteMemory)(),[M,E]=(0,u.useState)(e.id);M!==e.id&&(E(e.id),g(!1),T(!1),v(e.title),j(e.content),N(e.category),S((e.tags||[]).join(", "))),(0,u.useEffect)(()=>{if(l&&x===e.id){let e=setTimeout(()=>c(!0),0),t=setTimeout(()=>c(!1),1500);return()=>{clearTimeout(e),clearTimeout(t)}}},[l,x,e.id]);let D=(0,u.useCallback)(()=>{let t=k.split(",").map(e=>e.trim()).filter(Boolean),s={};(y!==e.title&&(s.title=y),b!==e.content&&(s.content=b),w!==e.category&&(s.category=w),k!==(e.tags||[]).join(", ")&&(s.tags=t),0===Object.keys(s).length)?g(!1):P.mutate({id:e.id,updates:s},{onSuccess:()=>{g(!1),m(!0),setTimeout(()=>m(!1),1500)}})},[e.id,y,b,w,k,P]),L=(0,nY.calculateDecayFactor)(e),F=(0,nX.getCategoryColor)(e.category),R=(0,nX.getTypeColor)(e.type),$=L>.7?{label:"Healthy",color:"#22C55E",bgColor:"rgba(34, 197, 94, 0.15)"}:L>.4?{label:"Fading",color:"#EAB308",bgColor:"rgba(234, 179, 8, 0.15)"}:{label:"Critical",color:"#EF4444",bgColor:"rgba(239, 68, 68, 0.15)"},z=(0,u.useMemo)(()=>{let a=[];for(let i of t)if(i.source_id===e.id){let e=s.find(e=>e.id===i.target_id);e&&a.push({memory:e,relationship:i.relationship,strength:i.strength,direction:"to"})}else if(i.target_id===e.id){let e=s.find(e=>e.id===i.source_id);e&&a.push({memory:e,relationship:i.relationship,strength:i.strength,direction:"from"})}return a.sort((e,t)=>t.strength-e.strength)},[e.id,t,s]);return(0,d.jsxs)(nF,{className:`bg-slate-900 border-slate-700 h-full overflow-auto transition-all duration-300 ${o?"ring-2 ring-green-500 ring-opacity-75":""} ${h?"ring-2 ring-emerald-500 ring-opacity-75":""}`,children:[(0,d.jsxs)(nR,{className:"border-b border-slate-700 pb-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[f?(0,d.jsx)(nH,{value:y,onChange:e=>v(e.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,d.jsxs)(n$,{className:"text-lg font-semibold text-white leading-tight flex items-center gap-2",children:[h&&(0,d.jsx)(nZ,{className:"w-4 h-4 text-emerald-400 shrink-0"}),e.title]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0 -mt-1",children:[!f&&(0,d.jsx)(nQ,{variant:"ghost",size:"sm",onClick:()=>g(!0),className:"text-slate-400 hover:text-white",title:"Edit memory",children:(0,d.jsx)(nJ,{className:"w-4 h-4"})}),(0,d.jsx)(nQ,{variant:"ghost",size:"sm",onClick:a,className:"text-slate-400 hover:text-white",children:"✕"})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[f?(0,d.jsx)("select",{value:w,onChange:e=>N(e.target.value),className:"bg-slate-800 border border-slate-600 text-white text-xs rounded-lg px-2 py-1",children:n1.map(e=>(0,d.jsx)("option",{value:e,children:e},e))}):(0,d.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:F+"20",color:F},children:e.category}),(0,d.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:R+"20",color:R},children:e.type.replace("_","-")})]})]}),(0,d.jsxs)(nz,{className:"p-4 space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Content"}),f?(0,d.jsx)("textarea",{value:b,onChange:e=>j(e.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-600 text-sm text-slate-200 rounded-lg p-3 resize-y focus:ring-cyan-500 focus:border-cyan-500"}):(0,d.jsx)("p",{className:"text-sm text-slate-200 whitespace-pre-wrap leading-relaxed",children:e.content})]}),f&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Tags (comma-separated)"}),(0,d.jsx)(nH,{value:k,onChange:e=>S(e.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),f?(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(nQ,{variant:"default",size:"sm",onClick:D,disabled:P.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:P.isPending?"Saving...":"Save Changes"}),(0,d.jsx)(nQ,{variant:"outline",size:"sm",onClick:()=>{g(!1),v(e.title),j(e.content),N(e.category),S((e.tags||[]).join(", "))},className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]}):null,!f&&(0,d.jsxs)("div",{className:"rounded-lg p-3 flex items-center gap-3",style:{backgroundColor:$.bgColor},children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{backgroundColor:$.color}}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-sm font-medium",style:{color:$.color},children:$.label}),(0,d.jsx)("div",{className:"text-xs text-slate-400",children:L>.7?"Memory is strong and stable":L>.4?"Memory is fading - reinforce to preserve":"Memory at risk of deletion - reinforce now"})]})]}),!f&&(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,d.jsx)("div",{className:"text-xs text-slate-400",children:"Salience"}),(0,d.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*e.salience).toFixed(0),"%"]}),(0,d.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 rounded-full transition-all",style:{width:`${100*e.salience}%`}})})]}),(0,d.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,d.jsx)("div",{className:"text-xs text-slate-400",children:"Decay Factor"}),(0,d.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*L).toFixed(0),"%"]}),(0,d.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*L}%`,backgroundColor:$.color}})})]})]}),!f&&(0,d.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${o?"ring-1 ring-green-500/50":""}`,children:[(0,d.jsxs)("div",{className:"flex justify-between items-center",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:"Access Count"}),(0,d.jsxs)("span",{className:`text-sm font-medium transition-all duration-300 ${o?"text-green-400 scale-110":"text-white"}`,children:[e.accessCount," times"]})]}),(0,d.jsxs)("div",{className:"flex justify-between items-center",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:"Last Accessed"}),(0,d.jsx)("span",{className:`text-sm transition-all duration-300 ${o?"text-green-400":"text-white"}`,children:o?"Just now":(e=>{let t=new Date(e),s=Math.floor((new Date().getTime()-t.getTime())/36e5);if(s<1)return"Just now";if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return a<7?`${a}d ago`:`${Math.floor(a/7)}w ago`})(e.lastAccessed)})]}),(0,d.jsxs)("div",{className:"flex justify-between items-center",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:"Created"}),(0,d.jsx)("span",{className:"text-sm text-white",children:new Date(e.createdAt).toLocaleString()})]})]}),!f&&z.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("h4",{className:"text-xs font-medium text-slate-400 mb-2 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"inline-block w-4 h-4",children:"🔗"}),"Related Memories (",z.length,")"]}),(0,d.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:z.map(({memory:e,relationship:t,strength:s,direction:a})=>{let i=n0[t]||n0.related,n=(0,nX.getCategoryColor)(e.category);return(0,d.jsxs)("button",{onClick:()=>r?.(e.id),className:"w-full text-left p-2 bg-slate-800 hover:bg-slate-750 rounded-lg transition-colors group",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:i.color}}),(0,d.jsx)("span",{className:"text-[10px] font-medium",style:{color:i.color},children:"to"===a?`${i.icon} ${i.label}`:`${i.label} ${i.icon}`}),(0,d.jsxs)("span",{className:"text-[10px] text-slate-500 ml-auto",children:[(100*s).toFixed(0),"%"]})]}),(0,d.jsx)("div",{className:"text-sm text-white truncate group-hover:text-blue-400 transition-colors",children:e.title}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:n+"20",color:n},children:e.category}),(0,d.jsxs)("span",{className:"text-[10px] text-slate-500",children:[(100*e.salience).toFixed(0),"% salience"]})]})]},`${e.id}-${a}`)})})]}),!f&&e.tags&&e.tags.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Tags"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map((e,t)=>(0,d.jsx)("span",{className:"px-2 py-0.5 bg-slate-700 text-slate-300 rounded text-xs",children:e},t))})]}),!f&&(0,d.jsxs)("div",{className:"space-y-2 pt-2",children:[i&&(0,d.jsx)(nQ,{variant:"default",size:"sm",onClick:()=>{p(e.id),i?.(e.id)},disabled:n,className:`w-full transition-all duration-300 ${o?"bg-green-600 hover:bg-green-600":"bg-blue-600 hover:bg-blue-700"}`,children:n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),"Reinforcing..."]}):o?(0,d.jsx)(d.Fragment,{children:"✓ Reinforced!"}):(0,d.jsx)(d.Fragment,{children:"⚡ Reinforce"})}),C?(0,d.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[(0,d.jsx)("p",{className:"text-xs text-red-400 mb-2",children:"Delete this memory permanently?"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(nQ,{variant:"default",size:"sm",onClick:()=>{A.mutate(e.id,{onSuccess:()=>{a()}})},disabled:A.isPending,className:"flex-1 bg-red-600 hover:bg-red-700",children:A.isPending?"Deleting...":"Confirm Delete"}),(0,d.jsx)(nQ,{variant:"outline",size:"sm",onClick:()=>T(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,d.jsx)(nQ,{variant:"ghost",size:"sm",onClick:()=>T(!0),className:"w-full text-slate-500 hover:text-red-400 hover:bg-red-500/10",children:"Delete Memory"})]})]})]})}var n5=e.i(1235);function n4(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);if(a<7)return`${a}d ago`;let i=Math.floor(a/7);return`${i}w ago`}function n3({memory:e,isSelected:t,onSelect:s,isChecked:a,onCheck:i}){let r=(0,nX.getCategoryColor)(e.category),n=(0,nX.getTypeColor)(e.type);return(0,d.jsxs)("div",{onClick:()=>s(e),className:`bg-slate-900 border rounded-lg p-3 hover:border-slate-600 cursor-pointer transition-colors relative ${t?"border-cyan-500":"border-slate-800"}`,children:[(0,d.jsx)("div",{className:"h-0.5 rounded-full bg-slate-800 mb-2 overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full",style:{width:`${100*e.salience}%`,backgroundColor:r}})}),i&&(0,d.jsx)("input",{type:"checkbox",checked:a??!1,onChange:t=>{t.stopPropagation(),i(e.id,t.target.checked)},onClick:e=>e.stopPropagation(),className:"absolute top-3 right-3 w-4 h-4 accent-blue-500"}),(0,d.jsx)("h3",{className:"text-sm font-semibold text-white truncate pr-6",children:e.title}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,d.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:r+"22",color:r},children:e.category}),(0,d.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:n+"22",color:n},children:e.type.replace("_","-")})]}),(0,d.jsx)("p",{className:"text-[13px] text-slate-400 mt-1.5 line-clamp-3 leading-snug",children:e.content}),e.tags.length>0&&(0,d.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[e.tags.slice(0,3).map(e=>(0,d.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-400",children:e},e)),e.tags.length>3&&(0,d.jsxs)("span",{className:"text-[10px] text-slate-500",children:["+",e.tags.length-3," more"]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-2 text-[11px] text-slate-500",children:[(0,d.jsxs)("span",{children:["Created ",n4(e.createdAt)]}),(0,d.jsxs)("span",{children:["Accessed ",n4(e.lastAccessed)]})]})]})}let n6=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function n8({memories:e,selectedMemory:t,onSelectMemory:s}){let[a,i]=(0,u.useState)("salience"),[r,n]=(0,u.useState)("grid"),[l,o]=(0,u.useState)(!1),[c,h]=(0,u.useState)(new Set),[m,x]=(0,u.useState)(!1),p=(0,n5.useQueryClient)(),f=(0,u.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{switch(a){case"salience":return t.salience-e.salience;case"createdAt":return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime();case"lastAccessed":return new Date(t.lastAccessed).getTime()-new Date(e.lastAccessed).getTime();case"decayedScore":return(t.decayedScore??t.salience)-(e.decayedScore??e.salience);default:return 0}}),t},[e,a]),g=(0,u.useCallback)((e,t)=>{h(s=>{let a=new Set(s);return t?a.add(e):a.delete(e),a})},[]),y=async()=>{if(0!==c.size){x(!0);try{await Promise.all(Array.from(c).map(e=>(0,rL.authFetch)(`${n6}/api/memories/${e}`,{method:"DELETE"}))),h(new Set),p.invalidateQueries({queryKey:["memories"]})}finally{x(!1)}}};return(0,d.jsxs)("div",{className:"flex flex-col h-full",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-slate-800 shrink-0",children:[(0,d.jsxs)("span",{className:"text-xs text-slate-400",children:[e.length," memories"]}),(0,d.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,d.jsxs)("select",{value:a,onChange:e=>i(e.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded px-2 py-1",children:[(0,d.jsx)("option",{value:"salience",children:"Salience"}),(0,d.jsx)("option",{value:"createdAt",children:"Created"}),(0,d.jsx)("option",{value:"lastAccessed",children:"Last Accessed"}),(0,d.jsx)("option",{value:"decayedScore",children:"Decay Score"})]}),(0,d.jsxs)("div",{className:"flex items-center border border-slate-700 rounded overflow-hidden",children:[(0,d.jsx)("button",{onClick:()=>n("grid"),className:`px-2 py-1 text-xs ${"grid"===r?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,d.jsx)("button",{onClick:()=>n("list"),className:`px-2 py-1 text-xs ${"list"===r?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"List"})]}),(0,d.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,d.jsx)("button",{onClick:()=>{o(!l),h(new Set)},className:`px-2 py-1 text-xs rounded ${l?"bg-blue-600 text-white":"bg-slate-800 text-slate-400 hover:text-white"}`,children:"Select"}),l&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{onClick:()=>h(new Set(f.map(e=>e.id))),className:"px-2 py-1 text-xs text-slate-400 hover:text-white",children:"Select all"}),(0,d.jsx)("button",{onClick:y,disabled:0===c.size||m,className:"px-2 py-1 text-xs rounded bg-red-600/20 text-red-400 hover:bg-red-600/40 disabled:opacity-40",children:m?"Deleting...":`Delete (${c.size})`})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,d.jsx)("div",{className:"grid"===r?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3":"flex flex-col gap-3 max-w-2xl",children:f.map(e=>(0,d.jsx)(n3,{memory:e,isSelected:t?.id===e.id,onSelect:s,isChecked:l?c.has(e.id):void 0,onCheck:l?g:void 0},e.id))})})]})}var n7=e.i(87353),n9=e.i(71921);let le=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function lt(){let e=await (0,rL.authFetch)(`${le}/api/license/status`);if(!e.ok)throw Error("Failed to fetch license status");return e.json()}async function ls(e){let t=await (0,rL.authFetch)(`${le}/api/license/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})});if(!t.ok)throw Error((await t.json().catch(()=>({error:"Activation failed"}))).error||"Activation failed");return t.json()}async function la(){let e=await (0,rL.authFetch)(`${le}/api/license/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate license");return e.json()}function li(){return(0,rD.useQuery)({queryKey:["license-status"],queryFn:lt,refetchInterval:6e4,retry:2})}let lr=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function ln({data:e,color:t="#22d3ee",width:s=24,height:a=10}){if(!e||0===e.length)return null;if(1===e.length)return(0,d.jsx)("svg",{width:s,height:a,viewBox:`0 0 ${s} ${a}`,children:(0,d.jsx)("circle",{cx:s/2,cy:a/2,r:1,fill:t,opacity:.6})});let i=Math.max(...e,1),r=s-2,n=a-2,l=e.map((t,s)=>{let a=1+s/(e.length-1)*r;return`${a.toFixed(1)},${(1+n-t/i*n).toFixed(1)}`}).join(" ");return(0,d.jsx)("svg",{width:s,height:a,viewBox:`0 0 ${s} ${a}`,className:"shrink-0",children:(0,d.jsx)("polyline",{points:l,fill:"none",stroke:t,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",opacity:.6})})}let ll=(0,nG.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"}]]),lo=(0,nG.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),lc=(0,nG.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),ld=(0,nG.default)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),lu=(0,nG.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),lh=(0,nG.default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),lm=(0,nG.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),lx=(0,nG.default)("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),lp=(0,nG.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),lf=[{id:"shield",label:"Shield",icon:ll},{id:"audit",label:"Audit",icon:lo},{id:"quarantine",label:"Queue",icon:lc},{id:"agents",label:"Agents",icon:lm},{id:"skills",label:"Skills",icon:lx},{id:"dome",label:"Dome",icon:lp},{id:"memories",label:"Memories",icon:ld},{id:"timeline",label:"Timeline",icon:(0,nG.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},{id:"brain",label:"Brain",icon:lu},{id:"graph",label:"Graph",icon:lh}],lg=new Set(["shield","audit","skills","dome"]);function ly(){let{viewMode:e,setViewMode:t}=(0,rM.useDashboardStore)(),{data:s}=(0,rA.useStats)(),{data:a}=(0,n7.useAuditStats)("24h"),{data:i}=(0,rA.useVersion)(),{data:r}=li(),{memoryTrend:n,threatTrend:l}=function(){let{data:e}=(0,rD.useQuery)({queryKey:["activity-trend"],queryFn:async()=>{let e=await (0,rL.authFetch)(`${lr}/api/memories/activity`);if(!e.ok)throw Error("Failed to fetch activity");return e.json()},staleTime:3e5,refetchInterval:3e5}),t=new Date;t.setDate(t.getDate()-7);let s=t.toISOString(),{data:a}=(0,rD.useQuery)({queryKey:["threat-trend"],queryFn:async()=>{let e=new URLSearchParams({firewallResult:"BLOCK",startTime:s,limit:"500"}),t=await (0,rL.authFetch)(`${lr}/api/v1/audit?${e}`);if(!t.ok)throw Error("Failed to fetch audit logs");return t.json()},staleTime:3e5,refetchInterval:3e5}),i=[];for(let e=6;e>=0;e--){let t=new Date;t.setDate(t.getDate()-e),i.push(t.toISOString().slice(0,10))}let r=new Map;if(e?.activity)for(let t of e.activity)r.set(t.date,t.count);let n=i.map(e=>r.get(e)??0),l=new Map;if(a?.logs)for(let e of a.logs){let t=e.timestamp.slice(0,10);l.set(t,(l.get(t)??0)+1)}return{memoryTrend:n,threatTrend:i.map(e=>l.get(e)??0)}}(),o=!r||"free"===r.tier,c=s?.decayDistribution?Math.round(s.decayDistribution.healthy/Math.max(1,s.total)*100):null,u=a?.blockedCount??0;return(0,d.jsxs)("nav",{className:"w-14 border-r border-slate-800 bg-slate-900/50 flex flex-col items-center py-3 shrink-0",children:[(0,d.jsx)("div",{className:"flex-1 flex flex-col items-center gap-1",children:lf.map(({id:s,label:a,icon:i})=>{let r="memories"===s?n:"shield"===s?l:null,c="shield"===s?"#f87171":"#22d3ee",h=r&&r.some(e=>e>0);return(0,d.jsxs)("button",{onClick:()=>t(s),className:`relative w-10 rounded-lg flex flex-col items-center justify-center gap-0.5 transition-colors ${h?"h-12":"h-10"} ${e===s?"dome"===s?"bg-red-600/20 text-red-400":"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,title:a,children:[(0,d.jsx)(i,{size:18}),h&&(0,d.jsx)(ln,{data:r,color:c,width:24,height:10}),(0,d.jsx)("span",{className:"text-[9px] leading-none",children:a}),"shield"===s&&u>0&&(0,d.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] rounded-full bg-red-500 text-white text-[8px] flex items-center justify-center px-0.5",children:u>99?"99+":u}),o&&lg.has(s)&&(0,d.jsx)("span",{className:"absolute -bottom-0.5 -left-0.5 px-1 h-[12px] rounded-full bg-cyan-600/80 text-white text-[7px] font-bold flex items-center justify-center leading-none",children:"PRO"})]},s)})}),(0,d.jsxs)("div",{className:"flex flex-col items-center gap-1 text-[10px] text-slate-500",children:[s&&(0,d.jsx)("span",{children:s.total}),null!==c&&(0,d.jsxs)("span",{children:[c,"%"]}),i?.version&&(0,d.jsxs)("span",{children:["v",i.version]})]})]})}let lv=(0,nG.default)("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]),lb=(0,nG.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),lj=(0,nG.default)("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),lw=(0,nG.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),lN=[{key:"trust",label:"Trust",icon:ll,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:lv,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:lb,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:lj,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:lo,color:"text-green-400",bg:"bg-green-400/10"}],lk={strict:{color:"text-red-400",bg:"bg-red-400/10"},balanced:{color:"text-cyan-400",bg:"bg-cyan-400/10"},permissive:{color:"text-green-400",bg:"bg-green-400/10"}};function lS({timeRange:e}){let{projectFilter:t}=(0,rM.useDashboardStore)(),{data:s,isLoading:a,isError:i}=(0,n7.useAuditStats)(e,t||void 0),{data:r}=(0,n7.useDefenceConfig)(),n=(0,n7.useSetDefenceMode)(),[l,o]=(0,u.useState)(!1),c=(0,u.useRef)(null),h=r?.mode??"balanced",m=lk[h];return(0,u.useEffect)(()=>{function e(e){c.current&&!c.current.contains(e.target)&&o(!1)}return l&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l]),(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[r?.tampered&&(0,d.jsxs)("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-3 py-2 mb-3",children:[(0,d.jsx)(lc,{size:14,className:"text-red-400 shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-red-400",children:"Config integrity check failed — running in strict mode"})]}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Defence Pipeline"}),(0,d.jsx)("div",{className:"flex items-center gap-1 mb-4",children:lN.map(({key:e,label:t,icon:s,color:a,bg:i},r)=>(0,d.jsxs)("div",{className:"flex items-center",children:[(0,d.jsxs)("div",{className:`flex items-center gap-1.5 px-3 py-2 rounded-lg ${i}`,children:[(0,d.jsx)(s,{size:14,className:a}),(0,d.jsx)("span",{className:`text-xs font-medium ${a}`,children:t})]}),r<lN.length-1&&(0,d.jsx)("div",{className:"w-4 h-px bg-slate-700 mx-0.5"})]},e))}),a?(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading stats..."}):i?(0,d.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"}):s?(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,d.jsxs)("div",{className:"text-center",children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-green-400",children:s.allowedCount}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Allowed"})]}),(0,d.jsxs)("div",{className:"text-center",children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-red-400",children:s.blockedCount}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocked"})]}),(0,d.jsxs)("div",{className:"text-center",children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-yellow-400",children:s.quarantinedCount}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Quarantined"})]})]}):(0,d.jsx)("div",{className:"text-xs text-slate-500",children:"No data"}),(0,d.jsx)("button",{onClick:()=>rM.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"}),(0,d.jsxs)("div",{className:"mt-2 pt-3 border-t border-slate-800 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-slate-500",children:"Firewall Mode"}),(0,d.jsxs)("div",{className:"relative",ref:c,children:[(0,d.jsxs)("button",{onClick:()=>o(!l),className:`text-xs font-medium ${m.color} ${m.bg} px-2 py-0.5 rounded flex items-center gap-1 hover:opacity-80 transition-opacity`,children:[h,(0,d.jsx)(lw,{size:10})]}),l&&(0,d.jsx)("div",{className:"absolute right-0 top-full mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl z-50 min-w-[120px] py-1",children:["strict","balanced","permissive"].map(e=>{let t=lk[e];return(0,d.jsxs)("button",{onClick:()=>{n.mutate(e),o(!1)},className:`w-full text-left px-3 py-1.5 text-xs hover:bg-slate-700/50 transition-colors flex items-center justify-between ${e===h?t.color+" font-medium":"text-slate-400"}`,children:[e,e===h&&(0,d.jsx)("span",{className:"text-[10px]",children:"✓"})]},e)})})]})]})]})}function lC(){let{setViewMode:e,projectFilter:t}=(0,rM.useDashboardStore)(),{data:s,isLoading:a,isError:i}=(0,n7.useQuarantine)("pending",3,t||void 0),r=s?.total??0,n=s?.items??[];return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Quarantine Queue"}),r>0&&(0,d.jsxs)("span",{className:"text-xs font-medium text-yellow-400 bg-yellow-400/10 px-2 py-0.5 rounded-full",children:[r," pending"]})]}),a?(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):i?(0,d.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load quarantine"}):0===n.length?(0,d.jsxs)("div",{className:"flex flex-col items-center py-6 text-slate-500",children:[(0,d.jsx)(lc,{size:24,className:"mb-2 text-slate-600"}),(0,d.jsx)("span",{className:"text-xs",children:"No items in quarantine"})]}):(0,d.jsx)("div",{className:"space-y-2",children:n.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,d.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-xs font-medium text-white truncate",children:e.title||"Untitled"}),(0,d.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleTimeString()]})]}),(0,d.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-1.5 py-0.5 rounded shrink-0 ml-2",children:e.reason?.slice(0,30)||"Threat detected"})]}),t.length>0&&(0,d.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:t.slice(0,3).map((e,t)=>(0,d.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1 py-0.5 rounded",children:e},t))})]},e.id)})}),r>0&&(0,d.jsxs)("button",{onClick:()=>e("quarantine"),className:"w-full mt-3 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["Review all ",r," items →"]})]})}function lT({timeRange:e}){let{projectFilter:t}=(0,rM.useDashboardStore)(),s={"24h":24,"7d":168,"30d":720},[a,i]=(0,u.useState)(()=>Date.now());(0,u.useEffect)(()=>{i(Date.now())},[e]);let r=(0,u.useMemo)(()=>new Date(6e4*Math.floor((a-36e5*s[e])/6e4)).toISOString(),[a,e]),{data:n,isLoading:l,isError:o}=(0,n7.useAuditLogs)({startTime:r,project:t||void 0,limit:500}),c=(0,u.useMemo)(()=>{if(!n?.logs.length)return[];let t="24h"===e?36e5:"7d"===e?216e5:864e5,s="24h"===e?24:"7d"===e?28:30,i=Array.from({length:s},(e,i)=>({time:a-(s-1-i)*t,allowed:0,blocked:0,quarantined:0}));for(let e of n.logs){let r=Math.floor((new Date(e.timestamp).getTime()-(a-s*t))/t),n=Math.min(Math.max(r,0),s-1);r>=0&&r<=s&&("ALLOW"===e.firewall_result?i[n].allowed++:"BLOCK"===e.firewall_result?i[n].blocked++:"QUARANTINE"===e.firewall_result&&i[n].quarantined++)}return i},[n,e,a]),h=Math.max(1,...c.map(e=>e.allowed+e.blocked+e.quarantined));return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Threat Timeline"}),l?(0,d.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading timeline..."})}):o?(0,d.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,d.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load timeline"})}):0===c.length?(0,d.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,d.jsx)("div",{className:"text-xs text-slate-500",children:"No audit data"})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex gap-px h-32",children:c.map((e,t)=>{let s=e.allowed+e.blocked+e.quarantined,a=s>0?e.blocked/s*100:0,i=s>0?e.quarantined/s*100:0;return(0,d.jsx)("div",{className:"flex-1 flex flex-col justify-end",title:`${new Date(e.time).toLocaleString()}: ${e.allowed} allowed, ${e.blocked} blocked, ${e.quarantined} quarantined`,children:(0,d.jsx)("div",{className:"w-full rounded-t-sm overflow-hidden",style:{height:`${Math.max(s/h*100,2*(s>0))}%`},children:(0,d.jsxs)("div",{className:"w-full h-full flex flex-col-reverse",children:[e.blocked>0&&(0,d.jsx)("div",{className:"bg-red-500",style:{height:`${a}%`}}),e.quarantined>0&&(0,d.jsx)("div",{className:"bg-yellow-500",style:{height:`${i}%`}}),(0,d.jsx)("div",{className:"bg-emerald-500/60 flex-1"})]})})},t)})}),(0,d.jsxs)("div",{className:"flex gap-4 mt-3 justify-center",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("div",{className:"w-2 h-2 rounded-full bg-emerald-500/60"}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:"Allowed"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500"}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("div",{className:"w-2 h-2 rounded-full bg-yellow-500"}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:"Quarantined"})]})]}),(0,d.jsx)("button",{onClick:()=>rM.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View detailed audit log →"})]})]})}function lP({timeRange:e}){let{projectFilter:t}=(0,rM.useDashboardStore)(),{data:s,isLoading:a,isError:i}=(0,n7.useAuditStats)(e,t||void 0);if(a)return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(i)return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,d.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"})]});if(!s)return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,d.jsx)("div",{className:"text-xs text-slate-500",children:"No data"})]});let r=s.totalOperations||1,n=(s.blockedCount/r*100).toFixed(1),l=Object.entries(s.threatBreakdown||{}).sort((e,t)=>t[1]-e[1]).slice(0,5);return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[(0,d.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-white",children:s.totalOperations}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Total Scans"})]}),(0,d.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,d.jsxs)("div",{className:`text-2xl font-bold ${parseFloat(n)>10?"text-red-400":"text-green-400"}`,children:[n,"%"]}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Block Rate"})]})]}),s.topSources.length>0&&(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Top Sources"}),(0,d.jsx)("div",{className:"space-y-1",children:s.topSources.slice(0,3).map(e=>(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:e.source}),(0,d.jsx)("span",{className:"text-xs text-slate-500",children:e.count})]},e.source))})]}),l.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Threat Types"}),(0,d.jsx)("div",{className:"space-y-1",children:l.map(([e,t])=>(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:e}),(0,d.jsx)("span",{className:"text-xs font-medium text-red-400",children:t})]},e))})]}),(0,d.jsx)("button",{onClick:()=>rM.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"})]})}let lA=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function lM(e){return e>70?"#22c55e":e>=40?"#eab308":"#ef4444"}function lE({score:e,size:t=120,strokeWidth:s=8}){let a=(t-s)/2,i=2*Math.PI*a,r=i-e/100*i,n=lM(e);return(0,d.jsxs)("svg",{width:t,height:t,className:"transform -rotate-90",children:[(0,d.jsx)("circle",{cx:t/2,cy:t/2,r:a,fill:"none",stroke:"rgba(255,255,255,0.06)",strokeWidth:s}),(0,d.jsx)("circle",{cx:t/2,cy:t/2,r:a,fill:"none",stroke:n,strokeWidth:s,strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:r,style:{transition:"stroke-dashoffset 0.6s ease"}})]})}function lD({component:e}){var t,s;return(0,d.jsxs)("div",{className:"group relative",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:e.label}),(0,d.jsx)("span",{className:"text-xs font-medium text-slate-300",children:e.score})]}),(0,d.jsx)("div",{className:`h-1.5 rounded-full ${(t=e.score)>70?"bg-green-500/20":t>=40?"bg-yellow-500/20":"bg-red-500/20"}`,children:(0,d.jsx)("div",{className:`h-full rounded-full ${(s=e.score)>70?"bg-green-500":s>=40?"bg-yellow-500":"bg-red-500"}`,style:{width:`${e.score}%`,transition:"width 0.6s ease"}})}),(0,d.jsx)("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 rounded bg-slate-800 text-[10px] text-slate-300 whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity z-10 border border-white/10",children:e.detail})]})}function lL(){let[e,t]=(0,u.useState)(null),[s,a]=(0,u.useState)(!0),[i,r]=(0,u.useState)(!1),n=(0,u.useCallback)(async()=>{try{let e=await (0,rL.authFetch)(`${lA}/api/health-score`);if(!e.ok)throw Error("Failed to fetch health score");let s=await e.json();t(s),r(!1)}catch{r(!0)}finally{a(!1)}},[]);if((0,u.useEffect)(()=>{n();let e=setInterval(n,6e4);return()=>clearInterval(e)},[n]),s)return(0,d.jsxs)("div",{className:"bg-[#12121a] border border-white/10 rounded-xl p-5 w-[300px]",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Memory Health"}),(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(i||!e)return(0,d.jsxs)("div",{className:"bg-[#12121a] border border-white/10 rounded-xl p-5 w-[300px]",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Memory Health"}),(0,d.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load health score"})]});let{overall:l,components:o}=e;return(0,d.jsxs)("div",{className:"bg-[#12121a] border border-white/10 rounded-xl p-5 w-[300px]",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Memory Health"}),(0,d.jsx)("div",{className:"flex justify-center mb-5",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(lE,{score:l}),(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,d.jsx)("span",{className:"text-3xl font-bold",style:{color:lM(l)},children:l})})]})}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(lD,{component:o.freshness}),(0,d.jsx)(lD,{component:o.coverage}),(0,d.jsx)(lD,{component:o.consistency}),(0,d.jsx)(lD,{component:o.consolidation})]})]})}let lF=(0,nG.default)("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),lR=(0,nG.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),l$=(0,nG.default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),lz=(0,nG.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var l_=e.i(17278);let lV=(0,nG.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function lI(){let{projectFilter:e}=(0,rM.useDashboardStore)(),{data:t}=(0,n7.useAuditStats)("30d",e||void 0),{data:s}=li(),[a,i]=(0,u.useState)("upsell"),[r,n]=(0,u.useState)(""),[l,o]=(0,u.useState)(null),[c,h]=(0,u.useState)(""),[m,x]=(0,u.useState)(!1);(0,u.useEffect)(()=>{let e=localStorage.getItem("shieldcortex_cloud_dismissed");if(e){let t=new Date(e);(Date.now()-t.getTime())/864e5<30&&i("hidden")}},[]),(0,u.useEffect)(()=>{(0,rL.authFetch)("http://localhost:3001/api/cloud/config").then(e=>e.json()).then(e=>{e.enabled&&e.apiKeySet&&i("hidden")}).catch(()=>{})},[]),(0,u.useEffect)(()=>{if("polling"!==a||!l)return;let e=setInterval(async()=>{try{let t=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${l}`),s=await t.json();"complete"===s.status&&s.api_key?(await (0,rL.authFetch)("http://localhost:3001/api/cloud/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cloudApiKey:s.api_key,cloudEnabled:!0,cloudBaseUrl:"https://api.shieldcortex.ai"})}),i("success"),clearInterval(e),setTimeout(()=>i("hidden"),5e3)):"expired"===s.status&&(h("Setup expired. Please try again."),i("upsell"),clearInterval(e))}catch{}},3e3);return()=>clearInterval(e)},[a,l]);let p=async e=>{if(e.preventDefault(),r&&!m){h(""),x(!0);try{let e=await fetch("https://api.shieldcortex.ai/v1/auth/cloud-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})}),t=await e.json();t.setup_id?(o(t.setup_id),i("polling")):h(t.error||"Failed to start setup")}catch{h("Could not reach ShieldCortex Cloud. Check your connection.")}finally{x(!1)}}},f=()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),i("hidden")};if("hidden"===a)return null;let g=t?.blockedCount??0,y=t?.totalOperations??0,v=s?.tier??"free";return"team"!==v&&"enterprise"!==v&&"upsell"===a?(0,d.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-violet-950/20 border border-violet-800/30 rounded-xl p-5 relative",children:[(0,d.jsx)("button",{onClick:f,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,d.jsx)(l_.X,{size:16})}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(lF,{size:20,className:"text-violet-400"}),(0,d.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Cloud Sync"}),(0,d.jsx)("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded text-violet-400 bg-violet-400/10",children:"Team"})]}),(0,d.jsx)("p",{className:"text-sm text-slate-300",children:g>0?`You've blocked ${g} threats locally. Upgrade to Team to sync across devices and give your team visibility.`:"Sync defence data across devices, share audit logs with your team, and get centralised alerts."}),(0,d.jsxs)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-4 py-2 bg-violet-600 hover:bg-violet-500 rounded-lg text-sm font-medium text-white transition-colors",children:["Upgrade to Team",(0,d.jsx)(lV,{size:12})]})]})]}):(0,d.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-800/30 rounded-xl p-5 relative",children:["upsell"===a&&(0,d.jsx)("button",{onClick:f,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,d.jsx)(l_.X,{size:16})}),"upsell"===a&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(lF,{size:20,className:"text-cyan-400"}),(0,d.jsx)("h3",{className:"text-sm font-semibold text-white",children:"ShieldCortex Cloud"})]}),(0,d.jsx)("p",{className:"text-sm text-slate-300",children:g>0?`You've blocked ${g} threats across ${y} scans — your team can't see them yet.`:"Sync your defence data to the cloud for team visibility, audit logs, and alerts."}),(0,d.jsxs)("form",{onSubmit:p,className:"flex gap-2",children:[(0,d.jsx)("input",{type:"email",placeholder:"Enter your email",value:r,onChange:e=>n(e.target.value),required:!0,className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:outline-none focus:ring-1 focus:ring-cyan-500 focus:border-cyan-500"}),(0,d.jsxs)("button",{type:"submit",disabled:m,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[m?(0,d.jsx)(l$,{size:14,className:"animate-spin"}):(0,d.jsx)(lR,{size:14}),"Get Started"]})]}),c&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:c}),(0,d.jsx)("p",{className:"text-[10px] text-slate-500",children:"Your Team licence includes cloud sync. Enter your email to connect."})]}),"polling"===a&&(0,d.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,d.jsx)(l$,{size:20,className:"text-cyan-400 animate-spin"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm text-white font-medium",children:"Check your email"}),(0,d.jsx)("p",{className:"text-xs text-slate-400",children:"Click the link in your inbox to complete setup. We'll auto-configure everything."})]})]}),"success"===a&&(0,d.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,d.jsx)(lz,{size:20,className:"text-emerald-400"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm text-white font-medium",children:"Connected to ShieldCortex Cloud"}),(0,d.jsx)("p",{className:"text-xs text-slate-400",children:"Your defence data will now sync automatically."})]})]})]})}function lO(){let e,t,{data:s,isLoading:a}=(0,rD.useQuery)({queryKey:["cloud-sync-status"],queryFn:async()=>{let e=await (0,rL.authFetch)("http://localhost:3001/api/cloud/sync-status");if(!e.ok)throw Error("Failed to fetch sync status");return e.json()},refetchInterval:1e4});if(a||!s)return null;let{enabled:i,apiKeySet:r,lastSyncAt:n,queue:l}=s;i&&r?l.failed>0?(e="bg-red-500",t=`${l.failed} event${1===l.failed?"":"s"} failed`):l.pending>0?(e="bg-amber-500",t=`${l.pending} event${1===l.pending?"":"s"} pending`):n?(e="bg-emerald-500",t="Cloud sync: OK"):(e="bg-emerald-500",t="Cloud sync: connected"):(e="bg-slate-500",t="Cloud sync: disabled");let o=n?function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let s=Math.floor(t/60);if(s<60)return`${s}m ago`;let a=Math.floor(s/60);if(a<24)return`${a}h ago`;let i=Math.floor(a/24);return`${i}d ago`}(n):null;return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-4 bg-slate-800 rounded-lg text-xs w-fit",children:[(0,d.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${e}`}),(0,d.jsx)("span",{className:"text-slate-300",children:t}),o&&(0,d.jsxs)("span",{className:"text-slate-500",children:["last sync ",o]})]})}let lB=(0,nG.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),lU=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function lq(e){let t=await (0,rL.authFetch)(`${lU}/api/skills/scan-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:e})});if(!t.ok)throw Error("Failed to scan skills");return t.json()}async function lK(e){let t=await (0,rL.authFetch)(`${lU}/api/skills/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to scan skill content");return t.json()}function lW(){return(0,n9.useMutation)({mutationFn:e=>lq(e)})}async function lQ(e){let t=await (0,rL.authFetch)(`${lU}/api/skills/trust`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to trust skill");return t.json()}async function lH(e){let t=await (0,rL.authFetch)(`${lU}/api/skills/trust`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to untrust skill");return t.json()}async function lX(e){let t=await (0,rL.authFetch)(`${lU}/api/skills/file`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to delete skill file");return t.json()}function lY(){let e=lW(),{setViewMode:t}=(0,rM.useDashboardStore)(),[s,a]=(0,u.useState)(null),i=s?s.files.filter(e=>e.safe).length:0,r=s?.threatCount??0;return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Skill Scanner"}),(0,d.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>a(e)})},disabled:e.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[e.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):(0,d.jsx)(lx,{size:12}),"Scan All"]})]}),s?(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(lz,{size:14,className:"text-green-400"}),(0,d.jsx)("span",{className:"text-sm font-medium text-green-400",children:i}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:"safe"})]}),r>0&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(lB,{size:14,className:"text-red-400"}),(0,d.jsx)("span",{className:"text-sm font-medium text-red-400",children:r}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:"threats"})]}),(0,d.jsx)("span",{className:"text-[10px] text-slate-600",children:new Date(s.scannedAt).toLocaleTimeString()})]}),(0,d.jsxs)("button",{onClick:()=>t("skills"),className:"flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["View all results",(0,d.jsx)(lR,{size:12})]})]}):e.isPending?(0,d.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,d.jsx)(l$,{size:16,className:"text-cyan-400 animate-spin"})}):(0,d.jsxs)("div",{className:"text-center py-3",children:[(0,d.jsx)(lx,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,d.jsx)("p",{className:"text-[10px] text-slate-500",children:"Scan agent instruction files for threats"})]})]})}let lG=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function lJ(){let e=await (0,rL.authFetch)(`${lG}/api/iron-dome/status`);if(!e.ok)throw Error("Failed to fetch Iron Dome status");return e.json()}async function lZ(e){let t=await (0,rL.authFetch)(`${lG}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e})});if(!t.ok)throw Error("Failed to activate Iron Dome");return t.json()}async function l0(){let e=await (0,rL.authFetch)(`${lG}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate Iron Dome");return e.json()}async function l1(e){let t=await (0,rL.authFetch)(`${lG}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok)throw Error("Failed to scan text");return t.json()}async function l2(){let e=await (0,rL.authFetch)(`${lG}/api/iron-dome/emergency-stop`,{method:"POST"});if(!e.ok)throw Error("Failed to trigger emergency stop");return e.json()}async function l5(e){let t=await (0,rL.authFetch)(`${lG}/api/iron-dome/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e||"Resumed via dashboard"})});if(!t.ok)throw Error("Failed to resume operations");return t.json()}async function l4(){let e=await (0,rL.authFetch)(`${lG}/api/control/status`);if(!e.ok)throw Error("Failed to fetch control status");return e.json()}async function l3(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let s=await (0,rL.authFetch)(`${lG}/api/iron-dome/audit?${t}`);if(!s.ok)throw Error("Failed to fetch Iron Dome audit");return s.json()}function l6(){return(0,rD.useQuery)({queryKey:["iron-dome-status"],queryFn:lJ,refetchInterval:3e4,retry:2})}function l8(e){return(0,rD.useQuery)({queryKey:["iron-dome-audit",e],queryFn:()=>l3(e),refetchInterval:3e4,retry:2})}function l7(){let e=(0,n5.useQueryClient)();return(0,n9.useMutation)({mutationFn:l2,onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]}),e.invalidateQueries({queryKey:["control-status"]})}})}function l9(){let{data:e,isLoading:t}=l6(),{data:s}=l8(100),a=e?.enabled??!1,i=e?.profile??"custom",r=s?.logs??[],n=r.filter(e=>e.reason?.includes("[iron-dome:")&&"BLOCK"===e.firewall_result).length,l=r.length;return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Iron Dome"}),(0,d.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${a?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:a?"ACTIVE":"INACTIVE"})]}),t?(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-xs text-slate-500 mb-3",children:["Profile: ",(0,d.jsx)("span",{className:"text-red-400 font-medium",children:i})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,d.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,d.jsx)("div",{className:"text-lg font-bold text-red-400",children:n}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocks"})]}),(0,d.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,d.jsx)("div",{className:"text-lg font-bold text-slate-300",children:l}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Events"})]})]})]}):(0,d.jsxs)("div",{className:"text-center py-3",children:[(0,d.jsx)(ll,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,d.jsx)("p",{className:"text-[10px] text-slate-500",children:"Behaviour protection layer — not active"})]}),(0,d.jsx)("button",{onClick:()=>rM.useDashboardStore.getState().setViewMode("dome"),className:"w-full text-center text-xs text-red-400 hover:text-red-300 transition-colors py-1",children:"View Iron Dome →"})]})}let oe="http://localhost:3001";function ot(){return(0,rD.useQuery)({queryKey:["cloud-config"],queryFn:async()=>{let e=await (0,rL.authFetch)(`${oe}/api/cloud/config`);if(!e.ok)throw Error("Failed to fetch cloud config");return e.json()},refetchInterval:3e4})}function os(e,t,s){return Math.max(t,Math.min(s,e))}function oa({initialAutoMemory:e,initialDedupe:t,initialNoveltyThreshold:s,initialMaxRecent:a}){let i,r=(i=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:async e=>{let t=await (0,rL.authFetch)(`${oe}/api/cloud/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to update cloud config");return t.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["cloud-config"]})}})),[n,l]=(0,u.useState)(e),[o,c]=(0,u.useState)(t),[h,m]=(0,u.useState)(String(s)),[x,p]=(0,u.useState)(String(a)),f=r.isPending;return(0,d.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:"Auto-memory extraction"}),(0,d.jsx)("button",{type:"button",onClick:()=>l(!n),className:`h-6 w-11 rounded-full transition-colors ${n?"bg-cyan-500":"bg-slate-700"}`,children:(0,d.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${n?"translate-x-5":"translate-x-0.5"}`})})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:"Novelty dedupe"}),(0,d.jsx)("button",{type:"button",onClick:()=>c(!o),disabled:!n,className:`h-6 w-11 rounded-full transition-colors ${o&&n?"bg-emerald-500":"bg-slate-700"} ${!n?"opacity-50 cursor-not-allowed":""}`,children:(0,d.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${o&&n?"translate-x-5":"translate-x-0.5"}`})})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Novelty threshold"}),(0,d.jsx)(nH,{type:"number",step:"0.01",min:.6,max:.99,value:h,disabled:!n||!o,onChange:e=>m(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Max recent records"}),(0,d.jsx)(nH,{type:"number",step:"1",min:50,max:1e3,value:x,disabled:!n||!o,onChange:e=>p(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,d.jsx)("span",{className:"text-[11px] text-slate-500",children:"Default: dedupe on, threshold 0.88, max 300"}),(0,d.jsxs)(nQ,{size:"sm",onClick:()=>{let e=os(Number.parseFloat(h),.6,.99),t=Math.floor(os(Number.parseInt(x,10),50,1e3));r.mutate({openclawAutoMemory:n,openclawAutoMemoryDedupe:o,openclawAutoMemoryNoveltyThreshold:Number.isFinite(e)?e:.88,openclawAutoMemoryMaxRecent:Number.isFinite(t)?t:300})},disabled:f,className:"h-8 text-xs bg-cyan-600 hover:bg-cyan-500 text-white",children:[f?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):null,"Save"]})]})]})}function oi(){let{data:e,isLoading:t}=ot(),s=e?.openclawMemory,a=s?`${s.autoMemory}-${s.dedupe}-${s.noveltyThreshold}-${s.maxRecent}`:"default";return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"OpenClaw Memory"}),(0,d.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Configure how ShieldCortex complements native OpenClaw memory."}),(0,d.jsx)("p",{className:"text-[11px] text-slate-600 mt-1",children:"Changes apply on next OpenClaw gateway restart."}),t?(0,d.jsx)("div",{className:"text-xs text-slate-500 mt-4 animate-pulse",children:"Loading settings..."}):(0,d.jsx)(oa,{initialAutoMemory:s?.autoMemory??!1,initialDedupe:s?.dedupe??!0,initialNoveltyThreshold:s?.noveltyThreshold??.88,initialMaxRecent:s?.maxRecent??300},a)]})}let or=(0,nG.default)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),on=(0,nG.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),ol=(0,nG.default)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),oo=(0,nG.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),oc="https://api.shieldcortex.ai",od=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",ou={free:"Free",pro:"Pro",team:"Team",enterprise:"Enterprise"},oh={free:"text-slate-400",pro:"text-cyan-400",team:"text-violet-400",enterprise:"text-amber-400"},om={free:"bg-slate-400/10",pro:"bg-cyan-400/10",team:"bg-violet-400/10",enterprise:"bg-amber-400/10"},ox={pro:{label:"Pro",price:"£29/mo"},team:{label:"Team",price:"£99/mo"}},op=["Custom injection patterns","Custom Iron Dome policies","Custom firewall rules","Audit export (JSON/CSV)","Skill scanner deep mode"];function of(){let e,t,{data:s,isLoading:a}=li(),i=(e=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>ls(e),onSuccess:()=>{e.invalidateQueries({queryKey:["license-status"]})}})),r=(t=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:la,onSuccess:()=>{t.invalidateQueries({queryKey:["license-status"]})}})),n=function(){let e=(0,n5.useQueryClient)(),[t,s]=(0,u.useState)("idle"),[a,i]=(0,u.useState)(null),[r,n]=(0,u.useState)(null),l=(0,u.useCallback)(async(e,t)=>{s("submitting"),i(null);try{let a=await fetch(`${oc}/v1/billing/quick-checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,plan:t})}),i=await a.json();if(!a.ok||!i.checkout_url||!i.setup_id)throw Error(i.error||"Failed to create checkout session");n(i.setup_id),window.open(i.checkout_url,"_blank"),s("polling")}catch(e){i(e instanceof Error?e.message:"Checkout failed"),s("error")}},[]);return(0,u.useEffect)(()=>{if("polling"!==t||!r)return;let a=setInterval(async()=>{try{let t=await fetch(`${oc}/v1/billing/setup-status/${r}`),n=await t.json();if("complete"===n.status&&n.license_key){clearInterval(a),s("activating");try{if(!(await (0,rL.authFetch)(`${od}/api/license/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n.license_key})})).ok)throw Error("Local activation failed");e.invalidateQueries({queryKey:["license-status"]}),s("complete")}catch{i('Payment succeeded but local activation failed. Use "I Have a Key" to activate manually.'),s("error")}}else"expired"===n.status?(clearInterval(a),i("Setup expired. Please try again."),s("error")):"complete"!==n.status||n.license_key||(clearInterval(a),i("Licence key was already retrieved. Check your dashboard or try again."),s("error"))}catch{}},3e3),n=setTimeout(()=>{clearInterval(a),i('Checkout timed out. If you completed payment, use "I Have a Key" or contact support.'),s("error")},9e5);return()=>{clearInterval(a),clearTimeout(n)}},[t,r,e]),{state:t,error:a,startCheckout:l,reset:(0,u.useCallback)(()=>{s("idle"),i(null),n(null)},[])}}(),[l,o]=(0,u.useState)(""),[c,h]=(0,u.useState)("default"),[m,x]=(0,u.useState)(""),[p,f]=(0,u.useState)("pro"),[g,y]=(0,u.useState)(!1);if(a||!s)return(0,d.jsx)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-4",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(ll,{size:16,className:"text-slate-500"}),(0,d.jsx)("span",{className:"text-xs text-slate-500 animate-pulse",children:"Loading licence..."})]})});let v=s.tier;if("free"===v)return(0,d.jsxs)("div",{className:"relative overflow-hidden rounded-xl mb-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-700/30",children:[(0,d.jsx)("div",{className:"absolute top-0 right-0 w-32 h-32 bg-cyan-500/5 rounded-full blur-2xl -translate-y-1/2 translate-x-1/2"}),(0,d.jsxs)("div",{className:"relative p-5",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-cyan-500/10 border border-cyan-500/20",children:(0,d.jsx)(on,{size:16,className:"text-cyan-400"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Unlock Pro Features"}),(0,d.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Your defence pipeline is fully active. Upgrade for advanced controls."})]})]}),(0,d.jsx)("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full bg-slate-800 text-slate-400 border border-slate-700",children:"Free"})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5 mb-4",children:op.map(e=>(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs",children:[(0,d.jsx)(ol,{size:10,className:"text-cyan-500/60 shrink-0"}),(0,d.jsx)("span",{className:"text-slate-400",children:e})]},e))}),"complete"===n.state?(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-emerald-500/10 border border-emerald-500/20 rounded-lg",children:[(0,d.jsx)(lz,{size:16,className:"text-emerald-400 shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-emerald-300",children:"Pro activated! Your dashboard is refreshing..."})]}):"polling"===n.state||"activating"===n.state?(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-cyan-500/10 border border-cyan-500/20 rounded-lg",children:[(0,d.jsx)(l$,{size:14,className:"text-cyan-400 animate-spin shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-cyan-300",children:"activating"===n.state?"Activating licence...":"Complete payment in the Stripe tab..."})]}),(0,d.jsx)("button",{onClick:()=>{n.reset(),h("default")},className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Cancel"})]}):"checkout"===c?(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-[10px] text-slate-500 mb-1 block",children:"Email"}),(0,d.jsx)("input",{type:"email",placeholder:"you@company.com",value:m,onChange:e=>x(e.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:ring-1 focus:ring-cyan-500",autoFocus:!0})]}),(0,d.jsx)("div",{className:"flex gap-2",children:["pro","team"].map(e=>(0,d.jsxs)("button",{type:"button",onClick:()=>f(e),className:`flex-1 px-3 py-2 text-xs font-medium rounded-lg border transition-colors ${p===e?"bg-cyan-600/20 border-cyan-500/50 text-cyan-300":"bg-slate-800 border-slate-700 text-slate-400 hover:border-slate-600"}`,children:[ox[e].label," — ",ox[e].price]},e))}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:()=>n.startCheckout(m,p),disabled:"submitting"===n.state||!m.trim(),className:"flex-1 inline-flex items-center justify-center gap-1.5 px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 text-white rounded-lg transition-colors",children:"submitting"===n.state?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):"Continue to Checkout"}),(0,d.jsx)("button",{onClick:()=>{h("default"),n.reset()},className:"px-3 py-2 text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Back"})]}),n.error&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:n.error})]}):"activate"===c?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.trim()&&i.mutate(l.trim(),{onSuccess:()=>{o(""),h("default")}})},className:"flex gap-2",children:[(0,d.jsx)("input",{type:"text",placeholder:"sc_pro_...",value:l,onChange:e=>o(e.target.value),className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:ring-1 focus:ring-cyan-500",autoFocus:!0}),(0,d.jsx)("button",{type:"submit",disabled:i.isPending||!l.trim(),className:"px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 text-white rounded-lg transition-colors",children:i.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):"Activate"}),(0,d.jsx)("button",{type:"button",onClick:()=>{h("default"),o(""),i.reset()},className:"px-3 py-2 text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Back"})]}),i.isError&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:i.error instanceof Error?i.error.message:"Activation failed"})]}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("button",{onClick:()=>h("checkout"),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg transition-colors",children:"Upgrade to Pro"}),(0,d.jsxs)("button",{onClick:()=>h("activate"),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg transition-colors border border-slate-700",children:[(0,d.jsx)(or,{size:12}),"I Have a Key"]})]}),n.error&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-xs text-red-400",children:n.error}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:()=>{n.reset(),h("checkout")},className:"text-[10px] text-cyan-400 hover:text-cyan-300 transition-colors",children:"Try Again"}),(0,d.jsx)("span",{className:"text-[10px] text-slate-600",children:"·"}),(0,d.jsx)("button",{onClick:()=>{n.reset(),h("activate")},className:"text-[10px] text-slate-400 hover:text-slate-300 transition-colors",children:"I Have a Key"})]})]})]})]})]});let b=s.features.filter(e=>e.enabled).length,j=s.features.length;return(0,d.jsxs)("div",{className:"bg-slate-900 border border-cyan-800/40 rounded-xl p-4 mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(ll,{size:16,className:oh[v]}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Licence"}),(0,d.jsx)("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${oh[v]} ${om[v]}`,children:ou[v]})]}),(0,d.jsxs)("span",{className:"text-[10px] text-slate-500",children:[b,"/",j," features"]})]}),(0,d.jsxs)("div",{className:"space-y-2 mb-3",children:[s.email&&(0,d.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,d.jsx)("span",{className:"text-slate-500",children:"Email"}),(0,d.jsx)("span",{className:"text-slate-300",children:s.email})]}),null!==s.daysUntilExpiry&&(0,d.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,d.jsx)("span",{className:"text-slate-500",children:"Expires"}),(0,d.jsx)("span",{className:s.daysUntilExpiry<=7?"text-yellow-400":"text-slate-300",children:s.daysUntilExpiry<=0?"Expired (grace period)":`${s.daysUntilExpiry} days`})]})]}),(0,d.jsxs)("button",{onClick:()=>y(!g),className:"flex items-center gap-1 text-[10px] text-slate-500 hover:text-slate-300 transition-colors mb-2",children:[g?(0,d.jsx)(oo,{size:12}):(0,d.jsx)(lw,{size:12}),g?"Hide features":"Show features"]}),g&&(0,d.jsx)("div",{className:"space-y-1.5 mb-3",children:s.features.map(e=>(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[e.enabled?(0,d.jsx)(lz,{size:12,className:"text-emerald-400 shrink-0"}):(0,d.jsx)(lB,{size:12,className:"text-slate-600 shrink-0"}),(0,d.jsx)("span",{className:e.enabled?"text-slate-300":"text-slate-600",children:e.description.split(".")[0]}),!e.enabled&&(0,d.jsx)("span",{className:`text-[9px] px-1 py-0.5 rounded ${oh[e.requiredTier]} ${om[e.requiredTier]}`,children:ou[e.requiredTier]})]},e.feature))}),(0,d.jsx)("button",{onClick:()=>{confirm(`Remove your ${ou[v]} licence key? You will lose access to paid features.`)&&r.mutate()},disabled:r.isPending,className:"text-[10px] text-slate-600 hover:text-red-400 transition-colors",children:"Deactivate"})]})}let og=(0,nG.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),oy=(0,nG.default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),ov=(0,nG.default)("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),ob=(0,nG.default)("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]);function oj({feature:e,children:t,label:s}){let{data:a}=li();if(!a)return(0,d.jsx)(d.Fragment,{children:t});let i=a.features.find(t=>t.feature===e);if(!i||i.enabled)return(0,d.jsx)(d.Fragment,{children:t});let r=i.requiredTier;return(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"pointer-events-none select-none opacity-30 blur-[2px]",children:t}),(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-slate-900/60 rounded-xl backdrop-blur-sm",children:[(0,d.jsx)(ol,{size:24,className:"text-slate-500 mb-2"}),(0,d.jsxs)("p",{className:"text-sm font-medium text-slate-300 mb-1",children:[ou[r]," Feature"]}),s&&(0,d.jsx)("p",{className:"text-xs text-slate-500 mb-3 text-center max-w-xs",children:s}),(0,d.jsxs)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-4 py-2 text-xs bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg transition-colors",children:["Upgrade to ",ou[r],(0,d.jsx)(lV,{size:10})]})]})]})}let ow=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",oN=[{id:1,name:"Block API key patterns",priority:1,condition_type:"regex",condition_value:"sk-[a-zA-Z0-9]{32,}",action:"block",enabled:!0},{id:2,name:"Quarantine code injection",priority:2,condition_type:"regex",condition_value:"eval\\(|Function\\(",action:"quarantine",enabled:!0},{id:3,name:"Allow internal docs",priority:10,condition_type:"source",condition_value:"agent:docs-helper",action:"allow",enabled:!1}],ok=[{id:1,name:"Internal tool abuse",category:"tool_misuse",severity:"high",regex:"execute_tool\\(.*?delete|drop|truncate",description:"Detects attempts to use internal tools for destructive operations.",enabled:!0},{id:2,name:"PII exfiltration",category:"data_leak",severity:"critical",regex:"(SSN|social.security|\\d{3}-\\d{2}-\\d{4})",description:"Catches social security number patterns in agent memory writes.",enabled:!0},{id:3,name:"Prompt override attempt",category:"injection",severity:"medium",regex:"ignore.*(previous|above|prior).*instructions",description:"Detects common prompt injection override phrases.",enabled:!0}],oS=[{id:1,name:"Strict Healthcare",description:"Blocks all PII patterns, requires approval for external actions, whitelists only HIPAA-compliant channels.",is_active:!0},{id:2,name:"Dev Sandbox",description:"Permissive mode for development. Allows all channels, logs but does not block. Ideal for testing.",is_active:!1}],oC=[{files:["SKILL.md","handler.js"],finding:"Skill declares read-only but handler writes to filesystem",severity:"high"},{files:["SKILL.md","config.json"],finding:"Config enables network access not mentioned in skill manifest",severity:"medium"},{files:["handler.js","utils.js"],finding:"Dynamic eval() used in utility imported by main handler",severity:"critical"}],oT={"File access":45,"Network calls":30,"Process exec":15,"Memory write":10},oP=["Restrict filesystem writes to a sandboxed directory","Add explicit network permission declarations to SKILL.md"];function oA(){let e,t,s,a,{data:i,isLoading:r,isLocked:n}={...e=(0,rD.useQuery)({queryKey:["firewall-rules"],queryFn:()=>(0,rL.gatedFetch)(`${ow}/api/firewall-rules`).then(e=>{if(!e.ok)throw Error("Failed to fetch firewall rules");return e.json()}),retry:(e,t)=>!(t instanceof rL.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof rL.FeatureLockedError},l=(t=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${ow}/api/firewall-rules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["firewall-rules"]})}})),o=(s=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:({id:e,...t})=>(0,rL.gatedFetch)(`${ow}/api/firewall-rules/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["firewall-rules"]})}})),c=(a=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${ow}/api/firewall-rules/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["firewall-rules"]})}})),[h,m]=(0,u.useState)(!1),[x,p]=(0,u.useState)({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"}),f=i?.rules??[];return n?(0,d.jsx)(oM,{}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(ll,{size:16,className:"text-cyan-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Firewall Rules"}),(0,d.jsxs)("span",{className:"text-xs text-slate-500",children:[f.length,"/25"]})]}),(0,d.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1 px-2 py-1 text-xs bg-cyan-600/20 text-cyan-400 rounded hover:bg-cyan-600/30 transition-colors",children:[(0,d.jsx)(og,{size:12})," Add Rule"]})]}),h&&(0,d.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate(x,{onSuccess:()=>{m(!1),p({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsx)("input",{value:x.name,onChange:e=>p(t=>({...t,name:e.target.value})),placeholder:"Rule name",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,d.jsx)("input",{value:x.priority,onChange:e=>p(t=>({...t,priority:Number(e.target.value)})),type:"number",placeholder:"Priority",className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("select",{value:x.condition_type,onChange:e=>p(t=>({...t,condition_type:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,d.jsx)("option",{value:"regex",children:"Regex"}),(0,d.jsx)("option",{value:"source",children:"Source"}),(0,d.jsx)("option",{value:"keyword",children:"Keyword"})]}),(0,d.jsx)("input",{value:x.condition_value,onChange:e=>p(t=>({...t,condition_value:e.target.value})),placeholder:"Condition value",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,d.jsxs)("select",{value:x.action,onChange:e=>p(t=>({...t,action:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,d.jsx)("option",{value:"block",children:"Block"}),(0,d.jsx)("option",{value:"quarantine",children:"Quarantine"}),(0,d.jsx)("option",{value:"allow",children:"Allow"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"submit",disabled:l.isPending,className:"px-3 py-1 text-xs bg-cyan-600 text-white rounded hover:bg-cyan-500 disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,d.jsx)("button",{type:"button",onClick:()=>m(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),l.error&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:l.error.message})]}),r?(0,d.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading rules..."}):0===f.length?(0,d.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom rules yet. Click "Add Rule" to create one.'}):(0,d.jsx)("div",{className:"space-y-1",children:f.map(e=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,d.jsx)("span",{className:"text-slate-400 w-6 text-right",children:e.priority}),(0,d.jsx)("span",{className:"text-slate-200 flex-1",children:e.name}),(0,d.jsx)("code",{className:"text-slate-500 text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,d.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-red-500/20 text-red-400":"quarantine"===e.action?"bg-yellow-500/20 text-yellow-400":"bg-green-500/20 text-green-400"}`,children:e.action}),(0,d.jsx)("button",{onClick:()=>o.mutate({id:e.id,enabled:+!e.enabled}),className:"text-slate-500 hover:text-slate-300",title:e.enabled?"Disable":"Enable",children:e.enabled?(0,d.jsx)(ob,{size:14,className:"text-cyan-400"}):(0,d.jsx)(ov,{size:14})}),(0,d.jsx)("button",{onClick:()=>c.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,d.jsx)(oy,{size:12})})]},e.id))})]})}function oM(){return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(ll,{size:16,className:"text-cyan-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Firewall Rules"}),(0,d.jsx)("span",{className:"text-xs text-slate-500",children:"0/25"})]}),(0,d.jsx)("div",{className:"space-y-1",children:oN.map(e=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,d.jsx)("span",{className:"text-slate-400 w-6 text-right",children:e.priority}),(0,d.jsx)("span",{className:"text-slate-200 flex-1",children:e.name}),(0,d.jsx)("code",{className:"text-slate-500 text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,d.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-red-500/20 text-red-400":"quarantine"===e.action?"bg-yellow-500/20 text-yellow-400":"bg-green-500/20 text-green-400"}`,children:e.action})]},e.id))})]})}function oE(){return(0,d.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,d.jsx)(oj,{feature:"custom_firewall_rules",label:"Add custom rules to control what gets blocked, allowed, or quarantined.",children:(0,d.jsx)(oA,{})})})}function oD(){let[e,t]=(0,u.useState)("24h");return(0,d.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Defence Overview"}),(0,d.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(s=>(0,d.jsx)("button",{onClick:()=>t(s),className:`px-3 py-1 text-xs rounded-md transition-colors ${e===s?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:s},s))})]}),(0,d.jsx)(of,{}),(0,d.jsx)(lO,{}),(0,d.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,d.jsx)(lS,{timeRange:e}),(0,d.jsx)(lC,{}),(0,d.jsx)(lT,{timeRange:e}),(0,d.jsx)(lP,{timeRange:e})]}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(lL,{})}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(lY,{})}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(l9,{})}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(oi,{})}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(oE,{})}),(0,d.jsx)(lI,{})]})}let oL=(0,nG.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),oF=(0,nG.default)("file-braces",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),oR=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function o$(){let e=(0,n9.useMutation)({mutationFn:async({format:e,startTime:t,endTime:s})=>{let a=new URLSearchParams({format:e});t&&a.set("startTime",t),s&&a.set("endTime",s);let i=await (0,rL.gatedFetch)(`${oR}/api/audit/export?${a}`);if(!i.ok)throw Error((await i.json().catch(()=>({}))).error||"Export failed");let r=await i.blob(),n=URL.createObjectURL(r),l=document.createElement("a");return l.href=n,l.download=`shieldcortex-audit-${Date.now()}.${"csv"===e?"csv":"json"}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(n),{success:!0}}}),[t,s]=(0,u.useState)("json");return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(oL,{size:16,className:"text-cyan-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Export Audit Logs"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("div",{className:"flex rounded-lg overflow-hidden border border-slate-700",children:[(0,d.jsxs)("button",{onClick:()=>s("json"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"json"===t?"bg-cyan-600/20 text-cyan-400":"bg-slate-800 text-slate-400 hover:text-slate-200"}`,children:[(0,d.jsx)(oF,{size:12})," JSON"]}),(0,d.jsxs)("button",{onClick:()=>s("csv"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"csv"===t?"bg-cyan-600/20 text-cyan-400":"bg-slate-800 text-slate-400 hover:text-slate-200"}`,children:[(0,d.jsx)(lo,{size:12})," CSV"]})]}),(0,d.jsxs)("button",{onClick:()=>e.mutate({format:t}),disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-1.5 text-xs bg-cyan-600 text-white rounded-lg hover:bg-cyan-500 disabled:opacity-50 transition-colors",children:[(0,d.jsx)(oL,{size:12}),e.isPending?"Exporting...":"Export"]})]}),e.error&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:e.error.message}),e.isSuccess&&(0,d.jsx)("p",{className:"text-xs text-green-400",children:"Export downloaded successfully."})]})}function oz(){return(0,d.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,d.jsx)(oj,{feature:"audit_export",label:"Export your full audit trail as JSON or CSV for compliance reporting.",children:(0,d.jsx)(o$,{})})})}let o_={ALLOW:"bg-green-500/10 text-green-400",BLOCK:"bg-red-500/10 text-red-400",QUARANTINE:"bg-yellow-500/10 text-yellow-400"};function oV(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:s}=(0,rM.useDashboardStore)(),[a,i]=(0,u.useState)("24h"),[r,n]=(0,u.useState)(void 0),[l,o]=(0,u.useState)(void 0),c={"24h":24,"7d":168,"30d":720},[h,m]=(0,u.useState)(()=>Date.now());(0,u.useEffect)(()=>{m(Date.now())},[a]);let x=(0,u.useMemo)(()=>new Date(6e4*Math.floor((h-36e5*c[a])/6e4)).toISOString(),[h,a]),{data:p,isLoading:f}=(0,n7.useAuditLogs)({startTime:x,source:r,firewallResult:l,project:e||void 0,limit:200}),g=p?.logs??[],y=(0,u.useCallback)(e=>{if(!t||0===g.length)return;let a=g.findIndex(e=>e.id===t.id);"Escape"===e.key?s(null):"ArrowDown"===e.key&&a<g.length-1?(e.preventDefault(),s(g[a+1])):"ArrowUp"===e.key&&a>0&&(e.preventDefault(),s(g[a-1]))},[t,g,s]);return(0,u.useEffect)(()=>(window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)),[y]),(0,d.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Audit Log"}),(0,d.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(e=>(0,d.jsx)("button",{onClick:()=>i(e),className:`px-3 py-1 text-xs rounded-md transition-colors ${a===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsxs)("select",{value:l||"",onChange:e=>o(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,d.jsx)("option",{value:"",children:"All Results"}),(0,d.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,d.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,d.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,d.jsxs)("select",{value:r||"",onChange:e=>n(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,d.jsx)("option",{value:"",children:"All Sources"}),(0,d.jsx)("option",{value:"hook",children:"Hook"}),(0,d.jsx)("option",{value:"api",children:"API"}),(0,d.jsx)("option",{value:"agent",children:"Agent"}),(0,d.jsx)("option",{value:"user",children:"User"}),(0,d.jsx)("option",{value:"cli",children:"CLI"})]}),(0,d.jsxs)("span",{className:"text-xs text-slate-500 self-center ml-auto",children:[g.length," entries"]})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:f?(0,d.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading audit logs..."})}):0===g.length?(0,d.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,d.jsx)("div",{className:"text-xs text-slate-500",children:"No audit entries for this period"})}):(0,d.jsxs)("table",{className:"w-full text-xs",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-slate-900",children:(0,d.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,d.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Time"}),(0,d.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Source"}),(0,d.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Result"}),(0,d.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Trust"}),(0,d.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Anomaly"}),(0,d.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Reason"})]})}),(0,d.jsx)("tbody",{children:g.map(e=>(0,d.jsxs)("tr",{onClick:()=>{s(t?.id===e.id?null:e)},className:`border-b border-slate-800/50 cursor-pointer transition-colors ${t?.id===e.id?"bg-cyan-500/10 hover:bg-cyan-500/15":"hover:bg-slate-800/30"}`,children:[(0,d.jsx)("td",{className:"px-4 py-2 text-slate-400 whitespace-nowrap",children:new Date(e.timestamp).toLocaleString()}),(0,d.jsx)("td",{className:"px-4 py-2 text-slate-300",children:e.source_type}),(0,d.jsx)("td",{className:"px-4 py-2",children:(0,d.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${o_[e.firewall_result]||"text-slate-400"}`,children:e.firewall_result})}),(0,d.jsx)("td",{className:"px-4 py-2 text-slate-400",children:e.trust_score.toFixed(1)}),(0,d.jsx)("td",{className:"px-4 py-2",children:(0,d.jsx)("span",{className:e.anomaly_score>.5?"text-red-400":e.anomaly_score>.2?"text-yellow-400":"text-slate-400",children:e.anomaly_score.toFixed(2)})}),(0,d.jsx)("td",{className:"px-4 py-2 text-slate-400 max-w-xs truncate",children:e.reason||"—"})]},e.id))})]})}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(oz,{})})]})}let oI={ALLOW:{color:"#22C55E",bg:"rgba(34, 197, 94, 0.15)",label:"Allowed"},BLOCK:{color:"#EF4444",bg:"rgba(239, 68, 68, 0.15)",label:"Blocked"},QUARANTINE:{color:"#EAB308",bg:"rgba(234, 179, 8, 0.15)",label:"Quarantined"}},oO={PUBLIC:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"},INTERNAL:{color:"#60a5fa",bg:"rgba(96, 165, 250, 0.15)"},CONFIDENTIAL:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},RESTRICTED:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"}},oB={instruction_injection:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},privilege_escalation:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},credential_leak:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},encoding_obfuscation:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},fragmented_payload:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},external_url:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},pipeline_error:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"}};function oU(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function oq(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function oK({entry:e,onClose:t,onViewMemory:s}){let[a,i]=(0,u.useState)(!1),r=oI[e.firewall_result]||oI.ALLOW,n=oO[e.sensitivity_level]||oO.PUBLIC,l=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),o=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.blocked_patterns),c=(0,u.useCallback)(()=>{let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[e]);return(0,d.jsxs)(nF,{className:"bg-slate-900 border-slate-700 h-full overflow-auto",children:[(0,d.jsxs)(nR,{className:"border-b border-slate-700 pb-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:r.bg,color:r.color},children:r.label}),(0,d.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:n.bg,color:n.color},children:e.sensitivity_level})]}),(0,d.jsx)(nQ,{variant:"ghost",size:"sm",onClick:t,className:"text-slate-400 hover:text-white -mt-1",children:"✕"})]}),(0,d.jsx)("div",{className:"text-xs text-slate-400 mt-2",children:new Date(e.timestamp).toLocaleString()}),e.project&&(0,d.jsxs)("div",{className:"text-[10px] text-slate-500 mt-1",children:["Project: ",e.project]})]}),(0,d.jsxs)(nz,{className:"p-4 space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Source"}),(0,d.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,d.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-cyan-500/10 text-cyan-400",children:e.source_type})}),e.source_identifier&&(0,d.jsx)("div",{className:"text-xs text-slate-300 mt-1 font-mono break-all",children:e.source_identifier})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Scores"}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:"Trust"}),(0,d.jsxs)("div",{className:"text-lg font-bold",style:{color:oU(e.trust_score)},children:[(100*e.trust_score).toFixed(0),"%"]}),(0,d.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.trust_score}%`,backgroundColor:oU(e.trust_score)}})})]}),(0,d.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:"Anomaly"}),(0,d.jsxs)("div",{className:"text-lg font-bold",style:{color:oq(e.anomaly_score)},children:[(100*e.anomaly_score).toFixed(0),"%"]}),(0,d.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.anomaly_score}%`,backgroundColor:oq(e.anomaly_score)}})})]}),null!==e.fragmentation_score&&(0,d.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:"Fragmentation"}),(0,d.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[(100*e.fragmentation_score).toFixed(0),"%"]}),(0,d.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*e.fragmentation_score}%`}})})]}),null!==e.pipeline_duration_ms&&(0,d.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:"Pipeline"}),(0,d.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[e.pipeline_duration_ms,"ms"]})]})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Threat Indicators"}),l.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.map((e,t)=>{let s=oB[e]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,d.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:s.bg,color:s.color},children:e.replace(/_/g," ")},t)})}):(0,d.jsx)("div",{className:"text-xs text-slate-600",children:"No threats detected"})]}),o.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Blocked Patterns"}),(0,d.jsx)("div",{className:"bg-slate-800 rounded-lg p-3 max-h-32 overflow-y-auto",children:o.map((e,t)=>(0,d.jsx)("div",{className:"text-[11px] text-slate-300 font-mono break-all mb-1 last:mb-0",children:e},t))})]}),e.reason&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Reason"}),(0,d.jsx)("div",{className:"bg-slate-800 rounded-lg p-3",children:(0,d.jsx)("p",{className:"text-xs text-slate-300 whitespace-pre-wrap leading-relaxed",children:e.reason})})]}),(0,d.jsxs)("div",{className:"flex gap-2 pt-2",children:[e.memory_id&&s&&(0,d.jsx)(nQ,{variant:"default",size:"sm",onClick:()=>s(e.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,d.jsx)(nQ,{variant:"outline",size:"sm",onClick:c,className:`flex-1 border-slate-700 transition-all ${a?"bg-green-600/20 text-green-400 border-green-600/50":"text-slate-300 hover:text-white"}`,children:a?"Copied":"Copy JSON"})]})]})]})}function oW({action:e,item:t,onConfirm:s,onCancel:a}){let[i,r]=(0,u.useState)(""),n="yes"===i.trim().toLowerCase();return(0,d.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4",children:[(0,d.jsxs)("h3",{className:"text-sm font-semibold text-white mb-2",children:["approve"===e?"Approve":"Reject"," quarantined item?"]}),(0,d.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:(0,d.jsx)("strong",{children:t.title||"Untitled"})}),(0,d.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"approve"===e?"This will store the memory in the database.":"This will permanently discard the memory."}),(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsxs)("label",{className:"text-xs text-slate-400 block mb-1",children:["Type ",(0,d.jsx)("strong",{className:"text-white",children:"YES"})," to confirm:"]}),(0,d.jsx)("input",{type:"text",value:i,onChange:e=>r(e.target.value),className:"w-full bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&n&&s(),"Escape"===e.key&&a()}})]}),(0,d.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,d.jsx)("button",{onClick:a,className:"px-3 py-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"}),(0,d.jsx)("button",{onClick:s,disabled:!n,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${n?"approve"===e?"bg-green-600 text-white hover:bg-green-500":"bg-red-600 text-white hover:bg-red-500":"bg-slate-700 text-slate-500 cursor-not-allowed"}`,children:"approve"===e?"Approve":"Reject"})]})]})})}function oQ(){let{projectFilter:e}=(0,rM.useDashboardStore)(),[t,s]=(0,u.useState)("pending"),{data:a,isLoading:i}=(0,n7.useQuarantine)(t,100,e||void 0),r=(0,n7.useApproveQuarantine)(),n=(0,n7.useRejectQuarantine)(),[l,o]=(0,u.useState)(null),c=a?.items??[];return(0,d.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[l&&(0,d.jsx)(oW,{action:l.action,item:l.item,onConfirm:()=>{l&&("approve"===l.action?r.mutate(l.item.id):n.mutate({id:l.item.id}),o(null))},onCancel:()=>o(null)}),(0,d.jsx)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Quarantine Review"}),(0,d.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["pending","approved","rejected"].map(e=>(0,d.jsx)("button",{onClick:()=>s(e),className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:i?(0,d.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,d.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading quarantine items..."})}):0===c.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[(0,d.jsx)(lc,{size:24,className:"mb-2 text-slate-600"}),(0,d.jsxs)("span",{className:"text-xs",children:["No ",t," items"]})]}):(0,d.jsx)("div",{className:"space-y-3",children:c.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-sm font-medium text-white",children:e.title||"Untitled"}),(0,d.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleString(),e.anomaly_score>0&&(0,d.jsxs)("span",{className:`ml-2 ${e.anomaly_score>.5?"text-red-400":"text-yellow-400"}`,children:["Anomaly: ",e.anomaly_score.toFixed(2)]})]})]}),(0,d.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-2 py-0.5 rounded",children:e.reason?.slice(0,50)||"Threat detected"})]}),(0,d.jsx)("div",{className:"bg-slate-800/50 rounded-lg p-3 mb-3 text-xs text-slate-300 max-h-24 overflow-y-auto whitespace-pre-wrap",children:e.content?.slice(0,500)||"No content"}),t.length>0&&(0,d.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:t.map((e,t)=>(0,d.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1.5 py-0.5 rounded",children:e},t))}),"pending"===e.status&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsxs)("button",{onClick:()=>o({action:"approve",item:e}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-green-600/10 text-green-400 rounded-lg hover:bg-green-600/20 transition-colors",children:[(0,d.jsx)(nZ,{size:12})," Approve"]}),(0,d.jsxs)("button",{onClick:()=>o({action:"reject",item:e}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-600/10 text-red-400 rounded-lg hover:bg-red-600/20 transition-colors",children:[(0,d.jsx)(l_.X,{size:12})," Reject"]})]}),e.reviewed_at&&(0,d.jsxs)("div",{className:"text-[10px] text-slate-500",children:["approved"===e.status?"Approved":"Rejected"," by ",e.reviewed_by," at ",new Date(e.reviewed_at).toLocaleString()]})]},e.id)})})})]})}let oH=(0,nG.default)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),oX=(0,nG.default)("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);var oY=e.i(22934);let oG=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oJ(e,t){let s=new URLSearchParams({timeRange:e});t&&s.set("project",t);let a=await (0,rL.authFetch)(`${oG}/api/v1/agents?${s}`);if(!a.ok)throw Error("Failed to fetch agent registry");return a.json()}async function oZ(e,t,s){let a=encodeURIComponent(e),i=new URLSearchParams({timeRange:t});s&&i.set("project",s);let r=await (0,rL.authFetch)(`${oG}/api/v1/agents/${a}/timeline?${i}`);if(!r.ok)throw Error("Failed to fetch agent timeline");return r.json()}async function o0(e,t){let s=encodeURIComponent(e),a=new URLSearchParams;t?.limit&&a.set("limit",t.limit.toString()),t?.offset&&a.set("offset",t.offset.toString()),t?.firewallResult&&a.set("firewallResult",t.firewallResult),t?.project&&a.set("project",t.project);let i=await (0,rL.authFetch)(`${oG}/api/v1/agents/${s}/operations?${a}`);if(!i.ok)throw Error("Failed to fetch agent operations");return i.json()}function o1(e,t){return(0,rD.useQuery)({queryKey:["agent-operations",e,t],queryFn:()=>o0(e,t),enabled:!!e,refetchInterval:3e4,retry:2})}function o2(e){return e>=.7?"full":e>=.5?"limited":"restricted"}let o5={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},o4={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},o3={full:"Full Access",limited:"Limited",restricted:"Restricted"},o6=460,o8=90;function o7({identifier:e,timeRange:t}){let{data:s,isLoading:a}=function(e,t="24h",s){return(0,rD.useQuery)({queryKey:["agent-timeline",e,t,void 0],queryFn:()=>oZ(e,t,void 0),enabled:!!e,refetchInterval:3e4,retry:2})}(e,t),i=s?.points??[],{linePath:r,dots:n,xLabels:l}=(0,u.useMemo)(()=>{if(0===i.length)return{linePath:"",dots:[],xLabels:[]};let e=i.map(e=>new Date(e.timestamp).getTime()),s=Math.min(...e),a=Math.max(...e)-s||1,r=e=>30+(e-s)/a*o6,n=e=>10+(1-e)*o8,l=i.map((t,s)=>{let a=r(e[s]),i=n(t.trust_score);return`${0===s?"M":"L"} ${a} ${i}`}),o=i.map((t,s)=>({x:r(e[s]),y:n(t.trust_score),result:t.firewall_result,score:t.trust_score,time:t.timestamp})).filter(e=>"ALLOW"!==e.result),c=Math.min(5,i.length),d=[];for(let e=0;e<c;e++){let i=s+a*e/(c-1||1),n=new Date(i);d.push({x:r(i),label:"24h"===t?n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:l.join(" "),dots:o,xLabels:d}},[i,t]);return a?(0,d.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"Loading timeline..."}):0===i.length?(0,d.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"No data for this time range."}):(0,d.jsxs)("svg",{viewBox:"0 0 500 120",className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[(0,d.jsx)("line",{x1:30,y1:10+(1-.7)*o8,x2:30+o6,y2:10+(1-.7)*o8,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,d.jsx)("line",{x1:30,y1:10+.5*o8,x2:30+o6,y2:10+.5*o8,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,d.jsx)("text",{x:26,y:10+(1-.7)*o8+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,d.jsx)("text",{x:26,y:10+.5*o8+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.5"}),(0,d.jsx)("text",{x:26,y:13,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"1.0"}),(0,d.jsx)("text",{x:26,y:10+o8+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.0"}),(0,d.jsx)("path",{d:r,fill:"none",stroke:"#06b6d4",strokeWidth:"1.5"}),n.map((e,t)=>(0,d.jsx)("circle",{cx:e.x,cy:e.y,r:"3",fill:"BLOCK"===e.result?"#ef4444":"#eab308",stroke:"#0f172a",strokeWidth:"1",children:(0,d.jsx)("title",{children:`${e.result} — trust: ${e.score.toFixed(2)} — ${new Date(e.time).toLocaleString()}`})},t)),l.map((e,t)=>(0,d.jsx)("text",{x:e.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:e.label},t))]})}let o9={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function ce({identifier:e}){let{data:t,isLoading:s}=o1(e,{firewallResult:"BLOCK",limit:20}),{data:a}=o1(e,{firewallResult:"QUARANTINE",limit:20}),i=[...t?.entries??[],...a?.entries??[]].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());return s?(0,d.jsx)("div",{className:"text-slate-500 text-xs",children:"Loading..."}):0===i.length?(0,d.jsx)("div",{className:"text-slate-500 text-xs",children:"No flagged operations."}):(0,d.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto",children:i.map(e=>{let t=[];try{t=JSON.parse(e.threat_indicators)}catch{}return(0,d.jsxs)("div",{className:"px-2 py-1.5 rounded bg-slate-800/50 border border-slate-800",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:`px-1 py-0.5 rounded text-[10px] font-medium ${o9[e.firewall_result]??"text-slate-400"}`,children:e.firewall_result}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),e.reason&&(0,d.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5 truncate",children:e.reason}),t.length>0&&(0,d.jsx)("div",{className:"flex gap-1 mt-1 flex-wrap",children:t.map((e,t)=>(0,d.jsx)("span",{className:"px-1 py-0.5 rounded text-[9px] bg-red-500/10 text-red-400",children:e},t))}),(0,d.jsxs)("div",{className:"flex gap-3 mt-1 text-[10px] text-slate-500",children:[(0,d.jsxs)("span",{children:["Trust: ",e.trust_score.toFixed(2)]}),(0,d.jsxs)("span",{children:["Anomaly: ",e.anomaly_score.toFixed(2)]}),null!==e.pipeline_duration_ms&&(0,d.jsxs)("span",{children:[e.pipeline_duration_ms,"ms"]})]})]},e.id)})})}let ct=(0,nG.default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),cs=h.default.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function ca({agentFilter:e}){let[t,s]=(0,u.useState)([]),a=(0,u.useRef)(0),i=(0,u.useRef)(null),r=(0,u.useCallback)(t=>{try{let i=JSON.parse(t.data);if("defence_event"!==i.type)return;let r=i.data;if(e&&r.source_identifier!==e)return;s(e=>[{...r,id:++a.current},...e].slice(0,50))}catch{}},[e]);return((0,u.useEffect)(()=>{try{let e=new WebSocket(cs);return i.current=e,e.onmessage=r,e.onerror=()=>{},()=>{e.close(),i.current=null}}catch{return}},[r]),0===t.length)?(0,d.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 text-xs py-2",children:[(0,d.jsx)(ct,{size:12}),(0,d.jsx)("span",{children:"Listening for defence events..."})]}):(0,d.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:(0,d.jsx)(M,{initial:!1,children:t.map(e=>(0,d.jsxs)(rT.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0},className:`px-2 py-1.5 rounded border text-xs ${"BLOCK"===e.firewall_result?"bg-red-500/5 border-red-500/20":"bg-yellow-500/5 border-yellow-500/20"}`,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:`font-medium ${"BLOCK"===e.firewall_result?"text-red-400":"text-yellow-400"}`,children:e.firewall_result}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleTimeString()})]}),(0,d.jsxs)("p",{className:"text-slate-400 text-[11px] truncate mt-0.5",children:[e.source_identifier," — ",e.reason??"No reason"]})]},e.id))})})}function ci({identifier:e,compact:t}){let s=e.split(">").map(e=>e.trim());return 1===s.length?(0,d.jsx)("span",{className:"font-mono text-sm text-white",children:e}):t?(0,d.jsxs)("span",{className:"font-mono text-sm",children:[(0,d.jsxs)("span",{className:"text-slate-500",children:[s.slice(0,-1).join(" › ")," › "]}),(0,d.jsx)("span",{className:"text-white",children:s[s.length-1]})]}):(0,d.jsx)("div",{className:"font-mono text-sm",children:s.map((e,t)=>(0,d.jsxs)("span",{children:[t>0&&(0,d.jsx)(oY.ChevronRight,{size:12,className:"inline text-slate-600 mx-0.5"}),(0,d.jsx)("span",{className:t===s.length-1?"text-white":"text-slate-500",children:e})]},t))})}function cr({score:e}){let t=o2(e);return(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${o5[t]} ${o4[t]}`,children:[e.toFixed(2)," · ",o3[t]]})}function cn({type:e}){let t={agent:"text-purple-400 bg-purple-500/10",cli:"text-cyan-400 bg-cyan-500/10",user:"text-green-400 bg-green-500/10",hook:"text-blue-400 bg-blue-500/10",api:"text-orange-400 bg-orange-500/10",web:"text-red-400 bg-red-500/10",file:"text-slate-400 bg-slate-500/10",email:"text-yellow-400 bg-yellow-500/10"}[e]??"text-slate-400 bg-slate-500/10";return(0,d.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${t}`,children:e})}function cl(){let{projectFilter:e}=(0,rM.useDashboardStore)(),[t,s]=(0,u.useState)("24h"),[a,i]=(0,u.useState)(null),[r,n]=(0,u.useState)("operation_count"),[l,o]=(0,u.useState)(!1),[c,h]=(0,u.useState)(null),[m,x]=(0,u.useState)(null),[p,f]=(0,u.useState)(!1),[g]=(0,u.useState)(()=>Date.now()),{data:y,isLoading:v}=function(e="24h",t){return(0,rD.useQuery)({queryKey:["agents",e,t],queryFn:()=>oJ(e,t),refetchInterval:3e4,retry:2})}(t,e??void 0),b=y?.agents??[],j=(0,u.useMemo)(()=>{let e=b;return c&&(e=e.filter(e=>e.source_type===c)),m&&(e=e.filter(e=>o2(e.avg_trust_score)===m)),p&&(e=e.filter(e=>e.flagged_count>0)),e},[b,c,m,p]),w=(0,u.useMemo)(()=>{let e=[...j];return e.sort((e,t)=>{let s=e[r],a=t[r];return"string"==typeof s&&"string"==typeof a?l?s.localeCompare(a):a.localeCompare(s):l?s-a:a-s}),e},[j,r,l]),N=(0,u.useMemo)(()=>[...new Set(b.map(e=>e.source_type))],[b]),k=e=>{r===e?o(!l):(n(e),o(!1))};return(0,d.jsxs)("div",{className:"flex h-full",children:[(0,d.jsxs)("div",{className:`${a?"w-1/2":"w-full"} border-r border-slate-800 flex flex-col`,children:[(0,d.jsxs)("div",{className:"p-3 border-b border-slate-800 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(lm,{size:16,className:"text-cyan-400"}),(0,d.jsx)("h2",{className:"text-sm font-medium text-white",children:"Agent Registry"}),(0,d.jsxs)("span",{className:"text-xs text-slate-500",children:[w.length," agents"]})]}),(0,d.jsx)("div",{className:"flex gap-1",children:["24h","7d","30d"].map(e=>(0,d.jsx)("button",{onClick:()=>s(e),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-slate-800 flex items-center gap-2 flex-wrap",children:[(0,d.jsx)(oH,{size:12,className:"text-slate-500"}),N.map(e=>(0,d.jsx)("button",{onClick:()=>h(c===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${c===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,d.jsx)("span",{className:"text-slate-700",children:"|"}),["full","limited","restricted"].map(e=>(0,d.jsx)("button",{onClick:()=>x(m===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${m===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,d.jsx)("span",{className:"text-slate-700",children:"|"}),(0,d.jsxs)("button",{onClick:()=>f(!p),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors flex items-center gap-0.5 ${p?"bg-red-600/20 text-red-400":"text-slate-500 hover:text-slate-300"}`,children:[(0,d.jsx)(lc,{size:10})," flagged"]})]}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-b border-slate-800 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 text-[10px] text-slate-500",children:[(0,d.jsx)("span",{children:"Agent"}),(0,d.jsxs)("button",{onClick:()=>k("avg_trust_score"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Trust ",(0,d.jsx)(oX,{size:8})]}),(0,d.jsxs)("button",{onClick:()=>k("operation_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Ops ",(0,d.jsx)(oX,{size:8})]}),(0,d.jsxs)("button",{onClick:()=>k("flagged_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Flagged ",(0,d.jsx)(oX,{size:8})]}),(0,d.jsxs)("button",{onClick:()=>k("last_seen"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Last seen ",(0,d.jsx)(oX,{size:8})]})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[v&&(0,d.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading agents..."}),!v&&0===w.length&&(0,d.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"No agents found in this time range."}),w.map(e=>{let t,s=a?.source_identifier===e.source_identifier&&a?.source_type===e.source_type;return(0,d.jsxs)("button",{onClick:()=>i(s?null:e),className:`w-full px-3 py-2 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 items-center text-left transition-colors border-b border-slate-800/50 ${s?"bg-cyan-600/10":"hover:bg-slate-800/50"}`,children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(ci,{identifier:e.source_identifier,compact:!0}),(0,d.jsx)("div",{className:"mt-0.5",children:(0,d.jsx)(cn,{type:e.source_type})})]}),(0,d.jsx)(cr,{score:e.avg_trust_score}),(0,d.jsx)("span",{className:"text-xs text-slate-300 tabular-nums",children:e.operation_count}),(0,d.jsx)("span",{className:`text-xs tabular-nums ${e.flagged_count>0?"text-red-400":"text-slate-500"}`,children:e.flagged_count}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:(t=g-new Date(e.last_seen).getTime())<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`})]},`${e.source_type}:${e.source_identifier}`)})]})]}),(0,d.jsx)(M,{children:a&&(0,d.jsxs)(rT.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:"w-1/2 flex flex-col overflow-y-auto",children:[(0,d.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)(ci,{identifier:a.source_identifier}),(0,d.jsx)("button",{onClick:()=>i(null),className:"text-slate-500 hover:text-white text-xs",children:"Close"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,d.jsx)(cn,{type:a.source_type}),(0,d.jsx)(cr,{score:a.avg_trust_score}),(0,d.jsxs)("span",{className:"text-[10px] text-slate-500",children:[a.operation_count," ops · ",a.flagged_count," flagged"]})]})]}),(0,d.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Trust Score Timeline"}),(0,d.jsx)(o7,{identifier:a.source_identifier,timeRange:t})]}),(0,d.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,d.jsxs)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:["Flagged Operations",a.flagged_count>0&&(0,d.jsxs)("span",{className:"ml-1 text-red-400",children:["(",a.flagged_count,")"]})]}),(0,d.jsx)(ce,{identifier:a.source_identifier})]}),(0,d.jsxs)("div",{className:"p-3",children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Live Alerts"}),(0,d.jsx)(ca,{agentFilter:a.source_identifier})]})]})})]})}let co=(0,nG.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"}]]),cc={critical:"text-red-400 bg-red-400/10",high:"text-red-400 bg-red-400/10",medium:"text-yellow-400 bg-yellow-400/10",low:"text-slate-400 bg-slate-400/10",safe:"text-green-400 bg-green-400/10"};function cd({level:e}){let t=cc[e]??cc.low;return(0,d.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${t}`,children:e.toUpperCase()})}function cu({findings:e}){return 0===e.length?null:(0,d.jsx)("div",{className:"mt-2 space-y-1.5 pl-6",children:e.map((e,t)=>(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(cd,{level:e.severity}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"text-xs text-slate-300",children:e.description}),e.matchedText&&(0,d.jsxs)("div",{className:"mt-0.5 text-[10px] text-slate-500 font-mono truncate",children:['Match: "',e.matchedText,'"']})]})]},`${e.pattern}-${t}`))})}function ch(e){let t=e.split(/[/\\]/);return t[t.length-1]||e}function cm({file:e,cloudConnected:t,onTrust:s,onUntrust:a,onRemove:i,onCloudUpsell:r}){let[n,l]=(0,u.useState)(!e.safe),[o,c]=(0,u.useState)(!1);return(0,d.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[(0,d.jsxs)("button",{onClick:()=>l(!n),className:"flex-1 px-3 py-2.5 flex items-center gap-3 hover:bg-slate-800/80 transition-colors min-w-0",children:[e.trusted?(0,d.jsx)(co,{size:16,className:"text-cyan-400 shrink-0"}):e.safe?(0,d.jsx)(lz,{size:16,className:"text-green-400 shrink-0"}):(0,d.jsx)(lB,{size:16,className:"text-red-400 shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-white truncate block",children:e.skillName||ch(e.path)}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500 truncate block",children:e.path.replace(/^\/Users\/[^/]+/,"~")})]}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500 shrink-0",children:e.format}),e.trusted?(0,d.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-cyan-400/10 text-cyan-400",children:"TRUSTED"}):(0,d.jsx)(cd,{level:e.riskLevel}),(0,d.jsxs)("span",{className:"text-[10px] text-slate-600 shrink-0",children:[e.scanDurationMs,"ms"]}),e.findings.length>0?n?(0,d.jsx)(lw,{size:14,className:"text-slate-500 shrink-0"}):(0,d.jsx)(oY.ChevronRight,{size:14,className:"text-slate-500 shrink-0"}):(0,d.jsx)("div",{className:"w-[14px] shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 shrink-0",children:[e.trusted?(0,d.jsx)("button",{onClick:()=>a(e.path),title:"Remove trust",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-cyan-400 hover:text-cyan-300",children:(0,d.jsx)(co,{size:14})}):(0,d.jsx)("button",{onClick:()=>s(e.path),title:"Mark as trusted",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-slate-500 hover:text-cyan-400",children:(0,d.jsx)(ll,{size:14})}),!e.safe&&!e.trusted&&(0,d.jsx)("button",{onClick:()=>t?c(!0):r(),title:t?"Remove skill file":"Connect to Cloud to remove",className:`p-1.5 rounded transition-colors ${t?"hover:bg-red-500/10 text-slate-500 hover:text-red-400":"text-slate-600 hover:text-slate-400 cursor-not-allowed"}`,children:(0,d.jsx)(oy,{size:14})})]})]}),o&&(0,d.jsxs)("div",{className:"border-t border-slate-700/50 px-3 py-2.5 bg-red-950/30 flex items-center gap-3",children:[(0,d.jsxs)("span",{className:"text-xs text-red-300 flex-1",children:["Remove ",(0,d.jsx)("span",{className:"font-medium",children:e.skillName||ch(e.path)}),"? This will delete the file from disk."]}),(0,d.jsx)("button",{onClick:()=>{i(e.path),c(!1)},className:"px-3 py-1 text-xs font-medium bg-red-600 hover:bg-red-500 text-white rounded transition-colors",children:"Delete"}),(0,d.jsx)("button",{onClick:()=>c(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"})]}),n&&e.findings.length>0&&(0,d.jsx)("div",{className:"border-t border-slate-700/50 px-3 py-2 bg-slate-900/50",children:(0,d.jsx)(cu,{findings:e.findings})})]})}function cx({files:e,cloudConnected:t,onTrust:s,onUntrust:a,onRemove:i,onCloudUpsell:r}){return 0===e.length?null:(0,d.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,d.jsx)(cm,{file:e,cloudConnected:t,onTrust:s,onUntrust:a,onRemove:i,onCloudUpsell:r},e.path))})}var cp=e.i(6847);let cf=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function cg(){let[e,t]=(0,u.useState)(null),[s,a]=(0,u.useState)(!1),[i,r]=(0,u.useState)(null),[n,l]=(0,u.useState)(!1),o=async()=>{a(!0),r(null);try{let e=await (0,rL.gatedFetch)(`${cf}/api/skills/deep-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[]})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Deep scan failed")}t(await e.json())}catch(e){e instanceof rL.FeatureLockedError?l(!0):r(e.message)}finally{a(!1)}};return n?(0,d.jsx)(cy,{}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(lx,{size:16,className:"text-cyan-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Deep Skill Scanner"})]}),(0,d.jsxs)("button",{onClick:o,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-cyan-600 text-white rounded-lg hover:bg-cyan-500 disabled:opacity-50 transition-colors",children:[(0,d.jsx)(cp.Search,{size:12}),s?"Scanning...":"Run Deep Scan"]})]}),i&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:i}),e&&(0,d.jsxs)("div",{className:"space-y-3",children:[e.degraded&&(0,d.jsx)("p",{className:"text-[10px] text-yellow-400 bg-yellow-500/10 px-2 py-1 rounded",children:e.degradedReason}),e.correlations.length>0&&(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("h4",{className:"text-xs text-slate-400 font-medium",children:"Cross-File Correlations"}),e.correlations.map((e,t)=>(0,d.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,d.jsx)(lc,{size:12,className:"critical"===e.severity?"text-red-400 mt-0.5":"high"===e.severity?"text-orange-400 mt-0.5":"text-yellow-400 mt-0.5"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-slate-200",children:e.finding}),(0,d.jsxs)("p",{className:"text-slate-500 text-[10px]",children:["Files: ",e.files.join(", ")]})]})]},t))]}),Object.keys(e.intentBreakdown).length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Intent Breakdown"}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(e.intentBreakdown).map(([e,t])=>(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)("div",{className:"h-1.5 bg-slate-800 rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full bg-cyan-500/60 rounded-full",style:{width:`${Math.min(100,5*t)}%`}})})}),(0,d.jsx)("span",{className:"text-slate-500 text-[10px] w-16 truncate",children:e}),(0,d.jsx)("span",{className:"text-slate-400 text-[10px] w-4 text-right",children:t})]},e))})]}),e.recommendations.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Recommendations"}),(0,d.jsx)("ul",{className:"space-y-1",children:e.recommendations.map((e,t)=>(0,d.jsx)("li",{className:"text-xs text-slate-300 pl-3 relative before:absolute before:left-0 before:top-1.5 before:w-1.5 before:h-1.5 before:rounded-full before:bg-cyan-500/40",children:e},t))})]}),0===e.correlations.length&&0===Object.keys(e.intentBreakdown).length&&(0,d.jsx)("p",{className:"text-xs text-slate-500 text-center py-2",children:"No files provided for scanning. Upload skill files to analyse."})]}),!e&&!s&&(0,d.jsx)("p",{className:"text-xs text-slate-500 text-center py-2",children:"Run a deep scan to analyse skill files for cross-file threats and intent patterns."})]})}function cy(){return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(lx,{size:16,className:"text-cyan-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Deep Skill Scanner"})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("h4",{className:"text-xs text-slate-400 font-medium",children:"Cross-File Correlations"}),oC.map((e,t)=>(0,d.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,d.jsx)(lc,{size:12,className:"critical"===e.severity?"text-red-400 mt-0.5":"high"===e.severity?"text-orange-400 mt-0.5":"text-yellow-400 mt-0.5"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-slate-200",children:e.finding}),(0,d.jsxs)("p",{className:"text-slate-500 text-[10px]",children:["Files: ",e.files.join(", ")]})]})]},t))]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Intent Breakdown"}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(oT).map(([e,t])=>(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)("div",{className:"h-1.5 bg-slate-800 rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full bg-cyan-500/60 rounded-full",style:{width:`${t}%`}})})}),(0,d.jsx)("span",{className:"text-slate-500 text-[10px] w-16 truncate",children:e}),(0,d.jsx)("span",{className:"text-slate-400 text-[10px] w-4 text-right",children:t})]},e))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Recommendations"}),(0,d.jsx)("ul",{className:"space-y-1",children:oP.map((e,t)=>(0,d.jsx)("li",{className:"text-xs text-slate-300 pl-3 relative before:absolute before:left-0 before:top-1.5 before:w-1.5 before:h-1.5 before:rounded-full before:bg-cyan-500/40",children:e},t))})]})]})}function cv(){return(0,d.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,d.jsx)(oj,{feature:"skill_scanner_deep",label:"Deep skill scanning with multi-file analysis and semantic intent detection.",children:(0,d.jsx)(cg,{})})})}let cb=[{value:"",label:"Auto-detect"},{value:"skill-md",label:"SKILL.md (Claude Code)"},{value:"hook-md",label:"HOOK.md (OpenClaw)"},{value:"hook-js",label:"handler.js (OpenClaw)"},{value:"rules",label:".cursorrules / .windsurfrules / .clinerules"},{value:"claude-md",label:"CLAUDE.md"},{value:"copilot-md",label:"copilot-instructions.md"},{value:"aider-yml",label:".aider.conf.yml"},{value:"continue-json",label:".continue/config.json"}];function cj(){let e=lW(),t=(0,n9.useMutation)({mutationFn:lK}),s=(0,n9.useMutation)({mutationFn:lQ}),a=(0,n9.useMutation)({mutationFn:lH}),i=(0,n9.useMutation)({mutationFn:lX}),{data:r}=ot(),[n,l]=(0,u.useState)(null),[o,c]=(0,u.useState)(null),[h,m]=(0,u.useState)(!1),[x,p]=(0,u.useState)(""),[f,g]=(0,u.useState)(""),[y,v]=(0,u.useState)(!1),b=!!(r?.enabled&&r?.apiKeySet);return(0,d.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Skills Scanner"}),(0,d.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Scan agent instruction files for hidden threats"})]}),(0,d.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>l(e)})},disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[e.isPending?(0,d.jsx)(l$,{size:14,className:"animate-spin"}):(0,d.jsx)(lx,{size:14}),"Scan All"]})]}),y&&(0,d.jsxs)("div",{className:"mb-4 bg-slate-900 border border-cyan-800/50 rounded-xl p-4 flex items-center gap-3",children:[(0,d.jsx)(lF,{size:20,className:"text-cyan-400 shrink-0"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:"Connect to ShieldCortex Cloud"}),(0,d.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Enable one-click skill removal and cloud-powered threat intelligence."})]}),(0,d.jsx)("button",{onClick:()=>v(!1),className:"text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Dismiss"})]}),n?(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400",children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{className:"text-white font-medium",children:n.totalScanned})," files scanned"]}),(0,d.jsx)("span",{className:"text-slate-600",children:"·"}),n.threatCount>0?(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{className:"text-red-400 font-medium",children:n.threatCount})," with threats"]}):(0,d.jsx)("span",{className:"text-green-400",children:"All clean"}),(0,d.jsx)("span",{className:"text-slate-600",children:"·"}),(0,d.jsx)("span",{children:new Date(n.scannedAt).toLocaleTimeString()})]}),(0,d.jsx)(cx,{files:n.files,cloudConnected:b,onTrust:e=>{s.mutate(e,{onSuccess:()=>{n&&l({...n,files:n.files.map(t=>t.path===e?{...t,trusted:!0}:t),threatCount:n.files.filter(t=>!t.safe&&!t.trusted&&t.path!==e).length})}})},onUntrust:e=>{a.mutate(e,{onSuccess:()=>{n&&l({...n,files:n.files.map(t=>t.path===e?{...t,trusted:!1}:t),threatCount:n.files.filter(t=>{let s=t.path!==e&&t.trusted;return!t.safe&&!s}).length})}})},onRemove:e=>{i.mutate(e,{onSuccess:()=>{if(n){let t=n.files.filter(t=>t.path!==e);l({...n,files:t,totalScanned:t.length,threatCount:t.filter(e=>!e.safe&&!e.trusted).length})}}})},onCloudUpsell:()=>v(!0)})]}):e.isPending?(0,d.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,d.jsx)(l$,{size:24,className:"text-cyan-400 animate-spin"})}):(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,d.jsx)(lx,{size:32,className:"text-slate-600 mb-3"}),(0,d.jsx)("p",{className:"text-sm text-slate-400",children:"No skills scanned yet"}),(0,d.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:'Click "Scan All" to discover and scan agent instruction files'})]}),(0,d.jsxs)("div",{className:"mt-6",children:[(0,d.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-300 transition-colors",children:[h?(0,d.jsx)(lw,{size:14}):(0,d.jsx)(oY.ChevronRight,{size:14}),"Paste & Scan"]}),h&&(0,d.jsxs)("div",{className:"mt-3 bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("textarea",{value:x,onChange:e=>p(e.target.value),placeholder:"Paste skill/instruction file content here...",className:"w-full h-32 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:ring-cyan-500 focus:border-cyan-500 resize-y font-mono"}),(0,d.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,d.jsx)("select",{value:f,onChange:e=>g(e.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",children:cb.map(e=>(0,d.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,d.jsxs)("button",{onClick:()=>{x.trim()&&t.mutate({content:x,format:f||void 0},{onSuccess:e=>c(e)})},disabled:t.isPending||!x.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[t.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):(0,d.jsx)(lx,{size:12}),"Scan Content"]})]}),o&&(0,d.jsxs)("div",{className:"mt-4 bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-white",children:o.skillName}),(0,d.jsx)(cd,{level:o.riskLevel}),(0,d.jsxs)("span",{className:"text-[10px] text-slate-500",children:[o.scanDurationMs,"ms"]})]}),(0,d.jsx)("p",{className:"text-xs text-slate-400",children:o.summary}),o.findings.length>0&&(0,d.jsx)(cu,{findings:o.findings})]})]})]}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(cv,{})})]})}let cw=(0,nG.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),cN=(0,nG.default)("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),ck=(0,nG.default)("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),cS=(0,nG.default)("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),cC=(0,nG.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),cT=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function cP(){let e,t,s,{data:a,isLoading:i,isLocked:r}={...e=(0,rD.useQuery)({queryKey:["custom-patterns"],queryFn:()=>(0,rL.gatedFetch)(`${cT}/api/patterns`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom patterns");return e.json()}),retry:(e,t)=>!(t instanceof rL.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof rL.FeatureLockedError},n=(t=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${cT}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-patterns"]})}})),l=(s=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${cT}/api/patterns/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["custom-patterns"]})}})),o=(0,n9.useMutation)({mutationFn:({id:e,text:t})=>(0,rL.gatedFetch)(`${cT}/api/patterns/${e}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t})}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)}))}),[c,h]=(0,u.useState)(!1),[m,x]=(0,u.useState)(null),[p,f]=(0,u.useState)({name:"",category:"custom",severity:"medium",regex:"",description:""}),g=a?.patterns??[],y=!0,v="";if(p.regex)try{new RegExp(p.regex)}catch(e){y=!1,v=e.message}return r?(0,d.jsx)(cA,{}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(lp,{size:16,className:"text-red-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Injection Patterns"}),(0,d.jsxs)("span",{className:"text-xs text-slate-500",children:[g.length,"/50"]})]}),(0,d.jsxs)("button",{onClick:()=>h(!c),className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-600/20 text-red-400 rounded hover:bg-red-600/30 transition-colors",children:[(0,d.jsx)(og,{size:12})," Add Pattern"]})]}),c&&(0,d.jsxs)("form",{onSubmit:e=>{e.preventDefault(),n.mutate(p,{onSuccess:()=>{h(!1),f({name:"",category:"custom",severity:"medium",regex:"",description:""})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsx)("input",{value:p.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"Pattern name",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,d.jsxs)("select",{value:p.severity,onChange:e=>f(t=>({...t,severity:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,d.jsx)("option",{value:"critical",children:"Critical"}),(0,d.jsx)("option",{value:"high",children:"High"}),(0,d.jsx)("option",{value:"medium",children:"Medium"}),(0,d.jsx)("option",{value:"low",children:"Low"})]})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("input",{value:p.regex,onChange:e=>f(t=>({...t,regex:e.target.value})),placeholder:"Regex pattern",required:!0,className:`w-full px-2 py-1.5 text-xs bg-slate-900 border rounded text-slate-200 font-mono placeholder:text-slate-600 ${y?"border-slate-700":"border-red-500"}`}),!y&&(0,d.jsx)("p",{className:"text-[10px] text-red-400 mt-0.5",children:v})]}),(0,d.jsx)("input",{value:p.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"submit",disabled:n.isPending||!y,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-500 disabled:opacity-50",children:n.isPending?"Creating...":"Create"}),(0,d.jsx)("button",{type:"button",onClick:()=>h(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),n.error&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:n.error.message})]}),i?(0,d.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading patterns..."}):0===g.length?(0,d.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom patterns yet. Click "Add Pattern" to create one.'}):(0,d.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,d.jsxs)("div",{className:"px-3 py-2 bg-slate-800/30 rounded text-xs space-y-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-slate-200 flex-1 font-medium",children:e.name}),(0,d.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity?"bg-red-500/20 text-red-400":"high"===e.severity?"bg-orange-500/20 text-orange-400":"medium"===e.severity?"bg-yellow-500/20 text-yellow-400":"bg-slate-500/20 text-slate-400"}`,children:e.severity}),(0,d.jsx)("button",{onClick:()=>x(m?.id===e.id?null:{id:e.id,text:""}),className:"text-slate-500 hover:text-cyan-400",title:"Test pattern",children:(0,d.jsx)(cC,{size:12})}),(0,d.jsx)("button",{onClick:()=>l.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,d.jsx)(oy,{size:12})})]}),(0,d.jsx)("code",{className:"text-slate-500 text-[10px] block truncate",children:e.regex}),m?.id===e.id&&(0,d.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,d.jsx)("input",{value:m.text,onChange:t=>x({id:e.id,text:t.target.value}),placeholder:"Test text...",className:"flex-1 px-2 py-1 text-[10px] bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,d.jsx)("button",{onClick:()=>o.mutate({id:e.id,text:m.text}),disabled:!m.text,className:"px-2 py-1 text-[10px] bg-cyan-600/20 text-cyan-400 rounded hover:bg-cyan-600/30 disabled:opacity-50",children:"Test"}),o.data&&(0,d.jsxs)("span",{className:"text-[10px] text-slate-400 self-center",children:[o.data.count," matches"]})]})]},e.id))})]})}function cA(){return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(lp,{size:16,className:"text-red-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Injection Patterns"}),(0,d.jsx)("span",{className:"text-xs text-slate-500",children:"0/50"})]}),(0,d.jsx)("div",{className:"space-y-1",children:ok.map(e=>(0,d.jsxs)("div",{className:"px-3 py-2 bg-slate-800/30 rounded text-xs space-y-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-slate-200 flex-1 font-medium",children:e.name}),(0,d.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity?"bg-red-500/20 text-red-400":"high"===e.severity?"bg-orange-500/20 text-orange-400":"bg-yellow-500/20 text-yellow-400"}`,children:e.severity})]}),(0,d.jsx)("code",{className:"text-slate-500 text-[10px] block truncate",children:e.regex})]},e.id))})]})}function cM(){return(0,d.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,d.jsx)(oj,{feature:"custom_injection_patterns",label:"Define up to 50 custom regex patterns for detecting domain-specific threats.",children:(0,d.jsx)(cP,{})})})}let cE=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function cD(){let e,t,s,a,{data:i,isLoading:r,isLocked:n}={...e=(0,rD.useQuery)({queryKey:["custom-policies"],queryFn:()=>(0,rL.gatedFetch)(`${cE}/api/iron-dome/policies`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom policies");return e.json()}),retry:(e,t)=>!(t instanceof rL.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof rL.FeatureLockedError},l=(t=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${cE}/api/iron-dome/policies`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-policies"]})}})),o=(s=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${cE}/api/iron-dome/policies/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["custom-policies"]})}})),c=(a=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${cE}/api/iron-dome/policies/${e}/activate`,{method:"PUT"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["custom-policies"]})}})),[h,m]=(0,u.useState)(!1),[x,p]=(0,u.useState)({name:"",description:""}),f=i?.policies??[];return n?(0,d.jsx)(cL,{}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(ll,{size:16,className:"text-red-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Iron Dome Policies"}),(0,d.jsxs)("span",{className:"text-xs text-slate-500",children:[f.length,"/10"]})]}),(0,d.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-600/20 text-red-400 rounded hover:bg-red-600/30 transition-colors",children:[(0,d.jsx)(og,{size:12})," Create Policy"]})]}),h&&(0,d.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate({name:x.name,description:x.description,config:{}},{onSuccess:()=>{m(!1),p({name:"",description:""})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,d.jsx)("input",{value:x.name,onChange:e=>p(t=>({...t,name:e.target.value})),placeholder:"Policy name",required:!0,className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,d.jsx)("textarea",{value:x.description,onChange:e=>p(t=>({...t,description:e.target.value})),placeholder:"Description",rows:2,className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600 resize-none"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"submit",disabled:l.isPending,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-500 disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,d.jsx)("button",{type:"button",onClick:()=>m(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),l.error&&(0,d.jsx)("p",{className:"text-xs text-red-400",children:l.error.message})]}),r?(0,d.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading policies..."}):0===f.length?(0,d.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom policies yet. Click "Create Policy" to get started.'}):(0,d.jsx)("div",{className:"space-y-1",children:f.map(e=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-slate-200 font-medium",children:e.name}),1===e.is_active&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-green-500/20 text-green-400 text-[10px] font-medium",children:"Active"})]}),e.description&&(0,d.jsx)("p",{className:"text-slate-500 text-[10px] mt-0.5",children:e.description})]}),!e.is_active&&(0,d.jsxs)("button",{onClick:()=>c.mutate(e.id),className:"flex items-center gap-1 px-2 py-1 text-[10px] bg-green-600/20 text-green-400 rounded hover:bg-green-600/30",title:"Set active",children:[(0,d.jsx)(nZ,{size:10})," Activate"]}),(0,d.jsx)("button",{onClick:()=>o.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,d.jsx)(oy,{size:12})})]},e.id))})]})}function cL(){return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(ll,{size:16,className:"text-red-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Iron Dome Policies"}),(0,d.jsx)("span",{className:"text-xs text-slate-500",children:"0/10"})]}),(0,d.jsx)("div",{className:"space-y-1",children:oS.map(e=>(0,d.jsx)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-slate-200 font-medium",children:e.name}),e.is_active&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-green-500/20 text-green-400 text-[10px] font-medium",children:"Active"})]}),(0,d.jsx)("p",{className:"text-slate-500 text-[10px] mt-0.5",children:e.description})]})},e.id))})]})}function cF(){return(0,d.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,d.jsx)(oj,{feature:"custom_iron_dome_policies",label:"Create custom Iron Dome policies with tailored action gates and trust levels.",children:(0,d.jsx)(cD,{})})})}let cR=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:ll},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:ol},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:lm},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:lc}],c$=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:ck},{name:"Instruction Gateway",description:"Trusted channel validation",icon:cw},{name:"Action Gate",description:"Approve / block external actions",icon:ol},{name:"PII Guard",description:"Block sensitive data output",icon:lb},{name:"Kill Switch",description:"Emergency stop phrase",icon:cN},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:lm}],cz={critical:"bg-red-500/20 text-red-400 border-red-500/30",high:"bg-orange-500/20 text-orange-400 border-orange-500/30",medium:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",low:"bg-slate-500/20 text-slate-400 border-slate-500/30"},c_={CRITICAL:"bg-red-500/20 text-red-400",HIGH:"bg-orange-500/20 text-orange-400",MEDIUM:"bg-yellow-500/20 text-yellow-400",LOW:"bg-slate-500/20 text-slate-400",NONE:"bg-green-500/20 text-green-400"};function cV(){let e,t,s,{data:a,isLoading:i}=l6(),{data:r}=l8(50),n=(e=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>lZ(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),l=(t=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:l0,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),o=(0,n9.useMutation)({mutationFn:l1}),c=l7(),h=(s=(0,n5.useQueryClient)(),(0,n9.useMutation)({mutationFn:e=>l5(e),onSuccess:()=>{s.invalidateQueries({queryKey:["control-status"]}),s.invalidateQueries({queryKey:["iron-dome-status"]}),s.invalidateQueries({queryKey:["iron-dome-audit"]})}})),{data:m}=(0,rD.useQuery)({queryKey:["control-status"],queryFn:l4,refetchInterval:5e3,retry:2}),[x,p]=(0,u.useState)(""),[f,g]=(0,u.useState)(null),[y,v]=(0,u.useState)(""),b=a?.enabled??!1,j=m?.killSwitchActive??!1,w=m?.killSwitchMeta??null;m?.paused;let N=a?.profile,k=a?.config,S=r?.logs??[],C=S.filter(e=>"BLOCK"===e.firewall_result).length,T=S.filter(e=>"ALLOW"===e.firewall_result).length;return(0,d.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(lp,{size:20,className:"text-red-400"}),(0,d.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Iron Dome"}),i?(0,d.jsx)("span",{className:"text-[10px] text-slate-500 animate-pulse",children:"Loading..."}):(0,d.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${b?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:b?"ACTIVE":"INACTIVE"})]}),b&&(0,d.jsxs)("button",{onClick:()=>{l.mutate()},disabled:l.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 disabled:opacity-50 rounded-lg text-xs font-medium text-red-400 transition-colors",children:[l.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):(0,d.jsx)(cN,{size:12}),"Deactivate"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",children:[(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Security Profiles"}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2",children:cR.map(({id:e,label:t,description:s,icon:a})=>(0,d.jsxs)("button",{onClick:()=>{n.mutate(e)},disabled:n.isPending,className:`text-left p-3 rounded-lg border transition-colors ${N===e?"border-red-500/50 bg-red-500/10 text-red-400":"border-slate-700 bg-slate-800/50 text-slate-400 hover:border-slate-600"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,d.jsx)(a,{size:12}),(0,d.jsx)("span",{className:"text-xs font-medium",children:t})]}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:s})]},e))})]}),(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Module Status"}),(0,d.jsx)("div",{className:"space-y-2",children:c$.map(({name:e,description:t,icon:s})=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-slate-800/50",children:[(0,d.jsx)(s,{size:14,className:b?"text-red-400":"text-slate-600"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-xs font-medium text-slate-300",children:e}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500 truncate",children:t})]}),(0,d.jsx)("span",{className:`w-2 h-2 rounded-full ${b?"bg-red-400":"bg-slate-600"}`})]},e))})]})]}),b&&k&&(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-6",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Active Configuration"}),(0,d.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Trusted Channels"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1",children:k.trustedChannels.map(e=>(0,d.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:e},e))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Requires Approval"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1",children:k.requireApproval.map(e=>(0,d.jsx)("span",{className:"px-1.5 py-0.5 bg-red-500/10 border border-red-500/20 rounded text-red-400",children:e},e))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Kill Phrase"}),(0,d.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400 font-mono",children:k.killPhrase})]})]})]}),j?(0,d.jsxs)("div",{className:"bg-red-950/50 border-2 border-red-500/50 rounded-xl p-5 mb-6 animate-pulse-slow",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)(cS,{size:18,className:"text-red-400"}),(0,d.jsx)("h3",{className:"text-sm font-bold text-red-400 uppercase tracking-wide",children:"Kill Switch Active"}),(0,d.jsx)("span",{className:"ml-auto text-[10px] bg-red-500/20 text-red-400 px-2 py-0.5 rounded-full border border-red-500/30",children:"LOCKDOWN"})]}),(0,d.jsx)("p",{className:"text-xs text-red-300/80 mb-2",children:"All agent operations are blocked. No memory reads, writes, graph queries, or consolidation. Iron Dome remains active and continues protecting."}),w&&(0,d.jsxs)("div",{className:"bg-red-950/30 border border-red-500/20 rounded-lg p-3 mb-4 space-y-1",children:[(0,d.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,d.jsx)("span",{className:"text-red-400 font-medium",children:"Triggered:"})," ",new Date(w.triggeredAt).toLocaleString()]}),(0,d.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,d.jsx)("span",{className:"text-red-400 font-medium",children:"Source:"})," ","kill_phrase"===w.source?`Kill phrase "${w.phrase}"`:"manual"===w.source?"Manual (dashboard)":"mcp_tool"===w.source?"MCP tool":w.source]}),void 0!==w.memoryCountAtTrigger&&(0,d.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,d.jsx)("span",{className:"text-red-400 font-medium",children:"Memories at trigger:"})," ",w.memoryCountAtTrigger]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("input",{type:"text",value:y,onChange:e=>v(e.target.value),placeholder:"Reason for resuming (required)...",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white placeholder:text-slate-500 focus:outline-none focus:ring-1 focus:ring-green-500"}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("button",{onClick:()=>{y.trim()&&(h.mutate(y.trim()),v(""))},disabled:h.isPending||!y.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-green-600 hover:bg-green-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[h.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):(0,d.jsx)(cC,{size:12}),"Resume Agent"]}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500",children:"Only resume after you've investigated the threat"})]})]})]}):(0,d.jsxs)("div",{className:"bg-slate-900 border border-orange-500/30 rounded-xl p-4 mb-6",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,d.jsx)(cS,{size:14,className:"text-orange-400"}),(0,d.jsx)("h3",{className:"text-sm font-medium text-orange-300",children:"Emergency Stop"})]}),(0,d.jsx)("p",{className:"text-xs text-slate-400 mb-3",children:"Immediately halts your agent when you suspect it has been compromised or is acting on poisoned data. Blocks ALL operations — no reads, writes, or modifications. Iron Dome stays active."}),k?.killPhrase&&(0,d.jsxs)("p",{className:"text-[10px] text-slate-500 mb-3",children:["Kill phrase: ",(0,d.jsxs)("span",{className:"font-mono text-slate-400",children:['"',k.killPhrase,'"']})," — say this in conversation for hands-free stop"]}),(0,d.jsxs)("button",{onClick:()=>c.mutate(),disabled:c.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-red-600 hover:bg-red-500 disabled:opacity-50 rounded-lg text-xs font-bold text-white uppercase tracking-wider transition-colors",children:[c.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):(0,d.jsx)(cS,{size:14}),"Emergency Stop"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsxs)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:[(0,d.jsx)(ck,{size:14,className:"inline mr-1.5 text-red-400"}),"Injection Scanner"]}),(0,d.jsx)("textarea",{value:x,onChange:e=>p(e.target.value),placeholder:"Paste suspicious text to scan for injection patterns...",className:"w-full h-28 bg-slate-800 border border-slate-700 rounded-lg p-3 text-sm text-white placeholder:text-slate-500 resize-none focus:outline-none focus:ring-1 focus:ring-red-500 focus:border-red-500"}),(0,d.jsxs)("button",{onClick:()=>{x.trim()&&o.mutate(x,{onSuccess:e=>g(e)})},disabled:o.isPending||!x.trim(),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[o.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):(0,d.jsx)(lp,{size:12}),"Scan"]}),f&&(0,d.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[f.clean?(0,d.jsx)(lz,{size:14,className:"text-green-400"}):(0,d.jsx)(lB,{size:14,className:"text-red-400"}),(0,d.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${c_[f.riskLevel]??"bg-slate-500/20 text-slate-400"}`,children:f.riskLevel}),(0,d.jsx)("span",{className:"text-xs text-slate-400",children:f.summary})]}),f.detections.map((e,t)=>(0,d.jsxs)("div",{className:`border rounded-lg p-3 ${cz[e.severity]??"border-slate-700"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,d.jsx)("span",{className:"text-[10px] font-medium uppercase",children:e.severity}),(0,d.jsx)("span",{className:"text-xs text-slate-300",children:e.category.replace(/_/g," ")})]}),(0,d.jsx)("p",{className:"text-[11px] text-slate-400 mb-1",children:e.description}),(0,d.jsx)("code",{className:"text-[10px] text-slate-500 bg-slate-800 px-1.5 py-0.5 rounded block truncate",children:e.match})]},t))]})]}),(0,d.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Event Feed"}),(0,d.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Last ",S.length," events"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,d.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,d.jsx)("div",{className:"text-sm font-bold text-slate-300",children:S.length}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:"Total"})]}),(0,d.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,d.jsx)("div",{className:"text-sm font-bold text-red-400",children:C}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,d.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,d.jsx)("div",{className:"text-sm font-bold text-green-400",children:T}),(0,d.jsx)("div",{className:"text-[10px] text-slate-500",children:"Allowed"})]})]}),(0,d.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===S.length?(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)(ll,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,d.jsx)("p",{className:"text-[10px] text-slate-500",children:"No Iron Dome events yet"})]}):S.map((e,t)=>(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-slate-800/50 text-xs",children:[(0,d.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===e.firewall_result?"bg-red-400":"bg-green-400"}`}),(0,d.jsx)("span",{className:"text-slate-400 truncate flex-1",children:(e.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,d.jsx)("span",{className:"text-[10px] text-slate-600 shrink-0",children:new Date(e.timestamp).toLocaleTimeString()})]},e.id??t))})]})]}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(cM,{})}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(cF,{})})]})}let cI=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",cO={architecture:"#3b82f6",error:"#ef4444",pattern:"#8b5cf6",preference:"#f59e0b",learning:"#10b981",context:"#6366f1",todo:"#f97316",note:"#94a3b8",relationship:"#ec4899",custom:"#64748b"},cB={short_term:"STM",long_term:"LTM",episodic:"Episodic"},cU={short_term:"#22d3ee",long_term:"#a78bfa",episodic:"#f472b6"},cq=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"],cK=[{label:"All",value:"all"},{label:"STM",value:"short_term"},{label:"LTM",value:"long_term"},{label:"Episodic",value:"episodic"}];function cW(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function cQ({className:e}){let[t,s]=(0,u.useState)([]),[a,i]=(0,u.useState)(!0),[r,n]=(0,u.useState)(null),[l,o]=(0,u.useState)(new Set),[c,h]=(0,u.useState)("all"),[m,x]=(0,u.useState)(""),p=(0,u.useRef)(null),f=(0,u.useRef)(new Map),[g,y]=(0,u.useState)(new Set);(0,u.useEffect)(()=>{let e=!1;return async function(){i(!0),n(null);try{let t=await (0,rL.authFetch)(`${cI}/api/memories?limit=200&sort=created_at&order=desc`);if(!t.ok)throw Error(`API returned ${t.status}`);let a=await t.json();e||s(Array.isArray(a)?a:a.memories??[])}catch(t){e||n(t instanceof Error?t.message:"Failed to load memories")}finally{e||i(!1)}}(),()=>{e=!0}},[]),(0,u.useEffect)(()=>(p.current=new IntersectionObserver(e=>{y(t=>{let s=new Set(t);for(let t of e){let e=Number(t.target.getAttribute("data-memory-id"));t.isIntersecting&&s.add(e)}return s})},{threshold:.1,rootMargin:"0px 0px 50px 0px"}),()=>p.current?.disconnect()),[]);let v=(0,u.useCallback)(e=>t=>{t&&(f.current.set(e,t),p.current?.observe(t))},[]),b=(0,u.useMemo)(()=>{let e=t;if(l.size>0&&(e=e.filter(e=>l.has(e.category))),"all"!==c&&(e=e.filter(e=>e.type===c)),m.trim()){let t=m.toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))}return e},[t,l,c,m]),j=(0,u.useMemo)(()=>(function(e){let t=new Map;for(let s of e){let e=cW(s.createdAt);t.has(e)||t.set(e,[]),t.get(e).push(s)}return Array.from(t.entries()).sort(([e],[t])=>t.localeCompare(e)).map(([e,t])=>({key:e,label:function(e){let t=new Date,s=cW(t.toISOString()),a=new Date(t);a.setDate(a.getDate()-1);let i=cW(a.toISOString());if(e===s)return"Today";if(e===i)return"Yesterday";let[r,n,l]=e.split("-").map(Number),o=new Date(r,n-1,l);return o.toLocaleDateString(void 0,{month:"long",day:"numeric",year:o.getFullYear()!==t.getFullYear()?"numeric":void 0})}(e),memories:t}))})(b),[b]);return a?(0,d.jsx)("div",{className:`flex items-center justify-center h-full bg-[#0a0a0f] ${e??""}`,children:(0,d.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,d.jsx)("div",{className:"w-8 h-8 border-2 border-slate-700 border-t-cyan-500 rounded-full animate-spin"}),(0,d.jsx)("span",{className:"text-sm text-slate-400",children:"Loading timeline..."})]})}):r?(0,d.jsx)("div",{className:`flex items-center justify-center h-full bg-[#0a0a0f] ${e??""}`,children:(0,d.jsxs)("div",{className:"text-center space-y-2",children:[(0,d.jsx)("p",{className:"text-red-400 text-sm",children:"Failed to load memories"}),(0,d.jsx)("p",{className:"text-slate-500 text-xs",children:r})]})}):(0,d.jsxs)("div",{className:`h-full flex flex-col bg-[#0a0a0f] text-slate-200 ${e??""}`,children:[(0,d.jsxs)("div",{className:"shrink-0 border-b border-slate-800/60 px-4 py-3 space-y-3",children:[(0,d.jsx)("input",{type:"text",placeholder:"Search memories...",value:m,onChange:e=>x(e.target.value),className:"w-full bg-slate-900/60 border border-slate-700/50 rounded-lg px-3 py-2 text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 focus:border-cyan-500/40"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-slate-500 uppercase tracking-wider mr-1",children:"Type"}),cK.map(e=>(0,d.jsx)("button",{onClick:()=>h(e.value),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors ${c===e.value?"bg-cyan-500/20 text-cyan-400 border border-cyan-500/30":"bg-slate-800/40 text-slate-400 border border-slate-700/30 hover:bg-slate-800/80"}`,children:e.label},e.value))]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-slate-500 uppercase tracking-wider mr-1 self-center",children:"Category"}),cq.map(e=>{let t=l.has(e),s=cO[e]??"#64748b";return(0,d.jsx)("button",{onClick:()=>{o(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-all",style:{backgroundColor:t?`${s}22`:"rgba(30, 41, 59, 0.4)",color:t?s:"#94a3b8",border:`1px solid ${t?`${s}55`:"rgba(51, 65, 85, 0.3)"}`},children:e},e)}),l.size>0&&(0,d.jsx)("button",{onClick:()=>o(new Set),className:"px-2 py-1 rounded-md text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Clear"})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-6",children:0===j.length?(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsxs)("div",{className:"text-center space-y-2 max-w-sm",children:[(0,d.jsx)("div",{className:"text-slate-600 text-4xl mb-3",children:"--"}),(0,d.jsx)("p",{className:"text-slate-400 text-sm",children:"No memories yet."}),(0,d.jsxs)("p",{className:"text-slate-500 text-xs",children:["Start a conversation and use ",(0,d.jsx)("code",{className:"text-cyan-500/80 bg-slate-800/60 px-1.5 py-0.5 rounded text-xs",children:"remember"})," to build your timeline."]})]})}):(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-4 md:left-1/2 top-0 bottom-0 w-px bg-slate-800/80"}),j.map(e=>(0,d.jsxs)("div",{className:"mb-8",children:[(0,d.jsxs)("div",{className:"relative flex items-center mb-4",children:[(0,d.jsx)("div",{className:"absolute left-4 md:left-1/2 -translate-x-1/2 w-3 h-3 rounded-full bg-slate-700 border-2 border-slate-600 z-10"}),(0,d.jsx)("div",{className:"ml-10 md:ml-0 md:absolute md:left-1/2 md:translate-x-4",children:(0,d.jsx)("span",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider bg-[#0a0a0f] px-2",children:e.label})})]}),e.memories.map((e,t)=>{var s;let a=t%2==0,i=(s=e.salience)>=.8?{label:"Critical",colour:"#ef4444"}:s>=.6?{label:"High",colour:"#f59e0b"}:s>=.4?{label:"Medium",colour:"#3b82f6"}:{label:"Low",colour:"#64748b"},r=cO[e.category]??"#64748b",n=cU[e.type]??"#94a3b8",l=cB[e.type]??e.type,o=g.has(e.id);return(0,d.jsxs)("div",{ref:v(e.id),"data-memory-id":e.id,className:`relative flex mb-4 ${a?"md:justify-start justify-start":"md:justify-end justify-start"}`,style:{opacity:+!!o,transform:o?"translateY(0)":"translateY(12px)",transition:"opacity 0.4s ease-out, transform 0.4s ease-out"},children:[(0,d.jsx)("div",{className:"absolute left-4 md:left-1/2 top-4 -translate-x-1/2 w-2 h-2 rounded-full z-10",style:{backgroundColor:r}}),(0,d.jsxs)("div",{className:`ml-10 md:ml-0 w-full md:w-[calc(50%-2rem)] rounded-lg border border-slate-800/60 bg-slate-900/40 backdrop-blur-sm p-3 hover:border-slate-700/80 transition-colors ${a?"md:mr-auto md:ml-0":"md:ml-auto md:mr-0"}`,children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-1.5",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-slate-200 leading-tight flex-1 line-clamp-1",children:e.title}),(0,d.jsx)("span",{className:"text-[10px] text-slate-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})})]}),(0,d.jsx)("p",{className:"text-xs text-slate-400 line-clamp-2 mb-2 leading-relaxed",children:e.content}),(0,d.jsxs)("div",{className:"flex items-center flex-wrap gap-1.5",children:[(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:`${r}18`,color:r,border:`1px solid ${r}33`},children:e.category}),(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:`${n}18`,color:n,border:`1px solid ${n}33`},children:l}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{color:i.colour},children:[(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:i.colour}}),i.label]})]})]})]},e.id)})]},e.key))]})})]})}let cH=[{keys:["g","s"],description:"Go to Shield view"},{keys:["g","m"],description:"Go to Memories view"},{keys:["g","t"],description:"Go to Timeline view"},{keys:["g","g"],description:"Go to Graph view"},{keys:["g","a"],description:"Go to Audit view"},{keys:["g","b"],description:"Go to Brain view"},{keys:["g","d"],description:"Go to Dome view"}],cX=[{keys:["/"],description:"Focus search input"},{keys:["Esc"],description:"Close panel / blur search"},{keys:["?"],description:"Toggle this help overlay"}];function cY({children:e}){return(0,d.jsx)("kbd",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 bg-slate-700 border border-slate-600 rounded text-xs font-mono text-slate-200 shadow-sm",children:e})}function cG({shortcut:e}){return(0,d.jsxs)("div",{className:"flex items-center justify-between py-1.5",children:[(0,d.jsx)("span",{className:"text-sm text-slate-300",children:e.description}),(0,d.jsx)("div",{className:"flex items-center gap-1 ml-4 shrink-0",children:e.keys.map((e,t)=>(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[t>0&&(0,d.jsx)("span",{className:"text-slate-500 text-xs",children:"then"}),(0,d.jsx)(cY,{children:e})]},t))})]})}function cJ({open:e,onClose:t}){let s=(0,u.useRef)(null);return((0,u.useEffect)(()=>{if(!e)return;let a=e=>{s.current&&e.target===s.current&&t()};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t]),e)?(0,d.jsx)("div",{ref:s,className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 backdrop-blur-sm transition-opacity duration-150",style:{opacity:+!!e},children:(0,d.jsxs)("div",{className:"bg-slate-900/95 border border-slate-700 rounded-xl shadow-2xl w-full max-w-md mx-4 p-6 backdrop-blur-md animate-in fade-in zoom-in-95 duration-150",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-5",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Keyboard Shortcuts"}),(0,d.jsx)("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors text-sm",children:(0,d.jsx)(cY,{children:"Esc"})})]}),(0,d.jsxs)("div",{className:"mb-5",children:[(0,d.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 mb-2",children:"Navigation"}),(0,d.jsx)("div",{className:"space-y-0.5",children:cH.map((e,t)=>(0,d.jsx)(cG,{shortcut:e},t))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 mb-2",children:"Actions"}),(0,d.jsx)("div",{className:"space-y-0.5",children:cX.map((e,t)=>(0,d.jsx)(cG,{shortcut:e},t))})]}),(0,d.jsxs)("div",{className:"mt-5 pt-4 border-t border-slate-800 text-xs text-slate-500 text-center",children:["Chords: press ",(0,d.jsx)(cY,{children:"g"})," then a letter within 500ms"]})]})}):null}let cZ=(0,rP.default)(()=>e.A(9070),{loadableGenerated:{modules:[13213]},ssr:!1,loading:()=>(0,d.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,d.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Graph..."})})}),c0=(0,rP.default)(()=>e.A(62838).then(e=>e.BrainControlCentre),{loadableGenerated:{modules:[41740]},ssr:!1,loading:()=>(0,d.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,d.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Brain Control Centre..."})})});function c1(){let e,[t,s]=(0,u.useState)(""),[a,i]=(0,u.useState)(!1),[r,n]=(0,u.useState)(!1),[l,o]=(0,u.useState)(void 0),[c,h]=(0,u.useState)(void 0),m=(0,u.useRef)(null),x=(0,u.useRef)(null),p=rE(t,300),{viewMode:f,setViewMode:g,selectedMemory:y,setSelectedMemory:v,selectedAuditEntry:b,setSelectedAuditEntry:j,projectFilter:w,setProjectFilter:N,addEvent:k}=(0,rM.useDashboardStore)(),{showHelp:S,setShowHelp:C}=function(e){let{onFocusSearch:t,onClosePanel:s,onNavigate:a,onToggleHelp:i}=e,[r,n]=(0,u.useState)(!1),l=(0,u.useRef)(null),o=(0,u.useCallback)(e=>{let o=e.target,c=o.tagName.toLowerCase(),d="input"===c||"textarea"===c||"select"===c||o.isContentEditable;if("Escape"===e.key)return r?void n(!1):d?void o.blur():void s();if(d)return;if("/"===e.key){e.preventDefault(),t();return}if("?"===e.key){e.preventDefault(),n(e=>!e),i();return}let u=Date.now(),h=l.current;if("g"===e.key){if(h&&"g"===h.key&&u-h.time<500){l.current=null,a("graph");return}l.current={key:"g",time:u};return}if(h&&"g"===h.key&&u-h.time<500){l.current=null;let t={s:"shield",m:"memories",t:"timeline",a:"audit",b:"brain",d:"dome"}[e.key];if(t)return void a(t)}l.current=null},[t,s,a,i,r]);return(0,u.useEffect)(()=>(document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)),[o]),{showHelp:r,setShowHelp:n}}({onFocusSearch:(0,u.useCallback)(()=>{m.current?.focus()},[]),onClosePanel:(0,u.useCallback)(()=>{v(null),j(null)},[v,j]),onNavigate:(0,u.useCallback)(e=>{g(e)},[g]),onToggleHelp:()=>{}}),{data:T=[]}=(e=rE(t,200),(0,rD.useQuery)({queryKey:["suggestions",e],queryFn:()=>rR(e),enabled:e.length>=2,staleTime:3e4,refetchOnWindowFocus:!1})),{data:P}=(0,rA.useProjects)();(0,u.useEffect)(()=>{let e=e=>{x.current&&!x.current.contains(e.target)&&m.current&&!m.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let{data:A=[],isLoading:E,isConnected:D,lastEvent:L}=(0,rA.useMemoriesWithRealtime)({limit:1e3,query:p||void 0,mode:p?"search":"recent",project:w||void 0,type:l,category:c}),{data:F,isLoading:R}=(0,rA.useStats)(w||void 0),{data:$=[]}=(0,rA.useMemoryLinks)(w||void 0),z=(0,u.useRef)(L);(0,u.useEffect)(()=>{!L||L===z.current||(z.current=L,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(L.type)&&k({type:L.type,timestamp:L.timestamp,data:L.data}))},[L,k]);let _=(0,rA.useAccessMemory)();(0,rA.useConsolidate)();let{data:V}=(0,rA.useControlStatus)();(0,rA.usePauseMemory)(),(0,rA.useResumeMemory)();let I=V?.paused??!1,{data:O}=ot(),B=O?.enabled&&O?.apiKeySet,U=l7(),q=V?.killSwitchActive??!1,K=e=>{let t=A.find(t=>t.id===e);t&&v(t)},W="shield"===f||"audit"===f||"quarantine"===f||"agents"===f||"skills"===f||"dome"===f;return(0,d.jsxs)("div",{className:"h-screen w-screen bg-slate-950 text-white overflow-hidden flex flex-col",children:[(0,d.jsxs)("header",{className:"h-14 border-b border-slate-800 flex items-center justify-between px-4 bg-slate-900/50 backdrop-blur-sm shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(ll,{size:20,className:"text-cyan-400"}),(0,d.jsx)("h1",{className:"text-xl font-bold bg-gradient-to-r from-cyan-400 via-blue-400 to-emerald-400 bg-clip-text text-transparent",children:"ShieldCortex"}),(0,d.jsx)("div",{title:B?"Connected to ShieldCortex Cloud":"Cloud sync not configured",children:(0,d.jsx)(lF,{size:16,className:B?"text-emerald-400":"text-slate-600"})})]}),(0,d.jsx)("select",{value:w||"",onChange:e=>N(e.target.value||null),className:"bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-1.5 focus:ring-cyan-500 focus:border-cyan-500",children:P?.projects.map(e=>(0,d.jsxs)("option",{value:e.project||"",children:[e.label," (",e.memory_count,")"]},e.project||"all"))}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(nH,{ref:m,type:"text",placeholder:"Search memories...",value:t,onChange:e=>{s(e.target.value),i(!0)},onFocus:()=>i(!0),onKeyDown:e=>{"Escape"===e.key&&i(!1)},className:"w-64 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:ring-cyan-500"}),a&&T.length>0&&(0,d.jsx)("div",{ref:x,className:"absolute top-full left-0 right-0 mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl overflow-hidden z-50",children:T.map((e,t)=>(0,d.jsxs)("button",{onClick:()=>{s(e.text),i(!1),m.current?.focus()},className:"w-full px-3 py-2 text-left hover:bg-slate-700 transition-colors flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-white text-sm truncate flex-1",children:e.text}),(0,d.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-600 text-slate-300",children:e.type})]},`${e.type}-${e.text}-${t}`))})]}),(0,d.jsxs)(nQ,{variant:"outline",size:"sm",onClick:()=>n(!r),className:`border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700 ${r?"bg-slate-700":""}`,title:"Filter memories by type and category",children:["Filters ",(l||c)&&"•"]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[q?(0,d.jsxs)("button",{onClick:()=>rM.useDashboardStore.getState().setViewMode("dome"),className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-600/20 border border-red-500/50 rounded-lg text-xs font-bold text-red-400 uppercase tracking-wider animate-pulse cursor-pointer",title:"Kill switch is active — click to view details",children:[(0,d.jsx)(cS,{size:14}),"Kill Switch Active"]}):(0,d.jsxs)("button",{onClick:()=>U.mutate(),disabled:U.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-600/10 border border-red-500/30 hover:bg-red-600/20 hover:border-red-500/50 disabled:opacity-50 rounded-lg text-xs font-medium text-red-400 transition-colors",title:"Emergency Stop — immediately halt all agent operations",children:[U.isPending?(0,d.jsx)(l$,{size:12,className:"animate-spin"}):(0,d.jsx)(cS,{size:14}),"Emergency Stop"]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400 px-2",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full ${q?"bg-red-500 animate-pulse":I?"bg-orange-500 animate-pulse":D?"bg-green-500":"bg-yellow-500"}`,title:q?"Kill switch active — all operations blocked":I?"Memory creation paused":D?"Real-time connected":"Polling mode"}),F?.total??A.length," memories"]})]})]}),r&&(0,d.jsxs)("div",{className:"h-12 border-b border-slate-800 flex items-center gap-4 px-4 bg-slate-900/30",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:"Type:"}),["short_term","long_term","episodic"].map(e=>(0,d.jsx)("button",{onClick:()=>o(l===e?void 0:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${l===e?"bg-blue-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e.replace("_","-")},e))]}),(0,d.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-slate-400",children:"Category:"}),["architecture","pattern","error","learning","preference","context"].map(e=>(0,d.jsx)("button",{onClick:()=>h(c===e?void 0:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${c===e?"bg-purple-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e},e))]}),(l||c)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,d.jsx)("button",{onClick:()=>{o(void 0),h(void 0)},className:"px-2 py-1 text-xs text-red-400 hover:text-red-300",children:"Clear all"})]})]}),(0,d.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,d.jsx)(ly,{}),(0,d.jsx)(M,{mode:"wait",children:(0,d.jsxs)(rT.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 relative overflow-hidden",children:["shield"===f&&(0,d.jsx)(oD,{}),"audit"===f&&(0,d.jsx)(oV,{}),"quarantine"===f&&(0,d.jsx)(oQ,{}),"brain"===f&&(0,d.jsx)(c0,{memories:A,links:$,stats:F,isLoading:E}),"graph"===f&&(0,d.jsx)(cZ,{}),"timeline"===f&&(0,d.jsx)(cQ,{}),"agents"===f&&(0,d.jsx)(cl,{}),"skills"===f&&(0,d.jsx)(cj,{}),"dome"===f&&(0,d.jsx)(cV,{}),"memories"===f&&(0,d.jsx)(n8,{memories:A,selectedMemory:y,onSelectMemory:e=>{v(e)}})]},f)}),y&&!W&&"brain"!==f&&"graph"!==f&&"timeline"!==f&&(0,d.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,d.jsx)(n2,{memory:y,links:$,memories:A,onClose:()=>v(null),onReinforce:e=>{_.mutate(e)},onSelectMemory:K,isReinforcing:_.isPending,reinforceSuccess:_.isSuccess})}),b&&"audit"===f&&(0,d.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,d.jsx)(oK,{entry:b,onClose:()=>j(null),onViewMemory:e=>{j(null),K(e),rM.useDashboardStore.getState().setViewMode("memories")}})})]}),(0,d.jsx)(cJ,{open:S,onClose:()=>C(!1)})]})}e.s(["default",()=>c1],23733)}]);