tower-studio 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/diagnostics/route-bundle-stats.json +37 -37
  7. package/.next/fallback-build-manifest.json +3 -3
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  17. package/.next/server/app/_not-found/page/server-reference-manifest.json +25 -25
  18. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/_not-found.html +1 -1
  21. package/.next/server/app/_not-found.rsc +13 -13
  22. package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
  23. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  24. package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
  25. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  26. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  27. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  28. package/.next/server/app/index.html +1 -1
  29. package/.next/server/app/index.rsc +13 -13
  30. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  31. package/.next/server/app/index.segments/_full.segment.rsc +13 -13
  32. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  33. package/.next/server/app/index.segments/_index.segment.rsc +8 -8
  34. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  35. package/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  36. package/.next/server/app/missions/page/server-reference-manifest.json +51 -51
  37. package/.next/server/app/missions/page.js.nft.json +1 -1
  38. package/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  40. package/.next/server/app/onboarding/page/server-reference-manifest.json +25 -25
  41. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  42. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  43. package/.next/server/app/onboarding.html +1 -1
  44. package/.next/server/app/onboarding.rsc +15 -15
  45. package/.next/server/app/onboarding.segments/_full.segment.rsc +15 -15
  46. package/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
  47. package/.next/server/app/onboarding.segments/_index.segment.rsc +8 -8
  48. package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  49. package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  50. package/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
  51. package/.next/server/app/page/react-loadable-manifest.json +1 -1
  52. package/.next/server/app/page/server-reference-manifest.json +25 -25
  53. package/.next/server/app/page.js.nft.json +1 -1
  54. package/.next/server/app/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  56. package/.next/server/app/settings/page/server-reference-manifest.json +34 -34
  57. package/.next/server/app/settings/page.js.nft.json +1 -1
  58. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/settings.html +1 -1
  60. package/.next/server/app/settings.rsc +15 -15
  61. package/.next/server/app/settings.segments/_full.segment.rsc +15 -15
  62. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  63. package/.next/server/app/settings.segments/_index.segment.rsc +8 -8
  64. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  65. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  66. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  67. package/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  68. package/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +75 -75
  69. package/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  70. package/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  72. package/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +66 -66
  73. package/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  74. package/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  75. package/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  76. package/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +55 -55
  77. package/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  78. package/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  79. package/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  80. package/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +53 -53
  81. package/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  82. package/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  84. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +25 -25
  85. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  86. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +1 -1
  88. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +54 -54
  89. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  90. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  91. package/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  92. package/.next/server/app/workspaces/page/server-reference-manifest.json +41 -41
  93. package/.next/server/app/workspaces/page.js.nft.json +1 -1
  94. package/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  95. package/.next/server/chunks/0uz~_next_dist_esm_build_templates_app-route_05yec2y.js +2 -2
  96. package/.next/server/chunks/[root-of-the-server]__0~33o~m._.js +2 -2
  97. package/.next/server/chunks/project_f_tower_0n1s3ym._.js +1 -1
  98. package/.next/server/chunks/project_f_tower_src_11e.cv5._.js +1 -1
  99. package/.next/server/chunks/ssr/04uy_src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_01.s1p0._.js +1 -1
  100. package/.next/server/chunks/ssr/0y0r_f_tower_src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0n4g3bn._.js +1 -1
  101. package/.next/server/chunks/ssr/[root-of-the-server]__0.4j53v._.js +3 -0
  102. package/.next/server/chunks/ssr/[root-of-the-server]__06qzctf._.js +1 -1
  103. package/.next/server/chunks/ssr/[root-of-the-server]__09bcer6._.js +3 -0
  104. package/.next/server/chunks/ssr/[root-of-the-server]__0ffdrwp._.js +1 -1
  105. package/.next/server/chunks/ssr/[root-of-the-server]__0fwuc5u._.js +1 -1
  106. package/.next/server/chunks/ssr/{[root-of-the-server]__0p~~40h._.js → [root-of-the-server]__0gpx.d~._.js} +2 -2
  107. package/.next/server/chunks/ssr/[root-of-the-server]__0i4rk9v._.js +3 -3
  108. package/.next/server/chunks/ssr/[root-of-the-server]__0nmyvwk._.js +1 -1
  109. package/.next/server/chunks/ssr/[root-of-the-server]__0w7gbe7._.js +1 -1
  110. package/.next/server/chunks/ssr/[root-of-the-server]__11j4k9o._.js +1 -1
  111. package/.next/server/chunks/ssr/[root-of-the-server]__13cjs8r._.js +1 -1
  112. package/.next/server/chunks/ssr/[root-of-the-server]__13eo85g._.js +1 -1
  113. package/.next/server/chunks/ssr/project_f_tower_0.txwd8._.js +1 -1
  114. package/.next/server/chunks/ssr/project_f_tower_01tnhbx._.js +3 -0
  115. package/.next/server/chunks/ssr/{project_f_tower_0.k8r5w._.js → project_f_tower_0760i8j._.js} +2 -2
  116. package/.next/server/chunks/ssr/{project_f_tower_0t0smg9._.js → project_f_tower_08mqp19._.js} +2 -2
  117. package/.next/server/chunks/ssr/{project_f_tower_0c6n7oo._.js → project_f_tower_0ddfsyt._.js} +2 -2
  118. package/.next/server/chunks/ssr/project_f_tower_0f0-wva._.js +1 -1
  119. package/.next/server/chunks/ssr/project_f_tower_0hgtev9._.js +1 -1
  120. package/.next/server/chunks/ssr/project_f_tower_0ivvjwd._.js +1 -1
  121. package/.next/server/chunks/ssr/project_f_tower_0jy~1uf._.js +1 -1
  122. package/.next/server/chunks/ssr/project_f_tower_0l6ssf8._.js +1 -1
  123. package/.next/server/chunks/ssr/project_f_tower_0o5.y1e._.js +1 -1
  124. package/.next/server/chunks/ssr/{project_f_tower_0ron~f-._.js → project_f_tower_0pf464l._.js} +2 -2
  125. package/.next/server/chunks/ssr/{project_f_tower_0ifpw8k._.js → project_f_tower_0sy7ynr._.js} +2 -2
  126. package/.next/server/chunks/ssr/project_f_tower_0ym-aea._.js +1 -1
  127. package/.next/server/chunks/ssr/{project_f_tower_src_0_g15e8._.js → project_f_tower_src_0bqbs-1._.js} +2 -2
  128. package/.next/server/chunks/ssr/project_f_tower_src_actions_agent-actions_ts_0.s4~m-._.js +2 -2
  129. package/.next/server/chunks/ssr/project_f_tower_src_actions_file-actions_ts_02i742t._.js +1 -1
  130. package/.next/server/chunks/ssr/project_f_tower_src_app_missions_missions-client_tsx_0ums4qx._.js +1 -1
  131. package/.next/server/chunks/ssr/project_f_tower_src_app_onboarding_page_tsx_0_9_yoq._.js +1 -1
  132. package/.next/server/chunks/ssr/project_f_tower_src_app_settings_page_tsx_0oo06~d._.js +1 -1
  133. package/.next/server/chunks/ssr/project_f_tower_src_app_workspaces_[workspaceId]_board-page-client_tsx_0jmj1xz._.js +1 -1
  134. package/.next/server/middleware-build-manifest.js +3 -3
  135. package/.next/server/pages/404.html +1 -1
  136. package/.next/server/pages/500.html +1 -1
  137. package/.next/server/server-reference-manifest.js +1 -1
  138. package/.next/server/server-reference-manifest.json +217 -217
  139. package/.next/static/chunks/{0im8~yii0.2mn.js → 08gl4lr7zkm6b.js} +1 -1
  140. package/.next/static/chunks/0brwcgj_cjdcc.js +1 -0
  141. package/.next/static/chunks/{0vs5vey5ni44t.js → 0q40u78uovc7y.js} +1 -1
  142. package/.next/static/chunks/{00atyrg-7i0hj.js → 0qnvx~5op5b9e.js} +1 -1
  143. package/.next/static/chunks/{0-plp~pgpcel9.js → 0w90t_ngr5_pj.js} +1 -1
  144. package/.next/static/chunks/{0d.3wv6u.2g~6.js → 0x-v4tzitjxub.js} +1 -1
  145. package/.next/static/chunks/{01mymnegugktp.js → 0z-6e_hc3z22b.js} +1 -1
  146. package/.next/static/chunks/{0c49o.5w_cw8_.js → 0z2rpkmoqlr-v.js} +1 -1
  147. package/.next/static/chunks/11gkyogd_hqv~.js +1 -0
  148. package/.next/static/chunks/{09hs9w6-77im2.js → 11y3rfp3d4n.0.js} +1 -1
  149. package/.next/static/chunks/12.91avyb6b7-.js +1 -0
  150. package/.next/static/chunks/12btaaeo1ik-t.js +1 -0
  151. package/.next/static/chunks/{0qp~1_kfjklfg.js → 14zxctn8~z26r.js} +1 -1
  152. package/.next/static/chunks/{09p7-kr_vidww.js → 1660q32oalq26.js} +2 -2
  153. package/.next/static/chunks/{0.do_z22ngnjd.js → 17ckwfwqtxcv7.js} +1 -1
  154. package/.next/trace +2 -2
  155. package/.next/trace-build +1 -1
  156. package/bin/tower.mjs +38 -1
  157. package/package.json +1 -1
  158. package/scripts/init-db.ts +17 -0
  159. package/.next/server/chunks/ssr/[root-of-the-server]__08meal1._.js +0 -3
  160. package/.next/server/chunks/ssr/[root-of-the-server]__0la.lch._.js +0 -3
  161. package/.next/server/chunks/ssr/project_f_tower_0dfyjgz._.js +0 -3
  162. package/.next/static/chunks/09hxu-k8oyivu.js +0 -1
  163. package/.next/static/chunks/0kbuf91gryyo2.js +0 -1
  164. package/.next/static/chunks/0p~3m91-t6p91.js +0 -1
  165. package/.next/static/chunks/15zclhqyib88_.js +0 -1
  166. /package/.next/static/{jMxcHfsOSldWKgvAjGnAv → VzTy7iJ2D58ZvnVnTJZJi}/_buildManifest.js +0 -0
  167. /package/.next/static/{jMxcHfsOSldWKgvAjGnAv → VzTy7iJ2D58ZvnVnTJZJi}/_clientMiddlewareManifest.js +0 -0
  168. /package/.next/static/{jMxcHfsOSldWKgvAjGnAv → VzTy7iJ2D58ZvnVnTJZJi}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[182118,a=>{"use strict";var b=a.i(680889),c=a.i(96063),d=a.i(832116),e=a.i(972795);async function f(a,b){await a.$executeRawUnsafe("DELETE FROM notes_fts WHERE note_id = ?",b.id),await a.$executeRawUnsafe("INSERT INTO notes_fts(note_id, title, content) VALUES (?, ?, ?)",b.id,b.title,b.content)}async function g(a,b){await a.$executeRawUnsafe("DELETE FROM notes_fts WHERE note_id = ?",b)}var h=a.i(632919);let i=c.z.object({title:c.z.string().min(1).max(200),content:c.z.string(),category:c.z.string().max(50).optional(),projectId:c.z.string().min(1),taskId:c.z.string().optional()}),j=c.z.object({title:c.z.string().min(1).max(200).optional(),content:c.z.string().optional(),category:c.z.string().max(50).optional()});async function k(a){let b=i.parse(a),c=await d.db.projectNote.create({data:{title:b.title,content:b.content,category:b.category??"备忘",projectId:b.projectId,taskId:b.taskId??null}});return await f(d.db,{id:c.id,title:c.title,content:c.content}),(0,e.revalidatePath)("/workspace"),c}async function l(a,b){let c=j.parse(b),g=await d.db.projectNote.update({where:{id:a},data:c});return await f(d.db,{id:g.id,title:g.title,content:g.content}),(0,e.revalidatePath)("/workspace"),g}async function m(a){await g(d.db,a),await d.db.projectNote.delete({where:{id:a}}),(0,e.revalidatePath)("/workspace")}async function n(a){return d.db.projectNote.findUnique({where:{id:a}})}async function o(a,b){return d.db.projectNote.findMany({where:{projectId:a,taskId:null,...b?.category?{category:b.category}:{}},orderBy:{updatedAt:"desc"}})}async function p(a){return d.db.projectNote.findMany({where:{taskId:a},orderBy:{updatedAt:"desc"}})}(0,h.ensureServerEntryExports)([k,l,m,n,o,p]),(0,b.registerServerReference)(k,"40940832d36497429d52382d540b1bf916483d4ff0",null),(0,b.registerServerReference)(l,"60fd07387627fb28024e08245f24cc8cd18347f5cb",null),(0,b.registerServerReference)(m,"401c6f7273a2bd99db85bd7b590adde9bc449d70ea",null),(0,b.registerServerReference)(n,"406e10b0e5b005a636bfffc0179d25602c1e985623",null),(0,b.registerServerReference)(o,"606a92319e6dd1574993c46e3d1c683e6e8b915cb7",null),(0,b.registerServerReference)(p,"40c2ab0119ffd4ced8f4a8114ec09a995edc21b272",null),a.s(["createNote",0,k,"deleteNote",0,m,"getNoteById",0,n,"getProjectNotes",0,o,"getTaskNotes",0,p,"updateNote",0,l],182118)},675263,a=>a.a(async(b,c)=>{try{a.i(279254),a.i(30292);var d=a.i(322220),e=a.i(727977);a.i(198433),a.i(541587),a.i(182118);var f=b([d,e]);[d,e]=f.then?(await f)():f,a.s([]),c()}catch(a){c(a)}},!1),365056,a=>a.a(async(b,c)=>{try{var d=a.i(675263),e=a.i(279254),f=a.i(30292),g=a.i(322220),h=a.i(727977),i=a.i(198433),j=a.i(541587),k=a.i(182118),l=b([d,g,h]);[d,g,h]=l.then?(await l)():l,a.s(["002f8c1907daa108abf0de48763ba7242b18c8768d",()=>e.getWorkspacesWithProjects,"00c5a0d3b9b146d2731747fe1a416361d4501fba21",()=>h.getActualWsPort,"00f7de3735ec23dbbe02b347b3b27fe3293c72dd51",()=>j.getOnboardingStatus,"4002a489b8ddf18fe0011eb46ac0739ec3e093a5bf",()=>j.dispatchTaskCompletionEvent,"400c47cd4a543a8a180be1c4384b39a199af461904",()=>e.getProjectByLocalPath,"401227c576cd75dc12c7d7ef6c4acb53b48d853e45",()=>e.getRecentLocalProjects,"401c6f7273a2bd99db85bd7b590adde9bc449d70ea",()=>k.deleteNote,"4025e96d25637009a8b378148032220c259e2e209b",()=>e.deleteWorkspace,"405e24a96c3040b977262f38c5e06b74894259e0be",()=>j.completeOnboarding,"406303a55224e2a9384b4ad81ed3a003d67d23c0a5",()=>f.getLabelsForWorkspace,"406d0755627b7578b91d776cec0fe19e1bb6bfc1e3",()=>j.setOnboardingProgress,"406e10b0e5b005a636bfffc0179d25602c1e985623",()=>k.getNoteById,"407cbea3859811102573ba8273dc5d88a5d811928c",()=>h.resolveGitLocalPath,"40805f406dafafbee2bc2893759657900a249fb949",()=>i.checkMigrationSafety,"40940832d36497429d52382d540b1bf916483d4ff0",()=>k.createNote,"40b43304845d2ab1bbfcca9e8a22572005f72fdee2",()=>e.createWorkspace,"40c2ab0119ffd4ced8f4a8114ec09a995edc21b272",()=>k.getTaskNotes,"40c3e283c4bc09dd0ddeac0fee2d5450add9aba2ef",()=>e.deleteProject,"40d6e8e588bda631b24c5a0e2c634b36786afb4521",()=>e.getOrCreateTowerTaskId,"40de3b59acefdad3d4c0fe96d99c53f2e3910bc5c4",()=>f.createLabel,"40f0eec81bf22876c2506985320bb7faaaeb2e92e7",()=>e.getWorkspaceById,"40f10b98befcfeac7f091134a9d3044dd0589408ae",()=>e.getWorkspacesWithRecentTasks,"40f2f8dd87569241d7237d8e6d9c1062d583dceda0",()=>f.deleteLabel,"40f9512bdf19e6f9f4f666ec480b5d2a34184f2c20",()=>e.createProject,"60422a3dcf869aca6ad2360fc07fff8f7ad667284c",()=>e.updateWorkspace,"6051c20539a0938b9860bfe0dfe34cf20c41177e85",()=>g.globalSearch,"60580b8893845b30deedffa8257cbf297fee7c5689",()=>h.setConfigValue,"6058bc084dfc8fd7335c86f6b96805b28fbfade91d",()=>h.getConfigValue,"606a92319e6dd1574993c46e3d1c683e6e8b915cb7",()=>k.getProjectNotes,"60b8da241b1f9f2d12f9b07df697c5d7cc38d4d2a6",()=>e.updateProject,"60d8faa80f7dca8aa639744b42cee7f20ac78660cd",()=>i.analyzeProjectDirectory,"60f6737005b46b8cdbcf37d9f3db70c559c509ad1a",()=>i.migrateProjectPath,"60fd07387627fb28024e08245f24cc8cd18347f5cb",()=>k.updateNote]),c()}catch(a){c(a)}},!1),939768,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0zugnux._.js"].map(b=>a.l(b))).then(()=>b(326575)))},585988,a=>{a.v(a=>Promise.resolve().then(()=>a(264572)))},908462,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0xe9b6_._.js"].map(b=>a.l(b))).then(()=>b(961374)))},302452,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__13x5mmo._.js"].map(b=>a.l(b))).then(()=>b(396477)))}];
