tower-studio 0.2.37 → 0.2.39
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/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +44 -32
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +81 -69
- package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +44 -32
- package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +44 -32
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +61 -49
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +115 -103
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +98 -86
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +81 -69
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +86 -74
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +44 -32
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +84 -72
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +3 -3
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +95 -83
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +62 -50
- package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +5 -5
- package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00llstz._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01n7exm._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01yu.gw._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qif839._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qijr4h._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~foo~5._.js +2 -2
- package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_0i2.v2d._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_12xey8u._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{0ws9_lucide-react_dist_esm_icons_0odx0ph._.js → 0ws9_lucide-react_dist_esm_icons_10_90yo._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-tolks._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__05b5dyi._.js → [root-of-the-server]__0.~z1-.._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05sv58d._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05xg05r._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__062b.yt._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__093tt4a._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e-k-gl._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0guqcva._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gzafdq._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0csj88a._.js → [root-of-the-server]__0i0o7w5._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0oy9qt7._.js → [root-of-the-server]__0k1ivnj._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0vjz4a4._.js → [root-of-the-server]__0kgd-1s._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p0te97._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0siyg1p._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0t6f4lq._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0th-t1a._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0kdfgja._.js → [root-of-the-server]__0xte.35._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0r1f9zc._.js → _0-qd2ss._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0-~9em3._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0pp8emp._.js → _00kwrmr._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_00t6138._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_05jv_cy._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{_0ub.iem._.js → _06nlsbw._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_07c-9da._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0_z-t6g._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0cxhub8._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0v0y2s~._.js → _0gb8a9_._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0gxccup._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0hh17jg._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0lqxllh._.js → _0m.34j8._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0mpce0d._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0muaopo._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0n1l7yo._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0ng0eku._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0r_ch71._.js → _0t0oltj._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{_0.-xze1._.js → _0v66l8c._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0w9~m7o._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0wbcp88._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hhlpw6._.js → node_modules__pnpm_06f0dao._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_notes_notes-page-client_tsx_10gyo3v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_components_ui_select_tsx_0d2ra01._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_lib_0sms4xl._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +356 -272
- package/.next/standalone/.next/static/chunks/0.euy5rie4v3d.js +1 -0
- package/.next/standalone/.next/static/chunks/0.lqb7y9kz5z6.js +1 -0
- package/.next/standalone/.next/static/chunks/01.nidb8sf6bh.js +1 -0
- package/.next/standalone/.next/static/chunks/{00_-_qcmfqtqx.js → 01ijm9dpmm34q.js} +1 -1
- package/.next/standalone/.next/static/chunks/023v9juzhzc~d.js +1 -0
- package/.next/standalone/.next/static/chunks/02jsekc779t5~.js +1 -0
- package/.next/standalone/.next/static/chunks/0651zmy-w~saj.js +1 -0
- package/.next/standalone/.next/static/chunks/0_-2es-r~03mg.js +1 -0
- package/.next/standalone/.next/static/chunks/{0m227i3p__4qz.js → 0a._hcvzq4ko7.js} +2 -2
- package/.next/standalone/.next/static/chunks/{0o0ngxu962xwu.js → 0dha37i1oc6z~.js} +1 -1
- package/.next/standalone/.next/static/chunks/0e9ykduz3_0e1.js +1 -0
- package/.next/standalone/.next/static/chunks/0fy6w5d_zyro0.js +1 -0
- package/.next/standalone/.next/static/chunks/0g-gbdkcssn.g.js +1 -0
- package/.next/standalone/.next/static/chunks/{08ewy5rmh_n_s.js → 0h4k3cicu7g-w.js} +1 -1
- package/.next/standalone/.next/static/chunks/{03tc~x4m3si-p.js → 0h73q-9fyea0t.js} +1 -1
- package/.next/standalone/.next/static/chunks/0h7~fn.p-fxz_.js +1 -0
- package/.next/standalone/.next/static/chunks/0j2n.h0~von8h.js +1 -0
- package/.next/standalone/.next/static/chunks/0k.hp06ufx4yp.js +1 -0
- package/.next/standalone/.next/static/chunks/0lk-i0jm2ubea.css +1 -0
- package/.next/standalone/.next/static/chunks/0p5rare_o5zb1.js +5 -0
- package/.next/standalone/.next/static/chunks/{08cuzj12jsob5.js → 0q~4dhw.phxg3.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0oaelsx9hpsxi.js → 0t_3wwd~mmc.1.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0950xt.ix3j1q.js → 0u.3xek3m2ud..js} +1 -1
- package/.next/standalone/.next/static/chunks/0u.b0t7fueh-x.js +1 -0
- package/.next/standalone/.next/static/chunks/{10mwqzqdpi9d5.js → 0v.l5.sqos562.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0o3eu9q3qnvi..js → 0w14di5d0vw6-.js} +1 -1
- package/.next/standalone/.next/static/chunks/0z2blg_osfipv.js +1 -0
- package/.next/standalone/.next/static/chunks/{0c.6n7.lv8~10.js → 11.r6a56ss7qu.js} +1 -1
- package/.next/standalone/.next/static/chunks/112wpv9rqw4dp.js +1 -0
- package/.next/standalone/.next/static/chunks/{09a43rligfn_v.js → 134c60acdsr_g.js} +1 -1
- package/.next/standalone/.next/static/chunks/13rq33eiffqaz.js +1 -0
- package/.next/standalone/package.json +3 -2
- package/dist/mcp-server.cjs +6 -3
- package/package.json +3 -2
- package/scripts/migrations/0003-backfill-systemconfig-from-legacy-db.ts +113 -0
- package/scripts/run-migrations.ts +12 -0
- package/skills/tower/SKILL.md +81 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rzkdlf._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_00z0339._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0_r-f5a._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0gzdrnf._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0nk7qd4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0z7hp2l._.js +0 -3
- package/.next/standalone/.next/static/chunks/00.kucs-nzw72.js +0 -1
- package/.next/standalone/.next/static/chunks/014cs5ykpuy3m.js +0 -1
- package/.next/standalone/.next/static/chunks/01f6i88h8guls.js +0 -1
- package/.next/standalone/.next/static/chunks/034x~85_u-f26.js +0 -1
- package/.next/standalone/.next/static/chunks/03v.cnuy3h3rb.js +0 -1
- package/.next/standalone/.next/static/chunks/05dlhgy_00kj1.js +0 -1
- package/.next/standalone/.next/static/chunks/05p_suay02eo1.js +0 -1
- package/.next/standalone/.next/static/chunks/0ckcff42.pa_j.js +0 -1
- package/.next/standalone/.next/static/chunks/0dt3ljzz2pz0r.css +0 -1
- package/.next/standalone/.next/static/chunks/0kuz7yd.6hpd1.js +0 -1
- package/.next/standalone/.next/static/chunks/0mk6~akqfc05t.js +0 -1
- package/.next/standalone/.next/static/chunks/0p.-6dhm_nm9f.js +0 -1
- package/.next/standalone/.next/static/chunks/0qc.bnyy68-yh.js +0 -1
- package/.next/standalone/.next/static/chunks/0qfx4.vrc9a9n.js +0 -5
- package/.next/standalone/.next/static/chunks/0qonpqhvpg-tt.js +0 -1
- package/.next/standalone/.next/static/chunks/0s46.9vyvnj99.js +0 -1
- package/.next/standalone/.next/static/chunks/0u~0j4_f3gwi2.js +0 -1
- package/.next/standalone/.next/static/chunks/0~uo_7-sxehxf.js +0 -1
- package/.next/standalone/.next/static/chunks/15~2jg4z8h54~.js +0 -1
- /package/.next/standalone/.next/static/{FO1_JUKAw5Zm07Nlq0G6X → JutVIyokVf-YrN6j2WEwG}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{FO1_JUKAw5Zm07Nlq0G6X → JutVIyokVf-YrN6j2WEwG}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{FO1_JUKAw5Zm07Nlq0G6X → JutVIyokVf-YrN6j2WEwG}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[521007,a=>{"use strict";a.s(["BOARD_COLUMNS",0,[{id:"TODO",label:"To Do",color:"bg-slate-400"},{id:"IN_PROGRESS",label:"In Progress",color:"bg-amber-400"},{id:"IN_REVIEW",label:"In Review",color:"bg-sky-400"},{id:"DONE",label:"Done",color:"bg-emerald-400"},{id:"CANCELLED",label:"Cancelled",color:"bg-rose-400"}],"NOTE_CATEGORIES_PRESET",0,["账号","环境","需求","备忘","任务笔记","经验洞见"],"PRIORITY_CONFIG",0,{LOW:{label:"低",color:"bg-slate-500/20 text-slate-300 border border-slate-500/30"},MEDIUM:{label:"中",color:"bg-amber-500/20 text-amber-300 border border-amber-500/30"},HIGH:{label:"高",color:"bg-orange-500/20 text-orange-300 border border-orange-500/30"},CRITICAL:{label:"紧急",color:"bg-rose-500/20 text-rose-300 border border-rose-500/30"}},"TOWER_LABEL_NAME",0,"Tower"])},113047,541296,515374,a=>{"use strict";let b=(0,a.i(711796).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);a.s(["ChevronsUpDown",0,b],113047);var c=a.i(780410);let d=(0,c.createServerReference)("40dffcd1988fd8b1ac7b1da9ef721a2c75041021d0",c.callServer,void 0,c.findSourceMapURL,"getProjectBranches");a.s(["getProjectBranches",0,d],541296);let e=(0,c.createServerReference)("400b4e64d53a79ea69cb891f33bf0b5825053f5a2f",c.callServer,void 0,c.findSourceMapURL,"fetchRemoteBranches");a.s(["fetchRemoteBranches",0,e],515374)},162108,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("40c3605bec65c1496fa0fd5123f1e94bdfde2a828e",b.callServer,void 0,b.findSourceMapURL,"createTask");a.s(["createTask",0,c])},817784,238003,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("40dadcf5731aaed6d0df7327cccb194d62be9eca76",b.callServer,void 0,b.findSourceMapURL,"getTaskNotes");a.s(["getTaskNotes",0,c],817784);let d=(0,b.createServerReference)("40845f88c397d5023344b95513dff908b52205464f",b.callServer,void 0,b.findSourceMapURL,"getTaskAssets");a.s(["getTaskAssets",0,d],238003)},445798,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(814574),e=a.i(699570),f=a.i(866718),g=a.i(429246),h=a.i(412783),i=a.i(577565),j=a.i(668116),k=a.i(113047),l=a.i(580701),m=a.i(599209),n=a.i(419622),o=a.i(951192),p=a.i(541296),q=a.i(515374),r=a.i(780410);let s=(0,r.createServerReference)("406e86c83e91c1186830344ed891d8a1ce2757f822",r.callServer,void 0,r.findSourceMapURL,"getCurrentBranch");var t=a.i(435393);a.s(["CreateTaskDialog",0,function({open:a,onOpenChange:r,onSubmit:u,onUpdate:v,defaultStatus:w="TODO",editTask:x,editTaskLabelIds:y,prefillFromTask:z,labels:A,projectType:B,projectLocalPath:C,versions:D,defaultVersionId:E}){let F,[G,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(""),[K,L]=(0,c.useState)("MEDIUM"),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)([]),[Q,R]=(0,c.useState)([]),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(""),[W,X]=(0,c.useState)(!1),[Y,Z]=(0,c.useState)(!0),[$,_]=(0,c.useState)(!1),[aa,ab]=(0,c.useState)(null),{t:ac}=(0,o.useI18n)();(0,c.useEffect)(()=>{if(!a||x)return;let b=!1;return(0,t.getConfigValues)(["task.defaultUseWorktree","task.defaultAutoStart"]).then(a=>{if(b)return;let c=a["task.defaultUseWorktree"],d=a["task.defaultAutoStart"];"boolean"==typeof c&&Z(c),"boolean"==typeof d&&_(d)}).catch(()=>{}),()=>{b=!0}},[a,x]);let ad=!!x,ae=!!C;return(0,c.useEffect)(()=>{x?(H(x.title),J(x.description??""),L(x.priority),N(x.subPath??""),P(y??[]),ab(x.versionId??null)):(z?(H(z.title??""),J(z.description??""),L(z.priority??"MEDIUM"),N(z.subPath??""),P(z.labelIds??[])):(H(""),J(""),L("MEDIUM"),N(""),P([])),ab(E??null))},[x,y,z,E]),(0,c.useEffect)(()=>{a||x||(H(""),J(""),L("MEDIUM"),N(""),P([]),R([]),V(""),X(!1),ab(E??null))},[a,x,E]),(0,c.useEffect)(()=>{a&&ae&&!x&&(T(!0),Promise.all([(0,p.getProjectBranches)(C),s(C)]).then(([a,b])=>{R(a);let c=z?.baseBranch??null;c&&a.includes(c)?V(c):V(b&&a.includes(b)?b:a[0]??""),T(!1),(0,q.fetchRemoteBranches)(C).then(()=>{setTimeout(()=>{(0,p.getProjectBranches)(C).then(a=>{R(a),V(b=>a.includes(b)?b:a[0]??"")}).catch(()=>{})},3e3)})}).catch(()=>{R([]),V(""),T(!1)}))},[a,ae,C,x,z]),(0,b.jsx)(d.Dialog,{open:a,onOpenChange:r,disablePointerDismissal:!0,children:(0,b.jsxs)(d.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(d.DialogHeader,{children:(0,b.jsx)(d.DialogTitle,{children:ad?ac("task.edit"):ac("task.create")})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"title",children:ac("task.title")}),(0,b.jsx)(f.Input,{id:"title","data-testid":"task-title",placeholder:ac("task.titlePlaceholder"),value:G,onChange:a=>H(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault()})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"description",children:ac("task.description")}),(0,b.jsx)(g.Textarea,{id:"description",placeholder:ac("task.descPlaceholder"),rows:4,value:I,onChange:a=>J(a.target.value),className:"max-h-[200px] overflow-y-auto"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"subPath",children:ac("task.subPath")}),(0,b.jsx)(f.Input,{id:"subPath",placeholder:ac("task.subPathPlaceholder"),value:M,onChange:a=>N(a.target.value)}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:ac("task.subPathHint")})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{children:ac("task.priority")}),(0,b.jsx)("div",{className:"flex gap-1.5",children:["LOW","MEDIUM","HIGH","CRITICAL"].map(a=>{let c={LOW:{label:ac("task.priorityLow"),style:"text-slate-300 border-slate-500/30 bg-slate-500/10"},MEDIUM:{label:ac("task.priorityMedium"),style:"text-amber-300 border-amber-500/30 bg-amber-500/10"},HIGH:{label:ac("task.priorityHigh"),style:"text-orange-300 border-orange-500/30 bg-orange-500/10"},CRITICAL:{label:ac("task.priorityCritical"),style:"text-rose-300 border-rose-500/30 bg-rose-500/10"}}[a];return(0,b.jsx)("button",{type:"button",onClick:()=>L(a),className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${K===a?`${c.style} ring-1 ring-current/20`:"border-border text-muted-foreground hover:bg-accent"}`,children:c.label},a)})})]}),ae&&!ad&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{children:ac("task.baseBranch")}),S?(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:ac("task.branchLoading")}):Q.length>0?(0,b.jsxs)(m.Popover,{open:W,onOpenChange:X,children:[(0,b.jsxs)(m.PopoverTrigger,{className:"flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm font-mono transition-colors hover:bg-accent focus:outline-none focus:ring-1 focus:ring-ring","data-testid":"branch-selector",children:[(0,b.jsx)(i.GitBranch,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"flex-1 truncate text-left text-xs",title:U||void 0,children:U||ac("task.branchNone")}),(0,b.jsx)(k.ChevronsUpDown,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,b.jsx)(m.PopoverContent,{className:"w-[min(32rem,90vw)] p-0",align:"start",children:(0,b.jsxs)(n.Command,{children:[(0,b.jsx)(n.CommandInput,{placeholder:ac("task.branchSearch")}),(0,b.jsxs)(n.CommandList,{children:[(0,b.jsx)(n.CommandEmpty,{children:ac("task.branchNone")}),(0,b.jsx)(n.CommandGroup,{children:Q.map(a=>(0,b.jsxs)(n.CommandItem,{value:a,onSelect:()=>{V(a),X(!1)},children:[(0,b.jsx)(i.GitBranch,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-2"}),(0,b.jsx)("span",{className:"flex-1 truncate font-mono",title:a,children:a}),a===U&&(0,b.jsx)(j.Check,{className:"h-3 w-3 text-primary shrink-0 ml-auto"})]},a))})]})]})})]}):(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:ac("task.branchNone")}),(0,b.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,b.jsx)(h.Label,{className:"text-xs text-muted-foreground",children:ac("task.worktreeLabel")}),(0,b.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>Z(a),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${Y===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a?ac("task.worktreeYes"):ac("task.worktreeNo")},String(a)))})]}),(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,b.jsx)(h.Label,{className:"text-xs text-muted-foreground",children:ac("task.autoStartLabel")}),(0,b.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>_(a),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${$===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a?ac("task.autoStartYes"):ac("task.autoStartNo")},String(a)))})]})]}),A.length>0&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{children:ac("task.labels")}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:A.map(a=>{let c=O.includes(a.id);return(0,b.jsx)("button",{type:"button",onClick:()=>{P(b=>c?b.filter(b=>b!==a.id):[...b,a.id])},className:`rounded-full px-2.5 py-1 text-xs font-medium transition-all ${c?"ring-1 ring-current/30":"opacity-50 hover:opacity-80"}`,style:{backgroundColor:a.color+"20",color:a.color,borderColor:c?a.color+"40":"transparent",borderWidth:"1px"},children:a.name},a.id)})})]}),(!ad||D&&D.length>0)&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{children:ac("version.picker.label")}),D&&D.length>0?(0,b.jsxs)(l.Select,{value:aa??"__none__",onValueChange:a=>ab("__none__"===a?null:a),children:[(0,b.jsx)(l.SelectTrigger,{children:(0,b.jsx)("span",{className:"truncate text-sm",children:aa&&(F=D.find(a=>a.id===aa))?F.isCurrent?`${F.number} \xb7 ${F.name} \xb7 ${ac("version.currentShort")}`:`${F.number} \xb7 ${F.name}`:ac("version.picker.none")})}),(0,b.jsxs)(l.SelectContent,{children:[(0,b.jsx)(l.SelectItem,{value:"__none__",children:ac("version.picker.none")}),D.map(a=>(0,b.jsx)(l.SelectItem,{value:a.id,children:a.isCurrent?`${a.number} \xb7 ${a.name} \xb7 ${ac("version.currentShort")}`:`${a.number} \xb7 ${a.name}`},a.id))]})]}):(0,b.jsx)("p",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:ac("version.picker.empty")})]})]}),(0,b.jsxs)(d.DialogFooter,{children:[(0,b.jsx)(e.Button,{variant:"outline",onClick:()=>r(!1),children:ac("common.cancel")}),(0,b.jsx)(e.Button,{onClick:()=>{G.trim()&&(ad&&v?v(x.id,{title:G,description:I,priority:K,labelIds:O,subPath:M.trim()||"",versionId:aa}):u({title:G,description:I,priority:K,status:w,labelIds:O,...ae&&Y&&U?{baseBranch:U}:{},...M.trim()?{subPath:M.trim()}:{},versionId:aa,autoStart:$}),H(""),J(""),L("MEDIUM"),N(""),P([]),R([]),V(""),Z(!0),ab(null),r(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:ad?ac("common.save"):ac("common.create")})]})]})})}],445798)},757942,950314,a=>{"use strict";var b=a.i(90393);a.s([],757942),a.s(["Streamdown",()=>b.C],950314)},510650,a=>{"use strict";var b=a.i(728778);a.i(757942);var c=a.i(950314),d=a.i(814574),e=a.i(951192);a.s(["NotePreviewDialog",0,function({note:a,open:f,onOpenChange:g}){let{t:h}=(0,e.useI18n)();return(0,b.jsx)(d.Dialog,{open:f,onOpenChange:g,children:(0,b.jsxs)(d.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:a?.title}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:a&&a.content.trim()?(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(c.Streamdown,{children:a.content})}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.noteEmpty")})})]})})}])},532615,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(986099),e=a.i(54384),f=a.i(912868),g=a.i(10390),h=a.i(91756);let i=(0,a.i(711796).default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var j=a.i(747798),k=a.i(951192);function l({children:a,onClick:c,title:d,disabled:e,...f}){return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||c()},title:d,disabled:e,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/80 hover:bg-white/15 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-white/80 transition-colors",...f,children:a})}a.s(["ImageLightbox",0,function({imageUrl:a,filename:m,open:n,onOpenChange:o,assets:p,currentIndex:q,onIndexChange:r}){let{t:s}=(0,k.useI18n)(),[t,u]=(0,c.useState)(1),[v,w]=(0,c.useState)({x:0,y:0}),[x,y]=(0,c.useState)(!1),z=(0,c.useRef)(null),[A,B]=(0,c.useState)(!1),C=!!p&&p.length>1&&"number"==typeof q&&!!r,D=C&&q>0,E=C&&q<p.length-1,F=C?p.length:0,G=F>0?Math.ceil(F/10):0,H=C?Math.floor(q/10):0,I=10*H,J=Math.min(I+10,F),K=G>1,L=C&&H>0,M=C&&H<G-1;(0,c.useEffect)(()=>{B(!0)},[]),(0,c.useEffect)(()=>{u(1),w({x:0,y:0})},[a]),(0,c.useEffect)(()=>{if(!n)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[n]);let N=(0,c.useCallback)(()=>o(!1),[o]),O=(0,c.useCallback)(()=>{C&&D&&r(q-1)},[C,D,r,q]),P=(0,c.useCallback)(()=>{C&&E&&r(q+1)},[C,E,r,q]),Q=(0,c.useCallback)(()=>{C&&L&&r((H-1)*10)},[C,L,r,H]),R=(0,c.useCallback)(()=>{C&&M&&r(Math.min((H+1)*10,F-1))},[C,M,r,H,F]),S=(0,c.useCallback)(()=>{u(a=>Math.min(8,1.25*a))},[]),T=(0,c.useCallback)(()=>{u(a=>{let b=Math.max(.1,a/1.25);return b<=1&&w({x:0,y:0}),b})},[]),U=(0,c.useCallback)(()=>{u(1),w({x:0,y:0})},[]);(0,c.useEffect)(()=>{if(!n)return;let a=a=>{switch(a.key){case"Escape":a.preventDefault(),N();break;case"ArrowLeft":C&&(a.preventDefault(),O());break;case"ArrowRight":C&&(a.preventDefault(),P());break;case"+":case"=":a.preventDefault(),S();break;case"-":case"_":a.preventDefault(),T();break;case"0":a.preventDefault(),U()}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n,C,N,O,P,S,T,U]);let V=(0,c.useRef)(!1),W=()=>{x&&y(!1),z.current=null},X=x?"cursor-grabbing":"cursor-grab";if(!n||!A)return null;let Y=(0,b.jsxs)("div",{className:"fixed inset-0 z-[100] bg-black/70 dark:bg-black/40 backdrop-blur-md",role:"dialog","aria-modal":"true","aria-label":s("assets.lightbox.zoomFit"),children:[(0,b.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 max-w-[80vw] truncate rounded-md bg-black/40 px-3 py-1 text-xs text-white/80 backdrop-blur-sm pointer-events-none",children:[m,C?` \xb7 ${q+1} / ${p.length}`:""]}),(0,b.jsx)("div",{className:`absolute inset-0 flex items-center justify-center overflow-hidden select-none ${X}`,onClick:a=>{a.target===a.currentTarget&&N()},onWheel:a=>{a.preventDefault();let b=-a.deltaY>0?1.25:.8;u(a=>{let c=Math.min(8,Math.max(.1,a*b));return c<=1&&w({x:0,y:0}),c})},children:a&&(0,b.jsx)("img",{src:a,alt:m,onClick:a=>{a.stopPropagation(),V.current&&(V.current=!1)},onPointerDown:a=>{0===a.button&&(a.stopPropagation(),V.current=!1,a.target.setPointerCapture?.(a.pointerId),z.current={x:a.clientX,y:a.clientY,panX:v.x,panY:v.y},y(!0))},onPointerMove:a=>{if(!z.current)return;let b=a.clientX-z.current.x,c=a.clientY-z.current.y;Math.abs(b)+Math.abs(c)>5&&(V.current=!0),x&&w({x:z.current.panX+b,y:z.current.panY+c})},onPointerUp:W,onPointerLeave:W,onPointerCancel:W,className:"max-h-[88vh] max-w-[92vw] object-contain pointer-events-auto",style:{transform:`translate3d(${v.x}px, ${v.y}px, 0) scale(${t})`,transformOrigin:"center center",transition:x?"none":"transform 120ms ease-out",willChange:x?"transform":"auto"},draggable:!1})}),(0,b.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[92vw]",onClick:a=>a.stopPropagation(),children:[C&&(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-1.5 py-1.5 backdrop-blur-md ring-1 ring-white/10 max-w-[92vw]",children:[K&&(0,b.jsx)(l,{onClick:Q,title:`${s("assets.lightbox.prev")} (-10)`,"aria-label":`${s("assets.lightbox.prev")} (-10)`,disabled:!L,children:(0,b.jsx)(h.ChevronsLeft,{className:"h-4 w-4"})}),(0,b.jsx)(l,{onClick:O,title:s("assets.lightbox.prev"),"aria-label":s("assets.lightbox.prev"),disabled:!D,children:(0,b.jsx)(f.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:p.slice(I,J).map((a,c)=>{let d=I+c,e=d===q;return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||r(d)},title:a.filename,className:`shrink-0 h-12 w-12 overflow-hidden rounded-md transition-all ${e?"ring-2 ring-white opacity-100 scale-105":"opacity-60 hover:opacity-100 ring-1 ring-white/20"}`,children:(0,b.jsx)("img",{src:a.url,alt:a.filename,className:"h-full w-full object-cover",loading:"lazy",draggable:!1})},a.url+d)})}),(0,b.jsx)(l,{onClick:P,title:s("assets.lightbox.next"),"aria-label":s("assets.lightbox.next"),disabled:!E,children:(0,b.jsx)(g.ChevronRight,{className:"h-4 w-4"})}),K&&(0,b.jsx)(l,{onClick:R,title:`${s("assets.lightbox.next")} (+10)`,"aria-label":`${s("assets.lightbox.next")} (+10)`,disabled:!M,children:(0,b.jsx)(i,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-2 py-1.5 backdrop-blur-md ring-1 ring-white/10",children:[(0,b.jsxs)("span",{className:"px-2 text-xs text-white/80 tabular-nums select-none min-w-12 text-center",children:[Math.round(100*t),"%"]}),(0,b.jsx)(l,{onClick:U,title:s("assets.lightbox.reset"),"aria-label":s("assets.lightbox.reset"),disabled:1===t&&0===v.x&&0===v.y,children:(0,b.jsx)(j.RotateCcw,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"mx-1 h-5 w-px bg-white/20"}),(0,b.jsx)(l,{onClick:N,title:s("assets.lightbox.close"),"aria-label":s("assets.lightbox.close"),children:(0,b.jsx)(e.X,{className:"h-4 w-4"})})]})]})]});return(0,d.createPortal)(Y,document.body)}],532615)},894148,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(704494);a.i(757942);var e=a.i(950314),f=a.i(814574),g=a.i(951192);a.s(["TextPreviewDialog",0,function({url:a,filename:h,open:i,onOpenChange:j}){let{t:k}=(0,g.useI18n)(),[l,m]=(0,c.useState)(null),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!i||!a){m(null),q(null);return}let b=!1;return o(!0),q(null),m(null),fetch(a).then(a=>{let b=a.headers.get("content-length");if(b&&parseInt(b,10)>1048576)throw Error("FILE_TOO_LARGE");return a.text()}).then(a=>{if(a.length>1048576)throw Error("FILE_TOO_LARGE");b||(m(a),o(!1))}).catch(a=>{b||(a instanceof Error&&"FILE_TOO_LARGE"===a.message?q(k("assets.fileTooLarge")):q(k("assets.previewError")),o(!1))}),()=>{b=!0}},[i,a,k]);let r=h.split(".").pop()?.toLowerCase();return(0,b.jsx)(f.Dialog,{open:i,onOpenChange:j,children:(0,b.jsxs)(f.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:h}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:(()=>{if(n)return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 gap-2",children:[(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:k("assets.loadingPreview")})]});if(p)return(0,b.jsx)("p",{className:"text-sm text-destructive",children:p});if(null===l)return null;if("md"===r)return(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(e.Streamdown,{children:l})});if("json"===r){let a;try{a=JSON.stringify(JSON.parse(l),null,2)}catch{a=l}return(0,b.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-foreground",children:a})}return(0,b.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap text-foreground",children:l})})()})]})})}])},161181,a=>{"use strict";let b=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","apng"]);a.s(["isImageAsset",0,function(a,c){if(c?.startsWith("image/"))return!0;let d=a.split(".").pop()?.toLowerCase();return!!d&&b.has(d)},"localPathToApiUrl",0,function(a){let b=a.replace(/\\/g,"/").match(/\/assets\/([^/]+)\/([^/]+)$/);return b?`/api/files/assets/${b[1]}/${b[2]}`:a}])},87339,a=>{"use strict";let b=(0,a.i(711796).default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);a.s(["Paperclip",0,b],87339)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_07c-9da._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[342796,(a,b,c)=>{"use strict";b.exports=a.r(918622)},374637,(a,b,c)=>{"use strict";b.exports=a.r(342796).vendored["react-ssr"].React},728778,(a,b,c)=>{"use strict";b.exports=a.r(342796).vendored["react-ssr"].ReactJsxRuntime},986099,(a,b,c)=>{"use strict";b.exports=a.r(342796).vendored["react-ssr"].ReactDOM},499636,(a,b,c)=>{"use strict";b.exports=a.r(342796).vendored["react-ssr"].ReactServerDOMTurbopackClient},838928,(a,b,c)=>{"use strict";b.exports=a.r(342796).vendored.contexts.AppRouterContext},806795,(a,b,c)=>{"use strict";b.exports=a.r(342796).vendored.contexts.HooksClientContext},257172,(a,b,c)=>{"use strict";b.exports=a.r(342796).vendored.contexts.ServerInsertedHtml},499425,a=>{"use strict";a.s(["mergeClasses",0,(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim()])},748939,539153,a=>{"use strict";a.s(["default",0,{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}],748939),a.s(["hasA11yProp",0,a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1}],539153)},392223,a=>{"use strict";var b=a.i(374637),c=a.i(748939),d=a.i(539153),e=a.i(499425);let f=(0,b.createContext)({}),g=(0,b.forwardRef)(({color:a,size:g,strokeWidth:h,absoluteStrokeWidth:i,className:j="",children:k,iconNode:l,...m},n)=>{let{size:o=24,strokeWidth:p=2,absoluteStrokeWidth:q=!1,color:r="currentColor",className:s=""}=(0,b.useContext)(f)??{},t=i??q?24*Number(h??p)/Number(g??o):h??p;return(0,b.createElement)("svg",{ref:n,...c.default,width:g??o??c.default.width,height:g??o??c.default.height,stroke:a??r,strokeWidth:t,className:(0,e.mergeClasses)("lucide",s,j),...!k&&!(0,d.hasA11yProp)(m)&&{"aria-hidden":"true"},...m},[...l.map(([a,c])=>(0,b.createElement)(a,c)),...Array.isArray(k)?k:[k]])});a.s(["default",0,g],392223)},403988,(a,b,c)=>{"use strict";function d(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(d=function(a){return a?c:b})(a)}c._=function(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=d(b);if(c&&c.has(a))return c.get(a);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in a)if("default"!==g&&Object.prototype.hasOwnProperty.call(a,g)){var h=f?Object.getOwnPropertyDescriptor(a,g):null;h&&(h.get||h.set)?Object.defineProperty(e,g,h):e[g]=a[g]}return e.default=a,c&&c.set(a,e),e}},884864,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d,e,f={ACTION_HMR_REFRESH:function(){return l},ACTION_NAVIGATE:function(){return i},ACTION_REFRESH:function(){return h},ACTION_RESTORE:function(){return j},ACTION_SERVER_ACTION:function(){return m},ACTION_SERVER_PATCH:function(){return k},PrefetchKind:function(){return n},ScrollBehavior:function(){return o}};for(var g in f)Object.defineProperty(c,g,{enumerable:!0,get:f[g]});let h="refresh",i="navigate",j="restore",k="server-patch",l="hmr-refresh",m="server-action";var n=((d={}).AUTO="auto",d.FULL="full",d),o=((e={})[e.Default=0]="Default",e[e.NoScroll=1]="NoScroll",e);("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},66417,(a,b,c)=>{"use strict";function d(a){return null!==a&&"object"==typeof a&&"then"in a&&"function"==typeof a.then}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"isThenable",{enumerable:!0,get:function(){return d}})},239624,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={dispatchAppRouterAction:function(){return i},dispatchGestureState:function(){return j},refreshOnInstantNavigationUnlock:function(){return h},useActionQueue:function(){return k}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(403988)._(a.r(374637)),g=a.r(66417);a.r(884864);function h(){}function i(a){!0;throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0})}function j(a){!0;throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0})}function k(a){let[b,c]=f.default.useState(a.state),[d,e]=(0,f.useOptimistic)(b),h=(0,f.useMemo)(()=>d,[d]);return(0,g.isThenable)(h)?(0,f.use)(h):h}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},998029,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"callServer",{enumerable:!0,get:function(){return g}});let d=a.r(374637),e=a.r(884864),f=a.r(239624);async function g(a,b){return new Promise((c,g)=>{(0,d.startTransition)(()=>{(0,f.dispatchAppRouterAction)({type:e.ACTION_SERVER_ACTION,actionId:a,actionArgs:b,resolve:c,reject:g})})})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},186592,(a,b,c)=>{"use strict";let d;Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"findSourceMapURL",{enumerable:!0,get:function(){return d}});("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},780410,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={callServer:function(){return f.callServer},createServerReference:function(){return h.createServerReference},findSourceMapURL:function(){return g.findSourceMapURL}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(998029),g=a.r(186592),h=a.r(499636)},573242,a=>{"use strict";var b=a.i(648717);a.s(["Search",()=>b.default])},347165,a=>{"use strict";let b=(0,a.i(711796).default)("folder-open",[["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"}]]);a.s(["FolderOpen",0,b],347165)},663513,a=>{"use strict";let b=(0,a.i(711796).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);a.s(["default",0,b])},704494,a=>{"use strict";var b=a.i(663513);a.s(["Loader2",()=>b.default])},668116,a=>{"use strict";var b=a.i(29715);a.s(["Check",()=>b.default])},975231,a=>{"use strict";let b=(0,a.i(711796).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);a.s(["Trash2",0,b],975231)},774881,a=>{"use strict";let b=(0,a.i(711796).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);a.s(["Plus",0,b],774881)},146758,745539,a=>{"use strict";let b=(0,a.i(711796).default)("folder",[["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"}]]);a.s(["Folder",0,b],146758);var c=a.i(219551);a.s(["ChevronUp",()=>c.default],745539)},884664,a=>{"use strict";let b=(0,a.i(711796).default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);a.s(["default",0,b])},192369,a=>{"use strict";let b=(0,a.i(711796).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);a.s(["RefreshCw",0,b],192369)},622945,a=>{"use strict";let b=(0,a.i(711796).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);a.s(["default",0,b])},87309,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(780410);let e=(0,d.createServerReference)("40eb934880e7b3819f12c1c7f91817927d87299cd1",d.callServer,void 0,d.findSourceMapURL,"checkExtension");var f=a.i(583551);let g=(0,d.createServerReference)("40ce35e60ac54cb8269e14dc338b432fad63b05057",d.callServer,void 0,d.findSourceMapURL,"uninstallExtension");var h=a.i(953093);let i={installed:!1},j=(0,c.createContext)(null);a.s(["ExtensionContext",0,j,"ExtensionProvider",0,function({children:a,initialStatus:d}){let[k,l]=(0,c.useState)(()=>d??Object.fromEntries((0,h.listExtensionMetadata)().map(a=>[a.id,i]))),[m,n]=(0,c.useState)(new Set),o=(0,c.useRef)(new Set),p=(0,c.useCallback)(async a=>{let b=await e(a);l(c=>({...c,[a]:b}))},[]),q=(0,c.useCallback)(async a=>{if(o.current.has(a))return{success:!1,error:"install already in progress"};o.current.add(a),n(b=>{let c=new Set(b);return c.add(a),c});try{let b=await (0,f.installExtension)(a);return b.success&&await p(a),b}finally{o.current.delete(a),n(b=>{let c=new Set(b);return c.delete(a),c})}},[p]),r=(0,c.useCallback)(async a=>{if(o.current.has(a))return{success:!1,error:"operation already in progress"};o.current.add(a),n(b=>{let c=new Set(b);return c.add(a),c});try{let b=await g(a);return b.success&&await p(a),b}finally{o.current.delete(a),n(b=>{let c=new Set(b);return c.delete(a),c})}},[p]),s=(0,c.useMemo)(()=>({statusMap:k,loading:!1,installing:m,refresh:p,install:q,uninstall:r}),[k,m,p,q,r]);return(0,b.jsx)(j.Provider,{value:s,children:a})}],87309)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_0_z-t6g._.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
module.exports=[976268,a=>{"use strict";let b=(0,a.i(711796).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);a.s(["default",0,b])},607884,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(634910),f=a.i(607219),g=a.i(774881),h=a.i(690251),i=a.i(975231),j=a.i(336771),k=a.i(91756),l=a.i(881107),m=a.i(350739),n=a.i(347165),o=a.i(711796);let p=(0,o.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var q=a.i(335732),r=a.i(269876),s=a.i(814574),t=a.i(785259),u=a.i(699570),v=a.i(866718),w=a.i(780410);let x=(0,w.createServerReference)("40dc5994c5145791aa6b750c6db19b674339691e95",w.callServer,void 0,w.findSourceMapURL,"createWorkspace"),y=(0,w.createServerReference)("60de99d8abadfb18ea24da9fe6659ba6eb8f9b8b90",w.callServer,void 0,w.findSourceMapURL,"updateWorkspace"),z=(0,w.createServerReference)("4033f23e3fceeb4827b06ccb240c11c6786038f237",w.callServer,void 0,w.findSourceMapURL,"deleteWorkspace"),A=(0,w.createServerReference)("40d05a29d8dc5caa8d25e073a30ecc92f40fcd0db5",w.callServer,void 0,w.findSourceMapURL,"reorderWorkspaces");var B=a.i(629468);let C=(0,w.createServerReference)("40d973f296d8738cf4afb3d63fdcf700207ef10e8f",w.callServer,void 0,w.findSourceMapURL,"createLabel"),D=(0,w.createServerReference)("40021a9d736acd9bcfa12e8373f683a674b28086a3",w.callServer,void 0,w.findSourceMapURL,"deleteLabel");var E=a.i(258815),F=a.i(951192),G=a.i(952313),H=a.i(643228),I=a.i(859103),J=a.i(514126);let K=["📋","🚀","🎯","💡","🔧","📦","🎨","📊","🔬","🌟","📝","🏗️"];function L({workspaces:a}){let h,i=(0,d.useRouter)(),j=(0,d.usePathname)(),{t:l}=(0,F.useI18n)(),[o,q]=(0,c.useState)(!1);(0,c.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&q(!0)},[]);let[s,v]=(0,c.useState)(!1),[w,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[J,O]=(0,c.useState)(null),[Q,R]=(0,c.useState)(""),[S,T]=(0,c.useState)(K[0]),[U,V]=(0,c.useState)(null),[W,X]=(0,c.useState)(a);(0,c.useEffect)(()=>{X(a)},[a]);let Y=(0,H.useSensors)((0,H.useSensor)(H.PointerSensor,{activationConstraint:{distance:8}})),Z=(0,c.useCallback)(b=>{let{active:c,over:d}=b;if(!d||c.id===d.id)return;let e=W.findIndex(a=>a.id===c.id),f=W.findIndex(a=>a.id===d.id);if(-1===e||-1===f)return;let g=(0,I.arrayMove)(W,e,f);X(g),A(g.map(a=>a.id)).then(()=>i.refresh()).catch(()=>{X(a),G.toast.error(l("sidebar.reorderError"))})},[W,a,i,l]),$=j.split("/workspaces/")[1]?.split("/")[0],_=(0,c.useCallback)(a=>{if($===a)return;let b=(0,E.getLastProjectId)(a);i.push(b?`/workspaces/${a}?projectId=${b}`:`/workspaces/${a}`)},[$,i]),aa=(0,c.useCallback)(()=>{q(a=>{let b=!a;return localStorage.setItem("sidebar-collapsed",String(b)),b})},[]),ab=(0,c.useCallback)(async()=>{if(!Q.trim())return;let a=await x({name:Q.trim(),description:S});R(""),T(K[0]),v(!1),i.refresh(),i.push(`/workspaces/${a.id}`)},[Q,S,i]),ac=(0,c.useCallback)(async()=>{Q.trim()&&U&&(await y(U,{name:Q.trim(),description:S}),R(""),B(!1),V(null),i.refresh())},[Q,S,U,i]),ad=(0,c.useCallback)(a=>{V(a.id),R(a.name),T(a.description&&K.includes(a.description)?a.description:K[0]),B(!0)},[]),ae=(0,c.useCallback)(async(b,c)=>{if(a.length<=1)return void G.toast.error(l("sidebar.lastWorkspaceError"));if(confirm(l("sidebar.deleteConfirm",{name:c})))try{await z(b),i.refresh(),$===b&&i.push("/workspaces")}catch{G.toast.error(l("sidebar.lastWorkspaceError"))}},[$,i,l,a.length]),af=(0,c.useCallback)(a=>{O(a),D(!0)},[]),ag=a=>a.description&&K.includes(a.description)?a.description:a.name.charAt(0).toUpperCase();if(o){let c;return(0,b.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:aa,className:"mb-4 flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 ring-1 ring-primary/20 transition-transform hover:scale-105"}),children:(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.expand")})]}),(0,b.jsx)(r.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[a.map(a=>{let c=$===a.id,d=ag(a);return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>_(a.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${c?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:K.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold",children:d})})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:a.name})]},a.id)}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{"data-tour":"create-workspace",onClick:()=>v(!0),className:"flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"}),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.newWorkspace")})]})]})}),(0,b.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===j?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(p,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("missions.navLabel")})]}),(c=$||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/notes`),className:`rounded-lg p-2 transition-colors ${j.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(m.FileText,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.notes")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/assets`),className:`rounded-lg p-2 transition-colors ${j.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(n.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.assets")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/archive`),className:`rounded-lg p-2 transition-colors ${j.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(f.Archive,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.archive")})]})]}):null]}),(0,b.jsx)(N,{open:s,onOpenChange:v,title:l("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:ab,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")})]})}return(0,b.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,b.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,b.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-xs",onClick:aa,className:"text-muted-foreground",title:l("sidebar.collapse"),children:(0,b.jsx)(k.ChevronsLeft,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:l("sidebar.workspace")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{R(""),T(K[0]),v(!0)},title:l("sidebar.newWorkspace"),children:(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)(r.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,b.jsx)("div",{className:"px-2 py-1",children:(0,b.jsx)(H.DndContext,{id:"workspace-sidebar",sensors:Y,collisionDetection:H.closestCenter,onDragEnd:Z,children:(0,b.jsx)(I.SortableContext,{items:W.map(a=>a.id),strategy:I.verticalListSortingStrategy,children:W.map(a=>(0,b.jsx)(M,{ws:a,isActive:$===a.id,icon:ag(a),disableDelete:W.length<=1,t:l,onSelect:()=>_(a.id),onEdit:()=>ad(a),onManageLabels:()=>af(a.id),onDelete:()=>ae(a.id,a.name)},a.id))})})})}),(0,b.jsxs)(e.default,{href:"/missions",className:`relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] cursor-pointer transition-colors ${"/missions"===j?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(p,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("missions.navLabel")})]}),(h=$||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.default,{href:`/workspaces/${h}/notes`,className:"relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(m.FileText,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.notes")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/assets`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.assets")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/archive`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(f.Archive,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.archive")})]})]}):null,(0,b.jsx)(N,{open:s,onOpenChange:v,title:l("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:ab,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),(0,b.jsx)(N,{open:w,onOpenChange:a=>{B(a),a||V(null)},title:l("workspace.edit"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:ac,submitLabel:l("common.save"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),J&&(0,b.jsx)(P,{open:C,onOpenChange:a=>{D(a),a||O(null)},workspaceId:J})]})}function M({ws:a,isActive:c,icon:d,disableDelete:e,t:f,onSelect:g,onEdit:k,onManageLabels:m,onDelete:n}){var o;let p,r,s,{attributes:t,listeners:u,setNodeRef:v,transform:w,transition:x,isDragging:y}=(0,I.useSortable)({id:a.id}),z={transform:J.CSS.Transform.toString(w),transition:x,opacity:y?.4:1};return(0,b.jsxs)("div",{ref:v,style:z,...t,...u,className:`group relative flex touch-none items-center rounded-lg transition-all ${c?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,b.jsxs)("button",{onClick:g,className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${c?"cursor-default":"cursor-pointer"}`,children:[(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:K.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:d})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:`truncate text-sm font-medium ${c?"text-foreground":"text-secondary-foreground"}`,children:a.name}),(0,b.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(o=a.updatedAt,r=Math.floor((p=Date.now()-new Date(o).getTime())/6e4),s=Math.floor(p/36e5),r<60?`${r}m ago`:s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`)})]})]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"mr-2 rounded-md p-1 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:a=>a.stopPropagation()}),children:(0,b.jsx)(j.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,b.jsxs)(q.DropdownMenuContent,{align:"start",side:"right",children:[(0,b.jsxs)(q.DropdownMenuItem,{onClick:k,children:[(0,b.jsx)(h.Pencil,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.rename")]}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:m,children:[(0,b.jsx)(l.Tag,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.manageLabels")]}),(0,b.jsxs)(q.DropdownMenuItem,{className:e?"text-muted-foreground opacity-50":"text-rose-400",disabled:e,onClick:n,children:[(0,b.jsx)(i.Trash2,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.delete")]})]})]})]})}function N({open:a,onOpenChange:c,title:d,name:e,onNameChange:f,icon:g,onIconChange:h,onSubmit:i,submitLabel:j,nameLabel:k,iconLabel:l,namePlaceholder:m,cancelLabel:n}){return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:c,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:d})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k}),(0,b.jsx)(v.Input,{placeholder:m,value:e,onChange:a=>f(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:l}),(0,b.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:K.map(a=>(0,b.jsx)("button",{onClick:()=>h(a),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${g===a?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:a},a))})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>c(!1),children:n}),(0,b.jsx)(u.Button,{onClick:i,disabled:!e.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:j})]})]})})}let O=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function P({open:a,onOpenChange:d,workspaceId:e}){let{t:f}=(0,F.useI18n)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(O[0]);(0,c.useEffect)(()=>{a&&(0,B.getLabelsForWorkspace)(e).then(h)},[a,e]);let m=async()=>{i.trim()&&(await C({name:i.trim(),color:k,workspaceId:e}),h(await (0,B.getLabelsForWorkspace)(e)),j(""))},n=async a=>{await D(a),h(b=>b.filter(b=>b.id!==a))};return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:d,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("label.manage")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[g.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:a.color}}),(0,b.jsx)("span",{className:"flex-1 text-sm text-foreground",children:a.name}),a.isBuiltin?(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:f("label.builtin")}):(0,b.jsx)("button",{onClick:()=>n(a.id),className:"text-xs text-rose-400 hover:text-rose-300",children:f("common.delete")})]},a.id)),(0,b.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("label.name"),value:i,onChange:a=>j(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"flex-1 h-8"}),(0,b.jsx)(u.Button,{size:"sm",onClick:m,disabled:!i.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("label.add")})]}),(0,b.jsx)("div",{className:"mt-2 flex gap-1.5",children:O.map(a=>(0,b.jsx)("button",{onClick:()=>l(a),className:`h-5 w-5 rounded-full transition-all ${k===a?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:a}},a))})]})]})]})})}a.i(423993);var Q=a.i(267654),R=a.i(818862);let S=(0,R.create)(a=>({createProjectOpen:!1,importProjectOpen:!1,setCreateProjectOpen:b=>a({createProjectOpen:b}),setImportProjectOpen:b=>a({importProjectOpen:b})}));var T=a.i(940271),U=a.i(573242),V=a.i(369289);let W=(0,o.default)("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);var X=a.i(851378);let Y=(0,o.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var Z=a.i(761052),$=a.i(86354);a.s([],516474),a.i(516474);var _=a.i(213200),aa=a.i(862306);let ab=c.createContext(void 0);function ac(){let a=c.useContext(ab);if(void 0===a)throw Error((0,aa.default)(13));return a}let ad={imageLoadingStatus:()=>null},ae=c.forwardRef(function(a,d){let{className:e,render:f,...g}=a,[h,i]=c.useState("idle"),j=c.useMemo(()=>({imageLoadingStatus:h,setImageLoadingStatus:i}),[h,i]),k=(0,_.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:d,props:g,stateAttributesMapping:ad});return(0,b.jsx)(ab.Provider,{value:j,children:k})});var af=a.i(74686),ag=a.i(830067),ah=a.i(398312),ai=a.i(380562),aj=a.i(904531),ak=a.i(535011);let al={...ad,...ai.transitionStatusMapping},am=c.forwardRef(function(a,b){let{className:d,render:e,onLoadingStatusChange:f,referrerPolicy:g,crossOrigin:h,...i}=a,j=ac(),k=function(a,{referrerPolicy:b,crossOrigin:d}){let[e,f]=c.useState("idle");return(0,ag.useIsoLayoutEffect)(()=>{if(!a)return f("error"),ak.NOOP;let c=!0,e=new window.Image,g=a=>()=>{c&&f(a)};return f("loading"),e.onload=g("loaded"),e.onerror=g("error"),b&&(e.referrerPolicy=b),e.crossOrigin=d??null,e.src=a,()=>{c=!1}},[a,d,b]),e}(a.src,{referrerPolicy:g,crossOrigin:h}),l="loaded"===k,{mounted:m,transitionStatus:n,setMounted:o}=(0,aj.useTransitionStatus)(l),p=c.useRef(null),q=(0,af.useStableCallback)(a=>{f?.(a),j.setImageLoadingStatus(a)});(0,ag.useIsoLayoutEffect)(()=>{"idle"!==k&&q(k)},[k,q]),(0,ah.useOpenChangeComplete)({open:l,ref:p,onComplete(){l||o(!1)}});let r=(0,_.useRenderElement)("img",a,{state:{imageLoadingStatus:k,transitionStatus:n},ref:[b,p],props:i,stateAttributesMapping:al,enabled:m});return m?r:null});var an=a.i(102934);let ao=c.forwardRef(function(a,b){let{className:d,render:e,delay:f,...g}=a,{imageLoadingStatus:h}=ac(),[i,j]=c.useState(void 0===f),k=(0,an.useTimeout)();return c.useEffect(()=>(void 0!==f&&k.start(f,()=>j(!0)),k.clear),[k,f]),(0,_.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:b,props:g,stateAttributesMapping:ad,enabled:"loaded"!==h&&i})});a.s(["Fallback",0,ao,"Image",0,am,"Root",0,ae],991134);var ap=a.i(991134),ap=ap,aq=a.i(368114);function ar({className:a,size:c="default",...d}){return(0,b.jsx)(ap.Root,{"data-slot":"avatar","data-size":c,className:(0,aq.cn)("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",a),...d})}function as({className:a,...c}){return(0,b.jsx)(ap.Fallback,{"data-slot":"avatar-fallback",className:(0,aq.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",a),...c})}let at=(0,o.default)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);var au=a.i(577565);let av=(0,o.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),aw=(0,o.default)("package-2",[["path",{d:"M12 3v6",key:"1holv5"}],["path",{d:"M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z",key:"187q7i"}],["path",{d:"M3.054 9.013h17.893",key:"grwhos"}]]);var ax=a.i(54384);let ay=(0,w.createServerReference)("6071f62865d7cc8fd3ab220abf5ecfbc0ec631d910",w.callServer,void 0,w.findSourceMapURL,"globalSearch");var az=a.i(76151);let aA=[{id:"all",key:"search.all",icon:U.Search},{id:"task",key:"search.task",icon:m.FileText},{id:"project",key:"search.project",icon:at},{id:"repository",key:"search.repository",icon:au.GitBranch},{id:"note",key:"search.note",icon:av},{id:"asset",key:"search.asset",icon:aw}],aB=["task","project","repository","note","asset"],aC={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function aD({result:a,onSelect:c}){let d=aA.find(b=>b.id===a.type)?.icon??m.FileText;return(0,b.jsxs)("button",{onClick:()=>c(a),className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-3 text-left transition-colors hover:bg-accent last:border-b-0",children:[(0,b.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,b.jsx)(d,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:a.title}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:a.subtitle}),a.snippet&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:a.snippet})]})]})}function aE({open:a,onOpenChange:e}){let f,{t:g}=(0,F.useI18n)(),h=(0,d.useRouter)(),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)("all"),[m,n]=(0,c.useState)([]),[o,p]=(0,c.useState)(!1),[q,t]=(0,c.useState)(250),v=(0,c.useRef)(null),w=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&((0,az.getConfigValue)("search.debounceMs",250).then(t),setTimeout(()=>v.current?.focus(),100),j(""),n([]))},[a]),(0,c.useEffect)(()=>{if(w.current&&clearTimeout(w.current),!i.trim()){n([]),p(!1);return}p(!0);let a=!1;return w.current=setTimeout(async()=>{let b=await ay(i,k);a||(n(b),p(!1))},q),()=>{w.current&&clearTimeout(w.current),a=!0}},[i,k,q]);let x=(0,c.useCallback)(a=>{h.push(a.navigateTo),e(!1)},[h,e]);return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:e,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,b.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,b.jsx)(U.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,b.jsx)("input",{ref:v,value:i,onChange:a=>j(a.target.value),placeholder:g("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),i&&(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>{j(""),n([])},className:"text-muted-foreground",children:(0,b.jsx)(ax.X,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:aA.map(a=>{let c=a.icon;return(0,b.jsxs)("button",{onClick:()=>l(a.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${k===a.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,b.jsx)(c,{className:"h-3 w-3"}),g(a.key)]},a.id)})}),(0,b.jsxs)(r.ScrollArea,{className:"max-h-80",children:[!i.trim()&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.typeToSearch")}),i.trim()&&0===m.length&&!o&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.noResults")}),"all"===k&&m.length>0&&(f=m.reduce((a,b)=>((a[b.type]??=[]).push(b),a),{}),aB.filter(a=>f[a]?.length).map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:g(aC[a])}),f[a].map(a=>(0,b.jsx)(aD,{result:a,onSelect:x},`${a.type}-${a.id}`))]},a))),"all"!==k&&m.map(a=>(0,b.jsx)(aD,{result:a,onSelect:x},`${a.type}-${a.id}`))]})]})})}function aF(a){}let aG=(0,c.createContext)(null);function aH(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}let aI="assistant-attachment-cache";function aJ(a,b,c){try{let d=sessionStorage.getItem(aI),e=d?JSON.parse(d):{};e[a]||(e[a]={}),e[a][b]=c,sessionStorage.setItem(aI,JSON.stringify(e))}catch{}}function aK({children:a}){let[d,e]=(0,c.useState)(!1),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)("sidebar"),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)("idle"),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)([]),s=(0,c.useRef)(null),t=(0,c.useRef)(null),[u,v]=(0,c.useState)([]),[w,x]=(0,c.useState)(null),y=(0,c.useRef)(!1),z=(0,c.useCallback)(()=>{m([...r.current])},[]),A=(0,c.useCallback)(async()=>{i("dialog"===await (0,az.getConfigValue)("assistant.displayMode","sidebar")?"dialog":"sidebar")},[]);(0,c.useEffect)(()=>{A()},[A]);let B=(0,c.useCallback)(async()=>{v([])},[]),C=(0,c.useCallback)(async a=>{q(!0);try{let b=await fetch(`/api/internal/assistant/sessions?sessionId=${encodeURIComponent(a)}`);if(!b.ok)return;let c=await b.json();if(Array.isArray(c.messages)){r.current=c.messages;let b=function(a){try{let b=sessionStorage.getItem(aI);if(!b)return{};return JSON.parse(b)[a]??{}}catch{return{}}}(a);if(Object.keys(b).length>0){let a=0;r.current=r.current.map(c=>{if("user"===c.role){let d=b[a];if(a++,d?.length)return{...c,attachmentFilenames:d}}return c})}m([...r.current])}}catch{}finally{q(!1)}},[]);(0,c.useEffect)(()=>{B()},[B,C]);let D=(0,c.useCallback)(()=>{t.current?.abort(),s.current=null,y.current=!1,x(null),aF(null),r.current=[],m([]),o("idle")},[]),E=(0,c.useCallback)(a=>{t.current?.abort(),s.current=a,y.current=!0,x(a),aF(a),r.current=[],m([]),o("idle"),C(a)},[C]),F=(0,c.useCallback)(a=>{v([]),w===a&&D()},[w,D]),G=(0,c.useCallback)((a,b)=>{b.trim()&&v([])},[]),H=(0,c.useCallback)(async()=>{g(!0);try{await A(),e(!0)}finally{g(!1)}},[A]),I=(0,c.useCallback)(()=>{e(!1),t.current?.abort()},[]),J=(0,c.useCallback)(()=>{d||f?I():H()},[d,f,I,H]);(0,Q.useActionShortcut)("global.assistant",()=>J());let K=(0,c.useCallback)(async(a,b)=>{if(!a.trim()&&!b?.attachmentFilenames?.length)return;t.current?.abort();let c=new AbortController;t.current=c;let d=0!==r.current.length||y.current?null:a,e=aH();if(r.current=[...r.current,{id:aH(),role:"user",content:a,attachmentFilenames:b?.attachmentFilenames?.length?b.attachmentFilenames:void 0},{id:e,role:"thinking",content:"",isStreaming:!0}],z(),b?.attachmentFilenames?.length&&s.current){let a=r.current.filter(a=>"user"===a.role).length-1;aJ(s.current,a,b.attachmentFilenames)}o("connecting");let f=null;try{let g=await fetch("/api/internal/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,sessionId:s.current,attachmentFilenames:b?.attachmentFilenames??[]}),signal:c.signal});if(!g.ok||!g.body)throw Error(`HTTP ${g.status}`);o("streaming");let h=g.body.getReader(),i=new TextDecoder,j="";for(;;){let{done:a,value:c}=await h.read();if(a)break;let g=(j+=i.decode(c,{stream:!0})).split("\n");for(let a of(j=g.pop()??"",g)){let c;if(a.startsWith("data: ")){try{c=JSON.parse(a.slice(6).trim())}catch{continue}if(c.sessionId){let a=s.current;if(s.current=c.sessionId,d&&!y.current&&c.sessionId!==a){y.current=!0;new Date().toISOString();c.sessionId,function(a){let b=a.trim();b&&b.length>30&&b.slice(0,30)}(d),v([]),x(c.sessionId),aF(c.sessionId),b?.attachmentFilenames?.length&&aJ(c.sessionId,0,b.attachmentFilenames)}}switch(c.type){case"text_delta":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:a.content+(c.content??""),isStreaming:!0}:a):(f=aH(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"text":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:c.content??a.content,isStreaming:!0}:a):(f=aH(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"tool_start":{let a=r.current.filter(a=>a.id!==e);f?(r.current=a.map(a=>a.id===f?{...a,isStreaming:!1}:a),f=null):r.current=a,r.current=[...r.current,{id:aH(),role:"tool",content:`Calling ${c.content??"tool"}...`,toolName:c.content,isStreaming:!0}],z();break}case"tool_use":{let a=r.current.filter(a=>a.id!==e),b=f?a.map(a=>a.id===f?{...a,isStreaming:!1}:a):a;f=null,r.current=[...b,{id:aH(),role:"tool",content:JSON.stringify(c.toolInput??{},null,2),toolName:c.content}],z();break}case"tool_result":r.current=[...r.current,{id:aH(),role:"tool",content:String(c.toolOutput??""),toolName:`${c.content??"tool"} (result)`}],z();break;case"error":r.current=[...r.current.filter(a=>a.id!==e),{id:aH(),role:"assistant",content:`Error: ${c.content??"Unknown error"}`}],z(),o("error");break;case"done":f&&(r.current=r.current.map(a=>a.id===f?{...a,isStreaming:!1}:a)),r.current=r.current.filter(a=>a.id!==e),z(),o("idle")}}}}r.current=r.current.filter(a=>a.id!==e),z(),o(a=>"streaming"===a?"idle":a),B()}catch(a){if("AbortError"===a.name)return;r.current=[...r.current.filter(a=>a.id!==e),{id:aH(),role:"assistant",content:`Connection error: ${a.message??"Unknown error"}`}],z(),o("error")}},[z,B]),L=(0,c.useCallback)(()=>{t.current?.abort(),t.current=null;let a=[...r.current].reverse().find(a=>"user"===a.role),b=a?.content??null;if(a){let b=r.current.lastIndexOf(a);r.current=r.current.slice(0,b),m([...r.current])}return o("idle"),b},[]),M=l[l.length-1],N="connecting"===n||"streaming"===n||M?.role==="thinking"&&!0===M.isStreaming;return(0,b.jsx)(aG.Provider,{value:{isOpen:d,isStarting:f,displayMode:h,worktreePath:j,toggleAssistant:J,closeAssistant:I,chatMessages:l,chatStatus:n,isChatThinking:N,isLoadingHistory:p,sendChatMessage:K,cancelChat:L,sessions:u,activeSessionId:w,createNewSession:D,switchSession:E,removeSession:F,renameSession:G,refreshSessions:B},children:a})}function aL(){let a=(0,c.useContext)(aG);if(!a)throw Error("useAssistant must be used within an AssistantProvider");return a}var aM=a.i(704494),aN=a.i(668116),aO=a.i(616335),aP=a.i(394259),aQ=a.i(487410),aR=a.i(429246);function aS(a){return a.replace(/\.git\/?$/,"")}a.i(446786),a.i(814747);let aT=(0,w.createServerReference)("4092804c67622795f702440c3e64d76bd68b0f7dd4",w.callServer,void 0,w.findSourceMapURL,"resolveGitLocalPath");var aU=a.i(243700),aV=a.i(43775);function aW({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,F.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("FRONTEND"),[A,B]=(0,c.useState)("idle"),[C,D]=(0,c.useState)(""),[E,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(!1),K=()=>{i(""),k(""),m(""),p(""),r(""),x(!1),z("FRONTEND"),B("idle"),D(""),H(!1)},L=async()=>{if(q.trim()&&!E&&"success"===A){H(!0);try{let a=await (0,aU.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{G.toast.error(f("project.analyzeError"))}finally{H(!1)}}},M=async a=>{p(a),B("idle"),D("");let b=function(a){let b,c=a.match(/^git@([^:]+):(.+)$/);if(c)return{host:c[1],pathSegments:aS(c[2]).split("/").filter(Boolean)};try{b=new URL(a)}catch{return null}return{host:b.hostname,pathSegments:aS(decodeURIComponent(b.pathname)).split("/").filter(Boolean)}}(a);b&&b.pathSegments.length>0&&i(b.pathSegments[b.pathSegments.length-1]),w||r(await aT(a))},N=async()=>{if(o.trim()&&q.trim()){B("cloning"),D("");try{let a=function(a){let b=a.trim();if(!b)return"";if(b.startsWith("git@")||b.startsWith("ssh://")||b.endsWith(".git"))return b;try{let a=new URL(b),c=a.hostname,d=decodeURIComponent(a.pathname).split("/").filter(Boolean);if("code.iflytek.com"===c){let a=[...d];"osc"===a[0]&&"_source"===a[1]&&(a=a.slice(2));let e=a.indexOf("-");if(e>0&&(a=a.slice(0,e)),0===a.length)return b;return`https://${c}/${a.join("/")}.git`}return`${a.origin}${a.pathname.replace(/\/$/,"")}.git`}catch{return b}}(o.trim()),b=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:a,path:q.trim()})}),c=await b.json();if(!b.ok){B("error"),D(c.error||"Clone failed");return}B("success")}catch{B("error"),D("Network error")}}},O=async()=>{h.trim()&&(await e?.({name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:y}),K(),d(!1))};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||K()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.gitUrlHint")}),(0,b.jsx)(v.Input,{placeholder:f("project.gitPlaceholder"),value:o,onChange:a=>M(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.localPathHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("project.localPathPlaceholder"),value:q,onChange:a=>{r(a.target.value),x(!0)},className:"flex-1 min-w-0 font-mono text-xs"}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"outline",onClick:()=>J(!0),className:"shrink-0 gap-1.5 px-2.5 text-xs text-muted-foreground"}),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:f("folder.browse")})]}),(0,b.jsx)(t.TooltipContent,{children:f("folder.selectFolder")})]})]}),q.trim().startsWith("~")&&(0,b.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),f("project.tildeWarning")]}),o.trim()&&q.trim()&&(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{type:"button",disabled:"cloning"===A||"success"===A,onClick:N,className:"gap-1.5 text-xs bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/25 hover:bg-emerald-500/25 disabled:opacity-50",children:["cloning"===A?(0,b.jsx)(aM.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===A?(0,b.jsx)(aN.Check,{className:"h-3 w-3"}):(0,b.jsx)(au.GitBranch,{className:"h-3 w-3"}),"cloning"===A?f("git.cloning"):"success"===A?f("git.cloned"):f("git.clone")]}),"error"===A&&(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),C]}),"success"===A&&(0,b.jsx)("span",{className:"text-[11px] text-emerald-400",children:f("git.cloneSuccess")})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(aQ.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:y,onChange:z})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:L,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q.trim()||E?"opacity-50":""}`}),children:[E?(0,b.jsx)(aM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aP.Sparkles,{className:"h-3 w-3"}),E?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q.trim()?"success"!==A?f("project.genDescNotCloned"):f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aR.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),K()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:O,disabled:!h.trim()||E,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:f("common.create")})]})]})}),(0,b.jsx)(aV.FolderBrowserDialog,{open:I,onOpenChange:J,onSelect:a=>{if(r(a),x(!0),!h.trim()){let b=a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";b&&i(b)}}})]})}var aX=a.i(976268),aX=aX,aY=a.i(563658);let aZ=(0,w.createServerReference)("60697db45fd919041164efede51525c37717402587",w.callServer,void 0,w.findSourceMapURL,"migrateProjectPath"),a$=(0,w.createServerReference)("4046e8aa9ca2e60552574e42d4b0ea37efacf35831",w.callServer,void 0,w.findSourceMapURL,"checkMigrationSafety");function a_({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,F.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("FRONTEND"),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[E,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(""),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(!1),[Q,R]=(0,c.useState)(!1),S=()=>{i(""),k(""),m(""),p(""),r(""),z("FRONTEND"),B(!1),D(!1),H(""),J(!1),L(""),N(""),P(!1),R(!1)},T=async a=>{r(a),B(!1),D(!1),H(""),L(""),N(""),P(!1),i(a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"");try{let b=await fetch(`/api/git?path=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();if(a.isGit&&a.remoteUrl){p(a.remoteUrl),B(!0);let b=a.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);b&&i(b[1])}}}catch{}},U=(0,c.useCallback)(async a=>{if(D(a),L(""),N(""),P(!1),!a)return void H("");if(o)try{let a=await aT(o);a&&(H(a),a===q&&P(!0))}catch{}if(q)try{let a=await fetch(`/api/git?path=${encodeURIComponent(q)}&checkWorktrees=true`);a.ok&&(await a.json()).hasWorktrees&&N(f("project.worktreeWarning"))}catch{}},[o,q]),V=async()=>{if(q&&!Q){R(!0);try{let a=await (0,aU.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{G.toast.error(f("project.analyzeError"))}finally{R(!1)}}},W=async()=>{if(!h.trim())return;let a={name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:y},b=await e?.(a);if(C&&E&&E!==q&&b&&"id"in b){J(!0),L("");try{let a=await a$(b.id);if(!a.safe)return void L(a.reason);let c=await aZ(b.id,E);if(!c.success)return void L(c.error??f("project.migrateError"));G.toast.success(f("project.migrateSuccess"))}catch(b){let a=b instanceof Error?b.message:String(b);L(`${f("project.migrateError")}:${a}`);return}finally{J(!1)}}S(),d(!1)},X=!h.trim()||!q.trim()||I||Q||C&&!!M;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||S()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.importProject")})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.importHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{value:q,readOnly:!0,placeholder:f("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,b.jsxs)(u.Button,{type:"button",variant:"outline",onClick:()=>x(!0),className:"shrink-0 gap-1.5",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("folder.browse")]})]}),A&&(0,b.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:f("project.autoDetected")})]}),o&&(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)(v.Input,{value:o,onChange:a=>p(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),A&&q&&(0,b.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs font-medium",children:f("project.migrate")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.migrateHint")})]}),(0,b.jsx)(aY.Switch,{checked:C,onCheckedChange:a=>U(a)})]}),C&&(0,b.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:f("project.targetPath")}),(0,b.jsx)(v.Input,{value:E,onChange:a=>{H(a.target.value),P(a.target.value===q)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),O&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,b.jsx)(aX.default,{className:"h-3 w-3"}),f("project.samePathInfo")]}),M&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),M]}),K&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),K]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(aQ.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:y,onChange:z})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:V,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q||Q?"opacity-50":""}`}),children:[Q?(0,b.jsx)(aM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aP.Sparkles,{className:"h-3 w-3"}),Q?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q?f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aR.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),S()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:W,disabled:X,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:I?f("project.migrating"):f("common.create")})]})]})}),(0,b.jsx)(aV.FolderBrowserDialog,{open:w,onOpenChange:x,onSelect:a=>T(a)})]})}function a0({className:a}){return(0,b.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:a,children:(0,b.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12.02c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56v-2c-3.2.7-3.87-1.36-3.87-1.36-.52-1.34-1.27-1.7-1.27-1.7-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.34.96.1-.74.4-1.25.72-1.54-2.56-.29-5.25-1.28-5.25-5.69 0-1.26.45-2.28 1.18-3.09-.12-.29-.51-1.46.11-3.04 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.79 0c2.2-1.49 3.18-1.18 3.18-1.18.62 1.58.23 2.75.11 3.04.74.81 1.18 1.83 1.18 3.09 0 4.42-2.69 5.4-5.25 5.69.41.36.78 1.05.78 2.12v3.14c0 .31.21.68.79.56A11.52 11.52 0 0 0 23.5 12.02C23.5 5.65 18.35.5 12 .5Z"})})}function a1({onCreateProject:a,username:e}){let{t:f,locale:h,setLocale:i}=(0,F.useI18n)(),{isOpen:j,toggleAssistant:k}=aL(),{resolvedTheme:l,toggleTheme:m,triggerRef:o}=function(){let{resolvedTheme:a,setTheme:b}=(0,T.useTheme)(),d=(0,c.useRef)(null),e=(0,c.useCallback)(c=>{let d="dark"===a?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let a=c?.clientX??window.innerWidth/2,e=c?.clientY??0,f=Math.hypot(Math.max(a,window.innerWidth-a),Math.max(e,window.innerHeight-e));document.startViewTransition(()=>{b(d)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${a}px ${e}px)`,`circle(${f}px at ${a}px ${e}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else b(d)},[a,b]);return{resolvedTheme:a,toggleTheme:e,triggerRef:d}}(),p=(0,d.useRouter)(),[r,s]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!1);(0,Q.useActionShortcut)("global.search",()=>s(!0));let z=S(a=>a.createProjectOpen),A=S(a=>a.importProjectOpen),B=S(a=>a.setCreateProjectOpen),C=S(a=>a.setImportProjectOpen);return(0,c.useEffect)(()=>{z&&w(!0)},[z]),(0,c.useEffect)(()=>{A&&y(!0)},[A]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"w-40"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{variant:"outline",onClick:()=>s(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,b.jsx)(U.Search,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:f("topbar.searchPlaceholder")}),(0,b.jsxs)("kbd",{className:"mr-1 flex items-center gap-0.5 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] font-mono",children:[(0,b.jsx)(W,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{delay:500,render:(0,b.jsx)("button",{"data-tour":"open-assistant",onClick:k,"aria-label":f("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",j?"bg-accent text-foreground":""].join(" ")}),children:(0,b.jsx)(Y,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("assistant.iconLabel")})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",onClick:()=>i("zh"===h?"en":"zh"),className:"text-muted-foreground"}),children:[(0,b.jsx)(X.Globe,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===h?"EN":"中"})]}),(0,b.jsx)(t.TooltipContent,{children:f("settings.language")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{ref:o,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===l?(0,b.jsx)(Z.Sun,{className:"h-4 w-4"}):(0,b.jsx)($.Moon,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("settings.theme")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>window.open("https://github.com/jp-liu/tower","_blank","noopener,noreferrer"),className:"text-muted-foreground","aria-label":f("topbar.github")}),children:(0,b.jsx)(a0,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("topbar.github")})]}),(0,b.jsx)("div",{className:"h-4 w-px bg-border"}),(0,b.jsxs)(u.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>y(!0),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("topbar.importProject")]}),(0,b.jsxs)(u.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>w(!0),children:[(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"}),f("topbar.newProject")]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsxs)("button",{className:"ml-0.5 flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1 transition-colors hover:bg-accent",children:[e&&(0,b.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:e}),(0,b.jsx)(ar,{className:"h-7 w-7 ring-1 ring-border",children:(0,b.jsx)(as,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:e?e.trim().split(/\s+/).filter(a=>a.length>0).slice(0,2).map(a=>a[0].toUpperCase()).join(""):"U"})})]})}),(0,b.jsx)(q.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,b.jsxs)(q.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,b.jsx)(V.Settings,{className:"mr-2 h-3.5 w-3.5"}),f("settings.title")]})})]})]})]}),(0,b.jsx)(aE,{open:r,onOpenChange:s}),(0,b.jsx)(aW,{open:v,onOpenChange:a=>{w(a),a||B(!1)},onCreateProject:a}),(0,b.jsx)(a_,{open:x,onOpenChange:a=>{y(a),a||C(!1)},onCreateProject:a})]})}var a2=a.i(347872),a3=a.i(595999),a4=a.i(431670),a5=a.i(969032),a6=a.i(442620);let a7=(0,a5.default)(async()=>{},{loadableGenerated:{modules:[103363]},ssr:!1});function a8({mode:a}){let{isOpen:d,closeAssistant:e,sessions:f,activeSessionId:j,createNewSession:k,switchSession:l,removeSession:m,renameSession:n}=aL(),{t:o}=(0,F.useI18n)(),[p,r]=(0,c.useState)(null),[t,w]=(0,c.useState)(""),x=()=>{r(null),w("")},y=()=>{p&&t.trim()&&(n(p.id,t),x())},z=f.find(a=>a.id===j),A=z?.title??o("assistant.newSession");return(0,b.jsxs)("div",{className:"sidebar"===a?"min-w-[320px] max-w-[480px] w-[30vw] shrink-0 border-r border-border flex flex-col bg-sidebar overflow-hidden":"flex flex-col h-full overflow-hidden",children:[(0,b.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,b.jsx)(Y,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:o("assistant.title")}),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsxs)(q.DropdownMenuTrigger,{className:"flex items-center gap-1 h-8 px-2 rounded-md text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground max-w-[120px] truncate","aria-label":o("assistant.sessionList"),children:[(0,b.jsx)("span",{className:"truncate",children:A}),(0,b.jsx)(a6.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,b.jsxs)(q.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,className:"w-[280px]",children:[0===f.length?(0,b.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:o("assistant.noSessions")}):f.map(a=>(0,b.jsxs)(q.DropdownMenuItem,{className:"flex items-center justify-between gap-1 pr-1",onClick:()=>l(a.id),children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs truncate",children:a.title}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`}(a.updatedAt)})]}),(0,b.jsx)(u.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100",onClick:b=>{var c;b.stopPropagation(),r({id:a.id,title:c=a.title}),w(c)},"aria-label":o("assistant.renameSession"),children:(0,b.jsx)(h.Pencil,{className:"h-3 w-3"})}),(0,b.jsx)(u.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:b=>{b.stopPropagation(),m(a.id)},"aria-label":o("assistant.deleteSession"),children:(0,b.jsx)(i.Trash2,{className:"h-3 w-3"})})]},a.id)),f.length>0&&(0,b.jsx)(q.DropdownMenuSeparator,{}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:k,children:[(0,b.jsx)(g.Plus,{className:"h-3 w-3 mr-1"}),(0,b.jsx)("span",{className:"text-xs",children:o("assistant.newSession")})]})]})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:k,"aria-label":o("assistant.newSession"),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:e,"aria-label":o("assistant.closeLabel"),children:(0,b.jsx)(ax.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:d?(0,b.jsx)(a7,{}):null}),(0,b.jsx)(s.Dialog,{open:null!==p,onOpenChange:a=>{a||x()},children:(0,b.jsxs)(s.DialogContent,{children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:o("assistant.renameSessionTitle")})}),(0,b.jsx)(v.Input,{autoFocus:!0,value:t,onChange:a=>w(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),y())},placeholder:o("assistant.renameSessionPlaceholder")}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:x,children:o("common.cancel")}),(0,b.jsx)(u.Button,{onClick:y,disabled:!t.trim(),children:o("common.save")})]})]})})]})}var a9=a.i(190076);function ba({onDismiss:a}){let{t:d}=(0,F.useI18n)(),[e,f]=(0,c.useState)(!1);(0,c.useEffect)(()=>{},[]);let g=async()=>{"default"!==await window.Notification.requestPermission()&&(f(!1),a?.())};return e?(0,b.jsxs)("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-[9999] w-auto max-w-lg bg-card border rounded-lg shadow-lg px-4 py-2.5 flex items-center gap-3 animate-in fade-in slide-in-from-top-4 duration-500",children:[(0,b.jsx)(a9.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,b.jsx)("span",{className:"flex-1 text-sm",children:d("notification.permissionPrompt")}),(0,b.jsx)(u.Button,{size:"default",onClick:g,children:d("notification.allow")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"default",onClick:()=>{f(!1),a?.()},children:d("notification.dismiss")})]}):null}a.i(328535);var bb=a.i(641023);let bc=[{target:"create-workspace",titleKey:"tour.step1.title",descKey:"tour.step1.desc",placement:"right"},{target:"create-project",titleKey:"tour.step2.title",descKey:"tour.step2.desc",placement:"bottom",waitForTarget:!0},{target:"open-assistant",titleKey:"tour.step3.title",descKey:"tour.step3.desc",placement:"bottom"}];function bd({onComplete:a}){let{t:d}=(0,F.useI18n)(),[e,f]=(0,c.useState)(0),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(!1),k=(0,c.useRef)(null),l=bc[e],m=(0,c.useCallback)(async()=>{await (0,bb.setConfigValue)("onboarding.tourCompleted",!0),a()},[a]),n=(0,c.useCallback)(()=>l?document.querySelector(`[data-tour="${l.target}"]`):null,[l]),o=(0,c.useCallback)(()=>{let a=n();a?(h(a.getBoundingClientRect()),j(!0)):j(!1)},[n]);(0,c.useEffect)(()=>{o();let a=null;!i&&l?.waitForTarget&&(k.current=new MutationObserver(()=>{let b=n();b&&(h(b.getBoundingClientRect()),j(!0),k.current?.disconnect(),a&&clearTimeout(a))}),k.current.observe(document.body,{childList:!0,subtree:!0}),a=setTimeout(()=>{!n()&&(f(a=>{let b=a+1;return b<bc.length?b:a}),e>=bc.length-1&&m())},5e3));let b=()=>o();return window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{k.current?.disconnect(),a&&clearTimeout(a),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[e,l,n,o,i,m]),(0,c.useEffect)(()=>{let a=setInterval(o,1e3);return()=>clearInterval(a)},[o]);let p=(0,c.useCallback)(()=>{e<bc.length-1?(f(a=>a+1),j(!1)):m()},[e]);return l?(0,b.jsx)(b.Fragment,{children:i&&g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
|
|
1
|
+
module.exports=[976268,a=>{"use strict";let b=(0,a.i(711796).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);a.s(["default",0,b])},607884,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(634910),f=a.i(607219),g=a.i(774881),h=a.i(690251),i=a.i(975231),j=a.i(336771),k=a.i(91756),l=a.i(881107),m=a.i(350739),n=a.i(347165),o=a.i(711796);let p=(0,o.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var q=a.i(335732),r=a.i(269876),s=a.i(814574),t=a.i(785259),u=a.i(699570),v=a.i(866718),w=a.i(780410);let x=(0,w.createServerReference)("4000fd33b002f8f107377429f338f6aaddba6b48e7",w.callServer,void 0,w.findSourceMapURL,"createWorkspace"),y=(0,w.createServerReference)("60195d33c3642b0391d36a40f9be713c837345bcdc",w.callServer,void 0,w.findSourceMapURL,"updateWorkspace"),z=(0,w.createServerReference)("401aa0045164b9aaa0699a7eb6df980f436dc0edfe",w.callServer,void 0,w.findSourceMapURL,"deleteWorkspace"),A=(0,w.createServerReference)("40fe67db1340e8da26e398b83a4596e60c17915573",w.callServer,void 0,w.findSourceMapURL,"reorderWorkspaces");var B=a.i(771061);let C=(0,w.createServerReference)("40787eafcd84a6469dab06156a248a9fe75248326d",w.callServer,void 0,w.findSourceMapURL,"createLabel"),D=(0,w.createServerReference)("4010642c30732cf2c92871a2410bf6c83ad967b50d",w.callServer,void 0,w.findSourceMapURL,"deleteLabel");var E=a.i(258815),F=a.i(951192),G=a.i(952313),H=a.i(643228),I=a.i(859103),J=a.i(514126);let K=["📋","🚀","🎯","💡","🔧","📦","🎨","📊","🔬","🌟","📝","🏗️"];function L({workspaces:a}){let h,i=(0,d.useRouter)(),j=(0,d.usePathname)(),{t:l}=(0,F.useI18n)(),[o,q]=(0,c.useState)(!1);(0,c.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&q(!0)},[]);let[s,v]=(0,c.useState)(!1),[w,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[J,O]=(0,c.useState)(null),[Q,R]=(0,c.useState)(""),[S,T]=(0,c.useState)(K[0]),[U,V]=(0,c.useState)(null),[W,X]=(0,c.useState)(a);(0,c.useEffect)(()=>{X(a)},[a]);let Y=(0,H.useSensors)((0,H.useSensor)(H.PointerSensor,{activationConstraint:{distance:8}})),Z=(0,c.useCallback)(b=>{let{active:c,over:d}=b;if(!d||c.id===d.id)return;let e=W.findIndex(a=>a.id===c.id),f=W.findIndex(a=>a.id===d.id);if(-1===e||-1===f)return;let g=(0,I.arrayMove)(W,e,f);X(g),A(g.map(a=>a.id)).then(()=>i.refresh()).catch(()=>{X(a),G.toast.error(l("sidebar.reorderError"))})},[W,a,i,l]),$=j.split("/workspaces/")[1]?.split("/")[0],_=(0,c.useCallback)(a=>{if($===a)return;let b=(0,E.getLastProjectId)(a);i.push(b?`/workspaces/${a}?projectId=${b}`:`/workspaces/${a}`)},[$,i]),aa=(0,c.useCallback)(()=>{q(a=>{let b=!a;return localStorage.setItem("sidebar-collapsed",String(b)),b})},[]),ab=(0,c.useCallback)(async()=>{if(!Q.trim())return;let a=await x({name:Q.trim(),description:S});R(""),T(K[0]),v(!1),i.refresh(),i.push(`/workspaces/${a.id}`)},[Q,S,i]),ac=(0,c.useCallback)(async()=>{Q.trim()&&U&&(await y(U,{name:Q.trim(),description:S}),R(""),B(!1),V(null),i.refresh())},[Q,S,U,i]),ad=(0,c.useCallback)(a=>{V(a.id),R(a.name),T(a.description&&K.includes(a.description)?a.description:K[0]),B(!0)},[]),ae=(0,c.useCallback)(async(b,c)=>{if(a.length<=1)return void G.toast.error(l("sidebar.lastWorkspaceError"));if(confirm(l("sidebar.deleteConfirm",{name:c})))try{await z(b),i.refresh(),$===b&&i.push("/workspaces")}catch{G.toast.error(l("sidebar.lastWorkspaceError"))}},[$,i,l,a.length]),af=(0,c.useCallback)(a=>{O(a),D(!0)},[]),ag=a=>a.description&&K.includes(a.description)?a.description:a.name.charAt(0).toUpperCase();if(o){let c;return(0,b.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:aa,className:"mb-4 flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 ring-1 ring-primary/20 transition-transform hover:scale-105"}),children:(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.expand")})]}),(0,b.jsx)(r.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[a.map(a=>{let c=$===a.id,d=ag(a);return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>_(a.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${c?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:K.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold",children:d})})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:a.name})]},a.id)}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{"data-tour":"create-workspace",onClick:()=>v(!0),className:"flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"}),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.newWorkspace")})]})]})}),(0,b.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===j?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(p,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("missions.navLabel")})]}),(c=$||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/notes`),className:`rounded-lg p-2 transition-colors ${j.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(m.FileText,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.notes")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/assets`),className:`rounded-lg p-2 transition-colors ${j.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(n.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.assets")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/archive`),className:`rounded-lg p-2 transition-colors ${j.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(f.Archive,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.archive")})]})]}):null]}),(0,b.jsx)(N,{open:s,onOpenChange:v,title:l("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:ab,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")})]})}return(0,b.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,b.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,b.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-xs",onClick:aa,className:"text-muted-foreground",title:l("sidebar.collapse"),children:(0,b.jsx)(k.ChevronsLeft,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:l("sidebar.workspace")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{R(""),T(K[0]),v(!0)},title:l("sidebar.newWorkspace"),children:(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)(r.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,b.jsx)("div",{className:"px-2 py-1",children:(0,b.jsx)(H.DndContext,{id:"workspace-sidebar",sensors:Y,collisionDetection:H.closestCenter,onDragEnd:Z,children:(0,b.jsx)(I.SortableContext,{items:W.map(a=>a.id),strategy:I.verticalListSortingStrategy,children:W.map(a=>(0,b.jsx)(M,{ws:a,isActive:$===a.id,icon:ag(a),disableDelete:W.length<=1,t:l,onSelect:()=>_(a.id),onEdit:()=>ad(a),onManageLabels:()=>af(a.id),onDelete:()=>ae(a.id,a.name)},a.id))})})})}),(0,b.jsxs)(e.default,{href:"/missions",className:`relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] cursor-pointer transition-colors ${"/missions"===j?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(p,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("missions.navLabel")})]}),(h=$||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.default,{href:`/workspaces/${h}/notes`,className:"relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(m.FileText,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.notes")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/assets`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.assets")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/archive`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(f.Archive,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.archive")})]})]}):null,(0,b.jsx)(N,{open:s,onOpenChange:v,title:l("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:ab,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),(0,b.jsx)(N,{open:w,onOpenChange:a=>{B(a),a||V(null)},title:l("workspace.edit"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:ac,submitLabel:l("common.save"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),J&&(0,b.jsx)(P,{open:C,onOpenChange:a=>{D(a),a||O(null)},workspaceId:J})]})}function M({ws:a,isActive:c,icon:d,disableDelete:e,t:f,onSelect:g,onEdit:k,onManageLabels:m,onDelete:n}){var o;let p,r,s,{attributes:t,listeners:u,setNodeRef:v,transform:w,transition:x,isDragging:y}=(0,I.useSortable)({id:a.id}),z={transform:J.CSS.Transform.toString(w),transition:x,opacity:y?.4:1};return(0,b.jsxs)("div",{ref:v,style:z,...t,...u,className:`group relative flex touch-none items-center rounded-lg transition-all ${c?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,b.jsxs)("button",{onClick:g,className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${c?"cursor-default":"cursor-pointer"}`,children:[(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:K.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:d})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:`truncate text-sm font-medium ${c?"text-foreground":"text-secondary-foreground"}`,children:a.name}),(0,b.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(o=a.updatedAt,r=Math.floor((p=Date.now()-new Date(o).getTime())/6e4),s=Math.floor(p/36e5),r<60?`${r}m ago`:s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`)})]})]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"mr-2 rounded-md p-1 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:a=>a.stopPropagation()}),children:(0,b.jsx)(j.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,b.jsxs)(q.DropdownMenuContent,{align:"start",side:"right",children:[(0,b.jsxs)(q.DropdownMenuItem,{onClick:k,children:[(0,b.jsx)(h.Pencil,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.rename")]}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:m,children:[(0,b.jsx)(l.Tag,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.manageLabels")]}),(0,b.jsxs)(q.DropdownMenuItem,{className:e?"text-muted-foreground opacity-50":"text-rose-400",disabled:e,onClick:n,children:[(0,b.jsx)(i.Trash2,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.delete")]})]})]})]})}function N({open:a,onOpenChange:c,title:d,name:e,onNameChange:f,icon:g,onIconChange:h,onSubmit:i,submitLabel:j,nameLabel:k,iconLabel:l,namePlaceholder:m,cancelLabel:n}){return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:c,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:d})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k}),(0,b.jsx)(v.Input,{placeholder:m,value:e,onChange:a=>f(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:l}),(0,b.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:K.map(a=>(0,b.jsx)("button",{onClick:()=>h(a),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${g===a?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:a},a))})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>c(!1),children:n}),(0,b.jsx)(u.Button,{onClick:i,disabled:!e.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:j})]})]})})}let O=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function P({open:a,onOpenChange:d,workspaceId:e}){let{t:f}=(0,F.useI18n)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(O[0]);(0,c.useEffect)(()=>{a&&(0,B.getLabelsForWorkspace)(e).then(h)},[a,e]);let m=async()=>{i.trim()&&(await C({name:i.trim(),color:k,workspaceId:e}),h(await (0,B.getLabelsForWorkspace)(e)),j(""))},n=async a=>{await D(a),h(b=>b.filter(b=>b.id!==a))};return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:d,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("label.manage")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[g.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:a.color}}),(0,b.jsx)("span",{className:"flex-1 text-sm text-foreground",children:a.name}),a.isBuiltin?(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:f("label.builtin")}):(0,b.jsx)("button",{onClick:()=>n(a.id),className:"text-xs text-rose-400 hover:text-rose-300",children:f("common.delete")})]},a.id)),(0,b.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("label.name"),value:i,onChange:a=>j(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"flex-1 h-8"}),(0,b.jsx)(u.Button,{size:"sm",onClick:m,disabled:!i.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("label.add")})]}),(0,b.jsx)("div",{className:"mt-2 flex gap-1.5",children:O.map(a=>(0,b.jsx)("button",{onClick:()=>l(a),className:`h-5 w-5 rounded-full transition-all ${k===a?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:a}},a))})]})]})]})})}a.i(423993);var Q=a.i(267654),R=a.i(818862);let S=(0,R.create)(a=>({createProjectOpen:!1,importProjectOpen:!1,setCreateProjectOpen:b=>a({createProjectOpen:b}),setImportProjectOpen:b=>a({importProjectOpen:b})}));var T=a.i(940271),U=a.i(573242),V=a.i(369289);let W=(0,o.default)("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);var X=a.i(851378);let Y=(0,o.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var Z=a.i(761052),$=a.i(86354);a.s([],516474),a.i(516474);var _=a.i(213200),aa=a.i(862306);let ab=c.createContext(void 0);function ac(){let a=c.useContext(ab);if(void 0===a)throw Error((0,aa.default)(13));return a}let ad={imageLoadingStatus:()=>null},ae=c.forwardRef(function(a,d){let{className:e,render:f,...g}=a,[h,i]=c.useState("idle"),j=c.useMemo(()=>({imageLoadingStatus:h,setImageLoadingStatus:i}),[h,i]),k=(0,_.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:d,props:g,stateAttributesMapping:ad});return(0,b.jsx)(ab.Provider,{value:j,children:k})});var af=a.i(74686),ag=a.i(830067),ah=a.i(398312),ai=a.i(380562),aj=a.i(904531),ak=a.i(535011);let al={...ad,...ai.transitionStatusMapping},am=c.forwardRef(function(a,b){let{className:d,render:e,onLoadingStatusChange:f,referrerPolicy:g,crossOrigin:h,...i}=a,j=ac(),k=function(a,{referrerPolicy:b,crossOrigin:d}){let[e,f]=c.useState("idle");return(0,ag.useIsoLayoutEffect)(()=>{if(!a)return f("error"),ak.NOOP;let c=!0,e=new window.Image,g=a=>()=>{c&&f(a)};return f("loading"),e.onload=g("loaded"),e.onerror=g("error"),b&&(e.referrerPolicy=b),e.crossOrigin=d??null,e.src=a,()=>{c=!1}},[a,d,b]),e}(a.src,{referrerPolicy:g,crossOrigin:h}),l="loaded"===k,{mounted:m,transitionStatus:n,setMounted:o}=(0,aj.useTransitionStatus)(l),p=c.useRef(null),q=(0,af.useStableCallback)(a=>{f?.(a),j.setImageLoadingStatus(a)});(0,ag.useIsoLayoutEffect)(()=>{"idle"!==k&&q(k)},[k,q]),(0,ah.useOpenChangeComplete)({open:l,ref:p,onComplete(){l||o(!1)}});let r=(0,_.useRenderElement)("img",a,{state:{imageLoadingStatus:k,transitionStatus:n},ref:[b,p],props:i,stateAttributesMapping:al,enabled:m});return m?r:null});var an=a.i(102934);let ao=c.forwardRef(function(a,b){let{className:d,render:e,delay:f,...g}=a,{imageLoadingStatus:h}=ac(),[i,j]=c.useState(void 0===f),k=(0,an.useTimeout)();return c.useEffect(()=>(void 0!==f&&k.start(f,()=>j(!0)),k.clear),[k,f]),(0,_.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:b,props:g,stateAttributesMapping:ad,enabled:"loaded"!==h&&i})});a.s(["Fallback",0,ao,"Image",0,am,"Root",0,ae],991134);var ap=a.i(991134),ap=ap,aq=a.i(368114);function ar({className:a,size:c="default",...d}){return(0,b.jsx)(ap.Root,{"data-slot":"avatar","data-size":c,className:(0,aq.cn)("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",a),...d})}function as({className:a,...c}){return(0,b.jsx)(ap.Fallback,{"data-slot":"avatar-fallback",className:(0,aq.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",a),...c})}let at=(0,o.default)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);var au=a.i(577565);let av=(0,o.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),aw=(0,o.default)("package-2",[["path",{d:"M12 3v6",key:"1holv5"}],["path",{d:"M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z",key:"187q7i"}],["path",{d:"M3.054 9.013h17.893",key:"grwhos"}]]);var ax=a.i(54384);let ay=(0,w.createServerReference)("601729ed0bad968a41393fe90d428239c654b0709c",w.callServer,void 0,w.findSourceMapURL,"globalSearch");var az=a.i(526385);let aA=[{id:"all",key:"search.all",icon:U.Search},{id:"task",key:"search.task",icon:m.FileText},{id:"project",key:"search.project",icon:at},{id:"repository",key:"search.repository",icon:au.GitBranch},{id:"note",key:"search.note",icon:av},{id:"asset",key:"search.asset",icon:aw}],aB=["task","project","repository","note","asset"],aC={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function aD({result:a,onSelect:c}){let d=aA.find(b=>b.id===a.type)?.icon??m.FileText;return(0,b.jsxs)("button",{onClick:()=>c(a),className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-3 text-left transition-colors hover:bg-accent last:border-b-0",children:[(0,b.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,b.jsx)(d,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:a.title}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:a.subtitle}),a.snippet&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:a.snippet})]})]})}function aE({open:a,onOpenChange:e}){let f,{t:g}=(0,F.useI18n)(),h=(0,d.useRouter)(),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)("all"),[m,n]=(0,c.useState)([]),[o,p]=(0,c.useState)(!1),[q,t]=(0,c.useState)(250),v=(0,c.useRef)(null),w=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&((0,az.getConfigValue)("search.debounceMs",250).then(t),setTimeout(()=>v.current?.focus(),100),j(""),n([]))},[a]),(0,c.useEffect)(()=>{if(w.current&&clearTimeout(w.current),!i.trim()){n([]),p(!1);return}p(!0);let a=!1;return w.current=setTimeout(async()=>{let b=await ay(i,k);a||(n(b),p(!1))},q),()=>{w.current&&clearTimeout(w.current),a=!0}},[i,k,q]);let x=(0,c.useCallback)(a=>{h.push(a.navigateTo),e(!1)},[h,e]);return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:e,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,b.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,b.jsx)(U.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,b.jsx)("input",{ref:v,value:i,onChange:a=>j(a.target.value),placeholder:g("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),i&&(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>{j(""),n([])},className:"text-muted-foreground",children:(0,b.jsx)(ax.X,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:aA.map(a=>{let c=a.icon;return(0,b.jsxs)("button",{onClick:()=>l(a.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${k===a.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,b.jsx)(c,{className:"h-3 w-3"}),g(a.key)]},a.id)})}),(0,b.jsxs)(r.ScrollArea,{className:"max-h-80",children:[!i.trim()&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.typeToSearch")}),i.trim()&&0===m.length&&!o&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.noResults")}),"all"===k&&m.length>0&&(f=m.reduce((a,b)=>((a[b.type]??=[]).push(b),a),{}),aB.filter(a=>f[a]?.length).map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:g(aC[a])}),f[a].map(a=>(0,b.jsx)(aD,{result:a,onSelect:x},`${a.type}-${a.id}`))]},a))),"all"!==k&&m.map(a=>(0,b.jsx)(aD,{result:a,onSelect:x},`${a.type}-${a.id}`))]})]})})}function aF(a){}let aG=(0,c.createContext)(null);function aH(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}let aI="assistant-attachment-cache";function aJ(a,b,c){try{let d=sessionStorage.getItem(aI),e=d?JSON.parse(d):{};e[a]||(e[a]={}),e[a][b]=c,sessionStorage.setItem(aI,JSON.stringify(e))}catch{}}function aK({children:a}){let[d,e]=(0,c.useState)(!1),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)("sidebar"),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)("idle"),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)([]),s=(0,c.useRef)(null),t=(0,c.useRef)(null),[u,v]=(0,c.useState)([]),[w,x]=(0,c.useState)(null),y=(0,c.useRef)(!1),z=(0,c.useCallback)(()=>{m([...r.current])},[]),A=(0,c.useCallback)(async()=>{i("dialog"===await (0,az.getConfigValue)("assistant.displayMode","sidebar")?"dialog":"sidebar")},[]);(0,c.useEffect)(()=>{A()},[A]);let B=(0,c.useCallback)(async()=>{v([])},[]),C=(0,c.useCallback)(async a=>{q(!0);try{let b=await fetch(`/api/internal/assistant/sessions?sessionId=${encodeURIComponent(a)}`);if(!b.ok)return;let c=await b.json();if(Array.isArray(c.messages)){r.current=c.messages;let b=function(a){try{let b=sessionStorage.getItem(aI);if(!b)return{};return JSON.parse(b)[a]??{}}catch{return{}}}(a);if(Object.keys(b).length>0){let a=0;r.current=r.current.map(c=>{if("user"===c.role){let d=b[a];if(a++,d?.length)return{...c,attachmentFilenames:d}}return c})}m([...r.current])}}catch{}finally{q(!1)}},[]);(0,c.useEffect)(()=>{B()},[B,C]);let D=(0,c.useCallback)(()=>{t.current?.abort(),s.current=null,y.current=!1,x(null),aF(null),r.current=[],m([]),o("idle")},[]),E=(0,c.useCallback)(a=>{t.current?.abort(),s.current=a,y.current=!0,x(a),aF(a),r.current=[],m([]),o("idle"),C(a)},[C]),F=(0,c.useCallback)(a=>{v([]),w===a&&D()},[w,D]),G=(0,c.useCallback)((a,b)=>{b.trim()&&v([])},[]),H=(0,c.useCallback)(async()=>{g(!0);try{await A(),e(!0)}finally{g(!1)}},[A]),I=(0,c.useCallback)(()=>{e(!1),t.current?.abort()},[]),J=(0,c.useCallback)(()=>{d||f?I():H()},[d,f,I,H]);(0,Q.useActionShortcut)("global.assistant",()=>J());let K=(0,c.useCallback)(async(a,b)=>{if(!a.trim()&&!b?.attachmentFilenames?.length)return;t.current?.abort();let c=new AbortController;t.current=c;let d=0!==r.current.length||y.current?null:a,e=aH();if(r.current=[...r.current,{id:aH(),role:"user",content:a,attachmentFilenames:b?.attachmentFilenames?.length?b.attachmentFilenames:void 0},{id:e,role:"thinking",content:"",isStreaming:!0}],z(),b?.attachmentFilenames?.length&&s.current){let a=r.current.filter(a=>"user"===a.role).length-1;aJ(s.current,a,b.attachmentFilenames)}o("connecting");let f=null;try{let g=await fetch("/api/internal/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,sessionId:s.current,attachmentFilenames:b?.attachmentFilenames??[]}),signal:c.signal});if(!g.ok||!g.body)throw Error(`HTTP ${g.status}`);o("streaming");let h=g.body.getReader(),i=new TextDecoder,j="";for(;;){let{done:a,value:c}=await h.read();if(a)break;let g=(j+=i.decode(c,{stream:!0})).split("\n");for(let a of(j=g.pop()??"",g)){let c;if(a.startsWith("data: ")){try{c=JSON.parse(a.slice(6).trim())}catch{continue}if(c.sessionId){let a=s.current;if(s.current=c.sessionId,d&&!y.current&&c.sessionId!==a){y.current=!0;new Date().toISOString();c.sessionId,function(a){let b=a.trim();b&&b.length>30&&b.slice(0,30)}(d),v([]),x(c.sessionId),aF(c.sessionId),b?.attachmentFilenames?.length&&aJ(c.sessionId,0,b.attachmentFilenames)}}switch(c.type){case"text_delta":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:a.content+(c.content??""),isStreaming:!0}:a):(f=aH(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"text":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:c.content??a.content,isStreaming:!0}:a):(f=aH(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"tool_start":{let a=r.current.filter(a=>a.id!==e);f?(r.current=a.map(a=>a.id===f?{...a,isStreaming:!1}:a),f=null):r.current=a,r.current=[...r.current,{id:aH(),role:"tool",content:`Calling ${c.content??"tool"}...`,toolName:c.content,isStreaming:!0}],z();break}case"tool_use":{let a=r.current.filter(a=>a.id!==e),b=f?a.map(a=>a.id===f?{...a,isStreaming:!1}:a):a;f=null,r.current=[...b,{id:aH(),role:"tool",content:JSON.stringify(c.toolInput??{},null,2),toolName:c.content}],z();break}case"tool_result":r.current=[...r.current,{id:aH(),role:"tool",content:String(c.toolOutput??""),toolName:`${c.content??"tool"} (result)`}],z();break;case"error":r.current=[...r.current.filter(a=>a.id!==e),{id:aH(),role:"assistant",content:`Error: ${c.content??"Unknown error"}`}],z(),o("error");break;case"done":f&&(r.current=r.current.map(a=>a.id===f?{...a,isStreaming:!1}:a)),r.current=r.current.filter(a=>a.id!==e),z(),o("idle")}}}}r.current=r.current.filter(a=>a.id!==e),z(),o(a=>"streaming"===a?"idle":a),B()}catch(a){if("AbortError"===a.name)return;r.current=[...r.current.filter(a=>a.id!==e),{id:aH(),role:"assistant",content:`Connection error: ${a.message??"Unknown error"}`}],z(),o("error")}},[z,B]),L=(0,c.useCallback)(()=>{t.current?.abort(),t.current=null;let a=[...r.current].reverse().find(a=>"user"===a.role),b=a?.content??null;if(a){let b=r.current.lastIndexOf(a);r.current=r.current.slice(0,b),m([...r.current])}return o("idle"),b},[]),M=l[l.length-1],N="connecting"===n||"streaming"===n||M?.role==="thinking"&&!0===M.isStreaming;return(0,b.jsx)(aG.Provider,{value:{isOpen:d,isStarting:f,displayMode:h,worktreePath:j,toggleAssistant:J,closeAssistant:I,chatMessages:l,chatStatus:n,isChatThinking:N,isLoadingHistory:p,sendChatMessage:K,cancelChat:L,sessions:u,activeSessionId:w,createNewSession:D,switchSession:E,removeSession:F,renameSession:G,refreshSessions:B},children:a})}function aL(){let a=(0,c.useContext)(aG);if(!a)throw Error("useAssistant must be used within an AssistantProvider");return a}var aM=a.i(704494),aN=a.i(668116),aO=a.i(616335),aP=a.i(394259),aQ=a.i(487410),aR=a.i(429246);function aS(a){return a.replace(/\.git\/?$/,"")}a.i(446786),a.i(814747);let aT=(0,w.createServerReference)("404e7cc0e8e3765926dd1f7911020f0d67988d9696",w.callServer,void 0,w.findSourceMapURL,"resolveGitLocalPathWithSource");var aU=a.i(714096),aV=a.i(43775);function aW({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,F.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("empty"),[A,B]=(0,c.useState)("FRONTEND"),[C,D]=(0,c.useState)("idle"),[E,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(!1),M=()=>{i(""),k(""),m(""),p(""),r(""),x(!1),z("empty"),B("FRONTEND"),D("idle"),H(""),J(!1)},N=async()=>{if(q.trim()&&!I&&"success"===C){J(!0);try{let a=await (0,aU.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{G.toast.error(f("project.analyzeError"))}finally{J(!1)}}},O=async a=>{p(a),D("idle"),H("");let b=function(a){let b,c=a.match(/^git@([^:]+):(.+)$/);if(c)return{host:c[1],pathSegments:aS(c[2]).split("/").filter(Boolean)};try{b=new URL(a)}catch{return null}return{host:b.hostname,pathSegments:aS(decodeURIComponent(b.pathname)).split("/").filter(Boolean)}}(a);if(b&&b.pathSegments.length>0&&i(b.pathSegments[b.pathSegments.length-1]),!w){let{path:b,source:c}=await aT(a);r(b),z(c)}},P=async()=>{if(o.trim()&&q.trim()){D("cloning"),H("");try{let a=function(a){let b=a.trim();if(!b)return"";if(b.startsWith("git@")||b.startsWith("ssh://")||b.endsWith(".git"))return b;try{let a=new URL(b),c=a.hostname,d=decodeURIComponent(a.pathname).split("/").filter(Boolean);if("code.iflytek.com"===c){let a=[...d];"osc"===a[0]&&"_source"===a[1]&&(a=a.slice(2));let e=a.indexOf("-");if(e>0&&(a=a.slice(0,e)),0===a.length)return b;return`https://${c}/${a.join("/")}.git`}return`${a.origin}${a.pathname.replace(/\/$/,"")}.git`}catch{return b}}(o.trim()),b=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:a,path:q.trim()})}),c=await b.json();if(!b.ok){D("error"),H(c.error||"Clone failed");return}D("success")}catch{D("error"),H("Network error")}}},Q=async()=>{h.trim()&&(await e?.({name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:A}),M(),d(!1))};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||M()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.gitUrlHint")}),(0,b.jsx)(v.Input,{placeholder:f("project.gitPlaceholder"),value:o,onChange:a=>O(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.localPathHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("project.localPathPlaceholder"),value:q,onChange:a=>{r(a.target.value),x(!0)},className:"flex-1 min-w-0 font-mono text-xs"}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"outline",onClick:()=>L(!0),className:"shrink-0 gap-1.5 px-2.5 text-xs text-muted-foreground"}),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:f("folder.browse")})]}),(0,b.jsx)(t.TooltipContent,{children:f("folder.selectFolder")})]})]}),q.trim().startsWith("~")&&(0,b.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),f("project.tildeWarning")]}),!w&&"fallback"===y&&o.trim()&&q.trim()&&(0,b.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-muted-foreground",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3 shrink-0"}),f("project.gitPathFallbackHint")]}),o.trim()&&q.trim()&&(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{type:"button",disabled:"cloning"===C||"success"===C,onClick:P,className:"gap-1.5 text-xs bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/25 hover:bg-emerald-500/25 disabled:opacity-50",children:["cloning"===C?(0,b.jsx)(aM.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===C?(0,b.jsx)(aN.Check,{className:"h-3 w-3"}):(0,b.jsx)(au.GitBranch,{className:"h-3 w-3"}),"cloning"===C?f("git.cloning"):"success"===C?f("git.cloned"):f("git.clone")]}),"error"===C&&(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),E]}),"success"===C&&(0,b.jsx)("span",{className:"text-[11px] text-emerald-400",children:f("git.cloneSuccess")})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(aQ.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:A,onChange:B})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:N,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q.trim()||I?"opacity-50":""}`}),children:[I?(0,b.jsx)(aM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aP.Sparkles,{className:"h-3 w-3"}),I?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q.trim()?"success"!==C?f("project.genDescNotCloned"):f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aR.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),M()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:Q,disabled:!h.trim()||I,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:f("common.create")})]})]})}),(0,b.jsx)(aV.FolderBrowserDialog,{open:K,onOpenChange:L,onSelect:a=>{if(r(a),x(!0),!h.trim()){let b=a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";b&&i(b)}}})]})}var aX=a.i(976268),aX=aX,aY=a.i(563658);let aZ=(0,w.createServerReference)("403c3eb99fad3fed76d481d40f018e89b581ec53ea",w.callServer,void 0,w.findSourceMapURL,"resolveGitLocalPath"),a$=(0,w.createServerReference)("60e24e764bbd4747cf07763092c8c9e7d893ae14c3",w.callServer,void 0,w.findSourceMapURL,"migrateProjectPath"),a_=(0,w.createServerReference)("40197cd678ef6a311b1ffba1e86ba4f15bd16fd63b",w.callServer,void 0,w.findSourceMapURL,"checkMigrationSafety");function a0({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,F.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("FRONTEND"),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[E,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(""),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(!1),[Q,R]=(0,c.useState)(!1),S=()=>{i(""),k(""),m(""),p(""),r(""),z("FRONTEND"),B(!1),D(!1),H(""),J(!1),L(""),N(""),P(!1),R(!1)},T=async a=>{r(a),B(!1),D(!1),H(""),L(""),N(""),P(!1),i(a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"");try{let b=await fetch(`/api/git?path=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();if(a.isGit&&a.remoteUrl){p(a.remoteUrl),B(!0);let b=a.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);b&&i(b[1])}}}catch{}},U=(0,c.useCallback)(async a=>{if(D(a),L(""),N(""),P(!1),!a)return void H("");if(o)try{let a=await aZ(o);a&&(H(a),a===q&&P(!0))}catch{}if(q)try{let a=await fetch(`/api/git?path=${encodeURIComponent(q)}&checkWorktrees=true`);a.ok&&(await a.json()).hasWorktrees&&N(f("project.worktreeWarning"))}catch{}},[o,q]),V=async()=>{if(q&&!Q){R(!0);try{let a=await (0,aU.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{G.toast.error(f("project.analyzeError"))}finally{R(!1)}}},W=async()=>{if(!h.trim())return;let a={name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:y},b=await e?.(a);if(C&&E&&E!==q&&b&&"id"in b){J(!0),L("");try{let a=await a_(b.id);if(!a.safe)return void L(a.reason);let c=await a$(b.id,E);if(!c.success)return void L(c.error??f("project.migrateError"));G.toast.success(f("project.migrateSuccess"))}catch(b){let a=b instanceof Error?b.message:String(b);L(`${f("project.migrateError")}:${a}`);return}finally{J(!1)}}S(),d(!1)},X=!h.trim()||!q.trim()||I||Q||C&&!!M;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||S()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.importProject")})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.importHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{value:q,readOnly:!0,placeholder:f("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,b.jsxs)(u.Button,{type:"button",variant:"outline",onClick:()=>x(!0),className:"shrink-0 gap-1.5",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("folder.browse")]})]}),A&&(0,b.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:f("project.autoDetected")})]}),o&&(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)(v.Input,{value:o,onChange:a=>p(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),A&&q&&(0,b.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs font-medium",children:f("project.migrate")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.migrateHint")})]}),(0,b.jsx)(aY.Switch,{checked:C,onCheckedChange:a=>U(a)})]}),C&&(0,b.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:f("project.targetPath")}),(0,b.jsx)(v.Input,{value:E,onChange:a=>{H(a.target.value),P(a.target.value===q)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),O&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,b.jsx)(aX.default,{className:"h-3 w-3"}),f("project.samePathInfo")]}),M&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),M]}),K&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aO.AlertCircle,{className:"h-3 w-3"}),K]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(aQ.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:y,onChange:z})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:V,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q||Q?"opacity-50":""}`}),children:[Q?(0,b.jsx)(aM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aP.Sparkles,{className:"h-3 w-3"}),Q?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q?f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aR.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),S()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:W,disabled:X,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:I?f("project.migrating"):f("common.create")})]})]})}),(0,b.jsx)(aV.FolderBrowserDialog,{open:w,onOpenChange:x,onSelect:a=>T(a)})]})}function a1({className:a}){return(0,b.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:a,children:(0,b.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12.02c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56v-2c-3.2.7-3.87-1.36-3.87-1.36-.52-1.34-1.27-1.7-1.27-1.7-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.34.96.1-.74.4-1.25.72-1.54-2.56-.29-5.25-1.28-5.25-5.69 0-1.26.45-2.28 1.18-3.09-.12-.29-.51-1.46.11-3.04 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.79 0c2.2-1.49 3.18-1.18 3.18-1.18.62 1.58.23 2.75.11 3.04.74.81 1.18 1.83 1.18 3.09 0 4.42-2.69 5.4-5.25 5.69.41.36.78 1.05.78 2.12v3.14c0 .31.21.68.79.56A11.52 11.52 0 0 0 23.5 12.02C23.5 5.65 18.35.5 12 .5Z"})})}function a2({onCreateProject:a,username:e}){let{t:f,locale:h,setLocale:i}=(0,F.useI18n)(),{isOpen:j,toggleAssistant:k}=aL(),{resolvedTheme:l,toggleTheme:m,triggerRef:o}=function(){let{resolvedTheme:a,setTheme:b}=(0,T.useTheme)(),d=(0,c.useRef)(null),e=(0,c.useCallback)(c=>{let d="dark"===a?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let a=c?.clientX??window.innerWidth/2,e=c?.clientY??0,f=Math.hypot(Math.max(a,window.innerWidth-a),Math.max(e,window.innerHeight-e));document.startViewTransition(()=>{b(d)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${a}px ${e}px)`,`circle(${f}px at ${a}px ${e}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else b(d)},[a,b]);return{resolvedTheme:a,toggleTheme:e,triggerRef:d}}(),p=(0,d.useRouter)(),[r,s]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!1);(0,Q.useActionShortcut)("global.search",()=>s(!0));let z=S(a=>a.createProjectOpen),A=S(a=>a.importProjectOpen),B=S(a=>a.setCreateProjectOpen),C=S(a=>a.setImportProjectOpen);return(0,c.useEffect)(()=>{z&&w(!0)},[z]),(0,c.useEffect)(()=>{A&&y(!0)},[A]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"w-40"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{variant:"outline",onClick:()=>s(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,b.jsx)(U.Search,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:f("topbar.searchPlaceholder")}),(0,b.jsxs)("kbd",{className:"mr-1 flex items-center gap-0.5 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] font-mono",children:[(0,b.jsx)(W,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{delay:500,render:(0,b.jsx)("button",{"data-tour":"open-assistant",onClick:k,"aria-label":f("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",j?"bg-accent text-foreground":""].join(" ")}),children:(0,b.jsx)(Y,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("assistant.iconLabel")})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",onClick:()=>i("zh"===h?"en":"zh"),className:"text-muted-foreground"}),children:[(0,b.jsx)(X.Globe,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===h?"EN":"中"})]}),(0,b.jsx)(t.TooltipContent,{children:f("settings.language")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{ref:o,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===l?(0,b.jsx)(Z.Sun,{className:"h-4 w-4"}):(0,b.jsx)($.Moon,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("settings.theme")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>window.open("https://github.com/jp-liu/tower","_blank","noopener,noreferrer"),className:"text-muted-foreground","aria-label":f("topbar.github")}),children:(0,b.jsx)(a1,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("topbar.github")})]}),(0,b.jsx)("div",{className:"h-4 w-px bg-border"}),(0,b.jsxs)(u.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>y(!0),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("topbar.importProject")]}),(0,b.jsxs)(u.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>w(!0),children:[(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"}),f("topbar.newProject")]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsxs)("button",{className:"ml-0.5 flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1 transition-colors hover:bg-accent",children:[e&&(0,b.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:e}),(0,b.jsx)(ar,{className:"h-7 w-7 ring-1 ring-border",children:(0,b.jsx)(as,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:e?e.trim().split(/\s+/).filter(a=>a.length>0).slice(0,2).map(a=>a[0].toUpperCase()).join(""):"U"})})]})}),(0,b.jsx)(q.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,b.jsxs)(q.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,b.jsx)(V.Settings,{className:"mr-2 h-3.5 w-3.5"}),f("settings.title")]})})]})]})]}),(0,b.jsx)(aE,{open:r,onOpenChange:s}),(0,b.jsx)(aW,{open:v,onOpenChange:a=>{w(a),a||B(!1)},onCreateProject:a}),(0,b.jsx)(a0,{open:x,onOpenChange:a=>{y(a),a||C(!1)},onCreateProject:a})]})}var a3=a.i(347872),a4=a.i(595999),a5=a.i(892144),a6=a.i(969032),a7=a.i(442620);let a8=(0,a6.default)(async()=>{},{loadableGenerated:{modules:[103363]},ssr:!1});function a9({mode:a}){let{isOpen:d,closeAssistant:e,sessions:f,activeSessionId:j,createNewSession:k,switchSession:l,removeSession:m,renameSession:n}=aL(),{t:o}=(0,F.useI18n)(),[p,r]=(0,c.useState)(null),[t,w]=(0,c.useState)(""),x=()=>{r(null),w("")},y=()=>{p&&t.trim()&&(n(p.id,t),x())},z=f.find(a=>a.id===j),A=z?.title??o("assistant.newSession");return(0,b.jsxs)("div",{className:"sidebar"===a?"min-w-[320px] max-w-[480px] w-[30vw] shrink-0 border-r border-border flex flex-col bg-sidebar overflow-hidden":"flex flex-col h-full overflow-hidden",children:[(0,b.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,b.jsx)(Y,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:o("assistant.title")}),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsxs)(q.DropdownMenuTrigger,{className:"flex items-center gap-1 h-8 px-2 rounded-md text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground max-w-[120px] truncate","aria-label":o("assistant.sessionList"),children:[(0,b.jsx)("span",{className:"truncate",children:A}),(0,b.jsx)(a7.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,b.jsxs)(q.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,className:"w-[280px]",children:[0===f.length?(0,b.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:o("assistant.noSessions")}):f.map(a=>(0,b.jsxs)(q.DropdownMenuItem,{className:"flex items-center justify-between gap-1 pr-1",onClick:()=>l(a.id),children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs truncate",children:a.title}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`}(a.updatedAt)})]}),(0,b.jsx)(u.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100",onClick:b=>{var c;b.stopPropagation(),r({id:a.id,title:c=a.title}),w(c)},"aria-label":o("assistant.renameSession"),children:(0,b.jsx)(h.Pencil,{className:"h-3 w-3"})}),(0,b.jsx)(u.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:b=>{b.stopPropagation(),m(a.id)},"aria-label":o("assistant.deleteSession"),children:(0,b.jsx)(i.Trash2,{className:"h-3 w-3"})})]},a.id)),f.length>0&&(0,b.jsx)(q.DropdownMenuSeparator,{}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:k,children:[(0,b.jsx)(g.Plus,{className:"h-3 w-3 mr-1"}),(0,b.jsx)("span",{className:"text-xs",children:o("assistant.newSession")})]})]})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:k,"aria-label":o("assistant.newSession"),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:e,"aria-label":o("assistant.closeLabel"),children:(0,b.jsx)(ax.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:d?(0,b.jsx)(a8,{}):null}),(0,b.jsx)(s.Dialog,{open:null!==p,onOpenChange:a=>{a||x()},children:(0,b.jsxs)(s.DialogContent,{children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:o("assistant.renameSessionTitle")})}),(0,b.jsx)(v.Input,{autoFocus:!0,value:t,onChange:a=>w(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),y())},placeholder:o("assistant.renameSessionPlaceholder")}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:x,children:o("common.cancel")}),(0,b.jsx)(u.Button,{onClick:y,disabled:!t.trim(),children:o("common.save")})]})]})})]})}var ba=a.i(190076);function bb({onDismiss:a}){let{t:d}=(0,F.useI18n)(),[e,f]=(0,c.useState)(!1);(0,c.useEffect)(()=>{},[]);let g=async()=>{"default"!==await window.Notification.requestPermission()&&(f(!1),a?.())};return e?(0,b.jsxs)("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-[9999] w-auto max-w-lg bg-card border rounded-lg shadow-lg px-4 py-2.5 flex items-center gap-3 animate-in fade-in slide-in-from-top-4 duration-500",children:[(0,b.jsx)(ba.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,b.jsx)("span",{className:"flex-1 text-sm",children:d("notification.permissionPrompt")}),(0,b.jsx)(u.Button,{size:"default",onClick:g,children:d("notification.allow")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"default",onClick:()=>{f(!1),a?.()},children:d("notification.dismiss")})]}):null}a.i(707044);var bc=a.i(202722);let bd=[{target:"create-workspace",titleKey:"tour.step1.title",descKey:"tour.step1.desc",placement:"right"},{target:"create-project",titleKey:"tour.step2.title",descKey:"tour.step2.desc",placement:"bottom",waitForTarget:!0},{target:"open-assistant",titleKey:"tour.step3.title",descKey:"tour.step3.desc",placement:"bottom"}];function be({onComplete:a}){let{t:d}=(0,F.useI18n)(),[e,f]=(0,c.useState)(0),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(!1),k=(0,c.useRef)(null),l=bd[e],m=(0,c.useCallback)(async()=>{await (0,bc.setConfigValue)("onboarding.tourCompleted",!0),a()},[a]),n=(0,c.useCallback)(()=>l?document.querySelector(`[data-tour="${l.target}"]`):null,[l]),o=(0,c.useCallback)(()=>{let a=n();a?(h(a.getBoundingClientRect()),j(!0)):j(!1)},[n]);(0,c.useEffect)(()=>{o();let a=null;!i&&l?.waitForTarget&&(k.current=new MutationObserver(()=>{let b=n();b&&(h(b.getBoundingClientRect()),j(!0),k.current?.disconnect(),a&&clearTimeout(a))}),k.current.observe(document.body,{childList:!0,subtree:!0}),a=setTimeout(()=>{!n()&&(f(a=>{let b=a+1;return b<bd.length?b:a}),e>=bd.length-1&&m())},5e3));let b=()=>o();return window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{k.current?.disconnect(),a&&clearTimeout(a),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[e,l,n,o,i,m]),(0,c.useEffect)(()=>{let a=setInterval(o,1e3);return()=>clearInterval(a)},[o]);let p=(0,c.useCallback)(()=>{e<bd.length-1?(f(a=>a+1),j(!1)):m()},[e]);return l?(0,b.jsx)(b.Fragment,{children:i&&g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
|
|
2
2
|
ellipse at ${g.left+g.width/2}px ${g.top+g.height/2}px,
|
|
3
3
|
transparent ${Math.max(g.width,g.height)}px,
|
|
4
4
|
rgba(0,0,0,0.6) ${Math.max(g.width,g.height)+30}px
|
|
5
|
-
)`},onClick:p}),(0,b.jsx)("div",{className:"pointer-events-none fixed z-[10001] rounded-lg ring-2 ring-amber-400 ring-offset-2 ring-offset-background",style:{left:g.left-4,top:g.top-4,width:g.width+8,height:g.height+8}}),(0,b.jsxs)("div",{className:"fixed z-[10002] w-72 rounded-xl border border-border bg-card p-4 shadow-2xl",style:(()=>{if(!g)return{display:"none"};let a={position:"fixed",zIndex:10001};switch(l.placement){case"right":a.left=g.right+12,a.top=g.top+g.height/2,a.transform="translateY(-50%)";break;case"bottom":a.left=g.left+g.width/2,a.top=g.bottom+12,a.transform="translateX(-50%)";break;case"left":a.right=window.innerWidth-g.left+12,a.top=g.top+g.height/2,a.transform="translateY(-50%)";break;case"top":a.left=g.left+g.width/2,a.bottom=window.innerHeight-g.top+12,a.transform="translateX(-50%)"}return a})(),children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:d(l.titleKey)}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground leading-relaxed",children:d(l.descKey)})]}),(0,b.jsx)("button",{onClick:m,className:"shrink-0 rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:(0,b.jsx)(ax.X,{className:"h-3.5 w-3.5"})})]}),(0,b.jsxs)("div",{className:"mt-3 flex items-center justify-between",children:[(0,b.jsx)("div",{className:"flex gap-1",children:bc.map((a,c)=>(0,b.jsx)("div",{className:`h-1.5 w-1.5 rounded-full ${c===e?"bg-amber-400":c<e?"bg-amber-400/40":"bg-muted"}`},c))}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(u.Button,{variant:"ghost",className:"h-7 px-2 text-xs text-muted-foreground",onClick:m,children:d("tour.skip")}),(0,b.jsx)(u.Button,{className:"h-7 px-3 text-xs bg-amber-500/15 text-amber-300 ring-1 ring-amber-500/25 hover:bg-amber-500/25",onClick:p,children:d(e<bc.length-1?"tour.next":"tour.done")})]})]})]})]})}):null}var be=a.i(651571);let bf=(0,o.default)("sun-moon",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715",key:"xlf6rm"}],["path",{d:"M16 12a4 4 0 0 0-4-4",key:"6vsxu"}],["path",{d:"m19 5-1.256 1.256",key:"1yg6a6"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);var bg=a.i(34252),bh=a.i(567648),bi=a.i(419622);let bj=(0,R.create)(a=>({open:!1,setOpen:b=>a({open:b}),toggle:()=>a(a=>({open:!a.open}))})),bk=(0,R.create)(a=>({open:!1,setOpen:b=>a({open:b}),toggle:()=>a(a=>({open:!a.open}))}));function bl(){let{t:a,locale:c,setLocale:e}=(0,F.useI18n)(),f=(0,d.useRouter)(),{resolvedTheme:h,setTheme:i}=(0,T.useTheme)(),j=bj(a=>a.open),k=bj(a=>a.setOpen),l=bj(a=>a.toggle),m=S(a=>a.setCreateProjectOpen),o=S(a=>a.setImportProjectOpen),p=bk(a=>a.toggle);(0,Q.useActionShortcut)("global.commandPalette",()=>l());let q=a=>{k(!1),a()};return(0,b.jsxs)(bi.CommandDialog,{open:j,onOpenChange:k,title:a("palette.title"),children:[(0,b.jsx)(bi.CommandInput,{placeholder:a("palette.placeholder")}),(0,b.jsxs)(bi.CommandList,{children:[(0,b.jsx)(bi.CommandEmpty,{children:a("palette.empty")}),(0,b.jsxs)(bi.CommandGroup,{heading:a("palette.group.navigation"),children:[(0,b.jsxs)(bi.CommandItem,{onSelect:()=>q(()=>f.push("/missions")),children:[(0,b.jsx)(be.LayoutGrid,{}),a("palette.gotoMissions")]}),(0,b.jsxs)(bi.CommandItem,{onSelect:()=>q(()=>f.push("/settings")),children:[(0,b.jsx)(V.Settings,{}),a("palette.openSettings")]})]}),(0,b.jsxs)(bi.CommandGroup,{heading:a("palette.group.actions"),children:[(0,b.jsxs)(bi.CommandItem,{onSelect:()=>q(()=>m(!0)),children:[(0,b.jsx)(g.Plus,{}),a("palette.newProject")]}),(0,b.jsxs)(bi.CommandItem,{onSelect:()=>q(()=>o(!0)),children:[(0,b.jsx)(n.FolderOpen,{}),a("palette.importProject")]}),(0,b.jsxs)(bi.CommandItem,{onSelect:()=>q(()=>p()),children:[(0,b.jsx)(bh.Keyboard,{}),a("palette.openHelp")]})]}),(0,b.jsxs)(bi.CommandGroup,{heading:a("palette.group.preferences"),children:[(0,b.jsxs)(bi.CommandItem,{onSelect:()=>q(()=>i("dark"===h?"light":"dark")),children:[(0,b.jsx)(bf,{}),a("palette.toggleTheme")]}),(0,b.jsxs)(bi.CommandItem,{onSelect:()=>q(()=>e("zh"===c?"en":"zh")),children:[(0,b.jsx)(bg.Languages,{}),a("palette.toggleLocale")]})]})]})]})}var bm=a.i(109603),bn=a.i(875846),bo=a.i(718799);let bp=["global","panels","missions"],bq=new Set(["missions.cycleBack"]);function br(){let{t:a}=(0,F.useI18n)(),d=bk(a=>a.open),e=bk(a=>a.setOpen),f=bk(a=>a.toggle),g=(0,bn.useKeymapStore)(a=>a.overrides),[h,i]=(0,c.useState)("");(0,Q.useActionShortcut)("global.help",()=>f());let j=h.trim().toLowerCase(),k=bp.map(b=>{let c=bm.SHORTCUT_ACTIONS.filter(a=>a.group===b&&!bq.has(a.id)).map(b=>({id:b.id,description:a(b.descriptionKey),keys:(0,bn.resolveKeysFrom)(g,b.id)})).filter(a=>!j||a.description.toLowerCase().includes(j));return{title:a(`shortcuts.group.${b}`),shortcuts:c}}).filter(a=>a.shortcuts.length>0);return(0,b.jsx)(s.Dialog,{open:d,onOpenChange:e,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-2xl",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:a("shortcuts.help.title")})}),(0,b.jsx)(v.Input,{value:h,onChange:a=>i(a.target.value),placeholder:a("shortcuts.help.searchPlaceholder")}),(0,b.jsx)("div",{className:"max-h-[60vh] space-y-4 overflow-y-auto",children:k.map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:a.title}),(0,b.jsx)("div",{className:"space-y-0.5",children:a.shortcuts.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-md px-2 py-1.5 text-sm",children:[(0,b.jsx)("span",{className:"truncate",children:a.description}),(0,b.jsx)("div",{className:"flex shrink-0 items-center",children:(0,b.jsx)(bo.KeyCombo,{keys:a.keys})})]},a.id))})]},a.title))})]})})}function bs({workspaces:a,isFirstRun:e,username:f,children:g,handleCreateProject:h}){let i=(0,d.usePathname)(),j=(0,d.useRouter)(),{isOpen:k,displayMode:l,closeAssistant:m}=aL();(0,Q.useActionShortcut)("global.gotoWorkspace",b=>{let c=/^Digit([1-9])$/.exec(b.code);if(!c)return;let d=a[Number(c[1])-1];if(!d)return;let e=(0,E.getLastProjectId)(d.id);j.push(e?`/workspaces/${d.id}?projectId=${e}`:`/workspaces/${d.id}`)});let n=i.split("/workspaces/")[1]?.split("/")[0]||a[0]?.id;(0,Q.useActionShortcut)("panels.taskManager",()=>j.push("/missions")),(0,Q.useActionShortcut)("panels.assets",()=>{n&&j.push(`/workspaces/${n}/assets`)}),(0,Q.useActionShortcut)("panels.notes",()=>{n&&j.push(`/workspaces/${n}/notes`)}),(0,Q.useActionShortcut)("panels.archive",()=>{n&&j.push(`/workspaces/${n}/archive`)}),(0,c.useEffect)(()=>{e&&!i.startsWith("/onboarding")&&j.replace("/onboarding")},[e,i,j]);let[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1);(0,c.useEffect)(()=>{e||i.startsWith("/onboarding")||(0,az.getConfigValue)("onboarding.tourCompleted",!1).then(a=>{a?r(!0):p(!0)})},[e,i]);let t=()=>{p(!1),r(!0)},[u,v]=(0,c.useState)(!0);(0,c.useEffect)(()=>{(0,az.getConfigValue)("notification.enabled",!0).then(v)},[]);let w=i.startsWith("/onboarding");if(!function(a){let b=(0,d.useRouter)(),e=(0,c.useRef)(b),f=(0,c.useRef)(a),{t:g}=(0,F.useI18n)(),h=(0,c.useRef)(g);e.current=b,f.current=a,h.current=g,(0,c.useEffect)(()=>{},[a])}(u&&!w),w)return(0,b.jsx)(b.Fragment,{children:g});let x=/\/workspaces\/[^/]+\/tasks\/[^/]+/.test(i),y=/\/workspaces\/[^/]+\/(notes|assets|archive)/.test(i),z=k&&"sidebar"===l?(0,b.jsx)(a8,{mode:"sidebar"}):null,A="dialog"===l?(0,b.jsx)(s.Dialog,{open:k,onOpenChange:a=>{a||m()},children:(0,b.jsx)(s.DialogContent,{showCloseButton:!1,style:{width:"90vw",minWidth:"360px",maxWidth:"600px",height:"70vh",minHeight:"480px",maxHeight:"800px",padding:0},children:(0,b.jsx)(a8,{mode:"dialog"})})}):null;return x||y?(0,b.jsxs)(b.Fragment,{children:[q&&(0,b.jsx)(ba,{onDismiss:()=>r(!1)}),(0,b.jsx)("div",{className:"flex h-screen overflow-hidden",children:(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)(a1,{onCreateProject:h,username:f}),(0,b.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[z,(0,b.jsx)("main",{className:"flex-1 overflow-hidden bg-background",children:(0,b.jsx)(a3.ErrorBoundary,{children:g})})]})]})}),A,o&&(0,b.jsx)(bd,{onComplete:t}),(0,b.jsx)(bl,{}),(0,b.jsx)(br,{})]}):(0,b.jsxs)(b.Fragment,{children:[q&&(0,b.jsx)(ba,{onDismiss:()=>r(!1)}),(0,b.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,b.jsx)(L,{workspaces:a}),(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)(a1,{onCreateProject:h,username:f}),(0,b.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[z,(0,b.jsx)("main",{className:"flex-1 overflow-auto bg-background",children:(0,b.jsx)(a3.ErrorBoundary,{children:g})})]})]})]}),A,o&&(0,b.jsx)(bd,{onComplete:t}),(0,b.jsx)(bl,{}),(0,b.jsx)(br,{})]})}a.s(["LayoutClient",0,function({workspaces:a,isFirstRun:c,username:e,children:f}){let g=(0,d.useRouter)(),h=(0,d.usePathname)(),i=h.split("/workspaces/")[1]?.split("/")[0],j=async b=>{let c=i||(a.length>0?a[0].id:null);if(!c){let a=await x({name:"Default Workspace"}),c=await (0,a4.createProject)({...b,workspaceId:a.id});return g.refresh(),g.push(`/workspaces/${a.id}`),{id:c.id}}let d=await (0,a4.createProject)({...b,workspaceId:c});return g.refresh(),g.push(`/workspaces/${c}`),{id:d.id}};return(0,b.jsx)(aK,{children:(0,b.jsx)(a2.TerminalPortalProvider,{children:(0,b.jsx)(bs,{workspaces:a,isFirstRun:c,username:e,handleCreateProject:j,children:f})})})}],607884)},3896,a=>{"use strict";var b=a.i(728778),c=a.i(940271);a.s(["ThemeProvider",0,function({children:a,...d}){return(0,b.jsx)(c.ThemeProvider,{...d,children:a})}])},426419,a=>{"use strict";var b=a.i(728778),c=a.i(940271),d=a.i(952313),e=a.i(884664),e=e,f=a.i(976268),f=f,g=a.i(622945),g=g;let h=(0,a.i(711796).default)("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var i=a.i(663513),i=i;a.s(["Toaster",0,({...a})=>{let{theme:j="system"}=(0,c.useTheme)();return(0,b.jsx)(d.Toaster,{theme:j,className:"toaster group",icons:{success:(0,b.jsx)(e.default,{className:"size-4"}),info:(0,b.jsx)(f.default,{className:"size-4"}),warning:(0,b.jsx)(g.default,{className:"size-4"}),error:(0,b.jsx)(h,{className:"size-4"}),loading:(0,b.jsx)(i.default,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...a})}],426419)}];
|
|
5
|
+
)`},onClick:p}),(0,b.jsx)("div",{className:"pointer-events-none fixed z-[10001] rounded-lg ring-2 ring-amber-400 ring-offset-2 ring-offset-background",style:{left:g.left-4,top:g.top-4,width:g.width+8,height:g.height+8}}),(0,b.jsxs)("div",{className:"fixed z-[10002] w-72 rounded-xl border border-border bg-card p-4 shadow-2xl",style:(()=>{if(!g)return{display:"none"};let a={position:"fixed",zIndex:10001};switch(l.placement){case"right":a.left=g.right+12,a.top=g.top+g.height/2,a.transform="translateY(-50%)";break;case"bottom":a.left=g.left+g.width/2,a.top=g.bottom+12,a.transform="translateX(-50%)";break;case"left":a.right=window.innerWidth-g.left+12,a.top=g.top+g.height/2,a.transform="translateY(-50%)";break;case"top":a.left=g.left+g.width/2,a.bottom=window.innerHeight-g.top+12,a.transform="translateX(-50%)"}return a})(),children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:d(l.titleKey)}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground leading-relaxed",children:d(l.descKey)})]}),(0,b.jsx)("button",{onClick:m,className:"shrink-0 rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:(0,b.jsx)(ax.X,{className:"h-3.5 w-3.5"})})]}),(0,b.jsxs)("div",{className:"mt-3 flex items-center justify-between",children:[(0,b.jsx)("div",{className:"flex gap-1",children:bd.map((a,c)=>(0,b.jsx)("div",{className:`h-1.5 w-1.5 rounded-full ${c===e?"bg-amber-400":c<e?"bg-amber-400/40":"bg-muted"}`},c))}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(u.Button,{variant:"ghost",className:"h-7 px-2 text-xs text-muted-foreground",onClick:m,children:d("tour.skip")}),(0,b.jsx)(u.Button,{className:"h-7 px-3 text-xs bg-amber-500/15 text-amber-300 ring-1 ring-amber-500/25 hover:bg-amber-500/25",onClick:p,children:d(e<bd.length-1?"tour.next":"tour.done")})]})]})]})]})}):null}var bf=a.i(651571);let bg=(0,o.default)("sun-moon",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715",key:"xlf6rm"}],["path",{d:"M16 12a4 4 0 0 0-4-4",key:"6vsxu"}],["path",{d:"m19 5-1.256 1.256",key:"1yg6a6"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);var bh=a.i(34252),bi=a.i(567648),bj=a.i(419622);let bk=(0,R.create)(a=>({open:!1,setOpen:b=>a({open:b}),toggle:()=>a(a=>({open:!a.open}))})),bl=(0,R.create)(a=>({open:!1,setOpen:b=>a({open:b}),toggle:()=>a(a=>({open:!a.open}))}));function bm(){let{t:a,locale:c,setLocale:e}=(0,F.useI18n)(),f=(0,d.useRouter)(),{resolvedTheme:h,setTheme:i}=(0,T.useTheme)(),j=bk(a=>a.open),k=bk(a=>a.setOpen),l=bk(a=>a.toggle),m=S(a=>a.setCreateProjectOpen),o=S(a=>a.setImportProjectOpen),p=bl(a=>a.toggle);(0,Q.useActionShortcut)("global.commandPalette",()=>l());let q=a=>{k(!1),a()};return(0,b.jsxs)(bj.CommandDialog,{open:j,onOpenChange:k,title:a("palette.title"),children:[(0,b.jsx)(bj.CommandInput,{placeholder:a("palette.placeholder")}),(0,b.jsxs)(bj.CommandList,{children:[(0,b.jsx)(bj.CommandEmpty,{children:a("palette.empty")}),(0,b.jsxs)(bj.CommandGroup,{heading:a("palette.group.navigation"),children:[(0,b.jsxs)(bj.CommandItem,{onSelect:()=>q(()=>f.push("/missions")),children:[(0,b.jsx)(bf.LayoutGrid,{}),a("palette.gotoMissions")]}),(0,b.jsxs)(bj.CommandItem,{onSelect:()=>q(()=>f.push("/settings")),children:[(0,b.jsx)(V.Settings,{}),a("palette.openSettings")]})]}),(0,b.jsxs)(bj.CommandGroup,{heading:a("palette.group.actions"),children:[(0,b.jsxs)(bj.CommandItem,{onSelect:()=>q(()=>m(!0)),children:[(0,b.jsx)(g.Plus,{}),a("palette.newProject")]}),(0,b.jsxs)(bj.CommandItem,{onSelect:()=>q(()=>o(!0)),children:[(0,b.jsx)(n.FolderOpen,{}),a("palette.importProject")]}),(0,b.jsxs)(bj.CommandItem,{onSelect:()=>q(()=>p()),children:[(0,b.jsx)(bi.Keyboard,{}),a("palette.openHelp")]})]}),(0,b.jsxs)(bj.CommandGroup,{heading:a("palette.group.preferences"),children:[(0,b.jsxs)(bj.CommandItem,{onSelect:()=>q(()=>i("dark"===h?"light":"dark")),children:[(0,b.jsx)(bg,{}),a("palette.toggleTheme")]}),(0,b.jsxs)(bj.CommandItem,{onSelect:()=>q(()=>e("zh"===c?"en":"zh")),children:[(0,b.jsx)(bh.Languages,{}),a("palette.toggleLocale")]})]})]})]})}var bn=a.i(109603),bo=a.i(875846),bp=a.i(718799);let bq=["global","panels","missions"],br=new Set(["missions.cycleBack"]);function bs(){let{t:a}=(0,F.useI18n)(),d=bl(a=>a.open),e=bl(a=>a.setOpen),f=bl(a=>a.toggle),g=(0,bo.useKeymapStore)(a=>a.overrides),[h,i]=(0,c.useState)("");(0,Q.useActionShortcut)("global.help",()=>f());let j=h.trim().toLowerCase(),k=bq.map(b=>{let c=bn.SHORTCUT_ACTIONS.filter(a=>a.group===b&&!br.has(a.id)).map(b=>({id:b.id,description:a(b.descriptionKey),keys:(0,bo.resolveKeysFrom)(g,b.id)})).filter(a=>!j||a.description.toLowerCase().includes(j));return{title:a(`shortcuts.group.${b}`),shortcuts:c}}).filter(a=>a.shortcuts.length>0);return(0,b.jsx)(s.Dialog,{open:d,onOpenChange:e,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-2xl",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:a("shortcuts.help.title")})}),(0,b.jsx)(v.Input,{value:h,onChange:a=>i(a.target.value),placeholder:a("shortcuts.help.searchPlaceholder")}),(0,b.jsx)("div",{className:"max-h-[60vh] space-y-4 overflow-y-auto",children:k.map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:a.title}),(0,b.jsx)("div",{className:"space-y-0.5",children:a.shortcuts.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-md px-2 py-1.5 text-sm",children:[(0,b.jsx)("span",{className:"truncate",children:a.description}),(0,b.jsx)("div",{className:"flex shrink-0 items-center",children:(0,b.jsx)(bp.KeyCombo,{keys:a.keys})})]},a.id))})]},a.title))})]})})}function bt({workspaces:a,isFirstRun:e,username:f,children:g,handleCreateProject:h}){let i=(0,d.usePathname)(),j=(0,d.useRouter)(),{isOpen:k,displayMode:l,closeAssistant:m}=aL();(0,Q.useActionShortcut)("global.gotoWorkspace",b=>{let c=/^Digit([1-9])$/.exec(b.code);if(!c)return;let d=a[Number(c[1])-1];if(!d)return;let e=(0,E.getLastProjectId)(d.id);j.push(e?`/workspaces/${d.id}?projectId=${e}`:`/workspaces/${d.id}`)});let n=i.split("/workspaces/")[1]?.split("/")[0]||a[0]?.id;(0,Q.useActionShortcut)("panels.taskManager",()=>j.push("/missions")),(0,Q.useActionShortcut)("panels.assets",()=>{n&&j.push(`/workspaces/${n}/assets`)}),(0,Q.useActionShortcut)("panels.notes",()=>{n&&j.push(`/workspaces/${n}/notes`)}),(0,Q.useActionShortcut)("panels.archive",()=>{n&&j.push(`/workspaces/${n}/archive`)}),(0,c.useEffect)(()=>{e&&!i.startsWith("/onboarding")&&j.replace("/onboarding")},[e,i,j]);let[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1);(0,c.useEffect)(()=>{e||i.startsWith("/onboarding")||(0,az.getConfigValue)("onboarding.tourCompleted",!1).then(a=>{a?r(!0):p(!0)})},[e,i]);let t=()=>{p(!1),r(!0)},[u,v]=(0,c.useState)(!0);(0,c.useEffect)(()=>{(0,az.getConfigValue)("notification.enabled",!0).then(v)},[]);let w=i.startsWith("/onboarding");if(!function(a){let b=(0,c.useRef)(a),{t:d}=(0,F.useI18n)(),e=(0,c.useRef)(d);b.current=a,e.current=d,(0,c.useEffect)(()=>{},[a])}(u&&!w),w)return(0,b.jsx)(b.Fragment,{children:g});let x=/\/workspaces\/[^/]+\/tasks\/[^/]+/.test(i),y=/\/workspaces\/[^/]+\/(notes|assets|archive)/.test(i),z=k&&"sidebar"===l?(0,b.jsx)(a9,{mode:"sidebar"}):null,A="dialog"===l?(0,b.jsx)(s.Dialog,{open:k,onOpenChange:a=>{a||m()},children:(0,b.jsx)(s.DialogContent,{showCloseButton:!1,style:{width:"90vw",minWidth:"360px",maxWidth:"600px",height:"70vh",minHeight:"480px",maxHeight:"800px",padding:0},children:(0,b.jsx)(a9,{mode:"dialog"})})}):null;return x||y?(0,b.jsxs)(b.Fragment,{children:[q&&(0,b.jsx)(bb,{onDismiss:()=>r(!1)}),(0,b.jsx)("div",{className:"flex h-screen overflow-hidden",children:(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)(a2,{onCreateProject:h,username:f}),(0,b.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[z,(0,b.jsx)("main",{className:"flex-1 overflow-hidden bg-background",children:(0,b.jsx)(a4.ErrorBoundary,{children:g})})]})]})}),A,o&&(0,b.jsx)(be,{onComplete:t}),(0,b.jsx)(bm,{}),(0,b.jsx)(bs,{})]}):(0,b.jsxs)(b.Fragment,{children:[q&&(0,b.jsx)(bb,{onDismiss:()=>r(!1)}),(0,b.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,b.jsx)(L,{workspaces:a}),(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)(a2,{onCreateProject:h,username:f}),(0,b.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[z,(0,b.jsx)("main",{className:"flex-1 overflow-auto bg-background",children:(0,b.jsx)(a4.ErrorBoundary,{children:g})})]})]})]}),A,o&&(0,b.jsx)(be,{onComplete:t}),(0,b.jsx)(bm,{}),(0,b.jsx)(bs,{})]})}a.s(["LayoutClient",0,function({workspaces:a,isFirstRun:c,username:e,children:f}){let g=(0,d.useRouter)(),h=(0,d.usePathname)(),i=h.split("/workspaces/")[1]?.split("/")[0],j=async b=>{let c=i||(a.length>0?a[0].id:null);if(!c){let a=await x({name:"Default Workspace"}),c=await (0,a5.createProject)({...b,workspaceId:a.id});return g.refresh(),g.push(`/workspaces/${a.id}`),{id:c.id}}let d=await (0,a5.createProject)({...b,workspaceId:c});return g.refresh(),g.push(`/workspaces/${c}`),{id:d.id}};return(0,b.jsx)(aK,{children:(0,b.jsx)(a3.TerminalPortalProvider,{children:(0,b.jsx)(bt,{workspaces:a,isFirstRun:c,username:e,handleCreateProject:j,children:f})})})}],607884)},3896,a=>{"use strict";var b=a.i(728778),c=a.i(940271);a.s(["ThemeProvider",0,function({children:a,...d}){return(0,b.jsx)(c.ThemeProvider,{...d,children:a})}])},426419,a=>{"use strict";var b=a.i(728778),c=a.i(940271),d=a.i(952313),e=a.i(884664),e=e,f=a.i(976268),f=f,g=a.i(622945),g=g;let h=(0,a.i(711796).default)("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var i=a.i(663513),i=i;a.s(["Toaster",0,({...a})=>{let{theme:j="system"}=(0,c.useTheme)();return(0,b.jsx)(d.Toaster,{theme:j,className:"toaster group",icons:{success:(0,b.jsx)(e.default,{className:"size-4"}),info:(0,b.jsx)(f.default,{className:"size-4"}),warning:(0,b.jsx)(g.default,{className:"size-4"}),error:(0,b.jsx)(h,{className:"size-4"}),loading:(0,b.jsx)(i.default,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...a})}],426419)}];
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=_0cj9a7y._.js.map
|
|
@@ -18,7 +18,7 @@ module.exports=[287068,a=>{"use strict";var b=a.i(761469);function c(a,b){return
|
|
|
18
18
|
JOIN "Project" p ON p.id = n."projectId"
|
|
19
19
|
JOIN "Workspace" w ON w.id = p."workspaceId"
|
|
20
20
|
WHERE n.title LIKE ? OR n.content LIKE ?
|
|
21
|
-
LIMIT ?`,`%${g}%`,`%${g}%`,h)).map(a=>c(a,j))}}return"asset"===e?(await b.db.projectAsset.findMany({where:{OR:[{filename:{contains:g}},{description:{contains:g}}]},include:{project:{include:{workspace:!0}}},take:h,orderBy:{createdAt:"desc"}})).map(a=>({id:a.id,type:"asset",title:a.filename,subtitle:`${a.project.workspace.name} / ${a.project.name}`,navigateTo:`/workspaces/${a.project.workspaceId}/assets?projectId=${a.projectId}`,snippet:a.description||void 0})):[]}a.s(["search",0,d])},396904,a=>a.a(async(b,c)=>{try{var d=a.i(815429),e=a.i(287068),f=a.i(980999),g=a.i(630048),h=b([f]);async function i(a,b="task"){let c=await (0,f.getConfigValues)(["search.resultLimit","search.allModeCap","search.snippetLength"]);return(0,e.search)(a,b,{resultLimit:c["search.resultLimit"]??20,allModeCap:c["search.allModeCap"]??5,snippetLength:c["search.snippetLength"]??80})}[f]=h.then?(await h)():h,(0,g.ensureServerEntryExports)([i]),(0,d.registerServerReference)(i,"
|
|
21
|
+
LIMIT ?`,`%${g}%`,`%${g}%`,h)).map(a=>c(a,j))}}return"asset"===e?(await b.db.projectAsset.findMany({where:{OR:[{filename:{contains:g}},{description:{contains:g}}]},include:{project:{include:{workspace:!0}}},take:h,orderBy:{createdAt:"desc"}})).map(a=>({id:a.id,type:"asset",title:a.filename,subtitle:`${a.project.workspace.name} / ${a.project.name}`,navigateTo:`/workspaces/${a.project.workspaceId}/assets?projectId=${a.projectId}`,snippet:a.description||void 0})):[]}a.s(["search",0,d])},396904,a=>a.a(async(b,c)=>{try{var d=a.i(815429),e=a.i(287068),f=a.i(980999),g=a.i(630048),h=b([f]);async function i(a,b="task"){let c=await (0,f.getConfigValues)(["search.resultLimit","search.allModeCap","search.snippetLength"]);return(0,e.search)(a,b,{resultLimit:c["search.resultLimit"]??20,allModeCap:c["search.allModeCap"]??5,snippetLength:c["search.snippetLength"]??80})}[f]=h.then?(await h)():h,(0,g.ensureServerEntryExports)([i]),(0,d.registerServerReference)(i,"601729ed0bad968a41393fe90d428239c654b0709c",null),a.s(["globalSearch",0,i]),c()}catch(a){c(a)}},!1),101844,a=>{"use strict";var b=a.i(815429),c=a.i(924868),d=a.i(522734),e=a.i(814747),f=a.i(761469),g=a.i(188139),h=a.i(630048);async function i(b){if(!b||"string"!=typeof b)return{safe:!1,reason:"无效的项目 ID"};let g=await f.db.project.findUnique({where:{id:b}});if(!g||!g.localPath)return{safe:!1,reason:"项目不存在或未设置本地路径"};if((await f.db.taskExecution.findMany({where:{task:{projectId:b},status:"RUNNING"},select:{id:!0}})).length>0)return{safe:!1,reason:"该项目有正在运行的任务执行,请先停止所有执行"};let h=await f.db.task.findMany({where:{projectId:b},select:{id:!0}}),{getSession:i}=await a.A(98813);for(let a of h)if(void 0!==i(a.id))return{safe:!1,reason:"该项目有活跃的终端会话,请先关闭"};let j=e.default.join(g.localPath,".worktrees");if((0,d.existsSync)(j))try{if((await (0,c.readdir)(j)).length>0)return{safe:!1,reason:"该项目有活跃的 Git Worktree,请先清理"}}catch{}return{safe:!0}}async function j(b,h){if(!b||"string"!=typeof b)return{success:!1,error:"无效的项目 ID"};if(!h||"string"!=typeof h||!e.default.isAbsolute(h))return{success:!1,error:"目标路径必须是非空的绝对路径"};let i=await f.db.project.findUnique({where:{id:b}});if(!i||!i.localPath)return{success:!1,error:"项目不存在或未设置本地路径"};let j=i.localPath;if(h===j)return{success:!1,error:"源路径和目标路径相同"};if((await f.db.taskExecution.findMany({where:{task:{projectId:b},status:"RUNNING"},select:{id:!0}})).length>0)return{success:!1,error:"该项目有正在运行的任务执行,请先停止所有执行"};let k=await f.db.task.findMany({where:{projectId:b},select:{id:!0}}),{getSession:l}=await a.A(98813);for(let a of k)if(void 0!==l(a.id))return{success:!1,error:"该项目有活跃的终端会话,请先关闭"};let m=e.default.join(j,".worktrees");if((0,d.existsSync)(m))try{if((await (0,c.readdir)(m)).length>0)return{success:!1,error:"该项目有活跃的 Git Worktree,请先清理"}}catch{}if((0,d.existsSync)(h))try{if((await (0,c.readdir)(h)).length>0)return{success:!1,error:"目标路径已存在且不为空"}}catch{return{success:!1,error:"目标路径已存在且不为空"}}let n=e.default.dirname(h);try{await (0,c.mkdir)(n,{recursive:!0})}catch(a){if("EACCES"===a.code||"EPERM"===a.code)return{success:!1,error:`无权限创建父目录 ${n} — 请检查 Git 路径映射规则的模板是否漏了 "~/" 前缀`};if("EROFS"===a.code)return{success:!1,error:`父目录所在文件系统只读:${n}`};return{success:!1,error:`创建父目录失败:${a.message||a.code||"未知错误"}`}}try{await (0,c.rename)(j,h)}catch(a){if("EXDEV"===a.code)return{success:!1,error:"源路径和目标路径不在同一文件系统,不支持跨设备迁移"};if("EACCES"===a.code||"EPERM"===a.code)return{success:!1,error:`无权限移动到 ${h}`};return{success:!1,error:a.message||"文件系统操作失败"}}return await f.db.project.update({where:{id:b},data:{localPath:h}}),(0,g.revalidatePath)("/workspaces"),{success:!0}}let k=`分析这个项目目录,生成一段简短的 Markdown 项目描述。
|
|
22
22
|
|
|
23
23
|
读取 package.json、README.md 等关键文件,然后概括:
|
|
24
24
|
|
|
@@ -42,6 +42,6 @@ Requirements:
|
|
|
42
42
|
- Keep it under 1000 words
|
|
43
43
|
- Use concise Markdown (bold labels + short sentences), no ## headings or tables
|
|
44
44
|
- Don't list every file/directory, only key information
|
|
45
|
-
- Output in English`;async function m(b,c="zh"){if(!b||"string"!=typeof b)throw Error("无效的本地路径");if(b.startsWith("~"))throw Error("不支持 ~ 别名,请提供绝对路径");if(!e.default.isAbsolute(b))throw Error("本地路径必须为绝对路径");let{aiQuery:d}=await a.A(752453),f=await d("en"===c?l:k,b,{maxTurns:10,tools:["Read","Glob"],allowedTools:["Read","Glob"]});if(!f)throw Error("AI 分析未返回结果");return f.length>2e3?f.slice(0,2e3).trimEnd()+"\n\n...":f}(0,h.ensureServerEntryExports)([i,j,m]),(0,b.registerServerReference)(i,"
|
|
45
|
+
- Output in English`;async function m(b,c="zh"){if(!b||"string"!=typeof b)throw Error("无效的本地路径");if(b.startsWith("~"))throw Error("不支持 ~ 别名,请提供绝对路径");if(!e.default.isAbsolute(b))throw Error("本地路径必须为绝对路径");let{aiQuery:d}=await a.A(752453),f=await d("en"===c?l:k,b,{maxTurns:10,tools:["Read","Glob"],allowedTools:["Read","Glob"]});if(!f)throw Error("AI 分析未返回结果");return f.length>2e3?f.slice(0,2e3).trimEnd()+"\n\n...":f}(0,h.ensureServerEntryExports)([i,j,m]),(0,b.registerServerReference)(i,"40197cd678ef6a311b1ffba1e86ba4f15bd16fd63b",null),(0,b.registerServerReference)(j,"60e24e764bbd4747cf07763092c8c9e7d893ae14c3",null),(0,b.registerServerReference)(m,"60aec2ccb7f2e37674de7451b5028826a23d1fd408",null),a.s(["analyzeProjectDirectory",0,m,"checkMigrationSafety",0,i,"migrateProjectPath",0,j])},42344,a=>a.a(async(b,c)=>{try{a.i(244256),a.i(495370);var d=a.i(396904),e=a.i(980999);a.i(101844),a.i(563736),a.i(4634);var f=b([d,e]);[d,e]=f.then?(await f)():f,a.s([]),c()}catch(a){c(a)}},!1),413773,a=>a.a(async(b,c)=>{try{var d=a.i(42344),e=a.i(244256),f=a.i(495370),g=a.i(396904),h=a.i(980999),i=a.i(101844),j=a.i(563736),k=a.i(4634),l=b([d,g,h]);[d,g,h]=l.then?(await l)():l,a.s(["003cda51028de7d8ca1763a51d13223b9acbae6c96",()=>h.getActualWsPort,"00592b2050dca8305e2268efac020dae8b2fdb5ee0",()=>k.getOnboardingStatus,"00eaa4c6a465fc639f0823aa156f91447fb561cc40",()=>j.listAllExtensionStatus,"4000fd33b002f8f107377429f338f6aaddba6b48e7",()=>e.createWorkspace,"4010642c30732cf2c92871a2410bf6c83ad967b50d",()=>f.deleteLabel,"40197cd678ef6a311b1ffba1e86ba4f15bd16fd63b",()=>i.checkMigrationSafety,"401aa0045164b9aaa0699a7eb6df980f436dc0edfe",()=>e.deleteWorkspace,"403b5916a159649caf9f3f60a8a609eff6478fbbb3",()=>f.getLabelsForWorkspace,"403c101f24d1e7605a51cedf69da0d41af5c8ce953",()=>j.installExtension,"403c3eb99fad3fed76d481d40f018e89b581ec53ea",()=>h.resolveGitLocalPath,"404e7cc0e8e3765926dd1f7911020f0d67988d9696",()=>h.resolveGitLocalPathWithSource,"4057ffbbbeabb40cc3e03af5715687d8e537dc4639",()=>k.dispatchTaskCompletionEvent,"40787eafcd84a6469dab06156a248a9fe75248326d",()=>f.createLabel,"40bb3a59850008c559600bccd7be895b059a0cfc73",()=>e.createProject,"40bd6bd14273f742080b119c49ce1ae4226a0ea9ae",()=>h.getConfigValues,"40ce35e60ac54cb8269e14dc338b432fad63b05057",()=>j.uninstallExtension,"40eb934880e7b3819f12c1c7f91817927d87299cd1",()=>j.checkExtension,"40f772df9c5ef70aa3f0c91a6dc2716b97ed40d3a1",()=>k.setOnboardingProgress,"40fe67db1340e8da26e398b83a4596e60c17915573",()=>e.reorderWorkspaces,"601729ed0bad968a41393fe90d428239c654b0709c",()=>g.globalSearch,"60195d33c3642b0391d36a40f9be713c837345bcdc",()=>e.updateWorkspace,"6049009cebae9501b35174bc10f6e95392e15c1415",()=>k.setOnboardingExtensions,"60aec2ccb7f2e37674de7451b5028826a23d1fd408",()=>i.analyzeProjectDirectory,"60b661b64158203fc3f2bfee77e830c7f050c1d9c7",()=>h.setConfigValue,"60d2d75acc239bcc3016922e2bcf473c4b443f3ca9",()=>h.getConfigValue,"60d40c8f11280124b357c0af9e03f73ddef4889dc1",()=>k.completeOnboarding,"60e24e764bbd4747cf07763092c8c9e7d893ae14c3",()=>i.migrateProjectPath]),c()}catch(a){c(a)}},!1),76052,a=>{a.v(b=>Promise.all(["server/chunks/ssr/src_lib_0e27xy7._.js"].map(b=>a.l(b))).then(()=>b(492067)))},98813,a=>{a.v(a=>Promise.resolve().then(()=>a(962620)))},507502,a=>{a.v(b=>Promise.all(["server/chunks/ssr/src_lib_worktree_ts_06cucy3._.js"].map(b=>a.l(b))).then(()=>b(845427)))},752453,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0m7ydqb._.js"].map(b=>a.l(b))).then(()=>b(897667)))}];
|
|
46
46
|
|
|
47
47
|
//# sourceMappingURL=_0cxhub8._.js.map
|