commandmate 0.11.0 → 0.11.1

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 (177) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +265 -265
  3. package/.next/app-path-routes-manifest.json +26 -26
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +15 -15
  6. package/.next/react-loadable-manifest.json +4 -4
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/server/app/_not-found/page.js +1 -1
  9. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  10. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/app/update-check/route.js +1 -1
  13. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/chat/page.js +1 -1
  109. package/.next/server/app/chat/page.js.nft.json +1 -1
  110. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  111. package/.next/server/app/login/page.js +1 -1
  112. package/.next/server/app/login/page.js.nft.json +1 -1
  113. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/more/page.js +2 -2
  116. package/.next/server/app/more/page.js.nft.json +1 -1
  117. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  118. package/.next/server/app/offline/page.js +1 -1
  119. package/.next/server/app/offline/page.js.nft.json +1 -1
  120. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  121. package/.next/server/app/page.js +1 -1
  122. package/.next/server/app/page.js.nft.json +1 -1
  123. package/.next/server/app/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/repositories/page.js +1 -1
  126. package/.next/server/app/repositories/page.js.nft.json +1 -1
  127. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  128. package/.next/server/app/review/page.js +1 -1
  129. package/.next/server/app/review/page.js.nft.json +1 -1
  130. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  131. package/.next/server/app/sessions/page.js +1 -1
  132. package/.next/server/app/sessions/page.js.nft.json +1 -1
  133. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  134. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -1
  135. package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -1
  136. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  137. package/.next/server/app/worktrees/[id]/page.js +3 -3
  138. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  139. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  140. package/.next/server/app/worktrees/[id]/terminal/page.js +1 -1
  141. package/.next/server/app/worktrees/[id]/terminal/page.js.nft.json +1 -1
  142. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  143. package/.next/server/app-paths-manifest.json +26 -26
  144. package/.next/server/chunks/3644.js +13 -0
  145. package/.next/server/chunks/5959.js +1 -1
  146. package/.next/server/chunks/646.js +2 -14
  147. package/.next/server/chunks/9355.js +13 -1
  148. package/.next/server/chunks/{9992.js → 9968.js} +1 -1
  149. package/.next/server/middleware-build-manifest.js +1 -1
  150. package/.next/server/middleware-manifest.json +5 -5
  151. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  152. package/.next/server/pages/500.html +1 -1
  153. package/.next/server/server-reference-manifest.json +1 -1
  154. package/.next/static/chunks/4560-64b1461fd996127a.js +1 -0
  155. package/.next/static/chunks/{7347-7ee39e14be89e508.js → 6488-d6e53d8da584e644.js} +1 -1
  156. package/.next/static/chunks/{8566-b8bbcfd837cc338b.js → 8566-9da32e46c9d3fd54.js} +1 -1
  157. package/.next/static/chunks/8676.c1ef7e2aac5f05a0.js +1 -0
  158. package/.next/static/chunks/{8965-872d8de254196cec.js → 8965-5ff40db68775eb01.js} +1 -1
  159. package/.next/static/chunks/app/chat/{page-5d20240f98c07cee.js → page-6f714339e12c3a16.js} +1 -1
  160. package/.next/static/chunks/app/layout-86574192bd3c0e6b.js +1 -0
  161. package/.next/static/chunks/app/more/{page-af1d2af13ea901d2.js → page-a496425bba427b48.js} +1 -1
  162. package/.next/static/chunks/app/{page-3bbe737ec910d1fb.js → page-15bfd76bcf65842d.js} +1 -1
  163. package/.next/static/chunks/app/repositories/{page-ace9134ac165a6de.js → page-d214522ab8792ce7.js} +1 -1
  164. package/.next/static/chunks/app/review/{page-331b80f4f58582bc.js → page-1dadf0b5d7129598.js} +1 -1
  165. package/.next/static/chunks/app/sessions/{page-d694149a7e8649b6.js → page-96f007d986c5f327.js} +1 -1
  166. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/{page-9ff4d065483cdfe9.js → page-6a45f3744da50d95.js} +1 -1
  167. package/.next/static/chunks/app/worktrees/[id]/page-3b07e3be354aae57.js +1 -0
  168. package/.next/static/chunks/{webpack-4fbc38b2e3abb013.js → webpack-25d4697671930f37.js} +1 -1
  169. package/.next/trace +10 -10
  170. package/package.json +1 -1
  171. package/.next/server/chunks/1104.js +0 -13
  172. package/.next/static/chunks/4560-2bf9cb6504cc4425.js +0 -1
  173. package/.next/static/chunks/8676.cc638529497c5a1e.js +0 -1
  174. package/.next/static/chunks/app/layout-fe5857360dfba2b9.js +0 -1
  175. package/.next/static/chunks/app/worktrees/[id]/page-1c311aaa0950db1e.js +0 -1
  176. /package/.next/static/{8yp8SRJ9h3Uj75SpHLYpl → WzRCDS2PLtMvg0Sjwlf0S}/_buildManifest.js +0 -0
  177. /package/.next/static/{8yp8SRJ9h3Uj75SpHLYpl → WzRCDS2PLtMvg0Sjwlf0S}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4560],{4560:(e,t,r)=>{r.d(t,{GV:()=>tt});var n=r(95155),s=r(12115),a=r(20063),o=r(52619),i=r.n(o),l=r(89275);let c=(0,s.forwardRef)(function(e,t){let{href:r,onClick:s,target:o,...c}=e,d=(0,a.usePathname)(),u=(0,l.Hq)();return(0,n.jsx)(i(),{ref:t,href:r,target:o,onClick:e=>{var t;null==s||s(e),e.defaultPrevented||0!==(t=e).button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||void 0!==o&&"_self"!==o||/^([a-z][a-z0-9+.-]*:)?\/\//i.test(r)||/^(mailto:|tel:)/i.test(r)||(e.preventDefault(),r!==d&&u.push(r))},...c})});var d=r(18955),u=r(59847),m=r(86651),f=r(94684),h=r(34681),x=r(5379),p=r(59427),g=r(37494);function b(){let{theme:e,setTheme:t}=(0,x.D)(),[r,a]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{a(!0)},[]),!r)return(0,n.jsx)("div",{"data-testid":"theme-toggle-placeholder",className:"w-8 h-8","aria-hidden":"true"});let o="dark"===e;return(0,n.jsx)("button",{"data-testid":"theme-toggle",onClick:()=>t(o?"light":"dark"),className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring","aria-label":o?"Switch to light mode":"Switch to dark mode",title:o?"Switch to light mode":"Switch to dark mode",children:o?(0,n.jsx)(p.A,{className:"w-5 h-5","data-testid":"theme-icon-sun"}):(0,n.jsx)(g.A,{className:"w-5 h-5","data-testid":"theme-icon-moon"})})}var v=r(63365);function y(){let{status:e}=(0,v.xM)(),t=(0,d.c)("common");if("connected"===e)return null;let r="connecting"===e,s=t(r?"connection.reconnecting":"connection.offline");return(0,n.jsxs)("span",{"data-testid":"connection-status-indicator",role:"status","aria-live":"polite",title:t(r?"connection.reconnectingTooltip":"connection.offlineTooltip"),className:"hidden sm:inline-flex items-center gap-1.5 rounded-full border border-border bg-surface px-2 py-0.5 text-xs text-muted-foreground",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:["w-1.5 h-1.5 rounded-full",r?"bg-warning motion-safe:animate-pulse":"bg-muted-foreground"].join(" ")}),s]})}var j=r(79651),w=r(92614);let k=[{labelKey:"nav.home",href:"/",isActive:e=>"/"===e},{labelKey:"nav.chat",href:"/chat",isActive:e=>e.startsWith("/chat")},{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions")},{labelKey:"nav.repositoriesShort",href:"/repositories",isActive:e=>e.startsWith("/repositories")},{labelKey:"nav.reviewReport",href:"/review",isActive:e=>e.startsWith("/review")},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more")}];function N(e){let{title:t="CommandMate"}=e,r=(0,a.usePathname)(),o=(0,d.c)("commandPalette"),i=(0,d.c)("common"),{setOpen:l}=(0,w.C)(),[x,p]=s.useState(null);return s.useEffect(()=>{p("undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||"")?"⌘":"Ctrl")},[]),(0,n.jsx)("header",{className:"sticky top-0 z-50 border-b border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md",children:(0,n.jsx)("div",{className:"container-custom",children:(0,n.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,n.jsx)("div",{className:"flex items-center space-x-4",children:(0,n.jsxs)(c,{href:"/",className:"flex items-center space-x-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)("div",{className:"w-8 h-8 bg-accent-600 rounded-lg flex items-center justify-center",children:(0,n.jsx)(u.A,{size:20,strokeWidth:2,className:"text-white","aria-hidden":"true"})}),(0,n.jsx)("h1",{className:"text-xl font-bold text-foreground",children:t})]})}),(0,n.jsxs)("nav",{className:"flex items-center space-x-6",role:"navigation",children:[k.map(e=>{let t=e.isActive(r);return(0,n.jsx)(c,{href:e.href,"aria-current":t?"page":void 0,className:"relative py-1 text-sm font-medium transition-colors after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:rounded-full after:bg-accent-600 dark:after:bg-accent-400 after:origin-center motion-safe:after:transition-transform after:duration-200 after:ease-[var(--motion-ease-out)] ".concat(t?"text-accent-600 dark:text-accent-400 after:scale-x-100":"text-muted-foreground hover:text-foreground after:scale-x-0"),children:i(e.labelKey)},e.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"header-command-palette-trigger",onClick:()=>l(!0),"aria-label":o("mobileTrigger"),className:"hidden md:inline-flex items-center gap-2 rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-muted-foreground hover:bg-surface-2 transition-colors",children:[(0,n.jsx)(m.A,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0"}),(0,n.jsx)("span",{children:o("searchAction")}),x&&(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(j.u,{children:x}),(0,n.jsx)(j.u,{children:"K"})]})]}),(0,n.jsx)(y,{}),(0,n.jsx)(h.g,{}),(0,n.jsx)(b,{}),(0,n.jsxs)("a",{href:"https://github.com/kewton/MyCodeBranchDesk",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors flex items-center space-x-1",children:[(0,n.jsx)(f.A,{size:20,strokeWidth:2,"aria-hidden":"true"}),(0,n.jsx)("span",{children:"GitHub"})]})]})]})})})}var C=r(32916),S=r(38218);let A={showSidebar:!0,showGlobalNav:!0,showLocalNav:!1,autoCollapseSidebar:!1},M=[{prefix:"/worktrees/",config:{showGlobalNav:!1,showLocalNav:!0}},{prefix:"/sessions",config:{autoCollapseSidebar:!0}}];var E=r(22592),L=r(85710),R=r(17787),z=r(49027),T=r(27587),B=r(39649),D=r(47650),W=r(55142),P=r(48481);let K=(0,s.memo)(function(e){let{status:t,label:r}=e;return(0,n.jsx)(P.m,{"data-testid":"status-indicator",status:t,label:r,size:"lg"})});function I(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e,8),n)}function O(e){let{id:t,branch:r,isVisible:a,anchorRef:o}=e,[i,l]=(0,s.useState)({top:-9999,left:-9999}),c=(0,s.useRef)(null);if((0,s.useEffect)(()=>{var e,t,r;if(!a||!o.current)return;let n=o.current.getBoundingClientRect(),s=null==(e=c.current)?void 0:e.getBoundingClientRect(),i=null!=(t=null==s?void 0:s.width)?t:0,d=null!=(r=null==s?void 0:s.height)?r:0,u=window.innerWidth,m=window.innerHeight,f=n.right+8;if(f+i>u-8){let e=n.left-8-i;e>=8&&(f=e)}l({top:I(n.top,d,m),left:I(f,i,u)})},[a,o]),"undefined"==typeof document||!a)return null;let d=Math.min(384,Math.max(0,window.innerWidth-16));return D.createPortal((0,n.jsxs)("div",{ref:c,id:t,role:"tooltip",className:" fixed z-[9999] px-3 py-2 rounded-md shadow-lg bg-sidebar text-xs text-sidebar-foreground border border-sidebar-border pointer-events-none max-w-sm transition-opacity duration-150 ",style:{top:i.top,left:i.left,maxWidth:d},children:[(0,n.jsx)("p",{className:"font-medium text-sidebar-foreground whitespace-nowrap",children:r.name}),(0,n.jsx)("p",{className:"text-sidebar-muted whitespace-nowrap",children:r.repositoryName}),(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Status: ",r.status]}),r.worktreePath&&(0,n.jsx)("p",{className:"text-sidebar-muted truncate",children:r.worktreePath}),r.description&&(0,n.jsx)("p",{className:"text-sidebar-muted mt-1 border-t border-sidebar-border pt-1 whitespace-pre-wrap break-words",children:r.description})]}),document.body)}let _=0,F=(0,s.memo)(function(e){let{branch:t,isSelected:r,onClick:a,showRepositoryName:o=!0}=e,i=(0,d.c)("common"),l="tooltip-".concat(t.id),c=(0,s.useRef)(null),[u,m]=(0,s.useState)(!1),f=(0,s.useRef)(null),h=(0,s.useCallback)(()=>{null!==f.current&&(clearTimeout(f.current),f.current=null)},[]);(0,s.useEffect)(()=>()=>h(),[h]);let x=u&&!r;return(0,s.useEffect)(()=>{r&&m(!1)},[r]),(0,s.useEffect)(()=>{if(!u)return;let e=()=>m(!1);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[u]),(0,n.jsxs)("button",{ref:c,"data-testid":"branch-list-item",onClick:()=>{h(),_=Date.now()+400,m(!1),a()},onMouseEnter:()=>{h(),Date.now()>=_&&(f.current=setTimeout(()=>{m(!0)},150))},onMouseLeave:()=>{h(),m(!1)},onFocus:e=>{h(),e.target.matches(":focus-visible")&&(f.current=setTimeout(()=>{m(!0)},150))},onBlur:()=>{h(),m(!1)},"aria-current":r?"true":void 0,"aria-describedby":x?l:void 0,"aria-label":o?void 0:"".concat(t.name," - ").concat(t.repositoryName),className:"\n group relative w-full px-4 py-3 flex flex-col gap-1\n hover:bg-sidebar-hover transition-colors\n focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring\n ".concat(r?"bg-sidebar-hover border-l-2 border-accent-500":"border-l-2 border-transparent","\n "),children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[t.cliStatus&&Object.keys(t.cliStatus).length>0&&(0,n.jsx)("div",{className:"flex items-center justify-center flex-shrink-0 w-4","aria-label":i("branchItem.cliToolStatus"),children:(0,n.jsx)(K,{status:(0,W.A7)(t.cliStatus),label:(0,W.dw)(t.cliStatus,t.cliStatusLabels)})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-sidebar-foreground truncate",children:t.name}),o&&(0,n.jsx)("p",{className:"text-xs text-sidebar-muted truncate",children:t.repositoryName})]}),t.hasUnread&&(0,n.jsx)("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-accent-500 flex-shrink-0","aria-label":i("branchItem.hasUnread")})]}),t.description&&(0,n.jsx)("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:(0,n.jsx)("p",{className:"text-xs text-sidebar-muted line-clamp-2",children:t.description})}),(0,n.jsx)(O,{id:l,branch:t,isVisible:x,anchorRef:c})]})});var V=r(41898);function H(e,t,r){if(t<=0||r<=0)return 0;let n=e+t+8-r;return n>0?-Math.min(n,Math.max(0,e-8)):e<8?8-e:0}let G=(0,s.memo)(function(e){var t;let{sortKey:r,sortDirection:a,onSortKeyChange:o,onSortDirectionChange:i,options:l,defaultDirections:c,compact:u,tooltip:m,iconClassName:f="w-3 h-3"}=e,h=(0,d.c)("common"),[x,p]=(0,s.useState)(!1),g=(0,s.useRef)(null),b=(0,s.useRef)(null),v=(0,s.useRef)({x:0,y:0}),[y,j]=(0,s.useState)({x:0,y:0});(0,s.useEffect)(()=>{function e(e){g.current&&!g.current.contains(e.target)&&p(!1)}if(x)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]),(0,s.useEffect)(()=>{function e(e){"Escape"===e.key&&p(!1)}if(x)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x]),(0,s.useLayoutEffect)(()=>{let e=e=>{v.current=e,j(t=>t.x===e.x&&t.y===e.y?t:e)};if(!x)return void e({x:0,y:0});let t=b.current;if(!t)return;let r=t.getBoundingClientRect();e({x:H(r.left-v.current.x,r.width,window.innerWidth),y:H(r.top-v.current.y,r.height,window.innerHeight)})},[x]);let w=(0,s.useCallback)(()=>{p(e=>!e)},[]),k=(0,s.useCallback)(e=>{if(e===r)i("asc"===a?"desc":"asc");else{var t;o(e),i(null!=(t=null==c?void 0:c[e])?t:"asc")}p(!1)},[r,a,o,i,c]),N=(0,s.useCallback)(()=>{i("asc"===a?"desc":"asc")},[a,i]),C=(null==(t=l.find(e=>e.key===r))?void 0:t.label)||"Sort",S=(0,n.jsxs)("button",{type:"button",onClick:w,"aria-expanded":x,"aria-haspopup":"listbox","aria-label":"Sort by ".concat(C),className:" flex items-center gap-1 px-2 py-1 rounded text-xs text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors ",children:[(0,n.jsx)(J,{className:f}),(0,n.jsx)("span",{className:u?"hidden":"hidden sm:inline",children:C})]});return(0,n.jsxs)("div",{ref:g,className:"relative","data-testid":"sort-selector-base",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[m?(0,n.jsx)(V.m_,{content:m,placement:"bottom",children:S}):S,(0,n.jsx)("button",{type:"button",onClick:N,"aria-label":"asc"===a?"Sort ascending":"Sort descending",className:" p-1 rounded text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors ",children:"asc"===a?(0,n.jsx)(X,{className:f}):(0,n.jsx)(U,{className:f})})]}),x&&(0,n.jsx)("div",{ref:b,role:"listbox","aria-label":h("sort.options"),className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-sidebar border border-sidebar-border ",style:0!==y.x||0!==y.y?{transform:"translate(".concat(y.x,"px, ").concat(y.y,"px)")}:void 0,children:l.map(e=>(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":r===e.key,onClick:()=>k(e.key),className:"\n w-full px-3 py-2 text-left text-sm\n flex items-center justify-between\n hover:bg-sidebar-hover transition-colors\n ".concat(r===e.key?"text-accent-700 dark:text-accent-400":"text-sidebar-muted","\n "),children:[(0,n.jsx)("span",{children:e.label}),r===e.key&&(0,n.jsx)("span",{className:"text-xs",children:"asc"===a?"ASC":"DESC"})]},e.key))})]})});function J(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function X(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function U(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}let q=[{key:"updatedAt",labelKey:"sort.updatedAt"},{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"branchName",labelKey:"sort.branchName"},{key:"status",labelKey:"sort.status"}],Y={updatedAt:"desc"},Z=(0,s.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:r,setSortDirection:a}=(0,C.VF)(),o=(0,d.c)("common"),i=(0,s.useMemo)(()=>q.map(e=>{let{key:t,labelKey:r}=e;return{key:t,label:o(r)}}),[o]);return(0,n.jsx)(G,{sortKey:e,sortDirection:t,onSortKeyChange:r,onSortDirectionChange:a,options:i,defaultDirections:Y,compact:!0,tooltip:o("tooltips.sort"),iconClassName:"w-4 h-4"})});var $=r(744),Q=r(30061),ee=r(36809);let et=["en","ja"],er={en:"English",ja:"日本語"};function en(){return{currentLocale:(0,ee.Ym)(),switchLocale:e=>{if(et.includes(e)){let t="https:"===window.location.protocol;document.cookie="".concat("locale","=").concat(e,";path=/;max-age=").concat(31536e3,";SameSite=Lax").concat(t?";Secure":""),localStorage.setItem("locale",e),window.location.reload()}}}}function es(){let{currentLocale:e,switchLocale:t}=en(),r=(0,d.c)("common");return(0,n.jsx)("select",{value:e,onChange:e=>t(e.target.value),"data-testid":"locale-switcher","aria-label":r("language"),className:" w-full px-3 py-2 rounded-md bg-sidebar text-sidebar-foreground border border-sidebar-border focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent text-sm ",children:et.map(e=>(0,n.jsx)("option",{value:e,children:er[e]},e))})}var ea=r(65380);function eo(){let e=(0,d.c)("auth"),t=(0,ea.H)(),[r,a]=(0,s.useState)(!1);if(!t)return null;async function o(){a(!0);try{await fetch("/api/auth/logout",{method:"POST"}),window.location.href="/login"}catch(e){window.location.href="/login"}}return(0,n.jsx)("button",{type:"button",onClick:o,disabled:r,"data-testid":"logout-button",className:" w-full px-3 py-2 text-sm text-left rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 transition-colors ",children:r?"...":e("logout.button")})}var ei=r(94442),el=r(80344),ec=r(7636);let ed="mcbd-sidebar-group-collapsed",eu="mcbd-sidebar-scroll-top",em="mcbd-sidebar-group-order-cache",ef="w-4 h-4",eh=0;function ex(){try{let e=localStorage.getItem(em);if(!e)return[];let t=function(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e).slice(0,500)}catch(e){return[]}}(e);return t.length,t}catch(e){return[]}}function ep(e){try{localStorage.setItem(em,JSON.stringify(e))}catch(e){}}let eg=(0,s.memo)(function(){var e,t;let r=(0,l.Hq)(),{worktrees:a,repositories:o,selectedWorktreeId:c,selectWorktree:u,refreshWorktrees:m}=(0,B.$f)(),{closeMobileDrawer:f,sortKey:h,sortDirection:x,viewMode:p,setViewMode:g}=(0,C.VF)(),v=(0,d.c)("common"),[y,j]=(0,s.useState)(""),w=(0,s.useRef)(null),[k,N]=(0,s.useState)(()=>{try{let e=localStorage.getItem(ed);return e?function(e){try{let t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))return{};let r={},n=0;for(let[e,s]of Object.entries(t))if(!ev.has(e)&&"boolean"==typeof s){if(++n>100)break;r[e]=s}return r}catch(e){return{}}}(e):{}}catch(e){return{}}}),[S,A]=(0,s.useState)(ex),M=(0,s.useRef)(!1);(0,s.useEffect)(()=>{M.current||(M.current=!0,fetch("/api/sidebar/group-order").then(e=>e.json()).then(e=>{e.success&&Array.isArray(e.order)&&(A(e.order),ep(e.order))}).catch(()=>{}))},[]);let E=(0,s.useMemo)(()=>(0,ec.UZ)(o),[o]),T=(0,s.useMemo)(()=>(0,ec.s6)(a,E),[a,E]),D=(0,s.useMemo)(()=>T.map(W.XK),[T]),P=(0,s.useDeferredValue)(D),K=(0,s.useRef)(null),I=(0,s.useRef)(null);(0,s.useEffect)(()=>()=>{null!==I.current&&clearTimeout(I.current)},[]);let O=(0,s.useMemo)(()=>{let e=K.current;return!e||Date.now()>=e.expiresAt?P:e.items},[P]),_=(0,s.useRef)(O);(0,s.useLayoutEffect)(()=>{_.current=O});let H=(0,s.useCallback)(()=>{null!==I.current&&(clearTimeout(I.current),I.current=null);let e=K.current;if(e&&Date.now()<e.expiresAt){K.current={...e,expiresAt:1/0};return}K.current={items:_.current,expiresAt:1/0}},[]),G=(0,s.useCallback)(()=>{K.current&&(K.current={...K.current,expiresAt:Date.now()+1e3},null!==I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{K.current=null},1e3))},[]),{sortedItems:J,groupedItems:X}=function(e){let{items:t,sortKey:r,sortDirection:n,viewMode:a,filterText:o}=e,i=(0,s.useMemo)(()=>{if(!o)return t;let e=o.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.repositoryName.toLowerCase().includes(e))},[t,o]);return{sortedItems:(0,s.useMemo)(()=>(0,ec.Xn)(i,r,n),[i,r,n]),groupedItems:(0,s.useMemo)(()=>"grouped"===a?(0,ec._s)(i,r,n):[],[i,r,n,a])}}({items:O,sortKey:h,sortDirection:x,viewMode:p,filterText:y}),U=(0,s.useMemo)(()=>{if("grouped"!==p||!X)return null;if(y.trim()||0===S.length)return X;let e=new Map(S.map((e,t)=>[e,t]));return[...X].sort((t,r)=>{let n=e.has(t.repositoryName)?e.get(t.repositoryName):1/0,s=e.has(r.repositoryName)?e.get(r.repositoryName):1/0;return n===s?t.repositoryName.localeCompare(r.repositoryName):n-s})},[p,X,S,y]),q="grouped"===p?U:null;(0,s.useEffect)(()=>{try{localStorage.setItem(ed,JSON.stringify(k))}catch(e){}},[k]);let Y=(0,s.useCallback)(e=>{N(t=>({...t,[e]:!t[e]}))},[]),Q=(0,s.useCallback)(()=>{var e,t,r=null!=(t=null==(e=w.current)?void 0:e.scrollTop)?t:0;let n=Number.isFinite(r)&&r>0?r:0;eh=n;try{localStorage.setItem(eu,String(n))}catch(e){}},[]),ee=J.length>0||(null!=(e=null==q?void 0:q.length)?e:0)>0;(0,s.useEffect)(()=>{let e=w.current;if(!e)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=function(){try{let e=localStorage.getItem(eu);if(!e)return eh=0,0;let t=Number(e);Number.isFinite(t)&&t>=0&&(eh=t)}catch(e){}return eh}()});return()=>{window.cancelAnimationFrame(t)}},[ee,p]);let et=(0,s.useCallback)(e=>{Q(),u(e),r.push("/worktrees/".concat(e)),f()},[Q,u,r,f]),er=(0,R.FR)((0,R.MS)(R.AN,{activationConstraint:{distance:8}})),en=(0,s.useCallback)(e=>{let{active:t,over:r}=e;if(!r||t.id===r.id||!q)return;let n=q.map(e=>e.repositoryName),s=n.indexOf(String(t.id)),a=n.indexOf(String(r.id));if(-1===s||-1===a)return;let o=(0,z.be)(n,s,a);A(o),ep(o),fetch("/api/sidebar/group-order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:o})}).catch(()=>{A(n),ep(n)})},[q]),ea="flat"===p?0===J.length:(null!=(t=null==q?void 0:q.length)?t:0)===0;return(0,n.jsxs)("nav",{"data-testid":"sidebar","aria-label":v("sidebar.branchNavigation"),className:"h-full flex flex-col bg-sidebar text-sidebar-foreground",role:"navigation",children:[(0,n.jsx)("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 px-4 py-4 border-b border-sidebar-border",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-y-2",children:[(0,n.jsx)("h2",{className:"min-w-0 truncate text-lg font-semibold text-sidebar-foreground",children:v("sidebar.branches")}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,n.jsx)(ej,{viewMode:p,onToggle:g}),(0,n.jsx)(Z,{}),(0,n.jsx)(eA,{refreshWorktrees:m}),(0,n.jsx)(V.m_,{content:v("tooltips.repositories"),placement:"bottom",children:(0,n.jsx)(i(),{href:"/repositories","aria-label":v("nav.repositories"),className:"p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors inline-flex items-center",children:(0,n.jsx)(L.A,{className:ef,"aria-hidden":"true"})})})]})]})}),(0,n.jsx)("div",{className:"flex-shrink-0 px-4 py-3 border-b border-sidebar-border",children:(0,n.jsx)($.pd,{type:"text",placeholder:v("sidebar.searchBranches"),value:y,onChange:e=>j(e.target.value),className:"bg-background shadow-none"})}),(0,n.jsx)("div",{ref:w,"data-testid":"branch-list",onScroll:Q,onMouseEnter:H,onMouseLeave:G,className:"flex-1 overflow-y-auto overflow-x-hidden",children:ea?(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sidebar-muted",children:v(y?"sidebar.noBranchesFound":"sidebar.noBranchesAvailable")}):"grouped"===p&&q?(0,n.jsx)(R.Mp,{sensors:er,collisionDetection:R.fp,onDragEnd:en,children:(0,n.jsx)(z.gB,{items:q.map(e=>e.repositoryName),strategy:z._G,children:q.map(e=>{let t=!k[e.repositoryName]||!!y.trim();return(0,n.jsx)(eb,{group:e,isExpanded:t,selectedWorktreeId:c,onToggle:()=>Y(e.repositoryName),onBranchClick:et,isDragDisabled:!!y.trim()},e.repositoryName)})})}):J.map(e=>(0,n.jsx)(F,{branch:e,isSelected:e.id===c,onClick:()=>et(e.id)},e.id))}),(0,n.jsxs)("div",{className:"flex-shrink-0 px-4 py-3 border-t border-sidebar-border space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(es,{})}),(0,n.jsx)(b,{})]}),(0,n.jsx)(eo,{})]})]})});function eb(e){let{group:t,isExpanded:r,selectedWorktreeId:s,onToggle:a,onBranchClick:o,isDragDisabled:i}=e,{attributes:l,listeners:c,setNodeRef:d,setActivatorNodeRef:u,transform:m,transition:f,isDragging:h}=(0,z.gl)({id:t.repositoryName,disabled:i}),x={transform:T.Ks.Transform.toString(m),transition:f,opacity:h?.5:1};return(0,n.jsxs)("div",{ref:d,style:x,className:"w-full min-w-0",children:[(0,n.jsx)(ey,{repositoryName:t.repositoryName,branchCount:t.branches.length,isExpanded:r,onClick:a,dragHandleRef:u,dragHandleListeners:i?void 0:c,dragHandleAttributes:i?void 0:l}),r&&t.branches.map(e=>(0,n.jsx)(F,{branch:e,isSelected:e.id===s,onClick:()=>o(e.id),showRepositoryName:!1},e.id))]})}let ev=new Set(["__proto__","constructor","prototype"]);function ey(e){let{repositoryName:t,branchCount:r,isExpanded:s,onClick:a,dragHandleRef:o,dragHandleListeners:i,dragHandleAttributes:l}=e,c=(0,d.c)("common");return(0,n.jsxs)("div",{className:"flex items-center w-full",children:[i&&(0,n.jsx)("div",{ref:o,...i,...l,"aria-label":c("sidebar.dragToReorderGroup"),className:" flex-shrink-0 flex items-center justify-center w-6 h-full pl-2 cursor-grab active:cursor-grabbing text-sidebar-muted hover:text-sidebar-foreground transition-colors ",children:(0,n.jsx)(eC,{})}),(0,n.jsxs)("button",{"data-testid":"group-header",type:"button",onClick:a,"aria-expanded":s,className:" flex-1 min-w-0 flex items-center gap-2 px-2 py-2 text-xs font-semibold text-sidebar-muted uppercase tracking-wider focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring transition-colors ",children:[(0,n.jsx)(ew,{isExpanded:s}),(0,n.jsx)(ek,{color:(0,ec.LV)(t)}),(0,n.jsx)(Q.nR,{content:t,className:"flex-1 min-w-0 text-left truncate",children:t}),(0,n.jsx)("span",{className:"text-sidebar-muted font-normal tabular-nums pr-2",children:r})]})]})}function ej(e){let{viewMode:t,onToggle:r}=e,s=(0,d.c)("common");return(0,n.jsx)(V.m_,{content:s("tooltips.viewMode"),placement:"bottom",children:(0,n.jsx)("button",{"data-testid":"view-mode-toggle",type:"button",onClick:()=>{r("grouped"===t?"flat":"grouped")},"aria-label":s("grouped"===t?"sidebar.switchToFlatView":"sidebar.switchToGroupedView"),className:" p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors ",children:"grouped"===t?(0,n.jsx)(eN,{className:ef}):(0,n.jsx)(ek,{className:ef})})})}function ew(e){let{isExpanded:t}=e;return(0,n.jsx)("svg",{className:"w-3 h-3 flex-shrink-0 transition-transform ".concat(t?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})}function ek(e){let{className:t="w-3.5 h-3.5",color:r}=e;return(0,n.jsx)("svg",{className:"".concat(t," flex-shrink-0"),viewBox:"0 0 24 24",fill:null!=r?r:"none",stroke:r?"none":"currentColor",strokeWidth:2*!r,"aria-hidden":"true",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}function eN(e){let{className:t="w-3 h-3"}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})}function eC(){return(0,n.jsxs)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,n.jsx)("circle",{cx:"9",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"19",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"19",r:"1.5"})]})}function eS(e){let{className:t=""}=e;return(0,n.jsx)("svg",{className:"".concat(ef," ").concat(t),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20.49 9A9 9 0 005.64 5.64L4 4m16 16l-1.64-1.64A9 9 0 014.51 15"})})}let eA=(0,s.memo)(function(e){let{refreshWorktrees:t}=e,[r,a]=(0,s.useState)(!1),o=(0,s.useRef)(!1),{showToast:i,toasts:l,removeToast:c}=(0,ei.dj)(),u=(0,d.c)("common"),m=(0,s.useCallback)(async()=>{if(!o.current){o.current=!0,a(!0);try{let e=await el.Rx.sync();await t(),i(u("syncSuccess",{count:e.worktreeCount}),"success",3e3)}catch(e){e instanceof el.hD&&401===e.status?i(u("syncAuthError"),"error",5e3):i(u("syncError"),"error",5e3)}finally{o.current=!1,a(!1)}}},[t,i,u]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(V.m_,{content:u("tooltips.sync"),placement:"bottom",children:(0,n.jsx)("button",{type:"button",onClick:m,disabled:r,"aria-label":u("syncButtonLabel"),className:"p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:(0,n.jsx)(eS,{className:r?"animate-spin":""})})}),(0,n.jsx)(ei.N9,{toasts:l,onClose:c})]})});var eM=r(65993),eE=r(37586),eL=r(66685),eR=r(61362),ez=r(37772);let eT=[{labelKey:"nav.home",href:"/",isActive:e=>"/"===e,icon:(0,n.jsx)(eM.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.chat",href:"/chat",isActive:e=>e.startsWith("/chat"),icon:(0,n.jsx)(eE.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions"),icon:(0,n.jsx)(eL.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.review",href:"/review",isActive:e=>e.startsWith("/review"),icon:(0,n.jsx)(eR.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more"),icon:(0,n.jsx)(ez.A,{size:20,"aria-hidden":"true"})}];function eB(){let e=(0,a.usePathname)(),{setOpen:t}=(0,w.C)(),r=(0,d.c)("commandPalette"),s=(0,d.c)("common");return(0,n.jsx)("nav",{"data-testid":"global-mobile-nav",className:"fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md pb-safe",children:(0,n.jsxs)("div",{className:"flex items-center justify-around h-14",children:[eT.map(t=>{let r=t.isActive(e);return(0,n.jsxs)(c,{href:t.href,className:"flex flex-col items-center justify-center flex-1 h-full text-xs transition-colors ".concat(r?"text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),children:[t.icon,(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:s(t.labelKey)})]},t.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"mobile-command-palette-trigger",onClick:()=>t(!0),"aria-label":r("mobileTrigger"),className:"flex flex-col items-center justify-center flex-1 h-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(m.A,{size:20,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:r("mobileLabel")})]})]})})}var eD=r(79698),eW=r(24533),eP=r(79451),eK=r(89559),eI=r(97470),eO=r(76482),e_=r(39332),eF=r(87531),eV=r(59854),eH=r(70628),eG=r(66966),eJ=r(68704);let eX=[{key:"home",href:"/"},{key:"chat",href:"/chat"},{key:"sessions",href:"/sessions"},{key:"repositories",href:"/repositories"},{key:"review",href:"/review"},{key:"more",href:"/more"}],eU={home:eM.A,chat:eE.A,sessions:eL.A,repositories:eW.A,review:eR.A,more:ez.A},eq="cm.palette.recents";function eY(e){if(!e||"object"!=typeof e)return!1;let{kind:t,id:r}=e;return("nav"===t||"worktree"===t||"action"===t)&&"string"==typeof r}function eZ(e){return e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isSessionRunning?"ready":"idle"}function e$(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return!!("INPUT"===t||"TEXTAREA"===t||"SELECT"===t||e.isContentEditable||e.closest('[role="log"]'))}let eQ=(0,eF.cn)("flex cursor-pointer items-center gap-2 rounded-md px-2 py-2 text-sm","text-foreground","data-[selected=true]:bg-accent-500/15 data-[selected=true]:text-accent-700","dark:data-[selected=true]:text-accent-300"),e0="shrink-0 text-muted-foreground";function e1(){var e,t,r;let{open:o,setOpen:i}=(0,w.C)(),{setOpen:l}=(0,eH.K)(),c=(0,a.useRouter)(),u=(0,d.c)("commandPalette"),h=(0,d.c)("common"),{theme:b,setTheme:v}=(0,x.D)(),{setSize:y,isMobile:k}=(0,E.Ps)(),{currentLocale:N,switchLocale:C}=en(),S=(0,eG.rC)(),{toasts:A,showToast:M,removeToast:L}=(0,ei.dj)(),[R,z]=(0,s.useState)(!1),[T,B]=(0,s.useState)(""),[W,K]=(0,s.useState)([]),I=(0,s.useRef)(null),O=(0,s.useRef)(null),_=(0,s.useRef)(o);(0,s.useEffect)(()=>{_.current=o},[o]),(0,s.useEffect)(()=>{z(!0)},[]),(0,s.useEffect)(()=>{function e(e){if(("k"===e.key||"K"===e.key)&&(e.metaKey||e.ctrlKey)){if(_.current){e.preventDefault(),e.stopPropagation(),i(!1);return}if(e$(e.target))return;e.preventDefault(),i(!0);return}"Escape"===e.key&&_.current&&(e.preventDefault(),e.stopPropagation(),i(!1))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i]),(0,s.useEffect)(()=>{var e,t,r,n;o?(O.current=null!=(t=document.activeElement)?t:null,null==(e=I.current)||e.focus(),B(""),K(function(){try{let e=localStorage.getItem(eq);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(eY).slice(0,8)}catch(e){return[]}}())):O.current&&(null==(r=(n=O.current).focus)||r.call(n),O.current=null)},[o]);let F=(0,s.useCallback)((e,t)=>{t&&K(e=>(function(e,t){let r=e.filter(e=>e.kind!==t.kind||e.id!==t.id),n=[t,...r].slice(0,8);try{localStorage.setItem(eq,JSON.stringify(n))}catch(e){}return n})(e,t)),i(!1),e()},[i]),V=(0,s.useCallback)(async()=>{try{var e;await el.Rx.sync(),await (null==S||null==(e=S.refresh)?void 0:e.call(S)),M(u("actions.syncSuccess"),"success")}catch(e){M(u("actions.syncError"),"error")}},[S,M,u]),H="dark"===b,G=""===T.trim(),J=null!=(e=null==S?void 0:S.error)?e:null,X=null!=(t=null==S?void 0:S.isLoading)&&t,U=J?[]:null!=(r=null==S?void 0:S.worktrees)?r:[],q=U.length>0,Y=!J&&X&&0===U.length,Z=[...U].sort((e,t)=>{let r=+!!e.isSessionRunning,n=+!!t.isSessionRunning;if(r!==n)return n-r;let s=e.updatedAt?new Date(e.updatedAt).getTime():0;return(t.updatedAt?new Date(t.updatedAt).getTime():0)-s}),$=G?Z.slice(0,8):Z,Q=[{id:"theme",label:H?u("actions.toLight"):u("actions.toDark"),icon:H?p.A:g.A,run:()=>v(H?"light":"dark")},...k?[]:eJ.Uf.map(e=>({id:"displaysize:".concat(e),label:"".concat(u("actions.displaySizePrefix"),": ").concat(h("displaySize.".concat(e))),icon:eP.A,run:()=>y(e)})),{id:"sync",label:u("actions.syncRepositories"),icon:eK.A,run:()=>{V()}},{id:"locale",label:u("actions.switchLanguage"),icon:eI.A,run:()=>C("ja"===N?"en":"ja")},{id:"github",label:u("actions.openGitHub"),icon:f.A,run:()=>window.open("https://github.com/kewton/MyCodeBranchDesk","_blank","noopener,noreferrer")},{id:"keyboardShortcuts",label:u("actions.keyboardShortcuts"),icon:eO.A,run:()=>l(!0)}],ee=G?W.map(e=>{if("nav"===e.kind){let t=eX.find(t=>t.key===e.id);if(!t)return null;let r=eU[t.key],s=h("nav.".concat(t.key));return{id:"nav-".concat(t.key),value:"recent nav ".concat(t.key),node:(0,n.jsxs)(n.Fragment,{children:[r&&(0,n.jsx)(r,{size:16,className:e0,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:s})]}),onSelect:()=>F(()=>c.push(t.href),{kind:"nav",id:t.key})}}if("worktree"===e.kind){let t=U.find(t=>t.id===e.id);if(!t)return null;let r=t.repositoryDisplayName||t.repositoryName||"",s=t.branch||t.name;return{id:"worktree-".concat(t.id),value:"recent worktree ".concat(t.id),node:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e_.A,{size:16,className:e0,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:s}),r&&(0,n.jsx)("span",{className:"ml-auto truncate pl-2 text-xs text-muted-foreground",children:r}),(0,n.jsx)(P.m,{status:eZ(t),size:"sm",className:r?"ml-2":"ml-auto"})]}),onSelect:()=>F(()=>c.push("/worktrees/".concat(t.id)),{kind:"worktree",id:t.id})}}let t=Q.find(t=>t.id===e.id);if(!t)return null;let r=t.icon;return{id:"action-".concat(t.id),value:"recent action ".concat(t.id),node:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r,{size:16,className:e0,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:t.label})]}),onSelect:()=>F(t.run,{kind:"action",id:t.id})}}).filter(e=>null!==e):[];return R?(0,D.createPortal)((0,n.jsxs)(n.Fragment,{children:[o&&(0,n.jsxs)("div",{className:"fixed inset-0 overflow-y-auto",style:{zIndex:eV.M.MODAL},"data-testid":"command-palette",children:[(0,n.jsx)("div",{"data-state":"open","aria-hidden":"true",className:"fixed inset-0 bg-black/40 backdrop-blur-sm transition-opacity data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:duration-200",onClick:()=>i(!1)}),(0,n.jsx)("div",{className:"relative flex min-h-full items-start justify-center p-4 pt-[15vh]",children:(0,n.jsx)("div",{"data-state":"open","data-testid":"command-palette-panel",className:(0,eF.cn)("relative w-full max-w-lg overflow-hidden rounded-xl bg-surface/95 shadow-2xl ring-1 ring-border backdrop-blur-xl","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:duration-200"),children:(0,n.jsxs)(eD.uB,{label:u("title"),className:(0,eF.cn)("flex flex-col","[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-2","[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[(0,n.jsx)(m.A,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),(0,n.jsx)(eD.uB.Input,{ref:I,value:T,onValueChange:B,placeholder:u("placeholder"),"data-testid":"command-palette-input",className:"flex-1 bg-transparent py-3 text-sm text-foreground outline-none placeholder:text-muted-foreground"})]}),(0,n.jsxs)(eD.uB.List,{className:"max-h-[min(60vh,360px)] overflow-y-auto p-2",children:[(0,n.jsx)(eD.uB.Empty,{"data-testid":"command-palette-empty",className:"py-6 text-center text-sm text-muted-foreground",children:u("empty")}),Y&&(0,n.jsx)(eD.uB.Loading,{"data-testid":"command-palette-loading",className:"py-6 text-center text-sm text-muted-foreground",children:u("loading")}),ee.length>0&&(0,n.jsx)(eD.uB.Group,{heading:u("groups.recent"),children:ee.map(e=>(0,n.jsx)(eD.uB.Item,{value:e.value,onSelect:e.onSelect,className:eQ,children:e.node},e.id))}),(0,n.jsx)(eD.uB.Group,{heading:u("groups.navigation"),children:eX.map(e=>{let t=h("nav.".concat(e.key)),r=eU[e.key];return(0,n.jsxs)(eD.uB.Item,{value:"nav ".concat(t," ").concat(e.href),onSelect:()=>F(()=>c.push(e.href),{kind:"nav",id:e.key}),className:eQ,children:[r&&(0,n.jsx)(r,{size:16,className:e0,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:t})]},e.key)})}),q&&(0,n.jsx)(eD.uB.Group,{heading:u("groups.worktrees"),children:$.map(e=>{let t=e.repositoryDisplayName||e.repositoryName||"",r=e.branch||e.name;return(0,n.jsxs)(eD.uB.Item,{value:"worktree ".concat(t," ").concat(r," ").concat(e.name," ").concat(e.id),onSelect:()=>F(()=>c.push("/worktrees/".concat(e.id)),{kind:"worktree",id:e.id}),className:eQ,children:[(0,n.jsx)(e_.A,{size:16,className:e0,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:r}),t&&(0,n.jsx)("span",{className:"ml-auto truncate pl-2 text-xs text-muted-foreground",children:t}),(0,n.jsx)(P.m,{status:eZ(e),size:"sm",className:t?"ml-2":"ml-auto"})]},e.id)})}),(0,n.jsx)(eD.uB.Group,{heading:u("groups.actions"),children:Q.map(e=>{let t=e.icon;return(0,n.jsxs)(eD.uB.Item,{value:"action ".concat(e.id," ").concat(e.label),onSelect:()=>F(e.run,{kind:"action",id:e.id}),className:eQ,children:[(0,n.jsx)(t,{size:16,className:e0,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:e.label})]},e.id)})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 border-t border-border bg-surface-2 px-3 py-2 text-[11px] text-muted-foreground",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(j.u,{children:"↑"}),(0,n.jsx)(j.u,{children:"↓"}),u("footer.navigate")]}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(j.u,{children:"↵"}),u("footer.select")]}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(j.u,{children:"esc"}),u("footer.close")]})]})]})})})]}),(0,n.jsx)(ei.N9,{toasts:A,onClose:L})]}),document.body):null}var e2=r(94465);let e4=["global","terminal","composer"],e5=[{id:"commandPalette",keys:["MOD","K"],scope:"global"},{id:"keyboardHelp",keys:["?"],scope:"global"},{id:"closeOverlay",keys:["Esc"],scope:"global"},{id:"navigateList",keys:["↑","↓"],scope:"global"},{id:"terminalSearch",keys:["MOD","F"],scope:"terminal"},{id:"sendMessage",keys:["↵"],scope:"composer"},{id:"composerNewline",keys:["Shift","↵"],scope:"composer"}];function e9(){let{open:e,setOpen:t}=(0,eH.K)(),{open:r}=(0,w.C)(),a=(0,d.c)("keyboardShortcuts"),[o,i]=(0,s.useState)(!1);(0,s.useEffect)(()=>i(function(){if("undefined"==typeof navigator)return!1;let e=navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)}()),[]);let l=(0,s.useRef)(e);(0,s.useEffect)(()=>{l.current=e},[e]);let c=(0,s.useRef)(r);(0,s.useEffect)(()=>{c.current=r},[r]),(0,s.useEffect)(()=>{function e(e){"?"!==e.key||e.isComposing||229===e.keyCode||e$(e.target)||c.current||l.current||(e.preventDefault(),t(!0))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e5;return e4.map(t=>({scope:t,shortcuts:e.filter(e=>e.scope===t)})).filter(e=>e.shortcuts.length>0)}();return(0,n.jsx)(e2.a,{isOpen:e,onClose:()=>t(!1),title:a("title"),size:"md",children:(0,n.jsx)("div",{"data-testid":"keyboard-shortcuts-overlay",className:"space-y-6",children:u.map(e=>{let{scope:t,shortcuts:r}=e;return(0,n.jsxs)("section",{"data-testid":"keyboard-shortcuts-scope-".concat(t),children:[(0,n.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:a("scopes.".concat(t))}),(0,n.jsx)("ul",{className:"divide-y divide-border",children:r.map(e=>(0,n.jsxs)("li",{"data-testid":"keyboard-shortcut-".concat(e.id),className:"flex items-center justify-between gap-4 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:a("shortcuts.".concat(e.id))}),(0,n.jsx)("span",{className:"flex flex-shrink-0 items-center gap-1",children:e.keys.map((e,t)=>(0,n.jsx)(j.u,{children:"MOD"===e?o?"⌘":"Ctrl":e},t))})]},e.id))})]},t)})})})}var e6=r(52056),e3=r(65229),e8=r(52703);function e7(){let e=(0,d.c)("common"),[t,r]=(0,s.useState)(null),[a,o]=(0,s.useState)(null),i=(0,s.useCallback)(e=>{if(e.type!==e8.Oo)return;let{serverVersion:t,clientVersion:n}=e;"string"==typeof t&&"string"==typeof n&&t&&n&&t!==a&&r({serverVersion:t,clientVersion:n})},[a]);(0,v.T3)(i);let l=(0,s.useCallback)(()=>{window.location.reload()},[]),c=(0,s.useCallback)(()=>{r(e=>(e&&o(e.serverVersion),null))},[]);return t?(0,n.jsxs)("div",{"data-testid":"version-mismatch-banner",role:"alert","aria-live":"assertive",className:"fixed top-3 left-1/2 -translate-x-1/2 flex items-start gap-3 max-w-[92vw] rounded-lg border border-warning-border bg-warning-subtle px-4 py-3 text-warning-foreground shadow-lg",style:{zIndex:eV.M.TOAST},children:[(0,n.jsx)(e6.A,{className:"h-5 w-5 shrink-0 mt-0.5","aria-hidden":"true"}),(0,n.jsxs)("div",{className:"flex flex-col gap-0.5 text-sm",children:[(0,n.jsx)("span",{className:"font-semibold",children:e("versionMismatch.title")}),(0,n.jsx)("span",{children:e("versionMismatch.description",{serverVersion:t.serverVersion,clientVersion:t.clientVersion})})]}),(0,n.jsxs)("button",{type:"button","data-testid":"version-mismatch-reload",onClick:l,className:"shrink-0 inline-flex items-center gap-1.5 rounded-md border border-warning-border px-3 py-1.5 text-sm font-medium hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-2",children:[(0,n.jsx)(eK.A,{className:"h-4 w-4","aria-hidden":"true"}),e("versionMismatch.reload")]}),(0,n.jsx)("button",{type:"button","data-testid":"version-mismatch-dismiss",onClick:c,"aria-label":e("versionMismatch.dismiss"),className:"shrink-0 hover:opacity-70 focus:outline-none focus:ring-2 focus:ring-offset-2",children:(0,n.jsx)(e3.A,{className:"h-4 w-4","aria-hidden":"true"})})]}):null}let te="transform transition-transform duration-300 ease-out",tt=(0,s.memo)(function(e){let{children:t}=e,{isOpen:r,isMobileDrawerOpen:o,closeMobileDrawer:i,width:l,setWidth:c}=(0,C.VF)(),d=(0,S.a)(),{showSidebar:u,showGlobalNav:m}=function(){var e=(0,a.usePathname)();for(let t of M)if(e.startsWith(t.prefix))return{...A,...t.config};return{...A}}(),{factor:f}=(0,E.Ps)(),h=Math.round(160*f),x=Math.round(480*f),p=Math.round(Math.min(x,Math.max(h,l*f))),g=(0,s.useRef)(null),b=(0,s.useRef)(null),v=(0,s.useCallback)(e=>{c(Math.round(e/f))},[c,f]);return d?(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[o&&(0,n.jsx)("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:i,"aria-hidden":"true"}),u&&(0,n.jsx)("aside",{"data-testid":"sidebar-container",className:"\n fixed left-0 top-0 h-full w-72 z-50\n ".concat(te,"\n ").concat(o?"translate-x-0":"-translate-x-full","\n "),role:"complementary",children:(0,n.jsx)(eg,{})}),(0,n.jsx)("main",{className:"flex-1 min-h-0 overflow-hidden ".concat(m?"pb-14":""),role:"main","data-view-transition":"content",children:t}),m&&(0,n.jsx)(eB,{}),(0,n.jsx)(e1,{}),(0,n.jsx)(e9,{}),(0,n.jsx)(e7,{})]}):(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[m&&(0,n.jsx)(N,{}),(0,n.jsxs)("div",{className:"flex flex-1 min-h-0",children:[u&&(0,n.jsxs)("aside",{ref:g,"data-testid":"sidebar-container",className:"\n fixed left-0\n ".concat(m?"top-16 h-[calc(100vh-4rem)]":"top-0 h-full","\n border-r border-border\n ").concat(te,"\n ").concat(r?"translate-x-0":"-translate-x-full","\n "),style:{width:"".concat(p,"px"),zIndex:eV.M.SIDEBAR},role:"complementary","aria-hidden":!r,children:[(0,n.jsx)(eg,{}),(0,n.jsx)(tr,{currentWidth:p,minWidth:h,maxWidth:x,sidebarRef:g,mainRef:b,onWidthChange:v})]}),(0,n.jsx)("main",{ref:b,className:"flex-1 min-w-0 h-full overflow-hidden transition-[padding] duration-300 ease-out",style:{paddingLeft:u&&r?"".concat(p,"px"):0},role:"main","data-view-transition":"content",children:t})]}),(0,n.jsx)(e1,{}),(0,n.jsx)(e9,{}),(0,n.jsx)(e7,{})]})});function tr(e){let{currentWidth:t,minWidth:r,maxWidth:s,sidebarRef:a,mainRef:o,onWidthChange:i}=e;return(0,n.jsx)("div",{"data-testid":"sidebar-resize-handle","aria-hidden":"true",onMouseDown:e=>{e.preventDefault();let n=e.clientX,l=t;o.current&&(o.current.style.transition="none");let c=e=>{l=Math.max(r,Math.min(s,t+(e.clientX-n))),a.current&&(a.current.style.width="".concat(l,"px")),o.current&&(o.current.style.paddingLeft="".concat(l,"px"))},d=()=>{document.body.style.cursor="",document.body.style.userSelect="",o.current&&(o.current.style.transition=""),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d),i(l)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-accent-500/40 transition-colors"})}},30061:(e,t,r)=>{r.d(t,{nR:()=>o});var n=r(95155),s=r(12115),a=r(47650);function o(e){let{content:t,delay:r=200,className:o,children:i,metadata:l}=e,c=(0,s.useRef)(null),d=(0,s.useRef)(null),u=(0,s.useRef)(null),m=(0,s.useRef)(null),[f,h]=(0,s.useState)(!1),[x,p]=(0,s.useState)({top:-9999,left:-9999}),g=(0,s.useCallback)(()=>{null!==u.current&&(clearTimeout(u.current),u.current=null)},[]),b=(0,s.useCallback)(()=>{let e=c.current;e&&(e.scrollWidth>e.clientWidth||l)&&(g(),u.current=setTimeout(()=>{let t=e.getBoundingClientRect(),r=Math.max(4,window.innerWidth-384-4);m.current={top:t.top,bottom:t.bottom},p({top:t.bottom+4,left:Math.min(t.left,r)}),h(!0),u.current=null},r))},[g,r,l]);(0,s.useLayoutEffect)(()=>{if(!f)return;let e=d.current,t=m.current;if(!e||!t)return;let{height:r}=e.getBoundingClientRect();if(r<=0)return;let n=window.innerHeight;if(t.bottom+4+r+4<=n)return;let s=t.top-4-r,a=s>=4?s:Math.max(4,n-r-4);p(e=>e.top===a?e:{...e,top:a})},[f]);let v=(0,s.useCallback)(()=>{g(),h(!1)},[g]);return(0,s.useEffect)(()=>()=>g(),[g]),(0,n.jsxs)("span",{ref:c,className:o,onMouseEnter:b,onMouseLeave:v,children:[null!=i?i:t,f&&"undefined"!=typeof document&&(0,a.createPortal)((0,n.jsxs)("span",{ref:d,role:"tooltip","aria-hidden":"true",className:"fixed z-[9999] max-w-md px-2 py-1 text-xs font-medium rounded bg-foreground text-background shadow-lg pointer-events-none",style:{top:x.top,left:x.left},children:[(0,n.jsx)("span",{className:"block break-all",children:t}),l&&(0,n.jsx)("span",{className:"mt-0.5 block whitespace-pre-line font-normal text-background/70",children:l})]}),document.body)]})}},34681:(e,t,r)=>{r.d(t,{g:()=>i});var n=r(95155);r(12115);var s=r(18955),a=r(22592),o=r(68704);function i(){let{size:e,setSize:t,isMobile:r}=(0,a.Ps)(),i=(0,s.c)("common");if(r)return null;let l=i("displaySize.ariaLabel");return(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("label",{htmlFor:"pc-display-size",className:"sr-only",children:l}),(0,n.jsx)("select",{id:"pc-display-size","data-testid":"pc-display-size-select","aria-label":l,value:e,onChange:e=>{let r=e.target.value;(0,o.fM)(r)&&t(r)},className:"text-sm bg-transparent text-foreground border border-input rounded-md px-2 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:o.Uf.map(e=>(0,n.jsx)("option",{value:e,children:i("displaySize.".concat(e))},e))})]})}},41898:(e,t,r)=>{r.d(t,{m_:()=>l});var n=r(95155),s=r(12115),a=r(47650);function o(e,t,r){return Math.min(Math.max(e,4),Math.max(4,r-t-4))}let i={top:-9999,left:-9999};function l(e){let{content:t,placement:r="right",delay:l=100,children:c}=e,[d,u]=(0,s.useState)(!1),[m,f]=(0,s.useState)(null),h=(0,s.useRef)(null),x=(0,s.useRef)(null),p=(0,s.useRef)(null),g=(0,s.useCallback)(()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},[]),b=(0,s.useCallback)(()=>{g(),p.current=setTimeout(()=>{u(!0),p.current=null},l)},[l,g]),v=(0,s.useCallback)(()=>{g(),u(!1),f(null)},[g]),y=(0,s.useCallback)(()=>{let e=h.current,t=x.current;if(!e||!t)return;let n=e.getBoundingClientRect(),s=t.getBoundingClientRect();f(function(e,t,r,n){let s,a,i=t.left+t.width/2-r.width/2,l=t.top+t.height/2-r.height/2;switch(e){case"top":s=t.top-r.height-8,a=i;break;case"bottom":s=t.top+t.height+8,a=i;break;case"left":s=l,a=t.left-r.width-8;break;default:s=l,a=t.left+t.width+8}return{top:o(s,r.height,n.height),left:o(a,r.width,n.width)}}(r,{top:n.top,left:n.left,width:n.width,height:n.height},{width:s.width,height:s.height},{width:window.innerWidth,height:window.innerHeight}))},[r]);return(0,s.useLayoutEffect)(()=>{if(d)return y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[d,y]),(0,s.useEffect)(()=>()=>{g()},[g]),(0,n.jsxs)("span",{ref:h,"data-testid":"tooltip-wrapper",className:"relative inline-flex",tabIndex:-1,onMouseEnter:b,onMouseLeave:v,children:[c,d&&"undefined"!=typeof document&&(0,a.createPortal)((0,n.jsx)("span",{ref:x,role:"tooltip","aria-hidden":"true","data-placement":r,className:"fixed z-40 whitespace-nowrap px-2 py-1 text-xs font-medium rounded bg-foreground text-background shadow-lg pointer-events-none",style:null!=m?m:i,children:t}),document.body)]})}},54014:(e,t,r)=>{r.d(t,{Ab:()=>s,NL:()=>p,O6:()=>f,XH:()=>n,f_:()=>u,hR:()=>c,lu:()=>h,n6:()=>i,oo:()=>d,pQ:()=>a,sw:()=>m,vz:()=>x});let n=["claude","codex","gemini","vibe-local","opencode","copilot","antigravity"],s=10,a=50,o=/^[a-zA-Z0-9_-]+$/;function i(e){return"string"==typeof e&&e.length>0&&e.length<=64&&o.test(e)}let l={claude:"Claude",codex:"Codex",gemini:"Gemini","vibe-local":"Vibe Local",opencode:"OpenCode",copilot:"Copilot",antigravity:"Antigravity"};function c(e){return n.includes(e)}function d(e){var t;return null!=(t=l[e])?t:e}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assistant";return e&&c(e)?d(e):t}function m(e){let t=e.alias;return"string"==typeof t&&t.trim().length>0?t:d(e.cliTool)}function f(e,t,r){let n=e.find(e=>e.id===t);return n?m(n):d(r)}function h(e){return e.map((e,t)=>({id:e,cliTool:e,alias:d(e),order:t}))}let x=128,p=2097152},55142:(e,t,r)=>{r.d(t,{A7:()=>o,XK:()=>l,dw:()=>i,kA:()=>a});var n=r(54014),s=r(63001);function a(e){return e?e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isRunning?"ready":"idle":"idle"}function o(e){if(!e)return"idle";let t=Object.values(e).filter(e=>void 0!==e);return 0===t.length?"idle":t.includes("waiting")?"waiting":t.includes("running")?"running":t.includes("generating")?"generating":t.includes("ready")?"ready":"idle"}function i(e,t){return e?Object.entries(e).map(e=>{var r;let[s,a]=e;return"".concat(null!=(r=null==t?void 0:t[s])?r:(0,n.f_)(s,s),": ").concat(null!=a?a:"idle")}).join(", "):""}function l(e){var t,r,o,i;let l=a(void 0!==e.isSessionRunning?{isRunning:null!=(t=e.isSessionRunning)&&t,isWaitingForResponse:null!=(r=e.isWaitingForResponse)&&r,isProcessing:null!=(o=e.isProcessing)&&o}:void 0),c=!!e.lastAssistantMessageAt&&(!e.lastViewedAt||new Date(e.lastAssistantMessageAt)>new Date(e.lastViewedAt)),{cliStatus:d,cliStatusLabels:u}=function(e){var t,r,o;let i={},l={},c=e.sessionStatusByInstance;if(!c){for(let o of null!=(t=e.selectedAgents)?t:s.fJ)i[o]=a(null==(r=e.sessionStatusByCli)?void 0:r[o]),l[o]=(0,n.oo)(o);return{cliStatus:i,cliStatusLabels:l}}let d=e.agentInstances&&e.agentInstances.length>0?e.agentInstances:(0,n.lu)(null!=(o=e.selectedAgents)?o:s.fJ),u=new Set;for(let e of d)u.add(e.id),i[e.id]=a(c[e.id]),l[e.id]=(0,n.sw)(e);for(let[e,t]of Object.entries(c)){if(u.has(e))continue;let r=a(t);"idle"!==r&&(i[e]=r,l[e]=function(e){let t=n.XH.find(t=>e.startsWith("".concat(t,"-")));if(t){let r=e.slice(t.length+1);return"".concat((0,n.oo)(t)," ").concat(r)}return(0,n.f_)(e,e)}(e))}return{cliStatus:i,cliStatusLabels:l}}(e);return{id:e.id,name:e.name,repositoryName:null!=(i=e.repositoryDisplayName)?i:e.repositoryName,status:l,hasUnread:c,lastActivity:e.updatedAt,description:e.description,cliStatus:d,cliStatusLabels:u,worktreePath:e.path}}},63001:(e,t,r)=>{r.d(t,{fJ:()=>n}),r(54014);let n=["claude","codex","gemini","opencode","copilot","antigravity"]},94442:(e,t,r)=>{r.d(t,{N9:()=>p,dj:()=>g});var n=r(95155),s=r(12115),a=r(18955),o=r(42529),i=r(78874),l=r(52056),c=r(23327),d=r(65229),u=r(59854),m=r(9900),f=r(9286);function h(e){let{type:t,iconColor:r}=e,s="h-5 w-5 ".concat(r);switch(t){case"success":return(0,n.jsx)(o.A,{className:s,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(i.A,{className:s,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(l.A,{className:s,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(c.A,{className:s,"data-testid":"toast-icon-info"})}}function x(e){let{id:t,message:r,type:o,onClose:i,duration:l=3e3}=e,c=(0,a.c)("common"),u=(0,s.useRef)(null),x=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(o),[p,g]=(0,s.useState)(!0),{shouldRender:b,isExiting:v}=(0,f.O)(p,m.Ys),y=(0,s.useRef)(i);y.current=i,(0,s.useEffect)(()=>{b||y.current(t)},[b,t]),(0,s.useEffect)(()=>(l>0&&(u.current=setTimeout(()=>{g(!1)},l)),()=>{u.current&&clearTimeout(u.current)}),[l]);let j=(0,s.useCallback)(()=>{u.current&&clearTimeout(u.current),g(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(x.bgColor,"\n ").concat(x.borderColor,"\n ").concat(x.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(v?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(h,{type:o,iconColor:x.iconColor}),(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:r}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:j,"aria-label":c("closeNotification"),className:"\n ".concat(x.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})]})}function p(e){let{toasts:t,onClose:r}=e;return(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:u.M.TOAST},children:t.map(e=>(0,n.jsx)(x,{id:e.id,message:e.message,type:e.type,onClose:r,duration:e.duration},e.id))})}function g(){let[e,t]=(0,s.useState)([]),r=(0,s.useRef)(0),n=(0,s.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,a="toast-".concat(++r.current,"-").concat(Date.now()),o={id:a,message:e,type:n,duration:s};return t(e=>[...e,o]),a},[]);return{toasts:e,showToast:n,removeToast:(0,s.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clearToasts:(0,s.useCallback)(()=>{t([])},[])}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8676],{50666:(e,t,r)=>{r.d(t,{Ck:()=>o});var n=r(95155),l=r(12115),a=r(53482);function o(e){let{children:t,as:r="div",className:o=""}=e,i=function e(t){return null==t||"boolean"==typeof t?"":"string"==typeof t?t:"number"==typeof t?String(t):Array.isArray(t)?t.map(e).join(""):l.isValidElement(t)?e(t.props.children):""}(t);if(!i||0===i.trim().length)return(0,n.jsx)(r,{className:o||void 0,children:t});let s="relative group ".concat("span"===r?"block ":"").concat(o).trim();return(0,n.jsxs)(r,{className:s,"data-testid":"code-block-with-copy",children:[t,(0,n.jsx)(a.i,{text:i,className:"absolute right-2 top-2 z-10 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 focus:opacity-100"})]})}},55924:(e,t,r)=>{r.d(t,{K:()=>a});var n=r(95155),l=r(12115);function a(e){let{entries:t,title:r,headerOffset:a=64,root:o=null,className:i=""}=e,[s,d]=(0,l.useState)(null);return((0,l.useRef)(null).current=s,(0,l.useEffect)(()=>{if("undefined"==typeof IntersectionObserver||0===t.length)return;let e=new IntersectionObserver(e=>{let t=function(e){let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top);return t.length>0?t[0].target.id:null}(e);t&&d(t)},{root:o,rootMargin:"-".concat(a,"px 0px -70% 0px"),threshold:0}),r=[];for(let n of t){let t=document.getElementById(n.id);t&&(e.observe(t),r.push(t))}return()=>{e.disconnect(),r.length=0}},[t,a,o]),0===t.length)?null:(0,n.jsxs)("nav",{"aria-label":r,className:i,children:[(0,n.jsx)("p",{className:"px-3 pb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r}),(0,n.jsx)("ul",{className:"space-y-0.5 text-sm",children:t.map((e,t)=>{let r=e.id===s;return(0,n.jsx)("li",{children:(0,n.jsx)("a",{href:"#".concat(e.id),onClick:t=>((e,t)=>{e.preventDefault();let r="undefined"!=typeof document?document.getElementById(t):null;r&&r.scrollIntoView({behavior:"smooth",block:"start"}),d(t)})(t,e.id),"aria-current":r?"location":void 0,"data-depth":e.depth,style:{paddingLeft:"".concat((e.depth-1)*12+12,"px")},className:["block truncate rounded py-1 pr-2 transition-colors",r?"bg-accent-50 font-medium text-accent-700":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" "),title:e.text,children:e.text})},"".concat(e.id,"-").concat(t))})})]})}},69352:(e,t,r)=>{r.d(t,{WU:()=>d,d3:()=>c,dj:()=>s,uO:()=>u});var n,l,a,o,i=r(9567);function s(e){return e.startsWith("#")?"anchor":e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")?"external":"relative"}function d(e,t){if(!t)return null;let r=e.substring(0,e.lastIndexOf("/")+1);try{let e=new URL(r,"file:///"),n=new URL(t,e),l=decodeURIComponent(n.pathname);if(l.startsWith("/")){let e=l.substring(1);if(e.length>0)return e}}catch(e){}return null}function c(e){return!e||0===e.length||e.length>2048||/[\x00-\x1f\x7f]/.test(e)?null:e}let u={...i.j,attributes:{...i.j.attributes,a:[...(null!=(a=null==(n=i.j.attributes)?void 0:n.a)?a:[]).filter(e=>"href"!==e),["href",/^(?:#|mailto:|tel:|https?:\/\/|(?![a-zA-Z][a-zA-Z0-9+.-]*:))/]],img:[...(null!=(o=null==(l=i.j.attributes)?void 0:l.img)?o:[]).filter(e=>"src"!==e),["src",/^(?:https?:\/\/|(?![a-zA-Z][a-zA-Z0-9+.-]*:))/],"alt","width","height"]}}},79962:(e,t,r)=>{r.d(t,{K:()=>i,Y:()=>l});var n=r(21286);let l="commandmate:md-toc-visible",a=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?[ \t]*$/,o=/^( {0,3})(`{3,}|~{3,})(.*)$/;function i(e){if(!e)return[];let t=new n.A,r=[],l=null,i=0;for(let n of e.split("\n")){var s;let e=o.exec(n);if(l){if(e){let t=e[2];t[0]===l&&t.length>=i&&""===e[3].trim()&&(l=null,i=0)}continue}if(e){let t=e[2],r=t[0];if("`"===r&&e[3].includes("`"));else{l=r,i=t.length;continue}}let d=a.exec(n);if(!d)continue;let c=d[1].length,u=function(e){let t=e;return(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/!\[[^\]]*\]\([^)]*\)/g,"")).replace(/!\[[^\]]*\]\[[^\]]*\]/g,"")).replace(/\[([^\]]*)\]\([^)]*\)/g,"$1")).replace(/\[([^\]]*)\]\[[^\]]*\]/g,"$1")).replace(/\[([^\]]*)\]/g,"$1")).replace(/(`+)([\s\S]*?)\1/g,"$2")).replace(/(\*\*|__)(.*?)\1/g,"$2")).replace(/(\*|_)(.*?)\1/g,"$2")).replace(/~~(.*?)~~/g,"$1")).replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")).trim()}((null!=(s=d[2])?s:"").replace(/([ \t]|^)#+[ \t]*$/,"")),m=t.slug(u);r.push({depth:c,text:u,id:m})}return r}},98676:(e,t,r)=>{r.r(t),r.d(t,{MarkdownEditor:()=>ea});var n=r(95155),l=r(12115),a=r(47650),o=r(18955),i=r(80003),s=r(52056),d=r(64269),c=r(60322),u=r(94442),m=r(36402),f=r(3005),h=r(72115),x=r(89715),p=r(64545),w=r(57828),g=r(5917),v=r(75426),b=r(97624),k=r(37354),j=r(46046),y=r(65229),N=r(744);let E=(0,l.memo)(function(e){let{filePath:t,isDirty:r,viewMode:l,onViewModeChange:a,showMobileTabs:i,copied:s,onCopy:d,isMaximized:c,onToggleFullscreen:u,isAutoSaveEnabled:m,onAutoSaveToggle:f,isAutoSaving:h,isSaving:E,onSave:C,onClose:S,hideViewModeToggle:F}=e,A=(0,o.c)("worktree");return(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,n.jsx)(x.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:t}),r&&(0,n.jsx)("span",{"data-testid":"dirty-indicator",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-warning-subtle text-warning-foreground flex-shrink-0",children:A("editor.unsaved")})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!i&&!F&&(0,n.jsxs)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1",children:[(0,n.jsx)("button",{"data-testid":"view-mode-split","aria-pressed":"split"===l,onClick:()=>a("split"),className:"p-1.5 rounded ".concat("split"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:A("editor.splitView"),children:(0,n.jsx)(p.A,{className:"h-4 w-4"})}),(0,n.jsx)("button",{"data-testid":"view-mode-editor","aria-pressed":"editor"===l,onClick:()=>a("editor"),className:"p-1.5 rounded ".concat("editor"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:A("editor.editorOnly"),children:(0,n.jsx)(x.A,{className:"h-4 w-4"})}),(0,n.jsx)("button",{"data-testid":"view-mode-preview","aria-pressed":"preview"===l,onClick:()=>a("preview"),className:"p-1.5 rounded ".concat("preview"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:A("editor.previewOnly"),children:(0,n.jsx)(w.A,{className:"h-4 w-4"})})]}),(0,n.jsx)(N.$n,{variant:"ghost","data-testid":"copy-content-button",onClick:d,className:"p-1.5 hover:bg-muted rounded ".concat(s?"text-success":"text-muted-foreground hover:text-foreground"),title:A("actions.copyContent"),children:s?(0,n.jsx)(g.A,{className:"h-4 w-4"}):(0,n.jsx)(v.A,{className:"h-4 w-4"})}),(0,n.jsx)(N.$n,{variant:"ghost","data-testid":"maximize-button",onClick:u,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:A(c?"editor.exitFullscreen":"editor.enterFullscreen"),"aria-pressed":c,children:c?(0,n.jsx)(b.A,{className:"h-4 w-4"}):(0,n.jsx)(k.A,{className:"h-4 w-4"})}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:A("editor.auto")}),(0,n.jsx)("button",{"data-testid":"auto-save-toggle",role:"switch","aria-checked":m,onClick:()=>f(!m),className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors ".concat(m?"bg-accent-600":"bg-input"),children:(0,n.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ".concat(m?"translate-x-4":"translate-x-0.5")})})]}),m?(0,n.jsx)("span",{"data-testid":"auto-save-indicator",className:"text-sm text-muted-foreground",children:h?A("actions.saving"):r?"":A("actions.saved")}):(0,n.jsxs)(N.$n,{variant:"ghost","data-testid":"save-button",onClick:C,disabled:!r||E,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ".concat(r&&!E?"bg-accent-600 text-white hover:bg-accent-700":"bg-muted text-muted-foreground cursor-not-allowed"),children:[(0,n.jsx)(j.A,{className:"h-4 w-4"}),A(E?"actions.saving":"actions.save")]}),S&&(0,n.jsx)(N.$n,{variant:"ghost","data-testid":"close-button",onClick:S,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:A("actions.close"),children:(0,n.jsx)(y.A,{className:"h-4 w-4"})})]})]})});var C=r(28857),S=r(22133),F=r(89451),A=r(10934),P=r(92254),R=r(5225);r(1226);let M=(0,r(67909).default)(()=>Promise.all([r.e(221),r.e(7485),r.e(953)]).then(r.bind(r,90953)).then(e=>({default:e.MermaidDiagram})),{loadableGenerated:{webpack:()=>[90953]},ssr:!1,loading:function(){let e=(0,o.c)("worktree");return(0,n.jsxs)("div",{className:"mermaid-loading flex items-center gap-2 text-muted-foreground p-4",children:[(0,n.jsx)(f.y,{size:"sm"}),(0,n.jsx)("span",{children:e("mermaid.loading")})]})}});function z(e){let{className:t,children:r}=e;if(t&&t.split(" ").includes("language-mermaid")){let e=null==r?"":"string"==typeof r?r:Array.isArray(r)?r.map(e=>"string"==typeof e?e:"").join(""):String(r);return(0,n.jsx)(M,{code:e})}return(0,n.jsx)("code",{className:t,children:r})}var W=r(50666),I=r(69352),V=r(76246);function T(e){let{apiUrl:t,alt:r,width:a,height:i}=e,s=(0,o.c)("worktree"),[d,c]=(0,l.useState)(null);return((0,l.useEffect)(()=>{let e=!1;return fetch(t).then(e=>e.ok?e.json():null).then(t=>{!e&&(null==t?void 0:t.content)&&c(t.content)}).catch(()=>{}),()=>{e=!0}},[t]),d)?(0,n.jsx)("img",{src:d,alt:r,width:a,height:i,style:{maxWidth:a||"100%"}}):(0,n.jsx)("span",{style:{color:"#999"},children:s("markdownPreview.loadingImage")})}let D=(0,l.memo)(function(e){let{content:t,onOpenFile:r,currentFilePath:a,worktreeId:o}=e,i=(0,l.useRef)(r);i.current=r;let s=(0,l.useRef)(a);s.current=a;let d=(0,l.useRef)(o);d.current=o;let c=(0,l.useCallback)((e,t)=>{let r=(0,I.d3)(t);if(r)switch((0,I.dj)(r)){case"anchor":break;case"external":e.preventDefault(),window.open(r,"_blank","noopener,noreferrer");break;case"relative":{e.preventDefault();let t=s.current,n=i.current;if(t&&n){let e=(0,I.WU)(t,r);e&&n(e)}}}},[]),u=(0,l.useMemo)(()=>({code:z,pre:e=>{let{children:t}=e;return!function(e){let t=l.Children.toArray(e)[0];if(!l.isValidElement(t))return!1;let r=t.props.className;return"string"==typeof r&&r.split(" ").includes("language-mermaid")}(t)?(0,n.jsx)(W.Ck,{children:(0,n.jsx)("pre",{className:"overflow-x-auto",children:t})}):(0,n.jsx)("pre",{children:t})},img:e=>{var t,r,l,a;let{src:o,alt:i,width:c,height:u,...m}=e,f=null!=c?c:null==(r=m.node)||null==(t=r.properties)?void 0:t.width,h=null!=u?u:null==(a=m.node)||null==(l=a.properties)?void 0:l.height;if("string"==typeof o&&!o.startsWith("http://")&&!o.startsWith("https://")&&!o.startsWith("data:")){let e=s.current,t=d.current;if(e&&t){let r=(0,I.WU)(e,o);if(r){let e="/api/worktrees/".concat(t,"/files/").concat((0,V.o)(r));return(0,n.jsx)(T,{apiUrl:e,alt:null!=i?i:"",width:f,height:h})}}}return(0,n.jsx)("img",{src:o,alt:null!=i?i:"",width:f,height:h,style:{maxWidth:f||"100%"}})},a:e=>{let{href:t,children:r,...l}=e;return t?(0,n.jsx)("a",{...l,href:t,onClick:e=>c(e,t),children:r}):(0,n.jsx)("a",{...l,children:r})}}),[c]),m=(0,l.useMemo)(()=>[S.A],[]),f=(0,l.useMemo)(()=>[F.A,[A.A,I.uO],P.A,R.A],[]);return(0,n.jsx)(C.oz,{remarkPlugins:m,rehypePlugins:f,components:u,children:t})}),L=(0,l.memo)(function(e){let{mobileTab:t,onTabChange:r}=e,l=(0,o.c)("worktree");return(0,n.jsxs)("div",{className:"flex border-b border-border",children:[(0,n.jsxs)("button",{"data-testid":"mobile-tab-editor",onClick:()=>r("editor"),className:"flex-1 py-2 text-sm font-medium ".concat("editor"===t?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400":"text-muted-foreground"),children:[(0,n.jsx)(x.A,{className:"h-4 w-4 inline-block mr-1"}),l("markdownPreview.editor")]}),(0,n.jsxs)("button",{"data-testid":"mobile-tab-preview",onClick:()=>r("preview"),className:"flex-1 py-2 text-sm font-medium ".concat("preview"===t?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400":"text-muted-foreground"),children:[(0,n.jsx)(w.A,{className:"h-4 w-4 inline-block mr-1"}),l("markdownPreview.preview")]})]})}),O=(0,l.memo)(function(e){let{isMobile:t}=e,r=(0,o.c)("worktree");return(0,n.jsxs)("div",{"data-testid":"maximize-hint",className:"flex items-center justify-center px-4 py-1 bg-muted text-muted-foreground text-xs",children:[r("markdownPreview.exitFullscreenHint")," ",t&&r("markdownPreview.exitFullscreenHintSwipe")]})}),$=(0,l.memo)(function(e){let{onDismiss:t}=e,r=(0,o.c)("worktree");return(0,n.jsxs)("div",{"data-testid":"large-file-warning",className:"flex items-center gap-2 px-4 py-2 bg-warning-subtle border-b border-warning-border text-warning-foreground text-sm",children:[(0,n.jsx)(s.A,{className:"h-4 w-4"}),r("markdownPreview.largeFileWarning"),(0,n.jsx)("button",{onClick:t,className:"ml-auto text-warning hover:text-warning",children:(0,n.jsx)(y.A,{className:"h-4 w-4"})})]})});var _=r(55924),K=r(79962),U=r(38218);function H(){if("undefined"==typeof document)return null;let e=document;return e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement||e.msFullscreenElement||null}var q=r(2317),B=r(60850),Z=r(8269),G=r(51434),X=r(59854),Y=r(9900);let J={split:{showEditor:!0,showPreview:!0,editorWidth:"w-1/2",previewWidth:"w-1/2"},editor:{showEditor:!0,showPreview:!1,editorWidth:"w-full",previewWidth:"w-0"},preview:{showEditor:!1,showPreview:!0,editorWidth:"w-0",previewWidth:"w-full"}},Q="commandmate:md-editor-view-mode",ee={WARNING_THRESHOLD:512e3};function et(e){return"number"==typeof e&&e>=.1&&e<=.9}function er(e){return"boolean"==typeof e}function en(e){return"split"===e||"editor"===e||"preview"===e}let el=(0,l.memo)(function(e){let{previewContent:t,onOpenFile:r,filePath:a,worktreeId:o,tocVisible:s,onToggleTocVisible:d,tocTitle:c,tocShowLabel:u,tocHideLabel:m}=e,f=(0,l.useRef)(null),h=(0,l.useRef)(null),[x,p]=(0,l.useState)(null),[w,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{p(h.current)},[]),(0,l.useEffect)(()=>{let e=f.current;if(!e||"undefined"==typeof ResizeObserver)return;let t=new ResizeObserver(e=>{var t,r;g((null!=(r=null==(t=e[0])?void 0:t.contentRect.width)?r:0)>=480)});return t.observe(e),()=>t.disconnect()},[]);let v=(0,l.useMemo)(()=>(0,K.K)(t),[t]),b=v.length>=2&&w,k=b&&s;return(0,n.jsxs)("div",{ref:f,className:"relative flex flex-1 overflow-hidden",children:[(0,n.jsx)("div",{ref:h,"data-testid":"markdown-preview",className:"flex-1 min-w-0 p-4 overflow-y-auto prose prose-sm dark:prose-invert max-w-none prose-headings:scroll-mt-2",children:(0,n.jsx)(D,{content:t,onOpenFile:r,currentFilePath:a,worktreeId:o})}),k&&(0,n.jsx)("aside",{"data-testid":"markdown-preview-toc",className:"w-48 flex-shrink-0 overflow-y-auto border-l border-border py-4",children:(0,n.jsx)("div",{className:"sticky top-0",children:(0,n.jsx)(_.K,{entries:v,title:c,headerOffset:0,root:x})})}),b&&(0,n.jsx)("button",{"data-testid":"markdown-preview-toc-toggle",onClick:d,"aria-pressed":s,"aria-label":s?m:u,title:s?m:u,className:"absolute top-2 right-2 z-10 flex items-center justify-center rounded-md border border-border bg-surface/90 p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted shadow-sm",children:(0,n.jsx)(i.A,{className:"h-4 w-4"})})]})}),ea=(0,l.memo)(function(e){let{worktreeId:t,filePath:r,fileType:i,onClose:x,onSave:p,initialViewMode:w,onMaximizedChange:g,onDirtyChange:v,onOpenFile:b}=e,k="text"===(null!=i?i:r.toLowerCase().endsWith(".md")?"markdown":"text"),j=(0,o.c)("worktree"),y=(0,m.SC)(),[N,C]=(0,l.useState)(""),[S,F]=(0,l.useState)(""),[A,P]=(0,l.useState)(""),[R,M]=(0,l.useState)(()=>k?"editor":function(e){if(e&&en(e))return e;{let e=localStorage.getItem(Q);if(e&&en(e))return e}return"split"}(w)),[z,W]=(0,l.useState)(!0),[I,V]=(0,l.useState)(!1),[T,D]=(0,l.useState)(null),[_,ea]=(0,l.useState)(!1),[eo,ei]=(0,l.useState)(!1),[es,ed]=(0,l.useState)("editor"),[ec,eu]=(0,l.useState)(null),{toasts:em,showToast:ef,removeToast:eh}=(0,u.dj)(),ex=(0,l.useRef)(null),ep=(0,l.useRef)(null),ew=(0,l.useRef)(null),eg=(0,l.useRef)(null),ev=(0,l.useRef)(null),eb=(0,U.a)();(0,l.useEffect)(()=>{eb&&ed("preview")},[eb]);let{isKeyboardVisible:ek,keyboardHeight:ej}=(0,G.C)(),{value:ey,setValue:eN}=(0,q.V)({key:"commandmate:md-editor-maximized",defaultValue:!1,validate:er}),{isFullscreen:eE,isFallbackMode:eC,enterFullscreen:eS,exitFullscreen:eF,toggleFullscreen:eA}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elementRef:t,onEnter:r,onExit:n,onError:a}=e,[o,i]=(0,l.useState)(!1),[s,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),m=(0,l.useCallback)(()=>{let e=null!=H();i(e),!e&&s&&d(!1)},[s]),f=(0,l.useCallback)(async()=>{if(u(null),"undefined"!=typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||0)){i(!0),d(!0),null==r||r();return}if(function(){if("undefined"==typeof document)return!1;let e=document;return!!(e.fullscreenEnabled||e.webkitFullscreenEnabled||e.mozFullScreenEnabled||e.msFullscreenEnabled)}()&&(null==t?void 0:t.current))try{var e;await ((e=t.current).requestFullscreen?Promise.resolve(e.requestFullscreen()):e.webkitRequestFullscreen?Promise.resolve(e.webkitRequestFullscreen()):e.mozRequestFullScreen?Promise.resolve(e.mozRequestFullScreen()):e.msRequestFullscreen?Promise.resolve(e.msRequestFullscreen()):Promise.reject(Error("Fullscreen API not supported"))),i(!0),d(!1),null==r||r()}catch(t){let e=t instanceof Error?t.message:"Failed to enter fullscreen";u(e),null==a||a(t instanceof Error?t:Error(e)),i(!0),d(!0),null==r||r()}else i(!0),d(!0),null==r||r()},[t,r,a]),h=(0,l.useCallback)(async()=>{if(u(null),s){i(!1),d(!1),null==n||n();return}if(H())try{await function(){if("undefined"==typeof document)return Promise.resolve();let e=document;return e.exitFullscreen?Promise.resolve(e.exitFullscreen()):e.webkitExitFullscreen?Promise.resolve(e.webkitExitFullscreen()):e.mozCancelFullScreen?Promise.resolve(e.mozCancelFullScreen()):e.msExitFullscreen?Promise.resolve(e.msExitFullscreen()):Promise.resolve()}(),i(!1),null==n||n()}catch(t){let e=t instanceof Error?t.message:"Failed to exit fullscreen";u(e),null==a||a(t instanceof Error?t:Error(e)),i(!1),d(!1),null==n||n()}else i(!1),d(!1),null==n||n()},[s,n,a]),x=(0,l.useCallback)(async()=>{o?await h():await f()},[o,f,h]);return(0,l.useEffect)(()=>(function(e){if("undefined"==typeof document)return()=>{};let t=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];for(let r of t)document.addEventListener(r,e);return()=>{for(let r of t)document.removeEventListener(r,e)}})(m),[m]),{isFullscreen:o,isFallbackMode:s,enterFullscreen:f,exitFullscreen:h,toggleFullscreen:x,error:c}}({elementRef:eg,onEnter:()=>eN(!0),onExit:()=>eN(!1)}),{value:eP,setValue:eR}=(0,q.V)({key:"commandmate:md-editor-split-ratio",defaultValue:.5,validate:et}),{value:eM,setValue:ez}=(0,q.V)({key:"commandmate:md-editor-auto-save",defaultValue:!1,validate:er}),{value:eW,setValue:eI}=(0,q.V)({key:K.Y,defaultValue:!0,validate:er}),eV=(0,l.useCallback)(()=>{eI(e=>!e)},[eI]),{ref:eT}=(0,Z.hU)({onSwipeDown:()=>{eE&&eF()},threshold:150,enabled:eE&&eb}),eD=N!==S,eL=k?J.editor:J[R];(0,l.useEffect)(()=>{null==v||v(eD)},[eD,v]);let eO=eb&&window.innerHeight>window.innerWidth,e$=!k&&eO&&"split"===R,e_=(0,l.useMemo)(()=>(0,d.sg)(e=>{P(e)},300),[]),eK=(0,l.useCallback)(async()=>{W(!0),D(null);try{let n=await fetch("/api/worktrees/".concat(t,"/files/").concat(r)),l=await n.json();if(!n.ok||!l.success){var e;throw Error((null==(e=l.error)?void 0:e.message)||j("editor.loadError"))}let a=l.content||"";C(a),F(a),P(a),new Blob([a]).size>ee.WARNING_THRESHOLD&&ea(!0)}catch(e){D(e instanceof Error?e.message:j("editor.loadError"))}finally{W(!1)}},[t,r]),eU=(0,l.useCallback)(async e=>{let n=await fetch("/api/worktrees/".concat(t,"/files/").concat(r),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})});if(401===n.status||n.redirected)throw Error(j("editor.sessionExpired"));let l=await n.json();if(!n.ok||!l.success){var a;throw Error((null==(a=l.error)?void 0:a.message)||j("editor.saveError"))}F(e)},[t,r,j]),{isSaving:eH,error:eq,saveNow:eB}=(0,B.U)({value:N,saveFn:eU,debounceMs:3e3,disabled:!eM}),eZ=(0,l.useCallback)(e=>{ez(e),e&&eD&&eU(N)},[ez,eD,eU,N]),eG=(0,l.useCallback)(async()=>{if(eD&&!I){V(!0);try{await eU(N),ef(j("editor.saveSuccess"),"success"),p&&p(r)}catch(e){ef(e instanceof Error?e.message:j("editor.saveError"),"error")}finally{V(!1)}}},[eU,N,eD,I,p,r,ef,j]),eX=N.split("\n").length,eY=(0,l.useCallback)(()=>{ex.current&&ep.current&&(ep.current.scrollTop=ex.current.scrollTop)},[]),eJ=(0,l.useCallback)(e=>{let t=e.target.value;C(t),e_(t)},[e_]),eQ=(0,l.useCallback)(e=>{M(e),localStorage.setItem(Q,e)},[]),e0=(0,l.useCallback)(async()=>{if(eM){if((eD||eH)&&(await eB(),eq)&&!await y({description:j("editor.saveFailedCloseConfirm"),variant:"danger"}))return}else if(eD&&!await y({description:j("editor.unsavedCloseConfirm"),variant:"danger"}))return;null==x||x()},[eM,eD,eH,eB,eq,x,y,j]),e1=(0,l.useCallback)(async()=>{try{await (0,c.l)(N),ei(!0),setTimeout(()=>ei(!1),Y.pX)}catch(e){}},[N]),e4=(0,l.useCallback)(e=>{if(!ev.current)return;let t=ev.current.offsetWidth;if(0===t)return;let r=e/t;eR(e=>Math.max(.1,Math.min(.9,e+r)))},[eR]),e2=(0,l.useCallback)(()=>{eR(.5)},[eR]),e5=(0,l.useCallback)(e=>{if((e.ctrlKey||e.metaKey)&&"s"===e.key){e.preventDefault(),eM?(async()=>{await eB(),null==p||p(r)})():eG();return}if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F"===e.key){e.preventDefault(),eA();return}if("Escape"===e.key&&eE){e.preventDefault(),eF();return}},[eG,eM,eB,p,r,eA,eF,eE]),e6=(0,l.useCallback)(e=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:ep,className:"flex-shrink-0 py-4 pl-2 pr-2 text-right select-none text-muted-foreground font-mono text-sm bg-muted dark:bg-muted/50 border-r border-border overflow-hidden","aria-hidden":"true",children:Array.from({length:eX},(e,t)=>(0,n.jsx)("div",{className:"leading-[1.5rem]",children:t+1},t+1))}),(0,n.jsx)("textarea",{ref:ex,"data-testid":"markdown-editor-textarea",value:N,onChange:eJ,onKeyDown:e5,onScroll:eY,className:"flex-1 py-4 pr-4 pl-3 font-mono text-sm resize-none bg-surface text-foreground focus:outline-none leading-[1.5rem]".concat(e?" focus:ring-2 focus:ring-ring focus:ring-inset":""),placeholder:k?j("editor.placeholder"):j("editor.placeholderMarkdown"),spellCheck:!1})]}),[eX,N,eJ,e5,eY,k,j]);(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&eE&&(e.preventDefault(),eF())};return eE&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[eE,eF]),(0,l.useEffect)(()=>{ey&&!eE&&eS()},[]),(0,l.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.getElementById("markdown-editor-portal");return e||((e=document.createElement("div")).id="markdown-editor-portal",document.body.appendChild(e)),eu(e),()=>{let e=document.getElementById("markdown-editor-portal");e&&0===e.childNodes.length&&e.remove()}},[]),(0,l.useEffect)(()=>{null==g||g(eE)},[eE,g]),(0,l.useEffect)(()=>{eK()},[eK]),(0,l.useEffect)(()=>{let e=eM?eD||eH:eD,t=t=>{e&&(t.preventDefault(),t.returnValue="")};return e?(ew.current=t,window.addEventListener("beforeunload",t)):ew.current&&(window.removeEventListener("beforeunload",ew.current),ew.current=null),()=>{ew.current&&window.removeEventListener("beforeunload",ew.current)}},[eD,eH,eM]),(0,l.useEffect)(()=>{eq&&eM&&(ez(!1),ef(j("editor.autoSaveFailed"),"error"))},[eq,eM,ez,ef,j]);let e9=(0,l.useMemo)(()=>{let e="flex flex-col bg-surface";return eE&&eC?"".concat(e," fixed inset-0"):"".concat(e," h-full")},[eE,eC]),e3=(0,l.useMemo)(()=>{if(eE)return{zIndex:X.M.MAXIMIZED_EDITOR}},[eE]),e7=(0,l.useMemo)(()=>{if("split"===R&&!e$)return{width:"".concat(100*eP,"%"),flexShrink:0}},[R,eP,e$]),e8=(0,l.useMemo)(()=>{if("split"===R&&!e$)return{width:"".concat((1-eP)*100,"%"),flexShrink:0}},[R,eP,e$]),te=(0,l.useMemo)(()=>{if(ek&&ej>0)return{paddingBottom:ej}},[ek,ej]);if(z)return(0,n.jsx)("div",{"data-testid":"markdown-editor",className:"flex items-center justify-center h-full bg-surface",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)(f.y,{size:"xl",variant:"accent",className:"inline-block"}),(0,n.jsx)("p",{className:"mt-4 text-muted-foreground",children:j("editor.loading")})]})});if(T)return(0,n.jsx)("div",{"data-testid":"markdown-editor-error",className:"flex items-center justify-center h-full bg-surface",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)(s.A,{className:"h-12 w-12 text-danger mx-auto mb-4"}),(0,n.jsx)("p",{className:"text-danger-foreground",children:T}),x&&(0,n.jsx)("button",{onClick:x,className:"mt-4 px-4 py-2 bg-muted hover:bg-muted/80 rounded-lg text-foreground",children:j("actions.close")})]})});let tt=(0,n.jsxs)("div",{ref:e=>{eg.current=e,eT.current=e},"data-testid":"markdown-editor",className:e9,style:e3,onKeyDown:e5,role:eE&&eC?"dialog":void 0,"aria-modal":eE&&eC?"true":void 0,children:[(0,n.jsx)(E,{filePath:r,isDirty:eD,viewMode:R,onViewModeChange:eQ,showMobileTabs:e$,copied:eo,onCopy:e1,isMaximized:eE,onToggleFullscreen:eA,isAutoSaveEnabled:eM,onAutoSaveToggle:eZ,isAutoSaving:eH,isSaving:I,onSave:eG,onClose:x?e0:void 0,hideViewModeToggle:k}),eE&&(0,n.jsx)(O,{isMobile:eb}),_&&(0,n.jsx)($,{onDismiss:()=>ea(!1)}),e$&&(0,n.jsx)(L,{mobileTab:es,onTabChange:ed}),(0,n.jsxs)("div",{ref:ev,className:"flex flex-1 overflow-hidden",style:te,children:[e$?"editor"===es&&(0,n.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex overflow-hidden w-full flex-1",children:e6(!1)}):(0,n.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex overflow-hidden transition-all duration-200 ".concat(eL.showEditor?"":"hidden"),style:"split"===R?e7:{width:eL.showEditor?"100%":"0%"},children:e6(!0)}),"split"===R&&eL.showEditor&&eL.showPreview&&!e$&&(0,n.jsx)(h.f,{onResize:e4,onDoubleClick:e2,orientation:"horizontal",ariaValueNow:Math.round(100*eP),minRatio:.1}),e$?"preview"===es&&(0,n.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden w-full",children:(0,n.jsx)(el,{previewContent:A,onOpenFile:b,filePath:r,worktreeId:t,tocVisible:eW,onToggleTocVisible:eV,tocTitle:j("toc.title"),tocShowLabel:j("toc.show"),tocHideLabel:j("toc.hide")})}):(0,n.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden transition-all duration-200 ".concat(eL.showPreview?"":"hidden"),style:"split"===R?e8:{width:eL.showPreview?"100%":"0%"},children:(0,n.jsx)(el,{previewContent:A,onOpenFile:b,filePath:r,worktreeId:t,tocVisible:eW,onToggleTocVisible:eV,tocTitle:j("toc.title"),tocShowLabel:j("toc.show"),tocHideLabel:j("toc.hide")})})]}),(0,n.jsx)(u.N9,{toasts:em,onClose:eh})]});return eE&&eC&&ec?(0,a.createPortal)(tt,ec):tt})}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{3809:(e,t,r)=>{"use strict";r.d(t,{default:()=>s});var n=r(36809),a=r(95155);function s(e){let{locale:t,...r}=e;if(!t)throw Error(void 0);return(0,a.jsx)(n.Dk,{locale:t,...r})}},5379:(e,t,r)=>{"use strict";r.d(t,{D:()=>c,N:()=>u});var n=r(12115),a=(e,t,r,n,a,s,l,o)=>{let i=document.documentElement,c=["light","dark"];function u(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,n=r&&s?a.map(e=>s[e]||e):a;r?(i.classList.remove(...n),i.classList.add(s&&s[t]?s[t]:t)):i.setAttribute(e,t)}),r=t,o&&c.includes(r)&&(i.style.colorScheme=r)}if(n)u(n);else try{let e=localStorage.getItem(t)||r,n=l&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;u(n)}catch(e){}},s=["light","dark"],l="(prefers-color-scheme: dark)",o=n.createContext(void 0),i={setTheme:e=>{},themes:[]},c=()=>{var e;return null!=(e=n.useContext(o))?e:i},u=e=>n.useContext(o)?n.createElement(n.Fragment,null,e.children):n.createElement(m,{...e}),d=["light","dark"],m=e=>{let{forcedTheme:t,disableTransitionOnChange:r=!1,enableSystem:a=!0,enableColorScheme:i=!0,storageKey:c="theme",themes:u=d,defaultTheme:m=a?"system":"light",attribute:g="data-theme",value:b,children:y,nonce:w,scriptProps:k}=e,[x,E]=n.useState(()=>v(c,m)),[j,S]=n.useState(()=>"system"===x?p():x),N=b?Object.values(b):u,C=n.useCallback(e=>{let t=e;if(!t)return;"system"===e&&a&&(t=p());let n=b?b[t]:t,l=r?f(w):null,o=document.documentElement,c=e=>{"class"===e?(o.classList.remove(...N),n&&o.classList.add(n)):e.startsWith("data-")&&(n?o.setAttribute(e,n):o.removeAttribute(e))};if(Array.isArray(g)?g.forEach(c):c(g),i){let e=s.includes(m)?m:null,r=s.includes(t)?t:e;o.style.colorScheme=r}null==l||l()},[w]),A=n.useCallback(e=>{let t="function"==typeof e?e(x):e;E(t);try{localStorage.setItem(c,t)}catch(e){}},[x]),_=n.useCallback(e=>{S(p(e)),"system"===x&&a&&!t&&C("system")},[x,t]);n.useEffect(()=>{let e=window.matchMedia(l);return e.addListener(_),_(e),()=>e.removeListener(_)},[_]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?E(e.newValue):A(m))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[A]),n.useEffect(()=>{C(null!=t?t:x)},[t,x]);let L=n.useMemo(()=>({theme:x,setTheme:A,forcedTheme:t,resolvedTheme:"system"===x?j:x,themes:a?[...u,"system"]:u,systemTheme:a?j:void 0}),[x,A,t,j,a,u]);return n.createElement(o.Provider,{value:L},n.createElement(h,{forcedTheme:t,storageKey:c,attribute:g,enableSystem:a,enableColorScheme:i,defaultTheme:m,value:b,themes:u,nonce:w,scriptProps:k}),y)},h=n.memo(e=>{let{forcedTheme:t,storageKey:r,attribute:s,enableSystem:l,enableColorScheme:o,defaultTheme:i,value:c,themes:u,nonce:d,scriptProps:m}=e,h=JSON.stringify([s,r,i,t,u,c,l,o]).slice(1,-1);return n.createElement("script",{...m,suppressHydrationWarning:!0,nonce:"",dangerouslySetInnerHTML:{__html:"(".concat(a.toString(),")(").concat(h,")")}})}),v=(e,t)=>{let r;try{r=localStorage.getItem(e)||void 0}catch(e){}return r||t},f=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},p=e=>(e||(e=window.matchMedia(l)),e.matches?"dark":"light")},7183:e=>{e.exports={style:{fontFamily:"'GeistMono', ui-monospace, SFMono-Regular, Roboto Mono, Menlo, Monaco, Liberation Mono, DejaVu Sans Mono, Courier New, monospace"},className:"__className_46451f",variable:"__variable_46451f"}},13673:()=>{},18955:(e,t,r)=>{"use strict";r.d(t,{c:()=>s});var n=r(36809);function a(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let s=a(0,n.c3);a(0,n.kc)},20063:(e,t,r)=>{"use strict";var n=r(47260);r.o(n,"useParams")&&r.d(t,{useParams:function(){return n.useParams}}),r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}})},22311:e=>{e.exports={style:{fontFamily:"'GeistSans', 'GeistSans Fallback'"},className:"__className_8adcd2",variable:"__variable_8adcd2"}},22464:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,22311,23)),Promise.resolve().then(r.t.bind(r,7183,23)),Promise.resolve().then(r.t.bind(r,13673,23)),Promise.resolve().then(r.bind(r,25772))},25772:(e,t,r)=>{"use strict";r.d(t,{AppProviders:()=>w});var n=r(95155),a=r(3809),s=r(5379),l=r(32916),o=r(65380),i=r(22592),c=r(92614),u=r(70628),d=r(66966),m=r(89275),h=r(63365),v=r(36402),f=r(12115),p=r(18955),g=r(89559),b=r(59854);function y(){let e=(0,p.c)("pwa"),[t,r]=(0,f.useState)(null),a=(0,f.useRef)(!1);return((0,f.useEffect)(()=>{if("undefined"==typeof navigator||!("serviceWorker"in navigator))return;let e=!1,t=t=>{e||r(t)};navigator.serviceWorker.register("/sw.js").then(e=>{e.waiting&&navigator.serviceWorker.controller&&t(e.waiting),e.addEventListener("updatefound",()=>{let r=e.installing;r&&r.addEventListener("statechange",()=>{"installed"===r.state&&navigator.serviceWorker.controller&&t(r)})})}).catch(()=>{});let n=()=>{a.current||(a.current=!0,window.location.reload())};return navigator.serviceWorker.addEventListener("controllerchange",n),()=>{e=!0,navigator.serviceWorker.removeEventListener("controllerchange",n)}},[]),t)?(0,n.jsx)("div",{role:"status","aria-live":"polite",className:"fixed inset-x-0 bottom-0 flex justify-center px-4 pb-safe",style:{zIndex:b.M.TOAST},children:(0,n.jsxs)("div",{className:"mb-4 flex items-center gap-3 rounded-lg border border-border bg-surface px-4 py-3 shadow-lg",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:e("update.available")}),(0,n.jsxs)("button",{type:"button",onClick:()=>{t.postMessage({type:"SKIP_WAITING"})},className:"inline-flex items-center gap-1.5 rounded-md bg-accent-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background dark:bg-accent-500 dark:hover:bg-accent-600",children:[(0,n.jsx)(g.A,{className:"h-4 w-4"}),e("update.reload")]})]})}):null}function w(e){let{children:t,locale:r,messages:f,timeZone:p,authEnabled:g=!1}=e;return(0,n.jsx)(a.default,{locale:r,messages:f,timeZone:p,children:(0,n.jsx)(s.N,{attribute:"class",defaultTheme:"system",enableSystem:!0,children:(0,n.jsx)(o.O,{authEnabled:g,children:(0,n.jsx)(i.W5,{children:(0,n.jsx)(l.GB,{children:(0,n.jsx)(h.tS,{children:(0,n.jsx)(d.g7,{children:(0,n.jsx)(c.E,{children:(0,n.jsx)(u.S,{children:(0,n.jsxs)(v.aF,{children:[(0,n.jsx)(m.Bo,{children:t}),(0,n.jsx)(y,{})]})})})})})})})})})})}},71847:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(12115);let a=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},s=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:i,className:c="",children:u,iconNode:d,...m}=e;return(0,n.createElement)("svg",{ref:t,...l,width:a,height:a,stroke:r,strokeWidth:i?24*Number(o)/Number(a):o,className:s("lucide",c),...!u&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(m)&&{"aria-hidden":"true"},...m},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),i=(e,t)=>{let r=(0,n.forwardRef)((r,l)=>{let{className:i,...c}=r;return(0,n.createElement)(o,{ref:l,iconNode:t,className:s("lucide-".concat(a(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),i),...c})});return r.displayName=a(e),r}},83101:(e,t,r)=>{"use strict";r.d(t,{F:()=>l});var n=r(2821);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,s=n.$,l=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return s(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:o}=t,i=Object.keys(l).map(e=>{let t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;let s=a(t)||a(n);return l[e][s]}),c=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return s(e,i,null==t||null==(n=t.compoundVariants)?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...c}[t]):({...o,...c})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},89559:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(71847).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])}},e=>{e.O(0,[5373,2978,6809,4909,6402,7347,8441,1255,7358],()=>e(e.s=22464)),_N_E=e.O()}]);