1
+ module.exports=[182118,a=>{"use strict";var b=a.i(680889),c=a.i(96063),d=a.i(832116),e=a.i(972795);async function f(a,b){await a.$executeRawUnsafe("DELETE FROM notes_fts WHERE note_id = ?",b.id),await a.$executeRawUnsafe("INSERT INTO notes_fts(note_id, title, content) VALUES (?, ?, ?)",b.id,b.title,b.content)}async function g(a,b){await a.$executeRawUnsafe("DELETE FROM notes_fts WHERE note_id = ?",b)}var h=a.i(632919);let i=c.z.object({title:c.z.string().min(1).max(200),content:c.z.string(),category:c.z.string().max(50).optional(),projectId:c.z.string().min(1),taskId:c.z.string().optional()}),j=c.z.object({title:c.z.string().min(1).max(200).optional(),content:c.z.string().optional(),category:c.z.string().max(50).optional()});async function k(a){let b=i.parse(a),c=await d.db.projectNote.create({data:{title:b.title,content:b.content,category:b.category??"备忘",projectId:b.projectId,taskId:b.taskId??null}});return await f(d.db,{id:c.id,title:c.title,content:c.content}),(0,e.revalidatePath)("/workspace"),c}async function l(a,b){let c=j.parse(b),g=await d.db.projectNote.update({where:{id:a},data:c});return await f(d.db,{id:g.id,title:g.title,content:g.content}),(0,e.revalidatePath)("/workspace"),g}async function m(a){await g(d.db,a),await d.db.projectNote.delete({where:{id:a}}),(0,e.revalidatePath)("/workspace")}async function n(a){return d.db.projectNote.findUnique({where:{id:a}})}async function o(a,b){return d.db.projectNote.findMany({where:{projectId:a,taskId:null,...b?.category?{category:b.category}:{}},orderBy:{updatedAt:"desc"}})}async function p(a){return d.db.projectNote.findMany({where:{taskId:a},orderBy:{updatedAt:"desc"}})}(0,h.ensureServerEntryExports)([k,l,m,n,o,p]),(0,b.registerServerReference)(k,"40a14fb50f8e1521e2460862f41a35342ff9f82562",null),(0,b.registerServerReference)(l,"60106696cfb3a38c885d1a62d103a7245bcce74638",null),(0,b.registerServerReference)(m,"40d4eb941299e2ff03c49ba2109a99eed07b83e220",null),(0,b.registerServerReference)(n,"400cb172be6506c79826a71c7b061741d3905cf3ef",null),(0,b.registerServerReference)(o,"60e326d1cc2308c73efe4fd3d15b070580276d5805",null),(0,b.registerServerReference)(p,"400451039c091db41044fd8a496545041bc12e3909",null),a.s(["createNote",0,k,"deleteNote",0,m,"getNoteById",0,n,"getProjectNotes",0,o,"getTaskNotes",0,p,"updateNote",0,l],182118)},675263,a=>a.a(async(b,c)=>{try{a.i(279254),a.i(30292);var d=a.i(322220),e=a.i(727977);a.i(198433),a.i(541587),a.i(182118);var f=b([d,e]);[d,e]=f.then?(await f)():f,a.s([]),c()}catch(a){c(a)}},!1),365056,a=>a.a(async(b,c)=>{try{var d=a.i(675263),e=a.i(279254),f=a.i(30292),g=a.i(322220),h=a.i(727977),i=a.i(198433),j=a.i(541587),k=a.i(182118),l=b([d,g,h]);[d,g,h]=l.then?(await l)():l,a.s(["000fb4e39ec972db9511a0189892de76b46ee6e9aa",()=>j.getOnboardingStatus,"0044f2a6c1b0bdfe3f96fd2a1acd67295b6a2b25e2",()=>e.getWorkspacesWithProjects,"0073dca5d0325409af9b7177621b17fe326cebe488",()=>h.getActualWsPort,"400261a6fb1c366a989585444549d8506d4ba9db8c",()=>e.getRecentLocalProjects,"400451039c091db41044fd8a496545041bc12e3909",()=>k.getTaskNotes,"40063460d41622db1f63f741d432114ef2650a1f76",()=>e.getProjectByLocalPath,"400cb172be6506c79826a71c7b061741d3905cf3ef",()=>k.getNoteById,"400e586f307193ff83593c8d63bc62693553e1afa6",()=>f.getLabelsForWorkspace,"400ffa9303f88489448dd9899070241e26f745a58e",()=>e.deleteWorkspace,"4011bcdb946bba1c505087e70f156fd3989f3b872c",()=>f.deleteLabel,"401a86ff2781c007191e772caa16e4b6e7441b15d0",()=>e.deleteProject,"40527223fea127872c68668224c5822eebbb9bf090",()=>e.createProject,"4061302b8376f5d81135ccb1917c082eef7fca658a",()=>j.completeOnboarding,"4066597f1dfdab694851c822ca15c24d24face6c31",()=>i.checkMigrationSafety,"407fb2d0b204a4d0a175a5354170db11c9aafc3f36",()=>e.getWorkspacesWithRecentTasks,"40846f4f265949956da690418ff68309c0851110fb",()=>f.createLabel,"4086718196d2df7c995adeceabd3b4eff491f6f38a",()=>j.setOnboardingProgress,"409b01a0501cd6418e001637818a45b4908f321079",()=>h.resolveGitLocalPath,"409c0dd81d080577529994de4ce29a7c0a38dc7435",()=>j.dispatchTaskCompletionEvent,"40a14fb50f8e1521e2460862f41a35342ff9f82562",()=>k.createNote,"40ac52fbeec4ccb55e6302a7b3041b70a3fb54f683",()=>e.getWorkspaceById,"40d4eb941299e2ff03c49ba2109a99eed07b83e220",()=>k.deleteNote,"40f970bc0ca57ada0365f4088ef980b207fcf6a70c",()=>e.getOrCreateTowerTaskId,"40faf9e78c567cc29ecc3a4fd055cf407081d3fe02",()=>e.createWorkspace,"600866e086353c584288550341453060402c288c51",()=>e.updateProject,"60106696cfb3a38c885d1a62d103a7245bcce74638",()=>k.updateNote,"60579c28d1aed49c267cd531a1ee57bace8684177a",()=>i.analyzeProjectDirectory,"609b34226fbdf6994c63c038d9626094d8aaf093ec",()=>h.setConfigValue,"60b02796ca653ae818f77fac2e586c17f35e2a0c3e",()=>g.globalSearch,"60bf23fbae56b423bfa90b83d2f9e12132dafa55e0",()=>i.migrateProjectPath,"60c210ff07fecafa2265f30dd96eb4de225a19aa77",()=>h.getConfigValue,"60c990d709c90f774c38bf1afe3b56340413c9293b",()=>e.updateWorkspace,"60e326d1cc2308c73efe4fd3d15b070580276d5805",()=>k.getProjectNotes]),c()}catch(a){c(a)}},!1),939768,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0zugnux._.js"].map(b=>a.l(b))).then(()=>b(326575)))},585988,a=>{a.v(a=>Promise.resolve().then(()=>a(264572)))},908462,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0xe9b6_._.js"].map(b=>a.l(b))).then(()=>b(961374)))},302452,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__13x5mmo._.js"].map(b=>a.l(b))).then(()=>b(396477)))}];
2
2
 
3
3
  //# sourceMappingURL=project_f_tower_0.txwd8._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[728368,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("78ab7eecbea7614803c9f0cb4a2733e3f634910bc7",b.callServer,void 0,b.findSourceMapURL,"startPtyExecution");a.s(["startPtyExecution",0,c])},429621,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("406890b0e5ee52733eeef868cadf92a5b3ddd4f051",b.callServer,void 0,b.findSourceMapURL,"stopPtyExecution");a.s(["stopPtyExecution",0,c])},967086,595313,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("60966a0a06af6d734814331b4feab1d5c25c68b327",b.callServer,void 0,b.findSourceMapURL,"resumePtyExecution");a.s(["resumePtyExecution",0,c],967086);let d=(0,a.i(302856).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);a.s(["RotateCcw",0,d],595313)},57726,891903,a=>{"use strict";var b=a.i(65735);a.s(["CheckCircle2",()=>b.default],57726);let c=(0,a.i(302856).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);a.s(["XCircle",0,c],891903)},236413,a=>{"use strict";let b=(0,a.i(302856).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);a.s(["Terminal",0,b],236413)},506008,a=>{"use strict";var b=a.i(360295);a.s(["ChevronRight",()=>b.default])},769726,a=>{"use strict";let b=(0,a.i(302856).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);a.s(["ChevronLeft",0,b],769726)},113620,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"])},589492,29602,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40a14fb50f8e1521e2460862f41a35342ff9f82562",b.callServer,void 0,b.findSourceMapURL,"createNote");a.s(["createNote",0,c],589492);let d=(0,b.createServerReference)("40d4eb941299e2ff03c49ba2109a99eed07b83e220",b.callServer,void 0,b.findSourceMapURL,"deleteNote");a.s(["deleteNote",0,d],29602)},48300,a=>{"use strict";var b=a.i(293785),c=a.i(256116),d=a.i(488137),e=a.i(44585);let f=(0,d.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});a.s(["Badge",0,function({className:a,variant:d="default",render:g,...h}){var i;return i={defaultTagName:"span",props:(0,b.mergeProps)({className:(0,e.cn)(f({variant:d}),a)},h),render:g,state:{slot:"badge",variant:d}},(0,c.useRenderElement)(i.defaultTagName??"div",i,i)}],48300)},988977,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("406d2663b3d37c90d4cfccca5c89eddd5a3481f246",b.callServer,void 0,b.findSourceMapURL,"getPrompts");a.s(["getPrompts",0,c])},889822,a=>{"use strict";var b=a.i(858360),c=a.i(44585);a.s(["Label",0,function({className:a,...d}){return(0,b.jsx)("label",{"data-slot":"label",className:(0,c.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...d})}])},59711,a=>{"use strict";let b=(0,a.i(302856).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);a.s(["ArrowLeft",0,b],59711)},468518,a=>{"use strict";var b=a.i(858360),c=a.i(44585);a.s(["EmptyState",0,function({icon:a,title:d,description:e,action:f,className:g}){return(0,b.jsxs)("div",{className:(0,c.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",g),children:[a&&(0,b.jsx)(a,{className:"h-10 w-10 text-muted-foreground/40"}),(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:d}),e&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:e}),f&&(0,b.jsx)("div",{className:"mt-2",children:f})]})}])},236345,a=>{"use strict";let b=(0,a.i(302856).default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);a.s(["PlayCircle",0,b],236345)},208168,13207,a=>{"use strict";let b=(0,a.i(302856).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);a.s(["Upload",0,b],208168);var c=a.i(879876);let d=(0,c.createServerReference)("4016235521118ea84740785c18edc604b6ae43b33f",c.callServer,void 0,c.findSourceMapURL,"uploadAsset");a.s(["uploadAsset",0,d],13207)},8761,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40f4233344f4028e7561334fae8880577d4b84d654",b.callServer,void 0,b.findSourceMapURL,"deleteAsset");a.s(["deleteAsset",0,c])}];
