agmon 0.2.0 → 0.2.2
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +8 -8
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +15 -13
- package/.next/server/app/_not-found.segments/_full.segment.rsc +15 -13
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +8 -6
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/media/route.js.nft.json +1 -1
- package/.next/server/app/api/reports/tokens/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/transcript/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/transcript/route.js.nft.json +1 -1
- package/.next/server/app/api/traces/stream/route.js +1 -1
- package/.next/server/app/api/traces/stream/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/file-content/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
- package/.next/server/app/chat/page.js.nft.json +1 -1
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/chat.html +1 -1
- package/.next/server/app/chat.rsc +20 -19
- package/.next/server/app/chat.segments/_full.segment.rsc +20 -19
- package/.next/server/app/chat.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +22 -20
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +20 -18
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +10 -9
- package/.next/server/app/index.segments/_full.segment.rsc +20 -18
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/reports/page.js.nft.json +1 -1
- package/.next/server/app/reports/page_client-reference-manifest.js +1 -1
- package/.next/server/app/reports.html +1 -1
- package/.next/server/app/reports.rsc +4 -4
- package/.next/server/app/reports.segments/_full.segment.rsc +4 -4
- package/.next/server/app/reports.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/reports.segments/reports/__PAGE__.segment.rsc +6 -5
- package/.next/server/app/store/page.js.nft.json +1 -1
- package/.next/server/app/store/page_client-reference-manifest.js +1 -1
- package/.next/server/app/store.html +1 -1
- package/.next/server/app/store.rsc +5 -5
- package/.next/server/app/store.segments/_full.segment.rsc +5 -5
- package/.next/server/app/store.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/store.segments/store/__PAGE__.segment.rsc +7 -6
- package/.next/server/chunks/[root-of-the-server]__0dw97_pahi8uf._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0dw97_pahi8uf._.js.map +1 -0
- package/.next/server/chunks/_0ao-_t4jkb46h._.js +2 -2
- package/.next/server/chunks/_0ao-_t4jkb46h._.js.map +1 -1
- package/.next/server/chunks/_1-8ipqazoyrrk._.js +1 -1
- package/.next/server/chunks/_1-8ipqazoyrrk._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0i2rbwbkxbdog._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0i2rbwbkxbdog._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0qzscpxebh28_._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0qzscpxebh28_._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js +427 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js +427 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js.map +1 -0
- package/.next/server/chunks/ssr/_0e3frtjrk-wi9._.js +3 -0
- package/.next/server/chunks/ssr/_0e3frtjrk-wi9._.js.map +1 -0
- package/.next/server/chunks/ssr/_0h29jdf4relbq._.js +3 -0
- package/.next/server/chunks/ssr/_0h29jdf4relbq._.js.map +1 -0
- package/.next/server/chunks/ssr/_0zel-n0h--cnl._.js +3 -0
- package/.next/server/chunks/ssr/_0zel-n0h--cnl._.js.map +1 -0
- package/.next/server/chunks/ssr/_1487-zi23c5eb._.js +1 -1
- package/.next/server/chunks/ssr/_1487-zi23c5eb._.js.map +1 -1
- package/.next/server/chunks/ssr/_1vgwoe-shb9z7._.js +3 -0
- package/.next/server/chunks/ssr/_1vgwoe-shb9z7._.js.map +1 -0
- package/.next/server/chunks/ssr/_1zm4m-s8k7oe3._.js +3 -0
- package/.next/server/chunks/ssr/_1zm4m-s8k7oe3._.js.map +1 -0
- package/.next/server/chunks/ssr/_202tntue-jj6s._.js +3 -0
- package/.next/server/chunks/ssr/_202tntue-jj6s._.js.map +1 -0
- package/.next/server/chunks/ssr/{node_modules_1wlwrgnt65zus._.js → node_modules_00ebs67b4u61w._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0f773uqgzj7y7._.js → node_modules_01avo0bde3tpo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0z3elum1675ve._.js → node_modules_01l0208e5kqic._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1c8i3jrmo4393._.js → node_modules_033x29yqle_sj._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1kr1c-ncf8q9t._.js → node_modules_03wbg__aslvui._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_02jwra-d9iqim._.js → node_modules_06mgkab1v5iox._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0z7rdbaf13024._.js → node_modules_08-bqkrz7sh0l._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13nsmuhey_ti_._.js → node_modules_089w9jm7s2qa3._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0m3ihe65818y_._.js → node_modules_08q6a-f2itxyo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0__m9_odts7_e._.js → node_modules_0cy47-s63xjzh._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0b8ndnuql44z1._.js → node_modules_0czh0jcnsm5e6._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0fs8mckuwk2tj._.js → node_modules_0e6qoh__e4a69._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_05w7qhtrzvnk6._.js → node_modules_0fv321j1nslkb._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_061uaylfjwqk7._.js → node_modules_0g-wb7h-hsdwc._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ll-58c1c-qab._.js → node_modules_0hb0q0epwvp--._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0dq0dsblt-q0g._.js → node_modules_0l-y0kqtu_r3o._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1zs2nou5uogby._.js → node_modules_0l814qpw677vm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1xyxigbqzb8vs._.js → node_modules_0o63z1gd17rhb._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1-sz_-qddwilq._.js → node_modules_0oz_zzlh8exwx._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0oukyh0iq21ow._.js → node_modules_0so2agzqd9p8l._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_12qw2ucebdvol._.js → node_modules_0w2w61b8bh769._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1dff7b_kvngr-._.js → node_modules_0wd6szix_zku7._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0fd1swhk15cx3._.js → node_modules_0wp7omf0xblv8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0nde84kzuwv2n._.js → node_modules_0yayrqhzfk8wy._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0f4xh33v3iltc._.js → node_modules_0zb0i39mnjdf3._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1iovyom0-y7o_._.js → node_modules_10c51o2qv6mbi._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_02nv3yff2pqh8._.js → node_modules_10g1mmrf63d8a._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0-6sb1gkbjo93._.js → node_modules_152txg4c7ose3._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_12qn4bepdou5v._.js → node_modules_185fuy4cv7loa._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1-iyhsn_1p9nx._.js → node_modules_19vqq7rvf-_ar._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0hqa9oxz17hip._.js → node_modules_1hd7j-tdb8drq._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1rlnehdn16ay-._.js → node_modules_1hu83gui7_nj2._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_07maxxr-t28ql._.js → node_modules_1i3x2csuq_-jt._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0kovk4b6czb22._.js → node_modules_1j8hpoiygrs5e._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0zc49fdcopqu9._.js → node_modules_1l2g7btuh3e4s._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0t4h1rucl35hl._.js → node_modules_1n4kig4mj6n4s._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0vn0kjn_84lmn._.js → node_modules_1nz3ckv6tu_66._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0-nvg0c4pgfb8._.js → node_modules_1qnypguag6s_l._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1v4lexrfhnlhs._.js → node_modules_1r6w-jlme6d10._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1f4geuvkvlxj1._.js → node_modules_1s8oxeqa5_i3k._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1216007ogd5om._.js → node_modules_1tskcaktx6ods._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_02vtgweceovke._.js → node_modules_1xz1dstlo5ri-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1kv6lsckqs-m0._.js → node_modules_1zii7uk468cay._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0bmuudv_6eypr._.js → node_modules_katex_dist_katex_mjs_067omoj5szuys._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0qyy6pq9uzpk0._.js → node_modules_katex_dist_katex_mjs_1604s1ky8db8u._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_1d8fezw1qsiob._.js → node_modules_lucide-react_dist_esm_0-5bcc79665lq._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0-5bcc79665lq._.js.map +1 -0
- package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_0pezg1352q13j._.js → node_modules_lucide-react_dist_esm_0axoa1eg51x1-._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0axoa1eg51x1-._.js.map +1 -0
- package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_131i-tjzse3ye._.js → node_modules_lucide-react_dist_esm_18ei1-na3kusb._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_18ei1-na3kusb._.js.map +1 -0
- package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_1to-9cv1ysvs6._.js → node_modules_lucide-react_dist_esm_1tx493x2_auzs._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1tx493x2_auzs._.js.map +1 -0
- package/.next/server/chunks/ssr/node_modules_mermaid_dist_mermaid_core_mjs_06it7ktosm1dr._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_mermaid_dist_mermaid_core_mjs_06it7ktosm1dr._.js.map +1 -0
- package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js.map +1 -1
- package/.next/server/chunks/ssr/src_components_reports_TokenReportView_jsx_1g3p_enbbsadt._.js +1 -1
- package/.next/server/chunks/ssr/src_components_reports_TokenReportView_jsx_1g3p_enbbsadt._.js.map +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/0jo6fy2c_gmqn.js +1 -0
- package/.next/static/chunks/0r9apkv3exqv-.js +1 -0
- package/.next/static/chunks/1n_lb7wmn81jj.js +1 -0
- package/.next/static/chunks/2-w116ewoshm1.js +1 -0
- package/.next/static/chunks/23uup1e8841av.js +1 -0
- package/.next/static/chunks/2q9cwykv6ox1t.css +1 -0
- package/.next/static/chunks/2rx7xvi55ohln.js +1 -0
- package/.next/static/chunks/2zf44j8sjo0w0.js +425 -0
- package/.next/static/chunks/3rtpnpqd981z9.js +1 -0
- package/.next/trace +1 -1
- package/.next/trace-build +1 -1
- package/bin/cli.js +12 -0
- package/package.json +1 -1
- package/src/app/api/traces/stream/route.js +41 -5
- package/src/app/chat/page.js +14 -14
- package/src/app/globals.css +128 -0
- package/src/app/layout.js +8 -2
- package/src/app/page.js +18 -2
- package/src/components/chat/ChatMessageItem.js +12 -12
- package/src/components/chat/CodeBlock.js +5 -5
- package/src/components/chat/DiffViewer.js +27 -27
- package/src/components/chat/MarkdownRenderer.js +19 -19
- package/src/components/chat/SessionChatView.js +42 -42
- package/src/components/chat/SessionSearch.js +8 -8
- package/src/components/chat/ThinkingAccordion.js +3 -3
- package/src/components/chat/ToolCallCard.js +6 -6
- package/src/components/chat/ToolOutputView.js +19 -19
- package/src/components/factory/office-canvas.js +165 -3
- package/src/components/factory/scene/characters.js +267 -32
- package/src/components/layout/BottomPanel.jsx +6 -6
- package/src/components/layout/CommandPalette.jsx +12 -0
- package/src/components/layout/EditorTabs.jsx +17 -0
- package/src/components/layout/LayoutToggles.jsx +31 -2
- package/src/components/layout/LeftSidebar.jsx +88 -6
- package/src/components/layout/RightSidebar.jsx +8 -8
- package/src/components/layout/StatusBar.jsx +1 -1
- package/src/components/layout/TitleBar.jsx +76 -2
- package/src/components/layout/VSCodeWorkbench.jsx +99 -14
- package/src/components/store/Item3DRenderer.jsx +602 -48
- package/src/components/store/LiveFittingRoom.jsx +55 -791
- package/src/components/store/LiveReactAgent.jsx +1637 -0
- package/src/components/store/SupporterStoreModal.jsx +3 -2
- package/src/components/store/SupporterStoreView.jsx +94 -34
- package/src/components/theme/ThemeSettingsModal.jsx +40 -40
- package/src/components/ui/Button.jsx +4 -4
- package/src/components/ui/Input.jsx +1 -1
- package/src/components/ui/Modal.jsx +6 -6
- package/src/components/ui/Select.jsx +3 -3
- package/src/lib/catalog/auras.js +226 -1199
- package/src/lib/catalog/index.js +60 -1
- package/src/lib/catalog/pets.js +291 -2398
- package/src/lib/catalog/props.js +488 -4199
- package/src/lib/catalog/skins.js +773 -3249
- package/src/lib/catalog/trophies.js +226 -1199
- package/src/lib/mockTraces.js +28 -26
- package/src/lib/parsers/codexParser.js +373 -0
- package/src/lib/parsers/transcriptParser.js +35 -3
- package/src/lib/supporterStore.js +1 -1
- package/src/lib/traceContract.js +1 -1
- package/src/lib/useFactoryTraces.js +70 -5
- package/src/lib/watchers/antigravityWatcher.js +15 -1
- package/src/lib/watchers/claudeWatcher.js +86 -70
- package/src/lib/watchers/codexWatcher.js +482 -0
- package/src/lib/watchers/watcherManager.js +46 -30
- package/.next/server/chunks/src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js +0 -3
- package/.next/server/chunks/src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__19s2v5rryc14o._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__19s2v5rryc14o._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1_jerxrctq6ev._.js +0 -427
- package/.next/server/chunks/ssr/[root-of-the-server]__1_jerxrctq6ev._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1pvso-uyf--97._.js +0 -427
- package/.next/server/chunks/ssr/[root-of-the-server]__1pvso-uyf--97._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1y78dc7oiz7ks._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1y78dc7oiz7ks._.js.map +0 -1
- package/.next/server/chunks/ssr/_0ozao7omdwbvd._.js +0 -3
- package/.next/server/chunks/ssr/_0ozao7omdwbvd._.js.map +0 -1
- package/.next/server/chunks/ssr/_0rcmpdyxc1qwj._.js +0 -3
- package/.next/server/chunks/ssr/_0rcmpdyxc1qwj._.js.map +0 -1
- package/.next/server/chunks/ssr/_0wv0xnhun3mk7._.js +0 -3
- package/.next/server/chunks/ssr/_0wv0xnhun3mk7._.js.map +0 -1
- package/.next/server/chunks/ssr/_17rmaft1zusua._.js +0 -3
- package/.next/server/chunks/ssr/_17rmaft1zusua._.js.map +0 -1
- package/.next/server/chunks/ssr/_1e-d4pcj59a7a._.js +0 -3
- package/.next/server/chunks/ssr/_1e-d4pcj59a7a._.js.map +0 -1
- package/.next/server/chunks/ssr/_1qr5gnh64z8pg._.js +0 -3
- package/.next/server/chunks/ssr/_1qr5gnh64z8pg._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0pezg1352q13j._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_131i-tjzse3ye._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1d8fezw1qsiob._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1to-9cv1ysvs6._.js.map +0 -1
- package/.next/static/chunks/0_3s_e4gd9xl0.js +0 -1
- package/.next/static/chunks/0i4kx4yl-dwfg.js +0 -425
- package/.next/static/chunks/0z0jbobmmvqoc.js +0 -1
- package/.next/static/chunks/1_a_gmob5qzho.js +0 -1
- package/.next/static/chunks/1ifqr4qo4697b.js +0 -1
- package/.next/static/chunks/2ccq9i8ev4dsx.js +0 -1
- package/.next/static/chunks/2mif7onk_9jy-.css +0 -1
- package/.next/static/chunks/40wyf-mv0tiu3.js +0 -1
- /package/.next/server/chunks/ssr/{node_modules_1c8i3jrmo4393._.js.map → node_modules_00ebs67b4u61w._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0f773uqgzj7y7._.js.map → node_modules_01avo0bde3tpo._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0z3elum1675ve._.js.map → node_modules_01l0208e5kqic._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1wlwrgnt65zus._.js.map → node_modules_033x29yqle_sj._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1kr1c-ncf8q9t._.js.map → node_modules_03wbg__aslvui._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_02jwra-d9iqim._.js.map → node_modules_06mgkab1v5iox._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0fs8mckuwk2tj._.js.map → node_modules_08-bqkrz7sh0l._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0-6sb1gkbjo93._.js.map → node_modules_089w9jm7s2qa3._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_02vtgweceovke._.js.map → node_modules_08q6a-f2itxyo._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0__m9_odts7_e._.js.map → node_modules_0cy47-s63xjzh._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_02nv3yff2pqh8._.js.map → node_modules_0czh0jcnsm5e6._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0z7rdbaf13024._.js.map → node_modules_0e6qoh__e4a69._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0-nvg0c4pgfb8._.js.map → node_modules_0fv321j1nslkb._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_061uaylfjwqk7._.js.map → node_modules_0g-wb7h-hsdwc._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0t4h1rucl35hl._.js.map → node_modules_0hb0q0epwvp--._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0dq0dsblt-q0g._.js.map → node_modules_0l-y0kqtu_r3o._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0zc49fdcopqu9._.js.map → node_modules_0l814qpw677vm._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1xyxigbqzb8vs._.js.map → node_modules_0o63z1gd17rhb._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1-iyhsn_1p9nx._.js.map → node_modules_0oz_zzlh8exwx._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0oukyh0iq21ow._.js.map → node_modules_0so2agzqd9p8l._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_07maxxr-t28ql._.js.map → node_modules_0w2w61b8bh769._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1dff7b_kvngr-._.js.map → node_modules_0wd6szix_zku7._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0fd1swhk15cx3._.js.map → node_modules_0wp7omf0xblv8._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0nde84kzuwv2n._.js.map → node_modules_0yayrqhzfk8wy._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0f4xh33v3iltc._.js.map → node_modules_0zb0i39mnjdf3._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1-sz_-qddwilq._.js.map → node_modules_10c51o2qv6mbi._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0b8ndnuql44z1._.js.map → node_modules_10g1mmrf63d8a._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_13nsmuhey_ti_._.js.map → node_modules_152txg4c7ose3._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_12qn4bepdou5v._.js.map → node_modules_185fuy4cv7loa._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1iovyom0-y7o_._.js.map → node_modules_19vqq7rvf-_ar._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0hqa9oxz17hip._.js.map → node_modules_1hd7j-tdb8drq._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1rlnehdn16ay-._.js.map → node_modules_1hu83gui7_nj2._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_12qw2ucebdvol._.js.map → node_modules_1i3x2csuq_-jt._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0kovk4b6czb22._.js.map → node_modules_1j8hpoiygrs5e._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1ll-58c1c-qab._.js.map → node_modules_1l2g7btuh3e4s._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1zs2nou5uogby._.js.map → node_modules_1n4kig4mj6n4s._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0vn0kjn_84lmn._.js.map → node_modules_1nz3ckv6tu_66._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_05w7qhtrzvnk6._.js.map → node_modules_1qnypguag6s_l._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1v4lexrfhnlhs._.js.map → node_modules_1r6w-jlme6d10._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1f4geuvkvlxj1._.js.map → node_modules_1s8oxeqa5_i3k._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1216007ogd5om._.js.map → node_modules_1tskcaktx6ods._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0m3ihe65818y_._.js.map → node_modules_1xz1dstlo5ri-._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1kv6lsckqs-m0._.js.map → node_modules_1zii7uk468cay._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0bmuudv_6eypr._.js.map → node_modules_katex_dist_katex_mjs_067omoj5szuys._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0qyy6pq9uzpk0._.js.map → node_modules_katex_dist_katex_mjs_1604s1ky8db8u._.js.map} +0 -0
- /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → dGN2VKPk5TJgezxS3JvRc}/_buildManifest.js +0 -0
- /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → dGN2VKPk5TJgezxS3JvRc}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → dGN2VKPk5TJgezxS3JvRc}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,74647,e=>{"use strict";let t,s,r,i;var l,n,a=e.i(18050),o=e.i(71645),c=e.i(68590),d=e.i(37750),h=e.i(95925);function u(e){let t=(0,o.useId)();return`${e??t}`}let x="u">typeof window?o.useLayoutEffect:o.useEffect;function f(e){let t=(0,o.useRef)(e);return x(()=>{t.current=e},[e]),(0,o.useCallback)((...e)=>t.current?.(...e),[t])}function p(...e){return f(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function m(e,t="Assertion error"){if(!e)throw Error(t)}(0,o.createContext)(null);class g{#e={};addListener(e,t){let s=this.#e[e];return void 0===s?this.#e[e]=[t]:s.includes(t)||s.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let s=this.#e[e];if(void 0!==s)if(1===s.length)s[0].call(null,t);else{let e=!1,r=null,i=Array.from(s);for(let s=0;s<i.length;s++){let l=i[s];try{l.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let s=this.#e[e];if(void 0!==s){let e=s.indexOf(t);e>=0&&s.splice(e,1)}}}let b={cursorFlags:0,state:"inactive"},y=new g;function v(e){return y.addListener("change",e)}function w(e){let t=b;b=e,"active"===t.state&&"active"!==e.state&&t.didPointerMove&&t.hitRegions.forEach(({separator:e})=>{e&&e.element.ownerDocument.activeElement===e.element&&e.element.blur()}),y.emit("change",{prev:t,next:e})}let j=e=>e,k=()=>{};function S(){return void 0===s&&(s=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(s=!0)),s}let N=new WeakMap;function C(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:s}=N.get(e)??{};void 0===s&&(s=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(s):e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]));let r=b;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,axes:t,state:s}){let r=0,i=0;switch(s){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":i++}})}if(0!==r||0!==i){if("active"===s&&e&&S()){let t=(4&e)!=0,s=(8&e)!=0;if((1&e)!=0)return t?"se-resize":s?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":s?"nw-resize":"w-resize";if(t)return"s-resize";if(s)return"n-resize"}return S()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,axes:r.hitRegions.map(e=>e.axis),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?0===s.cssRules.length?s.insertRule(i):s.replaceSync(i):1===s.cssRules.length&&s.deleteRule(0);break}case"inactive":t=void 0,1===s.cssRules.length&&s.deleteRule(0)}N.set(e,{prevStyle:t,styleSheet:s})}function T({axis:e}){let{layoutStrategy:t,orientation:s,items:r}=e;return t?t.calculateAvailableSize():r.reduce((e,t)=>e+="horizontal"===s?t.element.offsetWidth:t.element.offsetHeight,0)}function M(e,t){let s=e.compareDocumentPosition(t);return s&Node.DOCUMENT_POSITION_DISCONNECTED?0:s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0}function _(e,t){return Array.from(t).sort((t,s)=>{var r,i,l,n;let a,o,c="horizontal"===e?(r=t,i=s,0!=(a=r.element.offsetLeft-i.element.offsetLeft)?a:r.element.offsetWidth-i.element.offsetWidth):(l=t,n=s,0!=(o=l.element.offsetTop-n.element.offsetTop)?o:l.element.offsetHeight-n.element.offsetHeight);return 0!==c?c:M(t.element,s.element)})}function z(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function R(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function I({expandHitTargets:e=!0,axis:s,includeDisabled:r=!1}){if(s.layoutStrategy)return s.layoutStrategy.calculateHitRegions({expandHitTargets:e,axis:s,includeDisabled:r});let{element:i,orientation:l,items:n,separators:a}=s,o=_(l,Array.from(i.children).filter(z).filter(e=>!e.hasAttribute("data-resize-preview")).map(e=>({element:e}))).map(({element:e})=>e),c=[],d=!1,h=!1,u=-1,x,f=-1,p=0,g,b=[];{let e=-1;for(let t of o)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(p++,-1===u&&(u=e),f=e))}if(r||p>1){let i=-1;for(let p of o)if(p.hasAttribute("data-panel")){i++;let a=n.find(e=>e.element===p);if(a){if(g){let n,o=g.element.getBoundingClientRect(),y=p.getBoundingClientRect();if(h){let e="horizontal"===l?new DOMRect(o.right,o.top,0,o.height):new DOMRect(o.left,o.bottom,o.width,0),t="horizontal"===l?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(b.length){case 0:n=[e,t];break;case 1:{let s=b[0],r=function({orientation:e,rects:t,targetRect:s}){let r={x:s.x+s.width/2,y:s.y+s.height/2},i,l=Number.MAX_VALUE;for(let s of t){let{x:t,y:n}=R(r,s),a="horizontal"===e?t:n;a<l&&(l=a,i=s)}return m(i,"No rect found"),i}({orientation:l,rects:[o,y],targetRect:s.element.getBoundingClientRect()});n=[s,r===o?t:e];break}default:n=b}}else n=b.length?b:["horizontal"===l?new DOMRect(o.right,y.top,y.left-o.right,y.height):new DOMRect(y.left,o.bottom,y.width,y.top-o.bottom)];for(let l of n){let n=function({expandHitTargets:e,axis:s,rect:r}){let i=e?(void 0===t&&(t="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),t)?s.resizeTargetMinimumSize.coarse:s.resizeTargetMinimumSize.fine:0;if(r.width<i){let e=i-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<i){let e=i-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}return r}({expandHitTargets:e,axis:s,rect:"width"in l?l:l.element.getBoundingClientRect()}),o=i<=u||i>f;!r&&(d||o)||(x??=T({axis:s}),c.push({axis:s,axisSize:x,items:[g,a],separator:"width"in l?void 0:l,rect:n})),d=!1}}h=!1,g=a,b=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(d=!0);let e=a.find(e=>e.element===p);e?b.push(e):(g=void 0,b=[])}else h=!0}return c}function L({axisSize:e,itemElement:t,styleProp:s}){let r,[i,l]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(s);switch(l){case"%":r=i/100*e;break;case"px":r=i;break;case"rem":r=i*parseFloat(getComputedStyle(t.ownerDocument.documentElement).fontSize);break;case"em":r=i*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=i/100*window.innerHeight;break;case"vw":r=i/100*window.innerWidth}return r}function E(e){return parseFloat(e.toFixed(3))}function A(e){let{items:t}=e,s=T({axis:e});return 0===s?t.map(e=>({groupResizeBehavior:e.constraintProps.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.constraintProps.collapsible,defaultSize:void 0,disabled:e.constraintProps.disabled,minSize:0,maxSize:100,itemId:e.id})):t.map(e=>{let t,r,{element:i,constraintProps:l}=e,n=0;void 0!==l.collapsedSize&&(n=E(L({axisSize:s,itemElement:i,styleProp:l.collapsedSize})/s*100)),void 0!==l.collapsedThreshold&&(t=E(L({axisSize:s,itemElement:i,styleProp:l.collapsedThreshold})/s*100)),void 0!==l.defaultSize&&(r=E(L({axisSize:s,itemElement:i,styleProp:l.defaultSize})/s*100));let a=0;void 0!==l.minSize&&(a=E(L({axisSize:s,itemElement:i,styleProp:l.minSize})/s*100));let o=100;return void 0!==l.maxSize&&(o=E(L({axisSize:s,itemElement:i,styleProp:l.maxSize})/s*100)),{groupResizeBehavior:l.groupResizeBehavior,collapsedSize:n,collapsedThreshold:t,collapsible:!0===l.collapsible,defaultSize:r,disabled:l.disabled,minSize:a,maxSize:o,itemId:e.id}})}let P=new Map,$=new g;function O(e,t){for(let[t]of P)if(t.id===e)return t}function F(e,t){for(let[t,s]of P)if(t.id===e)return s;if(t)throw Error(`Could not find data for Group with id ${e}`)}function W(e,t){return $.addListener("axisChange",s=>{s.axis.id===e&&t(s)})}function D(e,t,s){let r=P.get(e);(P=new Map(P)).set(e,t),$.emit("axisChange",{axis:e,isUserInteraction:s?.isUserInteraction===!0,prev:r,next:t})}function V(e,t,s=0){return Math.abs(E(e)-E(t))<=s}function B(e,t){return V(e,t)?0:e>t?1:-1}function H({overrideDisabledItems:e,itemConstraints:t,prevSize:s,size:r}){let{collapsedSize:i=0,collapsedThreshold:l,collapsible:n,disabled:a,maxSize:o=100,minSize:c=0}=t;if(a&&!e)return s;if(0>B(r,c))if(n){let e=l??(c-i)/2,t=0>=B(s,i),n=B(r,t?i+e:c-e);r=0>=B(r,i)||n<0||void 0!==l&&t&&0===n?i:c}else r=c;return E(r=Math.min(o,r))}function U({delta:e,initialLayout:t,itemConstraints:s,pivotIndices:r,prevLayout:i,trigger:l}){if(V(e,0))return t;let n="imperative-api"===l,a=s.map(({itemId:e})=>t[e]),o=s.map(({itemId:e})=>i[e]),c=[...a],[d,h]=r;m(null!=d,"Invalid first pivot index"),m(null!=h,"Invalid second pivot index");let u=0;if("keyboard"===l){{let t=e<0?h:d,r=s[t];m(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:l,minSize:n=0}=r;if(l){let s=a[t];if(m(null!=s,`Previous layout not found for panel index ${t}`),V(s,i)){let t=n-s;B(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:h,r=s[t];m(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:l,minSize:n=0}=r;if(l){let s=a[t];if(m(null!=s,`Previous layout not found for panel index ${t}`),V(s,n)){let t=s-i;B(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?h:d,r=s[t];m(r,`Panel constraints not found for index ${t}`);let i=a[t],{collapsedSize:l,collapsedThreshold:n,collapsible:o,minSize:c}=r;if(o&&0>B(i,c)){let t=c-l;if(0>B(i+Math.abs(e),c)){let s=B(Math.abs(e),n??t/2),r=void 0===n&&e<0;e=s>0||0===s&&r?e<0?-t:t:0}}}{let t=e<0?1:-1,r=e<0?h:d,i=0;for(;;){let e=a[r];if(m(null!=e,`Previous layout not found for panel index ${r}`),i+=H({overrideDisabledItems:n,itemConstraints:s[r],prevSize:e,size:100})-e,(r+=t)<0||r>=s.length)break}let l=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-l:l}{let t=e<0?d:h;for(;t>=0&&t<s.length;){let r=Math.abs(e)-Math.abs(u),i=a[t];m(null!=i,`Previous layout not found for panel index ${t}`);let l=i-r,o=H({overrideDisabledItems:n,itemConstraints:s[t],prevSize:i,size:l});if(!V(i,o)&&(u+=i-o,c[t]=o,u.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=t[s])return!1;return!0}(o,c))return i;{let t=e<0?h:d,r=a[t];m(null!=r,`Previous layout not found for panel index ${t}`);let i=r+u,l=H({overrideDisabledItems:n,itemConstraints:s[t],prevSize:r,size:i});if(c[t]=l,!V(l,i)){let t=i-l,r=e<0?h:d;for(;r>=0&&r<s.length;){let i=c[r];m(null!=i,`Previous layout not found for panel index ${r}`);let l=i+t,a=H({overrideDisabledItems:n,itemConstraints:s[r],prevSize:i,size:l});if(V(i,a)||(t-=a-i,c[r]=a),V(t,0))break;e>0?r--:r++}}}return V(Object.values(c).reduce((e,t)=>t+e,0),100,.1)?c.reduce((e,t,r)=>(e[s[r].itemId]=t,e),{}):i}function q(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let s in e)if(void 0===t[s]||0!==B(e[s],t[s]))return!1;return!0}function G({commit:e,document:t,event:s,hitRegions:r,initialLayoutMap:i,mountedAxes:l,pointerDownAtPoint:n,prevCursorFlags:a}){let o=0,c=b,d="active"===c.state?c.previews:[],h=new Map("active"===c.state?c.previewLayoutMap:void 0);r.forEach(t=>{let{axis:r,axisSize:a}=t,{orientation:c,items:u}=r;if(e&&"separator"!==r.resizePreviewMode)return;let{disableCursor:x}=r.mutableState,f=0;f=n?"horizontal"===c?(s.clientX-n.x)/a*100:(s.clientY-n.y)/a*100:"horizontal"===c?s.clientX<0?-100:100:s.clientY<0?-100:100;let p=i.get(r),m=l.get(r);if(!p||!m)return;let{defaultLayoutDeferred:g,derivedItemConstraints:b,axisSize:y,layout:v,separatorToItems:w}=m;if(b&&v&&w){let s="separator"===r.resizePreviewMode?h.get(r)??v:v,i=U({delta:f,initialLayout:p,itemConstraints:b,pivotIndices:t.items.map(e=>u.indexOf(e)),prevLayout:s,trigger:"mouse-or-touch"});if("separator"===r.resizePreviewMode&&!e&&!q(i,s)){h.set(r,i);let e=0,t=u.map(t=>a/100*(e+=i[t.id]-p[t.id]));d=d.map(e=>{if(e.axis!==r)return e;let s=t[e.itemIndex];return s===e.offset?e:{...e,offset:s}})}if(q(i,s)&&0!==f&&!x)switch(c){case"horizontal":o|=f<0?1:2;break;case"vertical":o|=f<0?4:8}("separator"!==r.resizePreviewMode||e)&&!q(i,v)&&D(t.axis,{defaultLayoutDeferred:g,derivedItemConstraints:b,axisSize:y,layout:i,requestedAxisSize:y,requestedLayout:i,separatorToItems:w})}});let u=0;0===s.movementX?u|=3&a:u|=3&o,0===s.movementY?u|=12&a:u|=12&o;let x="active"===c.state&&(s.clientX!==c.pointerDownAtPoint.x||s.clientY!==c.pointerDownAtPoint.y);(function(e,t=[],s,r=!1){let i=b,l={...b};l.cursorFlags=e,"active"===l.state&&(l.didPointerMove||=r,l.previews=t,s&&(l.previewLayoutMap=s)),b=l,y.emit("change",{prev:i,next:l})})(u,d,h,x),C(t)}function Y(e,t){let s=b,r=P,i=!1;return"active"===s.state&&(G({commit:!0,document:e,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedAxes:r,pointerDownAtPoint:s.pointerDownAtPoint,prevCursorFlags:s.cursorFlags}),w({cursorFlags:0,state:"inactive"}),s.hitRegions.length>0&&(C(e),i=!0,s.hitRegions.forEach(e=>{if(!r.has(e.axis))return;let t=F(e.axis.id,!0);D(e.axis,t,{isUserInteraction:!0})}))),i}function X(e){e.defaultPrevented||Y(e.currentTarget,e)}let K=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function J(e){let t=e.length;for(;t--;){let s=e[t];if(m(s,"Missing node"),function(e){let t,s=getComputedStyle(e);return!!("fixed"===s.position||"auto"!==s.zIndex&&("static"!==s.position||"flex"===(t=getComputedStyle(ee(e)??e).display)||"inline-flex"===t)||1>+s.opacity||"transform"in s&&"none"!==s.transform||"webkitTransform"in s&&"none"!==s.webkitTransform||"mixBlendMode"in s&&"normal"!==s.mixBlendMode||"filter"in s&&"none"!==s.filter||"webkitFilter"in s&&"none"!==s.webkitFilter||"isolation"in s&&"isolate"===s.isolation||K.test(s.willChange)||"touch"===s.webkitOverflowScrolling)}(s))return s}return null}function Z(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Q(e){let t=[];for(;e;)t.push(e),e=ee(e);return t}function ee(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function et(e,t){let s=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=I({axis:r}),l=function(e,t,s){let r,i={x:1/0,y:1/0};for(let l of t){let t=R(s,l.rect);switch(e){case"horizontal":(t.x<i.x||t.x===i.x&&t.y<=i.y)&&(r=l,i=t);break;case"vertical":(t.y<i.y||t.y===i.y&&t.x<=i.x)&&(r=l,i=t)}}return r?{distance:i,hitRegion:r}:void 0}(r.orientation,i,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&function({axisElement:e,hitRegion:t,pointerEventTarget:s}){if(z(s)){let t=s.closest("dialog");if(t&&!t.contains(e)&&function(e){try{return e.matches(":modal")}catch{return!1}}(t))return!1}if(!z(s)||s.contains(e)||e.contains(s))return!0;if(function(e,t){let s;if(e===t)throw Error("Cannot compare node with itself");let r={a:Q(e),b:Q(t)};for(;r.a.at(-1)===r.b.at(-1);)s=r.a.pop(),r.b.pop();m(s,"Stacking order can only be calculated for elements with a common ancestor");let i={a:Z(J(r.a)),b:Z(J(r.b))};if(i.a===i.b){let e=s.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},i=e.length;for(;i--;){let s=e[i];if(s===t.a)return 1;if(s===t.b)return -1}}return Math.sign(i.a-i.b)}(s,e)>0){let i=s;for(;i;){var r;if(i.contains(e))break;if(r=i.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;i=i.parentElement}}return!0}({axisElement:r.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&s.push(l.hitRegion)}),s}function es({layout:e,itemConstraints:t}){let s=t.map(({itemId:t})=>e[t]),r=[...s],i=r.reduce((e,t)=>e+t,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(e=>`${e}%`).join(", ")}`);if(!V(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];m(null!=t,`No layout data found for index ${e}`);let s=100/i*t;r[e]=s}let l=0;for(let e=0;e<t.length;e++){let i=s[e];m(null!=i,`No layout data found for index ${e}`);let n=r[e];m(null!=n,`No layout data found for index ${e}`);let a=H({overrideDisabledItems:!0,itemConstraints:t[e],prevSize:i,size:n});n!=a&&(l+=n-a,r[e]=a)}if(!V(l,0))for(let e=0;e<t.length;e++){let s=r[e];m(null!=s,`No layout data found for index ${e}`);let i=s+l,n=H({overrideDisabledItems:!0,itemConstraints:t[e],prevSize:s,size:i});if(s!==n&&(l-=n-s,r[e]=n,V(l,0)))break}return r.reduce((e,s,r)=>(e[t[r].itemId]=s,e),{})}function er({axisId:e,itemId:t}){let s=()=>{for(let[t,{defaultLayoutDeferred:s,derivedItemConstraints:r,layout:i,axisSize:l,separatorToItems:n}]of P)if(t.id===e)return{defaultLayoutDeferred:s,derivedItemConstraints:r,axis:t,axisSize:l,layout:i,separatorToItems:n};throw Error(`Group ${e} not found`)},r=()=>{let e=s().derivedItemConstraints.find(e=>e.itemId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=s().axis.items.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},l=()=>{let e=s().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},n=e=>{if(e===l())return;let{defaultLayoutDeferred:r,derivedItemConstraints:i,axis:n,axisSize:a,layout:o,separatorToItems:c}=s(),d=es({layout:(({nextSize:e,items:s,prevLayout:r,derivedItemConstraints:i})=>{let n=l(),a=s.findIndex(e=>e.id===t),o=0===a,c=a===s.length-1;if(c&&e<n&&(o||s.slice(0,a).every((e,t)=>{let s=i[t];return s?.collapsible&&V(s.collapsedSize,r[s.itemId])}))){let e=s.slice(0,a).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:E(100-e)}}return U({delta:c?n-e:e-n,initialLayout:r,itemConstraints:i,pivotIndices:c?[a-1,a]:[a,a+1],prevLayout:r,trigger:"imperative-api"})})({nextSize:e,items:n.items,prevLayout:o,derivedItemConstraints:i}),itemConstraints:i});q(o,d)||D(n,{defaultLayoutDeferred:r,derivedItemConstraints:i,axisSize:a,layout:d,requestedAxisSize:a,requestedLayout:d,separatorToItems:c})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:s}=i(),a=l();e&&a!==t&&(s.expandToSize=a,n(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:s}=r(),{mutableValues:a}=i(),o=l();if(e&&o===t){let e=a.expandToSize??s;0===e&&(e=1),n(e)}},getSize:()=>{let{axis:e}=s(),r=l(),{element:n}=i();return{asPercentage:r,inPixels:e.layoutStrategy?e.layoutStrategy.getItemSizeInPixels(t):"horizontal"===e.orientation?n.offsetWidth:n.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),s=l();return e&&V(t,s)},resize:e=>{let{axis:t}=s(),{element:r}=i(),l=T({axis:t});n(E(L({axisSize:l,itemElement:r,styleProp:e})/l*100))}}}function ei(e){e.defaultPrevented||et(e,P).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let s=t.items.find(e=>void 0!==e.constraintProps.defaultSize);if(s){let r=s.constraintProps.defaultSize,i=er({axisId:t.axis.id,itemId:s.id});i&&void 0!==r&&(i.resize(r),e.preventDefault())}}})}function el(e){for(let[t]of P)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function en({axisId:e}){let t=()=>{for(let[t,s]of P)if(t.id===e)return{axis:t,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:s}=t();return e?{}:s},setLayout(e){let{defaultLayoutDeferred:s,derivedItemConstraints:r,axis:i,axisSize:l,layout:n,separatorToItems:a}=t(),o=es({layout:e,itemConstraints:r});return s?n:(q(n,o)||D(i,{defaultLayoutDeferred:s,derivedItemConstraints:r,axisSize:l,layout:o,requestedAxisSize:l,requestedLayout:o,separatorToItems:a}),o)}}}function ea(e,t){let s=el(e),r=F(s.id,!0),i=s.separators.find(t=>t.element===e);m(i,"Matching separator not found");let l=r.separatorToItems.get(i);m(l,"Matching panels not found");let n=l.map(e=>s.items.indexOf(e)),a=en({axisId:s.id}).getLayout(),o=es({layout:U({delta:t,initialLayout:a,itemConstraints:r.derivedItemConstraints,pivotIndices:n,prevLayout:a,trigger:"keyboard"}),itemConstraints:r.derivedItemConstraints});q(a,o)||D(s,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedItemConstraints:r.derivedItemConstraints,axisSize:r.axisSize,layout:o,requestedAxisSize:r.axisSize,requestedLayout:o,separatorToItems:r.separatorToItems},{isUserInteraction:!0})}function eo(e){if(e.defaultPrevented)return;let t=e.currentTarget,s=el(t);if(!(s.disabled||s.separators.find(e=>e.element===t)?.disabled))switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===s.orientation&&ea(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===s.orientation&&ea(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===s.orientation&&ea(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===s.orientation&&ea(t,-5);break;case"End":e.preventDefault(),ea(t,100);break;case"Enter":{e.preventDefault();let{derivedItemConstraints:r,layout:i,separatorToItems:l}=F(s.id,!0),n=s.separators.find(e=>e.element===t);m(n,"Matching separator not found");let a=l.get(n);m(a,"Matching panels not found");let o=a[0],c=r.find(e=>e.itemId===o.id);if(m(c,"Panel metadata not found"),c.collapsible){let e=i[o.id];ea(t,(c.collapsedSize===e?s.mutableState.expandedItemSizes[o.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let t=s.separators.map(e=>e.element),r=Array.from(t).findIndex(t=>t===e.currentTarget);m(null!==r,"Index not found");let i=e.shiftKey?r>0?r-1:t.length-1:r+1<t.length?r+1:0;t[i].focus({preventScroll:!0});break}case"Home":e.preventDefault(),ea(t,-100)}}function ec(e){let t=b;if("active"!==t.state)return!1;let s=P;return t.previewLayoutMap.forEach((e,t)=>{let r=s.get(t);"separator"===t.resizePreviewMode&&r&&!q(e,r.layout)&&D(t,{...r,layout:e,requestedAxisSize:r.axisSize,requestedLayout:e})}),w({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{if(!s.has(e.axis))return;let t=F(e.axis.id,!0);D(e.axis,t,{isUserInteraction:!0})}),C(e),!0}function ed(e){let t=b;if("active"!==t.state)return;let s=t.hitRegions.flatMap(({separator:e})=>e?[e.element]:[]);!s.some(t=>t===e.target)||s.some(t=>t.hasPointerCapture?.(e.pointerId))||ec(e.currentTarget)}function eh(e){ec(e.currentTarget)}function eu(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=P,s=et(e,t);if(0===s.length)return;let r=new Map,i=!1;s.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let s=t.get(e.axis);s&&r.set(e.axis,s.layout)});let l=Array.from(r.keys()).flatMap(e=>"separator"===e.resizePreviewMode?function(e,t){let{element:s,orientation:r,items:i}=e,l=s.getBoundingClientRect(),n="horizontal"===r;return I({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:r,rect:a,separator:o},c)=>{let d=i.indexOf(r[0]),h=n?a.left+a.width/2:a.top+a.height/2;return{active:t.some(t=>t.axis===e&&t.items[0]===r[0]&&(o||t.separator?t.separator===o:V(h,n?t.rect.left+t.rect.width/2:t.rect.top+t.rect.height/2))),axis:e,key:o?`separator-${o.id}`:`panel-${r[0].id}-${c}`,offset:0,itemIndex:d,rect:new DOMRect((n&&!o?h:a.left)-l.left-s.clientLeft+s.scrollLeft,(!n&&!o?h:a.top)-l.top-s.clientTop+s.scrollTop,n&&!o?0:a.width,!n&&!o?0:a.height),separator:o}})}(e,s):[]);w({cursorFlags:0,didPointerMove:!1,hitRegions:s,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(r),previews:l,state:"active"}),e.preventDefault()}function ex(e){let t=P,s=b;"active"===s.state&&G({commit:!1,document:e.currentTarget,event:e,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedAxes:t,prevCursorFlags:s.cursorFlags})}function ef(e){if(e.defaultPrevented)return;let t=b,s=P;if("active"===t.state){if(0===e.buttons)return void ec(e.currentTarget);for(let s of t.hitRegions)if(s.separator){let{element:t}=s.separator;t.isConnected&&!t.hasPointerCapture?.(e.pointerId)&&t.setPointerCapture?.(e.pointerId)}G({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedAxes:s,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=et(e,s);0===r.length?"inactive"!==t.state&&w({cursorFlags:0,state:"inactive"}):w({cursorFlags:0,hitRegions:r,state:"hover"}),C(e.currentTarget)}}function ep(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===b.state&&w({cursorFlags:0,state:"inactive"})}function em(e){e.defaultPrevented||("mouse"!==e.pointerType||!(e.button>0))&&Y(e.currentTarget,e)&&e.preventDefault()}function eg(e){e.target===e.currentTarget&&ec(e.currentTarget.document)}function eb({axis:e,itemConstraints:t}){let s=e.items.map(({id:e})=>e).join(","),r=e.mutableState.defaultLayout;return e.mutableState.layouts[s]??(r&&function(e,t){let s=e.map(e=>e.id),r=Object.keys(t);if(s.length!==r.length)return!1;for(let e of s)if(!r.includes(e))return!1;return!0}(e.items,r)?r:function(e){let t=0,s=0,r={};for(let i of e)if(void 0!==i.defaultSize){t++;let e=E(i.defaultSize);s+=e,r[i.itemId]=e}else r[i.itemId]=void 0;let i=e.length-t;if(0!==i){let t=E((100-s)/i);for(let s of e)void 0===s.defaultSize&&(r[s.itemId]=t)}return r}(t))}function ey({itemIds:e,layout:t}){return es({layout:t,itemConstraints:e.map(e=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:e,maxSize:100,minSize:0}))})}function ev(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let s in e)if(e[s]!==t[s])return!1;return!0}let ew=new Map;function ej(e){let t=(0,o.useRef)({...e});return x(()=>{for(let s in e)t.current[s]=e[s]},[e]),t.current}let ek=(0,o.createContext)(null);function eS({attributes:e,axisId:t,axisOrientation:s,children:r,className:i,disableCursor:l,disabled:n,disableDoubleClick:c,elementRef:d,id:h,isSharedHitRegion:u,preview:f,registerSeparator:m,requiredStyle:g,style:y,styleDefaults:j,tabIndex:k=0,updateSeparatorProps:S}){let N,C,T=ej({disabled:n,disableDoubleClick:c,children:r,className:i,preview:f,style:y}),[M,_]=(0,o.useState)({}),[z,R]=(0,o.useState)("inactive"),[I,L]=(0,o.useState)(!1),E=(0,o.useRef)(null),A=(0,o.useRef)(null),P=p(E,d);return x(()=>{let e=E.current;if(null!==e){let s={disabled:T.disabled,disableDoubleClick:T.disableDoubleClick,element:e,id:h,get children(){return T.children},get className(){return T.className},get preview(){return T.preview},get style(){return T.style}};A.current=s;let r=m(s),i=v(e=>{R("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===s||(u?.(e)??!1))?e.next.state:"inactive")}),l=W(t,e=>{let{derivedItemConstraints:t,layout:r,separatorToItems:i}=e.next,l=i.get(s);if(l){let s=l[0],i=t.findIndex(e=>e.itemId===s.id),{layoutStrategy:n}=e.axis;_({...function({layout:e,itemConstraints:t,itemId:s,itemIndex:r}){let i,l,n=e[s],a=t.find(e=>e.itemId===s);if(a){let o=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,d=[r,r+1];l=es({layout:U({delta:c-n,initialLayout:e,itemConstraints:t,pivotIndices:d,prevLayout:e}),itemConstraints:t})[s],i=es({layout:U({delta:o-n,initialLayout:e,itemConstraints:t,pivotIndices:d,prevLayout:e}),itemConstraints:t})[s]}return{valueControls:s,valueMax:i,valueMin:l,valueNow:n}}({layout:r,itemConstraints:t,itemId:s.id,itemIndex:i}),...n?.getItemAriaControls&&{valueControls:n.getItemAriaControls(s.id)}})}});return()=>{A.current=null,i(),l(),r()}}},[t,h,u,m,T]),x(()=>{let e=A.current;e&&"active"===b.state&&b.previews.some(t=>t.separator===e)&&w({...b,previews:b.previews.map(t=>t.separator===e?{...t}:t)})},[f]),(0,o.useEffect)(()=>{S(h,{disabled:n,disableDoubleClick:c})},[n,c,h,S]),n&&!l&&(N="not-allowed"),C=n?"disabled":"active"===z?"active":I?"focus":z,(0,a.jsx)("div",{...e,"aria-controls":M.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===s?"vertical":"horizontal","aria-valuemax":M.valueMax,"aria-valuemin":M.valueMin,"aria-valuenow":M.valueNow,children:r,className:i,"data-separator":C,"data-testid":h,id:h,onBlur:()=>L(!1),onFocus:()=>L(!0),ref:P,role:"separator",style:{...j,cursor:N,...y,...g,touchAction:"none"},tabIndex:n?void 0:k})}function eN({separator:e}){let{element:t}=e,s=(0,o.useRef)(null);return x(()=>{let e=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],i=[e,...e.querySelectorAll("*")],l=t.ownerDocument.defaultView;return r.forEach((e,t)=>{let s=i[t];if(s instanceof l.HTMLElement||s instanceof l.SVGElement){let t=l.getComputedStyle(e);for(let e=0;e<t.length;e++){let r=t.item(e);s.style.setProperty(r,t.getPropertyValue(r))}}s.removeAttribute("data-testid"),s.removeAttribute("id")}),Object.assign(e.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),s.current.appendChild(e),()=>e.remove()},[t]),(0,a.jsx)("div",{ref:s,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function eC(){let e=(0,o.useContext)(ek);return m(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function eT(e){let{registerOverlay:t}=eC(),s=(0,o.useRef)(e);ev(s.current,e)||(s.current=e);let r=s.current;return x(()=>t(r),[t,r]),null}function eM({active:e,orientation:t,style:s,...r}){let i;switch(t){case"horizontal":i={height:"100%",minWidth:"1px"};break;case"vertical":i={minHeight:"1px",width:"100%"}}return(0,a.jsx)("div",{...r,"data-separator-overlay":e?"active":"inactive",style:{...i,...s,flexShrink:0,pointerEvents:"none"}})}function e_({overlay:e,preview:t}){let{axis:s,offset:r,rect:i,separator:l}=t,n="horizontal"===s.orientation,c=l?.preview,d=e;return(0,o.isValidElement)(c)&&c.type===eT&&(d=c.props,c=void 0),null==c&&(d?c=(0,a.jsx)(eM,{...d,active:t.active,orientation:s.orientation}):l&&(c=(0,a.jsx)(eN,{separator:l}))),(0,a.jsx)("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:i.height,left:i.left,pointerEvents:"none",position:"absolute",top:i.top,transform:n?`translateX(${r}px)`:`translateY(${r}px)`,width:i.width},children:c})}function ez({children:e,className:t,defaultLayout:s,disableCursor:r,disabled:i,elementRef:l,groupRef:n,id:c,onLayoutChange:d,onLayoutChanged:h,orientation:g="horizontal",resizePreviewMode:y="panel",resizeTargetMinimumSize:k={coarse:20,fine:10},style:S,...N}){let z,R=(0,o.useRef)({onLayoutChange:{},onLayoutChanged:{}}),L=f(e=>{q(R.current.onLayoutChange,e)||(R.current.onLayoutChange=e,d?.(e))}),$=f((e,t,s)=>{q(R.current.onLayoutChanged,e)||(R.current.onLayoutChanged=e,h?.(e,{isUserInteraction:t,requestedLayout:s}))}),B=u(c),[H,U]=(0,o.useState)(),G=function({groupId:e,resizePreviewMode:t}){let[s,r]=(0,o.useState)([]),i=(0,o.useRef)(s);return x(()=>{let s=s=>{let l=O(e),n="separator"===t&&"active"===s.state?s.previews.filter(e=>e.axis===l&&(e.active||!V(e.offset,0))):[],a=i.current;a.length===n.length&&n.every((e,t)=>e===a[t])||(i.current=n,r(n))};if("separator"!==t)return void s(b);let l=v(({next:e})=>s(e));return s(b),l},[e,t]),s}({groupId:B,resizePreviewMode:y}),Y=(0,o.useRef)(null),[K,J]=function(){let[e,t]=(0,o.useState)({});return[e,(0,o.useCallback)(()=>t({}),[])]}(),Z=(0,o.useRef)([]),Q=(0,o.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),ee=p(Y,l);z=(0,o.useRef)({getLayout:()=>({}),setLayout:j}),(0,o.useImperativeHandle)(n,()=>z.current,[]),x(()=>{Object.assign(z.current,en({axisId:B}))});let et=f((e,t)=>{let r=F(e);return r?{flexGrow:r.layout[t]??1}:s?.[t]?{flexGrow:s?.[t]}:void 0}),er=ej({defaultLayout:s,disableCursor:r,resizeTargetMinimumSize:k}),el=(0,o.useMemo)(()=>({get disableCursor(){return!!er.disableCursor},getPanelStyles:et,id:B,orientation:g,registerPanel:e=>{let t=Q.current;return t.panels=_(g,[...t.panels,e]),J(),()=>{t.panels=t.panels.filter(t=>t!==e),J()}},registerOverlay:e=>(U(e),()=>{U(void 0)}),registerSeparator:e=>{let t=Q.current;return t.separators=_(g,[...t.separators,e]),J(),()=>{t.separators=t.separators.filter(t=>t!==e),J()}},updatePanelProps:(e,{disabled:t})=>{let s=Q.current.panels.find(t=>t.id===e);s&&(s.constraintProps.disabled=t);let r=O(B),i=F(B);r&&i&&D(r,{...i,derivedItemConstraints:A(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:s})=>{let r=Q.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=s)}}),[et,B,J,g,er]),ea=(0,o.useRef)(null);return x(()=>{var e;let t,s,r,l,n,a,o,c,d,h,u,x,f,p=Y.current;if(null===p)return;let v=Q.current;if(v.panels=_(g,v.panels),v.separators=_(g,v.separators),Z.current=Array.from([...v.panels.map(({element:e})=>e),...v.separators.map(({element:e})=>e)]).sort(M),void 0!==er.defaultLayout&&Object.keys(er.defaultLayout).length===v.panels.length)for(let e of(f={},v.panels)){let t=er.defaultLayout[e.id];void 0!==t&&(f[e.id]=t)}let j={disabled:!!i,element:p,id:B,mutableState:{defaultLayout:f,disableCursor:!!er.disableCursor,expandedItemSizes:Q.current.lastExpandedPanelSizes,layouts:Q.current.layouts},orientation:g,items:v.panels,resizePreviewMode:y,get resizeTargetMinimumSize(){return er.resizeTargetMinimumSize},separators:v.separators};ea.current=j;let k=(t=!0,m((e=j).element.ownerDocument.defaultView,"Cannot register an unmounted Group"),s=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,l=new Set,(n=new s(s=>{for(let r of s){let{borderBoxSize:s,target:i}=r;if(i===e.element){if(t){let t=T({axis:e});if(0===t)return;let s=F(e.id);if(!s)return;let r=A(e),i=s.requestedAxisSize,l=s.requestedLayout;s.defaultLayoutDeferred&&(i=t,l=ey({itemIds:e.items.map(({id:e})=>e),layout:eb({axis:e,itemConstraints:r})}));let n=es({layout:function({axis:e,nextAxisSize:t,prevAxisSize:s,prevLayout:r}){if(s<=0||t<=0||s===t)return r;let i=0,l=0,n=!1,a=new Map,o=[];for(let c of e.items){let e=r[c.id]??0;if("preserve-pixel-size"===c.constraintProps.groupResizeBehavior){n=!0;let r=E(e/100*s/t*100);a.set(c.id,r),i+=r}else o.push(c.id),l+=e}if(!n||0===o.length)return r;let c=100-i,d={...r};if(a.forEach((e,t)=>{d[t]=e}),l>0)for(let e of o){let t=r[e]??0;d[e]=E(t/l*c)}else{let e=E(c/o.length);for(let t of o)d[t]=e}return d}({axis:e,nextAxisSize:t,prevAxisSize:i,prevLayout:l}),itemConstraints:r});if(!s.defaultLayoutDeferred&&q(s.layout,n)&&function(e,t){return e.length===t.length&&e.every((e,s)=>ev(e,t[s]))}(s.derivedItemConstraints,r)&&s.axisSize===t)continue;D(e,{defaultLayoutDeferred:!1,derivedItemConstraints:r,axisSize:t,layout:n,requestedAxisSize:i,requestedLayout:l,separatorToItems:s.separatorToItems})}}else!function(e,t,s){if(!s[0])return;let r=e.items.find(e=>e.element===t);if(!r||!r.onResize)return;let i=T({axis:e}),l="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,n=r.mutableValues.prevSize,a={asPercentage:E(l/i*100),inPixels:l};r.mutableValues.prevSize=a,r.onResize(a,r.id,n)}(e,i,s)}})).observe(e.element),e.items.forEach(e=>{m(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&n.observe(e.element)}),a=T({axis:e}),o=A(e),d=es({layout:c=eb({axis:e,itemConstraints:o}),itemConstraints:o}),u=(h=e.element.ownerDocument).defaultView,ew.set(h,(ew.get(h)??0)+1),x=new Map,I({axis:e,includeDisabled:!0}).forEach(e=>{e.separator&&x.set(e.separator,e.items)}),D(e,{defaultLayoutDeferred:0===a,derivedItemConstraints:o,axisSize:a,layout:d,requestedAxisSize:a,requestedLayout:ey({itemIds:e.items.map(({id:e})=>e),layout:c}),separatorToItems:x}),e.separators.forEach(e=>{m(!l.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),l.add(e.id),e.element.addEventListener("keydown",eo)}),1===ew.get(h)&&(h.addEventListener("contextmenu",X,!0),h.addEventListener("dblclick",ei,!0),h.addEventListener("lostpointercapture",ed,!0),h.addEventListener("pointercancel",eh,!0),h.addEventListener("pointerdown",eu,!0),h.addEventListener("pointerleave",ex),h.addEventListener("pointermove",ef),h.addEventListener("pointerout",ep),h.addEventListener("pointerup",em,!0),u?.addEventListener("blur",eg)),function(){t=!1,ew.set(h,Math.max(0,(ew.get(h)??0)-1)),(P=new Map(P)).delete(e),function(e){if("inactive"===b.state)return!1;let t=b.hitRegions.filter(t=>t.axis!==e),s="active"===b.state&&b.previews.some(t=>t.axis===e);if(t.length===b.hitRegions.length&&!s)return!1;if(0===t.length)w({cursorFlags:0,state:"inactive"});else if("active"===b.state){let s=new Map(b.initialLayoutMap),r=new Map(b.previewLayoutMap);s.delete(e),r.delete(e),w({...b,cursorFlags:0,hitRegions:t,initialLayoutMap:s,previewLayoutMap:r,previews:b.previews.filter(t=>t.axis!==e)})}else w({...b,hitRegions:t});return!0}(e)&&C(h),e.separators.forEach(e=>{e.element.removeEventListener("keydown",eo)}),ew.get(h)||(h.removeEventListener("contextmenu",X,!0),h.removeEventListener("dblclick",ei,!0),h.removeEventListener("lostpointercapture",ed,!0),h.removeEventListener("pointercancel",eh,!0),h.removeEventListener("pointerdown",eu,!0),h.removeEventListener("pointerleave",ex),h.removeEventListener("pointermove",ef),h.removeEventListener("pointerout",ep),h.removeEventListener("pointerup",em,!0),u?.removeEventListener("blur",eg)),n.disconnect()}),{defaultLayoutDeferred:S,derivedItemConstraints:N,layout:z,requestedLayout:R}=F(j.id,!0);!S&&N.length>0&&(L(z),$(z,!1,R));let O=W(B,e=>{let{defaultLayoutDeferred:t,derivedItemConstraints:s,layout:r,requestedLayout:i}=e.next;if(t||0===s.length)return;!function({derivedItemConstraints:e,axis:t,layout:s,prevLayout:r,requestedLayout:i}){let l=t.items.map(({id:e})=>e).join(",");t.mutableState.layouts[l]=i,r&&e.forEach(e=>{if(e.collapsible){let i=V(e.collapsedSize,s[e.itemId]),l=V(e.collapsedSize,r[e.itemId]);i&&!l&&(t.mutableState.expandedItemSizes[e.itemId]=r[e.itemId])}})}({derivedItemConstraints:s,axis:j,layout:r,prevLayout:e.prev?.layout,requestedLayout:i});let l=b,n="active"!==l.state||!l.hitRegions.some(e=>e.axis===j);L(r),n&&$(r,e.isUserInteraction,i)});return()=>{ea.current=null,k(),O()}},[i,B,$,L,g,K,y,er]),x(()=>{(function(e){for(let t=1;t<e.length;t++)if(M(e[t-1],e[t])>0)return!1;return!0})(Z.current)||J()}),(0,o.useEffect)(()=>{let e=ea.current;e&&(e.mutableState.defaultLayout=s,e.mutableState.disableCursor=!!r)}),(0,a.jsx)(ek.Provider,{value:el,children:(0,a.jsxs)("div",{...N,className:t,"data-group":!0,"data-testid":B,id:B,ref:ee,style:{height:"100%",width:"100%",overflow:"hidden",position:"separator"===y?"relative":void 0,...S,display:"flex",flexDirection:"horizontal"===g?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===g?"pan-y":"pan-x"},children:[e,G.map(e=>(0,a.jsx)(e_,{overlay:H,preview:e},e.key))]})})}function eR({children:e,className:t,collapsedSize:s="0%",collapsedThreshold:r,collapsible:i=!1,defaultSize:l,disabled:n,elementRef:c,groupResizeBehavior:d="preserve-relative-size",id:h,maxSize:m="100%",minSize:g="0%",onResize:b,panelRef:y,style:v,...w}){let j,S=!!h,N=u(h),C=ej({disabled:n}),T=(0,o.useRef)(null),M=p(T,c),{getPanelStyles:_,id:z,orientation:R,registerPanel:I,updatePanelProps:L}=eC(),E=null!==b,A=f((e,t,s)=>{b?.(e,h,s)});x(()=>{let e=T.current;if(null!==e)return I({element:e,id:N,idIsStable:S,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?A:void 0,constraintProps:{groupResizeBehavior:d,collapsedSize:s,collapsedThreshold:r,collapsible:i,defaultSize:l,disabled:C.disabled,maxSize:m,minSize:g}})},[d,s,r,i,l,E,N,S,m,g,A,I,C]),(0,o.useEffect)(()=>{L(N,{disabled:n})},[n,N,L]),function(e,t){let{id:s}=eC(),r=(0,o.useRef)({collapse:k,expand:k,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:k});(0,o.useImperativeHandle)(t,()=>r.current,[]),x(()=>{Object.assign(r.current,er({axisId:s,itemId:e}))})}(N,y);let P=()=>{let e=_(z,N);if(e)return JSON.stringify(e)},$=(0,o.useSyncExternalStore)(e=>W(z,e),P,P);return j=$?JSON.parse($):void 0!==l?{flexGrow:void 0,flexShrink:void 0,flexBasis:l}:{flexGrow:1},(0,a.jsx)("div",{...w,"data-disabled":n||void 0,"data-panel":!0,"data-testid":N,id:N,ref:M,style:{...eI,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...j},children:(0,a.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...v,touchAction:"horizontal"===R?"pan-y":"pan-x"},children:e})})}eT.displayName="SeparatorOverlay",ez.displayName="Group",eR.displayName="Panel";let eI={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0},eL={flexBasis:"auto"},eE={flexGrow:0,flexShrink:0};function eA({children:e,className:t,disabled:s,disableDoubleClick:r,elementRef:i,id:l,preview:n,style:o,...c}){let d=u(l),{disableCursor:h,id:x,orientation:f,registerSeparator:p,updateSeparatorProps:m}=eC();return(0,a.jsx)(eS,{attributes:c,axisId:x,axisOrientation:f,className:t,disableCursor:h,disabled:s,disableDoubleClick:r,elementRef:i,id:d,preview:n,registerSeparator:p,requiredStyle:eE,style:o,styleDefaults:eL,updateSeparatorProps:m,children:e})}eA.displayName="Separator";var eP=e.i(5342),e$=e.i(71567),eO=e.i(66595),eF=e.i(25398),eW=e.i(23827),eD=e.i(56420);let eV={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]};eV.node;let eB=(0,eD.f)(eV),eH={name:"bell",size:24,node:[["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"}]]};eH.node;let eU=(0,eD.f)(eH),eq={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};eq.node;let eG=(0,eD.f)(eq),eY={name:"radio",size:24,node:[["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"}]]};eY.node;let eX=(0,eD.f)(eY);var eK=e.i(49803),eJ=e.i(31772),eZ=e.i(50786),eQ=e.i(28623);let e0={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};e0.node;let e1=(0,eD.f)(e0),e2={name:"panel-bottom",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]};e2.node;let e5=(0,eD.f)(e2),e3={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};e3.node;let e4=(0,eD.f)(e3);function e8({isLeftSidebarVisible:e,isBottomPanelVisible:t,isRightSidebarVisible:s,onToggleLeftSidebar:r,onToggleBottomPanel:i,onToggleRightSidebar:l}){let n=e=>`inline-flex items-center justify-center p-1 rounded transition-colors ${e?"bg-[#007acc]/20 border border-[#007acc]/50 text-[#4fc1ff]":"border border-transparent text-[#858585] hover:text-[#cccccc] hover:bg-[#2a2d2e]"}`;return(0,a.jsxs)("div",{"data-testid":"layout-toggles-group",className:"inline-flex items-center gap-0.5 bg-[#252526] p-0.5 rounded border border-[#333333]",children:[(0,a.jsx)("button",{type:"button","data-testid":"toggle-left-sidebar",title:"Toggle Primary Sidebar (Cmd+B / Ctrl+B)",onClick:r,className:n(e),children:(0,a.jsx)(e1,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{type:"button","data-testid":"toggle-bottom-panel",title:"Toggle Bottom Panel (Cmd+J / Ctrl+J)",onClick:i,className:n(t),children:(0,a.jsx)(e5,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{type:"button","data-testid":"toggle-right-sidebar",title:"Toggle Secondary Sidebar (Live Chat & Inspector - Cmd+Alt+B)",onClick:l,className:n(s),children:(0,a.jsx)(e4,{className:"w-3.5 h-3.5"})})]})}let e6=[{id:"showcase",label:"All Items Showcase (24)"},{id:"cases",label:"Edge Cases & Items (17)"},{id:"showcase_skins",label:"Skins & Outfits (15)"},{id:"showcase_props",label:"Tech Props & Gadgets (14)"},{id:"showcase_pets",label:"Pets & Companions (12)"},{id:"showcase_auras",label:"Particle Auras & VFX (12)"},{id:"showcase_trophies",label:"Trophies & Badges (12)"},{id:"storm",label:"Storm (30 Agents)"},{id:"busy",label:"Busy (8 Agents)"},{id:"idle",label:"Idle (2 Agents)"},{id:"errors",label:"Error States"}];function e7({stats:e={},mode:t="live",mockPreset:s="cases",onModeChange:r,onPresetChange:i,isRefreshing:l=!1,onRefresh:n,soundEnabled:o=!1,onToggleSound:c,notifEnabled:d=!1,onToggleNotif:h,onOpenCommandPalette:u,onOpenReports:x,onOpenStore:f,onOpenThemeSettings:p,isSupporter:m=!1,layout:g,onToggleLeftSidebar:b,onToggleBottomPanel:y,onToggleRightSidebar:v}){return(0,a.jsxs)("header",{className:"h-[34px] min-h-[34px] bg-[#1e1e1e] border-b border-[#2b2b2b] flex items-center justify-between px-3 text-[#cccccc] text-xs select-none shrink-0 z-40",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-[200px]",children:[(0,a.jsx)("div",{className:"flex h-5 w-5 items-center justify-center rounded bg-gradient-to-br from-emerald-500 to-cyan-600 shadow-sm shadow-emerald-500/20",children:(0,a.jsx)(e$.f,{className:"w-3.5 h-3.5 text-white"})}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-bold text-[#e1e1e1] tracking-wide text-[11px]",children:"AGMON"}),(0,a.jsx)("span",{className:"rounded bg-[#2d2d2d] px-1.5 py-0.2 text-[9px] font-medium text-slate-400 border border-[#3e3e42]",children:"v0.2.0"})]}),(0,a.jsxs)("div",{className:"hidden lg:flex items-center gap-1 bg-[#252526] px-1.5 py-0.5 rounded text-[10px] text-emerald-400 border border-[#333333]",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),(0,a.jsx)("span",{children:"Multi-Provider"})]})]}),(0,a.jsxs)("div",{onClick:u,title:"Search sessions or run commands (Cmd+Shift+P / Ctrl+Shift+P)",className:"flex items-center justify-between w-[320px] max-w-[35vw] h-6 bg-[#252526] border border-[#3e3e42] hover:border-[#007acc] rounded px-2 cursor-pointer transition-colors text-slate-400 group",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,a.jsx)(eO.f,{className:"w-3 h-3 text-slate-500 group-hover:text-slate-300 shrink-0"}),(0,a.jsx)("span",{className:"text-[11px] truncate",children:"Search agents, logs, commands..."})]}),(0,a.jsx)("kbd",{className:"hidden sm:inline-block text-[9px] font-mono bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 text-slate-400",children:"Cmd+Shift+P"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-[240px] justify-end",children:[(0,a.jsxs)("div",{onClick:x,title:"Click to view detailed Token & Cost Analytics",className:"hidden xl:flex items-center gap-1.5 bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] px-2 py-0.5 rounded text-[11px] cursor-pointer transition-colors",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Desks:"}),(0,a.jsx)("span",{className:"font-bold text-slate-200",children:e?.agents??0}),(0,a.jsx)("span",{className:"text-slate-600",children:"|"}),(0,a.jsx)("span",{className:"text-slate-400",children:"Active:"}),(0,a.jsx)("span",{className:"font-bold text-cyan-400",children:e?.busy??0}),(0,a.jsx)("span",{className:"text-slate-600",children:"|"}),(0,a.jsx)("span",{className:"text-slate-400",children:"Tokens:"}),(0,a.jsx)("span",{className:"font-bold text-emerald-400",children:e?.tokensLabel??"0k"})]}),(0,a.jsxs)("button",{onClick:x,title:"Open Token & Cost Analytics",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors",children:[(0,a.jsx)(eK.f,{className:"w-3 h-3 text-amber-400"}),(0,a.jsx)("span",{className:"hidden md:inline font-medium",children:"Reports"})]}),(0,a.jsxs)("button",{onClick:f,title:"Supporter Store: Skins, Pets, Ambience & Coffee",className:`flex items-center gap-1.5 px-2.5 py-0.5 rounded border text-[11px] transition-all cursor-pointer ${m?"bg-amber-500/20 border-amber-500/50 text-amber-300 hover:bg-amber-500/30 shadow-sm shadow-amber-500/10":"bg-amber-500/10 hover:bg-amber-500/20 border-amber-500/40 hover:border-amber-400 text-amber-300 hover:text-white"}`,children:[(0,a.jsx)(eJ.f,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,a.jsx)("span",{className:"font-semibold text-amber-300",children:m?"VIP Supporter":"Store"})]}),(0,a.jsxs)("button",{onClick:p,title:"Color Themes & Font Customization (Preferences)",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors cursor-pointer",children:[(0,a.jsx)(eZ.f,{className:"w-3 h-3 text-cyan-400"}),(0,a.jsx)("span",{className:"hidden lg:inline font-medium",children:"Themes"})]}),(0,a.jsxs)("div",{className:"flex items-center rounded bg-[#252526] border border-[#333333] p-0.5 text-[11px]",children:[(0,a.jsxs)("button",{onClick:()=>r?.("live"),title:"Connect live log watchers ~/.gemini and ~/.claude",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"live"===t?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"text-slate-400 hover:text-slate-200"}`,children:[(0,a.jsx)(eX,{className:`w-2.5 h-2.5 ${"live"===t?"text-emerald-400 animate-pulse":"text-slate-500"}`}),"Live"]}),(0,a.jsx)("button",{onClick:()=>r?.("mock"),title:"Simulated multi-agent mock telemetry",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"mock"===t?"bg-[#333333] text-slate-200":"text-slate-400 hover:text-slate-200"}`,children:"Mock"}),"mock"===t&&(0,a.jsx)("select",{value:s,onChange:e=>i?.(e.target.value),className:"bg-transparent px-1 py-0.5 text-[10px] text-slate-300 outline-none cursor-pointer border-l border-[#333333] ml-1",children:e6.map(e=>(0,a.jsx)("option",{value:e.id,className:"bg-[#1e1e1e] text-slate-200",children:e.label},e.id))})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{r?.("mock"),i?.("showcase")},title:"Quickly showcase all 24 item archetypes in action",className:`flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-semibold border transition-all ${"mock"===t&&"showcase"===s?"bg-cyan-500/20 text-cyan-300 border-cyan-500/50 shadow-sm shadow-cyan-500/20":"bg-[#252526] text-slate-300 border-[#333333] hover:text-cyan-300 hover:border-cyan-500/40"}`,children:[(0,a.jsx)(eQ.f,{className:"w-3 h-3 text-cyan-400"}),(0,a.jsx)("span",{children:"Items Showcase"})]}),(0,a.jsx)("button",{onClick:n,title:"Force refresh connections & data",className:"flex h-6 w-6 items-center justify-center rounded border border-[#333333] bg-[#252526] text-slate-400 hover:text-slate-200 hover:border-[#444444] transition-colors",children:(0,a.jsx)(eF.f,{className:`w-3 h-3 ${l?"animate-spin text-emerald-400":""}`})}),(0,a.jsx)("button",{onClick:c,title:o?"Sound effects: ON":"Sound effects: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${o?"border-emerald-500/50 bg-emerald-500/20 text-emerald-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:o?(0,a.jsx)(eW.f,{className:"w-3 h-3"}):(0,a.jsx)(eB,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:h,title:d?"Desktop notifications: ON":"Desktop notifications: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${d?"border-amber-500/50 bg-amber-500/20 text-amber-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:d?(0,a.jsx)(eU,{className:"w-3 h-3"}):(0,a.jsx)(eG,{className:"w-3 h-3"})}),(0,a.jsx)(e8,{isLeftSidebarVisible:g?.isLeftSidebarVisible,isBottomPanelVisible:g?.isBottomPanelVisible,isRightSidebarVisible:g?.isRightSidebarVisible,onToggleLeftSidebar:b,onToggleBottomPanel:y,onToggleRightSidebar:v})]})]})}let e9={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]};e9.node;let te=(0,eD.f)(e9);var tt=e.i(79432),ts=e.i(4139);let tr={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};tr.node;let ti=(0,eD.f)(tr);var tl=e.i(20283);let tn={name:"files",size:24,node:[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]};tn.node;let ta=(0,eD.f)(tn);function to({activeView:e="explorer",onViewChange:t,onOpenStore:s,agentCount:r=0,isLeftSidebarVisible:i=!0,activeLeftSidebarTab:l="agents",isRightSidebarVisible:n=!1,activeRightSidebarTab:o="chat",isBottomPanelVisible:d=!1,onToggleBottomPanel:h,onOpenSettings:u}){let x=[{id:"explorer",title:"Explorer: Agents & Sessions (Ctrl+Shift+E)",icon:te,badge:r>0?r:void 0},{id:"files",title:"Workspace Files: File Tree & Code Editor",icon:ta},{id:"chat",title:"Live Chat / Transcript (Sidebar)",icon:c.f},{id:"office",title:"Virtual 2D Office View (Canvas)",icon:e$.f},{id:"network",title:"Multi-Agent Collaboration DAG Graph",icon:tl.f},{id:"reports",title:"Token & AI Cost Analytics",icon:eK.f},{id:"telemetry",title:"Live Telemetry & Traces",icon:tt.f},{id:"store",title:"Supporter Store: Skins, Pets & Ambience",icon:eJ.f}];return(0,a.jsxs)("aside",{"data-testid":"activity-bar",className:"w-12 h-full bg-[#181818] flex flex-col justify-between items-center border-r border-[#2b2b2b] py-2 shrink-0 z-30 select-none",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1 w-full items-center",children:[x.map(r=>{let c="chat"===r.id?n&&"chat"===o:"files"===r.id?i&&"files"===l:"explorer"===r.id?i&&"agents"===l:e===r.id,d=r.icon;return(0,a.jsxs)("button",{onClick:()=>{"store"===r.id?s?.():t?.(r.id)},title:r.title,className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${c?"text-white border-l-2 border-[#007acc] bg-[#252526]/50":"store"===r.id?"text-amber-400 hover:text-amber-300 hover:bg-[#252526]/40 border-l-2 border-transparent":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:[(0,a.jsx)(d,{className:`w-5 h-5 ${"store"===r.id?"text-amber-400":""}`}),void 0!==r.badge&&(0,a.jsx)("span",{className:"absolute top-1.5 right-1.5 bg-[#007acc] text-white text-[9px] font-bold px-1 rounded-full leading-none min-w-3 text-center",children:r.badge})]},r.id)}),(0,a.jsx)("button",{onClick:h,title:d?"Hide Terminal & Logs (Cmd+J)":"Show Terminal & Logs (Cmd+J)",className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${d?"text-cyan-400 border-l-2 border-cyan-500/50":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:(0,a.jsx)(ts.f,{className:"w-5 h-5"})})]}),(0,a.jsx)("div",{className:"flex flex-col gap-1 w-full items-center",children:(0,a.jsx)("button",{onClick:u,title:"System Settings & Watchers",className:"w-full py-2.5 flex justify-center items-center text-[#858585] hover:text-[#cccccc] transition-colors border-l-2 border-transparent",children:(0,a.jsx)(ti,{className:"w-5 h-5"})})})]})}var tc=e.i(16327),td=e.i(67927);let th={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};th.node;let tu=(0,eD.f)(th),tx={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};tx.node;let tf=(0,eD.f)(tx);var tp=e.i(97142),tm=e.i(63448);let tg={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]};tg.node;let tb=(0,eD.f)(tg),ty={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};ty.node;let tv=(0,eD.f)(ty);function tw({filename:e="",isFolder:t=!1,isOpen:s=!1,size:r=14,className:i=""}){if(t)return s?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${i}`,children:[(0,a.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V6H3a1.5 1.5 0 0 0-1.42 1.027L.5 11V3a1.5 1.5 0 0 1 1-1.5z",fill:"#c99e55"}),(0,a.jsx)("path",{d:"M2 13.5l1.8-6.2c.16-.54.66-.9 1.22-.9h9.46c.72 0 1.22.68 1.03 1.36l-1.5 5.2a1.5 1.5 0 0 1-1.44 1.04H3.5A1.5 1.5 0 0 1 2 13.5z",fill:"#e8a838"})]}):(0,a.jsx)("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${i}`,children:(0,a.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V12A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V3z",fill:"#dcb67a"})});let l=(e||"").toLowerCase();return l.endsWith(".js")||l.endsWith(".jsx")||l.endsWith(".mjs")||l.endsWith(".cjs")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f7df1e"}),(0,a.jsx)("text",{x:"3",y:"12",fill:"#000000",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:l.endsWith(".jsx")?"JSX":"JS"})]}):l.endsWith(".ts")||l.endsWith(".tsx")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3178c6"}),(0,a.jsx)("text",{x:"2.5",y:"12",fill:"#ffffff",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:l.endsWith(".tsx")?"TSX":"TS"})]}):l.endsWith(".json")||l.endsWith(".jsonl")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f1c40f",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"3.5",y:"12",fill:"#f1c40f",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"10",children:"{}"})]}):l.endsWith(".md")||l.endsWith(".markdown")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#519aba",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"2",y:"11.5",fill:"#519aba",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"MD"})]}):l.endsWith(".html")||l.endsWith(".htm")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e44d26",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"1",y:"11.5",fill:"#e44d26",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):l.endsWith(".css")||l.endsWith(".scss")||l.endsWith(".sass")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#42a5f5",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"2",y:"11.5",fill:"#42a5f5",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"#"})]}):l.endsWith(".java")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f89820",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"1.5",y:"11.5",fill:"#f89820",fontFamily:"var(--font-family-ui, sans-serif)",fontWeight:"bold",fontSize:"8.5",children:"JAVA"})]}):l.endsWith(".py")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3776ab",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"2.5",y:"11.5",fill:"#3776ab",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"9",children:"PY"})]}):l.endsWith(".sql")||l.endsWith(".ddl")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#00bcd4",fillOpacity:"0.2"}),(0,a.jsx)("path",{d:"M8 2C4.69 2 2 3.12 2 4.5v7C2 12.88 4.69 14 8 14s6-1.12 6-2.5v-7C14 3.12 11.31 2 8 2zm0 1.5c2.76 0 4.5.83 4.5 1s-1.74 1-4.5 1-4.5-.83-4.5-1 1.74-1 4.5-1zm-4.5 3.32c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1V6.82zm0 3.5c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1v-1.73z",fill:"#00bcd4"})]}):l.endsWith(".png")||l.endsWith(".jpg")||l.endsWith(".jpeg")||l.endsWith(".gif")||l.endsWith(".webp")||l.endsWith(".ico")||l.endsWith(".bmp")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#26a69a",fillOpacity:"0.2",stroke:"#26a69a",strokeWidth:"0.8"}),(0,a.jsx)("circle",{cx:"5",cy:"5.5",r:"1.5",fill:"#26a69a"}),(0,a.jsx)("path",{d:"M2.5 13.5l4-5 3.5 4 2-2.5 2 3.5h-11.5z",fill:"#26a69a"})]}):l.endsWith(".svg")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#ff7043",fillOpacity:"0.2",stroke:"#ff7043",strokeWidth:"0.8"}),(0,a.jsx)("text",{x:"1",y:"11.5",fill:"#ff7043",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"SVG"})]}):"dockerfile"===l||l.startsWith("dockerfile.")||l.endsWith(".dockerfile")||l.includes("docker-compose")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#2496ed",fillOpacity:"0.2"}),(0,a.jsx)("path",{d:"M13.8 6.8c-.3-.2-.8-.2-1.1 0-.1-.6-.5-1.1-1.1-1.3l-.4-.1-.2.4c-.2.5-.2 1 0 1.5-.4.2-.8.5-1.2.9H2.5c-.3 0-.5.2-.5.5v3.5c0 1.7 1.3 3 3 3h5.2c2.5 0 4.6-1.8 4.8-4.3.4-.6.6-1.3.6-2 0-.8-.4-1.4-1-1.8-.2-.1-.5-.2-.8-.3zM4 6.5h1.5v1.5H4V6.5zm2 0h1.5v1.5H6V6.5zm2 0h1.5v1.5H8V6.5zm2 0h1.5v1.5H10V6.5z",fill:"#2496ed"})]}):l.startsWith(".git")||l.includes("git")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f05032",fillOpacity:"0.15"}),(0,a.jsx)("circle",{cx:"5",cy:"5",r:"1.5",fill:"#f05032"}),(0,a.jsx)("circle",{cx:"11",cy:"5",r:"1.5",fill:"#f05032"}),(0,a.jsx)("circle",{cx:"8",cy:"11.5",r:"1.5",fill:"#f05032"}),(0,a.jsx)("path",{d:"M5 6.5v2a3 3 0 0 0 3 3M11 6.5v2a3 3 0 0 1-3 3",stroke:"#f05032",strokeWidth:"1.2",fill:"none"})]}):l.endsWith(".yaml")||l.endsWith(".yml")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#cb171e",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"1",y:"11.5",fill:"#e06c75",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"YML"})]}):l.endsWith(".toml")||l.endsWith(".ini")||l.endsWith(".conf")||l.endsWith(".cfg")||l.endsWith(".properties")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#61afef",fillOpacity:"0.2"}),(0,a.jsx)("circle",{cx:"8",cy:"8",r:"3",stroke:"#61afef",strokeWidth:"1.2",fill:"none"}),(0,a.jsx)("circle",{cx:"8",cy:"8",r:"1",fill:"#61afef"}),(0,a.jsx)("path",{d:"M8 2.5v2M8 11.5v2M2.5 8h2M11.5 8h2",stroke:"#61afef",strokeWidth:"1.2"})]}):l.endsWith(".sh")||l.endsWith(".bash")||l.endsWith(".zsh")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#89d185",fillOpacity:"0.2"}),(0,a.jsx)("path",{d:"M4 5l3 3-3 3",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,a.jsx)("line",{x1:"8.5",y1:"11",x2:"12",y2:"11",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round"})]}):l.includes("lock")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e5c07b",fillOpacity:"0.2"}),(0,a.jsx)("rect",{x:"4.5",y:"7",width:"7",height:"6",rx:"1",fill:"#e5c07b"}),(0,a.jsx)("path",{d:"M6 7V5a2 2 0 1 1 4 0v2",stroke:"#e5c07b",strokeWidth:"1.2",fill:"none"})]}):l.endsWith(".xml")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e74c3c",fillOpacity:"0.2"}),(0,a.jsx)("text",{x:"1",y:"11.5",fill:"#e74c3c",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):l.startsWith(".env")||l.includes("config")?(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",className:`shrink-0 ${i}`,children:[(0,a.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#9b59b6",fillOpacity:"0.2"}),(0,a.jsx)("circle",{cx:"8",cy:"8",r:"3.5",stroke:"#bb86fc",strokeWidth:"1.2",fill:"none"}),(0,a.jsx)("circle",{cx:"8",cy:"8",r:"1.5",fill:"#03dac6"})]}):(0,a.jsxs)("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${i}`,children:[(0,a.jsx)("path",{d:"M3 2a1 1 0 0 1 1-1h5.5l3.5 3.5V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2z",stroke:"#858585",strokeWidth:"1.2",fill:"#1e1e1e"}),(0,a.jsx)("path",{d:"M9 1v4h4",stroke:"#858585",strokeWidth:"1.2"}),(0,a.jsx)("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"}),(0,a.jsx)("line",{x1:"5",y1:"11",x2:"9",y2:"11",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"})]})}function tj({entry:e,depth:t=0,expandedPaths:s,toggleFolder:r,onOpenFile:i,searchQuery:l}){let n=!!s[e.path],[c,d]=(0,o.useState)(null),[h,u]=(0,o.useState)(!1);(0,o.useEffect)(()=>{e.isDirectory&&n&&null===c&&!h&&(u(!0),fetch(`/api/workspace/files?path=${encodeURIComponent(e.path)}`).then(e=>e.json()).then(e=>{d(e.entries||[])}).catch(()=>d([])).finally(()=>u(!1)))},[e.isDirectory,e.path,n,c,h]);let x=(0,o.useMemo)(()=>!l||e.name.toLowerCase().includes(l.toLowerCase()),[e.name,l]);return e.isDirectory?(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("div",{onClick:()=>r(e.path),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none",style:{paddingLeft:`${14*t+8}px`},title:e.path,children:[n?(0,a.jsx)(tc.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}):(0,a.jsx)(td.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),(0,a.jsx)(tw,{isFolder:!0,isOpen:n,size:14}),(0,a.jsx)("span",{className:"font-medium text-[11px] truncate",children:e.name}),h&&(0,a.jsx)(eF.f,{className:"w-2.5 h-2.5 animate-spin text-cyan-400 ml-auto"})]}),n&&c&&(0,a.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,a.jsx)("div",{className:"text-[10px] text-slate-500 italic py-0.5",style:{paddingLeft:`${(t+1)*14+18}px`},children:"(Empty folder)"}):c.map(e=>(0,a.jsx)(tj,{entry:e,depth:t+1,expandedPaths:s,toggleFolder:r,onOpenFile:i,searchQuery:l},e.path))})]}):x?(0,a.jsxs)("div",{onClick:()=>i?.(e),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none group",style:{paddingLeft:`${14*t+20}px`},title:`${e.name} (${e.size?`${Math.round(e.size/1024)} KB`:""})`,children:[(0,a.jsx)(tw,{filename:e.name,size:14}),(0,a.jsx)("span",{className:"text-[11px] text-slate-300 group-hover:text-cyan-300 truncate",children:e.name}),e.size>0&&(0,a.jsx)("span",{className:"text-[9px] text-slate-600 font-mono ml-auto opacity-0 group-hover:opacity-100 transition-opacity",children:e.size>1048576?`${(e.size/1048576).toFixed(1)}M`:`${Math.round(e.size/1024)}k`})]}):null}function tk({onOpenFile:e,initialPath:t=""}){let[s,r]=(0,o.useState)(t),[i,l]=(0,o.useState)(null),[n,c]=(0,o.useState)([]),[d,h]=(0,o.useState)(!1),[u,x]=(0,o.useState)(""),[f,p]=(0,o.useState)({}),m=(0,o.useCallback)(async e=>{h(!0);try{let t=e?`/api/workspace/files?path=${encodeURIComponent(e)}`:"/api/workspace/files",s=await fetch(t),i=await s.json();s.ok&&(c(i.entries||[]),r(i.currentPath||""),l(i.parentPath||null))}catch{}finally{h(!1)}},[]);(0,o.useEffect)(()=>{m(t)},[t,m]);let g=(0,o.useCallback)(e=>{p(t=>({...t,[e]:!t[e]}))},[]),b=(0,o.useMemo)(()=>s?s.split("/").pop()||s:"Workspace",[s]);return(0,a.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden text-xs",children:[(0,a.jsxs)("div",{className:"h-[30px] min-h-[30px] px-2.5 bg-[#252526] border-b border-[#2b2b2b] flex items-center justify-between shrink-0 select-none",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[(0,a.jsx)(tf,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,a.jsx)("span",{className:"font-bold text-[11px] uppercase tracking-wider text-slate-300 truncate",title:s,children:b})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[i&&(0,a.jsx)("button",{onClick:()=>{i&&m(i)},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Navigate up one directory",children:(0,a.jsx)(tv,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{onClick:()=>m(s),className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Refresh file explorer",children:(0,a.jsx)(eF.f,{className:`w-3.5 h-3.5 ${d?"animate-spin text-emerald-400":""}`})})]})]}),(0,a.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]/60",children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,a.jsx)(eO.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,a.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search files...",className:"bg-transparent text-[11px] text-slate-200 outline-none w-full placeholder:text-slate-500"})]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-1 py-1.5 space-y-0.5",children:d&&0===n.length?(0,a.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading files..."}):0===n.length?(0,a.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs italic",children:"No files found"}):n.map(t=>(0,a.jsx)(tj,{entry:t,depth:0,expandedPaths:f,toggleFolder:g,onOpenFile:e,searchQuery:u},t.path))})]})}function tS({workstations:e=[],selectedId:t=null,onSelectAgent:s,onOpenAgentTab:r,stats:i={},onRefresh:l,onStartReplay:n,onViewConversation:d,onOpenFile:u,onOpenStore:x,activeSidebarTab:f,onActiveSidebarTabChange:p}){let[m,g]=(0,o.useState)("agents"),b=void 0!==f?f:m,y=p||g,[v,w]=(0,o.useState)(""),[j,k]=(0,o.useState)(""),[S,N]=(0,o.useState)({agents:!0,folders:!0,metrics:!1}),C=e=>{N(t=>({...t,[e]:!t[e]}))},T=(0,o.useMemo)(()=>{if(!j.trim())return e;let t=j.toLowerCase();return e.filter(e=>e.account?.toLowerCase().includes(t)||e.sessionTitle?.toLowerCase().includes(t)||e.lastText?.toLowerCase().includes(t)||e.connectionId?.toLowerCase().includes(t)||e.provider?.toLowerCase().includes(t)||e.model?.toLowerCase().includes(t)||e.activeTool?.toLowerCase().includes(t))},[e,j]),M=(0,o.useMemo)(()=>{let e={extensions:[],geminiApp:[],geminiCli:[],claude:[],other:[]};return T.forEach(t=>{let s=(t.provider||"").toLowerCase(),r=(t.clientType||"").toLowerCase(),i=(t.cli||"").toLowerCase(),l=(t.connectionId||"").toLowerCase(),n=(t.model||"").toLowerCase(),a="extension"===r||"ide"===r||l.includes("extension"),o="claude"===i||s.includes("claude")||s.includes("anthropic")||n.includes("claude");a?e.extensions.push(t):"app"===r||s.includes("app")||l.includes("app")?e.geminiApp.push(t):o?e.claude.push(t):s.includes("gemini")||"antigravity"===i||"cli"===r?e.geminiCli.push(t):e.other.push(t)}),e},[T]),_=(e,i)=>{let l=t===e.connectionId,o=e.state||"idle",u=e.account||"agent-factory",x=e.sessionTitle||u,f="app"===e.clientType||(e.provider||"").includes("(app)"),p="extension"===e.clientType||(e.provider||"").includes("extension")||(e.connectionId||"").toLowerCase().includes("extension"),m=e.lastText?`${"assistant"===e.lastTextRole?"AI: ":"user"===e.lastTextRole?"You: ":""}${e.lastText}`:`${u} \xb7 ${e.model||"AI Agent"}${e.activeTool?` \xb7 ${e.activeTool}`:""}`;return(0,a.jsxs)("div",{onClick:()=>{s?.(e.connectionId),r?.(e)},className:`group flex items-center justify-between px-3 py-2 cursor-pointer text-xs transition-colors border-l-2 ${l?"bg-[#37373d] text-white border-[#007acc]":"hover:bg-[#2a2d2e] text-[#cccccc] border-transparent"}`,children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1 mr-2",children:[(0,a.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${"error"===o?"bg-rose-500":"streaming"===o||"busy"===o||"working"===o?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-slate-500"}`}),(0,a.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"font-medium truncate text-[11px] text-slate-200",title:x,children:x}),p?(0,a.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"EXT"}):f?(0,a.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"APP"}):(0,a.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"CLI"})]}),(0,a.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:m,children:m})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[n&&(0,a.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),n(e.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-cyan-400 hover:text-white transition-all cursor-pointer",title:"Replay Session (Default)",children:(0,a.jsx)(h.f,{className:"w-3 h-3"})}),d&&(0,a.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),d(e.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-slate-400 hover:text-cyan-300 transition-all cursor-pointer",title:"View conversation transcript",children:(0,a.jsx)(c.f,{className:"w-3 h-3"})}),(0,a.jsx)("span",{className:"text-[10px] text-slate-500 font-mono group-hover:text-slate-300",children:e.totalLabel||"0k"})]})]},e.connectionId||`agent-${i}`)};return(0,a.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,a.jsxs)("div",{className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)("button",{onClick:()=>y("agents"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"agents"===b?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"View active AI Agents & Sessions",children:[(0,a.jsx)(e$.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,a.jsxs)("span",{children:["Agents (",e.length,")"]})]}),(0,a.jsxs)("button",{onClick:()=>y("files"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"files"===b?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"Browse Workspace & Project Files",children:[(0,a.jsx)(te,{className:"w-3.5 h-3.5 text-amber-400"}),(0,a.jsx)("span",{children:"Files"})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-1",children:(0,a.jsx)("button",{onClick:l,title:"Refresh",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",children:(0,a.jsx)(eF.f,{className:"w-3 h-3"})})})]}),"files"===b?(0,a.jsx)(tk,{onOpenFile:u,initialPath:v}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]",children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,a.jsx)(eO.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,a.jsx)("input",{type:"text",value:j,onChange:e=>k(e.target.value),placeholder:"Filter agents by name, model...",className:"w-full bg-transparent text-[11px] text-slate-200 outline-none placeholder:text-slate-500"})]})}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2b2b2b]",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>C("agents"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[S.agents?(0,a.jsx)(tc.f,{className:"w-3 h-3 text-slate-400"}):(0,a.jsx)(td.f,{className:"w-3 h-3 text-slate-400"}),(0,a.jsxs)("span",{className:"uppercase text-[10px] tracking-wide",children:["Workstations & Sessions (",T.length,")"]})]}),i?.busy>0&&(0,a.jsxs)("span",{className:"bg-emerald-500/20 text-emerald-400 text-[9px] font-bold px-1.5 py-0.2 rounded-full border border-emerald-500/30",children:[i.busy," active"]})]}),S.agents&&(0,a.jsx)("div",{className:"py-1",children:0===T.length?(0,a.jsx)("div",{className:"px-4 py-3 text-center text-xs text-slate-500 italic",children:"No active agents found"}):(0,a.jsxs)(a.Fragment,{children:[M.extensions?.length>0&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-sky-400/90 flex items-center gap-1",children:[(0,a.jsx)(tb,{className:"w-2.5 h-2.5"}),(0,a.jsxs)("span",{children:["Extensions & IDEs (",M.extensions.length,")"]})]}),M.extensions.map(_)]}),M.geminiApp.length>0&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-purple-400/80 flex items-center gap-1",children:[(0,a.jsx)(eQ.f,{className:"w-2.5 h-2.5"}),(0,a.jsxs)("span",{children:["Antigravity Desktop App (",M.geminiApp.length,")"]})]}),M.geminiApp.map(_)]}),M.geminiCli.length>0&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-emerald-400/80 flex items-center gap-1",children:[(0,a.jsx)(tp.f,{className:"w-2.5 h-2.5"}),(0,a.jsxs)("span",{children:["Gemini CLI / Antigravity (",M.geminiCli.length,")"]})]}),M.geminiCli.map(_)]}),M.claude.length>0&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-amber-400/80 flex items-center gap-1",children:[(0,a.jsx)(tt.f,{className:"w-2.5 h-2.5"}),(0,a.jsxs)("span",{children:["Claude Code (",M.claude.length,")"]})]}),M.claude.map(_)]}),M.other.length>0&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-slate-400 flex items-center gap-1",children:(0,a.jsxs)("span",{children:["Other Agents (",M.other.length,")"]})}),M.other.map(_)]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("button",{type:"button",onClick:()=>C("folders"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[S.folders?(0,a.jsx)(tc.f,{className:"w-3 h-3 text-slate-400"}):(0,a.jsx)(td.f,{className:"w-3 h-3 text-slate-400"}),(0,a.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Watched Brain Directories"})]})}),S.folders&&(0,a.jsxs)("div",{className:"px-3 py-2 space-y-1.5 text-[11px]",children:[(0,a.jsxs)("div",{onClick:()=>{w("~/.gemini/antigravity/brain"),y("files")},className:"flex items-center gap-2 text-slate-400 hover:text-purple-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity Brain files",children:[(0,a.jsx)(tf,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity/brain"})]}),(0,a.jsxs)("div",{onClick:()=>{w("~/.gemini/antigravity-cli/brain"),y("files")},className:"flex items-center gap-2 text-slate-400 hover:text-emerald-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity CLI Brain files",children:[(0,a.jsx)(tu,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity-cli/brain"})]}),(0,a.jsxs)("div",{onClick:()=>{w("~/.claude/projects"),y("files")},className:"flex items-center gap-2 text-slate-400 hover:text-amber-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Claude Projects files",children:[(0,a.jsx)(tu,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.claude/projects"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("button",{type:"button",onClick:()=>C("metrics"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[S.metrics?(0,a.jsx)(tc.f,{className:"w-3 h-3 text-slate-400"}):(0,a.jsx)(td.f,{className:"w-3 h-3 text-slate-400"}),(0,a.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Factory Overview"})]})}),S.metrics&&(0,a.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,a.jsx)("span",{children:"Total Workstations:"}),(0,a.jsx)("span",{className:"font-bold text-slate-200",children:i?.agents||0})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,a.jsx)("span",{children:"Active Agents:"}),(0,a.jsx)("span",{className:"font-bold text-emerald-400",children:i?.busy||0})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,a.jsx)("span",{children:"Total Tokens:"}),(0,a.jsx)("span",{className:"font-bold text-cyan-400",children:i?.tokensLabel||"0k"})]})]})]}),(0,a.jsx)("div",{className:"p-2 border-t border-[#252526] bg-[#1a1a1b]",children:(0,a.jsxs)("button",{type:"button",onClick:x,className:"w-full flex items-center justify-between p-2 rounded-lg bg-gradient-to-r from-amber-500/15 to-amber-600/10 hover:from-amber-500/25 hover:to-amber-600/20 border border-amber-500/30 text-amber-300 transition-all cursor-pointer text-xs",title:"Open Supporter Store: 1,000 Tech Items & 3D Effects",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(tm.f,{className:"w-4 h-4 text-amber-400"}),(0,a.jsxs)("div",{className:"text-left",children:[(0,a.jsx)("div",{className:"font-bold text-white text-[11px] leading-tight",children:"Supporter Store"}),(0,a.jsx)("div",{className:"text-[10px] text-amber-400/80",children:"1,000 Tech Items & 3D Effects"})]})]}),(0,a.jsx)("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-amber-500/20 border border-amber-500/40",children:"Open"})]})})]})]})]})}var tN=e.i(63676),tC=e.i(24071);function tT({tabs:e=[],activeTabId:t="canvas",onSelectTab:s,onCloseTab:r}){let i=(0,o.useRef)(null);return(0,a.jsxs)("div",{"data-testid":"editor-tabs-bar",className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#1e1e1e] flex items-center justify-between select-none overflow-hidden",children:[(0,a.jsx)("div",{ref:i,onWheel:e=>{i.current&&(i.current.scrollLeft+=e.deltaY)},className:"flex items-center h-full overflow-x-auto no-scrollbar scroll-smooth flex-1",style:{scrollbarWidth:"none"},children:e.map(e=>{let i=e.id===t;return(0,a.jsxs)("div",{onClick:()=>s?.(e.id),className:`group flex items-center gap-2 h-full px-3 text-xs cursor-pointer border-r border-[#1e1e1e] transition-colors relative shrink-0 ${i?"bg-[#1e1e1e] text-white border-t-2 border-t-[#007acc]":"bg-[#2d2d2d] text-[#969696] hover:bg-[#252526] hover:text-[#cccccc] border-t-2 border-t-transparent"}`,children:["canvas"===e.type?(0,a.jsx)(e$.f,{className:"w-3.5 h-3.5 text-emerald-400"}):"network"===e.type?(0,a.jsx)(tl.f,{className:"w-3.5 h-3.5 text-indigo-400"}):"telemetry"===e.type?(0,a.jsx)(tt.f,{className:"w-3.5 h-3.5 text-cyan-400"}):"reports"===e.type?(0,a.jsx)(eK.f,{className:"w-3.5 h-3.5 text-amber-400"}):"store"===e.type?(0,a.jsx)(tm.f,{className:"w-3.5 h-3.5 text-amber-400"}):"file"===e.type?(0,a.jsx)(tw,{filename:e.filePath||e.title,size:14}):(0,a.jsx)(tp.f,{className:"w-3.5 h-3.5 text-purple-400"}),(0,a.jsx)("span",{className:"font-medium text-[11px] truncate max-w-[140px]",children:e.title}),!1!==e.closable&&(0,a.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),r?.(e.id)},title:"Close tab",className:"p-0.5 rounded text-slate-500 hover:text-white hover:bg-[#333333] transition-colors opacity-70 group-hover:opacity-100",children:(0,a.jsx)(tN.X,{className:"w-3 h-3"})})]},e.id)})}),(0,a.jsxs)("div",{className:"flex items-center px-2 gap-1 bg-[#252526] border-l border-[#1e1e1e] shrink-0 h-full",children:[(0,a.jsx)("button",{onClick:()=>{i.current&&i.current.scrollBy({left:-100,behavior:"smooth"})},title:"Scroll left",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,a.jsx)(tC.f,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>{i.current&&i.current.scrollBy({left:100,behavior:"smooth"})},title:"Scroll right",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,a.jsx)(td.f,{className:"w-3 h-3"})})]})]})}var tM=e.i(53138);let t_={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]};t_.node;let tz=(0,eD.f)(t_);var tR=e.i(26787),tI=e.i(90582),tL=e.i(19830);let tE={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};tE.node;let tA=(0,eD.f)(tE);function tP({traces:e=[],activeTab:t="logs",onTabChange:s,onClose:r,isMaximized:i=!1,onToggleMaximize:l}){let[n,c]=(0,o.useState)(t),[d,h]=(0,o.useState)(""),[u,x]=(0,o.useState)(!0),[f,p]=(0,o.useState)(null),[m,g]=(0,o.useState)(!1),b=(0,o.useRef)(null);(0,o.useEffect)(()=>{g(!0)},[]),(0,o.useEffect)(()=>{c(t)},[t]);let y=(0,o.useMemo)(()=>{let t=[],s=e=>{if(!m)return"--:--:--";if(e){if("string"==typeof e&&e.includes(":"))return e;let t=new Date(e);if(!isNaN(t.getTime()))return t.toLocaleTimeString()}return new Date().toLocaleTimeString()};e.forEach(e=>{let r=e.account||"Agent",i=e.model||"gemini-3.8-flash",l=e.clientType||(e.provider?.includes("app")?"app":"cli"),n=e.provider||"gemini",a=e.connectionId||e.traceId||"agent";Array.isArray(e.logs)&&e.logs.length>0?e.logs.forEach((e,o)=>{let c=(e.type||"").toUpperCase(),d=c.includes("ERR")?"ERROR":c.includes("TOOL")?"TOOL":"STREAM";t.push({id:`${a}-${e.timestamp||o}-${o}`,time:s(e.timestamp),level:d,provider:n,clientType:l,account:r,model:i,message:e.detail||e.summary||"Event recorded",meta:e.summary!==e.detail?e.summary:""})}):(e.activeTool&&t.push({id:`${a}-tool-${e.activeTool}`,time:s(e.timestamp),level:"TOOL",provider:n,clientType:l,account:r,model:i,message:`Executing tool: ${e.activeTool}`,meta:e.activeToolParams||""}),("streaming"===e.state||"busy"===e.state)&&t.push({id:`${a}-stream`,time:s(e.timestamp),level:"STREAM",provider:n,clientType:l,account:r,model:i,message:`Active session processing tokens (${Number.isFinite(e.totalTokens)?`${Math.round(e.totalTokens/1e3)}k`:"unavailable"})`}),"error"===e.state&&t.push({id:`${a}-err`,time:s(e.timestamp),level:"ERROR",provider:n,clientType:l,account:r,model:i,message:`Session encountered error state (${e.error||"failed"})`}))}),0===t.length&&t.push({id:"sys-init",time:m?new Date().toLocaleTimeString():"--:--:--",level:"SYSTEM",provider:"system",clientType:"cli",account:"AGMon Core",message:"Watcher initialized. Monitoring ~/.gemini and ~/.claude directories in real time."});let r=t.length>250?t.slice(-250):t;return f?r.filter(e=>e.time>f):r},[e,f,m]),v=(0,o.useMemo)(()=>{let e=y;if("tools"===n?e=e.filter(e=>"TOOL"===e.level):"problems"===n&&(e=e.filter(e=>"ERROR"===e.level)),d.trim()){let t=d.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||e.account.toLowerCase().includes(t)||e.level.toLowerCase().includes(t)||e.model?.toLowerCase().includes(t))}return e},[y,n,d]);(0,o.useEffect)(()=>{u&&b.current&&(b.current.scrollTop=b.current.scrollHeight)},[v,u]);let w=[{id:"logs",label:"Agent Output",icon:ts.f,count:y.length},{id:"tools",label:"Tool Executions",icon:tt.f,count:y.filter(e=>"TOOL"===e.level).length},{id:"problems",label:"Problems",icon:tM.f,count:y.filter(e=>"ERROR"===e.level).length}];return(0,a.jsxs)("div",{"data-testid":"bottom-panel-container",className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,a.jsxs)("div",{className:"h-[32px] min-h-[32px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,a.jsx)("div",{className:"flex items-center h-full gap-1",children:w.map(e=>{let t=n===e.id,r=e.icon;return(0,a.jsxs)("button",{type:"button",onClick:()=>{c(e.id),s?.(e.id)},className:`flex items-center gap-1.5 h-full px-2.5 text-xs transition-colors border-b-2 font-medium ${t?"text-white border-[#007acc] bg-[#1e1e1e]":"text-[#858585] hover:text-[#cccccc] border-transparent"}`,children:[(0,a.jsx)(r,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-wider",children:e.label}),e.count>0&&(0,a.jsx)("span",{className:"bg-[#333333] text-slate-300 text-[9px] font-mono px-1 rounded-full",children:e.count})]},e.id)})}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1.5 py-0.5 h-5",children:[(0,a.jsx)(eO.f,{className:"w-2.5 h-2.5 text-slate-500"}),(0,a.jsx)("input",{type:"text",value:d,onChange:e=>h(e.target.value),placeholder:"Filter logs...",className:"bg-transparent text-[10px] text-slate-200 outline-none w-20 sm:w-32 placeholder:text-slate-500"})]}),(0,a.jsx)("button",{onClick:()=>x(e=>!e),title:u?"Pause auto-scroll":"Resume auto-scroll",className:`p-1 rounded text-xs transition-colors ${u?"text-cyan-400 bg-cyan-950/40":"text-slate-500 hover:text-slate-300"}`,children:u?(0,a.jsx)(tA,{className:"w-3 h-3"}):(0,a.jsx)(tL.f,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>p(new Date().toLocaleTimeString()),title:"Clear log console",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,a.jsx)(tz,{className:"w-3 h-3"})}),l&&(0,a.jsx)("button",{onClick:l,title:i?"Restore panel size":"Maximize panel",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:i?(0,a.jsx)(tI.f,{className:"w-3 h-3"}):(0,a.jsx)(tR.f,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:r,title:"Close panel (Cmd+J / Ctrl+J)",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,a.jsx)(tN.X,{className:"w-3 h-3"})})]})]}),(0,a.jsx)("div",{ref:b,className:"flex-1 p-2 font-mono text-[11px] leading-relaxed overflow-y-auto bg-[#181818] select-text divide-y divide-[#222222]",children:0===v.length?(0,a.jsx)("div",{className:"text-slate-500 italic py-4 text-center",children:"No logs match the current filters"}):v.map(e=>{let t="TOOL"===e.level,s="ERROR"===e.level,r="app"===e.clientType;return(0,a.jsxs)("div",{className:"py-1 flex items-start gap-2 hover:bg-[#202020] px-1 rounded",children:[(0,a.jsx)("span",{suppressHydrationWarning:!0,className:"text-slate-500 shrink-0 text-[10px]",children:e.time}),(0,a.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${s?"bg-rose-950/80 text-rose-300 border border-rose-500/40":t?"bg-cyan-950/80 text-cyan-300 border border-cyan-500/40":"bg-slate-800 text-slate-300 border border-slate-700"}`,children:e.level}),(0,a.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${r?"bg-purple-950/80 text-purple-300 border border-purple-500/40":"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40"}`,children:r?"APP":"CLI"}),(0,a.jsxs)("span",{className:"text-slate-300 font-semibold shrink-0",children:["[",e.account,"]"]}),(0,a.jsx)("span",{className:"text-slate-400 break-all",children:e.message}),e.meta&&(0,a.jsx)("span",{className:"text-slate-500 text-[10px] truncate max-w-xs",children:e.meta})]},e.id)})})]})}var t$=e.i(12092),tO=e.i(86206),tF=e.i(8734),tW=e.i(89664),tD=e.i(17099),tV=e.i(81390),tB=e.i(60244);function tH({selectedAgent:e=null,workstations:t=[],activeTab:s="chat",onTabChange:r,onSelectAgent:i,onClose:l,onStartReplay:n}){let u,x,f,p,m,g,b,y,v,w,[j,k]=(0,o.useState)(!1),[S,N]=(0,o.useState)(s||"chat"),C=r?s:S,T=e=>{r?r(e):N(e)},M=e?.clientType==="app"||(e?.provider||"").toLowerCase().includes("(app)"),_=e?.state==="streaming"||e?.state==="busy"||e?.state==="working"||e?.mode==="streaming";return(0,a.jsxs)("div",{"data-testid":"secondary-sidebar-container",className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,a.jsxs)("div",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#1e1e1e] px-2 flex items-center justify-between shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>T("chat"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"chat"===C?"bg-[#1e1e1e] text-cyan-400 border border-[#3e3e42]":"text-slate-400 hover:text-slate-200 hover:bg-[#2d2d2d]"}`,title:"View Agent Live Chat & Conversation Transcript",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(c.f,{className:"w-3.5 h-3.5"}),_&&(0,a.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-cyan-400 animate-ping"})]}),(0,a.jsx)("span",{children:"Live Chat"}),_&&(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 inline-block ml-0.5"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>T("inspector"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"inspector"===C?"bg-[#1e1e1e] text-cyan-400 border border-[#3e3e42]":"text-slate-400 hover:text-slate-200 hover:bg-[#2d2d2d]"}`,title:"View Agent specs, telemetry, and token usage",children:[(0,a.jsx)(t$.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{children:"Inspector"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:["chat"===C&&e&&(0,a.jsx)("button",{onClick:()=>(0,eP.f)(e.connectionId||e.traceId),title:"Open in Detached Window (VS Code style)",className:"p-1 rounded text-slate-400 hover:text-cyan-300 hover:bg-[#333333] transition-colors cursor-pointer",children:(0,a.jsx)(d.f,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{onClick:l,title:"Close Secondary Sidebar (Cmd+Alt+B)",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",children:(0,a.jsx)(tN.X,{className:"w-3.5 h-3.5"})})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col",children:"chat"===C?e?(0,a.jsx)(tD.f,{sessionTrace:e,isSidebar:!0,onClose:l,onStartReplay:n}):(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col justify-center items-center text-center space-y-4",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center text-slate-500",children:(0,a.jsx)(c.f,{className:"w-6 h-6"})}),(0,a.jsxs)("div",{className:"space-y-1.5 max-w-[280px]",children:[(0,a.jsx)("h4",{className:"font-bold text-slate-300 text-xs",children:"No Agent Selected"}),(0,a.jsx)("p",{className:"text-[11px] text-slate-400 leading-relaxed",children:"Click any workstation on the virtual office or select an active agent below to inspect live conversation:"})]}),t.length>0&&(0,a.jsxs)("div",{className:"w-full max-w-[280px] space-y-1.5 pt-2 text-left",children:[(0,a.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-500 block px-1",children:["Active Agents (",t.length,")"]}),(0,a.jsx)("div",{className:"space-y-1 max-h-[28rem] overflow-y-auto pr-1",children:t.map((e,t)=>{let s="streaming"===e.state||"busy"===e.state||"working"===e.state||"streaming"===e.mode,r=e.account||"agent-factory",l=e.sessionTitle||r,n="app"===e.clientType||(e.provider||"").includes("(app)"),o="extension"===e.clientType||(e.provider||"").includes("extension")||(e.connectionId||"").toLowerCase().includes("extension"),c=e.lastText?`${"assistant"===e.lastTextRole?"AI: ":"user"===e.lastTextRole?"You: ":""}${e.lastText}`:`${r} \xb7 ${e.model||"AI Agent"}${e.activeTool?` \xb7 ${e.activeTool}`:""}`;return(0,a.jsxs)("button",{onClick:()=>i?.(e.connectionId||e.traceId),className:"w-full flex items-center gap-2 p-2 rounded bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] text-left transition-colors cursor-pointer text-slate-300",children:[(0,a.jsx)(e$.f,{className:"w-3.5 h-3.5 text-cyan-400 shrink-0 self-start mt-0.5"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"truncate font-medium text-xs text-slate-200",title:l,children:l}),o?(0,a.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"EXT"}):n?(0,a.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"APP"}):(0,a.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"CLI"})]}),(0,a.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:c,children:c})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[s&&(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),(0,a.jsx)(td.f,{className:"w-3.5 h-3.5 text-slate-500"})]})]},e.connectionId||e.traceId||`active-agent-${t}`)})})]})]}):(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-3 space-y-3 text-xs select-text",children:e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-6 rounded bg-[#1e1e1e] flex items-center justify-center border border-[#3e3e42]",children:(0,a.jsx)(tp.f,{className:"w-3.5 h-3.5 text-cyan-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-bold text-slate-200 text-xs",children:e.account||`Desk #${(e.deskIndex??0)+1}`}),(0,a.jsxs)("p",{className:"text-[10px] text-slate-400 font-mono",children:["ID: ",e.connectionId?.slice(0,8),"..."]})]})]}),M?(0,a.jsxs)("span",{className:"bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,a.jsx)(tO.f,{className:"w-2.5 h-2.5"}),(0,a.jsx)("span",{children:"APP"})]}):(0,a.jsxs)("span",{className:"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,a.jsx)(ts.f,{className:"w-2.5 h-2.5"}),(0,a.jsx)("span",{children:"CLI"})]})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-[#2b2b2b] grid grid-cols-2 gap-2 text-[11px]",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"PROVIDER"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300 uppercase",children:e.provider||"Unavailable"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"MODEL"}),(0,a.jsx)("span",{className:"font-semibold text-emerald-400 truncate block",children:e.model||"Unavailable"})]})]})]}),(0,a.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"CURRENT ACTIVITY"}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-[11px]",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Status:"}),(0,a.jsx)("span",{className:`font-semibold capitalize px-1.5 py-0.2 rounded text-[10px] ${"streaming"===e.state?"bg-cyan-500/20 text-cyan-300 border border-cyan-500/30":"busy"===e.state?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"error"===e.state?"bg-rose-500/20 text-rose-300 border border-rose-500/30":"bg-slate-800 text-slate-400"}`,children:e.state||"Idle"})]}),e.activeTool&&(0,a.jsxs)("div",{className:"pt-1",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[11px] block",children:"Active Tool:"}),(0,a.jsx)("div",{className:"mt-1 bg-[#181818] p-1.5 rounded border border-[#2b2b2b] font-mono text-[10px] text-cyan-300 truncate",children:e.activeTool})]})]}),(u=(0,tB.F)(),x=e?.skin||u?.equippedSkin,f=e?.aura||u?.equippedAura,p=e?.pet||u?.equippedPet,m=e?.props&&e.props.length>0?e.props:u?.equippedProps||[],g=e?.trophy||u?.equippedTrophy,b=x&&"classic"!==x&&"none"!==x?(0,tV.x)(x):null,y=f&&"none"!==f?(0,tV.x)(f):null,v=p&&"none"!==p?(0,tV.x)(p):null,w=g&&"none"!==g?(0,tV.x)(g):null,(0,a.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-[10px] font-bold text-cyan-400 uppercase tracking-wider flex items-center gap-1.5",children:[(0,a.jsx)(eQ.f,{className:"w-3 h-3 text-cyan-400"}),(0,a.jsx)("span",{children:"EQUIPPED COSMETICS"})]}),(b||y||v||w||m.length>0)&&(0,a.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/80 text-cyan-300 border border-cyan-500/40 font-mono font-bold",children:"ACTIVE GEAR"})]}),(0,a.jsxs)("div",{className:"space-y-1.5 text-[11px]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Chassis Skin:"}),(0,a.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-full inline-block border border-white/20",style:{backgroundColor:b.color}}),(0,a.jsx)("span",{className:"text-emerald-400 font-semibold truncate max-w-[120px]",children:b.name}),(0,a.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-slate-800 text-slate-400 border border-slate-700",children:b.archetype})]}):(0,a.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Classic Chassis"})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Particle Aura:"}),(0,a.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:y?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-purple-400 font-semibold truncate max-w-[120px]",children:y.name}),(0,a.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-purple-950/60 text-purple-300 border border-purple-800/40",children:y.archetype})]}):(0,a.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,a.jsxs)("div",{className:"py-1 border-b border-[#2d2d30]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Tech Desk Props:"}),(0,a.jsxs)("span",{className:"text-[9px] text-slate-500 font-mono",children:["(",m.length,")"]})]}),m.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:m.map((e,t)=>{let s=(0,tV.x)(e);return(0,a.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/60 text-cyan-300 border border-cyan-800/40 font-mono flex items-center gap-1",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:s?.color||"#38bdf8"}}),(0,a.jsx)("span",{children:s?.name||e})]},t)})}):(0,a.jsx)("span",{className:"text-slate-500 text-[10px]",children:"Standard Workstation"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Companion Pet:"}),(0,a.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:v?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-amber-400 font-semibold truncate max-w-[120px]",children:v.name}),(0,a.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-amber-950/60 text-amber-300 border border-amber-800/40",children:v.archetype})]}):(0,a.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Desk Trophy:"}),(0,a.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:w?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-yellow-400 font-semibold truncate max-w-[120px]",children:w.name}),(0,a.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-yellow-950/60 text-yellow-300 border border-yellow-800/40",children:w.archetype})]}):(0,a.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]})]})]})),(0,a.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"TOKEN USAGE"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-[11px]",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Total Tokens"}),(0,a.jsx)("span",{className:"font-bold text-emerald-400 font-mono",children:Number.isFinite(e.totalTokens)?e.totalTokens.toLocaleString():"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Requests / Steps"}),(0,a.jsx)("span",{className:"font-bold text-slate-300 font-mono",children:Number.isFinite(e.requestCount)?e.requestCount:"—"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-1.5 pt-1",children:[n&&(0,a.jsxs)("button",{onClick:()=>n(e.connectionId||e.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#007acc] hover:bg-[#0062a3] text-white font-medium text-xs transition-colors shadow-sm cursor-pointer",children:[(0,a.jsx)(h.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{children:"Replay Session"})]}),(0,a.jsxs)("button",{onClick:()=>T("chat"),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-200 hover:text-white font-medium text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,a.jsx)(c.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,a.jsx)("span",{children:"View Live Chat (Pin to Sidebar)"})]}),(0,a.jsxs)("button",{onClick:()=>(0,eP.f)(e.connectionId||e.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 hover:text-white text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,a.jsx)(d.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,a.jsx)("span",{children:"Open in Detached Window"})]}),(0,a.jsxs)("button",{onClick:()=>{e?.connectionId&&(navigator.clipboard?.writeText(e.connectionId),k(!0),setTimeout(()=>k(!1),2e3))},className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[j?(0,a.jsx)(tW.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,a.jsx)(tF.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{children:j?"Connection ID Copied!":"Copy Connection ID"})]})]})]}):(0,a.jsxs)("div",{className:"py-12 text-center text-slate-500 space-y-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center mx-auto text-slate-600",children:(0,a.jsx)(t$.f,{className:"w-5 h-5"})}),(0,a.jsxs)("div",{className:"space-y-1 px-4",children:[(0,a.jsx)("h4",{className:"font-bold text-slate-400 text-xs",children:"No Agent Selected"}),(0,a.jsx)("p",{className:"text-[11px] leading-relaxed",children:"Click any workstation on the virtual office or select from the Explorer list to inspect telemetry and details."})]})]})})})]})}let tU={name:"users",size:24,node:[["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"}]]};tU.node;let tq=(0,eD.f)(tU);function tG({mode:e="live",connected:t=!0,live:s=!0,stats:r={},selectedAgent:i=null,soundEnabled:l=!1,isBottomOpen:n=!0,onToggleBottom:o}){return(0,a.jsxs)("footer",{"data-testid":"status-bar",className:"h-[22px] min-h-[22px] bg-[#181818] border-t border-[#2b2b2b] px-3 flex items-center justify-between text-[11px] text-[#cccccc] select-none shrink-0 z-30 font-sans",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 hover:text-white cursor-pointer transition-colors",children:[(0,a.jsx)("span",{className:`w-2 h-2 rounded-full ${t&&s?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-amber-400"}`}),(0,a.jsx)("span",{className:"font-medium text-[10px]",children:"live"===e?"WATCHER: LIVE":"MODE: DEMO MOCK"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 hover:text-white transition-colors",children:[(0,a.jsx)(tq,{className:"w-3 h-3 text-[#007acc]"}),(0,a.jsxs)("span",{children:[r?.agents||0," Desks"]})]}),r?.busy>0&&(0,a.jsxs)("div",{className:"flex items-center gap-1 text-emerald-400",children:[(0,a.jsx)(tt.f,{className:"w-3 h-3 animate-spin"}),(0,a.jsxs)("span",{children:[r.busy," Working"]})]})]}),(0,a.jsx)("div",{className:"hidden md:flex items-center gap-2 text-slate-400 text-[10px]",children:i?(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(tp.f,{className:"w-3 h-3 text-cyan-400"}),(0,a.jsx)("span",{className:"text-slate-200 font-semibold truncate max-w-[200px]",children:i.account||i.connectionId}),(0,a.jsxs)("span",{children:["(",i.model||"gemini-3.8-flash",")"]})]}):(0,a.jsx)("span",{children:"Ready · Real-time monitoring Antigravity CLI, App & Claude"})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 text-[10px]",children:[l?(0,a.jsx)(eW.f,{className:"w-3 h-3 text-emerald-400"}):(0,a.jsx)(eB,{className:"w-3 h-3 text-slate-500"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:l?"Audio On":"Muted"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 font-mono text-[10px]",children:[(0,a.jsx)("span",{children:"Tokens:"}),(0,a.jsx)("span",{className:"text-emerald-400 font-bold",children:r?.tokensLabel||"0k"})]}),(0,a.jsxs)("button",{type:"button",onClick:o,title:n?"Hide Terminal (Cmd+J)":"Show Terminal (Cmd+J)",className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${n?"bg-[#007acc]/20 text-[#4fc1ff]":"text-slate-400 hover:text-white hover:bg-[#252526]"}`,children:[(0,a.jsx)(ts.f,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"text-[10px] hidden sm:inline",children:"Terminal"})]})]})]})}var tY=e.i(13285);let tX={name:"type",size:24,node:[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]};tX.node;let tK=(0,eD.f)(tX);function tJ({isOpen:e=!1,onClose:t,onOpenStore:s,onOpenThemeSettings:r,onOpenFontSettings:i,onToggleLeftSidebar:l,onToggleBottomPanel:n,onToggleRightSidebar:u,onOpenChatSidebar:x,onOpenFilesExplorer:f,onToggleSound:p,onToggleNotif:m,onRefresh:g,onSetMode:b,onSelectPreset:y,onOpenReports:v,onStartReplay:w}){let[j,k]=(0,o.useState)(""),S=(0,o.useRef)(null);if((0,o.useEffect)(()=>{e&&(setTimeout(()=>S.current?.focus(),50),k(""))},[e]),(0,o.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e,t]),!e)return null;let N=[{id:"toggle-left",title:"View: Toggle Primary Side Bar",shortcut:"Cmd+B",icon:e1,action:()=>{l(),t()}},{id:"open-files-explorer",title:"File: Open Workspace Files Explorer (Code & Artifacts)",icon:ta,action:()=>{f?.(),t()}},{id:"toggle-bottom",title:"View: Toggle Bottom Panel (Terminal & Logs)",shortcut:"Cmd+J",icon:e5,action:()=>{n(),t()}},{id:"toggle-right",title:"View: Toggle Secondary Side Bar (Live Chat & Inspector)",shortcut:"Cmd+Alt+B",icon:e4,action:()=>{u(),t()}},{id:"open-chat-sidebar",title:"Chat: Pin Live Chat to Sidebar",icon:c.f,action:()=>{x?.(),t()}},{id:"open-chat-new-window",title:"Chat: Move into New Window (Detached)",icon:d.f,action:()=>{(0,eP.f)(),t()}},{id:"preferences-theme",title:"Preferences: Color Theme (VS Code Themes)",icon:eZ.f,action:()=>{r?.(),t()}},{id:"preferences-fonts",title:"Preferences: Configure Fonts (UI & Monospace)",icon:tK,action:()=>{i?.(),t()}},{id:"open-reports",title:"Reports: Open Token Usage & Analytics Report",icon:eK.f,action:()=>{v?.(),t()}},{id:"open-store",title:"Store: Open Supporter Store & Character Customization (Buy Me a Coffee)",icon:eJ.f,action:()=>{s?.(),t()}},{id:"start-replay",title:"Time-Machine: Replay Session History",icon:h.f,action:()=>{w?.(),t()}},{id:"refresh-watchers",title:"Watcher: Force Refresh All Watchers & Brain Transcripts",shortcut:"Cmd+R",icon:eF.f,action:()=>{g(),t()}},{id:"live-mode",title:"Mode: Switch to Live Watchers (Realtime ~/.gemini & ~/.claude)",icon:eX,action:()=>{b("live"),t()}},{id:"mock-storm",title:"Preset: Run Storm Demo (30 Agents Stress Test)",icon:tY.f,action:()=>{b("mock"),y("storm"),t()}},{id:"mock-busy",title:"Preset: Run Busy Demo (8 Working Agents)",icon:tY.f,action:()=>{b("mock"),y("busy"),t()}},{id:"toggle-sound",title:"Audio: Toggle 8-bit Sound FX",icon:eW.f,action:()=>{p(),t()}},{id:"toggle-notif",title:"System: Toggle Desktop Notifications",icon:eU,action:()=>{m(),t()}}].filter(e=>e.title.toLowerCase().includes(j.toLowerCase()));return(0,a.jsx)("div",{onClick:t,className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-start justify-center pt-16 px-4",children:(0,a.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"w-full max-w-xl bg-[#252526] border border-[#3e3e42] rounded-lg shadow-2xl overflow-hidden flex flex-col max-h-[420px]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 bg-[#1e1e1e] border-b border-[#333333]",children:[(0,a.jsx)(eO.f,{className:"w-4 h-4 text-slate-400 shrink-0"}),(0,a.jsx)("input",{ref:S,type:"text",value:j,onChange:e=>k(e.target.value),placeholder:"Type a command or search actions...",className:"w-full bg-transparent text-xs text-slate-100 outline-none placeholder:text-slate-500"}),(0,a.jsx)("kbd",{className:"text-[10px] bg-[#2a2d2e] border border-[#3e3e42] rounded px-1.5 py-0.5 text-slate-400",children:"Esc"})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2d2d2d] py-1",children:0===N.length?(0,a.jsx)("div",{className:"p-4 text-center text-xs text-slate-500 italic",children:"No matching commands found"}):N.map(e=>{let t=e.icon;return(0,a.jsxs)("div",{onClick:e.action,className:"flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-[#007acc] hover:text-white text-[#cccccc] text-xs transition-colors group",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)(t,{className:"w-4 h-4 text-slate-400 group-hover:text-white shrink-0"}),(0,a.jsx)("span",{className:"font-medium truncate text-[11px]",children:e.title})]}),e.shortcut&&(0,a.jsx)("kbd",{className:"font-mono text-[9px] bg-[#1e1e1e] group-hover:bg-[#0062a3] border border-[#3e3e42] group-hover:border-transparent px-1.5 py-0.5 rounded text-slate-400 group-hover:text-white shrink-0",children:e.shortcut})]},e.id)})})]})})}var tZ=e.i(93414),tQ=e.i(38268),t0=e.i(47760);let t1={extension:{type:t0.x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await e.A(86043)}},t2={extension:{type:t0.x.Environment,name:"webworker",priority:0},test:()=>"u">typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await e.A(62925)}};e.i(10463),e.i(99650),e.i(58035);var t5=e.i(95932);t0.H.add(t1,t2);var t3=e.i(27402),t4=e.i(2351);async function t8(e={}){return void 0!==i?i:i=await (async()=>{let t=t3.f.get().getNavigator().gpu;if(!t)return!1;try{let s=await t.requestAdapter(e);return await s.requestDevice(),!0}catch(e){return!1}})()}let t6=["webgl","webgpu","canvas"];async function t7(t){let s,i=[];t.preference?Array.isArray(t.preference)?i=t.preference.slice():(i.push(t.preference),t6.forEach(e=>{e!==t.preference&&i.push(e)})):i=t6.slice();let l={};for(let n=0;n<i.length;n++){let a=i[n];if("webgpu"===a&&await t8()){let{WebGPURenderer:r}=await e.A(53088);s=r,l={...t,...t.webgpu};break}if("webgl"===a&&function(e){return void 0!==r?r:r=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:e??t4.f.defaultOptions.failIfMajorPerformanceCaveat};try{if(!t3.f.get().getWebGLRenderingContext())return!1;let e=t3.f.get().createCanvas().getContext("webgl",t),s=!!e?.getContextAttributes()?.stencil;if(e){let t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}return e=null,s}catch(e){return!1}})()}(t.failIfMajorPerformanceCaveat??t4.f.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:r}=await e.A(99331);s=r,l={...t,...t.webgl};break}if("canvas"===a){let{CanvasRenderer:r}=await e.A(35640);s=r,l={...t,...t.canvasOptions};break}}if(delete l.webgpu,delete l.webgl,delete l.canvasOptions,!s)throw Error("No available renderer for the current environment");let n=new s;return await n.init(l),n}var t9=e.i(50147),se=e.i(81834),st=e.i(49864);class ss{static init(e){Object.defineProperty(this,"resizeTo",{configurable:!0,set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{let e,t;if(this._resizeTo){if(this._cancelResize(),this._resizeTo===globalThis.window)e=globalThis.innerWidth,t=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:r}=this._resizeTo;e=s,t=r}this.renderer.resize(e,t),this.render()}},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}ss.extension=t0.x.Application;var sr=e.i(59750),si=e.i(6972);class sl{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,sr.f.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?si.f.shared:new si.f,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}}sl.extension=t0.x.Application,t0.H.add(ss),t0.H.add(sl);let sn=class e{constructor(...e){this.stage=new t9.t,void 0!==e[0]&&(0,st.K)(st.e,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new t9.t),this.renderer=await t7(t),e._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,st.K)(st.e,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){return this.renderer.renderPipes.dom?._domElement}destroy(t=!1,s=!1){let r=e._plugins.slice(0);r.reverse(),r.forEach(e=>{e.destroy.call(this)}),this.stage.destroy(s),this.stage=null,this.renderer.destroy(t),this.renderer=null}};sn._plugins=[],t0.H.handleByList(t0.x.Application,sn._plugins),t0.H.add(se.L);var sa=e.i(81541),so=e.i(94425),sc=e.i(95627),sd=e.i(4864),sh=e.i(56857),su=e.i(97377);class sx extends su.f{constructor(e,t){let{text:s,resolution:r,style:i,anchor:l,width:n,height:a,roundPixels:o,...c}=e;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=s??"",this.style=i,this.resolution=r??null,this.allowChildren=!1,this._anchor=new sh.f({_onUpdate:()=>{this.onViewUpdate()}}),l&&(this.anchor=l),this.roundPixels=o??!1,void 0!==n&&(this.width=n),void 0!==a&&(this.height=a)}get anchor(){return this._anchor}set anchor(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=null===e,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){"object"==typeof e?(t=e.height??e.width,e=e.width):t??(t=e),void 0!==e&&this._setWidth(e,this.bounds.width),void 0!==t&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,s=this.bounds.height,r=-t*this.anchor.x,i=0;return!!(e.x>=r)&&!!(e.x<=r+t)&&(i=-s*this.anchor.y,!!(e.y>=i)&&!!(e.y<=i+s))||!1}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(e=!1){this._style?.off("update",this.onViewUpdate,this),super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof e?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var sf=e.i(57471),sp=e.i(63646),sm=e.i(81735),sg=e.i(61411);let sb=null,sy=null;function sv(e,t,s){for(let r=0,i=4*s*t;r<t;++r,i+=4)if(0!==e[i+3])return!1;return!0}function sw(e,t,s,r,i){let l=4*t;for(let t=r,n=r*l+4*s;t<=i;++t,n+=l)if(0!==e[n+3])return!1;return!0}class sj{constructor(e=0,t=0,s=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=s,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){let t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){let t=Array(e.length);for(let s=0;s<e.length;s++){let r=e[s];t[s]=[r,this.get(r)]}return t}evict(e=!1){if(e||this.size>0){let e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t=this.items[e];if(void 0!==t)return this.ttl>0&&t.expiry<=Date.now()?void this.delete(e):(this.moveToEnd(t),t.value)}has(e){return e in this.items}moveToEnd(e){this.last!==e&&(null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),e.prev=this.last,e.next=null,null!==this.last&&(this.last.next=e),this.last=e,null===this.first&&(this.first=e))}keys(){let e=Array(this.size),t=this.first,s=0;for(;null!==t;)e[s++]=t.key,t=t.next;return e}setWithEvicted(e,t,s=this.resetTtl){let r=null;if(this.has(e))this.set(e,t,!0,s);else{this.max>0&&this.size===this.max&&(r={...this.first},this.evict(!0));let s=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};1==++this.size?this.first=s:this.last.next=s,this.last=s}return r}set(e,t,s=!1,r=this.resetTtl){let i=this.items[e];return s||void 0!==i?(i.value=t,!1===s&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(i)):(this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=i:this.last.next=i,this.last=i),this}values(e=this.keys()){let t=Array(e.length);for(let s=0;s<e.length;s++)t[s]=this.get(e[s]);return t}}function sk(e){return!!e.tagStyles&&Object.keys(e.tagStyles).length>0}function sS(e){return e.includes("<")}let sN=new Set([10,13]),sC=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),sT=new Set([45,8208,8211,8212,173]),sM=/(\r\n|\r|\n)/,s_=/(?:\r\n|\r|\n)/;function sz(e){return"string"==typeof e&&sN.has(e.charCodeAt(0))}function sR(e,t){return"string"==typeof e&&sC.has(e.charCodeAt(0))}function sI(e){return"normal"===e||"pre-line"===e}function sL(e){return"normal"===e}function sE(e){if("string"!=typeof e)return"";let t=e.length-1;for(;t>=0&&sR(e[t]);)t--;return t<e.length-1?e.slice(0,t+1):e}function sA(e){let t=[],s=[];if("string"!=typeof e)return t;for(let r=0;r<e.length;r++){let i=e[r],l=e[r+1];if(sR(i,l)||sz(i)){s.length>0&&(t.push(s.join("")),s.length=0),"\r"===i&&"\n"===l?(t.push("\r\n"),r++):t.push(i);continue}s.push(i),"string"==typeof i&&sT.has(i.charCodeAt(0))&&l&&!sR(l)&&!sz(l)&&(t.push(s.join("")),s.length=0)}return s.length>0&&t.push(s.join("")),t}function sP(e,t,s,r){let i=s(e),l=[];for(let s=0;s<i.length;s++){let n=i[s],a=n,o=1;for(;i[s+o];){let l=i[s+o];if(r(a,l,e,s,t))break;n+=l,a=l,o++}s+=o-1,l.push(n)}return l}let s$=/\r\n|\r|\n/g,sO={willReadFrequently:!0};function sF(e,t,s,r,i){let l=s[e];return"number"!=typeof l&&(l=i(e,t,r)+t,s[e]=l),l}let sW={willReadFrequently:!0},sD=class e{static get experimentalLetterSpacingSupported(){let t=e._experimentalLetterSpacingSupported;if(void 0===t){let s=t3.f.get().getCanvasRenderingContext2D().prototype;t=e._experimentalLetterSpacingSupported="letterSpacing"in s||"textLetterSpacing"in s}return t}constructor(e,t,s,r,i,l,n,a,o,c){this.text=e,this.style=t,this.width=s,this.height=r,this.lines=i,this.lineWidths=l,this.lineHeight=n,this.maxLineWidth=a,this.fontProperties=o,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",s,r=e._canvas,i=s.wordWrap){let l=`${t}-${s.styleKey}-wordWrap-${i}`;if(e._measurementCache.has(l))return e._measurementCache.get(l);if(sk(s)&&sS(t)){let r=function(e,t,s,r,i,l,n,a,o){let c=function(e,t){let s=[],r=t.tagStyles;if(!sk(t)||!sS(e))return s.push({text:e,style:t}),s;let i=[t],l=[],n="",a=0;for(;a<e.length;){let t=e[a];if("<"===t){let d=e.indexOf(">",a);if(-1===d){n+=t,a++;continue}let h=e.indexOf("<",a+1);if(-1!==h&&h<d){n+=t,a++;continue}let u=e.slice(a+1,d);if(u.startsWith("/")){let t=u.slice(1).trim();if(l.length>0&&l[l.length-1]===t){n.length>0&&(s.push({text:n,style:i[i.length-1]}),n=""),i.pop(),l.pop(),a=d+1;continue}n+=e.slice(a,d+1),a=d+1;continue}{let t=u.trim();if(r[t]){var o,c;n.length>0&&(s.push({text:n,style:i[i.length-1]}),n="");let e=(o=i[i.length-1],c=r[t],o.clone().assign(c));i.push(e),l.push(t),a=d+1;continue}n+=e.slice(a,d+1),a=d+1;continue}}n+=t,a++}return n.length>0&&s.push({text:n,style:i[i.length-1]}),s}(e,t);if(sL(t.whiteSpace))for(let e=0;e<c.length;e++){let t=c[e];c[e]={text:t.text.replace(s$," "),style:t.style}}let d=[],h=[];for(let e of c){let t=e.text.split(sM);for(let s=0;s<t.length;s++){let r=t[s];"\r\n"===r||"\r"===r||"\n"===r?(d.push(h),h=[]):r.length>0&&h.push({text:r,style:e.style})}}(h.length>0||0===d.length)&&d.push(h);let u=s?function(e,t,s,r,i,l){let{letterSpacing:n,whiteSpace:a,wordWrapWidth:o,breakWords:c}=t,d=sI(a),h=o+n,u={},x="",f=(e,t)=>{let i=`${e}|${t.styleKey}`,l=u[i];if(void 0===l){let n=t._fontString;n!==x&&(s.font=n,x=n),l=r(e,t.letterSpacing,s)+t.letterSpacing,u[i]=l}return l},p=[];for(let t of e){let e=function(e){let t=[],s=!1;for(let r of e){let e=sA(r.text),i=!0;for(let l of e){let e=sR(l)||sz(l),n=i&&s&&!e;t.push({token:l,style:r.style,continuesFromPrevious:n}),s=!e,i=!1}}return t}(t),s=p.length,r=t=>{let s=0,r=t;do{let{token:t,style:i}=e[r];s+=f(t,i),r++}while(r<e.length&&e[r].continuesFromPrevious)return s},n=t=>{let s=[],r=t;do s.push({token:e[r].token,style:e[r].style}),r++;while(r<e.length&&e[r].continuesFromPrevious)return s},a=[],o=0,u=!d,x=null,m=()=>{x&&x.text.length>0&&a.push(x),x=null},g=()=>{if(m(),a.length>0){let e=a[a.length-1];e.text=sE(e.text),0===e.text.length&&a.pop()}p.push(a),a=[],o=0,u=!1};for(let t=0;t<e.length;t++){let{token:s,style:b,continuesFromPrevious:y}=e[t],v=f(s,b);if(d){let e=sR(s),t=x?.text[x.text.length-1]??a[a.length-1]?.text.slice(-1)??"",r=!!t&&sR(t);if(e&&r)continue}let w=!y,j=w?r(t):v;if(j>h&&w)if(o>0&&g(),c){let e=n(t);for(let t=0;t<e.length;t++){let s=e[t].token,r=e[t].style;for(let e of sP(s,c,l,i)){let t=f(e,r);t+o>h&&g(),x&&x.style===r?x.text+=e:(m(),x={text:e,style:r}),o+=t}}t+=e.length-1}else{let e=n(t);m(),p.push(e.map(e=>({text:e.token,style:e.style}))),u=!1,t+=e.length-1}else if(j+o>h&&w){if(sR(s)){u=!1;continue}g(),x={text:s,style:b},o=v}else if(y&&!c)x&&x.style===b?x.text+=s:(m(),x={text:s,style:b}),o+=v;else{let e=sR(s);if(0===o&&e&&!u)continue;x&&x.style===b?x.text+=s:(m(),x={text:s,style:b}),o+=v}}if(m(),a.length>0){let e=a[a.length-1];e.text=sE(e.text),0===e.text.length&&a.pop()}(a.length>0||p.length===s)&&p.push(a)}return p}(d,t,r,l,a,o):d,x=[],f=[],p=[],m=[],g=[],b=0,y=n(t._fontString);0===y.fontSize&&(y.fontSize=t.fontSize,y.ascent=t.fontSize);let v="",w=!!t.dropShadow,j=t._stroke?.width||0;for(let e of u){let s=0,l=y.ascent,a=y.descent,o="";for(let t of e){let e=t.style._fontString,c=n(e);e!==v&&(r.font=e,v=e),s+=i(t.text,t.style.letterSpacing,r),l=Math.max(l,c.ascent),a=Math.max(a,c.descent),o+=t.text;let d=t.style._stroke?.width||0;d>j&&(j=d),!w&&t.style.dropShadow&&(w=!0)}0===e.length&&(l=y.ascent,a=y.descent),x.push(s),f.push(l),p.push(a),g.push(o);let c=t.lineHeight||l+a;m.push(c+t.leading),b=Math.max(b,s)}let k=j,S=b+k+(t.dropShadow?t.dropShadow.distance:0),N=0;for(let e=0;e<m.length;e++)N+=m[e];return{width:S,height:(N=Math.max(N,m[0]+k))+(t.dropShadow?t.dropShadow.distance:0),lines:g,lineWidths:x,lineHeight:(t.lineHeight||y.fontSize)+t.leading,maxLineWidth:b,fontProperties:y,runsByLine:u,lineAscents:f,lineDescents:p,lineHeights:m,hasDropShadow:w}}(t,s,i,e._context,e._measureText,e._measureTextAdvance,e.measureFont,e.canBreakChars,e.wordWrapSplit),n=new e(t,s,r.width,r.height,r.lines,r.lineWidths,r.lineHeight,r.maxLineWidth,r.fontProperties,{runsByLine:r.runsByLine,lineAscents:r.lineAscents,lineDescents:r.lineDescents,lineHeights:r.lineHeights,hasDropShadow:r.hasDropShadow});return e._measurementCache.set(l,n),n}let n=s._fontString,a=e.measureFont(n);0===a.fontSize&&(a.fontSize=s.fontSize,a.ascent=s.fontSize,a.descent=0);let o=e._context;o.font=n;let c=(i?e._wordWrap(t,s,r):t).split(s_),d=Array(c.length),h=0;for(let t=0;t<c.length;t++){let r=e._measureText(c[t],s.letterSpacing,o);d[t]=r,h=Math.max(h,r)}let u=s._stroke?.width??0,x=s.lineHeight||a.fontSize,f=e._adjustWidthForStyle(h,s),p=Math.max(x,a.fontSize+u)+(c.length-1)*(x+s.leading),m=e._adjustHeightForStyle(p,s),g=new e(t,s,f,m,c,d,x+s.leading,h,a);return e._measurementCache.set(l,g),g}static _adjustWidthForStyle(e,t){let s=e+(t._stroke?.width||0);return t.dropShadow&&(s+=t.dropShadow.distance),s}static _adjustHeightForStyle(e,t){let s=e;return t.dropShadow&&(s+=t.dropShadow.distance),s}static _measureText(t,s,r){let{metricWidth:i,metrics:l,letterSpacingVal:n}=e._measureTextCore(t,s,r),a=-(l.actualBoundingBoxLeft??0),o=(l.actualBoundingBoxRight??0)-a;return l.width>0&&(o+=n),Math.max(i,o)}static _measureTextAdvance(t,s,r){return e._measureTextCore(t,s,r).metricWidth}static _measureTextCore(t,s,r){let i=!1;e.experimentalLetterSpacingSupported&&(e.experimentalLetterSpacing?(r.letterSpacing=`${s}px`,r.textLetterSpacing=`${s}px`,i=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let l=r.measureText(t),n=l.width,a=0;return n>0&&(n+=a=i?-s:(e.graphemeSegmenter(t).length-1)*s),{metricWidth:n,metrics:l,letterSpacingVal:a}}static _wordWrap(t,s,r=e._canvas){return function(e,t,s,r,i,l,n){let a=s.getContext("2d",sO);a.font=t._fontString;let o=0,c="",d=[],h=Object.create(null),{letterSpacing:u,whiteSpace:x}=t,f=sI(x),p=sL(x),m=!f,g=t.wordWrapWidth+u,b=sA(e);for(let e=0;e<b.length;e++){let s=b[e];if(sz(s)){if(!p){d.push(sE(c)),m=!f,c="",o=0;continue}s=" "}if(f){let e=sR(s),t=sR(c[c.length-1]);if(e&&t)continue}let x=sF(s,u,h,a,r);if(x>g)if(""!==c&&(d.push(sE(c)),c="",o=0),i(s,t.breakWords))for(let e of sP(s,t.breakWords,n,l)){let t=sF(e,u,h,a,r);t+o>g&&(d.push(sE(c)),m=!1,c="",o=0),c+=e,o+=t}else c.length>0&&(d.push(sE(c)),c="",o=0),d.push(sE(s)),m=!1,c="",o=0;else x+o>g&&(m=!1,d.push(sE(c)),c="",o=0),(c.length>0||!sR(s)||m)&&(c+=s,o+=x)}let y=sE(c);return y.length>0&&d.push(y),d.join("\n")}(t,s,r,e._measureTextAdvance,e.canBreakWords,e.canBreakChars,e.wordWrapSplit)}static isBreakingSpace(e,t){return sR(e,t)}static canBreakWords(e,t){return t}static canBreakChars(e,t,s,r,i){return!0}static wordWrapSplit(t){return e.graphemeSegmenter(t)}static measureFont(t){if(e._fonts[t])return e._fonts[t];let s=e._context;s.font=t;let r=s.measureText(e.METRICS_STRING+e.BASELINE_SYMBOL),i=r.actualBoundingBoxAscent??0,l=r.actualBoundingBoxDescent??0,n={ascent:i,descent:l,fontSize:i+l};return e._fonts[t]=n,n}static clearMetrics(t=""){t?delete e._fonts[t]:e._fonts={}}static get _canvas(){if(!e.__canvas){let t;try{let s=new OffscreenCanvas(0,0),r=s.getContext("2d",sW);if(r?.measureText)return e.__canvas=s,s;t=t3.f.get().createCanvas()}catch(e){t=t3.f.get().createCanvas()}t.width=t.height=10,e.__canvas=t}return e.__canvas}static get _context(){return e.__context||(e.__context=e._canvas.getContext("2d",sW)),e.__context}};sD.METRICS_STRING="|ÉqÅ",sD.BASELINE_SYMBOL="M",sD.BASELINE_MULTIPLIER=1.4,sD.HEIGHT_MULTIPLIER=2,sD.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){let e=new Intl.Segmenter;return t=>{let s=e.segment(t),r=[],i=0;for(let e of s)r[i++]=e.segment;return r}}return e=>[...e]})(),sD.experimentalLetterSpacing=!1,sD._fonts={},sD._measurementCache=function(e=1e3,t=0,s=!1){if(isNaN(e)||e<0)throw TypeError("Invalid max value");if(isNaN(t)||t<0)throw TypeError("Invalid ttl value");if("boolean"!=typeof s)throw TypeError("Invalid resetTtl value");return new sj(e,t,s)}(1e3);let sV=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function sB(e){let t="number"==typeof e.fontSize?`${e.fontSize}px`:e.fontSize,s=e.fontFamily;Array.isArray(e.fontFamily)||(s=e.fontFamily.split(","));for(let e=s.length-1;e>=0;e--){let t=s[e].trim();/([\"\'])[^\'\"]+\1/.test(t)||sV.includes(t)||(t=`"${t}"`),s[e]=t}return`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${s.join(",")}`}var sH=e.i(28959),sU=e.i(61805),sq=e.i(31320),sG=e.i(85830),sY=e.i(37836);function sX(e,t,s,r=0,i=0,l=0){if(e.texture===sq.f.WHITE&&!e.fill)return sf.f.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();if(e.fill){if(e.fill instanceof sY.f){let s=e.fill,r=t.createPattern(s.texture.source.resource,"repeat");return sU.f.applyPatternTransform(r,s.transform,!1),r}else if(e.fill instanceof sa.f){let n,a=e.fill,o="linear"===a.type,c="local"===a.textureSpace,d=1,h=1;c&&s&&(d=s.width+r,h=s.height+r);let u=!1;if(o){let{start:e,end:s}=a;n=t.createLinearGradient(e.x*d+i,e.y*h+l,s.x*d+i,s.y*h+l),u=Math.abs(s.x-e.x)<Math.abs((s.y-e.y)*.1)}else{let{center:e,innerRadius:s,outerCenter:r,outerRadius:o}=a;n=t.createRadialGradient(e.x*d+i,e.y*h+l,s*d,r.x*d+i,r.y*h+l,o*d)}if(u&&c&&s){let e=s.lineHeight/h;for(let t=0;t<s.lines.length;t++){let i=(t*s.lineHeight+r/2)/h;a.colorStops.forEach(t=>{let s=i+t.offset*e;s=Math.max(0,Math.min(1,s)),n.addColorStop(Math.floor(1e5*s)/1e5,sf.f.shared.setValue(t.color).toHex())})}}else a.colorStops.forEach(e=>{n.addColorStop(e.offset,sf.f.shared.setValue(e.color).toHex())});return n}}else{let s=t.createPattern(e.texture.source.resource,"repeat"),r=e.matrix.copyTo(sH.f.shared);return r.scale(e.texture.source.pixelWidth,e.texture.source.pixelHeight),s.setTransform(r),s}return(0,sG.f)("FillStyle not recognised",e),"red"}let sK=new sp.f;function sJ(e){let t=0;for(let s=0;s<e.length;s++)32===e.charCodeAt(s)&&t++;return t}let sZ=new class{getCanvasAndContext(e){let{text:t,style:s,resolution:r=1}=e,i=s._getFinalPadding(),l=sD.measureText(t||" ",s),n=Math.ceil(Math.ceil(Math.max(1,l.width)+2*i)*r),a=Math.ceil(Math.ceil(Math.max(1,l.height)+2*i)*r),o=sm.f.getOptimalCanvasAndContext(n,a);this._renderTextToCanvas(s,i,r,o,l);let c=s.trim?function(...e){let t=e[0];t.canvas||(t={canvas:e[0],resolution:e[1]});let{canvas:s}=t,r=Math.min(t.resolution??1,1),i=t.width??s.width,l=t.height??s.height,n=t.output;if(sb||((sy=(sb=t3.f.get().createCanvas(256,128)).getContext("2d",{willReadFrequently:!0})).globalCompositeOperation="copy",sy.globalAlpha=1),(sb.width<i||sb.height<l)&&(sb.width=(0,sg.a)(i),sb.height=(0,sg.a)(l)),!sy)throw TypeError("Failed to get canvas 2D context");sy.drawImage(s,0,0,i,l,0,0,i*r,l*r);let a=sy.getImageData(0,0,i,l).data,o=0,c=0,d=i-1,h=l-1;for(;c<l&&sv(a,i,c);)++c;if(c===l)return sp.f.EMPTY;for(;sv(a,i,h);)--h;for(;sw(a,i,o,c,h);)++o;for(;sw(a,i,d,c,h);)--d;return++d,++h,sy.globalCompositeOperation="source-over",sy.strokeRect(o,c,d-o,h-c),sy.globalCompositeOperation="copy",n??(n=new sp.f),n.set(o/r,c/r,(d-o)/r,(h-c)/r),n}({canvas:o.canvas,width:n,height:a,resolution:1,output:sK}):sK.set(0,0,n,a);return{canvasAndContext:o,frame:c}}returnCanvasAndContext(e){sm.f.returnCanvasAndContext(e)}_renderTextToCanvas(e,t,s,r,i){let l,n;if(i.runsByLine&&i.runsByLine.length>0)return void this._renderTaggedTextToCanvas(i,e,t,s,r);let{canvas:a,context:o}=r,c=sB(e),d=i.lines,h=i.lineHeight,u=i.lineWidths,x=i.maxLineWidth,f=i.fontProperties,p=a.height;if(o.resetTransform(),o.scale(s,s),o.textBaseline=e.textBaseline,e._stroke?.width){let t=e._stroke;o.lineWidth=t.width,o.miterLimit=t.miterLimit,o.lineJoin=t.join,o.lineCap=t.cap}o.font=c;let m=e.dropShadow?2:1,g=(e._stroke?.width??0)/2,b=(h-f.fontSize)/2;h-f.fontSize<0&&(b=0);for(let a=0;a<m;++a){let c=e.dropShadow&&0===a,m=c?Math.ceil(Math.max(1,p)+2*t):0,y=m*s;if(c)this._setupDropShadow(o,e,s,y);else{let s=e._gradientBounds,r=e._gradientOffset;if(s){let l={width:s.width,height:s.height,lineHeight:s.height,lines:i.lines};this._setFillAndStrokeStyles(o,e,l,t,g,r?.x??0,r?.y??0)}else r?this._setFillAndStrokeStyles(o,e,i,t,g,r.x,r.y):this._setFillAndStrokeStyles(o,e,i,t,g);o.shadowColor="rgba(0,0,0,0)"}for(let s=0;s<d.length;s++){l=g,n=g+s*h+f.ascent+b,l+=this._getAlignmentOffset(u[s],x,e.align);let i=0;if("justify"===e.align&&e.wordWrap&&s<d.length-1){let e=sJ(d[s]);e>0&&(i=(x-u[s])/e)}e._stroke?.width&&this._drawLetterSpacing(d[s],e,r,l+t,n+t-m,!0,i),void 0!==e._fill&&this._drawLetterSpacing(d[s],e,r,l+t,n+t-m,!1,i)}}}_renderTaggedTextToCanvas(e,t,s,r,i){let{canvas:l,context:n}=i,{runsByLine:a,lineWidths:o,maxLineWidth:c,lineAscents:d,lineHeights:h,hasDropShadow:u}=e,x=l.height;n.resetTransform(),n.scale(r,r),n.textBaseline=t.textBaseline;let f=u?2:1,p=t._stroke?.width??0;for(let e of a)for(let t of e){let e=t.style._stroke?.width??0;e>p&&(p=e)}let m=p/2,g=[];for(let e=0;e<a.length;e++){let t=a[e],s=[];for(let e of t){let t=sB(e.style);n.font=t,s.push({width:sD._measureText(e.text,e.style.letterSpacing,n),font:t})}g.push(s)}for(let e=0;e<f;++e){let l=u&&0===e,f=l?Math.ceil(Math.max(1,x)+2*s):0,p=f*r;l||(n.shadowColor="rgba(0,0,0,0)");let b=m;for(let e=0;e<a.length;e++){let u=a[e],x=o[e],y=d[e],v=h[e],w=g[e],j=m;j+=this._getAlignmentOffset(x,c,t.align);let k=0;if("justify"===t.align&&t.wordWrap&&e<a.length-1){let e=0;for(let t of u)e+=sJ(t.text);e>0&&(k=(c-x)/e)}let S=b+y,N=j+s;for(let e=0;e<u.length;e++){let t=u[e],{width:a,font:o}=w[e];if(n.font=o,n.textBaseline=t.style.textBaseline,t.style._stroke?.width){let e=t.style._stroke;if(n.lineWidth=e.width,n.miterLimit=e.miterLimit,n.lineJoin=e.join,n.lineCap=e.cap,l)if(t.style.dropShadow)this._setupDropShadow(n,t.style,r,p);else{N+=a+sJ(t.text)*k;continue}else{let r=sD.measureFont(o),i=t.style.lineHeight||r.fontSize;n.strokeStyle=sX(e,n,{width:a,height:i,lineHeight:i,lines:[t.text]},2*s,N-s,b)}this._drawLetterSpacing(t.text,t.style,i,N,S+s-f,!0,k)}N+=a+sJ(t.text)*k}N=j+s;for(let e=0;e<u.length;e++){let t=u[e],{width:a,font:o}=w[e];if(n.font=o,n.textBaseline=t.style.textBaseline,void 0!==t.style._fill){if(l)if(t.style.dropShadow)this._setupDropShadow(n,t.style,r,p);else{N+=a+sJ(t.text)*k;continue}else{let e=sD.measureFont(o),r=t.style.lineHeight||e.fontSize,i={width:a,height:r,lineHeight:r,lines:[t.text]};n.fillStyle=sX(t.style._fill,n,i,2*s,N-s,b)}this._drawLetterSpacing(t.text,t.style,i,N,S+s-f,!1,k)}N+=a+sJ(t.text)*k}b+=v}}}_setFillAndStrokeStyles(e,t,s,r,i,l=0,n=0){e.fillStyle=t._fill?sX(t._fill,e,s,2*r,l,n):null,t._stroke?.width&&(e.strokeStyle=sX(t._stroke,e,s,i+2*r,l,n))}_setupDropShadow(e,t,s,r){e.fillStyle="black",e.strokeStyle="black";let i=t.dropShadow,l=i.color,n=i.alpha;e.shadowColor=sf.f.shared.setValue(l).setAlpha(n).toRgbaString();let a=i.blur*s,o=i.distance*s;e.shadowBlur=a,e.shadowOffsetX=Math.cos(i.angle)*o,e.shadowOffsetY=Math.sin(i.angle)*o+r}_getAlignmentOffset(e,t,s){return"right"===s?t-e:"center"===s?(t-e)/2:0}_drawLetterSpacing(e,t,s,r,i,l=!1,n=0){let{context:a}=s,o=t.letterSpacing,c=!1;if(sD.experimentalLetterSpacingSupported&&(sD.experimentalLetterSpacing?(a.letterSpacing=`${o}px`,a.textLetterSpacing=`${o}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),(0===o||c)&&0===n)return void(l?a.strokeText(e,r,i):a.fillText(e,r,i));if(0!==n&&(0===o||c)){let t=e.split(" "),s=r,o=a.measureText(" ").width;for(let e=0;e<t.length;e++)l?a.strokeText(t[e],s,i):a.fillText(t[e],s,i),s+=a.measureText(t[e]).width+o+n;return}let d=r,h=sD.graphemeSegmenter(e),u=a.measureText(e).width,x=0;for(let e=0;e<h.length;++e){let t=h[e];l?a.strokeText(t,d,i):a.fillText(t,d,i);let s="";for(let t=e+1;t<h.length;++t)s+=h[t];d+=u-(x=a.measureText(s).width)+o," "===t&&(d+=n),u=x}}};var sQ=t5,s0=e.i(24314),s1=e.i(20446),s2=e.i(86230);let s5=class e extends sQ.f{constructor(t={}){super(),this.uid=(0,s0.f)("textStyle"),this._tick=0,this._cachedFontString=null,function(e){if("boolean"==typeof e.dropShadow&&e.dropShadow){let t=s5.defaultDropShadow;e.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(void 0!==e.strokeThickness){(0,st.K)(st.e,"strokeThickness is now a part of stroke");let t=e.stroke,s={};if(sf.f.isColorLike(t))s.color=t;else if(t instanceof sa.f||t instanceof sY.f)s.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))s=t;else throw Error("Invalid stroke value.");e.stroke={...s,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){if((0,st.K)(st.e,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(e.fill)||0===e.fill.length)throw Error("Invalid fill value. Expected an array of colors for gradient fill.");e.fill.length!==e.fillGradientStops.length&&(0,sG.f)("The number of fill colors must match the number of fill gradient stops.");let t=new sa.f({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),s=e.fillGradientStops.slice(),r=e.fill.map(e=>sf.f.shared.setValue(e).toNumber());s.forEach((e,s)=>{t.addColorStop(e,r[s])}),e.fill={fill:t}}}(t);let s=t instanceof e,r=t;s&&(t=r._toObject());let i={...e.defaultTextStyle,...t};for(let e in i)this[e]=i[e];this._tagStyles=t.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.update())}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(null!==t&&"object"==typeof t?this._dropShadow=this._createProxy({...e.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...e.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.update())}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&("string"==typeof e?this._fontSize=parseInt(e,10):this._fontSize=e,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.update())}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.update())}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.update())}get filters(){return this._filters}set filters(e){this._filters!==e&&(this._filters=Object.freeze(e),this.update())}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.update())}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...s1.f.defaultFillStyle,...e},()=>{this._fill=(0,s2._)({...this._originalFill},s1.f.defaultFillStyle)})),this._fill=(0,s2._)(0===e?"black":e,s1.f.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...s1.f.defaultStrokeStyle,...e},()=>{this._stroke=(0,s2.U)({...this._originalStroke},s1.f.defaultStrokeStyle)})),this._stroke=(0,s2.U)(e,s1.f.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(e){this._tagStyles!==e&&(this._tagStyles=e??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){let t=e.defaultTextStyle;for(let e in t)this[e]=t[e]}assign(e){for(let t in e)this[t]=e[t];return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=sB(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new e(this._toObject())}_getFinalPadding(){let e=0;if(this._filters)for(let t=0;t<this._filters.length;t++)e+=this._filters[t].padding;return Math.max(this._padding,e)}destroy(e=!1){if(this.removeAllListeners(),"boolean"==typeof e?e:e?.texture){let t="boolean"==typeof e?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(t),this._originalFill?.texture&&this._originalFill.texture.destroy(t),this._stroke?.texture&&this._stroke.texture.destroy(t),this._originalStroke?.texture&&this._originalStroke.texture.destroy(t)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,t){return new Proxy(e,{set:(e,s,r)=>e[s]===r||(e[s]=r,t?.(s,r),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(sf.f.isColorLike(e)||e instanceof sa.f||e instanceof sY.f)}};s5.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},s5.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let s3=!1;var s4=e.i(33219),s8=e.i(81481),s6=e.i(40766);class s7 extends s6.f{}class s9{constructor(e){this._renderer=e,e.runners.resolutionChange.add(this),e.runners.contextChange.add(this),this._managedTexts=new s4.f({renderer:e,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(let e in this._managedTexts.items){let t=this._managedTexts.items[e];t?._autoResolution&&t.onViewUpdate()}}contextChange(){for(let e in this._managedTexts.items)this._managedTexts.items[e]?.unload()}validateRenderable(e){let t=this._getGpuText(e),s=e.styleKey;return t.currentKey!==s||e._didTextUpdate}addRenderable(e,t){let s=this._getGpuText(e);if(e._didTextUpdate||s.currentKey!==e.styleKey){let t=e._autoResolution?this._renderer.resolution:e.resolution;(s.currentKey!==e.styleKey||e._resolution!==t)&&this._updateGpuText(e),e._didTextUpdate=!1,function(e,t){let{texture:s,bounds:r}=e,i=t._style._getFinalPadding();(0,s8.f)(r,t._anchor,s);let l=t._anchor._x*i*2,n=t._anchor._y*i*2;r.minX-=i-l,r.minY-=i-n,r.maxX-=i-l,r.maxY-=i-n}(s,e)}this._renderer.renderPipes.batch.addToBatch(s,t)}updateRenderable(e){let t=this._getGpuText(e);t._batcher.updateElement(t)}_updateGpuText(e){let t=this._getGpuText(e);t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,t.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e.styleKey}_getGpuText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){let t=new s7;return t.currentKey="--",t.renderable=e,t.transform=e.groupTransform,t.bounds={minX:0,maxX:1,minY:0,maxY:0},t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,this._managedTexts.add(e),t}onTextUnload(e){let t=e._gpuData[this._renderer.uid];if(!t)return;let{canvasText:s}=this._renderer;s.getReferenceCount(t.currentKey)>0?s.decreaseReferenceCount(t.currentKey):t.texture&&s.returnTexture(t.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}s9.extension={type:[t0.x.WebGLPipes,t0.x.WebGPUPipes,t0.x.CanvasPipes],name:"text"};var re=e.i(41163),rt=e.i(70298);class rs{constructor(e,t){this._activeTextures={},this._renderer=e,this._retainCanvasContext=t}getTexture(e,t,s,r){"string"==typeof e&&((0,st.K)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:s,resolution:t}),e.style instanceof s5||(e.style=new s5(e.style)),"string"!=typeof e.text&&(e.text=e.text.toString());let{text:i,style:l,textureStyle:n,autoGenerateMipmaps:a}=e,o=e.resolution??this._renderer.resolution,{frame:c,canvasAndContext:d}=sZ.getCanvasAndContext({text:i,style:l,resolution:o}),h=(0,rt.f)(d.canvas,c.width,c.height,o,a,n?.scaleMode);if(l.trim&&(c.pad(l.padding),h.frame.copyFrom(c),h.frame.scale(1/o),h.updateUvs()),l.filters){let e=this._applyFilters(h,l.filters);return this.returnTexture(h),sZ.returnCanvasAndContext(d),e}return this._renderer.texture.initSource(h._source),this._retainCanvasContext||sZ.returnCanvasAndContext(d),h}returnTexture(e){let t=e.source,s=t.resource;if(this._retainCanvasContext&&s?.getContext){let e=s.getContext("2d");e&&sZ.returnCanvasAndContext({canvas:s,context:e})}t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",re.f.returnTexture(e)}renderTextToCanvas(){(0,st.K)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e.styleKey;if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let s=this.getTexture({text:e.text,style:e.style,resolution:e._resolution,textureStyle:e.textureStyle,autoGenerateMipmaps:e.autoGenerateMipmaps});return this._activeTextures[t]={texture:s,usageCount:1},s}decreaseReferenceCount(e){let t=this._activeTextures[e];t&&(t.usageCount--,0===t.usageCount&&(this.returnTexture(t.texture),this._activeTextures[e]=null))}getReferenceCount(e){return this._activeTextures[e]?.usageCount??0}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}_applyFilters(e,t){let s=this._renderer.renderTarget.renderTarget,r=this._renderer.filter.generateFilteredTexture({texture:e,filters:t});return this._renderer.renderTarget.bind({target:s,clear:!1}),r}destroy(){for(let e in this._renderer=null,this._activeTextures)this._activeTextures[e]&&this.returnTexture(this._activeTextures[e].texture);this._activeTextures=null}}class rr extends rs{constructor(e){super(e,!0)}}rr.extension={type:[t0.x.CanvasSystem],name:"canvasText"};class ri extends rs{constructor(e){super(e,!1)}}ri.extension={type:[t0.x.WebGLSystem,t0.x.WebGPUSystem],name:"canvasText"},t0.H.add(rr),t0.H.add(ri),t0.H.add(s9);class rl extends sx{constructor(...e){let t,s=(("string"==typeof(t=e[0]??{})||e[1])&&((0,st.K)(st.e,'use new Text({ text: "hi!", style }) instead'),t={text:t,style:e[1]}),t);super(s,s5),this.renderPipeId="text",s.textureStyle&&(this.textureStyle=s.textureStyle instanceof sd.f?s.textureStyle:new sd.f(s.textureStyle),function(e){if(s3)return;let t=new sd.f({scaleMode:e.scaleMode});e._resourceId!==t._resourceId&&(s3=!0,(0,sG.f)("Text textureStyle: only scaleMode is applied to a text texture, the other fields are ignored"))}(this.textureStyle)),this.autoGenerateMipmaps=s.autoGenerateMipmaps??sc.f.defaultOptions.autoGenerateMipmaps}updateBounds(){let e=this._bounds,t=this._anchor,s=0,r=0;if(this._style.trim){let{frame:e,canvasAndContext:t}=sZ.getCanvasAndContext({text:this.text,style:this._style,resolution:1});sZ.returnCanvasAndContext(t),s=e.width,r=e.height}else{let e=sD.measureText(this._text,this._style);s=e.width,r=e.height}e.minX=-t._x*s,e.maxX=e.minX+s,e.minY=-t._y*r,e.maxY=e.minY+r}}let rn={pending:0xf59e0b,streaming:2282478,done:3462041,error:0xef4444};function ra(e){return e?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):"0"}function ro(e=[]){let t=new Map;for(let s of e){if(!s?.connectionId)continue;let e=t.get(s.connectionId);if(!e){let r=String(s.connectionId||"").toLowerCase(),i=s.clientType||("app"===s.source||r.includes("app")?"app":"extension"===s.source||r.includes("extension")||"ide"===s.source||r.includes("ide")?"extension":"cli");e={connectionId:s.connectionId,account:s.account||s.connectionId,model:s.model,provider:s.provider,cli:s.cli||"agent",clientType:i,source:s.source||i,clientIcon:s.clientIcon,traces:[],tokens:{input:0,output:0,cached:0},totalTokens:null,activeCount:0,errorCount:0,tools:[],errorReason:null,fallbackFrom:null,queued:0,elapsedMs:0,cost:null,pendingCount:0,isLooping:!1,logs:[],skin:s.skin||null,aura:s.aura||null,pet:s.pet||null,props:s.props||[],trophy:s.trophy||null,theme:s.theme||null,sessionTitle:s.sessionTitle||s.account||"agent-factory",lastText:null,lastTextRole:null},t.set(s.connectionId,e)}for(let t of(e.traces.push(s),s.skin&&!e.skin&&(e.skin=s.skin),s.aura&&!e.aura&&(e.aura=s.aura),s.pet&&!e.pet&&(e.pet=s.pet),!s.props?.length||e.props&&e.props.length||(e.props=s.props),s.trophy&&!e.trophy&&(e.trophy=s.trophy),s.theme&&!e.theme&&(e.theme=s.theme),s.isLooping&&(e.isLooping=!0),Array.isArray(s.logs)&&s.logs.length>0&&(e.logs=s.logs),s.currentCommand&&!e.currentCommand&&(e.currentCommand=s.currentCommand),s.sessionTitle&&(e.sessionTitle=s.sessionTitle),s.lastText&&(e.lastText=s.lastText,e.lastTextRole=s.lastTextRole),s.toolCalls||[])){let s=t.tool||t.type;s&&!e.tools.includes(s)&&e.tools.push(s)}e.tokens.input+=s.tokens?.input??0,e.tokens.output+=s.tokens?.output??0,e.tokens.cached+=s.tokens?.cached??0,Number.isFinite(s.totalTokens)&&(e.totalTokens=(e.totalTokens??0)+s.totalTokens),e.queued+=Math.max(1,s.concurrent||1),e.elapsedMs=Math.max(e.elapsedMs,s.elapsedMs??0),Number.isFinite(s.cost)&&(e.cost=(e.cost??0)+s.cost),s.fallback?.from&&!e.fallbackFrom&&(e.fallbackFrom=s.fallback.from),"error"===s.state?(e.errorCount+=1,e.errorReason=e.errorReason||s.error||"error"):("streaming"===s.state||"pending"===s.state)&&(e.activeCount+=1,"pending"===s.state&&(e.pendingCount+=1))}let s=t.size,r=s>35?8:s>18?7:6,i=s>35?175:200,l=s>35?145:170,n=Math.max(1500,60+r*i+120),a=n+360,o=[...t.values()].map((e,t)=>{let s=Math.floor(t/r),n=!!e.isLooping,a=e.errorCount>0?"error":e.activeCount>0?"streaming":"done",o=n?"looping":"error"===a?"error":"streaming"===a?e.pendingCount===e.activeCount?"pending":"streaming":e.elapsedMs>=32e3?"sleeping":"happy",c=e.totalTokens,d=c&&e.tokens.cached>0?Math.round(e.tokens.cached/c*100):null,h=e.account||"agent-factory",u=e.sessionTitle||h;return{...e,deskIndex:t,traceId:e.traces?.[0]?.traceId||e.connectionId,sessionTitle:u,occupied:!0,state:a,mode:o,isLooping:n,logs:e.logs,cachedPct:d,cost:Number.isFinite(e.cost)?Math.round(100*e.cost)/100:null,color:n?0xf43f5e:rn[a],totalTokens:c,totalLabel:null===c?"—":ra(c),count:e.traces.length,x:60+t%r*i,y:820-s*l,depth:1,busy:e.activeCount}}),c=[...new Set(o.map(e=>e.provider).filter(Boolean))],d=c.map((e,t)=>{let s=o.filter(t=>t.provider===e),r=s.reduce((e,t)=>e+t.busy,0),i=s.reduce((e,t)=>e+(t.totalTokens??0),0),l=s.some(e=>"error"===e.state);return{provider:e,x:a,y:480-(c.length-1)*104/2+104*t,busy:r,load:Math.min(1,r/4),overloaded:r>=4,totalTokens:i,totalLabel:ra(i),color:l?rn.error:r>0?rn.streaming:rn.done}}),h=new Set(c),u=new Map;for(let e of o){if(!e.fallbackFrom||!h.has(e.fallbackFrom)||e.fallbackFrom===e.provider)continue;let t=`${e.fallbackFrom}>${e.provider}`,s=u.get(t)||{from:e.fallbackFrom,to:e.provider,count:0};s.count+=1,u.set(t,s)}return{workstations:o,pods:d,fallbacks:[...u.values()],rack:{x:n,y:480,active:o.reduce((e,t)=>e+t.busy,0)},stats:{agents:o.length,busy:o.filter(e=>e.busy>0).length,tokens:o.reduce((e,t)=>e+(t.totalTokens??0),0),tokensLabel:ra(o.reduce((e,t)=>e+(t.totalTokens??0),0))}}}var rc=e.i(69096);function rd(e,t=61695){if(!e)return t;if("number"==typeof e)return e;let s=parseInt(String(e).replace("#","").trim(),16);return Number.isNaN(s)?t:s}function rh(e,t){let s=String(e||"");return s.length>t?`${s.slice(0,t-1)}…`:s}let ru=()=>(0,rc.l)("mono"),rx=()=>(0,rc.l)("ui");function rf(...e){return new sa.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:e.map((t,s)=>({offset:s/(e.length-1),color:t})),textureSpace:"local"})}let rp=(e,t,s=1)=>({width:e,color:t,alpha:s,cap:"round",join:"round"});function rm({color:e,depth:t=1,scale:s=1,seed:r=0,trimColor:i,mode:l="streaming",clientType:n="cli",skin:a="classic",aura:o="none"}){let c=new t9.t,d="app"===n?9133302:1096065,h="string"==typeof a?(0,tV.x)(a):null,u=!!(h||a&&"classic"!==a&&"none"!==a),x=h?.archetype||("cat"===a?"cyber_cat":"ninja"===a?"stealth_ninja":"hacker"===a?"matrix_hacker":a||"cyber_classic"),f=h?.color?rd(h.color,i??d):i??d,p=u?1975344:0xf3f5f9,m=u?1119778:0xc9d0dc,g=new so.f;g.roundRect(-17,-30,34,22,11).fill(rf(0xffffff,p,m)),g.roundRect(-17,-30,34,8,8).fill({color:0xffffff,alpha:.6}),g.roundRect(-14,-12,28,8,4).fill({color:f}),g.roundRect(-16,-8,32,16,8).fill(rf(p,m,9213865)),g.roundRect(-16,2,32,6,4).fill({color:m,alpha:.6}),u&&(g.circle(0,-18,4).fill({color:988970}),g.circle(0,-18,4).stroke({width:1.2,color:f}),g.circle(0,-18,2).fill({color:f}));let b=new so.f;b.roundRect(-10,-36,20,8,4).fill({color:f});let y=new so.f;y.roundRect(-6,-34,12,3,1.5).fill({color:e});let v=new so.f,w=new so.f;for(let[e,t,s]of[[v,-26,-1],[w,18,1]])e.roundRect(t,-28,8,24,4).fill({color:p}),e.roundRect(t,-28,8,8,4).fill({color:0xffffff,alpha:.6}),e.circle(t+4+1.5*s,-2,4.5).stroke({width:2.4,color:p}),e.pivot.set(t+4,-26),e.position.set(t+4,-26);let j=new so.f;j.circle(-27,-56,8).fill({color:f}),j.circle(27,-56,8).fill({color:f}),j.circle(-27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),j.circle(27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),j.circle(-29,-58,3).fill({color:0xffffff,alpha:.7}),j.circle(25,-58,3).fill({color:0xffffff,alpha:.7}),j.ellipse(0,-56,26,24).fill(rf(u?2963272:0xffffff,p,m)),u&&j.ellipse(0,-56,27,25).stroke({width:2.2,color:f,alpha:.95}),j.ellipse(4,-50,24,21).stroke({width:3,color:7043728,alpha:.25}),j.ellipse(-8,-68,12,5.5).fill({color:0xffffff,alpha:.8}),j.circle(-14,-64,2).fill({color:0xffffff,alpha:.9}),j.ellipse(0,-53,22,17).fill({color:m}),j.ellipse(0,-53,20,15.5).fill({color:988188}),j.ellipse(-5,-58,11,5).fill({color:0xffffff,alpha:.06}),"cyber_suit"===x?(j.roundRect(-24,-66,48,7,2.5).fill({color:988970}),j.roundRect(-24,-66,48,7,2.5).stroke({width:1.6,color:f}),j.poly([-26,-66,-34,-76,-26,-72]).fill({color:f}),j.poly([26,-66,34,-76,26,-72]).fill({color:f}),j.circle(0,-62.5,2.5).fill({color:f})):"stealth_ninja"===x||"ninja"===x?(j.roundRect(-24,-66,48,8,3).fill({color:1973067}),j.roundRect(-24,-66,48,8,3).stroke({width:1.5,color:f}),j.circle(0,-62,3).fill({color:3718648}),j.poly([24,-62,38,-56,32,-50,22,-56]).fill({color:f,alpha:.9})):"mecha_pilot"===x?(j.poly([-22,-72,-18,-90,-12,-70]).fill({color:f}),j.poly([12,-70,18,-90,22,-72]).fill({color:f}),j.circle(-18,-90,2.5).fill({color:0xffffff}),j.circle(18,-90,2.5).fill({color:0xffffff})):"celestial_astro"===x?(j.ellipse(0,-64,30,8).stroke({width:2,color:f,alpha:.85}),j.circle(0,-72,3).fill({color:0xfef08a})):"matrix_hacker"===x||"hacker"===x?(j.roundRect(-27,-78,54,48,16).fill({color:1120295}),j.roundRect(-27,-78,54,48,16).stroke({width:1.6,color:f})):"cyber_cat"===x||"cat"===a?(j.poly([-22,-72,-14,-86,-6,-76]).fill({color:p}),j.poly([-20,-73,-14,-83,-8,-76]).fill({color:0xf472b6,alpha:.8}),j.poly([6,-76,14,-86,22,-72]).fill({color:p}),j.poly([8,-76,14,-83,20,-73]).fill({color:0xf472b6,alpha:.8})):j.poly([-8,-68,0,-78,8,-68]).fill({color:f});let k=null,S="string"==typeof o?(0,tV.x)(o):null,N=S?.archetype||"plasma_ring";o&&"none"!==o&&(k=new so.f,c.addChildAt(k,0));let C=new so.f,T=new so.f;c.addChild(g,b,y,v,w,j,C,T),c.scale.set(s*t);let M=l,_=u?f:e,z=(e,t,s,r,i,l)=>{if("happy"===l)C.moveTo(e-4.6,t+2).arc(e,t+2,4.6,Math.PI,0).stroke(rp(2.6,_,i));else if("sleep"===l)C.moveTo(e-4.6,t).arc(e,t,4.6,0,Math.PI).stroke(rp(2.2,_,.7));else if("x"===l)C.moveTo(e-4,t-4).lineTo(e+4,t+4).stroke(rp(2.6,_,i)),C.moveTo(e+4,t-4).lineTo(e-4,t+4).stroke(rp(2.6,_,i));else if("looping"===l)C.circle(e,t,4.2).stroke(rp(1.8,_,i)),C.circle(e,t,2).stroke(rp(1.4,_,i)),C.circle(e,t,.6).fill({color:_,alpha:i});else{C.ellipse(e,t,s,r).fill({color:_,alpha:.9*i});for(let i=t-r+1;i<t+r;i+=2.4)C.rect(e-s-1,i,2*s+2,1).fill({color:988188,alpha:.55})}};return{root:c,statusDot:y,setMode(e){M=e},animate(e,t=0){let s=c.baseX??c.x,i=M,l=.012*e+s,n=Math.sin(.004*e+.05*s)*(.8+1.4*t),o=0,d=0;"happy"===i&&(n=-(3.2*Math.abs(Math.sin(.005*e+s)))),"sleeping"===i&&(n=1.1*Math.sin(.0016*e+s)+2.2,d=.12+.02*Math.sin(.0016*e+s)),"error"===i&&(o=1.8*Math.sin(.09*e)),"looping"===i&&(o=2.2*Math.sin(.08*e),n=1.6*Math.sin(.015*e),d=.16*Math.sin(.02*e)),c.x=s+o,c.y=(c.baseY||0)+n,c.rotation=d,v.rotation=0,w.rotation=0,"streaming"===i?(v.rotation=.14*Math.sin(l)*(.3+t),w.rotation=-(.14*Math.sin(l+1.3))*(.3+t)):"pending"===i?(v.rotation=2.5+.35*Math.sin(.012*e),w.rotation=-(.06*Math.sin(l+1.3))):"happy"===i?(v.rotation=2.2+.2*Math.sin(.01*e),w.rotation=-2.2-.2*Math.sin(.01*e+1)):"error"===i?(v.rotation=2.7+.1*Math.sin(.08*e),w.rotation=-2.7-.1*Math.sin(.08*e)):"looping"===i?(v.rotation=2.4+.4*Math.sin(.02*e),w.rotation=-2.4-.4*Math.sin(.02*e+1)):"sleeping"===i&&(v.rotation=.05,w.rotation=-.05);let h=Math.sin(.0013*e+2.1*r)>.985,u=.85+.15*Math.sin(.01*e+r);C.clear();let x="happy"===i?"happy":"sleeping"===i?"sleep":"error"===i?"x":"looping"===i?"looping":"scan";if(z(-8,-57,4.8,h?.8:4.4,u,x),z(8,-57,4.8,h?.8:4.4,u,x),"happy"===i?C.moveTo(-6,-48).arc(0,-48,6,0,Math.PI).stroke(rp(2.2,_,.9)):"sleeping"===i?C.circle(0,-45,1.8).stroke(rp(1.6,_,.6)):"error"===i?C.moveTo(-7,-45).lineTo(-3.5,-48).lineTo(0,-45).lineTo(3.5,-48).lineTo(7,-45).stroke(rp(2,_,u)):"looping"===i?C.circle(0,-46,3.2).stroke(rp(2,_,u)):C.ellipse(0,-46,5+3*t,2.4+1.2*t).fill({color:_,alpha:.75*u}),"cat"===a&&(C.moveTo(-12,-47).lineTo(-22,-49).stroke(rp(1.2,0xffffff,.7)),C.moveTo(-12,-44).lineTo(-21,-43).stroke(rp(1.2,0xffffff,.7)),C.moveTo(12,-47).lineTo(22,-49).stroke(rp(1.2,0xffffff,.7)),C.moveTo(12,-44).lineTo(21,-43).stroke(rp(1.2,0xffffff,.7)),C.poly([-2,-48,0,-46,2,-48]).fill({color:0xf472b6})),T.clear(),"sleeping"===i)for(let t=0;t<3;t+=1){let s=(4e-4*e+t/3+.13*r)%1,i=20+16*s,l=-78-30*s,n=3+4*s;T.moveTo(i,l).lineTo(i+n,l).lineTo(i,l+n).lineTo(i+n,l+n).stroke(rp(1.6,0xa5b4cc,1-s))}else if("error"===i||"looping"===i)for(let t=0;t<5;t+=1){let s=(8e-4*e+t/5+.12*r)%1,i=7*Math.sin(8*s+1.3*t)+(t-2)*3.5,l=-76-38*s,n=2.5+7*s;T.circle(i,l,n).fill({color:4937059,alpha:.65*(1-s)})}if(k){k.clear();let t=S?.color?rd(S.color,61695):61695,s=1+.12*Math.sin(.006*e),l="happy"===i?.95:"error"===i?.35+.35*Math.sin(.08*e):"sleeping"===i?.25:.65;if("matrix_rain"===N)for(let s=-3;s<=3;s++){let i=9*s,n=-70+(.002*e+.33*s+.2*r)%1*50;k.moveTo(i,n-8).lineTo(i,n).stroke({width:1.5,color:t,alpha:.8*l}),k.circle(i,n,1.2).fill({color:0xffffff,alpha:l})}else if("quantum_mist"===N){for(let r=0;r<4;r++){let i=.003*e+r*Math.PI/2,n=30*s+4*Math.sin(i),a=14*s+3*Math.cos(i);k.ellipse(0,-42,n,a).stroke({width:1.2,color:t,alpha:.5*l})}k.circle(28*Math.sin(.007*e),-42+11*Math.cos(.007*e),2.2).fill({color:0xffffff,alpha:l})}else if("glitch_halo"===N){let r=2*Math.sin(.09*e);k.roundRect(-30*s+r,-54*s,60*s,24*s,6).stroke({width:2,color:t,alpha:l}),k.circle(2*r,-42,3).stroke({width:1,color:0xffffff,alpha:.7*l})}else k.ellipse(0,-42,34*s,13*s).stroke({width:2,color:t,alpha:l}),k.ellipse(0,-42,26*s,9*s).stroke({width:1.2,color:0xffffff,alpha:.8*l}),"happy"===i&&k.circle(32*Math.sin(.01*e),-42+12*Math.cos(.01*e),2.5).fill({color:0xffffff})}y.alpha=.6+.4*Math.sin(.007*e+r)*(.3+t)},setState(e){y.tint=e}}}function rg(e,{color:t=2282478,size:s=10}={}){return new rl({text:e,style:{fontFamily:rx(),fontSize:s,fill:t,fontWeight:"700"}})}let rb={cap:"round",join:"round"},ry={bash:{label:"Bash",color:3462041,draw(e,t){e.moveTo(-8,-6).lineTo(-2,0).lineTo(-8,6).stroke({width:2.4,color:t,...rb}),e.moveTo(1,7).lineTo(8,7).stroke({width:2.4,color:t,...rb})}},read:{label:"Read",color:6333946,draw(e,t){e.moveTo(-6,-9).lineTo(3,-9).lineTo(7,-5).lineTo(7,9).lineTo(-6,9).closePath().stroke({width:2,color:t,...rb}),e.moveTo(-3,-1).lineTo(4,-1).stroke({width:1.8,color:t,...rb}),e.moveTo(-3,3).lineTo(4,3).stroke({width:1.8,color:t,...rb}),e.moveTo(-3,6.5).lineTo(1,6.5).stroke({width:1.8,color:t,...rb})}},edit:{label:"Edit",color:0xfbbf24,draw(e,t){e.moveTo(-7,8).lineTo(-6,3).lineTo(4,-7).lineTo(8,-3).lineTo(-2,7).closePath().stroke({width:2,color:t,...rb}),e.moveTo(1,-4).lineTo(5,0).stroke({width:1.8,color:t,...rb}),e.moveTo(-8,9.5).lineTo(-1,9.5).stroke({width:1.8,color:t,...rb})}},search:{label:"Search",color:0xf472b6,draw(e,t){e.circle(-2,-2,6).stroke({width:2.2,color:t,...rb}),e.moveTo(2.5,2.5).lineTo(8,8).stroke({width:2.6,color:t,...rb})}},web:{label:"Web",color:2282478,draw(e,t){e.circle(0,0,8.5).stroke({width:2,color:t,...rb}),e.ellipse(0,0,3.6,8.5).stroke({width:1.6,color:t,...rb}),e.moveTo(-8.5,0).lineTo(8.5,0).stroke({width:1.6,color:t,...rb})}},mcp:{label:"MCP",color:0xa78bfa,draw(e,t){e.moveTo(-4,-9).lineTo(-4,-3).stroke({width:2.4,color:t,...rb}),e.moveTo(4,-9).lineTo(4,-3).stroke({width:2.4,color:t,...rb}),e.roundRect(-8,-3,16,9,3).stroke({width:2,color:t,...rb}),e.moveTo(0,6).lineTo(0,10).stroke({width:2.4,color:t,...rb})}},agent:{label:"Subagent",color:0xfb923c,draw(e,t){e.moveTo(0,-4).lineTo(-6,6).stroke({width:1.8,color:t,...rb}),e.moveTo(0,-4).lineTo(6,6).stroke({width:1.8,color:t,...rb}),e.circle(0,-5,3.6).fill({color:t}),e.circle(-6.5,7,3).fill({color:t}),e.circle(6.5,7,3).fill({color:t})}},todo:{label:"Todo",color:9741240,draw(e,t){e.moveTo(-8,-5).lineTo(-6,-3).lineTo(-3,-7).stroke({width:1.8,color:t,...rb}),e.moveTo(1,-5).lineTo(8,-5).stroke({width:1.8,color:t,...rb}),e.moveTo(-8,5).lineTo(-6,7).lineTo(-3,3).stroke({width:1.8,color:t,...rb}),e.moveTo(1,5).lineTo(8,5).stroke({width:1.8,color:t,...rb})}},gitnexus:{label:"GitNexus",color:0xc084fc,draw(e,t){e.moveTo(0,0).lineTo(-6,-6).stroke({width:1.5,color:t,...rb}),e.moveTo(0,0).lineTo(6,-5).stroke({width:1.5,color:t,...rb}),e.moveTo(0,0).lineTo(0,7).stroke({width:1.5,color:t,...rb}),e.circle(0,0,3.2).fill({color:t}),e.circle(-6,-6,2.2).fill({color:t}),e.circle(6,-5,2.2).fill({color:t}),e.circle(0,7,2.2).fill({color:t})}},browser:{label:"Browser",color:440020,draw(e,t){e.roundRect(-8,-7,16,14,2.5).stroke({width:1.8,color:t,...rb}),e.moveTo(-8,-2).lineTo(8,-2).stroke({width:1.4,color:t,...rb}),e.circle(-5,-4.5,1).fill({color:t}),e.circle(-2,-4.5,1).fill({color:t})}},git:{label:"Git",color:0xf97316,draw(e,t){e.moveTo(-4,-7).lineTo(-4,7).stroke({width:2,color:t,...rb}),e.moveTo(-4,2).arc(0,2,4,Math.PI,0).lineTo(4,-3).stroke({width:1.8,color:t,...rb}),e.circle(-4,-6,2.4).fill({color:t}),e.circle(-4,6,2.4).fill({color:t}),e.circle(4,-3,2.4).fill({color:t})}},docker:{label:"Docker",color:3718648,draw(e,t){e.roundRect(-7,1,6,5,1).fill({color:t,alpha:.8}).stroke({width:1.2,color:t,...rb}),e.roundRect(1,1,6,5,1).fill({color:t,alpha:.8}).stroke({width:1.2,color:t,...rb}),e.roundRect(-3,-6,6,5,1).fill({color:t,alpha:.8}).stroke({width:1.2,color:t,...rb})}}},rv={pending:{label:"Queued",color:0xf59e0b,draw(e,t){for(let s of[-7,0,7])e.circle(s,1,2.6).fill({color:t})}},done:{label:"Done",color:3462041,draw(e,t){e.moveTo(-7,0).lineTo(-2,6).lineTo(8,-7).stroke({width:3,color:t,...rb})}},rate_limited:{label:"Rate limit",color:0xef4444,draw(e,t){e.moveTo(-6,-9).lineTo(6,-9).lineTo(-6,9).lineTo(6,9).closePath().stroke({width:2,color:t,...rb}),e.moveTo(-3,6.5).lineTo(3,6.5).stroke({width:2.2,color:t,...rb})}},upstream_timeout:{label:"Timeout",color:0xef4444,draw(e,t){e.circle(0,0,8.5).stroke({width:2,color:t,...rb}),e.moveTo(0,-5).lineTo(0,0).lineTo(4.5,3).stroke({width:2,color:t,...rb})}},quota_exhausted:{label:"Quota",color:0xef4444,draw(e,t){e.roundRect(-8,-5,14,10,2).stroke({width:2,color:t,...rb}),e.rect(6,-2,3,4).fill({color:t}),e.rect(-6,-3,2.6,6).fill({color:t})}},auth_refresh_failed:{label:"Auth",color:0xef4444,draw(e,t){e.circle(-4,0,4.2).stroke({width:2,color:t,...rb}),e.moveTo(0,0).lineTo(8,0).stroke({width:2,color:t,...rb}),e.moveTo(5,0).lineTo(5,4).stroke({width:2,color:t,...rb}),e.moveTo(-9,-8).lineTo(9,8).stroke({width:2.2,color:0xfbbf24,...rb})}},fallback:{label:"Fallback",color:0xfbbf24,draw(e,t){e.moveTo(-8,-4).lineTo(7,-4).stroke({width:2.2,color:t,...rb}),e.moveTo(3,-8).lineTo(8,-4).lineTo(3,0).stroke({width:2.2,color:t,...rb}),e.moveTo(8,5).lineTo(-7,5).stroke({width:2.2,color:t,...rb}),e.moveTo(-3,1).lineTo(-8,5).lineTo(-3,9).stroke({width:2.2,color:t,...rb})}},looping:{label:"Looping",color:0xf43f5e,draw(e,t){e.arc(0,0,6.5,-(.2*Math.PI),1.3*Math.PI).stroke({width:2.2,color:t,...rb}),e.moveTo(4,-6.5).lineTo(7,-3.5).lineTo(1,-3.5).closePath().fill({color:t})}}},rw=Object.keys(ry),rj=["pending","done","rate_limited","upstream_timeout","quota_exhausted","auth_refresh_failed","fallback","looping"];function rk(e,{size:t=1,showLabel:s=!0,label:r}={}){let i=ry[e]||rv[e]||ry.bash,l=new t9.t,n=new so.f;n.circle(0,0,21).fill({color:i.color,alpha:.18});let a=new so.f;a.circle(0,0,15).fill({color:988188}),a.circle(0,0,15).stroke({width:2,color:i.color,alpha:.95});let o=new so.f;if(i.draw(o,i.color),o.scale.set(.95),l.addChild(n,a,o),s){let e=new rl({text:r??i.label,style:{fontFamily:(0,rc.l)("ui"),fontSize:9,fill:i.color,fontWeight:"800"}});e.anchor.set(.5,0),e.y=18,l.addChild(e)}return l.scale.set(t),{root:l,halo:n,tool:e}}let rS={x:-60,y:40,w:2150,h:980},rN=e=>Math.max(0,Math.min(1,e)),rC={streaming:.8,pending:.3,happy:.2,sleeping:0,error:1};async function rT(e,t,s={}){let r,i,l,n,a=s.selectedId??null,o=s.onSelect,c=!1,d={x:0,y:0},h={x:0,y:0},u=!1,x=new sn;await x.init({canvas:e,preference:"webgl",resizeTo:e.parentElement,background:724758,antialias:!0,resolution:Math.min(globalThis.devicePixelRatio||1,2),autoDensity:!0});let f=x.renderer?.context?.extensions?.loseContext;if(f&&"function"==typeof f.loseContext){let e=f.loseContext.bind(f);f.loseContext=()=>{try{let t=x.renderer?.gl;if(t&&"function"==typeof t.isContextLost&&t.isContextLost())return;e()}catch(e){}}}let p=new t9.t,m=new t9.t,g=new t9.t,b=new t9.t,y=new t9.t,v=new t9.t,w=new t9.t,j=(r=new t9.t,i=new so.f,l=new so.f,r.addChild(l,i),n=[],{container:r,setRoutes(e){for(let t of(n.length=0,e)){let e=Math.max(1,Math.min(6,Math.round(6*t.weight)));for(let s=0;s<e;s+=1)n.push({from:t.from,to:t.to,t:(s/e+.1*Math.random())%1,speed:35e-5+6e-4*Math.random()+4e-4*t.weight,color:t.color,size:1.6+2.2*t.weight,shape:t.shape||"circle",arc:t.arc??26})}for(;n.length>700;)n.pop()},animate(e){for(let t of(i.clear(),l.clear(),n)){t.t+=t.speed*e,t.t>1&&(t.t-=1,t.speed=35e-5+6e-4*Math.random());let s=function(e,t,s,r){let i=Math.sin(s*Math.PI)*r;return{x:e.x+(t.x-e.x)*s,y:e.y+(t.y-e.y)*s-i}}(t.from,t.to,t.t,t.arc),r=Math.min(1,6*t.t)*Math.min(1,(1-t.t)*6),n=t.size;if("diamond"===t.shape)i.poly([s.x,s.y-1.5*n,s.x+1.2*n,s.y,s.x,s.y+1.5*n,s.x-1.2*n,s.y]).fill({color:t.color,alpha:r});else if("square"===t.shape){let e=.7*n;i.rect(s.x-e,s.y-e,2*e,2*e).fill({color:t.color,alpha:.9*r})}else i.circle(s.x,s.y,n).fill({color:t.color,alpha:r});l.circle(s.x,s.y,3*n).fill({color:t.color,alpha:.14*r})}}});p.addChild(m,g,j.container,b,y,v,w),x.stage.addChild(p);let k=t,S=new so.f;function N(e=2150,t=980){rS.w=e,rS.h=t,S.clear();let s=(0,tB.F)(),r=k?.[0]?.theme||s?.equippedOfficeTheme||"theme_default",i=(tV.y.officeThemes||[]).find(e=>e.id===r)||tV.y.officeThemes?.[0],l=i?.palette||{floorGradient:[725016,1449772],gridColor:1712944,gridAlpha:.7,borderColor:2503236,panelRackColor:0xfde047,panelPodColor:2282478},[n,a]=l.floorGradient||[725016,1449772],o=l.gridColor??1712944,c=l.gridAlpha??.7,d=l.borderColor??2503236,h=l.panelRackColor??0xfde047,u=l.panelPodColor??2282478;S.roundRect(rS.x,rS.y,rS.w,rS.h,28).fill(new sa.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:[{offset:0,color:n},{offset:1,color:a}],textureSpace:"local"}));for(let e=rS.x+100;e<rS.x+rS.w;e+=100)S.moveTo(e,rS.y+14).lineTo(e,rS.y+rS.h-14).stroke({width:1,color:o,alpha:c});for(let e=rS.y+100;e<rS.y+rS.h;e+=100)S.moveTo(rS.x+14,e).lineTo(rS.x+rS.w-14,e).stroke({width:1,color:o,alpha:c});S.roundRect(rS.x,rS.y,rS.w,rS.h,28).stroke({width:2,color:d,alpha:.9}),S.roundRect(1370,rS.y+120,260,rS.h-240,22).fill({color:h,alpha:.045}),S.roundRect(1750,rS.y+40,220,rS.h-150,22).fill({color:u,alpha:.045})}N(2150,980),S.eventMode="static",S.on("pointertap",()=>{u||W(null)}),m.addChild(S);let C=new t9.t,T=rm({color:0xfde047,trimColor:0xf59e0b,seed:3,scale:.95,mode:"sleeping"});T.root.baseX=0,T.root.baseY=-156,T.root.x=0,T.root.y=-156,C.addChild(T.root);let M=new so.f;M.roundRect(-70,-170,140,230,10).fill({color:1712685}),M.roundRect(-62,-162,124,60,6).fill({color:2240576}),M.roundRect(-58,40,116,96,6).fill({color:2240576}),C.addChild(M);let _=new so.f;_.roundRect(-80,-180,160,250,14).fill({color:0xfde047,alpha:.12}),C.addChildAt(_,0);let z=new so.f;C.addChild(z);let R=new rl({text:"CORE HUB",style:{fontFamily:(0,rc.l)("ui"),fontSize:14,fill:3718648,fontWeight:"800",letterSpacing:2}});R.anchor.set(.5,0),R.y=-92,C.addChild(R);let I=rg("0",{color:0xfde047,size:13});I.anchor.set(.5,0),I.y=4,C.addChild(I),b.addChild(C);let L=[],E=[],A=[],P=[],$=!1,O="";function F(){for(let e of E)e.desk.setSelected(e.ws.connectionId===a)}function W(e){a=e,F(),o?.(e)}function D(e,t=!1){k=e;let s=function(e){if(!Array.isArray(e)||0===e.length)return"0:empty";let t=e.length+":";for(let s=0;s<e.length;s++){let r=e[s];r&&(t+=`${r.connectionId||r.id||s}_${r.state||""}_${r.mode||""}_${+!!r.isLooping}_${r.skin||""}_${r.aura||""}_${r.pet||""}_${r.trophy||""}_${Array.isArray(r.props)?r.props.join(","):r.props||""}_${r.cost||0}_${r.elapsedMs||0}_${r.tokens?.input||0}_${r.tokens?.output||0}_${r.tools?.length||0}_${r.error||""}|`)}return t}(e);if(!t&&s===O&&L.length>0)return;O=s;let r=[],i=[],l=[],n=[],o=(e,t)=>(e.addChild(t),r.push(t),t),c=ro(e),d=new Map(c.pods.map(e=>[e.provider,e])),h=[],x=[...c.workstations].sort((e,t)=>e.y-t.y||e.x-t.x),f=(0,tB.F)();for(let[e,t]of x.entries()){let s=!!t.isLooping,r="app"===t.clientType||String(t.provider||"").toLowerCase().includes("app"),l=t.clientType||(r?"app":"cli"),n=function({color:e,label:t="",meta:s="",provider:r="",clientType:i="cli",elapsedMs:l=0,cost:n=0,cachedPct:a=0,queued:o=1,depth:c=1,isLooping:d=!1,pet:h="none",props:u=[],trophy:x="none"}){let f=new t9.t,p="app"===i||String(r||"").toLowerCase().includes("app"),m=new so.f;m.ellipse(83,102,93,11).fill({color:0,alpha:.18}),m.ellipse(81,100,.56*150,8).fill({color:0,alpha:.28}),m.roundRect(0,34,150,62,7).fill(rf(2831427,1580326)),m.poly([150,40,159,32,159,88,150,94]).fill({color:1053723}),m.poly([-5,28,8,20,148,20,159,28]).fill({color:6122365}),m.roundRect(-5,26,164,14,6).fill(rf(6648714,3818836)),m.roundRect(-5,26,164,2.5,2).fill({color:0xffffff,alpha:.3}),m.roundRect(0,40,150,2,1).fill({color:0,alpha:.35}),f.addChild(m);let g=Math.min(1,l/4e4),b=l<12e3?3462041:l<26e3?0xfbbf24:0xef4444,y=new so.f;y.roundRect(10,87,130,4,2).fill({color:988188}),y.roundRect(10,87,Math.max(4,130*g),4,2).fill({color:b}),f.addChild(y);let v=new so.f;v.roundRect(13,-30,76,62,12).fill({color:e,alpha:.12}),f.addChild(v);let w=new so.f;w.roundRect(25,-16,58,38,5).fill({color:0,alpha:.35}),w.roundRect(23,-18,58,38,5).fill(rf(2765116,724499)),w.roundRect(27,-14,50,30,3).fill({color:e,alpha:.6});for(let e=0;e<4;e+=1)w.roundRect(31,-9+6*e,18+11*e%22,2.4,1).fill({color:0xffffff,alpha:.5});w.poly([27,-14,53,-14,41,16,27,16]).fill({color:0xffffff,alpha:.07}),w.roundRect(46,20,8,6,2).fill({color:2962753}),f.addChild(w);let j=new so.f;j.roundRect(29,-13,26,11,2.5).fill({color:p?3868516:413243,alpha:.9}),j.roundRect(29,-13,26,11,2.5).stroke({width:.8,color:p?0xa855f7:366185,alpha:.95}),f.addChild(j);let k=new rl({text:p?"APP":"CLI",style:{fontFamily:ru(),fontSize:7,fill:p?0xd8b4fe:7268279,fontWeight:"900"}});k.anchor.set(.5,.5),k.x=42,k.y=-7.5,f.addChild(k);let S=new so.f;S.roundRect(89,29,34,8,3).fill({color:724499}),S.roundRect(89,27,34,8,3).fill(rf(3884372,2304565)),f.addChild(S);let N=new so.f,C=Math.min(5,Math.max(1,o));for(let e=0;e<C;e+=1)N.roundRect(-2+e%2,22-3.4*e,22,5,1.5).fill({color:e%2?0xe6edf6:0xcfd8e6}).stroke({width:.6,color:988188,alpha:.5});if(f.addChild(N),o>1){let e=new rl({text:`\xd7${o}`,style:{fontFamily:rx(),fontSize:10,fill:0xfbbf24,fontWeight:"800"}});e.anchor.set(.5,1),e.x=9,e.y=22-3.4*C-1,f.addChild(e)}let T=new rl({text:rh(t,18),style:{fontFamily:rx(),fontSize:11.5,fill:p?0xf5d0fe:0xe6edf6,fontWeight:"700"}});T.anchor.set(.5,0),T.x=75,T.y=42;let M=r?r.toUpperCase():"",_=M?`${M} \xb7 ${rh(s,18)}`:rh(s,28),z=new rl({text:rh(_,28),style:{fontFamily:ru(),fontSize:8.5,fill:p?0xd8b4fe:9675189}});z.anchor.set(.5,0),z.x=75,z.y=57;let R=Number.isFinite(l)?l:null,I=Number.isFinite(n)?`$${n.toFixed(2)}`:"—",L=Number.isFinite(a)?`${a}% cached`:"— cached",E=null===R?"—":R>=1e3?`${(R/1e3).toFixed(1)}s`:`${R}ms`,A=new rl({text:`${E} \xb7 ${I} \xb7 ${L}`,style:{fontFamily:ru(),fontSize:8.5,fill:b}});A.anchor.set(.5,0),A.x=75,A.y=71,f.addChild(T,z,A);let P=Array.isArray(u)?u:[u],$=P.map(e=>"string"==typeof e?(0,tV.x)(e):e).filter(Boolean),O=P.includes("coffee_machine")||$.some(e=>"espresso_station"===e.archetype||e.id?.includes("prop_3")||e.id?.includes("espresso")),F=P.includes("bonsai")||$.some(e=>"terrarium_bonsai"===e.archetype||e.id?.includes("prop_4")||e.id?.includes("bonsai")),W=$.some(e=>"supercomputer"===e.archetype||e.id?.includes("prop_0")||e.id?.includes("server")),D=$.some(e=>"hologram_emitter"===e.archetype||e.id?.includes("prop_2")||e.id?.includes("holo")),V=$.some(e=>"dual_monitor"===e.archetype||e.id?.includes("prop_1")||e.id?.includes("monitor")),B=$.some(e=>"arcade_cabinet"===e.archetype||e.id?.includes("arcade")),H=$.some(e=>"lab_oscilloscope"===e.archetype||e.id?.includes("oscilloscope")),U=null;if(O){let e=new t9.t;e.x=118,e.y=12;let t=new so.f;t.roundRect(0,0,16,20,3).fill(rf(4674921,1976635)),t.roundRect(2,2,12,5,1.5).fill({color:988970}),t.roundRect(3,3,3,3,1).fill({color:3718648}),t.roundRect(2,9,12,9,1).fill({color:988970}),t.roundRect(4,11,7,7,2).fill({color:0xf8fafc}),t.roundRect(5,12,5,2,1).fill({color:7877903}),e.addChild(t),U=new so.f,e.addChild(U),f.addChild(e)}if(F){let e=new t9.t;e.x=4,e.y=14;let t=new so.f;t.roundRect(0,10,14,7,2).fill({color:8138002}),t.ellipse(7,6,7,5).fill({color:1409085}),t.circle(4,4,3.8).fill({color:2278750}),t.circle(10,4,3.8).fill({color:1483594}),e.addChild(t),f.addChild(e)}let q=null;if(W){let e=new t9.t;e.x=128,e.y=8;let t=new so.f;t.roundRect(0,0,14,28,2).fill(rf(1976635,988970)),t.roundRect(0,0,14,28,2).stroke({width:1,color:3359061}),e.addChild(t),q=new so.f,e.addChild(q),f.addChild(e)}let G=null;if(D){let e=new t9.t;e.x=6,e.y=10;let t=new so.f;t.ellipse(8,22,9,3.5).fill({color:1976635}),t.ellipse(8,22,9,3.5).stroke({width:1,color:440020}),t.poly([8,22,1,6,15,6]).fill({color:440020,alpha:.2}),e.addChild(t),(G=new so.f).x=8,G.y=4,G.roundRect(-4,-4,8,8,1).stroke({width:1.2,color:3718648,alpha:.9}),G.roundRect(-4,-4,8,8,1).fill({color:440020,alpha:.4}),e.addChild(G),f.addChild(e)}if(V){let e=new t9.t;e.x=4,e.y=10;let t=new so.f;t.roundRect(0,0,14,24,2).fill(rf(1976635,988970)),t.roundRect(0,0,14,24,2).stroke({width:1,color:3718648,alpha:.7}),t.roundRect(2,2,10,20,1).fill({color:132631});for(let e=0;e<4;e++)t.roundRect(3,4+4.5*e,5+e%2*3,1.2,.5).fill({color:e%2?2278750:61695,alpha:.8});e.addChild(t),f.addChild(e)}if(B){let e=new t9.t;e.x=126,e.y=6;let t=new so.f;t.roundRect(0,0,16,30,2).fill(rf(4988309,1973067)),t.roundRect(0,0,16,30,2).stroke({width:1,color:0xa855f7}),t.roundRect(2,2,12,6,1).fill({color:0xf43f5e}),t.roundRect(2,10,12,11,1).fill({color:395284}),t.circle(5,24,1.5).fill({color:0xf59e0b}),e.addChild(t),f.addChild(e)}let Y=null;if(H){let e=new t9.t;e.x=6,e.y=12;let t=new so.f;t.roundRect(0,0,18,18,2).fill({color:1976635}),t.roundRect(0,0,18,18,2).stroke({width:1,color:1096065}),t.circle(9,9,6.5).fill({color:142370}),e.addChild(t),Y=new so.f,e.addChild(Y),f.addChild(e)}if(x&&"none"!==x){let e="string"==typeof x?(0,tV.x)(x):null,t=e?.color?rd(e.color,0xf59e0b):0xf59e0b,s=e?.archetype||"quantum_crystal",r=new t9.t;r.x=136,r.y=16;let i=new so.f;i.roundRect(-6,8,12,4,1).fill({color:988970}),i.roundRect(-6,8,12,4,1).stroke({width:.8,color:t,alpha:.6}),"golden_key"===s?(i.circle(0,-2,4).stroke({width:1.5,color:t}),i.moveTo(0,2).lineTo(0,8).stroke({width:1.5,color:t}),i.moveTo(0,5).lineTo(2.5,5).stroke({width:1.2,color:t})):"silicon_wafer"===s?(i.circle(0,0,5.5).fill({color:1976635}),i.circle(0,0,5.5).stroke({width:1.2,color:t}),i.moveTo(-4,0).lineTo(4,0).stroke({width:.8,color:3718648,alpha:.8}),i.moveTo(0,-4).lineTo(0,4).stroke({width:.8,color:0xec4899,alpha:.8})):"diamond_bug"===s?(i.ellipse(0,0,4.5,5.5).fill({color:t}),i.circle(0,-3.5,2.5).fill({color:0xffffff}),i.moveTo(-4,-1).lineTo(-6,-3).stroke({width:1,color:t}),i.moveTo(4,-1).lineTo(6,-3).stroke({width:1,color:t})):(i.poly([0,-6,5,2,-5,2]).fill({color:t}),i.poly([0,-6,5,2,0,6,-5,2]).stroke({width:1,color:0xffffff,alpha:.8}),i.circle(0,0,1.5).fill({color:0xffffff})),r.addChild(i),f.addChild(r)}let X=null,K="string"==typeof h?(0,tV.x)(h):null,J=K?.archetype||("cat"===h?"cyber_cat":"shiba"===h?"dozing_shiba":h),Z=K?.color?rd(K.color,0xf472b6):"dozing_shiba"===J?0xd97706:0xf472b6;if(h&&"none"!==h){(X=new t9.t).x=24,X.y=80;let e=new so.f;"cyber_cat"===J||"cat"===h?(e.ellipse(0,0,11,7).fill({color:Z}),e.circle(-7,-2,5.5).fill({color:Z}),e.poly([-11,-7,-8,-11,-5,-7]).fill({color:0xf43f5e}),e.poly([-7,-7,-4,-11,-1,-7]).fill({color:0xf43f5e}),e.moveTo(-9,-1).arc(-7,-1,2,0,Math.PI).stroke(rp(1,8917815)),e.ellipse(7,2,5,2.5).fill({color:Z})):"dozing_shiba"===J||"shiba"===h?(e.ellipse(0,0,13,8).fill({color:Z}),e.ellipse(2,2,9,4).fill({color:0xfef3c7}),e.circle(-8,-2,6).fill({color:Z}),e.poly([-12,-7,-9,-12,-6,-7]).fill({color:0xb45309}),e.poly([-7,-7,-4,-12,-1,-7]).fill({color:0xb45309}),e.moveTo(-10,-1).arc(-8,-1,2,0,Math.PI).stroke(rp(1,7877903)),e.circle(9,-2,4).fill({color:Z})):"hover_drone"===J?(e.ellipse(0,6,12,3.5).stroke({width:1.5,color:Z,alpha:.8}),e.circle(0,0,7).fill({color:1976635}),e.circle(0,0,7).stroke({width:1.2,color:Z}),e.circle(0,0,3).fill({color:3718648}),e.circle(-1,-1,1).fill({color:0xffffff})):(e.ellipse(0,0,8,10).fill({color:1976635}),e.ellipse(0,0,8,10).stroke({width:1.2,color:Z}),e.circle(-3,-4,2.5).fill({color:Z}),e.circle(3,-4,2.5).fill({color:Z}),e.poly([-1,0,1,0,0,2]).fill({color:0xf59e0b})),X.addChild(e),f.addChild(X)}let Q=new so.f;Q.roundRect(-12,-76,174,180,14).stroke({width:2.5,color:0xfde047,alpha:.9}),Q.roundRect(-12,-76,174,180,14).fill({color:0xfde047,alpha:.05}),Q.visible=!1,f.addChildAt(Q,0);let ee=new so.f;return ee.roundRect(-10,18,170,88,10).stroke({width:3,color:0xf43f5e,alpha:.95}),ee.roundRect(-10,18,170,88,10).fill({color:0xf43f5e,alpha:.08}),ee.visible=!!d,f.addChildAt(ee,0),f.eventMode="static",f.cursor="pointer",f.hitArea=new sp.f(-12,-76,174,180),f.scale.set(c),{root:f,screen:w,glow:v,setSelected(e){Q.visible=!!e},setHazard(e){ee.visible=!!e},animate(e,t=0,s="streaming"){if(w.alpha=.7+.12*Math.sin(.008*e+f.x)*(.4+t),v.alpha=.3+.5*t+.08*Math.sin(.004*e+f.x),ee.visible&&(ee.alpha=.45+.45*Math.sin(.008*e)),U&&t>0){U.clear();for(let t=0;t<3;t++){let s=(.001*e+t/3)%1,r=7+3*Math.sin(5*s+t),i=8-12*s;U.circle(r,i,1+1.8*s).fill({color:0xffffff,alpha:.45*(1-s)})}}else U&&U.clear();if(q){q.clear();for(let t=0;t<4;t++){let s=Math.sin(.008*e+1.6*t)>0,r=[2278750,61695,0xf59e0b,0xec4899][t];q.circle(4,4+6*t,1.3).fill({color:s?r:1976635})}}if(G&&(G.rotation=.002*e),Y){Y.clear(),Y.moveTo(3,9);for(let t=3;t<=15;t+=1.5){let s=9+3*Math.sin(.01*e+.8*t);Y.lineTo(t,s)}Y.stroke({width:1.2,color:3462041,alpha:.9})}X&&("hover_drone"===J?(X.y=72+4*Math.sin(.005*e),X.scale.y=1):"happy"===s?(X.y=80-7*Math.abs(Math.sin(.008*e)),X.scale.y=1+.15*Math.abs(Math.sin(.008*e))):"sleeping"===s?(X.y=80,X.scale.y=1+.04*Math.sin(.0016*e)):"error"===s?(X.x=24+1.5*Math.sin(.08*e),X.y=80):"looping"===s?X.rotation=.15*Math.sin(.04*e):(X.y=80,X.scale.y=1+.06*Math.sin(.003*e)))}}}({color:t.color,label:t.account,meta:`${t.model||""} \xb7 ${t.totalLabel}`,provider:t.provider,clientType:l,elapsedMs:t.elapsedMs,cost:t.cost,cachedPct:t.cachedPct,queued:t.queued,depth:t.depth,isLooping:s,pet:t.pet||f.equippedPet||"none",props:t.props&&t.props.length>0?t.props:f.equippedProps||[],trophy:t.trophy||f.equippedTrophy||"none"});n.root.x=t.x,n.root.y=t.y,n.root.on("pointertap",e=>{u||(e.stopPropagation(),W(t.connectionId===a?null:t.connectionId))});let c=rm({color:t.color,depth:t.depth,seed:e,mode:t.mode,clientType:l,skin:t.skin||f.equippedSkin||"classic",aura:t.aura||f.equippedAura||"none"});c.root.x=t.x+108,c.root.baseX=t.x+108,c.root.baseY=t.y+34,c.root.y=c.root.baseY,o(b,c.root),o(b,n.root);let x=[];if(t.busy>0||t.tools.length>0)for(let e of t.tools){let s=rk(e,{size:1.05});s.root.x=t.x+28,s.root.y=t.y-50,s.root.visible=!1,o(v,s.root),x.push(s)}let p=null,m=t.isLooping?"looping":"pending"===t.mode?"pending":"happy"===t.mode?"done":"error"===t.mode?rv[t.errorReason]?t.errorReason:"rate_limited":null;if(m&&((p=rk(m,{size:1.05})).root.x=t.x+150+14,p.root.y=t.y-34,o(v,p.root)),t.fallbackFrom){let e=rk("fallback",{size:.85,label:`from ${t.fallbackFrom}`});e.root.x=t.x+150+14,e.root.y=t.y+40,o(v,e.root)}let g=null;if("happy"===t.mode&&t.cost>0){g=new t9.t;let e=new so.f;e.circle(0,0,6).fill({color:0xfacc15}),e.circle(0,0,6).stroke({width:1.2,color:0xa16207});let s=new rl({text:`+$${t.cost.toFixed(2)}`,style:{fontFamily:(0,rc.l)("ui"),fontSize:11,fill:0xfacc15,fontWeight:"800"}});s.x=10,s.anchor.set(0,.5),g.addChild(e,s),g.x=t.x+16,g.visible=!1,o(v,g)}i.push({desk:n,character:c,ws:t,toolBadges:x,statusBadge:p,coin:g});let y=d.get(t.provider);if(t.busy>0){let e=e=>Math.max(.15,rN(e)),s=e(t.tokens.input/16e3),r=e(t.tokens.output/3200),i=t.tokens.cached>0?e(t.tokens.cached/6500):0,l={x:t.x+75,y:t.y-10},n={x:1500,y:390};h.push({from:l,to:n,color:t.color,weight:s}),y&&(h.push({from:{x:1500,y:440},to:{x:y.x-46,y:y.y},color:y.color,weight:s}),h.push({from:{x:y.x-46,y:y.y+14},to:{x:1520,y:470},color:8843180,weight:r,shape:"diamond",arc:-22})),h.push({from:{x:1480,y:490},to:{x:t.x+100,y:t.y+6},color:8843180,weight:r,shape:"diamond",arc:-22}),i&&h.push({from:{x:t.x+90,y:t.y-20},to:{x:1470,y:360},color:0xcbd5e1,weight:i,shape:"square",arc:44})}}for(let e of c.pods){let t=rm({color:e.color,trimColor:e.color,scale:.55,seed:e.provider.length,mode:e.overloaded?"pending":e.busy>0?"streaming":"sleeping"});t.root.x=e.x+2,t.root.baseX=e.x+2,t.root.baseY=e.y+10,t.root.y=e.y+10,o(b,t.root);let s=new so.f;s.ellipse(0,34,52,10).fill({color:0,alpha:.35}),s.roundRect(-46,-30,92,62,12).fill({color:1844529}),s.roundRect(-46,-30,92,6,5).fill({color:0xffffff,alpha:.06});let r=e.overloaded?rn.error:e.load>.5?0xfbbf24:3462041;for(let t=0;t<3;t+=1){let i=rN(3*e.load-t);s.roundRect(-38,-18+14*t,76,9,3).fill({color:988188}),i>0&&s.roundRect(-38,-18+14*t,76*i,9,3).fill({color:r,alpha:.9})}s.x=e.x,s.y=e.y,o(b,s);let i=new so.f;i.x=e.x+34,i.y=e.y-35,o(b,i);let n=new rl({text:e.provider.toUpperCase(),style:{fontFamily:(0,rc.l)("ui"),fontSize:12,fill:0xdce6f2,fontWeight:"800",letterSpacing:1}});n.anchor.set(.5,0),n.x=e.x,n.y=e.y+38,o(b,n);let a=rg(`${e.busy} in flight${e.overloaded?" · FULL":""}`,{color:e.overloaded?rn.error:e.color,size:10});a.anchor.set(.5,0),a.x=e.x,a.y=e.y+53,o(b,a),l.push({pod:e,operator:t,siren:i})}c.fallbacks.forEach((e,t)=>{let s=d.get(e.from),r=d.get(e.to);if(!s||!r)return;let i=1778-t%4*14,l=new so.f;l.moveTo(s.x-46,s.y).lineTo(i,s.y).stroke({width:2,color:0xfbbf24,alpha:.5}),l.moveTo(r.x-46,r.y).lineTo(i,r.y).stroke({width:2,color:0xfbbf24,alpha:.5}),function(e,t,s,r){let i=Math.sign(r-s)||1;for(let l=s;i>0?l<r-8:l>r+8;l+=14*i)e.moveTo(t,l).lineTo(t,l+8*i).stroke({width:2,color:0xfbbf24,alpha:.8})}(l,i,s.y,r.y);let a=Math.sign(r.y-s.y)||1;l.poly([i-6,r.y-10*a,i+6,r.y-10*a,i,r.y]).fill({color:0xfbbf24}),o(g,l);let c=new rl({text:`FALLBACK \xd7${e.count}`,style:{fontFamily:(0,rc.l)("ui"),fontSize:9,fill:0xfbbf24,fontWeight:"800",letterSpacing:1}});c.anchor.set(1,.5),c.x=i-9,c.y=(s.y+r.y)/2,o(g,c);let h=rm({color:0xfbbf24,trimColor:0xf59e0b,scale:.5,seed:t+5,mode:"streaming"}),u=new so.f;u.roundRect(-30,-22,14,12,2).fill({color:0xd6a15c}),u.moveTo(-30,-16).lineTo(-16,-16).stroke({width:1.2,color:8145437});let x=new so.f;h.root.addChild(u,x),o(y,h.root),n.push({drone:h,flame:x,laneX:i,y1:s.y,y2:r.y,offset:900*t})}),C.x=1500,C.y=480,I.text=String(c.rack.active),$=c.rack.active>0,T.setMode($?"streaming":"sleeping"),j.setRoutes(h);let p=L;for(let e of(L=r,E=i,A=l,P=n,F(),p))try{e.destroy({children:!0})}catch(e){}}function V(){if(x.screen.width<=0||x.screen.height<=0)return;let e=Math.max(.25,Math.min(x.screen.width/2190,x.screen.height/1020,1));p.scale.set(e),N(Math.max(2150,x.screen.width/e-30),Math.max(980,x.screen.height/e-30)),p.x=(x.screen.width-rS.w*p.scale.x)/2-rS.x*p.scale.x,p.y=(x.screen.height-rS.h*p.scale.y)/2-rS.y*p.scale.y,s.onZoomChange?.(Math.round(100*e))}x.renderer.on("resize",V);let B=e=>{0===e.button&&(c=!0,u=!1,d={x:e.clientX,y:e.clientY},h={x:p.x,y:p.y})},H=e=>{if(!c)return;let t=e.clientX-d.x,s=e.clientY-d.y;Math.hypot(t,s)>4&&(u=!0),p.x=h.x+t,p.y=h.y+s},U=()=>{c=!1},q=t=>{t.preventDefault();let r=e.getBoundingClientRect(),i=t.clientX-r.left,l=t.clientY-r.top,n=t.deltaY<0?1.08:.92,a=p.scale.x,o=Math.max(.25,Math.min(1.15,a*n));if(.001>Math.abs(o-a))return;let c=(i-p.x)/a,d=(l-p.y)/a;p.scale.set(o),p.x=i-c*o,p.y=l-d*o,s.onZoomChange?.(Math.round(100*o))},G=()=>{V()},Y=null,X=e=>{e.preventDefault(),console.warn("[OfficeScene] WebGL context lost - browser reclaimed GPU memory")},K=()=>{console.info("[OfficeScene] WebGL context restored by browser"),Y&&clearTimeout(Y),Y=setTimeout(()=>{try{D(k,!0)}catch(e){console.warn("[OfficeScene] Soft rebuild after context restore:",e)}},200)};e.addEventListener("pointerdown",B),window.addEventListener("pointermove",H),window.addEventListener("pointerup",U),e.addEventListener("wheel",q,{passive:!1}),e.addEventListener("dblclick",G),e.addEventListener("webglcontextlost",X,!1),e.addEventListener("webglcontextrestored",K,!1);let J=()=>{N(rS.w,rS.h),D(k,!0)};window.addEventListener(tB.o,J),window.addEventListener(rc.D,J);let Z=0;x.ticker.add(e=>{let t=e.deltaMS;for(let e of(Z+=t,j.animate(t),E)){let{ws:t}=e,s="streaming"===t.mode?Math.min(1,t.busy/2):rC[t.mode]??0;e.desk.animate(Z,s,t.mode),e.character.animate(Z,s);let r=e.toolBadges.length;if(r>0){let s=Math.floor((Z+3*t.x)/2200)%r,i=(Z+3*t.x)%2200/2200;e.toolBadges.forEach((e,r)=>{let l=r===s;if(e.root.visible=l,!l)return;let n=Math.min(Math.min(1,6*i),Math.min(1,(1-i)*6));e.root.scale.set(1.05*(.35+.65*n)),e.root.alpha=n,e.root.y=t.y-50+2.5*Math.sin(.005*Z+r),e.halo.scale.set(1+.12*Math.sin(.01*Z))})}if(e.statusBadge){let s="error"===t.mode;e.statusBadge.root.y=t.y-34+Math.sin(Z*(s?.02:.004)+t.x)*(s?3:2),e.statusBadge.halo.scale.set(1+Math.sin(Z*(s?.016:.008))*(s?.3:.12))}if(e.coin){let s=(Z+5*t.x)%3400/3400;e.coin.visible=s<.8,e.coin.y=t.y-24-30*s,e.coin.alpha=Math.sin(Math.min(1,s/.8)*Math.PI)}}for(let{pod:e,operator:t,siren:s}of A)if(t.animate(Z,e.overloaded?1:Math.min(1,e.load)),s.clear(),e.overloaded){let e=Math.sin(.014*Z)>0;s.circle(0,0,5).fill({color:0xef4444,alpha:e?1:.35}),s.circle(0,0,13).fill({color:0xef4444,alpha:e?.28:.05})}else s.circle(0,0,3).fill({color:e.busy>0?3462041:4674921,alpha:.9});for(let e of P){let t=(Z+e.offset)%4500/4500,s=t*t*(3-2*t);e.drone.root.baseX=e.laneX,e.drone.root.baseY=e.y1+(e.y2-e.y1)*s+6,e.drone.animate(Z,1),e.flame.clear(),e.flame.ellipse(0,16,7+1.5*Math.sin(.04*Z),10+3*Math.sin(.05*Z)).fill({color:0xfbbf24,alpha:.55}),e.flame.ellipse(0,14,4,6).fill({color:0xfff1b8,alpha:.85}),e.drone.root.alpha=Math.min(1,8*t)*Math.min(1,(1-t)*8)}T.animate(Z,+!!$),z.clear();for(let e=0;e<5;e+=1)for(let t=0;t<6;t+=1)Math.sin(.006*Z+1.7*e+.9*t)>($?-.2:.6)&&z.circle(-40+16*t,56+14*e,2.4).fill({color:e%3==0?3462041:2282478,alpha:.9});_.alpha=$?.5+.3*Math.sin(.005*Z):.15});let Q=(e,t)=>{let s=new rl({text:e,style:{fontFamily:(0,rc.l)("ui"),fontSize:11,fill:8227488,fontWeight:"800",letterSpacing:2}});s.x=t,s.y=rS.y+rS.h-52,w.addChild(s)};Q("TOOL CALLS",35),rw.forEach((e,t)=>{let s=rk(e,{size:.72});s.root.x=160+65*t,s.root.y=rS.y+rS.h-40,w.addChild(s.root)}),Q("STATUS",965),rj.forEach((e,t)=>{let s=rk(e,{size:.72});s.root.x=1050+68*t,s.root.y=rS.y+rS.h-40,w.addChild(s.root)});let ee=new rl({text:"● input ◆ output ■ cached",style:{fontFamily:(0,rc.l)("ui"),fontSize:11,fill:8227488,fontWeight:"700"}});return ee.x=1560,ee.y=rS.y+rS.h-50,w.addChild(ee),D(t),V(),{app:x,rebuild:D,fit:V,zoomIn(){let e=Math.min(1.15,1.15*p.scale.x),t=x.screen.width/2,r=x.screen.height/2,i=(t-p.x)/p.scale.x,l=(r-p.y)/p.scale.y;p.scale.set(e),p.x=t-i*e,p.y=r-l*e,s.onZoomChange?.(Math.round(100*e))},zoomOut(){let e=Math.max(.25,.85*p.scale.x),t=x.screen.width/2,r=x.screen.height/2,i=(t-p.x)/p.scale.x,l=(r-p.y)/p.scale.y;p.scale.set(e),p.x=t-i*e,p.y=r-l*e,s.onZoomChange?.(Math.round(100*e))},reset100(){p.scale.set(1),p.x=(x.screen.width-2150)/2-rS.x,p.y=(x.screen.height-980)/2-rS.y,s.onZoomChange?.(100)},setSelected(e){a=e,F()},setOnSelect(e){o=e},destroy:()=>{Y&&clearTimeout(Y);try{e.removeEventListener("pointerdown",B),window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",U),e.removeEventListener("wheel",q),e.removeEventListener("dblclick",G),e.removeEventListener("webglcontextlost",X),e.removeEventListener("webglcontextrestored",K),window.removeEventListener(tB.o,J),window.removeEventListener(rc.D,J),x.renderer?.off?.("resize",V)}catch{}try{x.ticker?.stop?.()}catch{}try{let e=x.renderer?.gl;(!e||"function"==typeof e.isContextLost&&e.isContextLost())&&x.renderer?.context?.extensions&&(x.renderer.context.extensions.loseContext=null),x.destroy(!1,{children:!0})}catch(e){console.warn("[OfficeScene] Cleanly handled app.destroy:",e)}}}}function rM({traces:e=[],onStats:t,onSelect:s,selectedId:r=null}){let i=(0,o.useRef)(null),l=(0,o.useRef)(null),[n,c]=(0,o.useState)(100),d=(0,o.useRef)({onSelect:s,selectedId:r,traces:e});(0,o.useEffect)(()=>{d.current={onSelect:s,selectedId:r,traces:e}});let[h,u]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!1,t=null,s=i.current;if(!s)return;let r=document.createElement("canvas");return r.style.position="absolute",r.style.inset="0",r.style.width="100%",r.style.height="100%",r.style.display="block",r.style.opacity="0",r.style.transition="opacity 0.2s ease-in-out",s.appendChild(r),(async()=>{try{let s=await rT(r,d.current.traces,{selectedId:d.current.selectedId,onSelect:e=>d.current.onSelect?.(e),onZoomChange:e=>c(e)});if(e){try{s?.destroy?.()}catch{}try{r.remove()}catch{}return}l.current=t=s,r.style.opacity="1",d.current.traces&&d.current.traces.length>0&&t.rebuild?.(d.current.traces)}catch(t){e||(console.error("[OfficeCanvas] mount failed:",t),u(t?.message||"Failed to start the scene"))}})(),()=>{e=!0;try{t?.destroy?.()}catch(e){console.warn("[OfficeCanvas] Cleanup warning:",e)}l.current=null;try{r.remove()}catch{}}},[]),(0,o.useEffect)(()=>{l.current&&l.current.rebuild?.(e)},[e]),(0,o.useEffect)(()=>{let e=()=>{l.current&&l.current.rebuild?.(d.current.traces,!0)};return window.addEventListener(tB.o,e),()=>window.removeEventListener(tB.o,e)},[]),(0,o.useEffect)(()=>{l.current&&l.current.setSelected?.(r)},[r]),(0,o.useEffect)(()=>{if(!t)return;let e=setInterval(()=>{t?.({mounted:!!l.current})},2e3);return()=>clearInterval(e)},[t]),(0,a.jsxs)("div",{className:"relative h-full w-full overflow-hidden rounded-xl border border-slate-800 bg-[#080d14] shadow-2xl",children:[(0,a.jsx)("div",{ref:i,className:"absolute inset-0"}),h&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-rose-400",children:h}),(0,a.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex items-center gap-1 rounded-lg border border-slate-800/80 bg-slate-950/80 p-1 backdrop-blur-md shadow-xl text-slate-400",children:[(0,a.jsx)("button",{onClick:()=>l.current?.zoomOut?.(),title:"Zoom out",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,a.jsx)(tQ.f,{className:"w-3.5 h-3.5"})}),(0,a.jsxs)("button",{onClick:()=>l.current?.reset100?.(),title:"Reset to 100% (1:1 natural scale)",className:"px-2 py-1 rounded-md text-[11px] font-mono hover:bg-slate-800 hover:text-slate-200 transition-colors font-semibold text-slate-300 cursor-pointer",children:[n,"%"]}),(0,a.jsx)("button",{onClick:()=>l.current?.zoomIn?.(),title:"Zoom in",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,a.jsx)(tZ.f,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,a.jsx)("button",{onClick:()=>l.current?.fit?.(),title:"Fit to view",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,a.jsx)(tR.f,{className:"w-3.5 h-3.5"})})]})]})}var r_=e.i(21991);function rz({traces:e=[],selectedTraceId:t=null,onSelectTrace:s,activeTurns:r=[],className:i=""}){let l=(0,o.useRef)(null),[n,c]=(0,o.useState)(1),[d,h]=(0,o.useState)({x:100,y:50}),u=(0,o.useRef)(n);u.current=n;let x=(0,o.useRef)(d);x.current=d;let[f,p]=(0,o.useState)(!1),[m,g]=(0,o.useState)({x:0,y:0}),[b,y]=(0,o.useState)(t||e[0]?.traceId||e[0]?.connectionId),v=(0,o.useMemo)(()=>{let t=new Set,s=[];for(let r of e){let e=r.traceId||r.connectionId;!e||t.has(e)||(t.add(e),s.push({id:e,label:`${r.account||r.connectionId} (${r.model||"Gemini"})`}))}return s},[e]);(0,o.useEffect)(()=>{t?y(t):!b&&e.length>0&&y(e[0].traceId||e[0].connectionId)},[t,e,b]);let{nodes:w,edges:j,bounds:k}=(0,o.useMemo)(()=>(function(e=[],t=null,s=[]){if(!Array.isArray(e)||0===e.length)return{nodes:[],edges:[],bounds:{minX:0,maxX:800,minY:0,maxY:600}};let r=e.find(e=>e.traceId===t||e.traces?.[0]?.traceId===t||e.connectionId===t)||e[0],i=[];Array.isArray(s)&&s.forEach((e,t)=>{Array.isArray(e.toolCalls)&&e.toolCalls.forEach(e=>{let s=(e.name||"").toLowerCase();if(s.includes("invoke_subagent")||s.includes("define_subagent")){let s=e.args?.Subagents||e.args?.subagents||e.args;(Array.isArray(s)?s:[s]).forEach((s,l)=>{s&&(s.Role||s.role||s.TypeName||s.name)&&i.push({id:`sub-${t}-${l}-${s.TypeName||s.name||"worker"}`,parentId:r.traceId||r.connectionId,role:s.Role||s.role||"Subagent Worker",typeName:s.TypeName||s.name||"specialist",model:s.Model||s.model||null,prompt:s.Prompt||s.prompt||s.system_prompt||"",workspace:s.Workspace||s.workspace||"inherit",status:"running"===e.status?"streaming":"idle",tokens:null,durationMs:null,isSubagent:!0})})}})});let l=e.filter(e=>!e.parentTraceId);e.filter(e=>e.parentTraceId);let n=[],a=[],o=new Set,c=new Set,d=e=>{!e||!e.id||o.has(e.id)||(o.add(e.id),n.push(e))};(i.length>0?[r]:l.length>0?l:e).forEach(e=>{d({id:e.traceId||e.connectionId,level:0,label:e.account||e.connectionId||"Orchestrator Agent",role:"Lead Orchestrator",model:e.model||null,status:e.state||e.mode||"idle",isLooping:!!e.isLooping,tokens:e.tokens||null,toolsCount:e.tools?.length??e.logs?.length??null,clientType:e.clientType||"cli",color:e.color?`#${e.color.toString(16).padStart(6,"0")}`:"#38bdf8",isRoot:!0,traceRef:e})}),i.length>0&&i.forEach(e=>{var t;d({id:e.id,level:1,parentId:e.parentId,label:e.role,role:e.role,typeName:e.typeName,model:e.model,status:e.status,prompt:e.prompt,tokens:e.tokens,toolsCount:null,clientType:"subagent",color:"#818cf8",isRoot:!1}),!(t={id:`edge-${e.parentId}-${e.id}`,fromId:e.parentId,toId:e.id,active:"streaming"===e.status,label:e.typeName}).id||c.has(t.id)||(c.add(t.id),a.push(t))});let h={};n.forEach(e=>{h[e.level]||(h[e.level]=[]),h[e.level].push(e)});let u=[],x={},f=1;Object.values(h).forEach(e=>{e.length>f&&(f=e.length)});let p=Math.max((320*f-60)/2+100,500);Object.keys(h).forEach(e=>{let t=parseInt(e,10),s=h[t],r=p-(320*s.length-60)/2;s.forEach((e,s)=>{let i=Math.round(r+320*s),l=Math.round(80+280*t),n={...e,x:i,y:l,width:260,height:140};u.push(n),x[e.id]=n})});let m=[];a.forEach(e=>{let t=x[e.fromId],s=x[e.toId];if(t&&s){let r=t.x+t.width/2,i=t.y+t.height,l=s.x+s.width/2,n=s.y,a=Math.max((n-i)/2,40),o=i+a,c=n-a,d=`M ${r} ${i} C ${r} ${o}, ${l} ${c}, ${l} ${n}`;m.push({...e,fromPos:{x:r,y:i},toPos:{x:l,y:n},pathData:d})}});let g=1/0,b=-1/0,y=1/0,v=-1/0;return u.forEach(e=>{e.x<g&&(g=e.x),e.x+e.width>b&&(b=e.x+e.width),e.y<y&&(y=e.y),e.y+e.height>v&&(v=e.y+e.height)}),isFinite(g)||(g=0,b=1e3,y=0,v=700),{nodes:u,edges:m,bounds:{minX:Math.max(0,g-100),maxX:b+100,minY:Math.max(0,y-80),maxY:v+100}}})(e,b,r),[e,b,r]),S=(0,o.useRef)(k);S.current=k;let N=(0,o.useRef)(w.length);N.current=w.length;let C=(0,o.useCallback)(()=>{if(!l.current||0===N.current)return;let{clientWidth:e,clientHeight:t}=l.current,s=S.current,r=s.maxX-s.minX,i=s.maxY-s.minY;if(r<=0||i<=0)return;let n=Math.min(Math.max(Math.min((e-120)/r,(t-120)/i),.3),1.2),a=(s.minX+s.maxX)/2,o=(s.minY+s.maxY)/2,d=e/2-a*n,u=t/2-o*n;c(n),h({x:Math.round(d),y:Math.round(u)})},[]),T=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(b&&b!==T.current&&w.length>0){T.current=b;let e=setTimeout(()=>{C()},100);return()=>clearTimeout(e)}},[b,w.length,C]),(0,o.useEffect)(()=>{let e=()=>p(!1);return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),(0,o.useEffect)(()=>{let e=l.current;if(!e)return;let t=t=>{t.preventDefault();let s=u.current,r=x.current,i=t.deltaY<0?1.08*s:s/1.08;i=Math.min(Math.max(i,.2),3);let l=e.getBoundingClientRect(),n=t.clientX-l.left,a=t.clientY-l.top,o=n-(n-r.x)*(i/s),d=a-(a-r.y)*(i/s);c(i),h({x:Math.round(o),y:Math.round(d)})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);let M=w.filter(e=>"streaming"===e.status).length;return(0,a.jsxs)("div",{className:`relative w-full h-full bg-slate-950 overflow-hidden select-none flex flex-col ${i}`,onMouseMove:e=>{f&&h({x:Math.round(e.clientX-m.x),y:Math.round(e.clientY-m.y)})},onMouseUp:()=>{p(!1)},children:[(0,a.jsxs)("div",{className:"absolute top-4 left-4 right-4 z-20 flex items-center justify-between pointer-events-none",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl px-3 py-1.5 shadow-xl backdrop-blur-md text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"p-1 rounded-lg bg-indigo-500/10 text-indigo-400 border border-indigo-500/20",children:(0,a.jsx)(tl.f,{className:"w-4 h-4"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-slate-200 block text-xs",children:"Multi-Agent DAG"}),(0,a.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono",children:[w.length," agents • ",j.length," links ",M>0&&`• ${M} running`]})]})]}),(0,a.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-1"}),(0,a.jsx)("select",{value:b||"",onChange:e=>y(e.target.value),className:"bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-slate-300 font-mono focus:outline-none focus:border-indigo-500/50 cursor-pointer",children:v.map(e=>(0,a.jsx)("option",{value:e.id,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl p-1 shadow-xl backdrop-blur-md",children:[(0,a.jsx)("button",{onClick:()=>{let e=u.current,t=x.current,s=Math.min(1.2*e,3);if(l.current){let{clientWidth:r,clientHeight:i}=l.current,n=r/2,a=i/2;h({x:Math.round(n-(n-t.x)*(s/e)),y:Math.round(a-(a-t.y)*(s/e))})}c(s)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom In (+)",children:(0,a.jsx)(tZ.f,{className:"w-4 h-4"})}),(0,a.jsxs)("span",{className:"text-[11px] font-mono text-slate-400 px-2 min-w-12 text-center",children:[Math.round(100*n),"%"]}),(0,a.jsx)("button",{onClick:()=>{let e=u.current,t=x.current,s=Math.max(e/1.2,.2);if(l.current){let{clientWidth:r,clientHeight:i}=l.current,n=r/2,a=i/2;h({x:Math.round(n-(n-t.x)*(s/e)),y:Math.round(a-(a-t.y)*(s/e))})}c(s)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom Out (-)",children:(0,a.jsx)(tQ.f,{className:"w-4 h-4"})}),(0,a.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-0.5"}),(0,a.jsxs)("button",{onClick:C,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-medium text-slate-300 hover:text-white hover:bg-slate-800 transition-colors",title:"Fit to Screen",children:[(0,a.jsx)(tR.f,{className:"w-3.5 h-3.5 text-indigo-400"}),(0,a.jsx)("span",{children:"Fit"})]})]})]}),(0,a.jsxs)("div",{ref:l,onMouseDown:e=>{e.target.closest("button")||e.target.closest(".agent-node-card")||e.target.closest("select")||(p(!0),g({x:e.clientX-x.current.x,y:e.clientY-x.current.y}))},onDoubleClick:e=>{e.target.closest("button")||e.target.closest(".agent-node-card")||e.target.closest("select")||C()},className:"flex-1 w-full h-full relative cursor-grab active:cursor-grabbing overflow-hidden",children:[(0,a.jsxs)("svg",{className:"absolute inset-0 w-full h-full pointer-events-none opacity-20",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("defs",{children:(0,a.jsx)("pattern",{id:"dag-grid",width:"28",height:"28",patternUnits:"userSpaceOnUse",children:(0,a.jsx)("circle",{cx:"2",cy:"2",r:"1.2",fill:"#64748b"})})}),(0,a.jsx)("rect",{width:"100%",height:"100%",fill:"url(#dag-grid)"})]}),(0,a.jsxs)("div",{style:{transform:`translate(${d.x}px, ${d.y}px) scale(${n})`,transformOrigin:"0 0",transition:f?"none":"transform 0.1s ease-out"},className:"absolute top-0 left-0",children:[(0,a.jsxs)("svg",{className:"overflow-visible pointer-events-none absolute top-0 left-0",style:{width:1,height:1},children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"edge-pulse-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:"#38bdf8"}),(0,a.jsx)("stop",{offset:"50%",stopColor:"#818cf8"}),(0,a.jsx)("stop",{offset:"100%",stopColor:"#c084fc"})]}),(0,a.jsx)("marker",{id:"dag-arrow",viewBox:"0 0 10 10",refX:"6",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,a.jsx)("path",{d:"M 0 1 L 8 5 L 0 9 z",fill:"#6366f1"})})]}),j.map(e=>{let t=e.active;return(0,a.jsxs)("g",{children:[(0,a.jsx)("path",{d:e.pathData,fill:"none",stroke:"#1e293b",strokeWidth:"4",strokeLinecap:"round"}),(0,a.jsx)("path",{d:e.pathData,fill:"none",stroke:t?"url(#edge-pulse-gradient)":"#475569",strokeWidth:t?"2.5":"1.8",strokeDasharray:t?"8 6":"none",strokeLinecap:"round",className:t?"animate-pulse":""}),(0,a.jsx)("circle",{cx:e.toPos.x,cy:e.toPos.y,r:t?"4.5":"3",fill:t?"#38bdf8":"#64748b",className:t?"animate-ping":""}),e.label&&(0,a.jsxs)("g",{transform:`translate(${(e.fromPos.x+e.toPos.x)/2}, ${(e.fromPos.y+e.toPos.y)/2})`,children:[(0,a.jsx)("rect",{x:"-38",y:"-10",width:"76",height:"20",rx:"6",fill:"#090d16",stroke:"#334155",strokeWidth:"1"}),(0,a.jsx)("text",{x:"0",y:"4",textAnchor:"middle",fill:"#94a3b8",fontSize:"9",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"600",children:e.label})]})]},e.id)})]}),(0,a.jsx)("div",{className:"relative",children:w.map(e=>{let t="streaming"===e.status,r="done"===e.status,i=e.isLooping?{text:"Loop Alert",color:"text-rose-400 bg-rose-500/10 border-rose-500/30",dot:"bg-rose-500 animate-ping"}:t?{text:"Running",color:"text-cyan-300 bg-cyan-500/10 border-cyan-500/30",dot:"bg-cyan-400 animate-ping"}:r?{text:"Completed",color:"text-emerald-300 bg-emerald-500/10 border-emerald-500/30",dot:"bg-emerald-400"}:{text:"Idle",color:"text-slate-400 bg-slate-800/60 border-slate-700/60",dot:"bg-slate-500"};return(0,a.jsxs)("div",{style:{position:"absolute",left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`},onClick:()=>{e.traceRef&&s?.(e.traceRef)},className:`agent-node-card rounded-2xl border transition-all duration-200 cursor-pointer shadow-xl backdrop-blur-md p-3.5 flex flex-col justify-between select-text group hover:scale-[1.02] ${e.isRoot?"bg-slate-900/95 border-cyan-500/40 hover:border-cyan-400 hover:shadow-cyan-500/10":"bg-slate-900/85 border-slate-800 hover:border-indigo-500/50 hover:shadow-indigo-500/10"}`,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-xl border flex items-center justify-center shrink-0 shadow-inner",style:{borderColor:e.color,backgroundColor:`${e.color}20`},children:(0,a.jsx)(e$.f,{className:"w-4 h-4",style:{color:e.color}})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"font-semibold text-slate-100 text-xs truncate",children:e.label}),(0,a.jsx)("div",{className:"text-[10px] text-slate-400 truncate flex items-center gap-1",children:(0,a.jsx)("span",{children:e.role})})]})]}),(0,a.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-mono border font-semibold ${i.color}`,children:[(0,a.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${i.dot}`}),(0,a.jsx)("span",{children:i.text})]})]}),(0,a.jsx)("div",{className:"my-1.5",children:e.prompt?(0,a.jsx)("p",{className:"text-[11px] text-slate-300 font-mono line-clamp-2 leading-relaxed bg-black/40 p-1.5 rounded-lg border border-slate-800/80",children:e.prompt}):(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-slate-400",children:[(0,a.jsx)(ts.f,{className:"w-3 h-3 text-cyan-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate font-mono",children:e.model})]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-1.5 border-t border-slate-800/80 text-[10px] text-slate-400 font-mono",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(tp.f,{className:"w-3 h-3 text-indigo-400"}),(0,a.jsx)("span",{className:"truncate max-w-24",children:e.model})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[e.toolsCount>0&&(0,a.jsxs)("span",{children:[e.toolsCount," tools"]}),(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),e.traceRef&&s?.(e.traceRef)},className:"opacity-0 group-hover:opacity-100 p-1 rounded bg-slate-800 hover:bg-slate-700 text-slate-200 transition-opacity",title:"View chat session for this agent",children:(0,a.jsx)(r_.f,{className:"w-3 h-3"})})]})]})]},e.id)})})]})]})]})}var rR=e.i(22392);function rI(e,t){(null==t||t>e.length)&&(t=e.length);for(var s=0,r=Array(t);s<t;s++)r[s]=e[s];return r}function rL(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,r)}return s}function rE(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?rL(Object(s),!0).forEach(function(t){var r;r=s[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):rL(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function rA(e){return function t(){for(var s=this,r=arguments.length,i=Array(r),l=0;l<r;l++)i[l]=arguments[l];return i.length>=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),l=0;l<e;l++)r[l]=arguments[l];return t.apply(s,[].concat(i,r))}}}function rP(e){return({}).toString.call(e).includes("Object")}function r$(e){return"function"==typeof e}var rO=rA(function(e,t){throw Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),rF=function(e,t){return rP(t)||rO("changeType"),Object.keys(t).some(function(t){return!Object.prototype.hasOwnProperty.call(e,t)})&&rO("changeField"),t},rW=function(e){r$(e)||rO("selectorType")},rD=function(e){r$(e)||rP(e)||rO("handlerType"),rP(e)&&Object.values(e).some(function(e){return!r$(e)})&&rO("handlersType")},rV=function(e){e||rO("initialIsRequired"),rP(e)||rO("initialType"),Object.keys(e).length||rO("initialContent")};function rB(e,t){return r$(t)?t(e.current):t}function rH(e,t){return e.current=rE(rE({},e.current),t),t}function rU(e,t,s){return r$(t)?t(e.current):Object.keys(s).forEach(function(s){var r;return null==(r=t[s])?void 0:r.call(t,e.current[s])}),s}var rq={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},rG=(l=function(e,t){throw Error(e[t]||e.default)},function e(){for(var t=this,s=arguments.length,r=Array(s),i=0;i<s;i++)r[i]=arguments[i];return r.length>=l.length?l.apply(this,r):function(){for(var s=arguments.length,i=Array(s),l=0;l<s;l++)i[l]=arguments[l];return e.apply(t,[].concat(r,i))}})(rq),rY=function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}},rX={type:"cancelation",msg:"operation is manually canceled"};function rK(e){var t=!1,s=new Promise(function(s,r){e.then(function(e){return t?r(rX):s(e)}),e.catch(r)});return s.cancel=function(){return t=!0},s}var rJ=function(e){if(Array.isArray(e))return e}(n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};rV(e),rD(t);var s={current:e},r=rA(rU)(s,t),i=rA(rH)(s),l=rA(rF)(e),n=rA(rB)(s);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return rW(e),e(s.current)},function(e){(function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(r,i,l,n)(e)}]}({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}))||function(e){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var s,r,i,l,n=[],a=!0,o=!1;try{i=(t=t.call(e)).next,!1;for(;!(a=(s=i.call(t)).done)&&(n.push(s.value),2!==n.length);a=!0);}catch(e){o=!0,r=e}finally{try{if(!a&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(o)throw r}}return n}}(n)||function(e){if(e){if("string"==typeof e)return rI(e,2);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?rI(e,2):void 0}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),rZ=rJ[0],rQ=rJ[1];function r0(e){return document.body.appendChild(e)}function r1(e){var t,s,r=rZ(function(e){return{config:e.config,reject:e.reject}}),i=(t="".concat(r.config.paths.vs,"/loader.js"),s=document.createElement("script"),t&&(s.src=t),s);return i.onload=function(){return e()},i.onerror=r.reject,i}function r2(){var e=rZ(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){var s=t.m||t;r5(s),e.resolve(s)},function(t){e.reject(t)})}function r5(e){rZ().monaco||rQ({monaco:e})}var r3=new Promise(function(e,t){return rQ({resolve:e,reject:t})}),r4=function(){var e=rZ(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(rQ({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),rK(r3);if(window.monaco&&window.monaco.editor)return r5(window.monaco),e.resolve(window.monaco),rK(r3);rY(r0,r1)(r2)}return rK(r3)},r8={display:"flex",position:"relative",textAlign:"initial"},r6={width:"100%"},r7={display:"none"},r9={display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"},ie=function({children:e}){return o.default.createElement("div",{style:r9},e)},it=(0,o.memo)(function({width:e,height:t,isEditorReady:s,loading:r,_ref:i,className:l,wrapperProps:n}){return o.default.createElement("section",{style:{...r8,width:e,height:t},...n},!s&&o.default.createElement(ie,null,r),o.default.createElement("div",{ref:i,style:{...r6,...!s&&r7},className:l}))}),is=function(e){(0,o.useEffect)(e,[])},ir=function(e,t,s=!0){let r=(0,o.useRef)(!0);(0,o.useEffect)(r.current||!s?()=>{r.current=!1}:e,t)};function ii(){}function il(e,t,s,r){var i,l,n,a,o,c;return i=e,l=r,i.editor.getModel(ia(i,l))||(n=e,a=t,o=s,c=r,n.editor.createModel(a,o,c?ia(n,c):void 0))}function ia(e,t){return e.Uri.parse(t)}(0,o.memo)(function({original:e,modified:t,language:s,originalLanguage:r,modifiedLanguage:i,originalModelPath:l,modifiedModelPath:n,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:c=!1,theme:d="light",loading:h="Loading...",options:u={},height:x="100%",width:f="100%",className:p,wrapperProps:m={},beforeMount:g=ii,onMount:b=ii}){let[y,v]=(0,o.useState)(!1),[w,j]=(0,o.useState)(!0),k=(0,o.useRef)(null),S=(0,o.useRef)(null),N=(0,o.useRef)(null),C=(0,o.useRef)(b),T=(0,o.useRef)(g),M=(0,o.useRef)(!1);is(()=>{let e=r4();return e.then(e=>(S.current=e)&&j(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>{let t;return k.current?(t=k.current?.getModel(),void(a||t?.original?.dispose(),c||t?.modified?.dispose(),k.current?.dispose())):e.cancel()}}),ir(()=>{if(k.current&&S.current){let t=k.current.getOriginalEditor(),i=il(S.current,e||"",r||s||"text",l||"");i!==t.getModel()&&t.setModel(i)}},[l],y),ir(()=>{if(k.current&&S.current){let e=k.current.getModifiedEditor(),r=il(S.current,t||"",i||s||"text",n||"");r!==e.getModel()&&e.setModel(r)}},[n],y),ir(()=>{let e=k.current.getModifiedEditor();e.getOption(S.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],y),ir(()=>{k.current?.getModel()?.original.setValue(e||"")},[e],y),ir(()=>{let{original:e,modified:t}=k.current.getModel();S.current.editor.setModelLanguage(e,r||s||"text"),S.current.editor.setModelLanguage(t,i||s||"text")},[s,r,i],y),ir(()=>{S.current?.editor.setTheme(d)},[d],y),ir(()=>{k.current?.updateOptions(u)},[u],y);let _=(0,o.useCallback)(()=>{if(!S.current)return;T.current(S.current);let a=il(S.current,e||"",r||s||"text",l||""),o=il(S.current,t||"",i||s||"text",n||"");k.current?.setModel({original:a,modified:o})},[s,t,i,e,r,l,n]),z=(0,o.useCallback)(()=>{!M.current&&N.current&&(k.current=S.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...u}),_(),S.current?.editor.setTheme(d),v(!0),M.current=!0)},[u,d,_]);return(0,o.useEffect)(()=>{y&&C.current(k.current,S.current)},[y]),(0,o.useEffect)(()=>{w||y||z()},[w,y,z]),o.default.createElement(it,{width:f,height:x,isEditorReady:y,loading:h,_ref:N,className:p,wrapperProps:m})});var io=function(e){let t=(0,o.useRef)();return(0,o.useEffect)(()=>{t.current=e},[e]),t.current},ic=new Map,id=(0,o.memo)(function({defaultValue:e,defaultLanguage:t,defaultPath:s,value:r,language:i,path:l,theme:n="light",line:a,loading:c="Loading...",options:d={},overrideServices:h={},saveViewState:u=!0,keepCurrentModel:x=!1,width:f="100%",height:p="100%",className:m,wrapperProps:g={},beforeMount:b=ii,onMount:y=ii,onChange:v,onValidate:w=ii}){let[j,k]=(0,o.useState)(!1),[S,N]=(0,o.useState)(!0),C=(0,o.useRef)(null),T=(0,o.useRef)(null),M=(0,o.useRef)(null),_=(0,o.useRef)(y),z=(0,o.useRef)(b),R=(0,o.useRef)(),I=(0,o.useRef)(r),L=io(l),E=(0,o.useRef)(!1),A=(0,o.useRef)(!1);is(()=>{let e=r4();return e.then(e=>(C.current=e)&&N(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>T.current?void(R.current?.dispose(),x?u&&ic.set(l,T.current.saveViewState()):T.current.getModel()?.dispose(),T.current.dispose()):e.cancel()}),ir(()=>{let n=il(C.current,e||r||"",t||i||"",l||s||"");n!==T.current?.getModel()&&(u&&ic.set(L,T.current?.saveViewState()),T.current?.setModel(n),u&&T.current?.restoreViewState(ic.get(l)))},[l],j),ir(()=>{T.current?.updateOptions(d)},[d],j),ir(()=>{T.current&&void 0!==r&&(T.current.getOption(C.current.editor.EditorOption.readOnly)?T.current.setValue(r):r!==T.current.getValue()&&(A.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),T.current.pushUndoStop(),A.current=!1))},[r],j),ir(()=>{let e=T.current?.getModel();e&&i&&C.current?.editor.setModelLanguage(e,i)},[i],j),ir(()=>{void 0!==a&&T.current?.revealLine(a)},[a],j),ir(()=>{C.current?.editor.setTheme(n)},[n],j);let P=(0,o.useCallback)(()=>{if(!(!M.current||!C.current)&&!E.current){z.current(C.current);let o=l||s,c=il(C.current,r||e||"",t||i||"",o||"");T.current=C.current?.editor.create(M.current,{model:c,automaticLayout:!0,...d},h),u&&T.current.restoreViewState(ic.get(o)),C.current.editor.setTheme(n),void 0!==a&&T.current.revealLine(a),k(!0),E.current=!0}},[e,t,s,r,i,l,d,h,u,n,a]);return(0,o.useEffect)(()=>{j&&_.current(T.current,C.current)},[j]),(0,o.useEffect)(()=>{S||j||P()},[S,j,P]),I.current=r,(0,o.useEffect)(()=>{j&&v&&(R.current?.dispose(),R.current=T.current?.onDidChangeModelContent(e=>{A.current||v(T.current.getValue(),e)}))},[j,v]),(0,o.useEffect)(()=>{if(j){let e=C.current.editor.onDidChangeMarkers(e=>{let t=T.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=C.current.editor.getModelMarkers({resource:t});w?.(e)}});return()=>{e?.dispose()}}return()=>{}},[j,w]),o.default.createElement(it,{width:f,height:p,isEditorReady:j,loading:c,_ref:M,className:m,wrapperProps:g})});let ih={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};ih.node;let iu=(0,eD.f)(ih),ix={name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]};ix.node;let ip=(0,eD.f)(ix);var im=e.i(72382);let ig={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};ig.node;let ib=(0,eD.f)(ig);var iy=e.i(99847),iv=e.i(15170),iw=e.i(59928),ij=e.i(89360);function ik({filePath:e,fileMeta:t,isSvg:s=!1,onToggleSvgSource:r,onClose:i}){let[l,n]=(0,o.useState)(1),[c,d]=(0,o.useState)({x:0,y:0}),[h,u]=(0,o.useState)(!1),[x,f]=(0,o.useState)({x:0,y:0}),[p,m]=(0,o.useState)(!0),[g,b]=(0,o.useState)({width:0,height:0}),[y,v]=(0,o.useState)(!1),[w,j]=(0,o.useState)(!1),[k,S]=(0,o.useState)(!1),N=(0,o.useRef)(null),C=(0,o.useRef)(null),T=(0,o.useMemo)(()=>t?.mediaUrl?t.mediaUrl:e?`/api/media?path=${encodeURIComponent(e)}`:"",[t,e]),M=(0,o.useMemo)(()=>t?.name?t.name:e?e.split("/").pop()||e:"image",[t,e]),_=(0,o.useMemo)(()=>{if(t?.ext)return t.ext.replace(".","").toUpperCase();let e=M.split(".");return e.length>1?e.pop().toUpperCase():"IMG"},[t,M]),z=(0,o.useMemo)(()=>{if(!t?.size)return null;let e=t.size;return e>=1048576?`${(e/1048576).toFixed(2)} MB`:`${Math.round(e/1024)} KB`},[t]),R=()=>{u(!1)};return(0,a.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden select-none",children:[(0,a.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 text-xs z-10",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,a.jsx)(tw,{filename:M,size:15}),(0,a.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:M,children:M}),(0,a.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:e,children:e})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,a.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-teal-300 font-bold uppercase",children:_}),g.width>0&&(0,a.jsxs)("span",{children:[g.width," × ",g.height," px"]}),z&&(0,a.jsx)("span",{children:z})]}),(0,a.jsxs)("button",{onClick:()=>{e&&(navigator.clipboard.writeText(e),S(!0),setTimeout(()=>S(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${k?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy absolute file path",children:[k?(0,a.jsx)(tW.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,a.jsx)(tF.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{className:"hidden lg:inline",children:k?"Copied!":"Copy Path"})]}),(0,a.jsx)("button",{onClick:()=>m(e=>!e),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${p?"text-teal-400":""}`,title:`Toggle Transparent Checkerboard (${p?"ON":"OFF"})`,children:(0,a.jsx)(iw.f,{className:"w-3.5 h-3.5"})}),(0,a.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 py-0.5",children:[(0,a.jsx)("button",{onClick:()=>{n(e=>Math.max(Number((e-.25).toFixed(2)),.25))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom Out",children:(0,a.jsx)(tQ.f,{className:"w-3.5 h-3.5"})}),(0,a.jsxs)("button",{onClick:()=>{n(1),d({x:0,y:0})},className:"text-[10px] font-mono font-bold text-teal-300 px-1 hover:text-white cursor-pointer",title:"Reset Zoom to 100%",children:[Math.round(100*l),"%"]}),(0,a.jsx)("button",{onClick:()=>{n(e=>Math.min(Number((e+.25).toFixed(2)),5))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom In",children:(0,a.jsx)(tZ.f,{className:"w-3.5 h-3.5"})})]}),(0,a.jsx)("button",{onClick:()=>{if(!N.current||!g.width||!g.height)return;let e=N.current.clientWidth-40,t=N.current.clientHeight-40;n(Number(Math.min(e/g.width,t/g.height,1).toFixed(2))),d({x:0,y:0})},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Fit to Screen",children:(0,a.jsx)(tR.f,{className:"w-3.5 h-3.5"})}),s&&r&&(0,a.jsxs)("button",{onClick:r,className:"flex items-center gap-1 px-2 py-1 rounded bg-[#2d2d2d] hover:bg-[#383838] border border-[#3e3e42] text-xs text-amber-300 hover:text-white transition-colors cursor-pointer",title:"View & Edit SVG Source Code",children:[(0,a.jsx)(ij.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"SVG Code"})]}),(0,a.jsx)("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Open raw image in browser",children:(0,a.jsx)(r_.f,{className:"w-3.5 h-3.5"})}),i&&(0,a.jsx)("button",{onClick:i,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close image tab",children:(0,a.jsx)(tN.X,{className:"w-3.5 h-3.5"})})]})]}),(0,a.jsxs)("div",{ref:N,onWheel:e=>{e.preventDefault(),e.deltaY<0?n(e=>Math.min(Number((e+.1).toFixed(2)),5)):n(e=>Math.max(Number((e-.1).toFixed(2)),.25))},onMouseDown:e=>{0===e.button&&(u(!0),f({x:e.clientX-c.x,y:e.clientY-c.y}))},onMouseMove:e=>{h&&d({x:e.clientX-x.x,y:e.clientY-x.y})},onMouseUp:R,onMouseLeave:R,className:`flex-1 relative overflow-hidden flex items-center justify-center ${h?"cursor-grabbing":"cursor-grab"} ${p?"bg-[#141414] [background-image:linear-gradient(45deg,#1f1f1f_25%,transparent_25%),linear-gradient(-45deg,#1f1f1f_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#1f1f1f_75%),linear-gradient(-45deg,transparent_75%,#1f1f1f_75%)] [background-size:20px_20px] [background-position:0_0,0_10px,10px_-10px,-10px_0px]":"bg-[#121212]"}`,children:[!y&&!w&&(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-slate-400",children:[(0,a.jsx)(eF.f,{className:"w-6 h-6 animate-spin text-teal-400"}),(0,a.jsx)("span",{className:"text-xs font-mono",children:"Loading image..."})]}),w?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,a.jsx)(iy.f,{className:"w-5 h-5"})}),(0,a.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot display image"}),(0,a.jsxs)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:["Unable to load image from ",T]})]}):(0,a.jsx)("div",{style:{transform:`translate(${c.x}px, ${c.y}px) scale(${l})`,transformOrigin:"center center",transition:h?"none":"transform 0.15s ease-out"},className:"inline-block transition-transform select-none",children:(0,a.jsx)("img",{ref:C,src:T,alt:M,onLoad:e=>{let{naturalWidth:t,naturalHeight:s}=e.target;b({width:t,height:s}),v(!0),j(!1)},onError:()=>{v(!1),j(!0)},draggable:!1,className:`max-w-none shadow-2xl rounded-sm ${y?"opacity-100":"opacity-0"}`})}),(0,a.jsxs)("div",{className:"absolute bottom-3 left-3 bg-[#1e1e1e]/90 backdrop-blur-xs border border-[#3e3e42] rounded px-2.5 py-1 text-[10px] text-slate-400 flex items-center gap-2 pointer-events-none",children:[(0,a.jsx)(iv.f,{className:"w-3 h-3 text-teal-400"}),(0,a.jsx)("span",{children:"Drag to pan · Scroll to zoom"})]})]})]})}var iS=e.i(75276);function iN({content:e="",filePath:t="",className:s=""}){return(0,a.jsx)("div",{className:`h-full w-full overflow-y-auto bg-[#1e1e1e] p-6 lg:p-8 select-text ${s}`,children:(0,a.jsx)("div",{className:"max-w-4xl mx-auto bg-[#1e1e1e] pb-16",children:(0,a.jsx)(iS.f,{content:e})})})}function iC({filePath:e,initialContent:t=null,readOnly:s=!1,onClose:r,onSave:i}){let[l,n]=(0,o.useState)(t||""),[c,d]=(0,o.useState)(t||""),[h,u]=(0,o.useState)(null),[x,f]=(0,o.useState)(!t),[p,m]=(0,o.useState)(null),[g,b]=(0,o.useState)(!1),[y,v]=(0,o.useState)(!1),[w,j]=(0,o.useState)(!1),[k,S]=(0,o.useState)("on"),[N,C]=(0,o.useState)(!0),[T,M]=(0,o.useState)("vs-dark"),[_,z]=(0,o.useState)('ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'),[R,I]=(0,o.useState)(13),[L,E]=(0,o.useState)("preview"),[A,P]=(0,o.useState)("image"),$=(0,o.useMemo)(()=>e?e.split("/").pop()||e:"untitled",[e]);(0,o.useEffect)(()=>{let e=()=>{let e=(0,rc._)();"light-plus"===e.theme?M("vs"):M("vs-dark"),z((0,rc.l)("mono")),e.fontSize&&I(parseInt(e.fontSize,10)||13)};return e(),window.addEventListener(rc.D,e),()=>window.removeEventListener(rc.D,e)},[]);let O=(0,o.useCallback)(async()=>{if(e){f(!0),m(null);try{let t=await fetch(`/api/workspace/file-content?path=${encodeURIComponent(e)}`),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to load file content");n(s.content||""),d(s.content||""),u(s)}catch(e){m(e.message)}finally{f(!1)}}},[e]);(0,o.useEffect)(()=>{O()},[O]);let F=(0,o.useMemo)(()=>l!==c,[l,c]),W=async()=>{if(e&&!s&&!y){v(!0);try{let t=await fetch("/api/workspace/file-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:l})}),s=await t.json();if(!t.ok)throw Error(s.error||"Save failed");d(l),j(!0),setTimeout(()=>j(!1),2e3),i?.(e,l)}catch(e){alert(`Save error: ${e.message}`)}finally{v(!1)}}};(0,o.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),W())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,e,s]);let D=(0,o.useMemo)(()=>l?l.split("\n").length:0,[l]),V=h?.language||"plaintext",B=!!(h?.isImage&&!h?.isSvg),H=!!h?.isSvg,U="markdown"===V||$.endsWith(".md")||$.endsWith(".markdown")||$.endsWith(".mdx");return!B||x||p?!H||"image"!==A||x||p?(0,a.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-slate-200 overflow-hidden select-text",children:[(0,a.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 select-none text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,a.jsx)(tw,{filename:$,size:15}),(0,a.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:$,children:$}),F&&(0,a.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0",title:"Modified"}),(0,a.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:e,children:e})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[U&&(0,a.jsxs)("div",{className:"flex items-center bg-[#1e1e1e] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[(0,a.jsx)("button",{onClick:()=>E("edit"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"edit"===L?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Monaco Source Editor",children:"Code"}),(0,a.jsx)("button",{onClick:()=>E("preview"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"preview"===L?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Formatted Markdown Preview",children:"Preview"}),(0,a.jsx)("button",{onClick:()=>E("split"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"split"===L?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Side-by-side Edit & Live Preview",children:"Split"})]}),H&&"code"===A&&(0,a.jsxs)("button",{onClick:()=>P("image"),className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#1e1e1e] hover:bg-[#333333] border border-[#3e3e42] text-[10px] text-teal-300 hover:text-white transition-colors cursor-pointer",title:"Switch to Rendered SVG Image View",children:[(0,a.jsx)(iv.f,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"Image View"})]}),(0,a.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-cyan-300 font-bold uppercase",children:V}),(0,a.jsxs)("span",{children:[D," lines"]}),(0,a.jsx)("span",{children:"UTF-8"})]}),(0,a.jsxs)("button",{onClick:()=>{l&&(navigator.clipboard.writeText(l),b(!0),setTimeout(()=>b(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${g?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy file content to clipboard",children:[g?(0,a.jsx)(tW.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,a.jsx)(tF.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{className:"hidden lg:inline",children:g?"Copied!":"Copy"})]}),!s&&(0,a.jsxs)("button",{onClick:W,disabled:!F||y,className:`flex items-center gap-1 px-2.5 py-1 rounded text-xs transition-colors cursor-pointer border font-semibold ${w?"bg-emerald-600 text-white border-emerald-500":F?"bg-[#007acc] hover:bg-[#0062a3] text-white border-[#007acc] shadow-sm animate-pulse":"bg-[#2d2d2d] border-[#3e3e42] text-slate-500 cursor-not-allowed opacity-50"}`,title:"Save changes (Cmd+S / Ctrl+S)",children:[(0,a.jsx)(iu,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:y?"Saving...":w?"Saved!":"Save"})]}),(!U||"preview"!==L)&&(0,a.jsx)("button",{onClick:()=>S(e=>"on"===e?"off":"on"),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${"on"===k?"text-cyan-400":""}`,title:`Toggle Word Wrap (${"on"===k?"ON":"OFF"})`,children:(0,a.jsx)(ip,{className:"w-3.5 h-3.5"})}),(!U||"preview"!==L)&&(0,a.jsx)("button",{onClick:()=>C(e=>!e),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${N?"text-cyan-400":""}`,title:`Toggle Minimap (${N?"Show":"Hide"})`,children:N?(0,a.jsx)(im.f,{className:"w-3.5 h-3.5"}):(0,a.jsx)(ib,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{onClick:O,className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Reload from disk",children:(0,a.jsx)(eF.f,{className:`w-3.5 h-3.5 ${x?"animate-spin text-emerald-400":""}`})}),r&&(0,a.jsx)("button",{onClick:r,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close editor tab",children:(0,a.jsx)(tN.X,{className:"w-3.5 h-3.5"})})]})]}),(0,a.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#1e1e1e]",children:x?(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 text-slate-400",children:[(0,a.jsx)(eF.f,{className:"w-6 h-6 animate-spin text-[#007acc]"}),(0,a.jsxs)("span",{className:"text-xs font-mono",children:["Loading ",$,"..."]})]}):p?(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,a.jsx)(iy.f,{className:"w-5 h-5"})}),(0,a.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot load file"}),(0,a.jsx)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:p}),(0,a.jsx)("button",{onClick:O,className:"px-3 py-1.5 rounded bg-[#252526] hover:bg-[#333333] border border-[#3e3e42] text-xs text-slate-200 cursor-pointer",children:"Retry"})]}):U&&"preview"===L?(0,a.jsx)(iN,{content:l,filePath:e}):U&&"split"===L?(0,a.jsxs)("div",{className:"flex h-full w-full divide-x divide-[#2b2b2b]",children:[(0,a.jsx)("div",{className:"w-1/2 h-full overflow-hidden",children:(0,a.jsx)(id,{height:"100%",path:e,language:V,value:l,onChange:e=>n(e||""),theme:T,options:{readOnly:s,fontSize:R,fontFamily:_,minimap:{enabled:N},scrollBeyondLastLine:!1,wordWrap:k,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})}),(0,a.jsx)("div",{className:"w-1/2 h-full overflow-hidden bg-[#1e1e1e]",children:(0,a.jsx)(iN,{content:l,filePath:e})})]}):(0,a.jsx)(id,{height:"100%",path:e,language:V,value:l,onChange:e=>n(e||""),theme:T,options:{readOnly:s,fontSize:R,fontFamily:_,minimap:{enabled:N},scrollBeyondLastLine:!1,wordWrap:k,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})})]}):(0,a.jsx)(ik,{filePath:e,fileMeta:h,isSvg:!0,onToggleSvgSource:()=>P("code"),onClose:r}):(0,a.jsx)(ik,{filePath:e,fileMeta:h,onClose:r})}var iT=e.i(74363);e.i(2043);var iM=e.i(95554),i_=e.i(15267);let iz={name:"shield-check",size:24,node:[["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"}]]};iz.node;let iR=(0,eD.f)(iz);function iI({isOpen:e,onClose:t}){let[s,r]=(0,o.useState)((0,tB.F)());return(0,o.useEffect)(()=>{let e=e=>{r(e.detail||(0,tB.F)())};return window.addEventListener(tB.o,e),()=>window.removeEventListener(tB.o,e)},[]),(0,a.jsx)(iM.f,{isOpen:e,onClose:t,title:"Supporter Store & Vault (1,000 Tech Items & 3D Effects)",description:"Support the developer to maintain the project and unlock custom AGMon virtual office decorations",size:"full",footer:(0,a.jsxs)("div",{className:"flex items-center justify-between w-full text-xs text-slate-400",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:s.isSupporter?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-amber-400 font-semibold",children:[(0,a.jsx)(iR,{className:"w-4 h-4 text-amber-400"}),(0,a.jsx)("span",{children:"Status: VIP Supporter Activated (All 1,000 items unlocked)"})]}):(0,a.jsx)("span",{children:"100% of AGMon core engineering features remain completely free"})}),(0,a.jsx)(i_.f,{variant:"ghost",size:"sm",onClick:t,children:"Close"})]}),children:(0,a.jsx)("div",{className:"h-[80vh] -mx-4 -mt-2 -mb-4 overflow-hidden rounded-md border border-[#333333]",children:(0,a.jsx)(iT.f,{hideHeader:!0,onClose:t})})})}function iL({isOpen:e=!1,onClose:t,initialTab:s="themes"}){let[r,i]=(0,o.useState)(s||"themes"),[l,n]=(0,o.useState)(rc.s);if((0,o.useEffect)(()=>{e&&(n((0,rc._)()),i(s||"themes"))},[e,s]),(0,o.useEffect)(()=>{let e=e=>{e.detail&&n(e.detail)};return window.addEventListener(rc.D,e),()=>window.removeEventListener(rc.D,e)},[]),!e)return null;let c=(e,t)=>{let s={...l,[e]:t};n(s),(0,rc.Y)(s)};return(0,a.jsx)("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm animate-in fade-in",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl bg-[#1e1e1e] border border-[#333333] rounded-xl shadow-2xl overflow-hidden flex flex-col text-[#cccccc] font-sans max-h-[85vh]",children:[(0,a.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[#252526] border-b border-[#2b2b2b] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eZ.f,{className:"w-4 h-4 text-[#007acc]"}),(0,a.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-white",children:"Preferences: Theme & Typography (VS Code Settings)"})]}),(0,a.jsx)("button",{onClick:t,className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Close (Escape)",children:(0,a.jsx)(tN.X,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-[#2b2b2b] bg-[#181818] shrink-0 select-none",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i("themes"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"themes"===r?"bg-[#252526] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,children:[(0,a.jsx)(eZ.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,a.jsxs)("span",{children:["Color Themes (",rc.z.length,")"]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>i("fonts"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"fonts"===r?"bg-[#252526] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,children:[(0,a.jsx)(tK,{className:"w-3.5 h-3.5 text-emerald-400"}),(0,a.jsx)("span",{children:"Typography & Fonts"})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:"themes"===r?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Choose color theme for workbench, dialogs, sidebar, and toolbars:"}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:rc.z.map(e=>{let t=l.theme===e.id;return(0,a.jsxs)("div",{onClick:()=>{var t;let s;return t=e.id,void(n(s={...l,theme:t}),(0,rc.Y)(s))},className:`group relative p-3 rounded-lg border transition-all cursor-pointer flex flex-col justify-between space-y-2.5 ${t?"bg-[#252526] border-[#007acc] shadow-md shadow-[#007acc]/10":"bg-[#181818] border-[#2b2b2b] hover:border-[#3e3e42] hover:bg-[#252526]/50"}`,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-bold text-xs text-white",children:e.name}),(0,a.jsx)("span",{className:"text-[9px] px-1.5 py-0.2 rounded border border-[#3e3e42] text-slate-400 uppercase font-mono",children:e.category})]}),t&&(0,a.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#007acc] text-white flex items-center justify-center shrink-0",children:(0,a.jsx)(tW.f,{className:"w-2.5 h-2.5"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 h-3 rounded overflow-hidden p-0.5 bg-black/40 border border-[#2b2b2b]",children:[(0,a.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:e.colors.workbench},title:`Workbench: ${e.colors.workbench}`}),(0,a.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:e.colors.editor},title:`Editor: ${e.colors.editor}`}),(0,a.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:e.colors.sidebar},title:`Sidebar: ${e.colors.sidebar}`}),(0,a.jsx)("span",{className:"h-full w-4 rounded-xs",style:{backgroundColor:e.colors.accent},title:`Accent: ${e.colors.accent}`})]}),(0,a.jsx)("p",{className:"text-[11px] text-slate-400 leading-relaxed",children:e.description})]},e.id)})})]}):(0,a.jsxs)("div",{className:"space-y-4 text-xs",children:[(0,a.jsxs)("div",{className:"p-3 rounded-lg bg-[#181818] border border-[#2b2b2b] space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-bold text-slate-200 uppercase tracking-wider text-[11px]",children:"1. UI Font Family"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-500 font-mono",children:"--font-family-ui"})]}),(0,a.jsx)("select",{value:l.uiFont,onChange:e=>c("uiFont",e.target.value),className:"w-full bg-[#252526] text-slate-200 border border-[#3e3e42] rounded px-3 py-1.5 text-xs outline-none focus:border-[#007acc] cursor-pointer",children:rc.M.map(e=>(0,a.jsx)("option",{value:e.id,className:"bg-[#252526] text-slate-200",children:e.name},e.id))}),(0,a.jsx)("div",{className:"p-2 rounded bg-black/40 border border-[#2b2b2b] text-slate-300 text-xs",style:{fontFamily:"var(--font-family-ui)"},children:"UI Preview: Agent Factory - Realtime multi-agent activity and telemetry monitor."})]}),(0,a.jsxs)("div",{className:"p-3 rounded-lg bg-[#181818] border border-[#2b2b2b] space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-bold text-slate-200 uppercase tracking-wider text-[11px]",children:"2. Monospace Font (Code & Console)"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-500 font-mono",children:"--font-family-mono"})]}),(0,a.jsx)("select",{value:l.codeFont,onChange:e=>c("codeFont",e.target.value),className:"w-full bg-[#252526] text-slate-200 border border-[#3e3e42] rounded px-3 py-1.5 text-xs outline-none focus:border-[#007acc] cursor-pointer",children:rc.Q.map(e=>(0,a.jsx)("option",{value:e.id,className:"bg-[#252526] text-slate-200",children:e.name},e.id))}),(0,a.jsx)("div",{className:"p-2 rounded bg-black/40 border border-[#2b2b2b] text-emerald-400 font-mono text-[11px] leading-relaxed",style:{fontFamily:"var(--font-family-mono)"},children:'const agent = { id: "gemini-3.8-flash", tokens: 142857, state: "streaming" };'})]}),(0,a.jsxs)("div",{className:"p-3 rounded-lg bg-[#181818] border border-[#2b2b2b] space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-bold text-slate-200 uppercase tracking-wider text-[11px]",children:"3. Base Font Size"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-500 font-mono",children:"--font-size-ui"})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:rc.J.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>c("fontSize",e.id),className:`p-2 rounded border text-xs font-semibold transition-colors cursor-pointer text-center ${l.fontSize===e.id?"bg-[#007acc]/20 border-[#007acc] text-cyan-300":"bg-[#252526] border-[#3e3e42] text-slate-400 hover:text-white"}`,children:e.label},e.id))})]})]})}),(0,a.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[#252526] border-t border-[#2b2b2b] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,a.jsxs)("button",{onClick:()=>{n(rc.s),(0,rc.Y)(rc.s)},className:"flex items-center gap-1.5 px-2.5 py-1 rounded bg-[#1e1e1e] hover:bg-[#2d2d2d] text-slate-400 hover:text-white border border-[#3e3e42] text-xs transition-colors cursor-pointer",title:"Restore default settings",children:[(0,a.jsx)(h.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{children:"Reset to Defaults"})]}),(0,a.jsx)("button",{onClick:t,className:"px-4 py-1.5 rounded bg-[#007acc] hover:bg-[#0062a3] text-white text-xs font-semibold transition-colors cursor-pointer",children:"Done"})]})]})})}var iE=e.i(61240);let iA={"gemini-3.8-flash":{input:.075,output:.3,cached:.01875},"gemini-2.5-flash":{input:.075,output:.3,cached:.01875},"gemini-1.5-flash":{input:.075,output:.3,cached:.01875},"gemini-3.8-pro":{input:1.25,output:5,cached:.3125},"gemini-3.1-pro":{input:1.25,output:5,cached:.3125},"gemini-2.5-pro":{input:1.25,output:5,cached:.3125},"gemini-1.5-pro":{input:1.25,output:5,cached:.3125},"claude-opus-5-5":{input:4,output:20,cached:.2},"claude-sonnet-5-5":{input:2,output:10,cached:.1},"claude-haiku-5-5":{input:.1,output:.5,cached:.01},"claude-fable-5":{input:10,output:50,cached:1},"claude-mythos-5":{input:10,output:50,cached:1},"claude-opus-4-8":{input:5,output:25,cached:.5},"claude-opus-4-7":{input:5,output:25,cached:.5},"claude-opus-4-6":{input:5,output:25,cached:.5},"claude-opus-4-5":{input:5,output:25,cached:.5},"claude-sonnet-4-6":{input:3,output:15,cached:.3},"claude-sonnet-4-5":{input:3,output:15,cached:.3},"claude-haiku-4-5":{input:1,output:5,cached:.1},"claude-3-7-sonnet":{input:3,output:15,cached:.3},"claude-3-5-sonnet":{input:3,output:15,cached:.3},"claude-3-5-haiku":{input:.8,output:4,cached:.08},"claude-3-opus":{input:15,output:75,cached:1.5},"claude-3-haiku":{input:.25,output:1.25,cached:.025},"gpt-4o-mini":{input:.15,output:.6,cached:.075},"gpt-4o":{input:2.5,output:10,cached:1.25},minimax:{input:.3,output:1.2,cached:.3}},iP=Object.keys(iA).sort((e,t)=>t.length-e.length);function i$(e,t){if(!e)return null;let s=function(e){let t=(e||"").toLowerCase();if(!t)return null;for(let e of iP)if(t.includes(e))return iA[e];return null}(t);return s?(e.input||0)*(s.input/1e6)+(e.output||0)*(s.output/1e6)+(e.cached||0)*(s.cached/1e6):null}let iO={name:"skip-back",size:24,node:[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]]};iO.node;let iF=(0,eD.f)(iO),iW={name:"skip-forward",size:24,node:[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]};iW.node;let iD=(0,eD.f)(iW);var iV=e.i(64569),iB=e.i(23730),iH=e.i(82902);function iU(e){if(isNaN(e)||e<0)return"00:00";let t=Math.floor(e/60),s=Math.floor(e%60);return`${String(t).padStart(2,"0")}:${String(s).padStart(2,"0")}`}function iq({replay:e,onClose:t,className:s=""}){let{sessionInfo:r,keyframes:i=[],totalSteps:l=0,currentStepIndex:n=0,currentKeyframe:c,currentTime:d=0,totalElapsedSeconds:u=0,isPlaying:x=!1,playbackSpeed:f=2,play:p,pause:m,togglePlay:g,seekToStep:b,stepForward:y,stepBackward:v,setPlaybackSpeed:w,reset:j}=e,[k,S]=(0,o.useState)(null),N=(0,o.useMemo)(()=>l<=1?[]:i.map((e,t)=>{let s=t/(l-1)*100,r="bg-slate-500";return"prompt"===e.milestoneType?r="bg-amber-400":"file_write"===e.type?r="bg-purple-400":"tool"===e.milestoneType?r="bg-cyan-400":"error"===e.milestoneType?r="bg-rose-500":"finish"===e.milestoneType&&(r="bg-emerald-400"),{idx:t,pct:s,color:r,type:e.type,title:e.title,summary:e.summary}}),[i,l]);return i&&0!==i.length?(0,a.jsxs)("div",{className:`bg-[#181818]/95 backdrop-blur-md border-t border-[#3e3e42] p-2 select-none shadow-2xl flex flex-col gap-2 text-slate-200 ${s}`,style:{colorScheme:"dark"},children:[(0,a.jsxs)("div",{className:"relative flex flex-col gap-1 px-2 pt-1",children:[(0,a.jsxs)("div",{className:"relative w-full h-5 flex items-center",children:[(0,a.jsx)("div",{className:"absolute inset-x-0 h-1 bg-[#252526] rounded-full pointer-events-none overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-[#007acc] transition-all duration-75",style:{width:`${l>1?n/(l-1)*100:0}%`}})}),(0,a.jsx)("div",{className:"absolute inset-x-0 h-full pointer-events-none flex items-center",children:N.map(e=>(0,a.jsx)("div",{className:`absolute w-2 h-2 rounded-full -translate-x-1/2 ${e.color} transition-transform ${k===e.idx||n===e.idx?"scale-150 ring-2 ring-white z-20":"opacity-80"}`,style:{left:`${e.pct}%`}},e.idx))}),(0,a.jsx)("input",{type:"range",min:0,max:Math.max(0,l-1),value:n,onChange:e=>b(parseInt(e.target.value,10)),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",title:"Drag to scrub timeline"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-[11px] font-mono text-slate-400",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 truncate",children:[(0,a.jsxs)("span",{className:"text-[#007acc] font-bold",children:["Step ",n+1,"/",l]}),(0,a.jsx)("span",{className:"text-slate-600",children:"•"}),(0,a.jsx)("span",{className:"text-white truncate font-sans",children:c?.title||"Event"}),c?.activeTool&&(0,a.jsx)(iH.f,{variant:"type",badgeSize:"xs",className:"shrink-0 font-mono",children:c.activeTool})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,a.jsxs)("span",{children:[iU(d)," / ",iU(u)]})})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 px-2 border-t border-[#252526] pt-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(i_.f,{variant:"secondary",size:"icon-sm",onClick:j,title:"Rewind to start (Home)",children:(0,a.jsx)(h.f,{className:"w-3.5 h-3.5"})}),(0,a.jsx)(i_.f,{variant:"secondary",size:"icon-sm",onClick:v,disabled:n<=0,title:"Step backward (←)",children:(0,a.jsx)(iF,{className:"w-3.5 h-3.5"})}),(0,a.jsx)(i_.f,{variant:"primary",size:"sm",onClick:g,className:"px-3",title:x?"Pause (Space)":"Play (Space)",leftIcon:x?(0,a.jsx)(tA,{className:"w-3.5 h-3.5"}):(0,a.jsx)(tL.f,{className:"w-3.5 h-3.5 fill-current"}),children:x?"Pause":"Play"}),(0,a.jsx)(i_.f,{variant:"secondary",size:"icon-sm",onClick:y,disabled:n>=l-1,title:"Step forward (→)",children:(0,a.jsx)(iD,{className:"w-3.5 h-3.5"})}),(0,a.jsxs)("div",{className:"flex items-center gap-1 pl-2 border-l border-[#333]",children:[(0,a.jsx)("span",{className:"text-[10px] text-slate-400 font-medium",children:"Speed:"}),(0,a.jsx)("div",{className:"flex items-center bg-[#252526] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[{label:"1x",value:1},{label:"2x",value:2},{label:"5x",value:5},{label:"10x",value:10}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>w(e.value),className:`px-1.5 py-0.5 rounded transition-colors cursor-pointer ${f===e.value?"bg-[#007acc] text-white font-bold":"text-slate-400 hover:text-white"}`,children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs font-mono",children:[(0,a.jsxs)("div",{className:"hidden sm:flex items-center gap-1.5 text-slate-400",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase text-slate-500",children:"Session:"}),(0,a.jsxs)("span",{className:"text-white truncate max-w-[140px]",title:r?.id,children:[r?.id?.slice(0,14),"..."]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-emerald-400",children:[(0,a.jsx)(iV.f,{className:"w-3 h-3 text-cyan-400"}),(0,a.jsxs)("span",{children:[(c?.cumulativeTokens||0).toLocaleString()," tks"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-amber-300",children:[(0,a.jsx)(iB.f,{className:"w-3 h-3 text-amber-400"}),(0,a.jsxs)("span",{children:["$",(c?.cumulativeCost||0).toFixed(4)]})]}),t&&(0,a.jsx)(i_.f,{variant:"ghost",size:"xs",onClick:t,className:"text-slate-400 hover:text-white ml-1",title:"Exit Replay mode",leftIcon:(0,a.jsx)(tN.X,{className:"w-3 h-3"}),children:"Exit Replay"})]})]})]}):null}var iG=e.i(62633),iY=e.i(1279),iX=e.i(47925),iK=e.i(51757),iJ=e.i(74544);let iZ={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};iZ.node;let iQ=(0,eD.f)(iZ);function i0({isOpen:e,onClose:t,replay:s,onOpenConversation:r}){let{currentKeyframe:i,currentStepIndex:l=0,totalSteps:n=0,currentTime:d=0,totalElapsedSeconds:h=0,stepBackward:u,stepForward:x,sessionInfo:f={}}=s||{},[p,m]=(0,o.useState)(!1);if(!e||!i)return null;let g=e=>{e&&(navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3))},b={user_input:{label:"User Prompt",variant:"warning",icon:iY.f,color:"text-amber-400",bg:"bg-amber-950/40 border-amber-500/30"},thought:{label:"AI Chain of Thought",variant:"info",icon:iG.f,color:"text-cyan-400",bg:"bg-cyan-950/40 border-cyan-500/30"},tool_call:{label:"Tool Call",variant:"primary",icon:iX.f,color:"text-[#007acc]",bg:"bg-blue-950/40 border-blue-500/30"},file_write:{label:"File Write / Edit",variant:"tool",icon:ij.f,color:"text-purple-400",bg:"bg-purple-950/40 border-purple-500/30"},assistant_reply:{label:"Assistant Reply",variant:"success",icon:ts.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"},finish:{label:"Session Finished",variant:"success",icon:iK.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"}}[i.type]||{label:i.type||"Event",variant:"default",icon:iQ,color:"text-slate-400",bg:"bg-slate-900 border-slate-800"},y=b.icon,v="error"===i.milestoneType,w=i.details||{},j=w.args&&Object.keys(w.args).length>0,k=!!w.output;return(0,a.jsx)(iM.f,{isOpen:e,onClose:t,title:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(y,{className:`w-4 h-4 ${v?"text-rose-400":b.color}`}),(0,a.jsxs)("span",{className:"text-white font-semibold",children:["Event Details • Step ",l+1,"/",n]}),(0,a.jsx)(iH.f,{variant:v?"danger":b.variant,badgeSize:"xs",className:"uppercase tracking-wider font-mono text-[10px]",children:v?"Error":b.label})]}),description:(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400 mt-1",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1 font-mono",children:[(0,a.jsx)(iJ.f,{className:"w-3 h-3 text-slate-500"}),i.elapsedSeconds,"s (",new Date(i.timestamp).toLocaleTimeString(),")"]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{className:"flex items-center gap-1 text-cyan-400 font-mono",children:[(0,a.jsx)(iV.f,{className:"w-3 h-3"}),(i.cumulativeTokens||0).toLocaleString()," tokens"]}),(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{className:"flex items-center gap-1 text-amber-300 font-mono",children:[(0,a.jsx)(iB.f,{className:"w-3 h-3"}),"$",(i.cumulativeCost||0).toFixed(4)]})]}),size:"lg",footer:(0,a.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i_.f,{variant:"secondary",size:"sm",onClick:u,disabled:l<=0,leftIcon:(0,a.jsx)(tC.f,{className:"w-3.5 h-3.5"}),children:"Previous"}),(0,a.jsx)(i_.f,{variant:"secondary",size:"sm",onClick:x,disabled:l>=n-1,rightIcon:(0,a.jsx)(td.f,{className:"w-3.5 h-3.5"}),children:"Next"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[r&&(0,a.jsx)(i_.f,{variant:"secondary",size:"sm",onClick:()=>{t(),r(f?.id||s?.sessionId)},leftIcon:(0,a.jsx)(c.f,{className:"w-3.5 h-3.5 text-cyan-400"}),children:"View Conversation"}),(0,a.jsx)(i_.f,{variant:"secondary",size:"sm",onClick:t,children:"Close"})]})]}),children:(0,a.jsxs)("div",{className:"space-y-4 max-h-[65vh] overflow-y-auto pr-1",children:[(0,a.jsxs)("div",{className:`p-3 rounded-lg border ${b.bg} space-y-1`,children:[(0,a.jsxs)("div",{className:"text-xs font-semibold text-white flex items-center justify-between",children:[(0,a.jsx)("span",{children:i.title}),i.activeTool&&(0,a.jsx)(iH.f,{variant:"type",badgeSize:"xs",className:"font-mono",children:i.activeTool})]}),i.summary&&(0,a.jsx)("p",{className:"text-xs text-slate-300 leading-relaxed",children:i.summary})]}),"user_input"===i.type&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(iY.f,{className:"w-3.5 h-3.5 text-amber-400"}),"User Prompt Message"]}),(0,a.jsx)(i_.f,{variant:"ghost",size:"xs",onClick:()=>g(i.content),leftIcon:p?(0,a.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,a.jsx)(tF.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,a.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:i.content||"No text content."})]}),"thought"===i.type&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(iG.f,{className:"w-3.5 h-3.5 text-cyan-400"}),"AI Reasoning (Chain of Thought)"]}),(0,a.jsx)(i_.f,{variant:"ghost",size:"xs",onClick:()=>g(i.content),leftIcon:p?(0,a.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,a.jsx)(tF.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,a.jsx)("pre",{className:"p-3 bg-[#12161f] border border-cyan-900/40 rounded-lg text-xs font-mono text-cyan-200/90 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:i.content})]}),"file_write"===i.type&&w.args?.ReplacementContent&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(ij.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Code Changes (Diff Preview)"]}),w.targetFile&&(0,a.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:w.targetFile})]}),w.args.TargetContent&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("span",{className:"text-[10px] font-bold text-rose-400 uppercase tracking-wider block",children:"- Original Content (Replaced)"}),(0,a.jsx)("pre",{className:"p-2.5 bg-rose-950/20 border border-rose-500/30 rounded-lg text-xs font-mono text-rose-300 whitespace-pre-wrap leading-relaxed max-h-48 overflow-y-auto",children:w.args.TargetContent})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider block",children:"+ New Content (Added)"}),(0,a.jsx)("pre",{className:"p-2.5 bg-emerald-950/20 border border-emerald-500/30 rounded-lg text-xs font-mono text-emerald-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:w.args.ReplacementContent})]})]}),"file_write"===i.type&&!w.args?.ReplacementContent&&w.args?.CodeContent&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(ij.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Created File Content"]}),w.targetFile&&(0,a.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:w.targetFile})]}),(0,a.jsx)("pre",{className:"p-3 bg-[#101010] border border-purple-500/30 rounded-lg text-xs font-mono text-purple-200 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:w.args.CodeContent})]}),("tool_call"===i.type||"file_write"===i.type)&&j&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(iQ,{className:"w-3.5 h-3.5 text-blue-400"}),"Arguments (",i.activeTool,")"]}),w.targetFile&&(0,a.jsx)("span",{className:"text-[11px] font-mono text-purple-300 truncate max-w-[280px]",children:w.targetFile})]}),(0,a.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-mono text-slate-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(w.args,null,2)})]}),("tool_call"===i.type||"file_write"===i.type)&&k&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(ts.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Execution Output"]}),(0,a.jsx)(i_.f,{variant:"ghost",size:"xs",onClick:()=>g(w.output),leftIcon:p?(0,a.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,a.jsx)(tF.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,a.jsx)("pre",{className:"p-3 bg-[#101010] border border-[#2b2b2b] rounded-lg text-xs font-mono text-emerald-400/90 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:w.output})]}),"assistant_reply"===i.type&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(ts.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Assistant Response"]}),(0,a.jsx)(i_.f,{variant:"ghost",size:"xs",onClick:()=>g(i.content),leftIcon:p?(0,a.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,a.jsx)(tF.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,a.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:i.content})]}),"finish"===i.type&&(0,a.jsxs)("div",{className:"p-4 bg-emerald-950/20 border border-emerald-500/30 rounded-lg space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-emerald-400 font-bold text-sm",children:[(0,a.jsx)(iK.f,{className:"w-5 h-5"}),"Session Summary"]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[(0,a.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL DURATION"}),(0,a.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[h,"s"]})]}),(0,a.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL STEPS"}),(0,a.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[n," events"]})]}),(0,a.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL TOKENS"}),(0,a.jsx)("span",{className:"font-mono text-cyan-400 text-sm font-semibold",children:(i.cumulativeTokens||0).toLocaleString()})]}),(0,a.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"ESTIMATED COST"}),(0,a.jsxs)("span",{className:"font-mono text-amber-300 text-sm font-semibold",children:["$",(i.cumulativeCost||0).toFixed(4)]})]})]})]})]})})}var i1=e.i(56539);function i2({replay:e,onExit:t,onOpenConversation:s,className:r="",children:i}){let[l,n]=(0,o.useState)(!1),[d,h]=(0,o.useState)(!0),{sessionInfo:u={},currentKeyframe:x,currentStepIndex:f=0,totalSteps:p=0,isPlaying:m=!1,togglePlay:g,stepForward:b,stepBackward:y,seekToStep:v}=e||{};return(0,o.useEffect)(()=>{let e=e=>{let t=document.activeElement?.tagName?.toLowerCase();"input"!==t&&"textarea"!==t&&("Space"===e.code?(e.preventDefault(),g?.()):"ArrowLeft"===e.code?(e.preventDefault(),y?.()):"ArrowRight"===e.code?(e.preventDefault(),b?.()):"Home"===e.code?(e.preventDefault(),v?.(0)):"End"===e.code?(e.preventDefault(),v?.(Math.max(0,p-1))):"i"!==e.key&&"I"!==e.key||e.metaKey||e.ctrlKey||n(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g,y,b,v,p]),(0,a.jsxs)("div",{className:`relative flex flex-col h-full w-full overflow-hidden ${r}`,children:[(0,a.jsxs)("div",{className:"h-9 min-h-[36px] bg-[#1a1f2c]/90 border-b border-[#2d3748] px-3 flex items-center justify-between z-30 select-none backdrop-blur-md",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsxs)("span",{className:"flex h-2 w-2 relative",children:[(0,a.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"}),(0,a.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cyan-500"})]}),(0,a.jsx)(iH.f,{variant:"type",badgeSize:"xs",className:"font-mono uppercase font-bold tracking-wider",children:"Time-Machine Replay"}),(0,a.jsx)("span",{className:"text-slate-500 text-xs hidden sm:inline",children:"•"}),(0,a.jsx)("span",{className:"text-xs text-slate-300 font-mono truncate max-w-[200px]",title:u?.id,children:u?.id?`${u.id.slice(0,16)}...`:"Session"}),u?.model&&(0,a.jsxs)("span",{className:"text-[11px] text-slate-400 font-mono hidden md:inline",children:["(",u.model,")"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,a.jsx)(i_.f,{variant:"secondary",size:"xs",onClick:()=>s(u?.id||e?.sessionId),leftIcon:(0,a.jsx)(c.f,{className:"w-3 h-3 text-cyan-400"}),title:"View full conversation transcript for this session",children:"View Conversation"}),(0,a.jsx)(i_.f,{variant:"secondary",size:"xs",onClick:()=>n(!0),leftIcon:(0,a.jsx)(t$.f,{className:"w-3 h-3 text-cyan-400"}),title:"Inspect event details and parameters (Key: I)",children:"Step Details"}),(0,a.jsx)(i_.f,{variant:"ghost",size:"xs",onClick:t,leftIcon:(0,a.jsx)(tN.X,{className:"w-3.5 h-3.5"}),className:"text-slate-400 hover:text-white hover:bg-rose-950/40 hover:border-rose-500/40",title:"Exit Replay and return to live stream",children:"Exit Replay"})]})]}),(0,a.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[i,x&&(0,a.jsx)("div",{className:"absolute top-3 right-3 z-20 max-w-sm pointer-events-auto",children:(0,a.jsxs)("div",{className:"bg-[#18181b]/90 border border-[#3f3f46] rounded-xl shadow-2xl backdrop-blur-md overflow-hidden transition-all",children:[(0,a.jsxs)("div",{onClick:()=>h(!d),className:"px-3 py-2 bg-[#27272a]/70 flex items-center justify-between cursor-pointer hover:bg-[#27272a] transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(e=>{switch(e){case"user_input":return(0,a.jsx)(iY.f,{className:"w-3.5 h-3.5 text-amber-400"});case"thought":return(0,a.jsx)(iG.f,{className:"w-3.5 h-3.5 text-cyan-400"});case"file_write":return(0,a.jsx)(ij.f,{className:"w-3.5 h-3.5 text-purple-400"});case"tool_call":return(0,a.jsx)(iX.f,{className:"w-3.5 h-3.5 text-[#007acc]"});case"finish":return(0,a.jsx)(iK.f,{className:"w-3.5 h-3.5 text-emerald-400"});default:return(0,a.jsx)(ts.f,{className:"w-3.5 h-3.5 text-slate-400"})}})(x.type),(0,a.jsx)("span",{className:"text-xs font-semibold text-white truncate",children:x.title||"Agent Activity"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-slate-400",children:[(0,a.jsxs)("span",{className:"text-[10px] font-mono",children:[f+1,"/",p]}),d?(0,a.jsx)(i1.f,{className:"w-3 h-3"}):(0,a.jsx)(tc.f,{className:"w-3 h-3"})]})]}),d&&(0,a.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,a.jsx)("p",{className:"text-slate-300 leading-relaxed font-sans line-clamp-3",children:x.summary||x.content?.slice(0,150)||"Executing task..."}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-1 border-t border-[#27272a] text-[11px]",children:[x.activeTool?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 font-mono text-cyan-400 truncate",children:[(0,a.jsx)(iX.f,{className:"w-3 h-3 text-[#007acc] shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:x.activeTool})]}):(0,a.jsxs)("span",{className:"text-[10px] text-slate-500 font-mono",children:["Step ",f+1]}),s&&(0,a.jsxs)("button",{type:"button",onClick:()=>s(u?.id||e?.sessionId),className:"flex items-center gap-1 text-[11px] text-cyan-400 hover:text-cyan-300 hover:underline cursor-pointer ml-auto shrink-0",title:"View conversation transcript",children:[(0,a.jsx)(c.f,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"Conversation"})]})]})]})]})})]}),(0,a.jsx)(iq,{replay:e,onClose:t,className:"z-30 shrink-0"}),(0,a.jsx)(i0,{isOpen:l,onClose:()=>n(!1),replay:e,onOpenConversation:s})]})}let i5="agmon_workbench_layout",i3={isLeftSidebarVisible:!0,isBottomPanelVisible:!0,isRightSidebarVisible:!1,activeActivityView:"explorer",activeRightSidebarTab:"chat",activeBottomTab:"logs",activeEditorTab:"canvas",openedTabs:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]};function i4({traces:e=[],office:t={workstations:[],stats:{}},mode:s="live",mockPreset:r="cases",onModeChange:i,onPresetChange:l,connected:n=!0,live:u=!0,isRefreshing:x=!1,onRefresh:f,soundEnabled:p=!1,onToggleSound:m,notifEnabled:g=!1,onToggleNotif:b}){let[y,v]=(0,o.useState)(i3),[w,j]=(0,o.useState)(!1),[k,S]=(0,o.useState)(null),[N,C]=(0,o.useState)("canvas"),[T,M]=(0,o.useState)("agents"),[_,z]=(0,o.useState)(!1),[R,I]=(0,o.useState)(!1),[L,E]=(0,o.useState)(!1),[A,P]=(0,o.useState)("themes"),[$,O]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=(0,tB.F)();O(!!e.isSupporter),(0,iE.n)(e);let t=e=>{O(!!(e.detail||(0,tB.F)()).isSupporter)};window.addEventListener(tB.o,t);{let e=new URLSearchParams(window.location.search);("1"===e.get("store")||"true"===e.get("store")||"store"===e.get("modal")||"1"===e.get("coffee"))&&I(!0)}return()=>window.removeEventListener(tB.o,t)},[]);let[F,W]=(0,o.useState)(null),D=function(e=null){let[t,s]=(0,o.useState)(e),[r,i]=(0,o.useState)(!1),[l,n]=(0,o.useState)(null),[a,c]=(0,o.useState)({sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0}),[d,h]=(0,o.useState)(0),[u,x]=(0,o.useState)(!1),[f,p]=(0,o.useState)(2),m=(0,o.useRef)(null),g=(0,o.useRef)(null),b=(0,o.useCallback)(async e=>{if(e){i(!0),n(null),x(!1),h(0);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/transcript`);if(!t.ok)throw Error(`Failed to load session transcript: HTTP ${t.status}`);let r=await t.json(),i=function(e){if(!e||!Array.isArray(e.turns))return{sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0};let t=e.session||{},s=e.turns||[],r=t.model||null,i=t.cli||"antigravity",l=[],n=0,a=0,o=0,c=0,d=Date.now();t.startedAt?d=new Date(t.startedAt).getTime():s.length>0&&s[0].timestamp&&(d=new Date(s[0].timestamp).getTime()),s.forEach((e,t)=>{let s=e.timestamp?new Date(e.timestamp).getTime():d+5e3*t,i=Math.max(0,Math.round((s-d)/1e3));e.tokens&&(a+=e.tokens.input||0,o+=e.tokens.output||0,c+=e.tokens.cached||0);let h=a+o+c,u=i$({input:a,output:o,cached:c},r);if("user"===e.role)return void l.push({stepIndex:n++,turnIndex:t,timestamp:e.timestamp||new Date(s).toISOString(),elapsedSeconds:i,type:"user_input",milestoneType:"prompt",agentState:"thinking",title:"User Prompt",summary:e.content?e.content.slice(0,80)+(e.content.length>80?"...":""):"User message",content:e.content||"",cumulativeTokens:h,cumulativeCost:u,activeTool:null});e.thinking&&l.push({stepIndex:n++,turnIndex:t,timestamp:e.timestamp||new Date(s).toISOString(),elapsedSeconds:i,type:"thought",milestoneType:"thought",agentState:"thinking",title:"AI Chain of Thought",summary:e.thinking.slice(0,90)+(e.thinking.length>90?"...":""),content:e.thinking,cumulativeTokens:h,cumulativeCost:u,activeTool:null});let x=e.toolCalls||[];if(x.forEach((r,a)=>{let o=i+(a+1)*2,c="replace_file_content"===r.name||"write_to_file"===r.name||r.name?.includes("edit")||r.name?.includes("write"),d="run_command"===r.name||"bash"===r.name||"terminal"===r.name,x=r.name?.includes("search")||r.name?.includes("grep")||r.name?.includes("view"),f="tool";c?f="file_write":d?f="command":x&&(f="search"),l.push({stepIndex:n++,turnIndex:t,toolIndex:a,timestamp:e.timestamp||new Date(s+2e3*a).toISOString(),elapsedSeconds:o,type:c?"file_write":"tool_call",milestoneType:"error"===r.status?"error":"tool",agentState:c?"typing":"running_tool",title:`Tool Call: ${r.name||"tool"}`,summary:r.summary||r.action||r.name,details:{id:r.id,name:r.name,type:f,summary:r.summary,args:r.args||{},output:r.output||"",status:r.status||"completed",targetFile:r.args?.TargetFile||r.args?.AbsolutePath||null},cumulativeTokens:h,cumulativeCost:u,activeTool:r.name})}),e.content){let r=i+(x.length>0?(x.length+1)*2:1);l.push({stepIndex:n++,turnIndex:t,timestamp:e.timestamp||new Date(s+1e3*r).toISOString(),elapsedSeconds:r,type:"assistant_reply",milestoneType:"reply",agentState:"typing",title:"Assistant Reply",summary:e.content.slice(0,90)+(e.content.length>90?"...":""),content:e.content,cumulativeTokens:h,cumulativeCost:u,activeTool:null})}});let h=l[l.length-1],u=h?h.elapsedSeconds+2:5;l.push({stepIndex:n++,timestamp:new Date().toISOString(),elapsedSeconds:u,type:"finish",milestoneType:"finish",agentState:"done",title:"Session Completed",summary:`Completed ${s.length} turns • ${l.length} events`,content:"All tasks completed as instructed.",cumulativeTokens:a+o+c,cumulativeCost:i$({input:a,output:o,cached:c},r),activeTool:null});let x=a+o+c,f=i$({input:a,output:o,cached:c},r);return{sessionInfo:{id:t.id||"session",cli:i,model:r,cwd:t.cwd||"",startedAt:t.startedAt,turnsCount:s.length,totalSteps:l.length},keyframes:l,totalElapsedSeconds:u,totalTokens:x,totalCost:f}}(r);c(i),s(e),h(0)}catch(e){console.error("[useSessionReplay] Load error:",e),n(e.message||"Failed to load session data")}finally{i(!1)}}},[]);(0,o.useEffect)(()=>{e&&b(e)},[e,b]);let{keyframes:y,totalElapsedSeconds:v,sessionInfo:w,totalTokens:j,totalCost:k}=a,S=y.length,N=(0,o.useMemo)(()=>{if(0===y.length)return null;let e=Math.min(Math.max(0,d),y.length-1);return y[e]},[y,d]),C=N?N.elapsedSeconds:0,T=v>0?C/v:0,M=(0,o.useCallback)(e=>{h(t=>Math.min(Math.max(0,e),S-1))},[S]),_=(0,o.useCallback)(e=>{if(0===y.length)return;let t=Math.min(Math.max(0,e),1)*v,s=0,r=1/0;y.forEach((e,i)=>{let l=Math.abs(e.elapsedSeconds-t);l<r&&(r=l,s=i)}),M(s)},[y,v,M]),z=(0,o.useCallback)(()=>{M(d+1)},[d,M]),R=(0,o.useCallback)(()=>{M(d-1)},[d,M]),I=(0,o.useCallback)(()=>{d>=S-1&&h(0),x(!0),g.current=performance.now()},[d,S]),L=(0,o.useCallback)(()=>{x(!1),m.current&&cancelAnimationFrame(m.current)},[]),E=(0,o.useCallback)(()=>{u?L():I()},[u,I,L]),A=(0,o.useCallback)(()=>{L(),h(0)},[L]);return(0,o.useEffect)(()=>{if(!u||0===y.length)return;let e=0,t=1200/f,s=r=>{g.current||(g.current=r);let i=r-g.current;g.current=r,(e+=i)>=t&&(e=0,h(e=>e>=S-1?(x(!1),e):e+1)),m.current=requestAnimationFrame(s)};return g.current=performance.now(),m.current=requestAnimationFrame(s),()=>{m.current&&cancelAnimationFrame(m.current)}},[u,y.length,S,f]),{sessionId:t,loading:r,error:l,sessionInfo:w,keyframes:y,totalSteps:S,currentStepIndex:d,currentKeyframe:N,currentTime:C,totalElapsedSeconds:v,progress:T,isPlaying:u,playbackSpeed:f,totalTokens:j,totalCost:k,loadSession:b,play:I,pause:L,togglePlay:E,seekToStep:M,seekToProgress:_,stepForward:z,stepBackward:R,setPlaybackSpeed:p,reset:A}}(F),V=(0,o.useCallback)(t=>{let s=t||k||e[0]?.connectionId||e[0]?.traceId||"default-session";W(s),S(s),C("canvas")},[k,e]),B=(0,o.useCallback)(()=>{W(null)},[]),[H,U]=(0,o.useState)(()=>[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]);(0,o.useEffect)(()=>{(0,rc.p)();let e=function(){try{let e=localStorage.getItem(i5);if(e){let t=JSON.parse(e);return{...i3,...t}}}catch(e){console.warn("[layoutStore] Failed to load workbench layout:",e)}return{...i3}}();v(e),e.activeEditorTab&&C(e.activeEditorTab),e.openedTabs&&Array.isArray(e.openedTabs)&&e.openedTabs.length>0&&U(e.openedTabs),j(!0)},[]),(0,o.useEffect)(()=>{w&&function(e){try{localStorage.setItem(i5,JSON.stringify(e))}catch(e){console.warn("[layoutStore] Failed to save workbench layout:",e)}}(y)},[y,w]),(0,o.useEffect)(()=>{if("canvas"===N){let e=(0,tB.F)();window.dispatchEvent(new CustomEvent(tB.o,{detail:e}))}},[N]);let q=(0,o.useMemo)(()=>F&&D.currentKeyframe?function(e,t={}){if(!e)return null;let s=t.id||"replay-session",r=t.cli||"antigravity",i=t.model||"gemini-3.8-flash",l="app"===t.clientType,n="antigravity"===r?"Google":"Anthropic",a="mcp",o=(e.activeTool||e.details?.name||"").toLowerCase();o.includes("bash")||o.includes("command")||o.includes("terminal")||"run_command"===o?a="bash":o.includes("read")||o.includes("view")||"view_file"===o?a="read":o.includes("edit")||o.includes("write")||"replace_file_content"===o||"write_to_file"===o?a="edit":o.includes("search")||o.includes("grep")||o.includes("find")?a="search":o.includes("web")||o.includes("browse")||o.includes("url")?a="web":(o.includes("memory")||o.includes("remember")||o.includes("recall"))&&(a="memory");let c="streaming",d="streaming";"user_input"===e.type||"thought"===e.type?(c="pending",d="pending"):"finish"===e.type?(c="done",d="happy"):"error"===e.milestoneType&&(c="error",d="error");let h=e.activeTool?[{id:e.details?.id||"tool-0",tool:a,type:a,name:e.activeTool,status:e.details?.status||"completed"}]:[];return{connectionId:s,traceId:s,account:`${r.toUpperCase()}: ${s.slice(0,10)}`,model:i,provider:n,cli:r,clientType:l?"app":"cli",state:c,mode:d,isLooping:!1,tools:e.activeTool?[a]:[],toolCalls:h,activeTool:e.activeTool||null,tokens:{input:null,output:null,cached:null},totalTokens:e.cumulativeTokens??null,cost:e.cumulativeCost??null,elapsedMs:1e3*(e.elapsedSeconds||0),currentCommand:e.title||"",summary:e.summary||"",isReplay:!0,logs:[{id:`replay-log-${e.stepIndex}`,time:new Date(e.timestamp||Date.now()).toLocaleTimeString(),level:"error"===e.milestoneType?"error":"info",message:`[Replay #${e.stepIndex+1}] ${e.title}: ${e.summary}`}]}}(D.currentKeyframe,D.sessionInfo):null,[F,D.currentKeyframe,D.sessionInfo]),G=(0,o.useMemo)(()=>q?[q]:e,[q,e]),Y=(0,o.useMemo)(()=>q?ro(G):t,[q,G,t]),X=(0,o.useMemo)(()=>k?Y.workstations.find(e=>e.connectionId===k||e.traceId===k||e.traces?.[0]?.traceId===k)||G.find(e=>e.connectionId===k||e.traceId===k||e.traces?.[0]?.traceId===k)||{connectionId:k,traceId:k,account:k.length>20?`${k.slice(0,16)}...`:k,model:D?.sessionInfo?.model||"AI Agent",provider:D?.sessionInfo?.provider||"antigravity"}:null,[Y.workstations,G,k,D?.sessionInfo]),K=(0,o.useCallback)(e=>{e&&(S(e),v(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})))},[]),J=(0,o.useCallback)(e=>{S(e),e&&v(e=>({...e,isRightSidebarVisible:!0}))},[]),Z=(0,o.useCallback)(e=>{if(!e)return;let t=`agent-${e.connectionId}`;U(s=>s.find(e=>e.id===t)?s:[...s,{id:t,title:e.account||`Desk #${e.deskIndex+1}`,type:"agent",agentData:e,closable:!0}]),C(t)},[]),Q=(0,o.useCallback)(e=>{U(t=>{let s=t.filter(t=>t.id!==e);return s.length>0?s:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]}),C(t=>t===e?"canvas":t)},[]),ee=(0,o.useCallback)(()=>{U(e=>e.find(e=>"reports"===e.id)?e:[...e,{id:"reports",title:"Token Analytics",type:"reports",closable:!0}]),C("reports")},[]),et=(0,o.useCallback)(()=>{U(e=>e.find(e=>"network"===e.id)?e:[...e,{id:"network",title:"Multi-Agent Graph",type:"network",closable:!0}]),C("network")},[]),es=(0,o.useCallback)(()=>{U(e=>e.find(e=>"store"===e.id)?e:[...e,{id:"store",title:"Supporter Store",type:"store",closable:!0}]),C("store")},[]),er=(0,o.useCallback)(e=>{if(!e||!e.path)return;let t=`file-${e.path}`,s=e.name||e.path.split("/").pop();U(r=>r.find(e=>e.id===t)?r:[...r,{id:t,title:s,type:"file",filePath:e.path,closable:!0}]),C(t)},[]),ei=(0,o.useCallback)(()=>{v(e=>({...e,isLeftSidebarVisible:!0})),M("files")},[]);(0,o.useEffect)(()=>{let e=e=>{let t=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(t&&e.shiftKey&&("p"===e.key||"P"===e.key)){e.preventDefault(),z(e=>!e);return}if(t&&!e.shiftKey&&!e.altKey&&("b"===e.key||"B"===e.key)){e.preventDefault(),v(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible}));return}if(t&&("j"===e.key||"J"===e.key||"`"===e.key)){e.preventDefault(),v(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible}));return}if(t&&e.altKey&&("b"===e.key||"B"===e.key)){e.preventDefault(),v(e=>({...e,isRightSidebarVisible:!e.isRightSidebarVisible}));return}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let el=(0,o.useCallback)(()=>{window.dispatchEvent(new Event("resize"))},[]),en=(0,o.useMemo)(()=>H.find(e=>e.id===N)||H[0],[H,N]),ea=(0,o.useMemo)(()=>{if("telemetry"!==N)return"";let e=G.length>30?G.slice(-30):G;try{return JSON.stringify(e,null,2)}catch{return"[]"}},[N,G]);return(0,a.jsxs)("div",{className:"flex h-screen w-screen flex-col overflow-hidden bg-[#181818] text-[#cccccc] font-sans antialiased",children:[(0,a.jsx)(e7,{stats:t.stats,mode:s,mockPreset:r,onModeChange:i,onPresetChange:l,isRefreshing:x,onRefresh:f,soundEnabled:p,onToggleSound:m,notifEnabled:g,onToggleNotif:b,onOpenCommandPalette:()=>z(!0),onOpenReports:ee,onOpenStore:es,onOpenThemeSettings:()=>{P("themes"),E(!0)},isSupporter:$,layout:y,onToggleLeftSidebar:()=>v(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible})),onToggleBottomPanel:()=>v(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible})),onToggleRightSidebar:()=>v(e=>({...e,isRightSidebarVisible:!e.isRightSidebarVisible}))}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-hidden relative",children:[(0,a.jsx)(to,{activeView:y.activeActivityView,isLeftSidebarVisible:y.isLeftSidebarVisible,activeLeftSidebarTab:T,isRightSidebarVisible:y.isRightSidebarVisible,activeRightSidebarTab:y.activeRightSidebarTab||"chat",onOpenStore:es,onViewChange:e=>{"chat"===e?v(e=>{let t=e.isRightSidebarVisible&&"chat"===e.activeRightSidebarTab;return{...e,isRightSidebarVisible:!t,activeRightSidebarTab:"chat"}}):"files"===e?(v(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible||"files"!==T,activeActivityView:"files"})),M("files")):"explorer"===e?(v(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible||"agents"!==T,activeActivityView:"explorer"})),M("agents")):"office"===e?C("canvas"):"network"===e?et():"reports"===e?ee():"telemetry"===e?(U(e=>e.find(e=>"telemetry"===e.id)?e:[...e,{id:"telemetry",title:"Live Telemetry",type:"telemetry",closable:!0}]),C("telemetry")):"store"===e?es():v(t=>({...t,activeActivityView:e,isLeftSidebarVisible:t.activeActivityView!==e||!t.isLeftSidebarVisible}))},agentCount:t.stats?.busy||0,isBottomPanelVisible:y.isBottomPanelVisible,onToggleBottomPanel:()=>v(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible})),onOpenSettings:()=>{P("themes"),E(!0)}}),(0,a.jsxs)(ez,{orientation:"horizontal",className:"flex-1 h-full overflow-hidden",onLayoutChange:el,children:[y.isLeftSidebarVisible&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eR,{id:"left-sidebar-panel",defaultSize:"260px",minSize:"180px",maxSize:"450px",className:"overflow-hidden h-full",children:(0,a.jsx)(tS,{workstations:Y.workstations,selectedId:k,onSelectAgent:J,onOpenAgentTab:Z,stats:Y.stats,onRefresh:f,onStartReplay:V,onViewConversation:K,onOpenFile:er,onOpenStore:es,activeSidebarTab:T,onActiveSidebarTabChange:M})}),(0,a.jsx)(eA,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"})]}),(0,a.jsx)(eR,{id:"center-main-panel",minSize:"350px",className:"overflow-hidden flex flex-col h-full bg-[#1e1e1e]",children:(0,a.jsxs)(ez,{orientation:"vertical",className:"h-full w-full overflow-hidden",onLayoutChange:el,children:[(0,a.jsxs)(eR,{id:"editor-area-panel",minSize:"160px",className:"overflow-hidden flex flex-col h-full",children:[(0,a.jsx)(tT,{tabs:H,activeTabId:N,onSelectTab:C,onCloseTab:Q}),(0,a.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#070b12]",children:F?(0,a.jsx)(i2,{replay:D,onExit:B,onOpenConversation:K,children:(0,a.jsx)("div",{className:"absolute inset-0",children:"network"===N?(0,a.jsx)(rz,{traces:G,selectedTraceId:k,onSelectTrace:e=>{S(e.traceId||e.connectionId),v(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}}):(0,a.jsx)(rM,{traces:G,selectedId:k,onSelect:e=>J(e)})})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:`absolute inset-0 transition-opacity ${"canvas"===N?"opacity-100 z-10":"opacity-0 pointer-events-none z-0"}`,children:(0,a.jsx)(rM,{traces:G,selectedId:k,onSelect:e=>J(e)})}),"telemetry"===N&&(0,a.jsxs)("div",{className:"absolute inset-0 p-4 overflow-auto font-mono text-xs bg-[#181818] text-slate-300",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between pb-2 border-b border-[#333333]",children:[(0,a.jsx)("h3",{className:"font-bold text-sm text-cyan-400",children:"Realtime Telemetry Snapshots"}),(0,a.jsxs)("span",{className:"text-slate-500",children:[G.length," active sessions",G.length>30?" (latest 30)":""]})]}),(0,a.jsx)("pre",{className:"bg-[#121212] p-4 rounded border border-[#2b2b2b] text-[11px] text-emerald-400 leading-relaxed overflow-x-auto",children:ea})]}),en?.type==="agent"&&(0,a.jsx)("div",{className:"absolute inset-0 p-4 overflow-auto bg-[#1e1e1e] text-slate-200",children:(0,a.jsx)("div",{className:"max-w-3xl mx-auto space-y-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-[#252526] rounded-lg border border-[#333333]",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-base font-bold text-white",children:en.title}),(0,a.jsxs)("p",{className:"text-xs text-slate-400",children:["Connection ID: ",en.agentData?.connectionId]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>V(en.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[#007acc] hover:bg-[#0062a3] text-white rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5 shadow-sm",title:"Replay Session (Default)",children:[(0,a.jsx)(h.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{children:"Replay Session"})]}),(0,a.jsxs)("button",{onClick:()=>K(en.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[#252526] hover:bg-[#333333] border border-[#3e3e42] text-slate-200 hover:text-white rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Pin live chat transcript to Right Sidebar",children:[(0,a.jsx)(c.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,a.jsx)("span",{children:"Pin to Sidebar"})]}),(0,a.jsxs)("button",{onClick:()=>{(0,eP.f)(en.agentData?.connectionId)},className:"px-3.5 py-1.5 bg-[#252526] hover:bg-[#333333] border border-[#3e3e42] text-cyan-400 hover:text-white rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Open in Detached Window (VS Code style)",children:[(0,a.jsx)(d.f,{className:"w-3.5 h-3.5"}),(0,a.jsx)("span",{children:"New Window"})]})]})]})})}),"reports"===N&&(0,a.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,a.jsx)(rR.f,{onClose:()=>Q("reports"),onStartReplay:V,onViewConversation:K})}),"network"===N&&(0,a.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-slate-950 z-20",children:(0,a.jsx)(rz,{traces:G,selectedTraceId:k,onSelectTrace:e=>{S(e.traceId||e.connectionId),v(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}})}),en?.type==="file"&&(0,a.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#1e1e1e] z-20",children:(0,a.jsx)(iC,{filePath:en.filePath,onClose:()=>Q(N)})}),("store"===N||en?.type==="store")&&(0,a.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,a.jsx)(iT.f,{hideHeader:!1,onClose:()=>Q("store")})})]})})]}),y.isBottomPanelVisible&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eA,{className:"h-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-row-resize z-20 shrink-0"}),(0,a.jsx)(eR,{id:"bottom-panel",defaultSize:"220px",minSize:"90px",maxSize:"600px",className:"overflow-hidden bg-[#181818]",children:(0,a.jsx)(tP,{traces:G,activeTab:y.activeBottomTab,onTabChange:e=>v(t=>({...t,activeBottomTab:e})),onClose:()=>v(e=>({...e,isBottomPanelVisible:!1}))})})]})]})}),y.isRightSidebarVisible&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eA,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"}),(0,a.jsx)(eR,{id:"right-sidebar-panel",defaultSize:"360px",minSize:"260px",maxSize:"750px",className:"overflow-hidden h-full bg-[#252526]",children:(0,a.jsx)(tH,{selectedAgent:X,workstations:Y.workstations,activeTab:y.activeRightSidebarTab||"chat",onTabChange:e=>v(t=>({...t,activeRightSidebarTab:e})),onSelectAgent:J,onClose:()=>v(e=>({...e,isRightSidebarVisible:!1})),onStartReplay:V})})]})]})]}),(0,a.jsx)(tG,{mode:s,connected:n,live:u,stats:Y.stats,selectedAgent:X,soundEnabled:p,isBottomOpen:y.isBottomPanelVisible,onToggleBottom:()=>v(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible}))}),(0,a.jsx)(tJ,{isOpen:_,onClose:()=>z(!1),onToggleLeftSidebar:()=>v(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible})),onToggleBottomPanel:()=>v(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible})),onToggleRightSidebar:()=>v(e=>({...e,isRightSidebarVisible:!e.isRightSidebarVisible})),onOpenChatSidebar:()=>v(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})),onOpenFilesExplorer:ei,onOpenThemeSettings:()=>{P("themes"),E(!0)},onOpenFontSettings:()=>{P("fonts"),E(!0)},onToggleSound:m,onToggleNotif:b,onRefresh:f,onSetMode:i,onSelectPreset:l,onOpenReports:ee,onOpenStore:es,onStartReplay:V}),(0,a.jsx)(iI,{isOpen:R,onClose:()=>I(!1)}),(0,a.jsx)(iL,{isOpen:L,onClose:()=>E(!1),initialTab:A})]})}var i8=e.i(18913);function i6(){let[e,t]=(0,o.useState)(!1),[s,r]=(0,o.useState)(null);return((0,o.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(e=>{e.addEventListener("updatefound",()=>{let s=e.installing;s&&s.addEventListener("statechange",()=>{"installed"===s.state&&navigator.serviceWorker.controller&&t(!0)})})});let e=null,s=async()=>{try{let s=await fetch("/api/version");if(s.ok){let i=await s.json();e?i.version&&i.version!==e&&(r(i.version),t(!0)):e=i.version}}catch{}};s();let i=setInterval(s,6e4);return()=>clearInterval(i)},[]),e)?(0,a.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 rounded-full border border-emerald-500/40 bg-slate-900/95 px-4 py-2 shadow-2xl backdrop-blur-md animate-in slide-in-from-bottom-4 duration-300",children:[(0,a.jsx)("span",{className:"flex h-2 w-2 rounded-full bg-emerald-400 animate-ping"}),(0,a.jsxs)("span",{className:"text-xs text-slate-200 flex items-center gap-1.5",children:[(0,a.jsx)(eQ.f,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,a.jsxs)("span",{children:["New version available ",s?`(${s})`:""]})]}),(0,a.jsx)("button",{onClick:()=>{window.location.reload()},className:"rounded-full bg-emerald-500 hover:bg-emerald-400 px-3 py-1 text-xs font-semibold text-slate-950 transition-colors shadow-sm",children:"Update now"}),(0,a.jsx)("button",{onClick:()=>t(!1),className:"text-slate-400 hover:text-slate-200 p-1 ml-1 rounded hover:bg-slate-800 transition-colors","aria-label":"Dismiss",children:(0,a.jsx)(tN.X,{className:"w-3.5 h-3.5"})})]}):null}var i7=e.i(55332),i9=e.i(58858);e.s(["default",0,function(){let[e,t]=(0,o.useState)("live"),[s,r]=(0,o.useState)("cases"),[i,l]=(0,o.useState)(!1),[n,c]=(0,o.useState)(!1);(0,o.useEffect)(()=>{l(!(0,i7.p)()),c((0,i9.p)());{let e=new URLSearchParams(window.location.search);"mock"===(e.get("source")||e.get("mode"))&&t("mock");let s=e.get("preset");s&&r(s)}},[]);let{traces:d,connected:h,live:u,isRefreshing:x,refresh:f}=(0,i8.f)({mode:e,preset:s}),p=(0,o.useMemo)(()=>ro(d),[d]);return(0,a.jsxs)("main",{className:"h-screen w-screen overflow-hidden bg-[#181818]",children:[(0,a.jsx)(i6,{}),(0,a.jsx)(i4,{traces:d,office:p,mode:e,mockPreset:s,onModeChange:e=>t(e),onPresetChange:e=>r(e),connected:h,live:u,isRefreshing:x,onRefresh:f,soundEnabled:i,onToggleSound:()=>{l((0,i7.Z)())},notifEnabled:n,onToggleNotif:()=>{c((0,i9.i)())}})]})}],74647)}]);
|