2
+
3
+ //# sourceMappingURL=project_f_tower_01tnhbx._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[57726,891903,a=>{"use strict";var b=a.i(65735);a.s(["CheckCircle2",()=>b.default],57726);let c=(0,a.i(302856).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);a.s(["XCircle",0,c],891903)},236413,a=>{"use strict";let b=(0,a.i(302856).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);a.s(["Terminal",0,b],236413)},506008,a=>{"use strict";var b=a.i(360295);a.s(["ChevronRight",()=>b.default])},48300,a=>{"use strict";var b=a.i(293785),c=a.i(256116),d=a.i(488137),e=a.i(44585);let f=(0,d.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});a.s(["Badge",0,function({className:a,variant:d="default",render:g,...h}){var i;return i={defaultTagName:"span",props:(0,b.mergeProps)({className:(0,e.cn)(f({variant:d}),a)},h),render:g,state:{slot:"badge",variant:d}},(0,c.useRenderElement)(i.defaultTagName??"div",i,i)}],48300)},986698,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40b2fed3c8e27c9a082b7c8dd48ccbc23887a13c78",b.callServer,void 0,b.findSourceMapURL,"getPrompts");a.s(["getPrompts",0,c])},348703,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("78fb8fa47faed28ab00400d74b16e6f120e94f9b12",b.callServer,void 0,b.findSourceMapURL,"startPtyExecution");a.s(["startPtyExecution",0,c])},730611,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("401f463b01e74265a5a0f6a651625dbaa23ce7f0de",b.callServer,void 0,b.findSourceMapURL,"stopPtyExecution");a.s(["stopPtyExecution",0,c])},416902,595313,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("602e857033f412e1832ad1c46ff2b99c02da07294f",b.callServer,void 0,b.findSourceMapURL,"resumePtyExecution");a.s(["resumePtyExecution",0,c],416902);let d=(0,a.i(302856).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);a.s(["RotateCcw",0,d],595313)},113486,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40dda63072b6d9478cbe91e491c6fb8f623ed50bdc",b.callServer,void 0,b.findSourceMapURL,"openInTerminal");a.s(["openInTerminal",0,c])},59711,a=>{"use strict";let b=(0,a.i(302856).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);a.s(["ArrowLeft",0,b],59711)},468518,a=>{"use strict";var b=a.i(858360),c=a.i(44585);a.s(["EmptyState",0,function({icon:a,title:d,description:e,action:f,className:g}){return(0,b.jsxs)("div",{className:(0,c.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",g),children:[a&&(0,b.jsx)(a,{className:"h-10 w-10 text-muted-foreground/40"}),(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:d}),e&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:e}),f&&(0,b.jsx)("div",{className:"mt-2",children:f})]})}])},236345,a=>{"use strict";let b=(0,a.i(302856).default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);a.s(["PlayCircle",0,b],236345)},797896,a=>{"use strict";let b=(0,a.i(302856).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);a.s(["Eye",0,b],797896)},280210,412963,647045,12513,58996,33130,276587,554577,978072,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("600671d1d6e7a224405039d8d77d38721dccef91a5",b.callServer,void 0,b.findSourceMapURL,"listDirectory");a.s(["listDirectory",0,c],280210);let d=(0,b.createServerReference)("706e0a9f509c35c3b59d1839a2251fbd3b6e843b68",b.callServer,void 0,b.findSourceMapURL,"getGitStatus");a.s(["getGitStatus",0,d],412963);let e=(0,b.createServerReference)("60d03c2ef96057ffcc15e87f6d8e38e7d6e5e98ea3",b.callServer,void 0,b.findSourceMapURL,"createFile");a.s(["createFile",0,e],647045);let f=(0,b.createServerReference)("60080268456ba09ec6e80a70b2a94954ed7d4e5908",b.callServer,void 0,b.findSourceMapURL,"createDirectory");a.s(["createDirectory",0,f],12513);let g=(0,b.createServerReference)("7089e089fd2451f5abedcded3a012391d5413ecfc8",b.callServer,void 0,b.findSourceMapURL,"renameEntry");a.s(["renameEntry",0,g],58996);let h=(0,b.createServerReference)("601f604fadf0517208b49582f2630a520c9049c3af",b.callServer,void 0,b.findSourceMapURL,"deleteEntry");a.s(["deleteEntry",0,h],33130);let i=(0,b.createServerReference)("40842f1c734540be453d1bba1a6b19adf56694c258",b.callServer,void 0,b.findSourceMapURL,"listAllFiles");a.s(["listAllFiles",0,i],276587);let j=(0,b.createServerReference)("60c7ccc1a8dd11c1e64102b953e1c1c8b7d35a30c4",b.callServer,void 0,b.findSourceMapURL,"readFileContent");a.s(["readFileContent",0,j],554577);let k=(0,b.createServerReference)("702b1e33a125c6fd6ea494d556ecdd28218e51172c",b.callServer,void 0,b.findSourceMapURL,"writeFileContent");a.s(["writeFileContent",0,k],978072)},523151,a=>{a.v(b=>Promise.all(["server/chunks/ssr/project_f_tower_src_actions_file-actions_ts_02i742t._.js"].map(b=>a.l(b))).then(()=>b(5533)))},785402,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0j~t_@monaco-editor_react_dist_index_mjs_0m1qx-m._.js"].map(b=>a.l(b))).then(()=>b(963908)))}];
1
+ module.exports=[57726,891903,a=>{"use strict";var b=a.i(65735);a.s(["CheckCircle2",()=>b.default],57726);let c=(0,a.i(302856).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);a.s(["XCircle",0,c],891903)},236413,a=>{"use strict";let b=(0,a.i(302856).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);a.s(["Terminal",0,b],236413)},506008,a=>{"use strict";var b=a.i(360295);a.s(["ChevronRight",()=>b.default])},48300,a=>{"use strict";var b=a.i(293785),c=a.i(256116),d=a.i(488137),e=a.i(44585);let f=(0,d.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});a.s(["Badge",0,function({className:a,variant:d="default",render:g,...h}){var i;return i={defaultTagName:"span",props:(0,b.mergeProps)({className:(0,e.cn)(f({variant:d}),a)},h),render:g,state:{slot:"badge",variant:d}},(0,c.useRenderElement)(i.defaultTagName??"div",i,i)}],48300)},988977,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("406d2663b3d37c90d4cfccca5c89eddd5a3481f246",b.callServer,void 0,b.findSourceMapURL,"getPrompts");a.s(["getPrompts",0,c])},728368,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("78ab7eecbea7614803c9f0cb4a2733e3f634910bc7",b.callServer,void 0,b.findSourceMapURL,"startPtyExecution");a.s(["startPtyExecution",0,c])},429621,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("406890b0e5ee52733eeef868cadf92a5b3ddd4f051",b.callServer,void 0,b.findSourceMapURL,"stopPtyExecution");a.s(["stopPtyExecution",0,c])},967086,595313,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("60966a0a06af6d734814331b4feab1d5c25c68b327",b.callServer,void 0,b.findSourceMapURL,"resumePtyExecution");a.s(["resumePtyExecution",0,c],967086);let d=(0,a.i(302856).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);a.s(["RotateCcw",0,d],595313)},286165,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40792086b8ddfc45eea4746341d7e08bb697ebc030",b.callServer,void 0,b.findSourceMapURL,"openInTerminal");a.s(["openInTerminal",0,c])},59711,a=>{"use strict";let b=(0,a.i(302856).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);a.s(["ArrowLeft",0,b],59711)},468518,a=>{"use strict";var b=a.i(858360),c=a.i(44585);a.s(["EmptyState",0,function({icon:a,title:d,description:e,action:f,className:g}){return(0,b.jsxs)("div",{className:(0,c.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",g),children:[a&&(0,b.jsx)(a,{className:"h-10 w-10 text-muted-foreground/40"}),(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:d}),e&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:e}),f&&(0,b.jsx)("div",{className:"mt-2",children:f})]})}])},236345,a=>{"use strict";let b=(0,a.i(302856).default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);a.s(["PlayCircle",0,b],236345)},797896,a=>{"use strict";let b=(0,a.i(302856).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);a.s(["Eye",0,b],797896)},499548,650820,46848,713972,911529,309825,700677,715808,543514,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("60d32c896770d00ee60968d2f4a6f93cb53c6989b1",b.callServer,void 0,b.findSourceMapURL,"listDirectory");a.s(["listDirectory",0,c],499548);let d=(0,b.createServerReference)("70af77281fe063895a5f6266ed626de0667036ef66",b.callServer,void 0,b.findSourceMapURL,"getGitStatus");a.s(["getGitStatus",0,d],650820);let e=(0,b.createServerReference)("607bb6cdd595ec251d8200b11aa6379514e9bb92bd",b.callServer,void 0,b.findSourceMapURL,"createFile");a.s(["createFile",0,e],46848);let f=(0,b.createServerReference)("60f748646e24727b93b7b2da9d9ebfdae83aa421fd",b.callServer,void 0,b.findSourceMapURL,"createDirectory");a.s(["createDirectory",0,f],713972);let g=(0,b.createServerReference)("70d82079fb3cb3dc77c64d391b0ee3d95862c943e4",b.callServer,void 0,b.findSourceMapURL,"renameEntry");a.s(["renameEntry",0,g],911529);let h=(0,b.createServerReference)("6004a2a5b698029c5c50837854d75529113281e963",b.callServer,void 0,b.findSourceMapURL,"deleteEntry");a.s(["deleteEntry",0,h],309825);let i=(0,b.createServerReference)("40a8695a0f8936e4d3a0b4fb3da1e26ec680d5722e",b.callServer,void 0,b.findSourceMapURL,"listAllFiles");a.s(["listAllFiles",0,i],700677);let j=(0,b.createServerReference)("60d24307de454aa2c7a62e02d6da39bc7effec5115",b.callServer,void 0,b.findSourceMapURL,"readFileContent");a.s(["readFileContent",0,j],715808);let k=(0,b.createServerReference)("70de9666123a4c1a7514552421fd63a12a94243440",b.callServer,void 0,b.findSourceMapURL,"writeFileContent");a.s(["writeFileContent",0,k],543514)},523151,a=>{a.v(b=>Promise.all(["server/chunks/ssr/project_f_tower_src_actions_file-actions_ts_02i742t._.js"].map(b=>a.l(b))).then(()=>b(5533)))},785402,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0j~t_@monaco-editor_react_dist_index_mjs_0m1qx-m._.js"].map(b=>a.l(b))).then(()=>b(963908)))}];
2
2
 
3
- //# sourceMappingURL=project_f_tower_0.k8r5w._.js.map
3
+ //# sourceMappingURL=project_f_tower_0760i8j._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[272932,a=>{"use strict";let b=(0,a.i(302856).default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);a.s(["Lightbulb",0,b],272932)},801231,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("60b8da241b1f9f2d12f9b07df697c5d7cc38d4d2a6",b.callServer,void 0,b.findSourceMapURL,"updateProject");a.s(["updateProject",0,c])},929526,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(61966),e=a.i(354994),f=a.i(410215),g=a.i(858967),h=a.i(109434),i=a.i(857122),j=a.i(410756),k=a.i(620235),l=a.i(246962),m=a.i(584335);a.s(["CreateBranchDialog",0,function({open:a,onOpenChange:n,branches:o,currentBranch:p,localPath:q,onCreated:r,onError:s}){let{t}=(0,m.useI18n)(),[u,v]=(0,c.useState)(""),[w,x]=(0,c.useState)(p),[y,z]=(0,c.useState)(""),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(""),[E,F]=(0,c.useState)(!1);(0,c.useEffect)(()=>{a&&(v(""),x(p),z(""),D(""))},[a,p]);let G=[...new Set(o)].filter(a=>a.toLowerCase().includes(C.toLowerCase())),H=async()=>{if(u.trim()){B(!0);try{let a=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create-branch",path:q,branch:u.trim(),baseBranch:w})});if(a.ok)n(!1),r();else{let b=await a.json();s(b.error||"Unknown error")}}catch{s("Network error")}finally{B(!1)}}};return(0,b.jsx)(i.Dialog,{open:a,onOpenChange:n,children:(0,b.jsxs)(i.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(i.DialogHeader,{children:(0,b.jsx)(i.DialogTitle,{children:t("git.createBranch")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:t("git.branchName")}),(0,b.jsx)(k.Input,{value:u,onChange:a=>v(a.target.value),placeholder:t("git.branchNamePlaceholder"),className:"mt-1.5 font-mono text-xs",onKeyDown:a=>"Enter"===a.key&&H()})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:t("git.baseBranch")}),(0,b.jsxs)("div",{className:"relative mt-1.5",children:[(0,b.jsxs)("button",{onClick:()=>F(!E),className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(d.GitBranch,{className:"h-3 w-3 text-emerald-400"}),(0,b.jsx)("span",{className:"font-mono text-xs text-foreground",children:w})]}),(0,b.jsx)(e.ChevronDown,{className:`h-3 w-3 text-muted-foreground transition-transform ${E?"rotate-180":""}`})]}),E&&(0,b.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,b.jsx)("div",{className:"border-b border-border p-1.5",children:(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(f.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,b.jsx)("input",{value:C,onChange:a=>D(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,b.jsx)("div",{className:"max-h-40 overflow-auto py-1",children:G.map(a=>(0,b.jsxs)("button",{onClick:()=>{x(a),F(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${a===w?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,b.jsx)(d.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",children:a}),a===w&&(0,b.jsx)(g.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},a))})]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:t("git.branchDesc")}),(0,b.jsx)(l.Textarea,{value:y,onChange:a=>z(a.target.value),placeholder:t("git.branchDescPlaceholder"),rows:2,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"})]})]}),(0,b.jsxs)(i.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>n(!1),children:t("common.cancel")}),(0,b.jsxs)(j.Button,{onClick:H,disabled:!u.trim()||A,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[A?(0,b.jsx)(h.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,t("common.create")]})]})]})})}])},460143,a=>{"use strict";let b=(0,a.i(302856).default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);a.s(["ArrowUpFromLine",0,b],460143)},820838,a=>{"use strict";async function b(a,c,d={}){let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:c,path:a,...d})});if(!e.ok)throw Error((await e.json()).error||`${c} failed`);return e.json()}a.s(["gitAction",0,b])},105916,418841,a=>{"use strict";let b=(0,a.i(302856).default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);a.s(["Square",0,b],105916);var c=a.i(582812);a.s(["AlertTriangle",()=>c.default],418841)},983869,a=>{"use strict";let b=(0,a.i(302856).default)("git-compare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);a.s(["GitCompare",0,b],983869)},641804,569720,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(506008),e=a.i(354994),f=a.i(418841),g=a.i(983869),h=a.i(302856);let i=(0,h.default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);var j=a.i(410756),k=a.i(468518),l=a.i(48300),m=a.i(857122),n=a.i(246962),o=a.i(584335);a.s(["TaskDiffView",0,function({files:a,totalAdded:h,totalRemoved:p,hasConflicts:q,conflictFiles:r,onCommit:s,hasUncommitted:t}){let{t:u}=(0,o.useI18n)(),[v,w]=(0,c.useState)(new Set),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(""),[B,C]=(0,c.useState)(!1);return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 flex-shrink-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"font-medium text-foreground",children:[a.length," files changed"]}),(0,b.jsxs)("span",{className:"text-green-400 font-mono text-xs",children:["+",h]}),(0,b.jsxs)("span",{className:"text-red-400 font-mono text-xs",children:["-",p]})]}),(0,b.jsx)("div",{className:"flex items-center gap-2",children:t&&s&&(0,b.jsxs)(j.Button,{variant:"outline",onClick:()=>y(!0),className:"gap-2",children:[(0,b.jsx)(i,{className:"h-4 w-4"}),u("diff.commit")]})})]}),q&&(0,b.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border bg-amber-500/5 px-4 py-3 flex-shrink-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-amber-400",children:[(0,b.jsx)(f.AlertTriangle,{className:"h-4 w-4 flex-shrink-0"}),(0,b.jsxs)("span",{className:"text-sm font-medium",children:["Merge blocked: ",r.length," conflicting file",1!==r.length?"s":""]})]}),(0,b.jsx)("ul",{className:"ml-6 space-y-1",children:r.map(a=>(0,b.jsx)("li",{className:"text-xs font-mono text-amber-300/80",children:a},a))})]}),(0,b.jsx)("div",{className:"flex-1 overflow-auto",children:0===a.length?(0,b.jsx)(k.EmptyState,{icon:g.GitCompare,title:u("diff.noChanges"),className:"h-full"}):(0,b.jsx)("div",{className:"divide-y divide-border",children:a.map(a=>{let c=v.has(a.filename);return(0,b.jsxs)("div",{children:[(0,b.jsxs)(j.Button,{variant:"ghost",type:"button",onClick:()=>{var b;return b=a.filename,void w(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"flex w-full items-center gap-2 px-4 py-2.5 text-left hover:bg-accent/50 transition-colors rounded-none h-auto",children:[c?(0,b.jsx)(e.ChevronDown,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}):(0,b.jsx)(d.ChevronRight,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 truncate text-sm font-mono text-foreground",children:a.filename}),a.isBinary?(0,b.jsx)(l.Badge,{variant:"secondary",className:"text-[10px] bg-muted text-muted-foreground border border-border",children:"Binary"}):(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsxs)("span",{className:"text-xs font-mono text-green-400",children:["+",a.added]}),(0,b.jsxs)("span",{className:"text-xs font-mono text-red-400",children:["-",a.removed]})]})]}),c&&a.patch&&(0,b.jsx)("div",{className:"border-t border-border bg-background",children:(0,b.jsx)("pre",{className:"overflow-x-auto p-0 text-xs font-mono leading-5",children:a.patch.split("\n").map((a,c)=>{let d=a.startsWith("+")&&!a.startsWith("+++")?"px-4 block bg-green-500/10 text-green-400":a.startsWith("-")&&!a.startsWith("---")?"px-4 block bg-red-500/10 text-red-400":a.startsWith("@@")?"px-4 block bg-blue-500/10 text-blue-300":"px-4 block text-muted-foreground";return(0,b.jsx)("span",{className:d,children:a||" "},c)})})})]},a.filename)})})}),(0,b.jsx)(m.Dialog,{open:x,onOpenChange:y,children:(0,b.jsxs)(m.DialogContent,{className:"max-w-md",children:[(0,b.jsx)(m.DialogHeader,{children:(0,b.jsx)(m.DialogTitle,{children:u("diff.commitChanges")})}),(0,b.jsx)("div",{className:"flex flex-col gap-3",children:(0,b.jsx)(n.Textarea,{value:z,onChange:a=>A(a.target.value),placeholder:u("diff.commitMessagePlaceholder"),rows:5,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none resize-y min-h-[80px]"})}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"ghost",onClick:()=>y(!1),children:u("common.cancel")}),(0,b.jsx)(j.Button,{onClick:async()=>{if(z.trim()&&s){C(!0);try{await s(z.trim()),A(""),y(!1)}finally{C(!1)}}},disabled:!z.trim()||B,children:B?"...":u("diff.commit")})]})]})})]})}],641804);var p=a.i(448287);let q=(0,h.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var r=a.i(109434);a.s(["TaskMergeConfirmDialog",0,function({open:a,onOpenChange:d,taskId:e,taskTitle:f,baseBranch:g,fileCount:h,commitCount:i,commitLog:k=[],onMergeComplete:l}){let n=(0,p.useRouter)(),[o,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(null),v=async()=>{s(!0),u(null);try{let a=await fetch(`/api/tasks/${e}/merge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(a.ok){d(!1),l(),n.refresh();return}let b=await a.json().catch(()=>({error:"Merge failed"}));409===a.status?u(`Merge conflicts detected: ${Array.isArray(b.conflictFiles)?b.conflictFiles.join(", "):"unknown files"}`):u(b.error??"Merge failed")}catch{u("Network error — merge failed")}finally{s(!1)}};return(0,b.jsx)(m.Dialog,{open:a,onOpenChange:d,children:(0,b.jsxs)(m.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,b.jsx)(m.DialogHeader,{children:(0,b.jsxs)(m.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(q,{className:"h-4 w-4 text-emerald-400"}),"Confirm Merge"]})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Target branch"}),(0,b.jsx)("code",{className:"text-xs font-mono bg-muted px-2 py-0.5 rounded text-foreground",children:g})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Changed files"}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:h})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Commits"}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:i})]})]}),k.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:"Commits"}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:k.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))})]}),t&&(0,b.jsx)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2",children:(0,b.jsx)("p",{className:"text-xs text-red-400",children:t})})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"}),(0,b.jsx)(j.Button,{onClick:v,disabled:o,className:"gap-2",children:o?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Loader2,{className:"h-4 w-4 animate-spin"}),"Merging..."]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{className:"h-4 w-4"}),"Confirm Merge"]})})]})]})})}],569720)},273489,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("405330cd9709f40037aa83521bdac7044a93b13641",b.callServer,void 0,b.findSourceMapURL,"getTaskExecutions");a.s(["getTaskExecutions",0,c])},394552,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("4036dc278fce434992e90dd8958b9fa89e1c22580c",b.callServer,void 0,b.findSourceMapURL,"continueLatestPtyExecution");a.s(["continueLatestPtyExecution",0,c])},432378,112763,719666,536453,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("60d8d8ed534f28b32d271c58f8f9f2511c65003bdb",b.callServer,void 0,b.findSourceMapURL,"updateTaskStatus");a.s(["updateTaskStatus",0,c],432378);let d=(0,b.createServerReference)("40ec4f72b679f0487a21d7166d20412c1d3e4f1feb",b.callServer,void 0,b.findSourceMapURL,"checkWorktreeClean");a.s(["checkWorktreeClean",0,d],112763);let e=(0,b.createServerReference)("6030bc338dcedc06ab38184da02f82e242e2e73465",b.callServer,void 0,b.findSourceMapURL,"commitWorktreeChanges");a.s(["commitWorktreeChanges",0,e],719666);let f=(0,a.i(302856).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);a.s(["Clock",0,f],536453)},884284,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(354994),e=a.i(413857),f=a.i(57726),g=a.i(891903),h=a.i(109434),i=a.i(536453),j=a.i(236345),k=a.i(595313),l=a.i(272932);let m=(0,a.i(302856).default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var n=a.i(410756),o=a.i(468518),p=a.i(584335);function q({status:a}){switch(a){case"COMPLETED":return(0,b.jsx)(f.CheckCircle2,{className:"h-4 w-4 text-emerald-400"});case"FAILED":return(0,b.jsx)(g.XCircle,{className:"h-4 w-4 text-red-400"});case"RUNNING":return(0,b.jsx)(h.Loader2,{className:"h-4 w-4 text-blue-400 animate-spin"});default:return(0,b.jsx)(i.Clock,{className:"h-4 w-4 text-neutral-500"})}}a.s(["ExecutionTimeline",0,function({executions:a,onResume:f,onContinueLatest:g}){let{t:h,locale:i}=(0,p.useI18n)(),[r,s]=(0,c.useState)(null),[t,u]=(0,c.useState)(null);return 0===a.length?(0,b.jsx)(o.EmptyState,{icon:m,title:h("execution.noHistory")}):(0,b.jsxs)("div",{className:"space-y-2 p-3",children:[(0,b.jsx)("p",{className:"px-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:h("execution.history")}),a.map(c=>{let m=function(a){if(!a)return null;try{return JSON.parse(a)}catch{return null}}(c.gitStats??null),o=function(a,b){if(!a||!b)return"";let c=new Date(b).getTime()-new Date(a).getTime();if(c<0)return"";let d=Math.floor(c/1e3);if(d<60)return`${d}s`;let e=Math.floor(d/60);if(e<60)return`${e}m ${d%60}s`;let f=Math.floor(e/60);return`${f}h ${e%60}m`}(c.startedAt??null,c.endedAt??null),p=r===c.id;return(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-background/50 overflow-hidden",children:[(0,b.jsxs)("div",{className:"p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)(q,{status:c.status}),(0,b.jsx)("span",{className:`font-medium ${function(a){switch(a){case"COMPLETED":return"text-emerald-400";case"FAILED":return"text-red-400";case"RUNNING":return"text-blue-400";default:return"text-neutral-400"}}(c.status)}`,children:function(a,b){switch(a){case"COMPLETED":return b("execution.success");case"FAILED":return b("execution.failed");case"RUNNING":return b("execution.running");default:return a}}(c.status,h)}),(0,b.jsx)("span",{className:"text-muted-foreground",children:function(a,b="zh"){if(!a)return"";let c=new Date(a),d=Math.floor((new Date().getTime()-c.getTime())/864e5),e="zh"===b?"zh-CN":"en-US",f=c.toLocaleTimeString(e,{hour:"2-digit",minute:"2-digit"});return 0===d?f:1===d?"zh"===b?`昨天 ${f}`:`Yesterday ${f}`:d<7?"zh"===b?`${d}天前 ${f}`:`${d}d ago ${f}`:c.toLocaleDateString(e,{month:"2-digit",day:"2-digit"})+" "+f}(c.startedAt??null,i)}),o&&(0,b.jsxs)("span",{className:"text-muted-foreground/60",children:["(",o,")"]})]}),(0,b.jsx)("p",{className:"mt-1.5 text-sm text-foreground/80 line-clamp-2",children:c.summary||h("execution.noSummary")}),m&&(m.commits||m.filesChanged)&&(0,b.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground font-mono",children:[m.commits?(0,b.jsxs)("span",{children:[m.commits," ",h("execution.commits")]}):null,m.filesChanged?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{children:[m.filesChanged," ",h("execution.files")]})]}):null,m.insertions||m.deletions?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),m.insertions?(0,b.jsxs)("span",{className:"text-emerald-500",children:["+",m.insertions]}):null,m.deletions?(0,b.jsxs)("span",{className:"text-red-400",children:["-",m.deletions]}):null]}):null]}),c.insightNote&&(0,b.jsxs)("div",{className:"mt-2",children:[(0,b.jsxs)("button",{onClick:()=>u(t===c.id?null:c.id),className:"flex items-center gap-1.5 text-xs text-primary/90 hover:text-primary transition-colors",children:[(0,b.jsx)(l.Lightbulb,{className:"h-3.5 w-3.5"}),(0,b.jsxs)("span",{className:"font-medium",children:[h("execution.insight"),":"]}),(0,b.jsx)("span",{className:"text-foreground/70 truncate max-w-[200px]",children:c.insightNote.title}),t===c.id?(0,b.jsx)(e.ChevronUp,{className:"h-3 w-3"}):(0,b.jsx)(d.ChevronDown,{className:"h-3 w-3"})]}),t===c.id&&(0,b.jsx)("div",{className:"mt-2 rounded-md bg-primary/[0.06] border border-primary/10 p-3 text-xs text-foreground/80 whitespace-pre-wrap",children:c.insightNote.content})]}),(0,b.jsxs)("div",{className:"mt-2.5 flex items-center gap-2",children:[c.sessionId&&f?(0,b.jsxs)(n.Button,{size:"sm",onClick:()=>f(c.sessionId),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(j.PlayCircle,{className:"h-3.5 w-3.5"}),h("execution.resume")]}):!c.sessionId&&"FAILED"===c.status&&c.id===a[0]?.id&&g?(0,b.jsxs)(n.Button,{size:"sm",onClick:g,className:"bg-blue-500/15 text-blue-300 ring-1 ring-blue-500/20 hover:bg-blue-500/25",children:[(0,b.jsx)(k.RotateCcw,{className:"h-3.5 w-3.5"}),h("execution.tryRecover")]}):null,(0,b.jsxs)(n.Button,{variant:"ghost",size:"sm",onClick:()=>s(p?null:c.id),className:"bg-muted text-muted-foreground",children:[p?(0,b.jsx)(e.ChevronUp,{className:"h-3.5 w-3.5"}):(0,b.jsx)(d.ChevronDown,{className:"h-3.5 w-3.5"}),p?h("execution.collapse"):h("execution.details")]})]})]}),p&&(0,b.jsxs)("div",{className:"border-t border-border px-3 pb-3 space-y-3",children:[c.gitLog&&(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:h("execution.gitLog")}),(0,b.jsx)("pre",{className:"rounded-md bg-muted/50 p-2.5 text-xs font-mono text-foreground/70 overflow-x-auto whitespace-pre-wrap",children:c.gitLog.split("\n").slice(0,3).join("\n")})]}),c.terminalLog&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:h("execution.terminalOutput")}),(0,b.jsx)("pre",{className:"rounded-md bg-[#0f1419] p-2.5 text-xs font-mono text-neutral-300 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:c.terminalLog})]}),"FAILED"===c.status&&null!=c.exitCode&&(0,b.jsxs)("p",{className:"text-xs text-red-400/70",children:["Exit code: ",c.exitCode]})]})]},c.id)})]})}],884284)}];
1
+ module.exports=[272932,a=>{"use strict";let b=(0,a.i(302856).default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);a.s(["Lightbulb",0,b],272932)},677647,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("600866e086353c584288550341453060402c288c51",b.callServer,void 0,b.findSourceMapURL,"updateProject");a.s(["updateProject",0,c])},929526,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(61966),e=a.i(354994),f=a.i(410215),g=a.i(858967),h=a.i(109434),i=a.i(857122),j=a.i(410756),k=a.i(620235),l=a.i(246962),m=a.i(584335);a.s(["CreateBranchDialog",0,function({open:a,onOpenChange:n,branches:o,currentBranch:p,localPath:q,onCreated:r,onError:s}){let{t}=(0,m.useI18n)(),[u,v]=(0,c.useState)(""),[w,x]=(0,c.useState)(p),[y,z]=(0,c.useState)(""),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(""),[E,F]=(0,c.useState)(!1);(0,c.useEffect)(()=>{a&&(v(""),x(p),z(""),D(""))},[a,p]);let G=[...new Set(o)].filter(a=>a.toLowerCase().includes(C.toLowerCase())),H=async()=>{if(u.trim()){B(!0);try{let a=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create-branch",path:q,branch:u.trim(),baseBranch:w})});if(a.ok)n(!1),r();else{let b=await a.json();s(b.error||"Unknown error")}}catch{s("Network error")}finally{B(!1)}}};return(0,b.jsx)(i.Dialog,{open:a,onOpenChange:n,children:(0,b.jsxs)(i.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(i.DialogHeader,{children:(0,b.jsx)(i.DialogTitle,{children:t("git.createBranch")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:t("git.branchName")}),(0,b.jsx)(k.Input,{value:u,onChange:a=>v(a.target.value),placeholder:t("git.branchNamePlaceholder"),className:"mt-1.5 font-mono text-xs",onKeyDown:a=>"Enter"===a.key&&H()})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:t("git.baseBranch")}),(0,b.jsxs)("div",{className:"relative mt-1.5",children:[(0,b.jsxs)("button",{onClick:()=>F(!E),className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(d.GitBranch,{className:"h-3 w-3 text-emerald-400"}),(0,b.jsx)("span",{className:"font-mono text-xs text-foreground",children:w})]}),(0,b.jsx)(e.ChevronDown,{className:`h-3 w-3 text-muted-foreground transition-transform ${E?"rotate-180":""}`})]}),E&&(0,b.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,b.jsx)("div",{className:"border-b border-border p-1.5",children:(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(f.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,b.jsx)("input",{value:C,onChange:a=>D(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,b.jsx)("div",{className:"max-h-40 overflow-auto py-1",children:G.map(a=>(0,b.jsxs)("button",{onClick:()=>{x(a),F(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${a===w?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,b.jsx)(d.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",children:a}),a===w&&(0,b.jsx)(g.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},a))})]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:t("git.branchDesc")}),(0,b.jsx)(l.Textarea,{value:y,onChange:a=>z(a.target.value),placeholder:t("git.branchDescPlaceholder"),rows:2,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"})]})]}),(0,b.jsxs)(i.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>n(!1),children:t("common.cancel")}),(0,b.jsxs)(j.Button,{onClick:H,disabled:!u.trim()||A,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[A?(0,b.jsx)(h.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,t("common.create")]})]})]})})}])},460143,a=>{"use strict";let b=(0,a.i(302856).default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);a.s(["ArrowUpFromLine",0,b],460143)},820838,a=>{"use strict";async function b(a,c,d={}){let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:c,path:a,...d})});if(!e.ok)throw Error((await e.json()).error||`${c} failed`);return e.json()}a.s(["gitAction",0,b])},105916,418841,a=>{"use strict";let b=(0,a.i(302856).default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);a.s(["Square",0,b],105916);var c=a.i(582812);a.s(["AlertTriangle",()=>c.default],418841)},983869,a=>{"use strict";let b=(0,a.i(302856).default)("git-compare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);a.s(["GitCompare",0,b],983869)},641804,569720,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(506008),e=a.i(354994),f=a.i(418841),g=a.i(983869),h=a.i(302856);let i=(0,h.default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);var j=a.i(410756),k=a.i(468518),l=a.i(48300),m=a.i(857122),n=a.i(246962),o=a.i(584335);a.s(["TaskDiffView",0,function({files:a,totalAdded:h,totalRemoved:p,hasConflicts:q,conflictFiles:r,onCommit:s,hasUncommitted:t}){let{t:u}=(0,o.useI18n)(),[v,w]=(0,c.useState)(new Set),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(""),[B,C]=(0,c.useState)(!1);return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 flex-shrink-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"font-medium text-foreground",children:[a.length," files changed"]}),(0,b.jsxs)("span",{className:"text-green-400 font-mono text-xs",children:["+",h]}),(0,b.jsxs)("span",{className:"text-red-400 font-mono text-xs",children:["-",p]})]}),(0,b.jsx)("div",{className:"flex items-center gap-2",children:t&&s&&(0,b.jsxs)(j.Button,{variant:"outline",onClick:()=>y(!0),className:"gap-2",children:[(0,b.jsx)(i,{className:"h-4 w-4"}),u("diff.commit")]})})]}),q&&(0,b.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border bg-amber-500/5 px-4 py-3 flex-shrink-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-amber-400",children:[(0,b.jsx)(f.AlertTriangle,{className:"h-4 w-4 flex-shrink-0"}),(0,b.jsxs)("span",{className:"text-sm font-medium",children:["Merge blocked: ",r.length," conflicting file",1!==r.length?"s":""]})]}),(0,b.jsx)("ul",{className:"ml-6 space-y-1",children:r.map(a=>(0,b.jsx)("li",{className:"text-xs font-mono text-amber-300/80",children:a},a))})]}),(0,b.jsx)("div",{className:"flex-1 overflow-auto",children:0===a.length?(0,b.jsx)(k.EmptyState,{icon:g.GitCompare,title:u("diff.noChanges"),className:"h-full"}):(0,b.jsx)("div",{className:"divide-y divide-border",children:a.map(a=>{let c=v.has(a.filename);return(0,b.jsxs)("div",{children:[(0,b.jsxs)(j.Button,{variant:"ghost",type:"button",onClick:()=>{var b;return b=a.filename,void w(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"flex w-full items-center gap-2 px-4 py-2.5 text-left hover:bg-accent/50 transition-colors rounded-none h-auto",children:[c?(0,b.jsx)(e.ChevronDown,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}):(0,b.jsx)(d.ChevronRight,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 truncate text-sm font-mono text-foreground",children:a.filename}),a.isBinary?(0,b.jsx)(l.Badge,{variant:"secondary",className:"text-[10px] bg-muted text-muted-foreground border border-border",children:"Binary"}):(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsxs)("span",{className:"text-xs font-mono text-green-400",children:["+",a.added]}),(0,b.jsxs)("span",{className:"text-xs font-mono text-red-400",children:["-",a.removed]})]})]}),c&&a.patch&&(0,b.jsx)("div",{className:"border-t border-border bg-background",children:(0,b.jsx)("pre",{className:"overflow-x-auto p-0 text-xs font-mono leading-5",children:a.patch.split("\n").map((a,c)=>{let d=a.startsWith("+")&&!a.startsWith("+++")?"px-4 block bg-green-500/10 text-green-400":a.startsWith("-")&&!a.startsWith("---")?"px-4 block bg-red-500/10 text-red-400":a.startsWith("@@")?"px-4 block bg-blue-500/10 text-blue-300":"px-4 block text-muted-foreground";return(0,b.jsx)("span",{className:d,children:a||" "},c)})})})]},a.filename)})})}),(0,b.jsx)(m.Dialog,{open:x,onOpenChange:y,children:(0,b.jsxs)(m.DialogContent,{className:"max-w-md",children:[(0,b.jsx)(m.DialogHeader,{children:(0,b.jsx)(m.DialogTitle,{children:u("diff.commitChanges")})}),(0,b.jsx)("div",{className:"flex flex-col gap-3",children:(0,b.jsx)(n.Textarea,{value:z,onChange:a=>A(a.target.value),placeholder:u("diff.commitMessagePlaceholder"),rows:5,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none resize-y min-h-[80px]"})}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"ghost",onClick:()=>y(!1),children:u("common.cancel")}),(0,b.jsx)(j.Button,{onClick:async()=>{if(z.trim()&&s){C(!0);try{await s(z.trim()),A(""),y(!1)}finally{C(!1)}}},disabled:!z.trim()||B,children:B?"...":u("diff.commit")})]})]})})]})}],641804);var p=a.i(448287);let q=(0,h.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var r=a.i(109434);a.s(["TaskMergeConfirmDialog",0,function({open:a,onOpenChange:d,taskId:e,taskTitle:f,baseBranch:g,fileCount:h,commitCount:i,commitLog:k=[],onMergeComplete:l}){let n=(0,p.useRouter)(),[o,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(null),v=async()=>{s(!0),u(null);try{let a=await fetch(`/api/tasks/${e}/merge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(a.ok){d(!1),l(),n.refresh();return}let b=await a.json().catch(()=>({error:"Merge failed"}));409===a.status?u(`Merge conflicts detected: ${Array.isArray(b.conflictFiles)?b.conflictFiles.join(", "):"unknown files"}`):u(b.error??"Merge failed")}catch{u("Network error — merge failed")}finally{s(!1)}};return(0,b.jsx)(m.Dialog,{open:a,onOpenChange:d,children:(0,b.jsxs)(m.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,b.jsx)(m.DialogHeader,{children:(0,b.jsxs)(m.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(q,{className:"h-4 w-4 text-emerald-400"}),"Confirm Merge"]})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Target branch"}),(0,b.jsx)("code",{className:"text-xs font-mono bg-muted px-2 py-0.5 rounded text-foreground",children:g})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Changed files"}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:h})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Commits"}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:i})]})]}),k.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:"Commits"}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:k.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))})]}),t&&(0,b.jsx)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2",children:(0,b.jsx)("p",{className:"text-xs text-red-400",children:t})})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(j.Button,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"}),(0,b.jsx)(j.Button,{onClick:v,disabled:o,className:"gap-2",children:o?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Loader2,{className:"h-4 w-4 animate-spin"}),"Merging..."]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{className:"h-4 w-4"}),"Confirm Merge"]})})]})]})})}],569720)},181366,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40694cf4b0a7ce295ccdb10c7a286c86eebdaa1f84",b.callServer,void 0,b.findSourceMapURL,"getTaskExecutions");a.s(["getTaskExecutions",0,c])},457653,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("4076d0523ca8f9864a5fc3c9fc63d995ebd5d1f03f",b.callServer,void 0,b.findSourceMapURL,"continueLatestPtyExecution");a.s(["continueLatestPtyExecution",0,c])},481908,918593,605446,536453,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("6094d5b9b37f81f2c0923909d41df9c9cbb9260df1",b.callServer,void 0,b.findSourceMapURL,"updateTaskStatus");a.s(["updateTaskStatus",0,c],481908);let d=(0,b.createServerReference)("40896eaa7f639b4ae4d4165da333bc4df1ed644d31",b.callServer,void 0,b.findSourceMapURL,"checkWorktreeClean");a.s(["checkWorktreeClean",0,d],918593);let e=(0,b.createServerReference)("607f024304eb4c500c1c3096b197aa3da2e5d0dded",b.callServer,void 0,b.findSourceMapURL,"commitWorktreeChanges");a.s(["commitWorktreeChanges",0,e],605446);let f=(0,a.i(302856).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);a.s(["Clock",0,f],536453)},884284,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(354994),e=a.i(413857),f=a.i(57726),g=a.i(891903),h=a.i(109434),i=a.i(536453),j=a.i(236345),k=a.i(595313),l=a.i(272932);let m=(0,a.i(302856).default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var n=a.i(410756),o=a.i(468518),p=a.i(584335);function q({status:a}){switch(a){case"COMPLETED":return(0,b.jsx)(f.CheckCircle2,{className:"h-4 w-4 text-emerald-400"});case"FAILED":return(0,b.jsx)(g.XCircle,{className:"h-4 w-4 text-red-400"});case"RUNNING":return(0,b.jsx)(h.Loader2,{className:"h-4 w-4 text-blue-400 animate-spin"});default:return(0,b.jsx)(i.Clock,{className:"h-4 w-4 text-neutral-500"})}}a.s(["ExecutionTimeline",0,function({executions:a,onResume:f,onContinueLatest:g}){let{t:h,locale:i}=(0,p.useI18n)(),[r,s]=(0,c.useState)(null),[t,u]=(0,c.useState)(null);return 0===a.length?(0,b.jsx)(o.EmptyState,{icon:m,title:h("execution.noHistory")}):(0,b.jsxs)("div",{className:"space-y-2 p-3",children:[(0,b.jsx)("p",{className:"px-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:h("execution.history")}),a.map(c=>{let m=function(a){if(!a)return null;try{return JSON.parse(a)}catch{return null}}(c.gitStats??null),o=function(a,b){if(!a||!b)return"";let c=new Date(b).getTime()-new Date(a).getTime();if(c<0)return"";let d=Math.floor(c/1e3);if(d<60)return`${d}s`;let e=Math.floor(d/60);if(e<60)return`${e}m ${d%60}s`;let f=Math.floor(e/60);return`${f}h ${e%60}m`}(c.startedAt??null,c.endedAt??null),p=r===c.id;return(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-background/50 overflow-hidden",children:[(0,b.jsxs)("div",{className:"p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)(q,{status:c.status}),(0,b.jsx)("span",{className:`font-medium ${function(a){switch(a){case"COMPLETED":return"text-emerald-400";case"FAILED":return"text-red-400";case"RUNNING":return"text-blue-400";default:return"text-neutral-400"}}(c.status)}`,children:function(a,b){switch(a){case"COMPLETED":return b("execution.success");case"FAILED":return b("execution.failed");case"RUNNING":return b("execution.running");default:return a}}(c.status,h)}),(0,b.jsx)("span",{className:"text-muted-foreground",children:function(a,b="zh"){if(!a)return"";let c=new Date(a),d=Math.floor((new Date().getTime()-c.getTime())/864e5),e="zh"===b?"zh-CN":"en-US",f=c.toLocaleTimeString(e,{hour:"2-digit",minute:"2-digit"});return 0===d?f:1===d?"zh"===b?`昨天 ${f}`:`Yesterday ${f}`:d<7?"zh"===b?`${d}天前 ${f}`:`${d}d ago ${f}`:c.toLocaleDateString(e,{month:"2-digit",day:"2-digit"})+" "+f}(c.startedAt??null,i)}),o&&(0,b.jsxs)("span",{className:"text-muted-foreground/60",children:["(",o,")"]})]}),(0,b.jsx)("p",{className:"mt-1.5 text-sm text-foreground/80 line-clamp-2",children:c.summary||h("execution.noSummary")}),m&&(m.commits||m.filesChanged)&&(0,b.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground font-mono",children:[m.commits?(0,b.jsxs)("span",{children:[m.commits," ",h("execution.commits")]}):null,m.filesChanged?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{children:[m.filesChanged," ",h("execution.files")]})]}):null,m.insertions||m.deletions?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),m.insertions?(0,b.jsxs)("span",{className:"text-emerald-500",children:["+",m.insertions]}):null,m.deletions?(0,b.jsxs)("span",{className:"text-red-400",children:["-",m.deletions]}):null]}):null]}),c.insightNote&&(0,b.jsxs)("div",{className:"mt-2",children:[(0,b.jsxs)("button",{onClick:()=>u(t===c.id?null:c.id),className:"flex items-center gap-1.5 text-xs text-primary/90 hover:text-primary transition-colors",children:[(0,b.jsx)(l.Lightbulb,{className:"h-3.5 w-3.5"}),(0,b.jsxs)("span",{className:"font-medium",children:[h("execution.insight"),":"]}),(0,b.jsx)("span",{className:"text-foreground/70 truncate max-w-[200px]",children:c.insightNote.title}),t===c.id?(0,b.jsx)(e.ChevronUp,{className:"h-3 w-3"}):(0,b.jsx)(d.ChevronDown,{className:"h-3 w-3"})]}),t===c.id&&(0,b.jsx)("div",{className:"mt-2 rounded-md bg-primary/[0.06] border border-primary/10 p-3 text-xs text-foreground/80 whitespace-pre-wrap",children:c.insightNote.content})]}),(0,b.jsxs)("div",{className:"mt-2.5 flex items-center gap-2",children:[c.sessionId&&f?(0,b.jsxs)(n.Button,{size:"sm",onClick:()=>f(c.sessionId),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(j.PlayCircle,{className:"h-3.5 w-3.5"}),h("execution.resume")]}):!c.sessionId&&"FAILED"===c.status&&c.id===a[0]?.id&&g?(0,b.jsxs)(n.Button,{size:"sm",onClick:g,className:"bg-blue-500/15 text-blue-300 ring-1 ring-blue-500/20 hover:bg-blue-500/25",children:[(0,b.jsx)(k.RotateCcw,{className:"h-3.5 w-3.5"}),h("execution.tryRecover")]}):null,(0,b.jsxs)(n.Button,{variant:"ghost",size:"sm",onClick:()=>s(p?null:c.id),className:"bg-muted text-muted-foreground",children:[p?(0,b.jsx)(e.ChevronUp,{className:"h-3.5 w-3.5"}):(0,b.jsx)(d.ChevronDown,{className:"h-3.5 w-3.5"}),p?h("execution.collapse"):h("execution.details")]})]})]}),p&&(0,b.jsxs)("div",{className:"border-t border-border px-3 pb-3 space-y-3",children:[c.gitLog&&(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:h("execution.gitLog")}),(0,b.jsx)("pre",{className:"rounded-md bg-muted/50 p-2.5 text-xs font-mono text-foreground/70 overflow-x-auto whitespace-pre-wrap",children:c.gitLog.split("\n").slice(0,3).join("\n")})]}),c.terminalLog&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:h("execution.terminalOutput")}),(0,b.jsx)("pre",{className:"rounded-md bg-[#0f1419] p-2.5 text-xs font-mono text-neutral-300 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:c.terminalLog})]}),"FAILED"===c.status&&null!=c.exitCode&&(0,b.jsxs)("p",{className:"text-xs text-red-400/70",children:["Exit code: ",c.exitCode]})]})]},c.id)})]})}],884284)}];
2
2
 
3
- //# sourceMappingURL=project_f_tower_0t0smg9._.js.map
3
+ //# sourceMappingURL=project_f_tower_08mqp19._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[220213,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("408f9aa4b4846ac38314ce296b0e74b4cc0eb5d2c3",b.callServer,void 0,b.findSourceMapURL,"getConfigValues");a.s(["getConfigValues",0,c])},48300,a=>{"use strict";var b=a.i(293785),c=a.i(256116),d=a.i(488137),e=a.i(44585);let f=(0,d.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});a.s(["Badge",0,function({className:a,variant:d="default",render:g,...h}){var i;return i={defaultTagName:"span",props:(0,b.mergeProps)({className:(0,e.cn)(f({variant:d}),a)},h),render:g,state:{slot:"badge",variant:d}},(0,c.useRenderElement)(i.defaultTagName??"div",i,i)}],48300)},57726,891903,a=>{"use strict";var b=a.i(65735);a.s(["CheckCircle2",()=>b.default],57726);let c=(0,a.i(302856).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);a.s(["XCircle",0,c],891903)},236413,a=>{"use strict";let b=(0,a.i(302856).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);a.s(["Terminal",0,b],236413)},986698,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40b2fed3c8e27c9a082b7c8dd48ccbc23887a13c78",b.callServer,void 0,b.findSourceMapURL,"getPrompts");a.s(["getPrompts",0,c])},889822,a=>{"use strict";var b=a.i(858360),c=a.i(44585);a.s(["Label",0,function({className:a,...d}){return(0,b.jsx)("label",{"data-slot":"label",className:(0,c.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...d})}])}];
1
+ module.exports=[579517,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("40a714cf8a5713943d9460d44e361c6d739f12efc9",b.callServer,void 0,b.findSourceMapURL,"getConfigValues");a.s(["getConfigValues",0,c])},48300,a=>{"use strict";var b=a.i(293785),c=a.i(256116),d=a.i(488137),e=a.i(44585);let f=(0,d.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});a.s(["Badge",0,function({className:a,variant:d="default",render:g,...h}){var i;return i={defaultTagName:"span",props:(0,b.mergeProps)({className:(0,e.cn)(f({variant:d}),a)},h),render:g,state:{slot:"badge",variant:d}},(0,c.useRenderElement)(i.defaultTagName??"div",i,i)}],48300)},57726,891903,a=>{"use strict";var b=a.i(65735);a.s(["CheckCircle2",()=>b.default],57726);let c=(0,a.i(302856).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);a.s(["XCircle",0,c],891903)},236413,a=>{"use strict";let b=(0,a.i(302856).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);a.s(["Terminal",0,b],236413)},988977,a=>{"use strict";var b=a.i(879876);let c=(0,b.createServerReference)("406d2663b3d37c90d4cfccca5c89eddd5a3481f246",b.callServer,void 0,b.findSourceMapURL,"getPrompts");a.s(["getPrompts",0,c])},889822,a=>{"use strict";var b=a.i(858360),c=a.i(44585);a.s(["Label",0,function({className:a,...d}){return(0,b.jsx)("label",{"data-slot":"label",className:(0,c.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...d})}])}];
2
2
 
3
- //# sourceMappingURL=project_f_tower_0c6n7oo._.js.map
3
+ //# sourceMappingURL=project_f_tower_0ddfsyt._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[487045,a=>a.a(async(b,c)=>{try{a.i(279254),a.i(30292);var d=a.i(322220),e=a.i(727977);a.i(198433),a.i(541587);var f=b([d,e]);[d,e]=f.then?(await f)():f,a.s([]),c()}catch(a){c(a)}},!1),751254,a=>a.a(async(b,c)=>{try{var d=a.i(487045),e=a.i(279254),f=a.i(30292),g=a.i(322220),h=a.i(727977),i=a.i(198433),j=a.i(541587),k=b([d,g,h]);[d,g,h]=k.then?(await k)():k,a.s(["00c5a0d3b9b146d2731747fe1a416361d4501fba21",()=>h.getActualWsPort,"00f7de3735ec23dbbe02b347b3b27fe3293c72dd51",()=>j.getOnboardingStatus,"4002a489b8ddf18fe0011eb46ac0739ec3e093a5bf",()=>j.dispatchTaskCompletionEvent,"4025e96d25637009a8b378148032220c259e2e209b",()=>e.deleteWorkspace,"405e24a96c3040b977262f38c5e06b74894259e0be",()=>j.completeOnboarding,"406303a55224e2a9384b4ad81ed3a003d67d23c0a5",()=>f.getLabelsForWorkspace,"406d0755627b7578b91d776cec0fe19e1bb6bfc1e3",()=>j.setOnboardingProgress,"407cbea3859811102573ba8273dc5d88a5d811928c",()=>h.resolveGitLocalPath,"40805f406dafafbee2bc2893759657900a249fb949",()=>i.checkMigrationSafety,"40b43304845d2ab1bbfcca9e8a22572005f72fdee2",()=>e.createWorkspace,"40de3b59acefdad3d4c0fe96d99c53f2e3910bc5c4",()=>f.createLabel,"40f2f8dd87569241d7237d8e6d9c1062d583dceda0",()=>f.deleteLabel,"40f9512bdf19e6f9f4f666ec480b5d2a34184f2c20",()=>e.createProject,"60422a3dcf869aca6ad2360fc07fff8f7ad667284c",()=>e.updateWorkspace,"6051c20539a0938b9860bfe0dfe34cf20c41177e85",()=>g.globalSearch,"60580b8893845b30deedffa8257cbf297fee7c5689",()=>h.setConfigValue,"6058bc084dfc8fd7335c86f6b96805b28fbfade91d",()=>h.getConfigValue,"60d8faa80f7dca8aa639744b42cee7f20ac78660cd",()=>i.analyzeProjectDirectory,"60f6737005b46b8cdbcf37d9f3db70c559c509ad1a",()=>i.migrateProjectPath]),c()}catch(a){c(a)}},!1),939768,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0c1i04u._.js"].map(b=>a.l(b))).then(()=>b(326575)))},585988,a=>{a.v(a=>Promise.resolve().then(()=>a(264572)))},908462,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0xe9b6_._.js"].map(b=>a.l(b))).then(()=>b(961374)))},302452,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__05a17ca._.js"].map(b=>a.l(b))).then(()=>b(396477)))}];
1
+ module.exports=[487045,a=>a.a(async(b,c)=>{try{a.i(279254),a.i(30292);var d=a.i(322220),e=a.i(727977);a.i(198433),a.i(541587);var f=b([d,e]);[d,e]=f.then?(await f)():f,a.s([]),c()}catch(a){c(a)}},!1),751254,a=>a.a(async(b,c)=>{try{var d=a.i(487045),e=a.i(279254),f=a.i(30292),g=a.i(322220),h=a.i(727977),i=a.i(198433),j=a.i(541587),k=b([d,g,h]);[d,g,h]=k.then?(await k)():k,a.s(["000fb4e39ec972db9511a0189892de76b46ee6e9aa",()=>j.getOnboardingStatus,"0073dca5d0325409af9b7177621b17fe326cebe488",()=>h.getActualWsPort,"400e586f307193ff83593c8d63bc62693553e1afa6",()=>f.getLabelsForWorkspace,"400ffa9303f88489448dd9899070241e26f745a58e",()=>e.deleteWorkspace,"4011bcdb946bba1c505087e70f156fd3989f3b872c",()=>f.deleteLabel,"40527223fea127872c68668224c5822eebbb9bf090",()=>e.createProject,"4061302b8376f5d81135ccb1917c082eef7fca658a",()=>j.completeOnboarding,"4066597f1dfdab694851c822ca15c24d24face6c31",()=>i.checkMigrationSafety,"40846f4f265949956da690418ff68309c0851110fb",()=>f.createLabel,"4086718196d2df7c995adeceabd3b4eff491f6f38a",()=>j.setOnboardingProgress,"409b01a0501cd6418e001637818a45b4908f321079",()=>h.resolveGitLocalPath,"409c0dd81d080577529994de4ce29a7c0a38dc7435",()=>j.dispatchTaskCompletionEvent,"40faf9e78c567cc29ecc3a4fd055cf407081d3fe02",()=>e.createWorkspace,"60579c28d1aed49c267cd531a1ee57bace8684177a",()=>i.analyzeProjectDirectory,"609b34226fbdf6994c63c038d9626094d8aaf093ec",()=>h.setConfigValue,"60b02796ca653ae818f77fac2e586c17f35e2a0c3e",()=>g.globalSearch,"60bf23fbae56b423bfa90b83d2f9e12132dafa55e0",()=>i.migrateProjectPath,"60c210ff07fecafa2265f30dd96eb4de225a19aa77",()=>h.getConfigValue,"60c990d709c90f774c38bf1afe3b56340413c9293b",()=>e.updateWorkspace]),c()}catch(a){c(a)}},!1),939768,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0c1i04u._.js"].map(b=>a.l(b))).then(()=>b(326575)))},585988,a=>{a.v(a=>Promise.resolve().then(()=>a(264572)))},908462,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0xe9b6_._.js"].map(b=>a.l(b))).then(()=>b(961374)))},302452,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__05a17ca._.js"].map(b=>a.l(b))).then(()=>b(396477)))}];
2
2
 
3
3
  //# sourceMappingURL=project_f_tower_0f0-wva._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[690834,a=>{"use strict";let b=(0,a.i(302856).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])},582043,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(448287),e=a.i(759985),f=a.i(14180),g=a.i(263973),h=a.i(94202),i=a.i(569210),j=a.i(317076),k=a.i(302856);let l=(0,k.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),m=(0,k.default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var n=a.i(161604),o=a.i(986379);let p=(0,k.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(445705),r=a.i(358440),s=a.i(857122),t=a.i(95446),u=a.i(410756),v=a.i(620235),w=a.i(879876);let x=(0,w.createServerReference)("40b43304845d2ab1bbfcca9e8a22572005f72fdee2",w.callServer,void 0,w.findSourceMapURL,"createWorkspace"),y=(0,w.createServerReference)("60422a3dcf869aca6ad2360fc07fff8f7ad667284c",w.callServer,void 0,w.findSourceMapURL,"updateWorkspace"),z=(0,w.createServerReference)("4025e96d25637009a8b378148032220c259e2e209b",w.callServer,void 0,w.findSourceMapURL,"deleteWorkspace"),A=(0,w.createServerReference)("406303a55224e2a9384b4ad81ed3a003d67d23c0a5",w.callServer,void 0,w.findSourceMapURL,"getLabelsForWorkspace"),B=(0,w.createServerReference)("40de3b59acefdad3d4c0fe96d99c53f2e3910bc5c4",w.callServer,void 0,w.findSourceMapURL,"createLabel"),C=(0,w.createServerReference)("40f2f8dd87569241d7237d8e6d9c1062d583dceda0",w.callServer,void 0,w.findSourceMapURL,"deleteLabel");var D=a.i(584335),E=a.i(942308);let F=["📋","🚀","🎯","💡","🔧","📦","🎨","📊","🔬","🌟","📝","🏗️"];function G({workspaces:a}){let k,s=(0,d.useRouter)(),v=(0,d.usePathname)(),{t:w}=(0,D.useI18n)(),[A,B]=(0,c.useState)(!1);(0,c.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&B(!0)},[]);let[C,I]=(0,c.useState)(!1),[K,L]=(0,c.useState)(!1),[M,N]=(0,c.useState)(!1),[O,P]=(0,c.useState)(null),[Q,R]=(0,c.useState)(""),[S,T]=(0,c.useState)(F[0]),[U,V]=(0,c.useState)(null),W=v.split("/workspaces/")[1]?.split("/")[0],X=(0,c.useCallback)(()=>{B(a=>{let b=!a;return localStorage.setItem("sidebar-collapsed",String(b)),b})},[]),Y=(0,c.useCallback)(async()=>{if(!Q.trim())return;let a=await x({name:Q.trim(),description:S});R(""),T(F[0]),I(!1),s.refresh(),s.push(`/workspaces/${a.id}`)},[Q,S,s]),Z=(0,c.useCallback)(async()=>{Q.trim()&&U&&(await y(U,{name:Q.trim(),description:S}),R(""),L(!1),V(null),s.refresh())},[Q,S,U,s]),$=(0,c.useCallback)(a=>{V(a.id),R(a.name),T(a.description&&F.includes(a.description)?a.description:F[0]),L(!0)},[]),_=(0,c.useCallback)(async(b,c)=>{if(a.length<=1)return void E.toast.error(w("sidebar.lastWorkspaceError"));if(confirm(w("sidebar.deleteConfirm",{name:c})))try{await z(b),s.refresh(),W===b&&s.push("/workspaces")}catch{E.toast.error(w("sidebar.lastWorkspaceError"))}},[W,s,w,a.length]),aa=(0,c.useCallback)(a=>{P(a),N(!0)},[]),ab=a=>a.description&&F.includes(a.description)?a.description:a.name.charAt(0).toUpperCase();if(A){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:X,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:w("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=W===a.id,d=ab(a);return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>{c||s.push(`/workspaces/${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:F.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:()=>I(!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:w("sidebar.newWorkspace")})]})]})}),(0,b.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(c=W||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:()=>s.push(`/workspaces/${c}/notes`),className:`rounded-lg p-2 transition-colors ${v.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(n.FileText,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:w("sidebar.notes")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>s.push(`/workspaces/${c}/assets`),className:`rounded-lg p-2 transition-colors ${v.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(o.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:w("sidebar.assets")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>s.push(`/workspaces/${c}/archive`),className:`rounded-lg p-2 transition-colors ${v.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:w("sidebar.archive")})]})]}):null,(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>s.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===v?"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:w("missions.navLabel")})]})]}),(0,b.jsx)(H,{open:C,onOpenChange:I,title:w("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:Y,submitLabel:w("common.create"),nameLabel:w("workspace.name"),iconLabel:w("workspace.icon"),namePlaceholder:w("workspace.namePlaceholder"),cancelLabel:w("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:X,className:"text-muted-foreground",title:w("sidebar.collapse"),children:(0,b.jsx)(l,{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:w("sidebar.workspace")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{R(""),T(F[0]),I(!0)},title:w("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:a.map(c=>{var d;let e,f,g,k=W===c.id,l=ab(c);return(0,b.jsxs)("div",{className:`group relative flex items-center rounded-lg transition-all ${k?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,b.jsxs)("button",{onClick:()=>{k||s.push(`/workspaces/${c.id}`)},className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${k?"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:F.includes(l)?l:(0,b.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:l})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:`truncate text-sm font-medium ${k?"text-foreground":"text-secondary-foreground"}`,children:c.name}),(0,b.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(d=c.updatedAt,f=Math.floor((e=Date.now()-new Date(d).getTime())/6e4),g=Math.floor(e/36e5),f<60?`${f}m ago`:g<24?`${g}h ago`:`${Math.floor(g/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:()=>$(c),children:[(0,b.jsx)(h.Pencil,{className:"mr-2 h-3.5 w-3.5"}),w("sidebar.rename")]}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:()=>aa(c.id),children:[(0,b.jsx)(m,{className:"mr-2 h-3.5 w-3.5"}),w("sidebar.manageLabels")]}),(0,b.jsxs)(q.DropdownMenuItem,{className:a.length<=1?"text-muted-foreground opacity-50":"text-rose-400",disabled:a.length<=1,onClick:()=>_(c.id,c.name),children:[(0,b.jsx)(i.Trash2,{className:"mr-2 h-3.5 w-3.5"}),w("sidebar.delete")]})]})]})]},c.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"===v?"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:w("missions.navLabel")})]}),(k=W||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.default,{href:`/workspaces/${k}/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)(n.FileText,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:w("sidebar.notes")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${k}/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)(o.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:w("sidebar.assets")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${k}/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:w("sidebar.archive")})]})]}):null,(0,b.jsx)(H,{open:C,onOpenChange:I,title:w("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:Y,submitLabel:w("common.create"),nameLabel:w("workspace.name"),iconLabel:w("workspace.icon"),namePlaceholder:w("workspace.namePlaceholder"),cancelLabel:w("common.cancel")}),(0,b.jsx)(H,{open:K,onOpenChange:a=>{L(a),a||V(null)},title:w("workspace.edit"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:Z,submitLabel:w("common.save"),nameLabel:w("workspace.name"),iconLabel:w("workspace.icon"),namePlaceholder:w("workspace.namePlaceholder"),cancelLabel:w("common.cancel")}),O&&(0,b.jsx)(J,{open:M,onOpenChange:a=>{N(a),a||P(null)},workspaceId:O})]})}function H({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:F.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 I=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function J({open:a,onOpenChange:d,workspaceId:e}){let{t:f}=(0,D.useI18n)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(I[0]);(0,c.useEffect)(()=>{a&&A(e).then(h)},[a,e]);let m=async()=>{i.trim()&&(await B({name:i.trim(),color:k,workspaceId:e}),h(await A(e)),j(""))},n=async a=>{await C(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:I.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))})]})]})]})})}var K=a.i(432120),L=a.i(410215),M=a.i(666775);let N=(0,k.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 O=a.i(212765);let P=(0,k.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 Q=a.i(248763),R=a.i(470612);a.s([],243701),a.i(243701);var S=a.i(256116),T=a.i(545264);let U=c.createContext(void 0);function V(){let a=c.useContext(U);if(void 0===a)throw Error((0,T.default)(13));return a}let W={imageLoadingStatus:()=>null},X=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,S.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:d,props:g,stateAttributesMapping:W});return(0,b.jsx)(U.Provider,{value:j,children:k})});var Y=a.i(825863),Z=a.i(527993),$=a.i(759002),_=a.i(163323),aa=a.i(6644),ab=a.i(302398);let ac={...W,..._.transitionStatusMapping},ad=c.forwardRef(function(a,b){let{className:d,render:e,onLoadingStatusChange:f,referrerPolicy:g,crossOrigin:h,...i}=a,j=V(),k=function(a,{referrerPolicy:b,crossOrigin:d}){let[e,f]=c.useState("idle");return(0,Z.useIsoLayoutEffect)(()=>{if(!a)return f("error"),ab.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,aa.useTransitionStatus)(l),p=c.useRef(null),q=(0,Y.useStableCallback)(a=>{f?.(a),j.setImageLoadingStatus(a)});(0,Z.useIsoLayoutEffect)(()=>{"idle"!==k&&q(k)},[k,q]),(0,$.useOpenChangeComplete)({open:l,ref:p,onComplete(){l||o(!1)}});let r=(0,S.useRenderElement)("img",a,{state:{imageLoadingStatus:k,transitionStatus:n},ref:[b,p],props:i,stateAttributesMapping:ac,enabled:m});return m?r:null});var ae=a.i(313668);let af=c.forwardRef(function(a,b){let{className:d,render:e,delay:f,...g}=a,{imageLoadingStatus:h}=V(),[i,j]=c.useState(void 0===f),k=(0,ae.useTimeout)();return c.useEffect(()=>(void 0!==f&&k.start(f,()=>j(!0)),k.clear),[k,f]),(0,S.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:b,props:g,stateAttributesMapping:W,enabled:"loaded"!==h&&i})});a.s(["Fallback",0,af,"Image",0,ad,"Root",0,X],60418);var ag=a.i(60418),ag=ag,ah=a.i(44585);function ai({className:a,size:c="default",...d}){return(0,b.jsx)(ag.Root,{"data-slot":"avatar","data-size":c,className:(0,ah.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 aj({className:a,...c}){return(0,b.jsx)(ag.Fallback,{"data-slot":"avatar-fallback",className:(0,ah.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 ak=(0,k.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 al=a.i(61966);let am=(0,k.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"}]]),an=(0,k.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 ao=a.i(54709);let ap=(0,w.createServerReference)("6051c20539a0938b9860bfe0dfe34cf20c41177e85",w.callServer,void 0,w.findSourceMapURL,"globalSearch");var aq=a.i(716502);let ar=[{id:"all",key:"search.all",icon:L.Search},{id:"task",key:"search.task",icon:n.FileText},{id:"project",key:"search.project",icon:ak},{id:"repository",key:"search.repository",icon:al.GitBranch},{id:"note",key:"search.note",icon:am},{id:"asset",key:"search.asset",icon:an}],as=["task","project","repository","note","asset"],at={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function au({result:a,onSelect:c}){let d=ar.find(b=>b.id===a.type)?.icon??n.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 av({open:a,onOpenChange:e}){let f,{t:g}=(0,D.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,aq.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 ap(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)(L.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)(ao.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:ar.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),{}),as.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(at[a])}),f[a].map(a=>(0,b.jsx)(au,{result:a,onSelect:x},`${a.type}-${a.id}`))]},a))),"all"!==k&&m.map(a=>(0,b.jsx)(au,{result:a,onSelect:x},`${a.type}-${a.id}`))]})]})})}function aw(a){}let ax=(0,c.createContext)(null);function ay(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}let az="assistant-image-cache";function aA(a,b,c){try{let d=sessionStorage.getItem(az),e=d?JSON.parse(d):{};e[a]||(e[a]={}),e[a][b]=c,sessionStorage.setItem(az,JSON.stringify(e))}catch{}}function aB({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,aq.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(az);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,imageFilenames: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),aw(null),r.current=[],m([]),o("idle")},[]),E=(0,c.useCallback)(a=>{t.current?.abort(),s.current=a,y.current=!0,x(a),aw(a),r.current=[],m([]),o("idle"),C(a)},[C]),F=(0,c.useCallback)(a=>{v([]),w===a&&D()},[w,D]),G=(0,c.useCallback)(async()=>{g(!0);try{await A(),e(!0)}finally{g(!1)}},[A]),H=(0,c.useCallback)(()=>{e(!1),t.current?.abort()},[]),I=(0,c.useCallback)(()=>{d||f?H():G()},[d,f,H,G]);(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"l"===a.key&&(a.preventDefault(),I())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[I]);let J=(0,c.useCallback)(async(a,b)=>{if(!a.trim()&&!b?.imageFilenames?.length)return;t.current?.abort();let c=new AbortController;t.current=c;let d=0!==r.current.length||y.current?null:a,e=ay();if(r.current=[...r.current,{id:ay(),role:"user",content:a,imageFilenames:b?.imageFilenames?.length?b.imageFilenames:void 0},{id:e,role:"thinking",content:"",isStreaming:!0}],z(),b?.imageFilenames?.length&&s.current){let a=r.current.filter(a=>"user"===a.role).length-1;aA(s.current,a,b.imageFilenames)}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,imageFilenames:b?.imageFilenames??[]}),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),aw(c.sessionId),b?.imageFilenames?.length&&aA(c.sessionId,0,b.imageFilenames)}}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=ay(),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=ay(),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:ay(),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:ay(),role:"tool",content:JSON.stringify(c.toolInput??{},null,2),toolName:c.content}],z();break}case"tool_result":r.current=[...r.current,{id:ay(),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:ay(),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:ay(),role:"assistant",content:`Connection error: ${a.message??"Unknown error"}`}],z(),o("error")}},[z,B]),K=(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},[]),L=l[l.length-1],M="connecting"===n||"streaming"===n||L?.role==="thinking"&&!0===L.isStreaming;return(0,b.jsx)(ax.Provider,{value:{isOpen:d,isStarting:f,displayMode:h,worktreePath:j,toggleAssistant:I,closeAssistant:H,chatMessages:l,chatStatus:n,isChatThinking:M,isLoadingHistory:p,sendChatMessage:J,cancelChat:K,sessions:u,activeSessionId:w,createNewSession:D,switchSession:E,removeSession:F,refreshSessions:B},children:a})}function aC(){let a=(0,c.useContext)(ax);if(!a)throw Error("useAssistant must be used within an AssistantProvider");return a}var aD=a.i(109434),aE=a.i(858967),aF=a.i(467034),aG=a.i(938899),aH=a.i(845924),aI=a.i(246962);function aJ(a){return a.replace(/\.git\/?$/,"")}a.i(446786),a.i(814747);let aK=(0,w.createServerReference)("407cbea3859811102573ba8273dc5d88a5d811928c",w.callServer,void 0,w.findSourceMapURL,"resolveGitLocalPath");var aL=a.i(342800);function aM({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,D.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(""),[r,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)("FRONTEND"),[z,A]=(0,c.useState)("idle"),[B,C]=(0,c.useState)(""),[F,G]=(0,c.useState)(!1),H=()=>{i(""),k(""),m(""),o(""),q(""),w(!1),y("FRONTEND"),A("idle"),C(""),G(!1)},I=async()=>{if(p.trim()&&!F&&"success"===z){G(!0);try{let a=await (0,aL.analyzeProjectDirectory)(p.trim(),g);m(a)}catch{E.toast.error(f("project.analyzeError"))}finally{G(!1)}}},J=async a=>{o(a),A("idle"),C("");let b=function(a){let b,c=a.match(/^git@([^:]+):(.+)$/);if(c)return{host:c[1],pathSegments:aJ(c[2]).split("/").filter(Boolean)};try{b=new URL(a)}catch{return null}return{host:b.hostname,pathSegments:aJ(decodeURIComponent(b.pathname)).split("/").filter(Boolean)}}(a);b&&b.pathSegments.length>0&&i(b.pathSegments[b.pathSegments.length-1]),r||q(await aK(a))},K=async()=>{if(n.trim()&&p.trim()){A("cloning"),C("");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}}(n.trim()),b=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:a,path:p.trim()})}),c=await b.json();if(!b.ok){A("error"),C(c.error||"Clone failed");return}A("success")}catch{A("error"),C("Network error")}}},L=async()=>{h.trim()&&(await e?.({name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:n.trim()||void 0,localPath:p.trim()||void 0,projectType:x}),H(),d(!1))};return(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||H()},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:n,onChange:a=>J(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.jsx)(v.Input,{placeholder:f("project.localPathPlaceholder"),value:p,onChange:a=>{q(a.target.value),w(!0)},className:"mt-1.5 font-mono text-xs w-full"}),p.trim().startsWith("~")&&(0,b.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aF.AlertCircle,{className:"h-3 w-3"}),f("project.tildeWarning")]}),n.trim()&&p.trim()&&(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{type:"button",disabled:"cloning"===z||"success"===z,onClick:K,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"===z?(0,b.jsx)(aD.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===z?(0,b.jsx)(aE.Check,{className:"h-3 w-3"}):(0,b.jsx)(al.GitBranch,{className:"h-3 w-3"}),"cloning"===z?f("git.cloning"):"success"===z?f("git.cloned"):f("git.clone")]}),"error"===z&&(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aF.AlertCircle,{className:"h-3 w-3"}),B]}),"success"===z&&(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)(aH.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:x,onChange:y})})]}),(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:I,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!p.trim()||F?"opacity-50":""}`}),children:[F?(0,b.jsx)(aD.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aG.Sparkles,{className:"h-3 w-3"}),F?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:p.trim()?"success"!==z?f("project.genDescNotCloned"):f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aI.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),H()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:L,disabled:!h.trim()||F,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:f("common.create")})]})]})})})}var aN=a.i(690834),aN=aN,aO=a.i(563504),aP=a.i(775788);let aQ=(0,w.createServerReference)("60f6737005b46b8cdbcf37d9f3db70c559c509ad1a",w.callServer,void 0,w.findSourceMapURL,"migrateProjectPath"),aR=(0,w.createServerReference)("40805f406dafafbee2bc2893759657900a249fb949",w.callServer,void 0,w.findSourceMapURL,"checkMigrationSafety");function aS({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,D.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,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,F]=(0,c.useState)(!1),[G,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),F(!1),H(""),J(!1),L(""),N(""),P(!1),R(!1)},T=async a=>{r(a),B(!1),F(!1),H(""),L(""),N(""),P(!1),i(a.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(F(a),L(""),N(""),P(!1),!a)return void H("");if(n)try{let a=await aK(n);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{}},[n,q]),V=async()=>{if(q&&!Q){R(!0);try{let a=await (0,aL.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{E.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:n.trim()||void 0,localPath:q.trim()||void 0,projectType:y},b=await e?.(a);if(C&&G&&G!==q&&b&&"id"in b){J(!0),L("");let a=await aR(b.id);if(!a.safe){L(a.reason),J(!1);return}let c=await aQ(b.id,G);if(J(!1),!c.success)return void L(c.error??f("project.migrateError"));E.toast.success(f("project.migrateSuccess"))}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)(o.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")})]}),n&&(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:n,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)(aP.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:G,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)(aN.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)(aF.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)(aF.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)(aH.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)(aD.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aG.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)(aI.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)(aO.FolderBrowserDialog,{open:w,onOpenChange:x,onSelect:a=>T(a)})]})}function aT({onCreateProject:a,username:e}){let{t:f,locale:h,setLocale:i}=(0,D.useI18n)(),{isOpen:j,toggleAssistant:k}=aC(),{resolvedTheme:l,toggleTheme:m,triggerRef:n}=function(){let{resolvedTheme:a,setTheme:b}=(0,K.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);return(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"k"===a.key&&(a.preventDefault(),s(!0))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",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)(L.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)(N,{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)(P,{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)(O.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:n,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===l?(0,b.jsx)(Q.Sun,{className:"h-4 w-4"}):(0,b.jsx)(R.Moon,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("settings.theme")})]}),(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)(o.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)(ai,{className:"h-7 w-7 ring-1 ring-border",children:(0,b.jsx)(aj,{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)(M.Settings,{className:"mr-2 h-3.5 w-3.5"}),f("settings.title")]})})]})]})]}),(0,b.jsx)(av,{open:r,onOpenChange:s}),(0,b.jsx)(aM,{open:v,onOpenChange:w,onCreateProject:a}),(0,b.jsx)(aS,{open:x,onOpenChange:y,onCreateProject:a})]})}var aU=a.i(184083),aV=c,aW=a.i(145685);class aX extends aV.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,b){console.error("[ErrorBoundary]",a,b)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[(0,b.jsx)(aF.AlertCircle,{className:"h-8 w-8 text-destructive"}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:this.state.error?.message??"An unexpected error occurred"})]}),(0,b.jsxs)(u.Button,{variant:"outline",onClick:()=>this.setState({hasError:!1,error:null}),children:[(0,b.jsx)(aW.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Retry"]})]}):this.props.children}}var aY=a.i(763204),aZ=a.i(357089),a$=a.i(354994);let a_=(0,aZ.default)(async()=>{},{loadableGenerated:{modules:[834880]},ssr:!1});function a0({mode:a}){let{isOpen:c,closeAssistant:d,sessions:e,activeSessionId:f,createNewSession:h,switchSession:j,removeSession:k}=aC(),{t:l}=(0,D.useI18n)(),m=e.find(a=>a.id===f),n=m?.title??l("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)(P,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:l("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":l("assistant.sessionList"),children:[(0,b.jsx)("span",{className:"truncate",children:n}),(0,b.jsx)(a$.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,b.jsxs)(q.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,children:[0===e.length?(0,b.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:l("assistant.noSessions")}):e.map(a=>(0,b.jsxs)(q.DropdownMenuItem,{className:"flex items-center justify-between gap-2 pr-1",onClick:()=>j(a.id),children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs truncate max-w-[140px]",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 hover:text-destructive",onClick:b=>{b.stopPropagation(),k(a.id)},"aria-label":l("assistant.deleteSession"),children:(0,b.jsx)(i.Trash2,{className:"h-3 w-3"})})]},a.id)),e.length>0&&(0,b.jsx)(q.DropdownMenuSeparator,{}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:h,children:[(0,b.jsx)(g.Plus,{className:"h-3 w-3 mr-1"}),(0,b.jsx)("span",{className:"text-xs",children:l("assistant.newSession")})]})]})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:h,"aria-label":l("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:d,"aria-label":l("assistant.closeLabel"),children:(0,b.jsx)(ao.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:c?(0,b.jsx)(a_,{}):null})]})}var a1=a.i(684262);function a2({onDismiss:a}){let{t:d}=(0,D.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)(a1.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}w.callServer,w.findSourceMapURL;var a3=a.i(385174);let a4=[{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 a5({onComplete:a}){let{t:d}=(0,D.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=a4[e],m=(0,c.useCallback)(async()=>{await (0,a3.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<a4.length?b:a}),e>=a4.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<a4.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=[690834,a=>{"use strict";let b=(0,a.i(302856).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])},582043,a=>{"use strict";var b=a.i(858360),c=a.i(175391),d=a.i(448287),e=a.i(759985),f=a.i(14180),g=a.i(263973),h=a.i(94202),i=a.i(569210),j=a.i(317076),k=a.i(302856);let l=(0,k.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),m=(0,k.default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var n=a.i(161604),o=a.i(986379);let p=(0,k.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(445705),r=a.i(358440),s=a.i(857122),t=a.i(95446),u=a.i(410756),v=a.i(620235),w=a.i(879876);let x=(0,w.createServerReference)("40faf9e78c567cc29ecc3a4fd055cf407081d3fe02",w.callServer,void 0,w.findSourceMapURL,"createWorkspace"),y=(0,w.createServerReference)("60c990d709c90f774c38bf1afe3b56340413c9293b",w.callServer,void 0,w.findSourceMapURL,"updateWorkspace"),z=(0,w.createServerReference)("400ffa9303f88489448dd9899070241e26f745a58e",w.callServer,void 0,w.findSourceMapURL,"deleteWorkspace"),A=(0,w.createServerReference)("400e586f307193ff83593c8d63bc62693553e1afa6",w.callServer,void 0,w.findSourceMapURL,"getLabelsForWorkspace"),B=(0,w.createServerReference)("40846f4f265949956da690418ff68309c0851110fb",w.callServer,void 0,w.findSourceMapURL,"createLabel"),C=(0,w.createServerReference)("4011bcdb946bba1c505087e70f156fd3989f3b872c",w.callServer,void 0,w.findSourceMapURL,"deleteLabel");var D=a.i(584335),E=a.i(942308);let F=["📋","🚀","🎯","💡","🔧","📦","🎨","📊","🔬","🌟","📝","🏗️"];function G({workspaces:a}){let k,s=(0,d.useRouter)(),v=(0,d.usePathname)(),{t:w}=(0,D.useI18n)(),[A,B]=(0,c.useState)(!1);(0,c.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&B(!0)},[]);let[C,I]=(0,c.useState)(!1),[K,L]=(0,c.useState)(!1),[M,N]=(0,c.useState)(!1),[O,P]=(0,c.useState)(null),[Q,R]=(0,c.useState)(""),[S,T]=(0,c.useState)(F[0]),[U,V]=(0,c.useState)(null),W=v.split("/workspaces/")[1]?.split("/")[0],X=(0,c.useCallback)(()=>{B(a=>{let b=!a;return localStorage.setItem("sidebar-collapsed",String(b)),b})},[]),Y=(0,c.useCallback)(async()=>{if(!Q.trim())return;let a=await x({name:Q.trim(),description:S});R(""),T(F[0]),I(!1),s.refresh(),s.push(`/workspaces/${a.id}`)},[Q,S,s]),Z=(0,c.useCallback)(async()=>{Q.trim()&&U&&(await y(U,{name:Q.trim(),description:S}),R(""),L(!1),V(null),s.refresh())},[Q,S,U,s]),$=(0,c.useCallback)(a=>{V(a.id),R(a.name),T(a.description&&F.includes(a.description)?a.description:F[0]),L(!0)},[]),_=(0,c.useCallback)(async(b,c)=>{if(a.length<=1)return void E.toast.error(w("sidebar.lastWorkspaceError"));if(confirm(w("sidebar.deleteConfirm",{name:c})))try{await z(b),s.refresh(),W===b&&s.push("/workspaces")}catch{E.toast.error(w("sidebar.lastWorkspaceError"))}},[W,s,w,a.length]),aa=(0,c.useCallback)(a=>{P(a),N(!0)},[]),ab=a=>a.description&&F.includes(a.description)?a.description:a.name.charAt(0).toUpperCase();if(A){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:X,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:w("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=W===a.id,d=ab(a);return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>{c||s.push(`/workspaces/${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:F.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:()=>I(!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:w("sidebar.newWorkspace")})]})]})}),(0,b.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(c=W||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:()=>s.push(`/workspaces/${c}/notes`),className:`rounded-lg p-2 transition-colors ${v.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(n.FileText,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:w("sidebar.notes")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>s.push(`/workspaces/${c}/assets`),className:`rounded-lg p-2 transition-colors ${v.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(o.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:w("sidebar.assets")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>s.push(`/workspaces/${c}/archive`),className:`rounded-lg p-2 transition-colors ${v.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:w("sidebar.archive")})]})]}):null,(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>s.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===v?"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:w("missions.navLabel")})]})]}),(0,b.jsx)(H,{open:C,onOpenChange:I,title:w("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:Y,submitLabel:w("common.create"),nameLabel:w("workspace.name"),iconLabel:w("workspace.icon"),namePlaceholder:w("workspace.namePlaceholder"),cancelLabel:w("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:X,className:"text-muted-foreground",title:w("sidebar.collapse"),children:(0,b.jsx)(l,{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:w("sidebar.workspace")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{R(""),T(F[0]),I(!0)},title:w("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:a.map(c=>{var d;let e,f,g,k=W===c.id,l=ab(c);return(0,b.jsxs)("div",{className:`group relative flex items-center rounded-lg transition-all ${k?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,b.jsxs)("button",{onClick:()=>{k||s.push(`/workspaces/${c.id}`)},className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${k?"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:F.includes(l)?l:(0,b.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:l})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:`truncate text-sm font-medium ${k?"text-foreground":"text-secondary-foreground"}`,children:c.name}),(0,b.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(d=c.updatedAt,f=Math.floor((e=Date.now()-new Date(d).getTime())/6e4),g=Math.floor(e/36e5),f<60?`${f}m ago`:g<24?`${g}h ago`:`${Math.floor(g/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:()=>$(c),children:[(0,b.jsx)(h.Pencil,{className:"mr-2 h-3.5 w-3.5"}),w("sidebar.rename")]}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:()=>aa(c.id),children:[(0,b.jsx)(m,{className:"mr-2 h-3.5 w-3.5"}),w("sidebar.manageLabels")]}),(0,b.jsxs)(q.DropdownMenuItem,{className:a.length<=1?"text-muted-foreground opacity-50":"text-rose-400",disabled:a.length<=1,onClick:()=>_(c.id,c.name),children:[(0,b.jsx)(i.Trash2,{className:"mr-2 h-3.5 w-3.5"}),w("sidebar.delete")]})]})]})]},c.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"===v?"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:w("missions.navLabel")})]}),(k=W||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.default,{href:`/workspaces/${k}/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)(n.FileText,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:w("sidebar.notes")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${k}/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)(o.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:w("sidebar.assets")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${k}/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:w("sidebar.archive")})]})]}):null,(0,b.jsx)(H,{open:C,onOpenChange:I,title:w("workspace.create"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:Y,submitLabel:w("common.create"),nameLabel:w("workspace.name"),iconLabel:w("workspace.icon"),namePlaceholder:w("workspace.namePlaceholder"),cancelLabel:w("common.cancel")}),(0,b.jsx)(H,{open:K,onOpenChange:a=>{L(a),a||V(null)},title:w("workspace.edit"),name:Q,onNameChange:R,icon:S,onIconChange:T,onSubmit:Z,submitLabel:w("common.save"),nameLabel:w("workspace.name"),iconLabel:w("workspace.icon"),namePlaceholder:w("workspace.namePlaceholder"),cancelLabel:w("common.cancel")}),O&&(0,b.jsx)(J,{open:M,onOpenChange:a=>{N(a),a||P(null)},workspaceId:O})]})}function H({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:F.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 I=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function J({open:a,onOpenChange:d,workspaceId:e}){let{t:f}=(0,D.useI18n)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(I[0]);(0,c.useEffect)(()=>{a&&A(e).then(h)},[a,e]);let m=async()=>{i.trim()&&(await B({name:i.trim(),color:k,workspaceId:e}),h(await A(e)),j(""))},n=async a=>{await C(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:I.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))})]})]})]})})}var K=a.i(432120),L=a.i(410215),M=a.i(666775);let N=(0,k.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 O=a.i(212765);let P=(0,k.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 Q=a.i(248763),R=a.i(470612);a.s([],243701),a.i(243701);var S=a.i(256116),T=a.i(545264);let U=c.createContext(void 0);function V(){let a=c.useContext(U);if(void 0===a)throw Error((0,T.default)(13));return a}let W={imageLoadingStatus:()=>null},X=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,S.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:d,props:g,stateAttributesMapping:W});return(0,b.jsx)(U.Provider,{value:j,children:k})});var Y=a.i(825863),Z=a.i(527993),$=a.i(759002),_=a.i(163323),aa=a.i(6644),ab=a.i(302398);let ac={...W,..._.transitionStatusMapping},ad=c.forwardRef(function(a,b){let{className:d,render:e,onLoadingStatusChange:f,referrerPolicy:g,crossOrigin:h,...i}=a,j=V(),k=function(a,{referrerPolicy:b,crossOrigin:d}){let[e,f]=c.useState("idle");return(0,Z.useIsoLayoutEffect)(()=>{if(!a)return f("error"),ab.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,aa.useTransitionStatus)(l),p=c.useRef(null),q=(0,Y.useStableCallback)(a=>{f?.(a),j.setImageLoadingStatus(a)});(0,Z.useIsoLayoutEffect)(()=>{"idle"!==k&&q(k)},[k,q]),(0,$.useOpenChangeComplete)({open:l,ref:p,onComplete(){l||o(!1)}});let r=(0,S.useRenderElement)("img",a,{state:{imageLoadingStatus:k,transitionStatus:n},ref:[b,p],props:i,stateAttributesMapping:ac,enabled:m});return m?r:null});var ae=a.i(313668);let af=c.forwardRef(function(a,b){let{className:d,render:e,delay:f,...g}=a,{imageLoadingStatus:h}=V(),[i,j]=c.useState(void 0===f),k=(0,ae.useTimeout)();return c.useEffect(()=>(void 0!==f&&k.start(f,()=>j(!0)),k.clear),[k,f]),(0,S.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:b,props:g,stateAttributesMapping:W,enabled:"loaded"!==h&&i})});a.s(["Fallback",0,af,"Image",0,ad,"Root",0,X],60418);var ag=a.i(60418),ag=ag,ah=a.i(44585);function ai({className:a,size:c="default",...d}){return(0,b.jsx)(ag.Root,{"data-slot":"avatar","data-size":c,className:(0,ah.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 aj({className:a,...c}){return(0,b.jsx)(ag.Fallback,{"data-slot":"avatar-fallback",className:(0,ah.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 ak=(0,k.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 al=a.i(61966);let am=(0,k.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"}]]),an=(0,k.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 ao=a.i(54709);let ap=(0,w.createServerReference)("60b02796ca653ae818f77fac2e586c17f35e2a0c3e",w.callServer,void 0,w.findSourceMapURL,"globalSearch");var aq=a.i(854516);let ar=[{id:"all",key:"search.all",icon:L.Search},{id:"task",key:"search.task",icon:n.FileText},{id:"project",key:"search.project",icon:ak},{id:"repository",key:"search.repository",icon:al.GitBranch},{id:"note",key:"search.note",icon:am},{id:"asset",key:"search.asset",icon:an}],as=["task","project","repository","note","asset"],at={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function au({result:a,onSelect:c}){let d=ar.find(b=>b.id===a.type)?.icon??n.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 av({open:a,onOpenChange:e}){let f,{t:g}=(0,D.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,aq.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 ap(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)(L.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)(ao.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:ar.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),{}),as.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(at[a])}),f[a].map(a=>(0,b.jsx)(au,{result:a,onSelect:x},`${a.type}-${a.id}`))]},a))),"all"!==k&&m.map(a=>(0,b.jsx)(au,{result:a,onSelect:x},`${a.type}-${a.id}`))]})]})})}function aw(a){}let ax=(0,c.createContext)(null);function ay(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}let az="assistant-image-cache";function aA(a,b,c){try{let d=sessionStorage.getItem(az),e=d?JSON.parse(d):{};e[a]||(e[a]={}),e[a][b]=c,sessionStorage.setItem(az,JSON.stringify(e))}catch{}}function aB({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,aq.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(az);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,imageFilenames: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),aw(null),r.current=[],m([]),o("idle")},[]),E=(0,c.useCallback)(a=>{t.current?.abort(),s.current=a,y.current=!0,x(a),aw(a),r.current=[],m([]),o("idle"),C(a)},[C]),F=(0,c.useCallback)(a=>{v([]),w===a&&D()},[w,D]),G=(0,c.useCallback)(async()=>{g(!0);try{await A(),e(!0)}finally{g(!1)}},[A]),H=(0,c.useCallback)(()=>{e(!1),t.current?.abort()},[]),I=(0,c.useCallback)(()=>{d||f?H():G()},[d,f,H,G]);(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"l"===a.key&&(a.preventDefault(),I())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[I]);let J=(0,c.useCallback)(async(a,b)=>{if(!a.trim()&&!b?.imageFilenames?.length)return;t.current?.abort();let c=new AbortController;t.current=c;let d=0!==r.current.length||y.current?null:a,e=ay();if(r.current=[...r.current,{id:ay(),role:"user",content:a,imageFilenames:b?.imageFilenames?.length?b.imageFilenames:void 0},{id:e,role:"thinking",content:"",isStreaming:!0}],z(),b?.imageFilenames?.length&&s.current){let a=r.current.filter(a=>"user"===a.role).length-1;aA(s.current,a,b.imageFilenames)}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,imageFilenames:b?.imageFilenames??[]}),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),aw(c.sessionId),b?.imageFilenames?.length&&aA(c.sessionId,0,b.imageFilenames)}}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=ay(),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=ay(),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:ay(),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:ay(),role:"tool",content:JSON.stringify(c.toolInput??{},null,2),toolName:c.content}],z();break}case"tool_result":r.current=[...r.current,{id:ay(),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:ay(),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:ay(),role:"assistant",content:`Connection error: ${a.message??"Unknown error"}`}],z(),o("error")}},[z,B]),K=(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},[]),L=l[l.length-1],M="connecting"===n||"streaming"===n||L?.role==="thinking"&&!0===L.isStreaming;return(0,b.jsx)(ax.Provider,{value:{isOpen:d,isStarting:f,displayMode:h,worktreePath:j,toggleAssistant:I,closeAssistant:H,chatMessages:l,chatStatus:n,isChatThinking:M,isLoadingHistory:p,sendChatMessage:J,cancelChat:K,sessions:u,activeSessionId:w,createNewSession:D,switchSession:E,removeSession:F,refreshSessions:B},children:a})}function aC(){let a=(0,c.useContext)(ax);if(!a)throw Error("useAssistant must be used within an AssistantProvider");return a}var aD=a.i(109434),aE=a.i(858967),aF=a.i(467034),aG=a.i(938899),aH=a.i(845924),aI=a.i(246962);function aJ(a){return a.replace(/\.git\/?$/,"")}a.i(446786),a.i(814747);let aK=(0,w.createServerReference)("409b01a0501cd6418e001637818a45b4908f321079",w.callServer,void 0,w.findSourceMapURL,"resolveGitLocalPath");var aL=a.i(413318);function aM({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,D.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(""),[r,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)("FRONTEND"),[z,A]=(0,c.useState)("idle"),[B,C]=(0,c.useState)(""),[F,G]=(0,c.useState)(!1),H=()=>{i(""),k(""),m(""),o(""),q(""),w(!1),y("FRONTEND"),A("idle"),C(""),G(!1)},I=async()=>{if(p.trim()&&!F&&"success"===z){G(!0);try{let a=await (0,aL.analyzeProjectDirectory)(p.trim(),g);m(a)}catch{E.toast.error(f("project.analyzeError"))}finally{G(!1)}}},J=async a=>{o(a),A("idle"),C("");let b=function(a){let b,c=a.match(/^git@([^:]+):(.+)$/);if(c)return{host:c[1],pathSegments:aJ(c[2]).split("/").filter(Boolean)};try{b=new URL(a)}catch{return null}return{host:b.hostname,pathSegments:aJ(decodeURIComponent(b.pathname)).split("/").filter(Boolean)}}(a);b&&b.pathSegments.length>0&&i(b.pathSegments[b.pathSegments.length-1]),r||q(await aK(a))},K=async()=>{if(n.trim()&&p.trim()){A("cloning"),C("");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}}(n.trim()),b=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:a,path:p.trim()})}),c=await b.json();if(!b.ok){A("error"),C(c.error||"Clone failed");return}A("success")}catch{A("error"),C("Network error")}}},L=async()=>{h.trim()&&(await e?.({name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:n.trim()||void 0,localPath:p.trim()||void 0,projectType:x}),H(),d(!1))};return(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||H()},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:n,onChange:a=>J(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.jsx)(v.Input,{placeholder:f("project.localPathPlaceholder"),value:p,onChange:a=>{q(a.target.value),w(!0)},className:"mt-1.5 font-mono text-xs w-full"}),p.trim().startsWith("~")&&(0,b.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aF.AlertCircle,{className:"h-3 w-3"}),f("project.tildeWarning")]}),n.trim()&&p.trim()&&(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{type:"button",disabled:"cloning"===z||"success"===z,onClick:K,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"===z?(0,b.jsx)(aD.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===z?(0,b.jsx)(aE.Check,{className:"h-3 w-3"}):(0,b.jsx)(al.GitBranch,{className:"h-3 w-3"}),"cloning"===z?f("git.cloning"):"success"===z?f("git.cloned"):f("git.clone")]}),"error"===z&&(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aF.AlertCircle,{className:"h-3 w-3"}),B]}),"success"===z&&(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)(aH.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:x,onChange:y})})]}),(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:I,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!p.trim()||F?"opacity-50":""}`}),children:[F?(0,b.jsx)(aD.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aG.Sparkles,{className:"h-3 w-3"}),F?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:p.trim()?"success"!==z?f("project.genDescNotCloned"):f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aI.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),H()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:L,disabled:!h.trim()||F,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:f("common.create")})]})]})})})}var aN=a.i(690834),aN=aN,aO=a.i(563504),aP=a.i(775788);let aQ=(0,w.createServerReference)("60bf23fbae56b423bfa90b83d2f9e12132dafa55e0",w.callServer,void 0,w.findSourceMapURL,"migrateProjectPath"),aR=(0,w.createServerReference)("4066597f1dfdab694851c822ca15c24d24face6c31",w.callServer,void 0,w.findSourceMapURL,"checkMigrationSafety");function aS({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,D.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,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,F]=(0,c.useState)(!1),[G,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),F(!1),H(""),J(!1),L(""),N(""),P(!1),R(!1)},T=async a=>{r(a),B(!1),F(!1),H(""),L(""),N(""),P(!1),i(a.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(F(a),L(""),N(""),P(!1),!a)return void H("");if(n)try{let a=await aK(n);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{}},[n,q]),V=async()=>{if(q&&!Q){R(!0);try{let a=await (0,aL.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{E.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:n.trim()||void 0,localPath:q.trim()||void 0,projectType:y},b=await e?.(a);if(C&&G&&G!==q&&b&&"id"in b){J(!0),L("");let a=await aR(b.id);if(!a.safe){L(a.reason),J(!1);return}let c=await aQ(b.id,G);if(J(!1),!c.success)return void L(c.error??f("project.migrateError"));E.toast.success(f("project.migrateSuccess"))}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)(o.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")})]}),n&&(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:n,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)(aP.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:G,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)(aN.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)(aF.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)(aF.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)(aH.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)(aD.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aG.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)(aI.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)(aO.FolderBrowserDialog,{open:w,onOpenChange:x,onSelect:a=>T(a)})]})}function aT({onCreateProject:a,username:e}){let{t:f,locale:h,setLocale:i}=(0,D.useI18n)(),{isOpen:j,toggleAssistant:k}=aC(),{resolvedTheme:l,toggleTheme:m,triggerRef:n}=function(){let{resolvedTheme:a,setTheme:b}=(0,K.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);return(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"k"===a.key&&(a.preventDefault(),s(!0))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",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)(L.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)(N,{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)(P,{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)(O.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:n,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===l?(0,b.jsx)(Q.Sun,{className:"h-4 w-4"}):(0,b.jsx)(R.Moon,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("settings.theme")})]}),(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)(o.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)(ai,{className:"h-7 w-7 ring-1 ring-border",children:(0,b.jsx)(aj,{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)(M.Settings,{className:"mr-2 h-3.5 w-3.5"}),f("settings.title")]})})]})]})]}),(0,b.jsx)(av,{open:r,onOpenChange:s}),(0,b.jsx)(aM,{open:v,onOpenChange:w,onCreateProject:a}),(0,b.jsx)(aS,{open:x,onOpenChange:y,onCreateProject:a})]})}var aU=a.i(184083),aV=c,aW=a.i(145685);class aX extends aV.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,b){console.error("[ErrorBoundary]",a,b)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[(0,b.jsx)(aF.AlertCircle,{className:"h-8 w-8 text-destructive"}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:this.state.error?.message??"An unexpected error occurred"})]}),(0,b.jsxs)(u.Button,{variant:"outline",onClick:()=>this.setState({hasError:!1,error:null}),children:[(0,b.jsx)(aW.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Retry"]})]}):this.props.children}}var aY=a.i(134729),aZ=a.i(357089),a$=a.i(354994);let a_=(0,aZ.default)(async()=>{},{loadableGenerated:{modules:[834880]},ssr:!1});function a0({mode:a}){let{isOpen:c,closeAssistant:d,sessions:e,activeSessionId:f,createNewSession:h,switchSession:j,removeSession:k}=aC(),{t:l}=(0,D.useI18n)(),m=e.find(a=>a.id===f),n=m?.title??l("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)(P,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:l("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":l("assistant.sessionList"),children:[(0,b.jsx)("span",{className:"truncate",children:n}),(0,b.jsx)(a$.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,b.jsxs)(q.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,children:[0===e.length?(0,b.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:l("assistant.noSessions")}):e.map(a=>(0,b.jsxs)(q.DropdownMenuItem,{className:"flex items-center justify-between gap-2 pr-1",onClick:()=>j(a.id),children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs truncate max-w-[140px]",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 hover:text-destructive",onClick:b=>{b.stopPropagation(),k(a.id)},"aria-label":l("assistant.deleteSession"),children:(0,b.jsx)(i.Trash2,{className:"h-3 w-3"})})]},a.id)),e.length>0&&(0,b.jsx)(q.DropdownMenuSeparator,{}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:h,children:[(0,b.jsx)(g.Plus,{className:"h-3 w-3 mr-1"}),(0,b.jsx)("span",{className:"text-xs",children:l("assistant.newSession")})]})]})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:h,"aria-label":l("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:d,"aria-label":l("assistant.closeLabel"),children:(0,b.jsx)(ao.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:c?(0,b.jsx)(a_,{}):null})]})}var a1=a.i(684262);function a2({onDismiss:a}){let{t:d}=(0,D.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)(a1.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}w.callServer,w.findSourceMapURL;var a3=a.i(119190);let a4=[{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 a5({onComplete:a}){let{t:d}=(0,D.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=a4[e],m=(0,c.useCallback)(async()=>{await (0,a3.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<a4.length?b:a}),e>=a4.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<a4.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