vibeman 0.0.3 → 0.0.5

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 (184) hide show
  1. package/dist/index.js +3 -3
  2. package/dist/runtime/api/.tsbuildinfo +1 -1
  3. package/dist/runtime/api/agent/agent-service.d.ts +4 -0
  4. package/dist/runtime/api/agent/agent-service.js +62 -3
  5. package/dist/runtime/api/agent/ai-providers/amp-cli-provider.d.ts +38 -0
  6. package/dist/runtime/api/agent/ai-providers/amp-cli-provider.js +268 -0
  7. package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +40 -12
  8. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.d.ts +24 -0
  9. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.js +291 -0
  10. package/dist/runtime/api/agent/ai-providers/index.d.ts +3 -3
  11. package/dist/runtime/api/agent/ai-providers/index.js +3 -1
  12. package/dist/runtime/api/agent/ai-providers/types.d.ts +5 -2
  13. package/dist/runtime/api/agent/amp-cli-provider.test.d.ts +1 -0
  14. package/dist/runtime/api/agent/amp-cli-provider.test.js +99 -0
  15. package/dist/runtime/api/agent/codex-cli-provider.test.js +10 -8
  16. package/dist/runtime/api/agent/prompt-service.js +108 -105
  17. package/dist/runtime/api/agent/prompt-service.test.js +35 -0
  18. package/dist/runtime/api/agent/routing-policy.d.ts +2 -2
  19. package/dist/runtime/api/agent/routing-policy.test.js +4 -4
  20. package/dist/runtime/api/api/routers/ai.d.ts +3 -3
  21. package/dist/runtime/api/api/routers/executions.d.ts +2 -7
  22. package/dist/runtime/api/api/routers/executions.js +2 -2
  23. package/dist/runtime/api/api/routers/provider-config.d.ts +34 -0
  24. package/dist/runtime/api/api/routers/settings.d.ts +19 -0
  25. package/dist/runtime/api/api/routers/settings.js +16 -0
  26. package/dist/runtime/api/api/routers/tasks.d.ts +9 -9
  27. package/dist/runtime/api/api/routers/workflows.d.ts +12 -12
  28. package/dist/runtime/api/api/routers/worktrees.d.ts +2 -2
  29. package/dist/runtime/api/api/trpc.d.ts +16 -16
  30. package/dist/runtime/api/lib/local-config.d.ts +94 -4
  31. package/dist/runtime/api/lib/local-config.js +16 -0
  32. package/dist/runtime/api/lib/provider-detection.d.ts +2 -0
  33. package/dist/runtime/api/lib/provider-detection.js +83 -1
  34. package/dist/runtime/api/lib/server/vibeman-info.d.ts +5 -0
  35. package/dist/runtime/api/lib/server/vibeman-info.js +85 -0
  36. package/dist/runtime/api/lib/trpc/server.d.ts +63 -33
  37. package/dist/runtime/api/persistence/execution-log-persistence.d.ts +1 -1
  38. package/dist/runtime/api/persistence/execution-log-persistence.js +19 -3
  39. package/dist/runtime/api/router.d.ts +63 -33
  40. package/dist/runtime/api/settings-service.js +31 -14
  41. package/dist/runtime/api/tasks/task-file-parser.d.ts +1 -0
  42. package/dist/runtime/api/tasks/task-file-parser.js +20 -1
  43. package/dist/runtime/api/tasks/task-updater.d.ts +62 -0
  44. package/dist/runtime/api/tasks/task-updater.js +260 -0
  45. package/dist/runtime/api/tasks/task-updater.test.d.ts +1 -0
  46. package/dist/runtime/api/tasks/task-updater.test.js +303 -0
  47. package/dist/runtime/api/types/index.d.ts +1 -1
  48. package/dist/runtime/api/types/settings.d.ts +17 -6
  49. package/dist/runtime/api/vcs/git-service.d.ts +9 -0
  50. package/dist/runtime/api/vcs/git-service.js +23 -0
  51. package/dist/runtime/api/vcs/worktree-service.d.ts +1 -1
  52. package/dist/runtime/api/vcs/worktree-service.js +22 -10
  53. package/dist/runtime/api/workflows/quality-pipeline.js +2 -1
  54. package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +93 -5
  55. package/dist/runtime/api/workflows/vibing-orchestrator.js +774 -203
  56. package/dist/runtime/api/workflows/workflow-effects.d.ts +45 -0
  57. package/dist/runtime/api/workflows/workflow-effects.js +49 -0
  58. package/dist/runtime/api/workflows/workflow-reconciler.d.ts +65 -0
  59. package/dist/runtime/api/workflows/workflow-reconciler.js +226 -0
  60. package/dist/runtime/api/workflows/workflow-reducer.d.ts +26 -0
  61. package/dist/runtime/api/workflows/workflow-reducer.js +288 -0
  62. package/dist/runtime/api/workflows/workflow-reducer.test.d.ts +1 -0
  63. package/dist/runtime/api/workflows/workflow-reducer.test.js +247 -0
  64. package/dist/runtime/api/workflows/workflow-schema.d.ts +546 -0
  65. package/dist/runtime/api/workflows/workflow-schema.js +256 -0
  66. package/dist/runtime/web/.next/BUILD_ID +1 -1
  67. package/dist/runtime/web/.next/app-build-manifest.json +50 -50
  68. package/dist/runtime/web/.next/app-path-routes-manifest.json +1 -1
  69. package/dist/runtime/web/.next/build-manifest.json +14 -14
  70. package/dist/runtime/web/.next/prerender-manifest.json +3 -3
  71. package/dist/runtime/web/.next/react-loadable-manifest.json +2 -33
  72. package/dist/runtime/web/.next/required-server-files.json +5 -5
  73. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +1 -1
  74. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +1 -1
  75. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +1 -1
  76. package/dist/runtime/web/.next/server/app/_not-found/page.js +2 -2
  77. package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  78. package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  79. package/dist/runtime/web/.next/server/app/_not-found.html +2 -2
  80. package/dist/runtime/web/.next/server/app/_not-found.rsc +12 -12
  81. package/dist/runtime/web/.next/server/app/api/health/route.js +1 -1
  82. package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +1 -1
  83. package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  84. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +1 -1
  85. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +1 -1
  86. package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +1 -1
  87. package/dist/runtime/web/.next/server/app/api/upload/route.js +1 -1
  88. package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +1 -1
  89. package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +1 -1
  90. package/dist/runtime/web/.next/server/app/index.html +2 -2
  91. package/dist/runtime/web/.next/server/app/index.rsc +15 -15
  92. package/dist/runtime/web/.next/server/app/page.js +27 -62
  93. package/dist/runtime/web/.next/server/app/page.js.nft.json +1 -1
  94. package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +1 -1
  95. package/dist/runtime/web/.next/server/app-paths-manifest.json +1 -1
  96. package/dist/runtime/web/.next/server/chunks/210.js +1 -0
  97. package/dist/runtime/web/.next/server/chunks/291.js +18 -0
  98. package/dist/runtime/web/.next/server/chunks/552.js +22 -0
  99. package/dist/runtime/web/.next/server/chunks/780.js +1 -0
  100. package/dist/runtime/web/.next/server/chunks/905.js +6 -0
  101. package/dist/runtime/web/.next/server/chunks/98.js +1 -0
  102. package/dist/runtime/web/.next/server/middleware-build-manifest.js +1 -1
  103. package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  104. package/dist/runtime/web/.next/server/pages/404.html +2 -2
  105. package/dist/runtime/web/.next/server/pages/500.html +1 -1
  106. package/dist/runtime/web/.next/server/pages/_app.js +1 -1
  107. package/dist/runtime/web/.next/server/pages/_app.js.nft.json +1 -1
  108. package/dist/runtime/web/.next/server/pages/_document.js +1 -1
  109. package/dist/runtime/web/.next/server/pages/_document.js.nft.json +1 -1
  110. package/dist/runtime/web/.next/server/pages/_error.js +9 -9
  111. package/dist/runtime/web/.next/server/pages/_error.js.nft.json +1 -1
  112. package/dist/runtime/web/.next/server/pages-manifest.json +1 -1
  113. package/dist/runtime/web/.next/server/server-reference-manifest.json +1 -1
  114. package/dist/runtime/web/.next/server/webpack-runtime.js +1 -1
  115. package/dist/runtime/web/.next/static/{5_15u1WQCxN1_eHZpldCv → LJFZk_8tvKFN_Ee4HqUuM}/_buildManifest.js +1 -1
  116. package/dist/runtime/web/.next/static/chunks/05c91ade-7d09b2b280adffd1.js +1 -0
  117. package/dist/runtime/web/.next/static/chunks/201-51bef3fa8c832e2e.js +1 -0
  118. package/dist/runtime/web/.next/static/chunks/524-89747ed9b0294f8a.js +1 -0
  119. package/dist/runtime/web/.next/static/chunks/554-8bec6e9cca6acc67.js +1 -0
  120. package/dist/runtime/web/.next/static/chunks/764.86e9503a69d45a85.js +1 -0
  121. package/dist/runtime/web/.next/static/chunks/{87c73c54-09e1ba5c70e60a51.js → 7ab4dc20-239138e0ae7af24a.js} +1 -1
  122. package/dist/runtime/web/.next/static/chunks/905-342391e3d3a3678f.js +20 -0
  123. package/dist/runtime/web/.next/static/chunks/a8a5ce16-4edea7df2d9b544a.js +79 -0
  124. package/dist/runtime/web/.next/static/chunks/{8bb4d8db-3e2aa02b0a2384b9.js → ad74d572-4c1b162e2c15acaa.js} +1 -1
  125. package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-7b752a8641f96c1f.js +1 -0
  126. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-34e66b251c2b5044.js +1 -0
  127. package/dist/runtime/web/.next/static/chunks/app/api/health/route-7b752a8641f96c1f.js +1 -0
  128. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-7b752a8641f96c1f.js +1 -0
  129. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-7b752a8641f96c1f.js +1 -0
  130. package/dist/runtime/web/.next/static/chunks/app/layout-df9ac93cb02b2385.js +1 -0
  131. package/dist/runtime/web/.next/static/chunks/app/page-6610743f7de5f92a.js +1 -0
  132. package/dist/runtime/web/.next/static/chunks/c25e0690-e9b798b8de667da1.js +1 -0
  133. package/dist/runtime/web/.next/static/chunks/framework-57157ec4d37f64aa.js +1 -0
  134. package/dist/runtime/web/.next/static/chunks/main-app-156cc0c60371bd78.js +1 -0
  135. package/dist/runtime/web/.next/static/chunks/main-df25d367c47b1fec.js +1 -0
  136. package/dist/runtime/web/.next/static/chunks/pages/_app-9f629a5e1131d19f.js +1 -0
  137. package/dist/runtime/web/.next/static/chunks/pages/_error-9238238274c7efcd.js +1 -0
  138. package/dist/runtime/web/.next/static/chunks/webpack-cd50e39b423d1808.js +1 -0
  139. package/dist/runtime/web/.next/static/css/4fbf378a264bd4ea.css +1 -0
  140. package/dist/runtime/web/package.json +8 -8
  141. package/dist/runtime/web/server.js +1 -1
  142. package/dist/tsconfig.tsbuildinfo +1 -1
  143. package/package.json +3 -37
  144. package/dist/runtime/api/lib/trpc/client.d.ts +0 -1
  145. package/dist/runtime/api/lib/trpc/client.js +0 -5
  146. package/dist/runtime/web/.next/server/chunks/217.js +0 -1
  147. package/dist/runtime/web/.next/server/chunks/383.js +0 -6
  148. package/dist/runtime/web/.next/server/chunks/458.js +0 -1
  149. package/dist/runtime/web/.next/server/chunks/576.js +0 -18
  150. package/dist/runtime/web/.next/server/chunks/635.js +0 -22
  151. package/dist/runtime/web/.next/server/chunks/761.js +0 -1
  152. package/dist/runtime/web/.next/server/chunks/777.js +0 -3
  153. package/dist/runtime/web/.next/server/chunks/825.js +0 -1
  154. package/dist/runtime/web/.next/server/chunks/838.js +0 -1
  155. package/dist/runtime/web/.next/server/chunks/973.js +0 -15
  156. package/dist/runtime/web/.next/static/chunks/18-15c10d3288afef2e.js +0 -1
  157. package/dist/runtime/web/.next/static/chunks/1c0ca389.537bbe362e3ffbd9.js +0 -3
  158. package/dist/runtime/web/.next/static/chunks/22747d63-ad5da0c19f4cfe41.js +0 -71
  159. package/dist/runtime/web/.next/static/chunks/355.056c2645878a799a.js +0 -1
  160. package/dist/runtime/web/.next/static/chunks/420.a5ccf151c9e2b2f1.js +0 -1
  161. package/dist/runtime/web/.next/static/chunks/439.1be0c6242fd248d5.js +0 -15
  162. package/dist/runtime/web/.next/static/chunks/440.c52e7c0f797e22b2.js +0 -1
  163. package/dist/runtime/web/.next/static/chunks/575-e2478287c27da87b.js +0 -1
  164. package/dist/runtime/web/.next/static/chunks/691.920d88c115087314.js +0 -1
  165. package/dist/runtime/web/.next/static/chunks/765-e838910065b50c3d.js +0 -1
  166. package/dist/runtime/web/.next/static/chunks/823-6f371a6e829adbba.js +0 -63
  167. package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +0 -1
  168. package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +0 -1
  169. package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-751c9265a65409e5.js +0 -1
  170. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-1cb74d1cba27d0ab.js +0 -1
  171. package/dist/runtime/web/.next/static/chunks/app/api/health/route-751c9265a65409e5.js +0 -1
  172. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-751c9265a65409e5.js +0 -1
  173. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-751c9265a65409e5.js +0 -1
  174. package/dist/runtime/web/.next/static/chunks/app/layout-8435322f09fd0975.js +0 -1
  175. package/dist/runtime/web/.next/static/chunks/app/page-9fe7d75095b4ccec.js +0 -1
  176. package/dist/runtime/web/.next/static/chunks/cac567b0-5b77dd12911823cd.js +0 -1
  177. package/dist/runtime/web/.next/static/chunks/framework-2518f1345b5b2806.js +0 -1
  178. package/dist/runtime/web/.next/static/chunks/main-17665e5e39de9a8a.js +0 -1
  179. package/dist/runtime/web/.next/static/chunks/main-app-c0b0f5ba4f7f9d75.js +0 -1
  180. package/dist/runtime/web/.next/static/chunks/pages/_app-d6f6b3bbc3d81ee1.js +0 -1
  181. package/dist/runtime/web/.next/static/chunks/pages/_error-75a96cf1997cc3b9.js +0 -1
  182. package/dist/runtime/web/.next/static/chunks/webpack-c8de37305b4635cf.js +0 -1
  183. package/dist/runtime/web/.next/static/css/08c950681f1a9a92.css +0 -1
  184. /package/dist/runtime/web/.next/static/{5_15u1WQCxN1_eHZpldCv → LJFZk_8tvKFN_Ee4HqUuM}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{7609:()=>{},14113:(e,t,l)=>{"use strict";l.d(t,{i:()=>i});let i=(0,l(22627).pY)()},21315:()=>{},23156:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>nm});var i=l(54568),n=l(7620),r=l(34476),a=l(3568),o=l(97628),s=l(81609),d=l(97544),c=l(40635),u=l(85462),p=l(30602),h=l(24249),m=l(42623),g=l(69697),x=l(87402),f=l(29364),v=l(14113),C=l(51091),y=l(72035),j=l(62868),b=l(26621),w=l(3348),k=l(67504),T=l(79198),S=l(24347),A=l(23744),z=l(16280),L=l(58042),E=l(44471),I=l(15768),R=l(32788),M=l(54271),P=l(54029),N=l(4869);function B(){return v.i.listWorktrees.useQuery(void 0,{refetchOnWindowFocus:!1,staleTime:3e4,refetchInterval:3e4})}function H(e){let{data:t}=B();return null==t?void 0:t.find(t=>t.taskId===e)}var D=l(43929);let F=[{key:"implement",label:"Implement",color:"yellow",phases:["draft","implementing"]},{key:"validate",label:"Validate",color:"orange",phases:["validating"]},{key:"review",label:"Review",color:"grape",phases:["ai-reviewing","awaiting-review","approved"]},{key:"merge",label:"Merge",color:"teal",phases:["merging","merged","cleaning","completed"]}];function U(e){return e&&"failed"!==e?F.findIndex(t=>t.phases.includes(e)):-1}function V(e){let{color:t,status:l,size:n="xs",label:r}=e,a="xs"===n?10:12,o="failed"===l?"var(--mantine-color-red-5)":"pending"===l?"transparent":"var(--mantine-color-".concat(t,"-5)"),s="pending"===l?"1px solid var(--mantine-color-gray-5)":"1px solid var(--mantine-color-".concat(t,"-6)"),d="active"===l?"0 0 0 2px var(--mantine-color-".concat(t,"-3)"):void 0;return(0,i.jsx)(w.Tooltip,{label:r,withArrow:!0,children:(0,i.jsx)("div",{"aria-label":r,style:{width:a,height:a,borderRadius:"50%",background:o,border:s,boxShadow:d,display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:"failed"===l&&(0,i.jsx)(D.A,{size:a-4,color:"var(--mantine-color-red-1)",stroke:2})})})}function O(e){let{size:t="xs"}=e;return(0,i.jsx)("div",{"aria-hidden":!0,style:{width:"xs"===t?12:14,height:2,background:"var(--mantine-color-gray-4)",borderRadius:1,opacity:.7}})}let G=(0,n.memo)(function(e){let{workflows:t,size:l="xs"}=e,r=t&&t[0]||null,a=(0,n.useMemo)(()=>{if(!r)return{current:-1,failedAt:-1};if("failed"===r.phase){var e;return{current:-1,failedAt:U((null==(e=r.failureContext)?void 0:e.atPhase)||r.lastPhase)}}return{current:U(r.phase),failedAt:-1}},[r]);return r?(0,i.jsx)(o.Group,{gap:6,wrap:"nowrap",align:"center",children:F.map((e,t)=>{let r="pending";return r=a.failedAt>=0?t<a.failedAt?"done":t===a.failedAt?"failed":"pending":a.current>=0?t<a.current?"done":t===a.current?"active":"pending":0===t?"active":"pending",(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(V,{color:e.color,status:r,size:l,label:e.label}),t<F.length-1&&(0,i.jsx)(O,{size:l})]},e.key)})}):(0,i.jsx)(o.Group,{gap:4,wrap:"nowrap",align:"center",children:F.map((e,t)=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(V,{color:e.color,status:0===t?"active":"pending",size:l,label:e.label}),t<F.length-1&&(0,i.jsx)(O,{size:l})]},e.key))})});function W(e){let{taskId:t,worktree:l,size:n="xs"}=e,r=v.i.useUtils(),a=v.i.openInEditor.useMutation(),o=v.i.createWorktree.useMutation({onSuccess:async()=>{await r.listWorktrees.invalidate()}}),s=async e=>{e.stopPropagation();try{let e=null==l?void 0:l.path;if(!e){let l=await o.mutateAsync({taskId:t});e=null==l?void 0:l.path}e&&await a.mutateAsync({worktreePath:e})}catch(e){console.error("Failed to open editor:",e)}},d=a.isPending||o.isPending,u=!!(null==l?void 0:l.path);return(0,i.jsx)(w.Tooltip,{label:u?"Open Editor":"Click to create worktree and open editor",withArrow:!0,children:(0,i.jsx)(c.ActionIcon,{variant:u?"light":"subtle",color:u?"blue":"gray",size:n,onClick:s,loading:d,"aria-label":"Open task worktree in editor",children:(0,i.jsx)(T.A,{size:"xs"===n?12:14})})})}var _=l(72221);function q(e){let{taskId:t,worktree:l,size:n="xs"}=e,r=v.i.useUtils(),a=v.i.openInTerminal.useMutation(),o=v.i.createWorktree.useMutation({onSuccess:async()=>{await r.listWorktrees.invalidate()}}),s=async e=>{e.stopPropagation();try{let e=null==l?void 0:l.path;if(!e){let l=await o.mutateAsync({taskId:t});e=null==l?void 0:l.path}e&&await a.mutateAsync({worktreePath:e})}catch(e){console.error("Failed to open terminal:",e)}},d=o.isPending||a.isPending,u=!!(null==l?void 0:l.path);return(0,i.jsx)(w.Tooltip,{label:u?"Open Terminal":"Click to create worktree and open terminal",withArrow:!0,children:(0,i.jsx)(c.ActionIcon,{variant:u?"light":"subtle",color:"gray",size:n,onClick:s,loading:d,"aria-label":"Open task worktree in terminal",children:(0,i.jsx)(_.A,{size:"xs"===n?12:14})})})}var Z=l(27541);let Q={feature:T.A,bug:S.A,chore:u.A,refactor:A.A,test:z.A,doc:L.A},K={feature:"blue",bug:"red",chore:"gray",refactor:"orange",test:"green",doc:"purple"},J={low:"gray",medium:"yellow",high:"red"};function $(e){let t,{task:l,onClick:n,isDragging:r=!1}=e,s=Q[l.type],u=H(l.id),p=v.i.getWorkflowsByTaskId.useQuery({taskId:l.id},{enabled:!!l.id,refetchOnWindowFocus:!1,staleTime:15e3}),h=(0,Z.useRouter)(),m=(0,Z.useSearchParams)(),g=(0,Z.usePathname)(),x=null!=g?g:"/",f=p.data&&p.data[0]||null,C=!!f&&!!(t=f.phase)&&["implementing","validating","ai-reviewing","awaiting-review","approved","merging"].includes(t);return(0,i.jsx)(b.Card,{shadow:"sm",padding:"sm",radius:"md",withBorder:!0,style:{cursor:"pointer",opacity:r?.7:1,transform:r?"rotate(3deg) scale(1.05)":"none",transition:"all 0.2s ease",boxShadow:r?"0 8px 16px rgba(0, 0, 0, 0.15)":void 0,position:"relative"},onClick:n,children:(0,i.jsxs)(a.Stack,{gap:"xs",children:[(0,i.jsxs)(o.Group,{justify:"space-between",align:"flex-start",children:[(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",fw:500,children:l.id}),(0,i.jsxs)(o.Group,{gap:4,children:[(0,i.jsx)(y.Badge,{color:K[l.type],variant:"light",size:"xs",leftSection:(0,i.jsx)(s,{size:10}),children:l.type}),u&&(0,i.jsx)(w.Tooltip,{label:"Worktree: ".concat(u.path),children:(0,i.jsx)(y.Badge,{color:"green",variant:"light",size:"xs",leftSection:(0,i.jsx)(P.A,{size:10}),children:"ACTIVE"})}),"medium"!==l.priority&&(0,i.jsx)(y.Badge,{color:J[l.priority],variant:"light",size:"xs",leftSection:(0,i.jsx)(E.A,{size:10}),children:l.priority})]})]}),(0,i.jsx)(d.Text,{fw:500,lineClamp:2,children:l.title}),C&&(0,i.jsx)(G,{workflows:p.data,size:"xs"}),l.tags.length>0&&(0,i.jsxs)(o.Group,{gap:4,children:[l.tags.slice(0,3).map(e=>(0,i.jsx)(y.Badge,{size:"xs",variant:"outline",children:e},e)),l.tags.length>3&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["+",l.tags.length-3]})]}),(0,i.jsxs)(o.Group,{justify:"space-between",align:"center",children:[(0,i.jsxs)(o.Group,{gap:6,children:[(0,i.jsx)(w.Tooltip,{label:"Open Vibing panel",withArrow:!0,children:(0,i.jsx)(c.ActionIcon,{size:"xs",variant:"light",onClick:e=>{var t;e.stopPropagation();let i=new URLSearchParams((null==m||null==(t=m.toString)?void 0:t.call(m))||"");i.set("task",l.id),i.set("tab","vibing"),h.push("".concat(x,"?").concat(i.toString()),{scroll:!1})},"aria-label":"Open vibing",children:(0,i.jsx)(I.A,{size:12})})}),(0,i.jsx)(W,{taskId:l.id,worktree:u||void 0,size:"xs"}),(0,i.jsx)(q,{taskId:l.id,worktree:u||void 0,size:"xs"}),(0,i.jsx)(k.Divider,{orientation:"vertical",mx:2}),l.assignee&&l.assignee.length>0&&(0,i.jsx)(w.Tooltip,{label:l.assignee.join(", "),children:(0,i.jsx)(c.ActionIcon,{size:"xs",variant:"subtle",children:(0,i.jsx)(R.A,{size:12})})}),l.due_date&&(0,i.jsx)(w.Tooltip,{label:"Due: ".concat(l.due_date),children:(0,i.jsx)(c.ActionIcon,{size:"xs",variant:"subtle",color:"orange",children:(0,i.jsx)(M.A,{size:12})})})]}),(0,i.jsx)(o.Group,{gap:6,children:(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:l.updated_at?new Date(l.updated_at).toLocaleDateString():"No date"})})]})]})})}function Y(e){let{task:t,onClick:l}=e,{attributes:n,listeners:r,setNodeRef:a,transform:o,transition:s,isDragging:d}=(0,f.gl)({id:t.id}),c={transform:j.Ks.Transform.toString(o),transition:s};return(0,i.jsxs)("div",{ref:a,style:c,...n,...r,role:"button",tabIndex:0,"aria-label":"Drag to move task: ".concat(t.title),"aria-describedby":"task-".concat(t.id,"-description"),"aria-grabbed":d,children:[(0,i.jsx)($,{task:t,onClick:l,isDragging:d}),(0,i.jsx)("div",{id:"task-".concat(t.id,"-description"),style:{display:"none"},children:"Press space to pick up this task, then use arrow keys to move it to a different column. Press space again to drop."})]})}function X(e){let{id:t,status:l,label:n,color:r,tasks:d,onTaskClick:c,onAddTask:u,isDropTarget:p=!1}=e,{isOver:m,setNodeRef:v}=(0,x.zM)({id:t}),j=d.map(e=>e.id);return(0,i.jsxs)(C.Paper,{ref:v,p:"md",withBorder:!0,role:"region","aria-label":"".concat(n," task column with ").concat(d.length," tasks"),"aria-dropeffect":m?"move":"none",style:{minHeight:"400px",width:"280px",minWidth:"280px",flexShrink:0,backgroundColor:m?"#e3f2fd":p?"#f8f9fa":void 0,borderColor:m?"#2196f3":p?"#228be6":void 0,borderStyle:m||p?"dashed":"solid",borderWidth:m?"3px":p?"2px":"1px",transition:"all 0.2s ease",transform:m?"scale(1.02)":"scale(1)"},children:[(0,i.jsxs)(o.Group,{justify:"space-between",mb:"md",children:[(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(s.Title,{order:4,children:n}),(0,i.jsx)(y.Badge,{color:r,variant:"light",children:d.length})]}),(0,i.jsx)(h.Button,{size:"xs",variant:"light",leftSection:(0,i.jsx)(g.A,{size:14}),onClick:()=>u(l),children:"Add"})]}),(0,i.jsx)(f.gB,{items:j,strategy:f._G,children:(0,i.jsx)(a.Stack,{gap:"sm",children:d.map(e=>(0,i.jsx)(Y,{task:e,onClick:()=>c(e)},e.id))})})]})}var ee=l(63395),et=l(49652),el=l(61597),ei=l(82110),en=l(96557),er=l(13239);let ea=[{value:"feature",label:"Feature"},{value:"bug",label:"Bug"},{value:"chore",label:"Chore"},{value:"refactor",label:"Refactor"},{value:"test",label:"Test"},{value:"doc",label:"Documentation"}],eo=[{value:"backlog",label:"Backlog"},{value:"in-progress",label:"In Progress"},{value:"review",label:"Review"},{value:"done",label:"Done"}],es=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function ed(e){let{onSearch:t,onFilterChange:l,availableTags:r=[]}=e,[a,s]=(0,n.useState)(!1),[d,u]=(0,n.useState)(""),[p,m]=(0,n.useState)({type:void 0,status:void 0,priority:void 0,tags:[]}),g=e=>{m(e),l(e)},x=p.type||p.status||p.priority||p.tags.length>0,f=r.map(e=>({value:e,label:e}));return(0,i.jsxs)(C.Paper,{p:"md",withBorder:!0,children:[(0,i.jsx)(o.Group,{justify:"space-between",children:(0,i.jsxs)(o.Group,{style:{flex:1},children:[(0,i.jsx)(ee.TextInput,{placeholder:"Search tasks...",value:d,onChange:e=>{var l;u(l=e.target.value),t(l)},leftSection:(0,i.jsx)(en.A,{size:16}),style:{flex:1,maxWidth:400}}),(0,i.jsxs)(h.Button,{variant:a?"filled":"light",leftSection:(0,i.jsx)(er.A,{size:16}),onClick:()=>s(!a),children:["Filters",x&&" (".concat([p.type,p.status,p.priority,...p.tags||[]].filter(Boolean).length,")")]}),x&&(0,i.jsx)(c.ActionIcon,{variant:"subtle",onClick:()=>{let e={type:void 0,status:void 0,priority:void 0,tags:[]};m(e),l(e)},children:(0,i.jsx)(D.A,{size:16})})]})}),(0,i.jsx)(et.Collapse,{in:a,children:(0,i.jsxs)(o.Group,{mt:"md",align:"flex-end",children:[(0,i.jsx)(el.Select,{label:"Type",placeholder:"All types",value:p.type||"",data:ea,clearable:!0,onChange:e=>g({...p,type:e})}),(0,i.jsx)(el.Select,{label:"Status",placeholder:"All statuses",value:p.status||"",data:eo,clearable:!0,onChange:e=>g({...p,status:e})}),(0,i.jsx)(el.Select,{label:"Priority",placeholder:"All priorities",value:p.priority||"",data:es,clearable:!0,onChange:e=>g({...p,priority:e})}),(0,i.jsx)(ei.MultiSelect,{label:"Tags",placeholder:"Select tags",value:p.tags,data:f,onChange:e=>g({...p,tags:e}),style:{minWidth:200}})]})})]})}let ec=[{key:"backlog",label:"Backlog",color:"gray"},{key:"in-progress",label:"In Progress",color:"blue"},{key:"review",label:"Review",color:"orange"},{key:"done",label:"Done",color:"green"}];function eu(e){let{onTaskClick:t,onCreateTask:l}=e,[r,d]=(0,n.useState)(null),[c,u]=(0,n.useState)(null),[C,y]=(0,n.useState)(""),[j,b]=(0,n.useState)({type:void 0,status:void 0,priority:void 0,tags:[]}),w=v.i.useUtils(),{data:k=[],isLoading:T,error:S,refetch:A}=v.i.listTasks.useQuery(void 0,{refetchOnMount:!0,refetchOnWindowFocus:!0,retry:3,retryDelay:1e3});v.i.onTaskUpdate.useSubscription({},{onData:e=>{if("delete"===e.type){let t=w.listTasks.getData();if(t){let l=t.filter(t=>t.id!==e.taskId);w.listTasks.setData(void 0,l)}w.listTasks.invalidate()}else"update"===e.type&&A()},onError:e=>{console.error("Kanban task subscription error:",e)}}),v.i.onTaskWorkflowEvents.useSubscription({},{onData:e=>{var t;let l=null==e||null==(t=e.workflow)?void 0:t.taskId;l?w.getWorkflowsByTaskId.invalidate({taskId:l}).catch(()=>{}):w.getWorkflowsByTaskId.invalidate().catch(()=>{}),w.listWorktrees.invalidate().catch(()=>{})},onError:e=>{console.error("Kanban workflow subscription error:",e)}});let z=v.i.moveTask.useMutation({onMutate:async e=>{let{id:t,status:l}=e;await w.listTasks.cancel();let i=w.listTasks.getData();if(i){let e=i.map(e=>e.id===t?{...e,status:l}:e);w.listTasks.setData(void 0,e)}return{previousTasks:i}},onError:(e,t,l)=>{(null==l?void 0:l.previousTasks)&&w.listTasks.setData(void 0,l.previousTasks),m.notifications.hide("moving-".concat(t.id)),m.notifications.show({title:"Move Failed",message:"Unable to move task: ".concat(e.message,". Please try again."),color:"red",autoClose:5e3})},onSuccess:e=>{m.notifications.hide("moving-".concat(e.id)),m.notifications.show({title:"Task Moved",message:"".concat(e.title," moved to ").concat(e.status),color:"green",autoClose:3e3}),w.listTasks.invalidate()}}),L=(0,x.FR)((0,x.MS)(x.AN,{activationConstraint:{distance:8}}),(0,x.MS)(x.uN,{coordinateGetter:f.JR})),E=(0,n.useMemo)(()=>{let e=k.filter(e=>!e.deleted_at);if(C){let t=C.toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||e.tags.some(e=>e.toLowerCase().includes(t)))}return j.type&&(e=e.filter(e=>e.type===j.type)),j.status&&(e=e.filter(e=>e.status===j.status)),j.priority&&(e=e.filter(e=>e.priority===j.priority)),j.tags.length>0&&(e=e.filter(e=>j.tags.some(t=>e.tags.includes(t)))),e},[k,C,j]),I=(0,n.useMemo)(()=>{let e=new Set;return k.forEach(t=>{t.tags.forEach(t=>e.add(t))}),Array.from(e).sort()},[k]),R=(0,n.useCallback)(e=>{d(E.find(t=>t.id===e.active.id)||null)},[E]),M=(0,n.useCallback)(e=>{let{over:t}=e;if(t){var l;let e=t.id;u((null==(l=ec.find(t=>e==="lane-".concat(t.key)))?void 0:l.key)||null)}else u(null)},[]),P=(0,n.useCallback)(e=>{var t;let{active:l,over:i}=e;if(d(null),u(null),!i)return;let n=l.id,r=i.id,a=null==(t=ec.find(e=>r==="lane-".concat(e.key)))?void 0:t.key;if(a){let e=k.find(e=>e.id===n);e&&e.status!==a&&(m.notifications.show({id:"moving-".concat(n),title:"Moving Task",message:'Moving "'.concat(e.title,'" to ').concat(a,"..."),loading:!0,autoClose:!1}),z.mutate({id:n,status:a}))}},[k,z]);if(T)return(0,i.jsx)(p.Box,{children:"Loading tasks..."});if(S)return(0,i.jsxs)(p.Box,{children:["Error loading tasks: ",S.message]});let N=ec.reduce((e,t)=>(e[t.key]=E.filter(e=>e.status===t.key),e),{});return(0,i.jsxs)(x.Mp,{sensors:L,onDragStart:R,onDragOver:M,onDragEnd:P,children:[(0,i.jsxs)(a.Stack,{gap:"lg",children:[(0,i.jsxs)(o.Group,{justify:"space-between",children:[(0,i.jsx)(s.Title,{order:2,children:"Task Board"}),(0,i.jsx)(h.Button,{leftSection:(0,i.jsx)(g.A,{size:16}),onClick:()=>l(),children:"New Task"})]}),(0,i.jsx)(ed,{onSearch:y,onFilterChange:e=>{b({type:e.type,status:e.status,priority:e.priority,tags:e.tags||[]})},availableTags:I}),(0,i.jsx)(o.Group,{align:"flex-start",gap:"md",style:{overflowX:"auto",flexWrap:"nowrap",width:"100%"},children:ec.map(e=>(0,i.jsx)(X,{id:"lane-".concat(e.key),status:e.key,label:e.label,color:e.color,tasks:N[e.key]||[],onTaskClick:t,onAddTask:e=>l(e),isDropTarget:c===e.key},e.key))})]}),(0,i.jsx)(x.Hd,{children:r?(0,i.jsx)($,{task:r,onClick:()=>{},isDragging:!0}):null})]})}var ep=l(24547),eh=l(96828),em=l(59033),eg=l(69191),ex=l(42625),ef=l(58740),ev=l(85390),eC=l(58955),ey=l(31269);function ej(e,t,l,i){let n=new URLSearchParams(t);i&&i.length>0?n.set(l,i):n.delete(l);let r=n.toString();return r?"".concat(e,"?").concat(r):e}var eb=l(10195),ew=l(79464),ek=l(98885),eT=l(85378),eS=l(70097),eA=l(4198),ez=l(89501),eL=l(23201),eE=l(49081),eI=l(81543);l(81401);let eR=n.createContext(null);function eM(){let e=n.useContext(eR);if(null==e)throw Error("Tooltip components must be wrapped in <TooltipProvider />");return e}function eP(e){var t,l;let{children:r,...a}=e,o=function(){let{initialOpen:e=!1,placement:t="top",open:l,onOpenChange:i,delay:r=600,closeDelay:a=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[o,s]=n.useState(e),d=null!=l?l:o,c=null!=i?i:s,u=(0,eL.we)({placement:t,open:d,onOpenChange:c,whileElementsMounted:eE.ll,middleware:[(0,eI.cY)(4),(0,eI.UU)({crossAxis:t.includes("-"),fallbackAxisSideDirection:"start",padding:4}),(0,eI.BN)({padding:4})]}),p=u.context,h=(0,eL.Mk)(p,{mouseOnly:!0,move:!1,restMs:r,enabled:null==l,delay:{close:a}}),m=(0,eL.iQ)(p,{enabled:null==l}),g=(0,eL.s9)(p),x=(0,eL.It)(p,{role:"tooltip"}),f=(0,eL.bv)([h,m,g,x]);return n.useMemo(()=>({open:d,setOpen:c,...f,...u}),[d,c,f,u])}(a);return a.useDelayGroup?(0,i.jsx)(eL.T3,{delay:{open:null!=(t=a.delay)?t:0,close:null!=(l=a.closeDelay)?l:0},timeoutMs:a.timeout,children:(0,i.jsx)(eR.Provider,{value:o,children:r})}):(0,i.jsx)(eR.Provider,{value:o,children:r})}let eN=n.forwardRef(function(e,t){let{children:l,asChild:r=!1,...a}=e,o=eM(),s=n.isValidElement(l)?parseInt(n.version,10)>=19?l.props.ref:l.ref:void 0,d=(0,eL.SV)([o.refs.setReference,t,s]);if(r&&n.isValidElement(l)){let e={"data-tooltip-state":o.open?"open":"closed"};return n.cloneElement(l,o.getReferenceProps({ref:d,...a,..."object"==typeof l.props?l.props:{},...e}))}return(0,i.jsx)("button",{ref:d,"data-tooltip-state":o.open?"open":"closed",...o.getReferenceProps(a),children:l})}),eB=n.forwardRef(function(e,t){let{style:l,children:n,portal:r=!0,portalProps:a={},...o}=e,s=eM(),d=(0,eL.SV)([s.refs.setFloating,t]);if(!s.open)return null;let c=(0,i.jsx)("div",{ref:d,style:{...s.floatingStyles,...l},...s.getFloatingProps(o),className:"tiptap-tooltip",children:n});return r?(0,i.jsx)(eL.XF,{...a,children:c}):c});eP.displayName="Tooltip",eN.displayName="TooltipTrigger",eB.displayName="TooltipContent";var eH=l(15701);let eD={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function eF(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return t.filter(Boolean).join(" ")}let eU=function(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return t?eD[e.toLowerCase()]||(l?e.toUpperCase():e):l?e.charAt(0).toUpperCase()+e.slice(1):e},eV=e=>{let{shortcutKeys:t,delimiter:l="+",capitalize:i=!0}=e;return t?t.split(l).map(e=>e.trim()).map(e=>eU(e,"undefined"!=typeof navigator&&navigator.platform.toLowerCase().includes("mac"),i)):[]},eO=(e,t)=>!!(null==t?void 0:t.schema)&&void 0!==t.schema.spec.marks.get(e),eG=(e,t)=>!!(null==t?void 0:t.schema)&&void 0!==t.schema.spec.nodes.get(e);function eW(e){return"number"==typeof e&&e>=0}function e_(e,t){if(!e)return!1;let l=Array.isArray(t)?t:[t],i=l.some(t=>e.extensionManager.extensions.some(e=>e.name===t));return i||console.warn("None of the extensions [".concat(l.join(", "),"] were found in the editor schema. Ensure they are included in the editor configuration.")),i}function eq(e){var t;let{editor:l,node:i,nodePos:n}=e;if(!l||!(null==(t=l.state)?void 0:t.doc))return null;let r=null!=i,a=eW(n);if(!r&&!a)return null;if(r){let e=-1,t=null;if(l.state.doc.descendants((l,n)=>l!==i||(e=n,t=l,!1)),-1!==e&&null!==t)return{pos:e,node:t}}if(a){let e=function(e,t){try{let l=e.state.doc.nodeAt(t);if(!l)return console.warn("No node found at position ".concat(t)),null;return l}catch(e){return console.error("Error getting node at position ".concat(t,":"),e),null}}(l,n);if(e)return{pos:n,node:e}}return null}function eZ(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e||!e.state.selection)return!1;let{state:l}=e,{selection:i}=l;if(i.empty)return!1;if(i instanceof eH.nh){let e=i.node;return!!e&&t.includes(e.type.name)}return!1}let eQ=async(e,t,l)=>{if(!e)throw Error("No file provided");if(e.size>5242880)throw Error("File size exceeds maximum allowed (".concat(5,"MB)"));let i=new FormData;return i.append("file",e),new Promise((e,n)=>{let r=new XMLHttpRequest;r.upload.addEventListener("progress",e=>{if(e.lengthComputable){let l=Math.round(e.loaded/e.total*100);null==t||t({progress:l})}}),r.addEventListener("load",()=>{if(r.status>=200&&r.status<300)try{var t;let l=null!=(t=JSON.parse(r.responseText))?t:{},i=function(e){for(let t of e)if("string"==typeof t&&t.trim().length>0)return t;return null}([l.publicPath,l.url,l.relativePath]);if(!i)return void n(Error("Upload failed: response did not include a URL"));e(i)}catch(e){n(e instanceof Error?e:Error("Failed to parse upload response"))}else n(Error("Upload failed with status ".concat(r.status)))}),r.addEventListener("error",()=>{n(Error("Upload failed"))}),l&&l.addEventListener("abort",()=>{r.abort(),n(Error("Upload cancelled"))}),r.open("POST","/api/upload"),r.send(i)})},eK=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;l(90312),l(81961),l(33783);let eJ=e=>{let{shortcuts:t}=e;return 0===t.length?null:(0,i.jsx)("div",{children:t.map((e,t)=>(0,i.jsxs)(n.Fragment,{children:[t>0&&(0,i.jsx)("kbd",{children:"+"}),(0,i.jsx)("kbd",{children:e})]},t))})},e$=n.forwardRef((e,t)=>{let{className:l,children:r,tooltip:a,showTooltip:o=!0,shortcutKeys:s,"aria-label":d,...c}=e,u=n.useMemo(()=>eV({shortcutKeys:s}),[s]);return a&&o?(0,i.jsxs)(eP,{delay:200,children:[(0,i.jsx)(eN,{className:eF("tiptap-button",l),ref:t,"aria-label":d,...c,children:r}),(0,i.jsxs)(eB,{children:[a,(0,i.jsx)(eJ,{shortcuts:u})]})]}):(0,i.jsx)("button",{className:eF("tiptap-button",l),ref:t,"aria-label":d,...c,children:r})});e$.displayName="Button";let eY=n.forwardRef((e,t)=>{let{className:l,children:n,orientation:r="vertical",...a}=e;return(0,i.jsx)("div",{ref:t,className:eF("tiptap-button-group",l),"data-orientation":r,role:"group",...a,children:n})});eY.displayName="ButtonGroup",l(38641);let eX=n.forwardRef((e,t)=>{let{decorative:l,orientation:n="vertical",className:r,...a}=e;return(0,i.jsx)("div",{className:eF("tiptap-separator",r),"data-orientation":n,...l?{role:"none"}:{"aria-orientation":"vertical"===n?n:void 0,role:"separator"},...a,ref:t})});eX.displayName="Separator",l(46577);let e1=(e,t)=>{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)},e0=n.forwardRef((e,t)=>{let{children:l,className:r,variant:a="fixed",...o}=e,s=n.useRef(null),d=((e,t)=>{let l=n.useRef(null);return n.useCallback(i=>{e&&"current"in e&&(e.current=i),l.current&&e1(l.current,null),l.current=t,t&&e1(t,i)},[e,t])})(s,t);return(e=>{let[t,l]=n.useState([]),i=n.useCallback(()=>e.current?Array.from(e.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[e]);n.useEffect(()=>{let t=e.current;if(!t)return;let n=()=>l(i());n();let r=new MutationObserver(n);return r.observe(t,{childList:!0,subtree:!0}),()=>r.disconnect()},[i,e]);let{selectedIndex:r}=function(e){let{editor:t,containerRef:l,query:i,items:r,onSelect:a,onClose:o,orientation:s="vertical",autoSelectFirstItem:d=!0}=e,[c,u]=n.useState(d?0:-1);return n.useEffect(()=>{let e=e=>{if(!r.length)return!1;let t=()=>u(e=>-1===e?0:(e+1)%r.length),l=()=>u(e=>-1===e?r.length-1:(e-1+r.length)%r.length);switch(e.key){case"ArrowUp":if("horizontal"===s)return!1;return e.preventDefault(),l(),!0;case"ArrowDown":if("horizontal"===s)return!1;return e.preventDefault(),t(),!0;case"ArrowLeft":if("vertical"===s)return!1;return e.preventDefault(),l(),!0;case"ArrowRight":if("vertical"===s)return!1;return e.preventDefault(),t(),!0;case"Tab":return e.preventDefault(),e.shiftKey?l():t(),!0;case"Home":return e.preventDefault(),u(0),!0;case"End":return e.preventDefault(),u(r.length-1),!0;case"Enter":if(e.isComposing)return!1;return e.preventDefault(),-1!==c&&r[c]&&(null==a||a(r[c])),!0;case"Escape":return e.preventDefault(),null==o||o(),!0;default:return!1}},i=null;if(t?i=t.view.dom:(null==l?void 0:l.current)&&(i=l.current),i)return i.addEventListener("keydown",e,!0),()=>{null==i||i.removeEventListener("keydown",e,!0)}},[t,l,r,c,a,o,s]),n.useEffect(()=>{i&&u(d?0:-1)},[i,d]),{selectedIndex:r.length?c:void 0,setSelectedIndex:u}}({containerRef:e,items:t,orientation:"horizontal",onSelect:e=>e.click(),autoSelectFirstItem:!1});n.useEffect(()=>{let t=e.current;if(!t)return;let l=e=>{let l=e.target;t.contains(l)&&l.setAttribute("data-focus-visible","true")},i=e=>{let l=e.target;t.contains(l)&&l.removeAttribute("data-focus-visible")};return t.addEventListener("focus",l,!0),t.addEventListener("blur",i,!0),()=>{t.removeEventListener("focus",l,!0),t.removeEventListener("blur",i,!0)}},[e]),n.useEffect(()=>{void 0!==r&&t[r]&&t[r].focus()},[r,t])})(s),(0,i.jsx)("div",{ref:d,role:"toolbar","aria-label":"toolbar","data-variant":a,className:eF("tiptap-toolbar",r),...o,children:l})});e0.displayName="Toolbar";let e2=n.forwardRef((e,t)=>{let{children:l,className:n,...r}=e;return(0,i.jsx)("div",{ref:t,role:"group",className:eF("tiptap-toolbar-group",n),...r,children:l})});e2.displayName="ToolbarGroup";let e7=n.forwardRef((e,t)=>{let{...l}=e;return(0,i.jsx)(eX,{ref:t,orientation:"vertical",decorative:!0,...l})});e7.displayName="ToolbarSeparator";var e4=l(48947);let e5=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})})});e5.displayName="CloseIcon",l(78503);let e9=()=>(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),e3=()=>(0,i.jsx)("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),e6=()=>(0,i.jsx)("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),e8=e=>{let{onFile:t,children:l}=e,[r,a]=n.useState(!1),[o,s]=n.useState(!1);return(0,i.jsx)("div",{className:"tiptap-image-upload-drag-area ".concat(o?"drag-active":""," ").concat(r?"drag-over":""),onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),s(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||(s(!1),a(!1))},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),a(!0)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),s(!1),a(!1);let l=Array.from(e.dataTransfer.files);l.length>0&&t(l)},children:l})},te=e=>{let{fileItem:t,onRemove:l}=e;return(0,i.jsxs)("div",{className:"tiptap-image-upload-preview",children:["uploading"===t.status&&(0,i.jsx)("div",{className:"tiptap-image-upload-progress",style:{width:"".concat(t.progress,"%")}}),(0,i.jsxs)("div",{className:"tiptap-image-upload-preview-content",children:[(0,i.jsxs)("div",{className:"tiptap-image-upload-file-info",children:[(0,i.jsx)("div",{className:"tiptap-image-upload-file-icon",children:(0,i.jsx)(e9,{})}),(0,i.jsxs)("div",{className:"tiptap-image-upload-details",children:[(0,i.jsx)("span",{className:"tiptap-image-upload-text",children:t.file.name}),(0,i.jsx)("span",{className:"tiptap-image-upload-subtext",children:(e=>{if(0===e)return"0 Bytes";let t=Math.floor(Math.log(e)/Math.log(1024));return"".concat(parseFloat((e/Math.pow(1024,t)).toFixed(2))," ").concat(["Bytes","KB","MB","GB"][t])})(t.file.size)})]})]}),(0,i.jsxs)("div",{className:"tiptap-image-upload-actions",children:["uploading"===t.status&&(0,i.jsxs)("span",{className:"tiptap-image-upload-progress-text",children:[t.progress,"%"]}),(0,i.jsx)(e$,{type:"button","data-style":"ghost",onClick:e=>{e.stopPropagation(),l()},children:(0,i.jsx)(e5,{className:"tiptap-button-icon"})})]})]})]})},tt=e=>{let{maxSize:t,limit:l}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"tiptap-image-upload-dropzone",children:[(0,i.jsx)(e3,{}),(0,i.jsx)(e6,{}),(0,i.jsx)("div",{className:"tiptap-image-upload-icon-container",children:(0,i.jsx)(e9,{})})]}),(0,i.jsxs)("div",{className:"tiptap-image-upload-content",children:[(0,i.jsxs)("span",{className:"tiptap-image-upload-text",children:[(0,i.jsx)("em",{children:"Click to upload"})," or drag and drop"]}),(0,i.jsxs)("span",{className:"tiptap-image-upload-subtext",children:["Maximum ",l," file",1===l?"":"s",", ",t/1024/1024,"MB each."]})]})]})},tl=e=>{let{accept:t,limit:l,maxSize:r}=e.node.attrs,a=n.useRef(null),o=e.extension,{fileItems:s,uploadFiles:d,removeFileItem:c,clearAllFiles:u}=function(e){let[t,l]=n.useState([]),i=async t=>{var i,n,r;if(t.size>e.maxSize){let t=Error("File size exceeds maximum allowed (".concat(e.maxSize/1024/1024,"MB)"));return null==(i=e.onError)||i.call(e,t),null}let a=new AbortController,o=crypto.randomUUID(),s={id:o,file:t,progress:0,status:"uploading",abortController:a};l(e=>[...e,s]);try{if(!e.upload)throw Error("Upload function is not defined");let i=await e.upload(t,e=>{l(t=>t.map(t=>t.id===o?{...t,progress:e.progress}:t))},a.signal);if(!i)throw Error("Upload failed: No URL returned");if(!a.signal.aborted)return l(e=>e.map(e=>e.id===o?{...e,status:"success",url:i,progress:100}:e)),null==(n=e.onSuccess)||n.call(e,i),i;return null}catch(t){return a.signal.aborted||(l(e=>e.map(e=>e.id===o?{...e,status:"error",progress:0}:e)),null==(r=e.onError)||r.call(e,t instanceof Error?t:Error("Upload failed"))),null}};return{fileItems:t,uploadFiles:async t=>{var l,n;if(!t||0===t.length)return null==(l=e.onError)||l.call(e,Error("No files to upload")),[];if(e.limit&&t.length>e.limit)return null==(n=e.onError)||n.call(e,Error("Maximum ".concat(e.limit," file").concat(1===e.limit?"":"s"," allowed"))),[];let r=t.map(e=>i(e));return(await Promise.all(r)).filter(e=>null!==e)},removeFileItem:e=>{l(t=>{let l=t.find(t=>t.id===e);return(null==l?void 0:l.abortController)&&l.abortController.abort(),(null==l?void 0:l.url)&&URL.revokeObjectURL(l.url),t.filter(t=>t.id!==e)})},clearAllFiles:()=>{t.forEach(e=>{e.abortController&&e.abortController.abort(),e.url&&URL.revokeObjectURL(e.url)}),l([])}}}({maxSize:r,limit:l,accept:t,upload:o.options.upload,onSuccess:o.options.onSuccess,onError:o.options.onError}),p=async t=>{let l=await d(t);if(l.length>0){let i=e.getPos();if(eW(i)){let n=l.map((e,l)=>{var i;let n=(null==(i=t[l])?void 0:i.name.replace(/\.[^/.]+$/,""))||"unknown";return{type:o.options.type,attrs:{...o.options,src:e,alt:n,title:n}}});e.editor.chain().focus().deleteRange({from:i,to:i+e.node.nodeSize}).insertContentAt(i,n).run(),function(e){let{state:t,view:l}=e,{doc:i,selection:n}=t,r=eH.LN.findFrom(n.$to,1,!0);if(r)return l.dispatch(t.tr.setSelection(r).scrollIntoView());let a=t.schema.nodes.paragraph;if(!a)return console.warn("No paragraph node type found in schema.");let o=i.content.size,s=a.create(),d=t.tr.insert(o,s),c=d.doc.resolve(o+1);d=d.setSelection(eH.U3.near(c)).scrollIntoView(),l.dispatch(d)}(e.editor)}}},h=s.length>0;return(0,i.jsxs)(eb.VR,{className:"tiptap-image-upload",tabIndex:0,onClick:()=>{a.current&&0===s.length&&(a.current.value="",a.current.click())},children:[!h&&(0,i.jsx)(e8,{onFile:p,children:(0,i.jsx)(tt,{maxSize:r,limit:l})}),h&&(0,i.jsxs)("div",{className:"tiptap-image-upload-previews",children:[s.length>1&&(0,i.jsxs)("div",{className:"tiptap-image-upload-header",children:[(0,i.jsxs)("span",{children:["Uploading ",s.length," files"]}),(0,i.jsx)(e$,{type:"button","data-style":"ghost",onClick:e=>{e.stopPropagation(),u()},children:"Clear All"})]}),s.map(e=>(0,i.jsx)(te,{fileItem:e,onRemove:()=>c(e.id)},e.id))]}),(0,i.jsx)("input",{ref:a,name:"file",accept:t,type:"file",multiple:l>1,onChange:e=>{let t=e.target.files;if(!t||0===t.length){var l,i;null==(l=(i=o.options).onError)||l.call(i,Error("No file selected"));return}p(Array.from(t))},onClick:e=>e.stopPropagation()})]})},ti=e4.bP.create({name:"imageUpload",group:"block",draggable:!0,atom:!0,addOptions:()=>({type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}),addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML:()=>[{tag:'div[data-type="image-upload"]'}],renderHTML(e){let{HTMLAttributes:t}=e;return["div",(0,e4.KV)({"data-type":"image-upload"},t)]},addNodeView:()=>(0,eb.gu)(tl),addCommands(){return{setImageUploadNode:e=>t=>{let{commands:l}=t;return l.insertContent({type:this.name,attrs:e})}}},addKeyboardShortcuts:()=>({Enter:e=>{let{editor:t}=e,{selection:l}=t.state,{nodeAfter:i}=l.$from;if(i&&"imageUpload"===i.type.name&&t.isActive("imageUpload")){let e=t.view.nodeDOM(l.$from.pos);if(e&&e instanceof HTMLElement){let t=e.firstChild;if(t&&t instanceof HTMLElement)return t.click(),!0}}return!1}})}),tn=l(1341).A.extend({renderHTML(){return["div",(0,e4.KV)(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),tr=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})})});function ta(e){let{editor:t}=(0,eb.aA)(),l=n.useMemo(()=>e||t,[e,t]);return(0,eb.er)({editor:l,selector:e=>e.editor?{editor:e.editor,editorState:e.editor.state,canCommand:e.editor.can.bind(e.editor)}:{editor:null,editorState:void 0,canCommand:void 0}})||{editor:null}}tr.displayName="ChevronDownIcon",l(92490),l(92471),l(46889);let to=n.forwardRef((e,t)=>{let{variant:l,size:n="default",appearance:r="default",trimText:a=!1,className:o,children:s,...d}=e;return(0,i.jsx)("div",{ref:t,className:"tiptap-badge ".concat(o||""),"data-style":l,"data-size":n,"data-appearance":r,"data-text-trim":a?"on":"off",...d,children:s})});function ts(e){let{level:t,shortcutKeys:l=tf[t]}=e;return(0,i.jsx)(to,{children:eV({shortcutKeys:l})})}to.displayName="Badge";let td=n.forwardRef((e,t)=>{let{editor:l,level:r,text:a,hideWhenUnavailable:o=!1,onToggled:s,showShortcut:d=!1,onClick:c,children:u,...p}=e,{editor:h}=ta(l),{isVisible:m,canToggle:g,isActive:x,handleToggle:f,label:v,Icon:C,shortcutKeys:y}=function(e){let{editor:t,level:l,hideWhenUnavailable:i=!1,onToggled:r}=e,{editor:a}=ta(t),[o,s]=n.useState(!0),d=tv(a,l),c=tC(a,l);return n.useEffect(()=>{if(!a)return;let e=()=>{s(ty({editor:a,level:l,hideWhenUnavailable:i}))};return e(),a.on("selectionUpdate",e),()=>{a.off("selectionUpdate",e)}},[a,l,i]),{isVisible:o,isActive:c,handleToggle:n.useCallback(()=>{if(!a)return!1;let e=function(e,t){if(!e||!e.isEditable)return!1;let l=Array.isArray(t)?t:[t],i=l.find(t=>tv(e,t));if(!i)return!1;try{var n,r,a;let t=e.view,o=t.state,s=o.tr;if(o.selection.empty||o.selection instanceof eH.U3){let l=null==(n=eq({editor:e,node:o.selection.$anchor.node(1)}))?void 0:n.pos;if(!eW(l))return!1;s=s.setSelection(eH.nh.create(o.doc,l)),t.dispatch(s),o=t.state}let d=o.selection,c=e.chain().focus();if(d instanceof eH.nh){let e=null==(r=d.node.firstChild)?void 0:r.firstChild,t=null==(a=d.node.lastChild)?void 0:a.lastChild,l=e?d.from+e.nodeSize:d.from+1,i=t?d.to-t.nodeSize:d.to-1;c=c.setTextSelection({from:l,to:i}).clearNodes()}return(l.some(t=>e.isActive("heading",{level:t}))?c.setNode("paragraph"):c.setNode("heading",{level:i})).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch(e){return!1}}(a,l);return e&&(null==r||r()),e},[a,l,r]),canToggle:d,label:"Heading ".concat(l),shortcutKeys:tf[l],Icon:tx[l]}}({editor:h,level:r,hideWhenUnavailable:o,onToggled:s}),j=n.useCallback(e=>{null==c||c(e),e.defaultPrevented||f()},[f,c]);return m?(0,i.jsx)(e$,{type:"button","data-style":"ghost","data-active-state":x?"on":"off",role:"button",tabIndex:-1,disabled:!g,"data-disabled":!g,"aria-label":v,"aria-pressed":x,tooltip:v,onClick:j,...p,ref:t,children:null!=u?u:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{className:"tiptap-button-icon"}),a&&(0,i.jsx)("span",{className:"tiptap-button-text",children:a}),d&&(0,i.jsx)(ts,{level:r,shortcutKeys:y})]})}):null});td.displayName="HeadingButton";let tc=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]})});tc.displayName="HeadingOneIcon";let tu=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]})});tu.displayName="HeadingTwoIcon";let tp=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]})});tp.displayName="HeadingThreeIcon";let th=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]})});th.displayName="HeadingFourIcon";let tm=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]})});tm.displayName="HeadingFiveIcon";let tg=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]})});tg.displayName="HeadingSixIcon";let tx={1:tc,2:tu,3:tp,4:th,5:tm,6:tg},tf={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function tv(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!e||!e.isEditable||!eG("heading",e)||eZ(e,["image"]))return!1;if(!l)return t?e.can().setNode("heading",{level:t}):e.can().setNode("heading");try{let t=e.view.state,l=t.selection;if(l.empty||l instanceof eH.U3){var i;let l=null==(i=eq({editor:e,node:t.selection.$anchor.node(1)}))?void 0:i.pos;if(!eW(l))return!1}return!0}catch(e){return!1}}function tC(e,t){return!!e&&!!e.isEditable&&(Array.isArray(t)?t.some(t=>e.isActive("heading",{level:t})):t?e.isActive("heading",{level:t}):e.isActive("heading"))}function ty(e){let{editor:t,level:l,hideWhenUnavailable:i}=e;return!!t&&!!t.isEditable&&!!eG("heading",t)&&(!i||!!t.isActive("code")||(Array.isArray(l)?l.some(e=>tv(t,e)):tv(t,l)))}var tj=l(11534);function tb(e){let{...t}=e;return(0,i.jsx)(tj.bL,{modal:!1,...t})}function tw(e){let{...t}=e;return(0,i.jsx)(tj.ZL,{...t})}l(33977);let tk=n.forwardRef((e,t)=>{let{...l}=e;return(0,i.jsx)(tj.l9,{ref:t,...l})});tk.displayName=tj.l9.displayName,tj.YJ,tj.Pb,tj.z6;let tT=tj.q7;tj.ZP,n.forwardRef((e,t)=>{let{className:l,portal:n=!0,...r}=e,a=(0,i.jsx)(tj.G5,{ref:t,className:eF("tiptap-dropdown-menu",l),...r});return n?(0,i.jsx)(tw,{..."object"==typeof n?n:{},children:a}):a}).displayName=tj.G5.displayName;let tS=n.forwardRef((e,t)=>{let{className:l,sideOffset:n=4,portal:r=!1,...a}=e,o=(0,i.jsx)(tj.UC,{ref:t,sideOffset:n,onCloseAutoFocus:e=>e.preventDefault(),className:eF("tiptap-dropdown-menu",l),...a});return r?(0,i.jsx)(tw,{..."object"==typeof r?r:{},children:o}):o});tS.displayName=tj.UC.displayName,l(21315);let tA=n.forwardRef((e,t)=>{let{className:l,...n}=e;return(0,i.jsx)("div",{ref:t,className:eF("tiptap-card",l),...n})});tA.displayName="Card",n.forwardRef((e,t)=>{let{className:l,...n}=e;return(0,i.jsx)("div",{ref:t,className:eF("tiptap-card-header",l),...n})}).displayName="CardHeader";let tz=n.forwardRef((e,t)=>{let{className:l,...n}=e;return(0,i.jsx)("div",{ref:t,className:eF("tiptap-card-body",l),...n})});tz.displayName="CardBody";let tL=n.forwardRef((e,t)=>{let{className:l,orientation:n="vertical",...r}=e;return(0,i.jsx)("div",{ref:t,"data-orientation":n,className:eF("tiptap-card-item-group",l),...r})});tL.displayName="CardItemGroup",n.forwardRef((e,t)=>{let{className:l,...n}=e;return(0,i.jsx)("div",{ref:t,className:eF("tiptap-card-group-label",l),...n})}).displayName="CardGroupLabel",n.forwardRef((e,t)=>{let{className:l,...n}=e;return(0,i.jsx)("div",{ref:t,className:eF("tiptap-card-footer",l),...n})}).displayName="CardFooter";let tE=n.forwardRef((e,t)=>{let{editor:l,levels:r=[1,2,3,4,5,6],hideWhenUnavailable:a=!1,portal:o=!1,onOpenChange:s,...d}=e,{editor:c}=ta(l),[u,p]=n.useState(!1),{isVisible:h,isActive:m,canToggle:g,Icon:x}=function(e){let{editor:t,levels:l=[1,2,3,4,5,6],hideWhenUnavailable:i=!1}=e||{},{editor:r}=ta(t),[a,o]=n.useState(!0),s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,2,3,4,5,6];if(e&&e.isEditable)return t.find(t=>tC(e,t))}(r,l),d=tC(r),c=tv(r);return n.useEffect(()=>{if(!r)return;let e=()=>{o(ty({editor:r,hideWhenUnavailable:i,level:l}))};return e(),r.on("selectionUpdate",e),()=>{r.off("selectionUpdate",e)}},[r,i,l]),{isVisible:a,activeLevel:s,isActive:d,canToggle:c,levels:l,label:"Heading",Icon:s?tx[s]:tI}}({editor:c,levels:r,hideWhenUnavailable:a}),f=n.useCallback(e=>{c&&g&&(p(e),null==s||s(e))},[g,c,s]);return h?(0,i.jsxs)(tb,{modal:!0,open:u,onOpenChange:f,children:[(0,i.jsx)(tk,{asChild:!0,children:(0,i.jsxs)(e$,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!g,"data-disabled":!g,"aria-label":"Format text as heading","aria-pressed":m,tooltip:"Heading",...d,ref:t,children:[(0,i.jsx)(x,{className:"tiptap-button-icon"}),(0,i.jsx)(tr,{className:"tiptap-button-dropdown-small"})]})}),(0,i.jsx)(tS,{align:"start",portal:o,children:(0,i.jsx)(tA,{children:(0,i.jsx)(tz,{children:(0,i.jsxs)(eY,{children:[(0,i.jsx)(tT,{asChild:!0,children:(0,i.jsx)(e$,{type:"button","data-style":"ghost","data-active-state":(null==c?void 0:c.isActive("paragraph"))?"on":"off",onClick:()=>null==c?void 0:c.chain().focus().setParagraph().run(),disabled:!(null==c?void 0:c.can().setParagraph()),children:(0,i.jsx)("span",{className:"tiptap-button-text",children:"Paragraph"})})}),r.map(e=>(0,i.jsx)(tT,{asChild:!0,children:(0,i.jsx)(td,{editor:c,level:e,text:"Heading ".concat(e),showTooltip:!1})},"heading-".concat(e)))]})})})})]}):null});tE.displayName="HeadingDropdownMenu";let tI=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})})});function tR(e){let{shortcutKeys:t=tH}=e;return(0,i.jsx)(to,{children:eV({shortcutKeys:t})})}tI.displayName="HeadingIcon";let tM=n.forwardRef((e,t)=>{let{editor:l,text:r,hideWhenUnavailable:a=!1,onInserted:o,showShortcut:s=!1,onClick:d,children:c,...u}=e,{editor:p}=ta(l),{isVisible:h,canInsert:m,handleImage:g,label:x,isActive:f,shortcutKeys:v,Icon:C}=function(e){let{editor:t,hideWhenUnavailable:l=!1,onInserted:i}=e||{},{editor:r}=ta(t),a=tN(),[o,s]=n.useState(!0),d=tD(r),c=!!r&&!!r.isEditable&&r.isActive("imageUpload");n.useEffect(()=>{if(!r)return;let e=()=>{s(function(e){let{editor:t,hideWhenUnavailable:l}=e;return!!t&&!!t.isEditable&&!!e_(t,"imageUpload")&&(!l||!!t.isActive("code")||tD(t))}({editor:r,hideWhenUnavailable:l}))};return e(),r.on("selectionUpdate",e),()=>{r.off("selectionUpdate",e)}},[r,l]);let u=n.useCallback(()=>{if(!r)return!1;let e=function(e){if(!e||!e.isEditable||!tD(e))return!1;try{return e.chain().focus().insertContent({type:"imageUpload"}).run()}catch(e){return!1}}(r);return e&&(null==i||i()),e},[r,i]);return(0,tP.vC)(tH,e=>{e.preventDefault(),u()},{enabled:o&&d,enableOnContentEditable:!a,enableOnFormTags:!0}),{isVisible:o,isActive:c,handleImage:u,canInsert:d,label:"Add image",shortcutKeys:tH,Icon:tB}}({editor:p,hideWhenUnavailable:a,onInserted:o}),y=n.useCallback(e=>{null==d||d(e),e.defaultPrevented||g()},[g,d]);return h?(0,i.jsx)(e$,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":x,"aria-pressed":f,tooltip:x,onClick:y,...u,ref:t,children:null!=c?c:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{className:"tiptap-button-icon"}),r&&(0,i.jsx)("span",{className:"tiptap-button-text",children:r}),s&&(0,i.jsx)(tR,{shortcutKeys:v})]})}):null});tM.displayName="ImageUploadButton";var tP=l(22540);function tN(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,l]=n.useState(void 0);return n.useEffect(()=>{let t=window.matchMedia("(max-width: ".concat(e-1,"px)")),i=()=>{l(window.innerWidth<e)};return t.addEventListener("change",i),l(window.innerWidth<e),()=>t.removeEventListener("change",i)},[e]),!!t}let tB=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})})});tB.displayName="ImagePlusIcon";let tH="mod+shift+i";function tD(e){return!(!e||!e.isEditable||!e_(e,"imageUpload")||eZ(e,["image"]))&&e.can().insertContent({type:"imageUpload"})}function tF(e){let{type:t,shortcutKeys:l=tq[t]}=e;return(0,i.jsx)(to,{children:eV({shortcutKeys:l})})}let tU=n.forwardRef((e,t)=>{let{editor:l,type:r,text:a,hideWhenUnavailable:o=!1,onToggled:s,showShortcut:d=!1,onClick:c,children:u,...p}=e,{editor:h}=ta(l),{isVisible:m,canToggle:g,isActive:x,handleToggle:f,label:v,shortcutKeys:C,Icon:y}=function(e){let{editor:t,type:l,hideWhenUnavailable:i=!1,onToggled:r}=e,{editor:a}=ta(t),[o,s]=n.useState(!0),d=tZ(a,l),c=tQ(a,l);return n.useEffect(()=>{if(!a)return;let e=()=>{s(function(e){let{editor:t,type:l,hideWhenUnavailable:i}=e;return!!t&&!!t.isEditable&&!!eG(l,t)&&(!i||!!t.isActive("code")||tZ(t,l))}({editor:a,type:l,hideWhenUnavailable:i}))};return e(),a.on("selectionUpdate",e),()=>{a.off("selectionUpdate",e)}},[a,l,i]),{isVisible:o,isActive:c,handleToggle:n.useCallback(()=>{if(!a)return!1;let e=function(e,t){if(!e||!e.isEditable||!tZ(e,t))return!1;try{var l,i,n;let r=e.view,a=r.state,o=a.tr;if(a.selection.empty||a.selection instanceof eH.U3){let t=null==(l=eq({editor:e,node:a.selection.$anchor.node(1)}))?void 0:l.pos;if(!eW(t))return!1;o=o.setSelection(eH.nh.create(a.doc,t)),r.dispatch(o),a=r.state}let s=a.selection,d=e.chain().focus();if(s instanceof eH.nh){let e=null==(i=s.node.firstChild)?void 0:i.firstChild,t=null==(n=s.node.lastChild)?void 0:n.lastChild,l=e?s.from+e.nodeSize:s.from+1,r=t?s.to-t.nodeSize:s.to-1;d=d.setTextSelection({from:l,to:r}).clearNodes()}if(e.isActive(t))d.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{let e={bulletList:()=>d.toggleBulletList(),orderedList:()=>d.toggleOrderedList(),taskList:()=>d.toggleList("taskList","taskItem")}[t];if(!e)return!1;e().run()}return e.chain().focus().selectTextblockEnd().run(),!0}catch(e){return!1}}(a,l);return e&&(null==r||r()),e},[a,l,r]),canToggle:d,label:t_[l],shortcutKeys:tq[l],Icon:tW[l]}}({editor:h,type:r,hideWhenUnavailable:o,onToggled:s}),j=n.useCallback(e=>{null==c||c(e),e.defaultPrevented||f()},[f,c]);return m?(0,i.jsx)(e$,{type:"button","data-style":"ghost","data-active-state":x?"on":"off",role:"button",tabIndex:-1,disabled:!g,"data-disabled":!g,"aria-label":v,"aria-pressed":x,tooltip:v,onClick:j,...p,ref:t,children:null!=u?u:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(y,{className:"tiptap-button-icon"}),a&&(0,i.jsx)("span",{className:"tiptap-button-text",children:a}),d&&(0,i.jsx)(tF,{type:r,shortcutKeys:C})]})}):null});tU.displayName="ListButton";let tV=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]})});tV.displayName="ListIcon";let tO=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]})});tO.displayName="ListOrderedIcon";let tG=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]})});tG.displayName="ListTodoIcon";let tW={bulletList:tV,orderedList:tO,taskList:tG},t_={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},tq={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function tZ(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!e||!e.isEditable||!eG(t,e)||eZ(e,["image"]))return!1;if(!l)switch(t){case"bulletList":return e.can().toggleBulletList();case"orderedList":return e.can().toggleOrderedList();case"taskList":return e.can().toggleList("taskList","taskItem");default:return!1}try{let t=e.view.state,l=t.selection;if(l.empty||l instanceof eH.U3){var i;let l=null==(i=eq({editor:e,node:t.selection.$anchor.node(1)}))?void 0:i.pos;if(!eW(l))return!1}return!0}catch(e){return!1}}function tQ(e,t){if(!e||!e.isEditable)return!1;switch(t){case"bulletList":return e.isActive("bulletList");case"orderedList":return e.isActive("orderedList");case"taskList":return e.isActive("taskList");default:return!1}}let tK=[{label:"Bullet List",type:"bulletList",icon:tV},{label:"Ordered List",type:"orderedList",icon:tO},{label:"Task List",type:"taskList",icon:tG}];function tJ(e){let{editor:t,types:l=["bulletList","orderedList","taskList"],hideWhenUnavailable:r=!1,onOpenChange:a,portal:o=!1,...s}=e,{editor:d}=ta(t),[c,u]=n.useState(!1),{filteredLists:p,canToggle:h,isActive:m,isVisible:g,Icon:x}=function(e){let{editor:t,types:l=["bulletList","orderedList","taskList"],hideWhenUnavailable:i=!1}=e||{},{editor:r}=ta(t),[a,o]=n.useState(!1),s=l.some(e=>eG(e,r)),d=n.useMemo(()=>tK.filter(e=>!e.type||l.includes(e.type)),[l]),c=!!r&&!!r.isEditable&&l.some(e=>tZ(r,e)),u=!!r&&!!r.isEditable&&l.some(e=>tQ(r,e)),p=function(e,t){if(e&&e.isEditable)return t.find(t=>tQ(e,t))}(r,l),h=d.find(e=>e.type===p);return n.useEffect(()=>{if(!r)return;let e=()=>{o(function(e){let{editor:t,hideWhenUnavailable:l,listInSchema:i,canToggleAny:n}=e;return!!i&&!!t&&(!l||!!t.isActive("code")||n)}({editor:r,listTypes:l,hideWhenUnavailable:i,listInSchema:s,canToggleAny:c}))};return e(),r.on("selectionUpdate",e),()=>{r.off("selectionUpdate",e)}},[c,r,i,s,l]),{isVisible:a,activeType:p,isActive:u,canToggle:c,types:l,filteredLists:d,label:"List",Icon:h?tW[h.type]:tV}}({editor:d,types:l,hideWhenUnavailable:r}),f=n.useCallback(e=>{u(e),null==a||a(e)},[a]);return g&&d&&d.isEditable?(0,i.jsxs)(tb,{open:c,onOpenChange:f,children:[(0,i.jsx)(tk,{asChild:!0,children:(0,i.jsxs)(e$,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":"List options",tooltip:"List",...s,children:[(0,i.jsx)(x,{className:"tiptap-button-icon"}),(0,i.jsx)(tr,{className:"tiptap-button-dropdown-small"})]})}),(0,i.jsx)(tS,{align:"start",portal:o,children:(0,i.jsx)(tA,{children:(0,i.jsx)(tz,{children:(0,i.jsx)(eY,{children:p.map(e=>(0,i.jsx)(tT,{asChild:!0,children:(0,i.jsx)(tU,{editor:d,type:e.type,text:e.label,showTooltip:!1})},e.type))})})})})]}):null}function t$(e){let{shortcutKeys:t=t1}=e;return(0,i.jsx)(to,{children:eV({shortcutKeys:t})})}let tY=n.forwardRef((e,t)=>{let{editor:l,text:r,hideWhenUnavailable:a=!1,onToggled:o,showShortcut:s=!1,onClick:d,children:c,...u}=e,{editor:p}=ta(l),{isVisible:h,canToggle:m,isActive:g,handleToggle:x,label:f,shortcutKeys:v,Icon:C}=function(e){let{editor:t,hideWhenUnavailable:l=!1,onToggled:i}=e||{},{editor:r}=ta(t),[a,o]=n.useState(!0),s=t0(r),d=(null==r?void 0:r.isActive("blockquote"))||!1;return n.useEffect(()=>{if(!r)return;let e=()=>{o(function(e){let{editor:t,hideWhenUnavailable:l}=e;return!!t&&!!t.isEditable&&!!eG("blockquote",t)&&(!l||!!t.isActive("code")||t0(t))}({editor:r,hideWhenUnavailable:l}))};return e(),r.on("selectionUpdate",e),()=>{r.off("selectionUpdate",e)}},[r,l]),{isVisible:a,isActive:d,handleToggle:n.useCallback(()=>{if(!r)return!1;let e=function(e){if(!e||!e.isEditable||!t0(e))return!1;try{var t,l,i;let n=e.view,r=n.state,a=r.tr;if(r.selection.empty||r.selection instanceof eH.U3){let l=null==(t=eq({editor:e,node:r.selection.$anchor.node(1)}))?void 0:t.pos;if(!eW(l))return!1;a=a.setSelection(eH.nh.create(r.doc,l)),n.dispatch(a),r=n.state}let o=r.selection,s=e.chain().focus();if(o instanceof eH.nh){let e=null==(l=o.node.firstChild)?void 0:l.firstChild,t=null==(i=o.node.lastChild)?void 0:i.lastChild,n=e?o.from+e.nodeSize:o.from+1,r=t?o.to-t.nodeSize:o.to-1;s=s.setTextSelection({from:n,to:r}).clearNodes()}return(e.isActive("blockquote")?s.lift("blockquote"):s.wrapIn("blockquote")).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch(e){return!1}}(r);return e&&(null==i||i()),e},[r,i]),canToggle:s,label:"Blockquote",shortcutKeys:t1,Icon:tX}}({editor:p,hideWhenUnavailable:a,onToggled:o}),y=n.useCallback(e=>{null==d||d(e),e.defaultPrevented||x()},[x,d]);return h?(0,i.jsx)(e$,{type:"button","data-style":"ghost","data-active-state":g?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":f,"aria-pressed":g,tooltip:"Blockquote",onClick:y,...u,ref:t,children:null!=c?c:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{className:"tiptap-button-icon"}),r&&(0,i.jsx)("span",{className:"tiptap-button-text",children:r}),s&&(0,i.jsx)(t$,{shortcutKeys:v})]})}):null});tY.displayName="BlockquoteButton";let tX=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]})});tX.displayName="BlockquoteIcon";let t1="mod+shift+b";function t0(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!e||!e.isEditable||!eG("blockquote",e)||eZ(e,["image"]))return!1;if(!t)return e.can().toggleWrap("blockquote");try{let t=e.view.state,i=t.selection;if(i.empty||i instanceof eH.U3){var l;let i=null==(l=eq({editor:e,node:t.selection.$anchor.node(1)}))?void 0:l.pos;if(!eW(i))return!1}return!0}catch(e){return!1}}function t2(e){let{shortcutKeys:t=t5}=e;return(0,i.jsx)(to,{children:eV({shortcutKeys:t})})}let t7=n.forwardRef((e,t)=>{let{editor:l,text:r,hideWhenUnavailable:a=!1,onToggled:o,showShortcut:s=!1,onClick:d,children:c,...u}=e,{editor:p}=ta(l),{isVisible:h,canToggle:m,isActive:g,handleToggle:x,label:f,shortcutKeys:v,Icon:C}=function(e){let{editor:t,hideWhenUnavailable:l=!1,onToggled:i}=e||{},{editor:r}=ta(t),[a,o]=n.useState(!0),s=t9(r),d=(null==r?void 0:r.isActive("codeBlock"))||!1;return n.useEffect(()=>{if(!r)return;let e=()=>{o(function(e){let{editor:t,hideWhenUnavailable:l}=e;return!!t&&!!t.isEditable&&!!eG("codeBlock",t)&&(!l||!!t.isActive("code")||t9(t))}({editor:r,hideWhenUnavailable:l}))};return e(),r.on("selectionUpdate",e),()=>{r.off("selectionUpdate",e)}},[r,l]),{isVisible:a,isActive:d,handleToggle:n.useCallback(()=>{if(!r)return!1;let e=function(e){if(!e||!e.isEditable||!t9(e))return!1;try{var t,l,i;let n=e.view,r=n.state,a=r.tr;if(r.selection.empty||r.selection instanceof eH.U3){let l=null==(t=eq({editor:e,node:r.selection.$anchor.node(1)}))?void 0:t.pos;if(!eW(l))return!1;a=a.setSelection(eH.nh.create(r.doc,l)),n.dispatch(a),r=n.state}let o=r.selection,s=e.chain().focus();if(o instanceof eH.nh){let e=null==(l=o.node.firstChild)?void 0:l.firstChild,t=null==(i=o.node.lastChild)?void 0:i.lastChild,n=e?o.from+e.nodeSize:o.from+1,r=t?o.to-t.nodeSize:o.to-1;s=s.setTextSelection({from:n,to:r}).clearNodes()}return(e.isActive("codeBlock")?s.setNode("paragraph"):s.toggleNode("codeBlock","paragraph")).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch(e){return!1}}(r);return e&&(null==i||i()),e},[r,i]),canToggle:s,label:"Code Block",shortcutKeys:t5,Icon:t4}}({editor:p,hideWhenUnavailable:a,onToggled:o}),y=n.useCallback(e=>{null==d||d(e),e.defaultPrevented||x()},[x,d]);return h?(0,i.jsx)(e$,{type:"button","data-style":"ghost","data-active-state":g?"on":"off",role:"button",disabled:!m,"data-disabled":!m,tabIndex:-1,"aria-label":f,"aria-pressed":g,tooltip:"Code Block",onClick:y,...u,ref:t,children:null!=c?c:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{className:"tiptap-button-icon"}),r&&(0,i.jsx)("span",{className:"tiptap-button-text",children:r}),s&&(0,i.jsx)(t2,{shortcutKeys:v})]})}):null});t7.displayName="CodeBlockButton";let t4=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]})});t4.displayName="CodeBlockIcon";let t5="mod+alt+c";function t9(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!e||!e.isEditable||!eG("codeBlock",e)||eZ(e,["image"]))return!1;if(!t)return e.can().toggleNode("codeBlock","paragraph");try{let t=e.view.state,i=t.selection;if(i.empty||i instanceof eH.U3){var l;let i=null==(l=eq({editor:e,node:t.selection.$anchor.node(1)}))?void 0:l.pos;if(!eW(i))return!1}return!0}catch(e){return!1}}let t3=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})})});t3.displayName="CornerDownLeftIcon";let t6=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]})});t6.displayName="ExternalLinkIcon";let t8=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]})});t8.displayName="LinkIcon";let le=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})})});le.displayName="TrashIcon";var lt=l(37193);function ll(e){let{...t}=e;return(0,i.jsx)(lt.bL,{...t})}function li(e){let{...t}=e;return(0,i.jsx)(lt.l9,{...t})}function ln(e){let{className:t,align:l="center",sideOffset:n=4,...r}=e;return(0,i.jsx)(lt.ZL,{children:(0,i.jsx)(lt.UC,{align:l,sideOffset:n,className:eF("tiptap-popover",t),...r})})}function lr(e){let{className:t,type:l,...n}=e;return(0,i.jsx)("input",{type:l,className:eF("tiptap-input",t),...n})}function la(e){let{className:t,children:l,...n}=e;return(0,i.jsx)("div",{className:eF("tiptap-input-group",t),...n,children:l})}l(7609),l(66321);let lo=n.forwardRef((e,t)=>{let{className:l,children:n,...r}=e;return(0,i.jsx)(e$,{type:"button",className:l,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:t,...r,children:n||(0,i.jsx)(t8,{className:"tiptap-button-icon"})})});lo.displayName="LinkButton";let ls=e=>{let{url:t,setUrl:l,setLink:n,removeLink:r,openLink:a,isActive:o}=e,s=tN();return(0,i.jsx)(tA,{style:{...s?{boxShadow:"none",border:0}:{}},children:(0,i.jsx)(tz,{style:{...s?{padding:0}:{}},children:(0,i.jsxs)(tL,{orientation:"horizontal",children:[(0,i.jsx)(la,{children:(0,i.jsx)(lr,{type:"url",placeholder:"Paste a link...",value:t,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),n())},autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),(0,i.jsx)(eY,{orientation:"horizontal",children:(0,i.jsx)(e$,{type:"button",onClick:n,title:"Apply link",disabled:!t&&!o,"data-style":"ghost",children:(0,i.jsx)(t3,{className:"tiptap-button-icon"})})}),(0,i.jsx)(eX,{}),(0,i.jsxs)(eY,{orientation:"horizontal",children:[(0,i.jsx)(e$,{type:"button",onClick:a,title:"Open in new window",disabled:!t&&!o,"data-style":"ghost",children:(0,i.jsx)(t6,{className:"tiptap-button-icon"})}),(0,i.jsx)(e$,{type:"button",onClick:r,title:"Remove link",disabled:!t&&!o,"data-style":"ghost",children:(0,i.jsx)(le,{className:"tiptap-button-icon"})})]})]})})})},ld=e=>{let{editor:t}=e,l=lh({editor:t});return(0,i.jsx)(ls,{...l})},lc=n.forwardRef((e,t)=>{let{editor:l,hideWhenUnavailable:r=!1,onSetLink:a,onOpenChange:o,autoOpenOnLinkActive:s=!0,onClick:d,children:c,...u}=e,{editor:p}=ta(l),[h,m]=n.useState(!1),{isVisible:g,canSet:x,isActive:f,url:v,setUrl:C,setLink:y,removeLink:j,openLink:b,label:w,Icon:k}=lh({editor:p,hideWhenUnavailable:r,onSetLink:a}),T=n.useCallback(e=>{m(e),null==o||o(e)},[o]),S=n.useCallback(()=>{y(),m(!1)},[y]),A=n.useCallback(e=>{null==d||d(e),e.defaultPrevented||m(!h)},[d,h]);return(n.useEffect(()=>{s&&f&&m(!0)},[s,f]),g)?(0,i.jsxs)(ll,{open:h,onOpenChange:T,children:[(0,i.jsx)(li,{asChild:!0,children:(0,i.jsx)(lo,{disabled:!x,"data-active-state":f?"on":"off","data-disabled":!x,"aria-label":w,"aria-pressed":f,onClick:A,...u,ref:t,children:null!=c?c:(0,i.jsx)(k,{className:"tiptap-button-icon"})})}),(0,i.jsx)(ln,{children:(0,i.jsx)(ls,{url:v,setUrl:C,setLink:S,removeLink:j,openLink:b,isActive:f})})]}):null});function lu(e){return!!e&&!!e.isEditable&&e.can().setMark("link")}function lp(e){return!!e&&!!e.isEditable&&e.isActive("link")}function lh(e){let{editor:t,hideWhenUnavailable:l=!1,onSetLink:i}=e||{},{editor:r}=ta(t),{isVisible:a,canSet:o,isActive:s}=function(e){let{editor:t,hideWhenUnavailable:l=!1}=e,i=lu(t),r=lp(t),[a,o]=n.useState(!1);return n.useEffect(()=>{if(!t)return;let e=()=>{o(function(e){let{editor:t,hideWhenUnavailable:l}=e;return!!eO("link",t)&&!!t&&(!l||!!t.isActive("code")||lu(t))}({editor:t,hideWhenUnavailable:l}))};return e(),t.on("selectionUpdate",e),()=>{t.off("selectionUpdate",e)}},[t,l]),{isVisible:a,canSet:i,isActive:r}}({editor:r,hideWhenUnavailable:l});return{isVisible:a,canSet:o,isActive:s,label:"Link",Icon:t8,...function(e){let{editor:t,onSetLink:l}=e,[i,r]=n.useState(null);n.useEffect(()=>{if(!t)return;let{href:e}=t.getAttributes("link");lp(t)&&null===i&&r(e||"")},[t,i]),n.useEffect(()=>{if(!t)return;let e=()=>{let{href:e}=t.getAttributes("link");r(e||"")};return t.on("selectionUpdate",e),()=>{t.off("selectionUpdate",e)}},[t]);let a=n.useCallback(()=>{if(!i||!t)return;let{selection:e}=t.state,n=e.empty,a=t.chain().focus();a=a.extendMarkRange("link").setLink({href:i}),n&&(a=a.insertContent({type:"text",text:i})),a.run(),r(null),null==l||l()},[t,l,i]),o=n.useCallback(()=>{t&&(t.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),r(""))},[t]),s=n.useCallback(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"_blank",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"noopener,noreferrer";if(!i)return;let l=function(e,t,l){try{let l=new URL(e,t);if(function(e,t){let l=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&l.push(t)}),!e||e.replace(eK,"").match(RegExp("^(?:(?:".concat(l.join("|"),"):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))"),"i"))}(l.href,void 0))return l.href}catch(e){}return"#"}(i,window.location.href);"#"!==l&&window.open(l,e,t)},[i]);return{url:i||"",setUrl:r,setLink:a,removeLink:o,openLink:s}}({editor:r,onSetLink:i})}}function lm(e){let{type:t,shortcutKeys:l=lk[t]}=e;return(0,i.jsx)(to,{children:eV({shortcutKeys:l})})}lc.displayName="LinkPopover";let lg=n.forwardRef((e,t)=>{let{editor:l,type:r,text:a,hideWhenUnavailable:o=!1,onToggled:s,showShortcut:d=!1,onClick:c,children:u,...p}=e,{editor:h}=ta(l),{isVisible:m,handleMark:g,label:x,canToggle:f,isActive:v,Icon:C,shortcutKeys:y}=function(e){let{editor:t,type:l,hideWhenUnavailable:i=!1,onToggled:r}=e,{editor:a}=ta(t),[o,s]=n.useState(!0),d=lT(a,l),c=!!a&&!!a.isEditable&&a.isActive(l);return n.useEffect(()=>{if(!a)return;let e=()=>{s(function(e){let{editor:t,type:l,hideWhenUnavailable:i}=e;return!!t&&!!t.isEditable&&!!eO(l,t)&&(!i||!!t.isActive("code")||lT(t,l))}({editor:a,type:l,hideWhenUnavailable:i}))};return e(),a.on("selectionUpdate",e),()=>{a.off("selectionUpdate",e)}},[a,l,i]),{isVisible:o,isActive:c,handleMark:n.useCallback(()=>{if(!a)return!1;let e=!!a&&!!a.isEditable&&!!lT(a,l)&&a.chain().focus().toggleMark(l).run();return e&&(null==r||r()),e},[a,l,r]),canToggle:d,label:l.charAt(0).toUpperCase()+l.slice(1),shortcutKeys:lk[l],Icon:lw[l]}}({editor:h,type:r,hideWhenUnavailable:o,onToggled:s}),j=n.useCallback(e=>{null==c||c(e),e.defaultPrevented||g()},[g,c]);return m?(0,i.jsx)(e$,{type:"button",disabled:!f,"data-style":"ghost","data-active-state":v?"on":"off","data-disabled":!f,role:"button",tabIndex:-1,"aria-label":x,"aria-pressed":v,tooltip:x,onClick:j,...p,ref:t,children:null!=u?u:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{className:"tiptap-button-icon"}),a&&(0,i.jsx)("span",{className:"tiptap-button-text",children:a}),d&&(0,i.jsx)(lm,{type:r,shortcutKeys:y})]})}):null});lg.displayName="MarkButton";let lx=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})})});lx.displayName="BoldIcon";let lf=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]})});lf.displayName="Code2Icon";let lv=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})})});lv.displayName="ItalicIcon";let lC=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]})});lC.displayName="StrikeIcon";let ly=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]})});ly.displayName="SubscriptIcon";let lj=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsxs)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]})});lj.displayName="SuperscriptIcon";let lb=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})})});lb.displayName="UnderlineIcon";let lw={bold:lx,italic:lv,underline:lb,strike:lC,code:lf,superscript:lj,subscript:ly},lk={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function lT(e,t){return!(!e||!e.isEditable||!eO(t,e)||eZ(e,["image"]))&&e.can().toggleMark(t)}function lS(e){let{action:t,shortcutKeys:l=lE[t]}=e;return(0,i.jsx)(to,{children:eV({shortcutKeys:l})})}let lA=n.forwardRef((e,t)=>{let{editor:l,action:r,text:a,hideWhenUnavailable:o=!1,onExecuted:s,showShortcut:d=!1,onClick:c,children:u,...p}=e,{editor:h}=ta(l),{isVisible:m,handleAction:g,label:x,canExecute:f,Icon:v,shortcutKeys:C}=function(e){let{editor:t,action:l,hideWhenUnavailable:i=!1,onExecuted:r}=e,{editor:a}=ta(t),[o,s]=n.useState(!0),d=lM(a,l);return n.useEffect(()=>{if(!a)return;let e=()=>{s(function(e){let{editor:t,hideWhenUnavailable:l,action:i}=e;return!!t&&!!t.isEditable&&(!l||!!t.isActive("code")||lM(t,i))}({editor:a,hideWhenUnavailable:i,action:l}))};return e(),a.on("transaction",e),()=>{a.off("transaction",e)}},[a,i,l]),{isVisible:o,handleAction:n.useCallback(()=>{if(!a)return!1;let e=function(e,t){if(!e||!e.isEditable||!lM(e,t))return!1;let l=e.chain().focus();return"undo"===t?l.undo().run():l.redo().run()}(a,l);return e&&(null==r||r()),e},[a,l,r]),canExecute:d,label:lI[l],shortcutKeys:lE[l],Icon:lR[l]}}({editor:h,action:r,hideWhenUnavailable:o,onExecuted:s}),y=n.useCallback(e=>{null==c||c(e),e.defaultPrevented||g()},[g,c]);return m?(0,i.jsx)(e$,{type:"button",disabled:!f,"data-style":"ghost","data-disabled":!f,role:"button",tabIndex:-1,"aria-label":x,tooltip:x,onClick:y,...p,ref:t,children:null!=u?u:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v,{className:"tiptap-button-icon"}),a&&(0,i.jsx)("span",{className:"tiptap-button-text",children:a}),d&&(0,i.jsx)(lS,{action:r,shortcutKeys:C})]})}):null});lA.displayName="UndoRedoButton";let lz=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})})});lz.displayName="Redo2Icon";let lL=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})})});lL.displayName="Undo2Icon";let lE={undo:"mod+z",redo:"mod+shift+z"},lI={undo:"Undo",redo:"Redo"},lR={undo:lL,redo:lz};function lM(e,t){return!(!e||!e.isEditable||eZ(e,["image"]))&&("undo"===t?e.can().undo():e.can().redo())}let lP=n.memo(e=>{let{className:t,...l}=e;return(0,i.jsx)("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...l,children:(0,i.jsx)("path",{d:"M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z",fill:"currentColor"})})});lP.displayName="ArrowLeftIcon";var lN=l(57639),lB=l(90421),lH=l(6644),lD=l(1034);function lF(){let e=(0,lN._)(["(![[^]]*]()s*","([^s)]+)"],["(!\\[[^\\]]*\\]\\()\\s*","([^\\s)]+)"]);return lF=function(){return e},e}function lU(){let e=(0,lN._)(["(<img[^>]+src=[\"'])s*","([^\"'>s]+)"],["(<img[^>]+src=[\"'])\\s*","([^\"'>\\s]+)"]);return lU=function(){return e},e}lB.xI.setOptions({gfm:!0,breaks:!1});let lV=new lH.A({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```"});lV.use(lD.Te);let lO=".vibeman/assets/images/",lG="/.vibeman/assets/images/",lW="./.vibeman/assets/images/",l_=[lG,lW],lq=[lO,lW],lZ=[lG,lW];function lQ(e){return e.replace(/[\^$.*+?()[\]{}|]/g,e=>"\\".concat(e))}function lK(e,t,l){let i=RegExp(String.raw(lU(),lQ(t)),"gi");return e.replace(i,(e,t,i)=>"".concat(t).concat(l).concat(i))}function lJ(e){if(!e)return e;let t=e;for(let e of l_)t=function(e,t,l){let i=RegExp(String.raw(lF(),lQ(t)),"g");return e.replace(i,(e,t,i)=>"".concat(t).concat(l).concat(i))}(t,e,lO);return t}function l$(e){if(!(null==e?void 0:e.trim()))return"";let t=lJ(function(e){if(!(null==e?void 0:e.trim()))return e;let t=e.split("\n"),l=[];for(let e=0;e<t.length;e++){let i=t[e],n=e+1<t.length?t[e+1]:"";l.push(i),i.trim().match(/^-\s+\[[ x]\]/)&&n.trim()&&!n.match(/^-\s+/)&&!n.match(/^\s{2,}/)&&l.push("")}return l.join("\n")}(e));var l=function(e){if(!e)return e;let t=e;for(let e of lq)t=lK(t,e,lG);return t}((0,lB.xI)(t));if(!(null==l?void 0:l.trim()))return l;{let e=new DOMParser().parseFromString(l,"text/html");return Array.from(e.querySelectorAll("ul")).reverse().forEach(e=>{let t=!1;Array.from(e.children).filter(e=>"LI"===e.nodeName).forEach(e=>{let l=e.querySelector('input[type="checkbox"]');if(l){var i;t=!0;let n=l.hasAttribute("checked");e.setAttribute("data-type","taskItem"),e.setAttribute("data-checked",n?"true":"false");let r=e.cloneNode(!0),a=r.querySelector('input[type="checkbox"]');a&&a.remove();let o=Array.from(r.querySelectorAll("ul")),s=o.map(e=>e.outerHTML);o.forEach(e=>{e instanceof Element&&e.remove()});let d=(null==(i=r.textContent)?void 0:i.trim())||"",c='\n <label contenteditable="false">\n <input type="checkbox" '.concat(n?"checked":"",">\n <span></span>\n </label>\n <div>\n <p>").concat(d,"</p>");s.length>0&&s.forEach(e=>{let t=e;e.includes('data-type="taskItem"')&&!e.includes('data-type="taskList"')&&(t=e.replace("<ul>",'<ul data-type="taskList">')),c+=t}),e.innerHTML=(c+="</div>").trim()}}),t&&e.setAttribute("data-type","taskList")}),e.body.innerHTML}}function lY(e){if(!(null==e?void 0:e.trim()))return"";let t=function(e){if(!e)return e;let t=e;for(let e of lZ)t=lK(t,e,lO);return t.replace(/\.vibeman\/assets\/images\/+/g,".vibeman/assets/images/")}(function(e){if(!(null==e?void 0:e.trim()))return e;{let t=new DOMParser().parseFromString(e,"text/html");return t.querySelectorAll("ul > li, ol > li").forEach(e=>{Array.from(e.querySelectorAll("p")).forEach(l=>{if(l.parentElement===e||l.parentElement&&["UL","OL","LI"].includes(l.parentElement.nodeName)){let e=l.innerHTML;t.createDocumentFragment().appendChild(t.createTextNode(e)),l.outerHTML=e}})}),t.body.innerHTML}}(e));return lJ(lV.turndown(t))}lV.addRule("listItem",{filter:e=>"LI"===e.nodeName&&!e.getAttribute("data-type"),replacement:(e,t,l)=>{e=e.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n ");let i="- ",n=t.parentNode;if(n&&"OL"===n.nodeName){let e=Array.prototype.indexOf.call(n.children,t),l=n.getAttribute("start");i=(l?parseInt(l,10)-1:0)+e+1+". "}return i+e+(t.nextSibling&&!/\n$/.test(e)?"\n":"")}}),lV.addRule("tiptapTaskItem",{filter:(e,t)=>"LI"===e.nodeName&&"taskItem"===e.getAttribute("data-type")&&null!==e.getAttribute("data-checked"),replacement:(e,t)=>{var l;let i="true"===t.getAttribute("data-checked"),n=t.querySelector("div"),r=n?(null==(l=n.textContent)?void 0:l.trim())||"":e.trim();return"- ".concat(i?"[x]":"[ ]"," ").concat(r)}}),lV.addRule("tiptapTaskList",{filter:e=>"UL"===e.nodeName&&"taskList"===e.getAttribute("data-type"),replacement:(e,t)=>{let l=Array.from(t.children).filter(e=>"LI"===e.nodeName&&"taskItem"===e.getAttribute("data-type"));if(0===l.length)return e;let i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l="true"===e.getAttribute("data-checked"),n=e.querySelector("div"),r="";if(n){var a;let e=n.cloneNode(!0);Array.from(e.querySelectorAll("ul")).forEach(e=>{e instanceof Element&&e.remove()}),r=(null==(a=e.textContent)?void 0:a.trim())||""}let o="".concat(t,"- ").concat(l?"[x]":"[ ]"," ").concat(r),s=e.querySelector('ul[data-type="taskList"]');return s&&Array.from(s.children).filter(e=>"LI"===e.nodeName&&"taskItem"===e.getAttribute("data-type")).forEach(e=>{e instanceof Element&&(o+="\n"+i(e,t+" "))}),o};return"\n"+l.map(e=>i(e)).join("\n")+"\n"}}),lV.addRule("paragraph",{filter:"p",replacement:e=>"\n\n"+e.trim()+"\n\n"});let lX=e4.YY.create({name:"imagePasteDrop",addOptions:()=>({upload:eQ,onError:void 0,onSuccess:void 0,maxSize:5242880,allowedTypes:["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/svg+xml"]}),addProseMirrorPlugins(){let e=(e,t,l)=>{e.forEach(async e=>{var i,n,r,a,o,s;try{if(this.options.maxSize&&e.size>this.options.maxSize){let e=Error("File size exceeds maximum allowed (".concat(this.options.maxSize/1048576,"MB)"));null==(r=(a=this.options).onError)||r.call(a,e);return}let o=t.state.tr.insert(l,t.state.schema.text("\uD83D\uDD04 Uploading..."));t.dispatch(o);let s=this.options.upload||eQ,d=await s(e),c=e.name.replace(/\.[^/.]+$/,"")||"image",u=t.state.schema.nodes.image.create({src:d,alt:c,title:c}),p=t.state,h=!1;p.doc.descendants((e,l)=>{if(!h&&e.isText&&"\uD83D\uDD04 Uploading..."===e.text){let i=p.tr.replaceRangeWith(l,l+e.nodeSize,u);return t.dispatch(i),h=!0,!1}return!0}),null==(i=(n=this.options).onSuccess)||i.call(n,d)}catch(i){let e=t.state;e.doc.descendants((l,i)=>{if(l.isText&&"\uD83D\uDD04 Uploading..."===l.text){let n=e.tr.delete(i,i+l.nodeSize);return t.dispatch(n),!1}return!0});let l=i instanceof Error?i:Error("Upload failed");null==(o=(s=this.options).onError)||o.call(s,l)}})};return[new eH.k_({key:new eH.hs("imagePasteDrop"),props:{handleDOMEvents:{drop:(t,l)=>{l.preventDefault();let{files:i}=l.dataTransfer,n=Array.from(i).filter(e=>{var t;return null==(t=this.options.allowedTypes)?void 0:t.includes(e.type)});if(0===n.length)return!1;let r=t.posAtCoords({left:l.clientX,top:l.clientY});return!!r&&(e(n,t,r.pos),!0)},paste:(t,l)=>{let{files:i}=l.clipboardData,n=Array.from(i).filter(e=>{var t;return null==(t=this.options.allowedTypes)?void 0:t.includes(e.type)});if(0===n.length)return!1;l.preventDefault();let{selection:r}=t.state;return e(n,t,r.from),!0},dragover:(e,t)=>(t.preventDefault(),!1),dragenter:(e,t)=>(t.preventDefault(),!1)}}})]}}),l1=JSON.parse('{"type":"doc","content":[{"type":"heading","attrs":{"textAlign":null,"level":1},"content":[{"type":"text","text":"Getting started"}]},{"type":"paragraph","attrs":{"textAlign":null},"content":[{"type":"text","text":"Welcome to the "},{"type":"text","marks":[{"type":"italic"},{"type":"highlight","attrs":{"color":"var(--tt-color-highlight-yellow)"}}],"text":"Simple Editor"},{"type":"text","text":" template! This template integrates "},{"type":"text","marks":[{"type":"bold"}],"text":"open source"},{"type":"text","text":" UI components and Tiptap extensions licensed under "},{"type":"text","marks":[{"type":"bold"}],"text":"MIT"},{"type":"text","text":"."}]},{"type":"paragraph","attrs":{"textAlign":null},"content":[{"type":"text","text":"Integrate it by following the "},{"type":"text","marks":[{"type":"link","attrs":{"href":"https://tiptap.dev/docs/ui-components/templates/simple-editor","target":"_blank","rel":"noopener noreferrer nofollow","class":null}}],"text":"Tiptap UI Components docs"},{"type":"text","text":" or using our CLI tool."}]},{"type":"codeBlock","attrs":{"language":null},"content":[{"type":"text","text":"npx @tiptap/cli init"}]},{"type":"heading","attrs":{"textAlign":null,"level":2},"content":[{"type":"text","text":"Features"}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"textAlign":null},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"A fully responsive rich text editor with built-in support for common formatting and layout tools. Type markdown "},{"type":"text","marks":[{"type":"code"}],"text":"**"},{"type":"text","marks":[{"type":"italic"}],"text":" or use keyboard shortcuts "},{"type":"text","marks":[{"type":"code"}],"text":"⌘+B"},{"type":"text","text":" for "},{"type":"text","marks":[{"type":"strike"}],"text":"most"},{"type":"text","text":" all common markdown marks. \uD83E\uDE84"}]}]},{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","text":"Add images, customize alignment, and apply "},{"type":"text","marks":[{"type":"highlight","attrs":{"color":"var(--tt-color-highlight-blue)"}}],"text":"advanced formatting"},{"type":"text","text":" to make your writing more engaging and professional."}]},{"type":"image","attrs":{"src":"/images/tiptap-ui-placeholder-image.jpg","alt":"placeholder-image","title":"placeholder-image"}},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"Superscript"},{"type":"text","text":" (x"},{"type":"text","marks":[{"type":"superscript"}],"text":"2"},{"type":"text","text":") and "},{"type":"text","marks":[{"type":"bold"}],"text":"Subscript"},{"type":"text","text":" (H"},{"type":"text","marks":[{"type":"subscript"}],"text":"2"},{"type":"text","text":"O) for precision."}]}]},{"type":"listItem","content":[{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"Typographic conversion"},{"type":"text","text":": automatically convert to "},{"type":"text","marks":[{"type":"code"}],"text":"->"},{"type":"text","text":" an arrow "},{"type":"text","marks":[{"type":"bold"}],"text":"→"},{"type":"text","text":"."}]}]}]},{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"→ "},{"type":"text","marks":[{"type":"link","attrs":{"href":"https://tiptap.dev/docs/ui-components/templates/simple-editor#features","target":"_blank","rel":"noopener noreferrer nofollow","class":null}}],"text":"Learn more"}]},{"type":"horizontalRule"},{"type":"heading","attrs":{"textAlign":"left","level":2},"content":[{"type":"text","text":"Make it your own"}]},{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","text":"Switch between light and dark modes, and tailor the editor\'s appearance with customizable CSS to match your style."}]},{"type":"taskList","content":[{"type":"taskItem","attrs":{"checked":true},"content":[{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","text":"Test template"}]}]},{"type":"taskItem","attrs":{"checked":false},"content":[{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","marks":[{"type":"link","attrs":{"href":"https://tiptap.dev/docs/ui-components/templates/simple-editor","target":"_blank","rel":"noopener noreferrer nofollow","class":null}}],"text":"Integrate the free template"}]}]}]},{"type":"paragraph","attrs":{"textAlign":"left"}}]}'),l0=e=>{let{onLinkClick:t,isMobile:l}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(e2,{children:[(0,i.jsx)(lA,{action:"undo"}),(0,i.jsx)(lA,{action:"redo"})]}),(0,i.jsx)(e7,{}),(0,i.jsxs)(e2,{children:[(0,i.jsx)(tE,{levels:[1,2,3,4],portal:l}),(0,i.jsx)(tJ,{types:["bulletList","orderedList","taskList"],portal:l}),(0,i.jsx)(tY,{}),(0,i.jsx)(t7,{})]}),(0,i.jsx)(e7,{}),(0,i.jsxs)(e2,{children:[(0,i.jsx)(lg,{type:"bold"}),(0,i.jsx)(lg,{type:"italic"}),(0,i.jsx)(lg,{type:"strike"}),(0,i.jsx)(lg,{type:"code"}),(0,i.jsx)(lg,{type:"underline"}),l?(0,i.jsx)(lo,{onClick:t}):(0,i.jsx)(lc,{})]}),(0,i.jsx)(e7,{}),(0,i.jsx)(e2,{children:(0,i.jsx)(tM,{text:"Add"})})]})},l2=e=>{let{onBack:t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e2,{children:(0,i.jsxs)(e$,{"data-style":"ghost",onClick:t,children:[(0,i.jsx)(lP,{className:"tiptap-button-icon"}),(0,i.jsx)(t8,{className:"tiptap-button-icon"})]})}),(0,i.jsx)(e7,{}),(0,i.jsx)(ld,{})]})},l7=e=>{let{value:t,onChange:l,placeholder:r="Start typing...",className:a,minHeight:o="200px",onSave:s}=e,d=tN(),[c,u]=n.useState("main"),p=n.useRef(null),h=n.useRef(t||""),m=n.useRef(null),g=(0,eb.hG)({immediatelyRender:!1,shouldRerenderOnTransaction:!1,editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off","aria-label":r,class:"simple-editor ".concat(a||"")}},extensions:[ew.W.configure({history:{newGroupDelay:750},horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}}),ez.A.configure({placeholder:r}),tn,eT._0,eT.L2.configure({nested:!0}),ek._V,eS.o5,eA.LN,ti.configure({accept:"image/*",maxSize:5242880,limit:3,upload:eQ,onError:e=>console.error("Upload failed:",e)}),lX.configure({upload:eQ,maxSize:5242880,onError:e=>console.error("Paste/Drop upload failed:",e),onSuccess:e=>console.log("Image uploaded successfully:",e)})],content:t?l$(t):l1,onUpdate:e=>{let{editor:t}=e;m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{let e=lY(t.getHTML());e!==h.current&&(h.current=e,null==l||l(e))},600)}});return n.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),n.useEffect(()=>{d||"main"===c||u("main")},[d,c]),n.useEffect(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),m.current&&clearTimeout(m.current),g&&l&&l(lY(g.getHTML())),s&&s())};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[g,l,s]),n.useEffect(()=>{let e=t||"";if(g&&e!==h.current){let t=e?l$(e):l1,{anchor:l,head:i}=g.state.selection||{anchor:1,head:1};g.commands.setContent(t,!1);let{from:n,to:r}=function(e,t,l){let i=Math.max(1,l-2),n=e=>Math.max(1,Math.min(e,i)),r=n(e),a=n(t);return{from:Math.min(r,a),to:Math.max(r,a)}}(l,i,g.state.doc.nodeSize);g.chain().focus().setTextSelection({from:n,to:r}).run(),h.current=e}},[g,t]),(0,i.jsx)("div",{className:"simple-editor-wrapper",style:{...o&&{minHeight:o},...l&&{height:"auto"}},children:(0,i.jsxs)(eb.pl.Provider,{value:{editor:g},children:[(0,i.jsx)(e0,{ref:p,children:"main"===c?(0,i.jsx)(l0,{onLinkClick:()=>u("link"),isMobile:d}):(0,i.jsx)(l2,{onBack:()=>u("main")})}),(0,i.jsx)(eb.$Z,{editor:g,role:"presentation",className:"simple-editor-content",style:{minHeight:o}})]})})};l7.displayName="SimpleEditor";var l4=l(20388);let l5=0;var l9=l(98175),l3=l(98878);async function l6(){let[{Terminal:e},{FitAddon:t},{WebLinksAddon:i},n]=await Promise.all([l.e(581).then(l.t.bind(l,67179,23)),l.e(355).then(l.t.bind(l,79355,23)),l.e(691).then(l.t.bind(l,9691,23)),l.e(439).then(l.t.bind(l,6439,23)).catch(()=>null)]);return{Terminal:e,FitAddon:t,WebLinksAddon:i,WebglAddon:null==n?void 0:n.WebglAddon}}function l8(e){let{lines:t,title:l,height:r=380,scrollback:a=1e4}=e,s="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",c=(0,n.useRef)(null),u=(0,n.useRef)(null),m=(0,n.useRef)(null),g=(0,n.useRef)(0),x=(0,n.useRef)(null),[f,v]=(0,n.useState)(!1),[C,y]=(0,n.useState)(!1),[j]=(0,n.useState)(14),b=(0,n.useRef)(null),k=(0,l9.useComputedColorScheme)("light",{getInitialValueInEffect:!0});(0,n.useEffect)(()=>{let e=!1,t=null;return(async()=>{let{Terminal:l,FitAddon:i,WebLinksAddon:n,WebglAddon:r}=await l6();if(e)return;let o=new i,d="dark"!==k,p=new l({convertEol:!0,disableStdin:!0,cursorBlink:!1,cursorStyle:"bar",scrollback:a,fontFamily:s,fontSize:j,lineHeight:1.2,letterSpacing:0,theme:d?{background:"#f6f8fa",foreground:"#1f2937",cursor:"transparent",selectionBackground:"#93c5fdAA"}:{background:"#0d1117",foreground:"#e5e7eb",cursor:"transparent",selectionBackground:"#2563eb55"}});if(p.loadAddon(o),p.loadAddon(new n),r)try{p.loadAddon(new r)}catch(e){l3.Rm.error("Failed to load xterm WebGL addon",e,"terminal-logs-viewer")}if(c.current){p.open(c.current),o.fit();try{p.scrollToBottom()}catch(e){l3.Rm.error("Failed to scroll xterm to bottom after open",e,"terminal-logs-viewer")}try{let e=d?"#f6f8fa":"#0d1117",t=c.current;t.style.backgroundColor=e;let l=t.querySelector(".xterm-viewport");null==l||l.style.setProperty("background-color",e),null==l||l.style.setProperty("overscroll-behavior","contain"),null==l||l.style.setProperty("overscroll-behavior-y","contain");let i=t.querySelector(".xterm");null==i||i.style.setProperty("background-color",e);let n=t.querySelector(".xterm-screen");null==n||n.style.setProperty("background-color",e)}catch(e){l3.Rm.error("Failed to apply background color to xterm viewport",e,"terminal-logs-viewer")}}t=new ResizeObserver(()=>{try{o.fit()}catch(e){l3.Rm.error("Fit failed on resize",e,"terminal-logs-viewer")}}),c.current&&t.observe(c.current),u.current=p,m.current=o,v(!0)})(),()=>{e=!0;try{null==t||t.disconnect()}catch(e){l3.Rm.error("ResizeObserver disconnect failed",e,"terminal-logs-viewer")}let l=u.current;if(l&&"function"==typeof l.dispose)try{l.dispose()}catch(t){let e=(t instanceof Error?t.message:String(t)).toLowerCase();e.includes("disposed")||e.includes("destroyed")||e.includes("terminal has been disposed")||e.includes("cannot read properties of null")||e.includes("cannot read properties of undefined")||e.includes("already disposed")||l3.Rm.error("Terminal dispose failed",t,"terminal-logs-viewer")}u.current=null,m.current=null}},[a,k,j]);let T=e=>e;return(0,n.useEffect)(()=>{let e=u.current;if(!f||!e)return;let l=g.current;t.length<l&&(e.clear(),g.current=0,x.current=null);let i=t.length;if(i>g.current){let l=t.slice(g.current),n=l.map(T).join("\r\n");if(l.length>500)for(let t=0;t<l.length;t+=500){let i=l.slice(t,t+500).map(T).join("\r\n");e.write(i+"\r\n")}else e.write(n+"\r\n");g.current=i,x.current=i>0?String(t[i-1]):null;try{e.scrollToBottom(),requestAnimationFrame(()=>e.scrollToBottom()),setTimeout(()=>e.scrollToBottom(),30)}catch(e){l3.Rm.error("Scroll to bottom failed after appending logs",e,"terminal-logs-viewer")}return}if(i===g.current){let l=i>0?String(t[i-1]):null;if(l!==x.current)try{i>0?e.write("\x1b[1A\r\x1b[2K"+T(l||"")+"\r\n"):e.clear(),x.current=l;try{e.scrollToBottom()}catch(e){l3.Rm.error("Scroll to bottom failed after tail change",e,"terminal-logs-viewer")}}catch(i){l3.Rm.error("Rewrite after tail change failed",i,"terminal-logs-viewer");try{e.clear();let i=t.map(T).join("\r\n");e.write(i+(t.length?"\r\n":"")),x.current=l}catch(e){l3.Rm.error("Rewrite after tail change failed",e,"terminal-logs-viewer")}}}},[t,f]),(0,n.useEffect)(()=>{let e=setTimeout(()=>{try{var e,t,l,i;null==(t=m.current)||null==(e=t.fit)||e.call(t),null==(i=u.current)||null==(l=i.scrollToBottom)||l.call(i)}catch(e){l3.Rm.error("Force fit or scroll failed",e,"terminal-logs-viewer")}},50);return()=>clearTimeout(e)},[r,f,C]),(0,n.useEffect)(()=>{f&&(()=>{try{let e=u.current;if(!e)return;e.scrollToBottom(),requestAnimationFrame(()=>e.scrollToBottom()),setTimeout(()=>e.scrollToBottom(),30)}catch(e){l3.Rm.error("Initial scroll to bottom failed",e,"terminal-logs-viewer")}})()},[f,C]),(0,n.useEffect)(()=>{try{var e,t,l,i;null==(t=u.current)||null==(e=t.setOption)||e.call(t,"fontSize",j),null==(i=m.current)||null==(l=i.fit)||l.call(i)}catch(e){l3.Rm.error("Failed to apply font size to xterm",e,"terminal-logs-viewer")}},[j]),(0,n.useEffect)(()=>{if(!f)return;let e=c.current,t=null==e?void 0:e.querySelector(".xterm-viewport");if(!t)return;try{t.style.setProperty("overscroll-behavior","contain"),t.style.setProperty("overscroll-behavior-y","contain")}catch(e){}let l=e=>{let l=e.deltaY,i=t.scrollTop,n=t.scrollHeight-t.clientHeight;(l<0&&i<=0||l>0&&i>=n-1)&&(e.preventDefault(),e.stopPropagation())};return t.addEventListener("wheel",l,{passive:!1}),()=>{t.removeEventListener("wheel",l)}},[f]),(0,i.jsxs)(p.Box,{children:[l&&(0,i.jsx)(d.Text,{size:"sm",fw:600,mb:"xs",children:l}),(0,i.jsxs)(o.Group,{justify:"space-between",align:"center",mb:"xs",wrap:"wrap",children:[(0,i.jsxs)(o.Group,{gap:"xs",wrap:"wrap",children:[(0,i.jsx)(w.Tooltip,{label:"Scroll to top",withArrow:!0,children:(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>{try{var e,t;null==(t=u.current)||null==(e=t.scrollToTop)||e.call(t)}catch(e){l3.Rm.error("Scroll to top failed",e,"terminal-logs-viewer")}},children:"Top"})}),(0,i.jsx)(w.Tooltip,{label:"Scroll to bottom",withArrow:!0,children:(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>{try{var e,t;null==(t=u.current)||null==(e=t.scrollToBottom)||e.call(t)}catch(e){l3.Rm.error("Scroll to bottom failed",e,"terminal-logs-viewer")}},children:"Bottom"})}),(0,i.jsx)(w.Tooltip,{label:C?"Collapse":"Expand",withArrow:!0,children:(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>y(e=>!e),children:C?"Collapse":"Expand"})})]}),(0,i.jsxs)(o.Group,{gap:"xs",wrap:"wrap",children:[(0,i.jsx)(w.Tooltip,{label:"Copy all logs",withArrow:!0,children:(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>{var e;let l=t.join("\n");null==(e=navigator.clipboard)||e.writeText(l).catch(e=>l3.Rm.error("Copy logs to clipboard failed",e,"terminal-logs-viewer"))},children:"Copy"})}),(0,i.jsx)(w.Tooltip,{label:"Download logs",withArrow:!0,children:(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>{let e=new Blob([t.join("\n")],{type:"text/plain;charset=utf-8"}),l=URL.createObjectURL(e),i=document.createElement("a");i.href=l,i.download="logs.txt",i.click(),URL.revokeObjectURL(l)},children:"Download"})})]})]}),(0,i.jsx)(p.Box,{ref:b,style:{height:C?Math.max(r,700):r,background:"dark"===k?"#0d1117":"var(--mantine-color-gray-1)",border:"1px solid var(--mantine-color-default-border)",overflow:"hidden",overscrollBehavior:"contain",letterSpacing:0,wordSpacing:0,fontFamily:s},children:(0,i.jsx)(p.Box,{ref:c,style:{padding:8,height:"100%",letterSpacing:0,wordSpacing:0,fontFamily:s,background:"dark"===k?"#0d1117":"#f6f8fa"}})})]})}function ie(e){let{task:t,title:l,type:r,priority:s,content:c,disabled:u=!1,onAccept:p}=e,[g,x]=(0,n.useState)(!1),[f,C]=(0,n.useState)(!1),[y,j]=(0,n.useState)(null),[b,w]=(0,n.useState)([]),[k,T]=(0,n.useState)(),[S,A]=(0,n.useState)(null),z=(0,n.useRef)(0);v.i.onExecutionUpdate.useSubscription({executionId:S||""},{enabled:!!S,onData:e=>{let t=e.logs||[],l=z.current||0,i=t.slice(l);if(i.length>0){z.current=t.length;let e=new Date().toLocaleTimeString();w(t=>[...t,...i.map(t=>"[".concat(e,"] ").concat(t))])}"failed"===e.status&&(T(e.error),x(!1),C(!1),A(null),z.current=0)},onError:e=>{console.error("Execution subscription error:",e)}});let L=v.i.stopTaskExecution.useMutation({onSuccess:()=>{w(e=>[...e,"[".concat(new Date().toLocaleTimeString(),"] Improvement cancelled successfully")])}}),E=v.i.improveTask.useMutation({onSuccess:e=>{let t={type:e.type,priority:e.priority,content:e.content,title:e.title};p&&p(t),x(!1),C(!1),j(null),A(null),z.current=0},onError:e=>{console.error("Failed to improve task:",e),x(!1);let t=e.message;if(T(t),w(e=>[...e,"[".concat(new Date().toLocaleTimeString(),"] Error: ").concat(t)]),t.includes("Claude CLI is not installed")){let e=t.includes("To use this feature")?t:"Claude CLI is not installed or not found in PATH.";m.notifications.show({color:"red",title:"Claude CLI Missing",message:e})}else m.notifications.show({color:"red",title:"AI Improvement Failed",message:t})}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Button,{size:"xs",variant:"light",leftSection:(0,i.jsx)(ef.A,{size:14}),onClick:()=>{if(!t||g)return;z.current=0,w(["[".concat(new Date().toLocaleTimeString(),"] Starting task improvement...")]),T(void 0),j(null),A(null),z.current=0,x(!0),C(!0);let e=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{useUuid:l=!0,includeTimestamp:i=!1,separator:n="_"}=t,r=[e];if(i&&r.push(Date.now().toString()),l)r.push((0,l4.A)());else if("undefined"!=typeof crypto&&crypto.randomUUID)r.push(crypto.randomUUID());else{let e=Date.now(),t=Math.random().toString(36).substring(2,11),l=Math.random().toString(36).substring(2,7),i=l5=(l5+1)%1e4;r.push("".concat(e.toString(36)).concat(t).concat(l).concat(i.toString(36)))}return r.join(n)}("improve");A(e),w(e=>[...e,"[".concat(new Date().toLocaleTimeString(),"] Analyzing current task data..."),"[".concat(new Date().toLocaleTimeString(),"] Sending task data to Claude...")]),E.mutate({taskId:t.id,title:l,type:r,priority:s,content:c,executionId:e})},loading:g,disabled:u||g,children:g?"Improving...":"Improve with Vibeman"}),(0,i.jsx)(ep.Modal,{opened:f,onClose:()=>g?null:C(!1),withCloseButton:!g,size:"860px",title:(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(d.Text,{fw:500,children:"Improving Task"}),(null==y?void 0:y.selectedModel)&&(0,i.jsxs)(d.Text,{size:"sm",c:"dimmed",children:["• ",y.selectedModel]})]}),styles:{body:{maxHeight:"calc(100vh - 200px)",overflowY:"auto"}},children:(0,i.jsxs)(a.Stack,{gap:"md",children:[b.length>0&&(0,i.jsx)(l8,{lines:b,height:240}),g&&(0,i.jsx)(d.Text,{c:"blue",size:"sm",fw:500,style:{textAlign:"center"},children:"⚡ Processing..."}),k&&!g&&(0,i.jsx)(d.Text,{c:"red",children:k}),(0,i.jsx)("div",{style:{position:"sticky",bottom:"-16px",left:0,right:0,background:"var(--mantine-color-body)",borderTop:"1px solid var(--mantine-color-default-border)",paddingTop:"12px",paddingBottom:"4px"},children:(0,i.jsx)(o.Group,{justify:"flex-end",children:g?(0,i.jsx)(h.Button,{variant:"subtle",color:"red",onClick:()=>{S&&L.mutate({executionId:S}),x(!1),C(!1),A(null),w(e=>[...e,"[".concat(new Date().toLocaleTimeString(),"] Improvement cancelled by user")])},children:"Cancel"}):(0,i.jsx)(h.Button,{variant:"subtle",onClick:()=>C(!1),children:"Close"})})})]})})]})}l(56732);let it={autoQualityChecks:!0,autoCommit:!1,createPR:!1,autoMerge:!1,aiCodeReview:!0,requireHumanApproval:!0,stepByStepMode:!1};function il(e,t){switch(t.type){case"INITIALIZE":return{...e,...t.payload};case"SET_REQUIRE_HUMAN_APPROVAL":return{...e,requireHumanApproval:t.payload,...t.payload&&{autoCommit:!1,createPR:!1,autoMerge:!1}};case"SET_AUTO_COMMIT":return{...e,autoCommit:t.payload,...!1===t.payload&&{createPR:!1,autoMerge:!1}};case"SET_CREATE_PR":return{...e,createPR:t.payload,...t.payload&&{autoCommit:!0,autoMerge:!1}};case"SET_AUTO_MERGE":return{...e,autoMerge:t.payload,...t.payload&&{autoCommit:!0,createPR:!1,requireHumanApproval:!1}};case"SET_AUTO_QUALITY_CHECKS":return{...e,autoQualityChecks:t.payload};case"SET_AI_CODE_REVIEW":return{...e,aiCodeReview:t.payload};case"SET_STEP_BY_STEP_MODE":return{...e,stepByStepMode:t.payload};default:return e}}var ii=l(94527),ir=l(40228);function ia(e){let{label:t,tooltip:l,checked:n,disabled:r=!1,onChange:a}=e;return(0,i.jsx)(w.Tooltip,{label:l,withArrow:!0,position:"bottom",children:(0,i.jsxs)(ir.Checkbox.Card,{radius:"sm",checked:n,onChange:a,disabled:r,style:{display:"inline-flex",alignItems:"center",padding:"6px 10px",width:"auto",opacity:r?.5:1},children:[(0,i.jsx)(ir.Checkbox.Indicator,{}),(0,i.jsx)(d.Text,{size:"sm",fw:500,ml:6,children:t})]})})}var io=l(52247),is=l(45873),id=l(39530),ic=l(13806),iu=l(24165);let ip={draft:"gray",implementing:"yellow",implemented:"yellow",validating:"orange",validated:"orange","ai-reviewing":"indigo","ai-reviewed":"indigo","awaiting-review":"grape",paused:"gray",approved:"green",merging:"teal",merged:"teal",cleaning:"gray",cleaned:"gray",completed:"teal",failed:"red"},ih={draft:io.A,implementing:T.A,implemented:T.A,validating:is.A,validated:is.A,"ai-reviewing":id.A,"ai-reviewed":id.A,"awaiting-review":id.A,paused:io.A,approved:ic.A,merging:iu.A,merged:iu.A,cleaning:eC.A,cleaned:eC.A,completed:iu.A,failed:D.A};var im=l(77562),ig=l(69950),ix=l(58951),iv=l(17195),iC=l(25404),iy=l(6748);function ij(e){if(!e||!isFinite(e)||e<0)return"n/a";let t=Math.floor(e/1e3),l=Math.floor(t/3600),i=Math.floor(t%3600/60),n=t%60;return l>0?"".concat(l,"h ").concat(i,"m ").concat(n,"s"):i>0?"".concat(i,"m ").concat(n,"s"):"".concat(n,"s")}let ib=function(e){var t,l,r;let{executionId:o}=e,s=v.i.getTaskExecutionStatus.useQuery({executionId:o},{enabled:!!o,refetchOnWindowFocus:!1}),[c,u]=n.useState(!1);n.useEffect(()=>{let e=s.data;e&&("completed"===e.status||"failed"===e.status||"cancelled"===e.status||e.endTime)&&u(!0)},[s.data]);let p=v.i.getTaskExecutionLogs.useQuery({executionId:o},{enabled:!!o,refetchOnWindowFocus:!1,refetchInterval:()=>!c&&1e3}),[h,m]=n.useState(null),g=!c;v.i.onExecutionUpdate.useSubscription(o?{executionId:o}:{},{enabled:!!o&&g,onData:e=>{(null==e?void 0:e.logs)&&m(e.logs);let t=null==e?void 0:e.status;t&&("completed"===t||"failed"===t||"cancelled"===t)&&u(!0)}});let x=n.useRef(!1);n.useEffect(()=>{x.current&&!g&&(p.refetch().catch(()=>{}),m(null)),x.current=g},[g,p]);let f=s.data,C=null==f?void 0:f.usage,y=((null==(t=p.data)?void 0:t.logs)||[]).map(e=>"string"==typeof e?e:e.message),j=Array.isArray(null==(l=s.data)?void 0:l.logs)?s.data.logs.map(e=>"string"==typeof e?e:e.message):[],b=h&&h.length?h:y.length?y:j,w=(()=>{try{let e=(null==f?void 0:f.startTime)?new Date(f.startTime).getTime():void 0,t=(null==f?void 0:f.endTime)?new Date(f.endTime).getTime():Date.now();return e?Math.max(0,t-e):void 0}catch(e){return}})();return(0,i.jsxs)(a.Stack,{gap:6,mt:6,children:[!!C&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["Provider: ",(null==f?void 0:f.provider)||"n/a"," • Tokens: ",null!=(r=C.totalTokens)?r:0," • Cost:"," ",void 0!==C.cost?"$".concat(C.cost.toFixed(4)):"n/a"]}),!!w&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["Duration: ",ij(w)]}),b.length>0?(0,i.jsx)(l8,{lines:b,height:200}):(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:g?"Waiting for logs…":"No logs available."})]})};function iw(e){let{workflowId:t}=e,l=v.i.useUtils(),n=v.i.continueWorkflow.useMutation({onSuccess:()=>l.getWorkflow.invalidate({workflowId:t}).catch(()=>{})});return(0,i.jsx)(h.Button,{size:"xs",variant:"filled",onClick:()=>n.mutate({workflowId:t}),loading:n.isPending,children:"Continue"})}function ik(e){let{workflowId:t,phase:l}=e,n=v.i.useUtils(),r=v.i.rerunFromPhase.useMutation({onSuccess:()=>n.getWorkflow.invalidate({workflowId:t}).catch(()=>{})});return(0,i.jsx)(h.Button,{size:"xs",variant:"outline",onClick:()=>ex.jQ.openConfirmModal({title:"Rerun from this step",centered:!0,labels:{confirm:"Rerun",cancel:"Cancel"},children:(0,i.jsx)(d.Text,{size:"sm",children:"This will reset all later steps and logs. Continue?"}),onConfirm:()=>r.mutate({workflowId:t,phase:l})}),loading:r.isPending,children:"Rerun From Here"})}function iT(e){let{workflowId:t}=e,l=v.i.useUtils(),n=v.i.pauseWorkflow.useMutation({onSuccess:()=>l.getWorkflow.invalidate({workflowId:t}).catch(()=>{})});return(0,i.jsx)(h.Button,{disabled:!0,size:"xs",variant:"subtle",onClick:()=>n.mutate({workflowId:t}),loading:n.isPending,children:"Pause"})}function iS(e){let{workflowId:t}=e,l=v.i.useUtils(),n=v.i.skipToNextPhase.useMutation({onSuccess:()=>l.getWorkflow.invalidate({workflowId:t}).catch(()=>{})});return(0,i.jsx)(h.Button,{disabled:!0,size:"xs",variant:"subtle",onClick:()=>n.mutate({workflowId:t}),loading:n.isPending,children:"Skip To Next"})}function iA(e){let{workflowId:t}=e,l=v.i.useUtils(),n=v.i.approveAndContinueReview.useMutation({onSuccess:()=>l.getWorkflow.invalidate({workflowId:t}).catch(()=>{})}),r=v.i.checkWorktreeStatus.useMutation();return(0,i.jsx)(h.Button,{size:"xs",variant:"filled",color:"green",onClick:async()=>{try{let l=await r.mutateAsync({workflowId:t});if(!l.clean){var e;let a=(null==(e=l.uncommittedFiles)?void 0:e.length)?"\n\n".concat(l.uncommittedFiles.join("\n")):"";ex.jQ.openConfirmModal({title:"Uncommitted changes detected",centered:!0,labels:{confirm:"I have committed, continue",cancel:"Cancel"},children:(0,i.jsxs)(d.Text,{size:"sm",children:["Please commit or stash your local changes before approving.",a?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("br",{}),(0,i.jsx)("br",{}),(0,i.jsx)("strong",{children:"Files:"}),(0,i.jsx)("br",{}),l.uncommittedFiles.join(", ")]}):null]}),onConfirm:async()=>{try{let l=await r.mutateAsync({workflowId:t});if(!l.clean){var e;m.notifications.show({color:"red",title:"Still has uncommitted changes",message:(null==(e=l.uncommittedFiles)?void 0:e.join("\n"))||"Please commit or stash changes and try again."});return}await n.mutateAsync({workflowId:t})}catch(t){let e=(null==t?void 0:t.message)||"Failed to approve and continue";m.notifications.show({color:"red",title:"Action failed",message:e})}}});return}await n.mutateAsync({workflowId:t})}catch(e){try{await n.mutateAsync({workflowId:t})}catch(t){let e=(null==t?void 0:t.message)||"Failed to approve and continue";m.notifications.show({color:"red",title:"Action failed",message:e})}}},loading:n.isPending||r.isPending,children:"Approve & Continue"})}function iz(e){let{workflowId:t}=e,l=v.i.useUtils(),n=v.i.markCompleted.useMutation({onSuccess:()=>l.getWorkflow.invalidate({workflowId:t}).catch(()=>{})});return(0,i.jsx)(h.Button,{size:"xs",variant:"outline",color:"gray",disabled:!0,onClick:()=>n.mutate({workflowId:t}),loading:n.isPending,children:"Mark as Completed"})}function iL(e){let{workflowId:t}=e,l=v.i.useUtils(),n=v.i.runMerge.useMutation({onSuccess:()=>l.getWorkflow.invalidate({workflowId:t}).catch(()=>{})});return(0,i.jsx)(h.Button,{size:"xs",variant:"outline",onClick:()=>n.mutate({workflowId:t}),loading:n.isPending,children:"Run Merge"})}function iE(e){var t,l;let{workflowId:n}=e,r=(null==(l=v.i.runCleanup)||null==(t=l.useMutation)?void 0:t.call(l))||{mutate:()=>{},isPending:!1};return(0,i.jsx)(h.Button,{size:"xs",variant:"outline",onClick:()=>r.mutate({workflowId:n}),loading:r.isPending,children:"Run Cleanup"})}function iI(e){var t;let{taskId:l}=e,n=v.i.getWorktreeInfo.useQuery(l?{taskId:l}:void 0,{enabled:!!l,refetchOnWindowFocus:!1,staleTime:3e4}),r=v.i.openInEditor.useMutation(),a=null==(t=n.data)?void 0:t.path;return(0,i.jsx)(h.Button,{size:"xs",variant:"outline",onClick:async()=>{if(a)try{await r.mutateAsync({worktreePath:a})}catch(e){console.error("Failed to open editor:",e)}},disabled:!a,children:"Open in Editor"})}function iR(e){var t,l,n;let{taskId:r}=e,a=v.i.getWorktreeInfo.useQuery(r?{taskId:r}:void 0,{enabled:!!r,refetchOnWindowFocus:!1,staleTime:3e4}),o=(null==(l=v.i.openInTerminal)||null==(t=l.useMutation)?void 0:t.call(l))||{mutateAsync:async()=>{},isPending:!1},s=null==(n=a.data)?void 0:n.path,d=o.isPending;return(0,i.jsx)(h.Button,{size:"xs",variant:"outline",onClick:async()=>{if(s)try{await o.mutateAsync({worktreePath:s})}catch(e){console.error("Failed to open Terminal:",e)}},disabled:!s,loading:d,children:"Open in Terminal"})}function iM(e){var t,l;let{workflow:r}=e,[u,p]=n.useState({}),m=!!(null==r||null==(t=r.metadata)?void 0:t.stepByStepMode);console.log("workflow",r,m);let g=(0,n.useMemo)(()=>((null==r?void 0:r.timeline)||[]).slice(),[null==r?void 0:r.timeline]);(0,n.useEffect)(()=>{if(!r||!(null==g?void 0:g.length))return;let e=g.find(e=>!e.placeholder&&e.phase===r.phase&&!!e.executionId);e&&p(t=>t[e.id]?t:{...t,[e.id]:!0})},[null==r?void 0:r.phase,null==r?void 0:r.executionIds,g,r]),(0,n.useEffect)(()=>{(null==g?void 0:g.length)&&p(e=>{if(Object.keys(e||{}).length>0)return e;let t={};if((null==r?void 0:r.phase)==="failed"&&(null==r?void 0:r.lastPhase)){let e=g.find(e=>!e.placeholder&&e.phase===r.lastPhase);e&&(t[e.id]=!0)}let l=null==r?void 0:r.qualityResults;if(l&&!1===l.overall){let e=g.find(e=>!e.placeholder&&"validating"===e.phase);e&&(t[e.id]=!0)}return Object.keys(t).length?t:e})},[r,g,null==r?void 0:r.phase,null==r?void 0:r.lastPhase,null==r||null==(l=r.qualityResults)?void 0:l.overall]);let x=(0,n.useMemo)(()=>(null==g?void 0:g.length)?g.reduce((e,t)=>((null==t?void 0:t.usage)&&(e.tokens+=t.usage.totalTokens||0,"number"==typeof t.usage.cost&&(e.cost+=t.usage.cost)),e),{tokens:0,cost:0}):{tokens:0,cost:0},[g]),f=(0,n.useMemo)(()=>{try{if(!r)return;let e=r.startTime?new Date(r.startTime).getTime():void 0,t=r.endTime?new Date(r.endTime).getTime():new Date(r.lastUpdatedAt||Date.now()).getTime();return e?Math.max(0,t-e):void 0}catch(e){return}},[r]),v=Math.max(0,g.reduce((e,t,l)=>t.placeholder?e:l,-1));return r?(0,i.jsxs)(b.Card,{withBorder:!0,padding:"md",radius:"md",children:[(0,i.jsxs)(a.Stack,{mb:"lg",gap:0,children:[(0,i.jsxs)(o.Group,{justify:"space-between",children:[(0,i.jsx)(o.Group,{children:(0,i.jsx)(s.Title,{order:5,children:"Timeline"})}),(0,i.jsxs)(o.Group,{gap:8,children:[(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>p(()=>(g||[]).reduce((e,t)=>(e[t.id]=!0,e),{})),children:"Expand All"}),(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>p(()=>(g||[]).reduce((e,t)=>(e[t.id]=!1,e),{})),children:"Collapse All"})]})]}),(0,i.jsx)(o.Group,{children:r&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["Total: ",x.tokens," tok • ",x.cost>0?"$".concat(x.cost.toFixed(4)):"n/a",void 0!==f?" • Runtime: ".concat(ij(f)):"",r?" • ".concat(r.id):""]})})]}),(0,i.jsx)(ix.Timeline,{active:v,bulletSize:18,lineWidth:2,children:g.map((e,t)=>{var l,n,s;let h=ih[e.phase],x=e.startTime,f=new Set(["implementing","validating","ai-reviewing","awaiting-review","approved","merging","cleaning"]),v=!!e.executionId,C=!!r&&r.phase===e.phase,j=new Set(["validating","ai-reviewing","approved","merging","cleaning"]),b=!!(m&&j.has(e.phase)),k=!!(C&&b&&!v),T=!!r&&!e.placeholder&&C&&f.has(e.phase)&&("implementing"===e.phase||!b||v),S="SUCCESS";"failed"===e.phase?S="FAILED":"paused"===e.phase?S="INACTIVE":T?S="RUNNING":k||e.placeholder||k?S="INACTIVE":"validating"===e.phase&&r&&r.qualityResults?S=r.qualityResults.overall?"SUCCESS":"FAILED":r&&"failed"===r.phase&&r.lastPhase===e.phase&&(S="FAILED");let A=T||"FAILED"===S,z=null!=(n=u[e.id])?n:A,L=()=>p(t=>{var l;return{...t,[e.id]:!(null!=(l=t[e.id])?l:z)}}),E=e.endTime||(null==(l=g[t+1])?void 0:l.startTime)||(r?r.endTime:void 0)||(r?r.lastUpdatedAt:void 0),I=(()=>{try{if(!x||!E)return"";let e=new Date(E).getTime()-new Date(x).getTime();return e>0?"• ".concat(ij(e)):""}catch(e){return""}})();return(0,i.jsxs)(ix.Timeline.Item,{bullet:(0,i.jsx)(h,{size:12}),color:ip[e.phase],children:[(0,i.jsxs)(o.Group,{justify:"space-between",align:"center",wrap:"nowrap",onClick:()=>{e.placeholder||L()},role:"button",tabIndex:0,onKeyDown:t=>{e.placeholder||("Enter"===t.key||" "===t.key)&&(t.preventDefault(),L())},style:{cursor:e.placeholder?"default":"pointer"},"aria-expanded":z,"aria-controls":"timeline-panel-".concat(e.id),"data-testid":"timeline-header-".concat(e.id),children:[(0,i.jsxs)(o.Group,{gap:8,align:"center",wrap:"nowrap",children:[(0,i.jsx)(d.Text,{size:"sm",fw:600,c:e.placeholder?"dimmed":void 0,children:e.label}),!["paused","draft"].includes(e.phase)&&(0,i.jsx)(y.Badge,{size:"xs",variant:"light",color:"RUNNING"===S?"yellow":"FAILED"===S?"red":"INACTIVE"===S?"gray":"green",children:S}),!e.placeholder&&x&&(0,i.jsx)(w.Tooltip,{label:x,withArrow:!0,children:(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:[function(e){if(!e)return"";try{return new Date(e).toLocaleString()}catch(t){return String(e)}}(x)," ",I]})}),e.usage&&(0,i.jsxs)(o.Group,{gap:6,children:[(0,i.jsx)(iv.A,{size:12}),(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:[null!=(s=e.usage.totalTokens)?s:0," tok",void 0!==e.usage.cost?" • $".concat(e.usage.cost.toFixed(4)):" • n/a"]})]})]}),(0,i.jsx)(c.ActionIcon,{size:"sm",variant:"subtle",onClick:e=>{e.stopPropagation(),L()},"aria-label":z?"Collapse":"Expand",disabled:e.placeholder,children:z?(0,i.jsx)(iC.A,{size:16}):(0,i.jsx)(iy.A,{size:16})})]}),z&&!e.placeholder&&(0,i.jsxs)("div",{id:"timeline-panel-".concat(e.id),children:[e.attempt&&e.attempt>1||e.reason?(0,i.jsxs)(a.Stack,{gap:4,mt:6,children:[e.attempt&&e.attempt>1&&(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:(0,i.jsxs)("strong",{children:["Retry #",e.attempt]})}),e.reason&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:[(0,i.jsx)("strong",{children:"Reason:"})," ",e.reason]})]}):null,(()=>{var t;let l=null==r||null==(t=r.executionIds)?void 0:t[e.phase],n=l&&l.length?l[l.length-1]:void 0,a=e.executionId||n;return a?(0,i.jsx)(ib,{executionId:a}):null})(),m&&(null==r?void 0:r.id)&&!T&&(0,i.jsx)(o.Group,{gap:6,mt:6,children:["completed"].includes(e.phase)?null:(0,i.jsx)(iw,{workflowId:r.id})}),(null==r?void 0:r.id)&&!e.placeholder&&!T&&!["failed","paused","approved","merged","completed","draft"].includes(e.phase)&&(0,i.jsx)(o.Group,{gap:6,mt:6,children:(0,i.jsx)(ik,{workflowId:r.id,phase:e.phase})}),(null==r?void 0:r.id)&&T&&(0,i.jsx)("div",{style:{marginTop:6},children:(()=>{switch(e.phase){case"implementing":case"validating":return(0,i.jsxs)(o.Group,{gap:6,children:[(0,i.jsx)(iT,{workflowId:r.id}),(0,i.jsx)(iS,{workflowId:r.id})]});case"ai-reviewing":return(0,i.jsx)(o.Group,{gap:6,children:(0,i.jsx)(iS,{workflowId:r.id})});case"awaiting-review":return(0,i.jsxs)(o.Group,{gap:6,children:[(0,i.jsx)(iA,{workflowId:r.id}),(0,i.jsx)(iz,{workflowId:r.id}),(0,i.jsx)(iR,{taskId:r.taskId}),(0,i.jsx)(iI,{taskId:r.taskId})]});case"merging":return(0,i.jsx)(o.Group,{gap:6,children:(0,i.jsx)(iL,{workflowId:r.id})});case"cleaning":return(0,i.jsx)(o.Group,{gap:6,children:(0,i.jsx)(iE,{workflowId:r.id})});default:return null}})()})]})]},e.id)})})]}):(0,i.jsx)(b.Card,{withBorder:!0,padding:"md",radius:"md",children:(0,i.jsx)(d.Text,{children:"Please start vibing to see the timeline"})})}function iP(e){var t,r,c,u;let{task:p,disableOptions:m}=e,[g,x]=(0,n.useState)(null),f=v.i.useUtils(),j=null!=g?g:void 0,b=function(e){let[t,l]=(0,n.useReducer)(il,it),i=v.i.updateWorkflowOptions.useMutation(),r=(0,n.useCallback)(async t=>{e&&await i.mutateAsync({workflowId:e,config:t})},[e,i]),a=(0,n.useCallback)(e=>{let i={type:"SET_REQUIRE_HUMAN_APPROVAL",payload:e};l(i),r(il(t,i))},[t,r]),o=(0,n.useCallback)(e=>{let i={type:"SET_AUTO_COMMIT",payload:e};l(i),r(il(t,i))},[t,r]),s=(0,n.useCallback)(e=>{let i={type:"SET_CREATE_PR",payload:e};l(i),r(il(t,i))},[t,r]),d=(0,n.useCallback)(e=>{let i={type:"SET_AUTO_MERGE",payload:e};l(i),r(il(t,i))},[t,r]),c=(0,n.useCallback)(e=>{let i={type:"SET_AUTO_QUALITY_CHECKS",payload:e};l(i),r(il(t,i))},[t,r]),u=(0,n.useCallback)(e=>{let i={type:"SET_AI_CODE_REVIEW",payload:e};l(i),r(il(t,i))},[t,r]),p=(0,n.useCallback)(e=>{let i={type:"SET_STEP_BY_STEP_MODE",payload:e};l(i),r(il(t,i))},[t,r]);return{options:t,setRequireHumanApproval:a,setAutoCommit:o,setCreatePR:s,setAutoMerge:d,setAutoQualityChecks:c,setAiCodeReview:u,setStepByStepMode:p,initialize:(0,n.useCallback)(e=>{l({type:"INITIALIZE",payload:e})},[]),isUpdating:i.isPending}}(j),{autoQualityChecks:w,autoCommit:T,createPR:S,autoMerge:z,aiCodeReview:L,requireHumanApproval:E,stepByStepMode:R}=b.options,M=v.i.getWorkflow.useQuery(j?{workflowId:j}:ig.hT,{enabled:!!j,refetchOnWindowFocus:!1}),P=null==M?void 0:M.data,N=v.i.getLatestWorkflowByTaskId.useQuery({taskId:p.id},{enabled:!j&&!!p.id,refetchOnWindowFocus:!1,staleTime:15e3});(0,n.useEffect)(()=>{var e;!j&&(null==(e=N.data)?void 0:e.id)&&x(N.data.id)},[j,null==(t=N.data)?void 0:t.id]),v.i.onTaskWorkflowEvents.useSubscription({taskId:p.id},{onData:e=>{let t=null==e?void 0:e.workflow,l=(null==e?void 0:e.workflowId)||(null==t?void 0:t.id);if(t&&l){try{f.getWorkflow.setData({workflowId:l},t)}catch(e){l3.Rm.error("Error applying task workflow event snapshot",e,"workflow-review")}!j&&l&&x(l)}(null==e?void 0:e.type)==="deleted"&&j&&l===j&&x(null)},onError:e=>{console.error("WorkflowReview workflow subscription error:",e)}});let{logs:B,clearLogs:H}=function(e){var t,l,i,r;let[a,o]=(0,n.useState)([]),[s,d]=(0,n.useState)([]),[c,u]=(0,n.useState)([]),p=(0,n.useRef)(0),h=(0,n.useRef)(0),m=((null==e||null==(t=e.executionIds)?void 0:t.implementing)||[]).slice(-1)[0],g=((null==e||null==(l=e.executionIds)?void 0:l.merging)||[]).slice(-1)[0],x=v.i.getTaskExecutionLogs.useQuery({executionId:m||""},{enabled:!!m,refetchOnWindowFocus:!1,refetchInterval:(null==e?void 0:e.phase)==="implementing"&&!!m&&!a.length&&1e3}),f=null==x||null==(i=x.data)?void 0:i.logs,C=(0,n.useMemo)(()=>null!=f?f:[],[f]),{promptLines:y,systemPromptLines:j,rerunLines:b}=(()=>{try{var e,t,l,i,n,r;let a,o=(C||[]).find(e=>{var t;return null==e||null==(t=e.data)?void 0:t.prompt}),s=(null==o||null==(e=o.data)?void 0:e.prompt)?String(o.data.prompt):void 0;(null==o||null==(t=o.data)?void 0:t.appendSystemPrompt)?a=String(o.data.appendSystemPrompt):(null==o||null==(i=o.data)||null==(l=i.options)?void 0:l.appendSystemPrompt)&&(a=String(o.data.options.appendSystemPrompt));let d=(null==o||null==(n=o.data)?void 0:n.rerunContext)?"Reason: ".concat(o.data.rerunContext.reason||"","\nAttempt: ").concat(null!=(r=o.data.rerunContext.attempt)?r:"","\nPrevExec: ").concat(o.data.rerunContext.previousExecutionId||"","\nFailurePhase: ").concat(o.data.rerunContext.failurePhase||""):void 0;return{promptLines:s?["--- Prompt ---",s,"--- End Prompt ---"]:[],systemPromptLines:a?["--- System Prompt ---",a,"--- End System Prompt ---"]:[],rerunLines:d?["--- Rerun Context ---",d,"--- End Rerun Context ---"]:[]}}catch(e){return{promptLines:[],systemPromptLines:[],rerunLines:[]}}})(),w=v.i.getTaskExecutionLogs.useQuery({executionId:g||""},{enabled:!!g,refetchOnWindowFocus:!1,refetchInterval:(null==e?void 0:e.phase)==="merging"&&!!g&&!s.length&&1e3}),k=null==w||null==(r=w.data)?void 0:r.logs,T=(0,n.useMemo)(()=>null!=k?k:[],[k]),S=null==e?void 0:e.phase,A="implementing"===S&&!!m,z="merging"===S&&!!g;v.i.onExecutionUpdate.useSubscription(m?{executionId:m}:{},{enabled:!!m&&A,onData:e=>{if(!(null==e?void 0:e.logs))return;let t=Date.now();t-p.current<150||(p.current=t,o(e.logs.slice(-1e4)))}}),v.i.onExecutionUpdate.useSubscription(g?{executionId:g}:{},{enabled:!!g&&z,onData:e=>{if(!(null==e?void 0:e.logs))return;let t=Date.now();t-h.current<150||(h.current=t,d(e.logs.slice(-1e4)))}});let L=(0,n.useMemo)(()=>{let t=null==e?void 0:e.qualityResults;if(!t)return"";let l=[];return["tests","linting","typecheck","build"].forEach(e=>{var i,n;let r=null==(i=t.details)?void 0:i[e],a=null==(n=t.outputs)?void 0:n[e];a&&l.push("== ".concat(e.toUpperCase()," : ").concat(r?"PASSED":"FAILED"," ==\n").concat(a))}),l.join("\n\n")},[null==e?void 0:e.qualityResults]);(0,n.useEffect)(()=>{L&&u(L.split("\n"))},[L]);let E=(0,n.useCallback)(()=>{o([]),u([]),d([])},[]),I=(0,n.useCallback)(()=>{o([])},[]),R=(0,n.useCallback)(()=>{u([])},[]),M=(0,n.useCallback)(()=>{d([])},[]);return{logs:(0,n.useMemo)(()=>{let e=C.flatMap(e=>"string"==typeof e?[e]:[e.message]),t=T.flatMap(e=>"string"==typeof e?[e]:[e.message]),l=[...j,...y,...b];return{implementation:a.length?l.length?[...l,...a]:a:l.length?[...l,...e]:e,validation:c.length?c:L?L.split("\n"):["No validation logs yet."],merge:s.length?s:t}},[a,C,y,j,b,c,L,s,T]),clearLogs:E,clearImplementationLogs:I,clearValidationLogs:R,clearMergeLogs:M}}(P),D=v.i.aiReviewCode.useMutation(),F=v.i.listProviders.useQuery(void 0,{refetchOnWindowFocus:!1,staleTime:6e4}),U=v.i.getRoutingPolicy.useQuery(void 0,{refetchOnWindowFocus:!1,staleTime:6e4}),[V,O]=(0,n.useState)({}),G=null==P||null==(r=P.metadata)?void 0:r.aiReviewResult,W=(null==D?void 0:D.data)||G,_=v.i.getWorktreeInfo.useQuery({taskId:p.id},{enabled:!!p.id,refetchOnWindowFocus:!1,staleTime:3e4}),q=null==_?void 0:_.data,Z=v.i.resetWorkflow.useMutation(),Q=v.i.moveTask.useMutation({onSuccess:async()=>{await f.listTasks.invalidate()}}),K=v.i.pauseWorkflow.useMutation(),J=v.i.continueWorkflow.useMutation(),$=v.i.startWorkflow.useMutation({onSuccess:()=>{null==_||_.refetch()}}),Y=(0,n.useRef)(null);(0,n.useEffect)(()=>{var e,t,l,i,n,r,a;if(!(null==P?void 0:P.id)||!(null==P?void 0:P.metadata))return;let o={autoQualityChecks:null==(e=P.metadata.autoQualityChecks)||e,requireHumanApproval:null==(t=P.metadata.requireHumanApproval)||t,autoCommit:null!=(l=P.metadata.autoCommit)&&l,createPR:null!=(i=P.metadata.createPR)&&i,autoMerge:null!=(n=P.metadata.autoMerge)&&n,aiCodeReview:null==(r=P.metadata.aiCodeReview)||r,stepByStepMode:null!=(a=P.metadata.stepByStepMode)&&a},s="".concat(P.id,":").concat(JSON.stringify(o));Y.current!==s&&(Y.current=s,b.initialize(o))},[null==P?void 0:P.id,null==P?void 0:P.metadata,b]);let X=v.i.updateWorkflowOptions.useMutation(),ee=async()=>{try{var e,t;if(ei||en)return;if(H(),"in-progress"!==p.status)try{await Q.mutateAsync({id:p.id,status:"in-progress"})}catch(e){console.error("Failed to move task to in-progress:",e)}if(j){if(Object.keys(V||{}).length>0)try{await X.mutateAsync({workflowId:j,config:{aiRoutingOverrides:V}})}catch(e){console.error("Failed to apply routing overrides to workflow:",e)}try{await J.mutateAsync({workflowId:j})}catch(l){l3.Rm.warn("continueWorkflow failed; starting a new workflow instead:",l,"workflow-review"),x(null);let t=await (null==(e=$.mutateAsync)?void 0:e.call($,{taskId:p.id,config:{...b.options,aiRoutingOverrides:V}}));(null==t?void 0:t.workflowId)&&x(t.workflowId)}}else await (null==(t=$.mutateAsync)?void 0:t.call($,{taskId:p.id,config:{...b.options,aiRoutingOverrides:V}}))}catch(e){console.error("Failed to start vibing workflow:",e)}},et=((null==P?void 0:P.phase)==="failed"&&(null==P||null==(c=P.metadata)?void 0:c.requireHumanApproval)&&W&&(null==P||null==(u=P.error)?void 0:u.includes("AI code review score too low"))?"awaiting-review":null==P?void 0:P.phase)||"draft",el=!!(null==$?void 0:$.isPending)||!!(null==J?void 0:J.isPending),ei=!!j&&["merged","completed","approved"].includes(et),en=!!j&&["implementing","validating","ai-reviewing","awaiting-review","merging","cleaning"].includes(et),er="paused"===et,ea=(!j||!en)&&!el,eo=!j||!en,es=v.i.rerunFromPhase.useMutation(),ed=!eo||ei||en||er;return(0,i.jsxs)(a.Stack,{gap:"md",children:[(0,i.jsx)(s.Title,{order:4,children:"Vibing Parameters"}),(0,i.jsxs)(C.Paper,{p:"xs",withBorder:!0,children:[(0,i.jsx)(o.Group,{gap:"xs",children:(0,i.jsx)(s.Title,{order:6,children:"Basic function setup"})}),(0,i.jsxs)(o.Group,{gap:"xs",align:"center",wrap:"wrap",children:[(0,i.jsx)(ia,{label:"Human Approval",tooltip:E?"Human review enabled - leaves changes uncommitted for manual review/testing (disables automation)":"Enable human review - will disable all automation options",checked:E,disabled:!ea,onChange:b.setRequireHumanApproval}),(0,i.jsx)(ia,{label:"AI Review",tooltip:L?"AI code review enabled - performs extra code review and fixes":"Enable AI code review for additional quality checks",checked:L,disabled:!ea,onChange:b.setAiCodeReview}),(0,i.jsx)(ia,{label:"Auto Quality Checks",tooltip:w?"Auto quality checks enabled - runs tests, linting, type checking, and builds automatically":"Enable automatic quality checks (tests, linting, type checking, builds)",checked:w,disabled:!ea,onChange:b.setAutoQualityChecks}),(0,i.jsx)(ia,{label:"Auto Commit",tooltip:T?"Auto commit enabled - automatically commits changes after implementation":E?"Disabled: Human review mode keeps changes uncommitted":(null==m?void 0:m.autoCommit)?"Temporarily disabled: Auto Commit functions not implemented yet":"Enable automatic commit of changes after implementation",checked:T,disabled:!ea||E||!!(null==m?void 0:m.autoCommit),onChange:b.setAutoCommit}),(0,i.jsx)(ia,{label:"Create PR",tooltip:S?"Create PR enabled - will push branch and create PR (auto-enables Auto Commit)":E?"Disabled: Human review mode disables automation":z?"Disabled: Auto Merge conflicts with Create PR":(null==m?void 0:m.createPR)?"Temporarily disabled: Create PR functions not implemented yet":"Enable to push branch and create PR (enables Auto Commit)",checked:S,disabled:!ea||E||z||!!(null==m?void 0:m.createPR),onChange:b.setCreatePR}),(0,i.jsx)(ia,{label:"Auto Merge",tooltip:z?"Auto merge enabled - AI will auto-merge to main/dev (use with caution)":E?"Disabled: Human review mode disables automation":S?"Disabled: Create PR conflicts with Auto Merge":(null==m?void 0:m.autoMerge)?"Temporarily disabled: Auto Merge functions not implemented yet":"Enable AI auto-merge to main/dev (disables Create PR) - use with caution",checked:z,disabled:!ea||E||S||!!(null==m?void 0:m.autoMerge),onChange:b.setAutoMerge}),(0,i.jsx)(ia,{label:"Step-by-step",tooltip:R?"Step-by-step mode enabled – workflow waits for Continue between phases":"Enable to pause automatically between phases for testing/debugging",checked:R,disabled:!ea,onChange:b.setStepByStepMode})]}),(0,i.jsx)(k.Divider,{my:8}),(0,i.jsxs)(o.Group,{justify:"space-between",mb:"xs",children:[(0,i.jsx)(s.Title,{order:6,children:"AI & Models for each step"}),(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["Defaults come from workspace settings. You can override per workflow.",ea?"":" (Locked while starting or running)"]})]}),(0,i.jsx)(o.Group,{gap:"xs",children:[{op:"execute_task",label:"Implementation"},{op:"quality_checks",label:"Quality Checks"},{op:"ai_codereview",label:"AI Review"},{op:"ai_merge",label:"Merge"}].map(e=>{var t,l,n,r,a,s,d,c;let{op:u,label:p}=e,m=V[u]||{},g=(null==(n=U.data)||null==(l=n.operations)||null==(t=l[u])?void 0:t.provider)||(null==(r=U.data)?void 0:r.defaultProvider),x=(null==(d=U.data)||null==(s=d.operations)||null==(a=s[u])?void 0:a.model)||"";return(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(y.Badge,{variant:"light",color:"gray",w:140,title:u,children:p}),(0,i.jsxs)(eg.Menu,{withinPortal:!0,position:"bottom-start",shadow:"md",children:[(0,i.jsx)(eg.Menu.Target,{children:(0,i.jsxs)(h.Button,{size:"xs",variant:"outline",disabled:!ea,children:[m.provider||g||"Select provider",m.model?":".concat(m.model):x?":".concat(x):""]})}),(0,i.jsxs)(eg.Menu.Dropdown,{children:[F.isLoading&&(0,i.jsx)(eg.Menu.Label,{children:"Loading providers…"}),!F.isLoading&&(!F.data||0===F.data.length)&&(0,i.jsx)(eg.Menu.Label,{children:"No providers found"}),null==(c=F.data)?void 0:c.filter(e=>e.available).map((e,t)=>{var l;return(0,i.jsxs)("div",{children:[(0,i.jsx)(eg.Menu.Label,{children:e.displayName||e.name}),(e.models&&e.models.length>0?e.models:["default"]).map(t=>{let l="string"==typeof t?t:t.id||String(t),n="string"==typeof t?t:t.name||t.id||String(t);return(0,i.jsxs)(eg.Menu.Item,{disabled:!ea,onClick:()=>O(t=>({...t,[u]:{provider:e.name,model:l}})),children:[e.name,":",n]},"ovr-".concat(u,"-").concat(e.name,":").concat(l))}),t<((null==(l=F.data)?void 0:l.length)||1)-1&&(0,i.jsx)(k.Divider,{my:4})]},"ovr-".concat(u,"-").concat(e.name,"-").concat(t))})]})]}),m.provider&&(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",color:"red",disabled:!ea,onClick:()=>O(e=>{let t={...e};return delete t[u],t}),children:"Clear override"})]},u)})}),(0,i.jsx)(k.Divider,{my:8}),(0,i.jsxs)(o.Group,{gap:"xs",align:"center",wrap:"wrap",children:[(0,i.jsx)(s.Title,{order:6,children:"Actions"}),(0,i.jsx)(h.Button,{size:"xs",leftSection:(0,i.jsx)(I.A,{size:14}),onClick:ee,loading:$.isPending||J.isPending,disabled:ed,variant:"gradient",gradient:{from:"blue",to:"cyan"},children:"Start Vibing"}),(0,i.jsx)(h.Button,{size:"xs",variant:"outline",color:"yellow",leftSection:(0,i.jsx)(im.A,{size:14}),onClick:()=>j&&K.mutate({workflowId:j}),loading:K.isPending,disabled:!0,children:"Pause"}),er&&(0,i.jsx)(h.Button,{size:"xs",variant:"outline",color:"green",disabled:!0,leftSection:(0,i.jsx)(I.A,{size:14}),onClick:()=>{var e,t;if(!j)return;let n=(null==P||null==(t=P.phaseHistory)||null==(e=t[(null==P?void 0:P.phaseHistory.length)-1])?void 0:e.to)||(null==P?void 0:P.lastPhase)||"implementing";l.e(440).then(l.bind(l,75440)).then(e=>{let{modals:t}=e;return t.openConfirmModal({title:"Rerun current phase",centered:!0,labels:{confirm:"Rerun",cancel:"Cancel"},children:(0,i.jsx)("span",{children:"This will reset later steps and logs. Continue?"}),onConfirm:()=>es.mutate({workflowId:j,phase:n})})})},loading:es.isPending,children:"Rerun Current Phase"}),(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",color:"red",leftSection:(0,i.jsx)(A.A,{size:14}),onClick:async()=>{if(j&&window.confirm("Reset this workflow? Worktree will be kept."))try{await Z.mutateAsync({workflowId:j,deleteWorktree:!1,force:!0}),x(null)}catch(e){l3.Rm.error("Failed to reset workflow:",e,"workflow-review")}},loading:Z.isPending,disabled:!j,children:"Reset Workflow"}),(0,i.jsx)(h.Button,{size:"xs",variant:"outline",color:"red",leftSection:(0,i.jsx)(eC.A,{size:14}),onClick:async()=>{if(j&&window.confirm("Reset and destroy? This will delete the worktree and its branch. This cannot be undone."))try{await Z.mutateAsync({workflowId:j,deleteWorktree:!0,force:!0}),x(null)}catch(e){l3.Rm.error("Failed to reset & destroy workflow:",e,"workflow-review")}},loading:Z.isPending,disabled:!j||!(null==q?void 0:q.path),children:"Reset & Destroy"})]}),z&&!E&&(0,i.jsx)(ii.Alert,{color:"orange",mt:"xs",children:(0,i.jsxs)(d.Text,{size:"xs",children:[(0,i.jsx)("strong",{children:"Warning:"})," Auto Merge will merge to the main/dev branch automatically without human approval."]})})]}),(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(C.Paper,{children:[(0,i.jsx)(o.Group,{justify:"space-between",mb:"sm",children:(0,i.jsxs)(o.Group,{children:[(0,i.jsx)(s.Title,{order:4,children:"Vibing Progress"}),(0,i.jsx)(y.Badge,{color:ip[et],variant:"light",children:String(et).toUpperCase()})]})}),(0,i.jsx)(iM,{workflow:P})]})})]})}var iN=l(77545);function iB(e){let{worktree:t,size:l="xs",showActions:n=!1}=e,r=function(){let e=(0,N.jE)();return v.i.createWorktreePR.useMutation({onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]})}})}(),a=async()=>{try{let e=await r.mutateAsync({taskId:t.taskId});e.success&&e.pullRequest?m.notifications.show({title:"PR Created",message:"Pull request created successfully: ".concat(e.pullRequest.url),color:"green"}):m.notifications.show({title:"PR Creation Failed",message:e.error||"Unknown error occurred",color:"red"})}catch(e){m.notifications.show({title:"PR Creation Failed",message:e instanceof Error?e.message:"Unknown error occurred",color:"red"})}};return(0,i.jsxs)(o.Group,{gap:4,align:"center",children:[(0,i.jsx)(w.Tooltip,{label:"Worktree: ".concat(t.path),children:(0,i.jsx)(y.Badge,{color:"green",variant:"light",size:l,leftSection:(0,i.jsx)(P.A,{size:10}),children:"active"})}),n&&(0,i.jsx)(w.Tooltip,{label:"Create Pull Request",children:(0,i.jsx)(c.ActionIcon,{size:"sm",variant:"light",color:"blue",onClick:e=>{e.stopPropagation(),a()},loading:r.isPending,children:(0,i.jsx)(iN.A,{size:12})})}),n&&(0,i.jsx)(w.Tooltip,{label:"Branch: ".concat(t.branchName),children:(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",style:{fontFamily:"monospace"},children:t.branchName})})]})}var iH=l(71911),iD=l(84356),iF=l(34201),iU=l(61839),iV=l(91509),iO=l(99970),iG=l(50008);function iW(e){var t,l;let{taskId:r,fromHash:s,toHash:c}=e,u=v.i.getTaskDiff.useQuery({taskId:r,fromHash:s,toHash:c},{refetchOnWindowFocus:!1,staleTime:6e4}),p=(0,n.useMemo)(()=>{var e;if(!(null==(e=u.data)?void 0:e.diff))return null;try{return(0,iG.FR)(u.data.diff)[0]||null}catch(e){return console.error("Error parsing diff:",e),null}},[null==(t=u.data)?void 0:t.diff]);if(u.isLoading)return(0,i.jsxs)(a.Stack,{align:"center",py:"xl",children:[(0,i.jsx)(iH.Loader,{size:"md"}),(0,i.jsx)(d.Text,{c:"dimmed",children:"Loading diff..."})]});if(u.isError)return(0,i.jsxs)(ii.Alert,{color:"red",icon:(0,i.jsx)(iU.A,{size:16}),children:["Failed to load diff: ",null==(l=u.error)?void 0:l.message]});let h=u.data;return(null==h?void 0:h.diff)&&""!==h.diff.trim()?p?(0,i.jsxs)(a.Stack,{gap:"md",children:[(0,i.jsxs)(o.Group,{justify:"space-between",children:[(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(d.Text,{fw:500,size:"sm",children:"Changes Summary"}),(0,i.jsxs)(y.Badge,{variant:"light",color:"green",size:"sm",children:["+",h.additions]}),(0,i.jsxs)(y.Badge,{variant:"light",color:"red",size:"sm",children:["-",h.deletions]})]}),(0,i.jsx)(o.Group,{gap:"xs",children:(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["From ",s.substring(0,7)," to ",c.substring(0,7)]})})]}),(0,i.jsx)(C.Paper,{withBorder:!0,children:(0,i.jsx)(iD.ScrollArea,{h:500,children:(0,i.jsx)("div",{style:{padding:"16px"},children:(0,i.jsx)(iG.oO,{viewType:"split",diffType:p.type,hunks:p.hunks,renderToken:(e,t,l)=>t(e,l),children:e=>e.map(e=>(0,i.jsx)(iG.D9,{hunk:e},"".concat(e.oldStart,"-").concat(e.oldLines,"-").concat(e.newStart,"-").concat(e.newLines)))})})})}),p&&(0,i.jsx)(C.Paper,{p:"sm",withBorder:!0,children:(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["File: ",p.newPath||p.oldPath]}),(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["• Type: ",p.type]}),p.oldRevision&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["• From: ",p.oldRevision.substring(0,7)]}),p.newRevision&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["• To: ",p.newRevision.substring(0,7)]})]})})]}):(0,i.jsxs)(a.Stack,{gap:"md",children:[(0,i.jsx)(ii.Alert,{color:"yellow",icon:(0,i.jsx)(iV.A,{size:16}),children:"Unable to parse diff for visual display. Showing raw diff below."}),(0,i.jsx)(C.Paper,{withBorder:!0,p:"md",children:(0,i.jsx)(iD.ScrollArea,{h:400,children:(0,i.jsx)(d.Text,{component:"pre",size:"sm",style:{whiteSpace:"pre-wrap"},children:h.diff})})})]}):(0,i.jsx)(ii.Alert,{color:"blue",icon:(0,i.jsx)(iV.A,{size:16}),children:"No changes found between these versions."})}function i_(e){var t,l,r,u;let{task:p,onClose:m}=e,[g,x]=(0,n.useState)(null),[f,j]=(0,n.useState)(!1),[b,k]=(0,n.useState)(!1),[T,S]=(0,n.useState)(null),[A,z]=(0,n.useState)(null),[L,E]=(0,n.useState)(1),I=v.i.getTaskHistory.useQuery({taskId:p.id,limit:100},{refetchOnWindowFocus:!1,staleTime:3e4}),R=v.i.getTaskVersion.useQuery({taskId:p.id,commitHash:g},{enabled:!!g,refetchOnWindowFocus:!1});if(I.isLoading)return(0,i.jsxs)(a.Stack,{align:"center",py:"xl",children:[(0,i.jsx)(iH.Loader,{size:"md"}),(0,i.jsx)(d.Text,{c:"dimmed",children:"Loading task history..."})]});if(I.isError)return(0,i.jsxs)(ii.Alert,{color:"red",icon:(0,i.jsx)(iU.A,{size:16}),children:["Failed to load task history: ",null==(r=I.error)?void 0:r.message]});if(!(null==(t=I.data)?void 0:t.available))return(0,i.jsx)(ii.Alert,{color:"yellow",icon:(0,i.jsx)(iV.A,{size:16}),children:(null==(u=I.data)?void 0:u.error)?"Git history not available: ".concat(I.data.error):"Git repository not available or task file not tracked in Git"});let M=I.data.history||[];if(0===M.length)return(0,i.jsx)(ii.Alert,{color:"blue",icon:(0,i.jsx)(iV.A,{size:16}),children:"No history available for this task. The task file may be new or not yet committed to Git."});let N=Math.ceil(M.length/20),B=(L-1)*20,H=M.slice(B,B+20);return(0,i.jsxs)(a.Stack,{gap:"md",children:[(0,i.jsxs)(o.Group,{justify:"space-between",children:[(0,i.jsxs)(o.Group,{children:[(0,i.jsx)(s.Title,{order:4,children:"Task History"}),(0,i.jsxs)(y.Badge,{variant:"light",size:"sm",children:[M.length," ",1===M.length?"commit":"commits"]})]}),m&&(0,i.jsx)(h.Button,{variant:"subtle",size:"xs",onClick:m,children:"Close"})]}),T&&!A&&(0,i.jsx)(ii.Alert,{color:"blue",icon:(0,i.jsx)(iV.A,{size:16}),children:(0,i.jsxs)(o.Group,{justify:"space-between",children:[(0,i.jsxs)(d.Text,{size:"sm",children:["Selected"," ",(0,i.jsx)(d.Text,{span:!0,fw:500,children:T.substring(0,7)})," ","for comparison. Click another commit to compare."]}),(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",onClick:()=>S(null),children:"Cancel"})]})}),(0,i.jsxs)(C.Paper,{withBorder:!0,p:"md",children:[(0,i.jsx)(iD.ScrollArea,{h:500,children:(0,i.jsx)(ix.Timeline,{active:-1,bulletSize:24,lineWidth:2,children:H.map((e,t)=>{let l=T===e.commitHash,n=e.changes.additions>0||e.changes.deletions>0;return(0,i.jsx)(ix.Timeline.Item,{bullet:(0,i.jsx)(P.A,{size:12}),title:(0,i.jsxs)(o.Group,{gap:"xs",wrap:"nowrap",children:[(0,i.jsx)(d.Text,{fw:500,size:"sm",truncate:!0,style:{flex:1},children:e.message}),(0,i.jsx)(y.Badge,{variant:l?"filled":"light",size:"xs",color:l?"blue":"gray",children:e.shortHash})]}),children:(0,i.jsxs)(a.Stack,{gap:"xs",children:[(0,i.jsxs)(o.Group,{gap:"xs",wrap:"nowrap",children:[(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["by"," ",(0,i.jsx)(d.Text,{span:!0,fw:500,children:e.author})]}),(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:"•"}),(0,i.jsx)(w.Tooltip,{label:e.date.toLocaleString(),children:(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:(e=>{let t=new Date().getTime()-e.getTime(),l=Math.floor(t/864e5);if(0===l){let e=Math.floor(t/36e5);if(0===e){let e=Math.floor(t/6e4);return e<=1?"just now":"".concat(e," minutes ago")}return 1===e?"1 hour ago":"".concat(e," hours ago")}return 1===l?"yesterday":l<7?"".concat(l," days ago"):e.toLocaleDateString()})(e.date)})}),n&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:"•"}),(0,i.jsxs)(o.Group,{gap:4,children:[e.changes.additions>0&&(0,i.jsxs)(d.Text,{size:"xs",c:"green",children:["+",e.changes.additions]}),e.changes.deletions>0&&(0,i.jsxs)(d.Text,{size:"xs",c:"red",children:["-",e.changes.deletions]})]})]})]}),(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(w.Tooltip,{label:"View file content at this version",children:(0,i.jsx)(c.ActionIcon,{variant:"subtle",size:"sm",onClick:()=>{x(e.commitHash),j(!0)},children:(0,i.jsx)(id.A,{size:14})})}),(0,i.jsx)(w.Tooltip,{label:T?T===e.commitHash?"Cancel comparison":"Compare with selected":"Select for comparison",children:(0,i.jsx)(c.ActionIcon,{variant:l?"filled":"subtle",size:"sm",color:l?"blue":"gray",onClick:()=>{var t;return t=e.commitHash,void(T?T===t?S(null):(z(t),k(!0)):S(t))},children:(0,i.jsx)(iO.A,{size:14})})}),t<H.length-1&&(0,i.jsx)(w.Tooltip,{label:"Compare with next commit",children:(0,i.jsx)(c.ActionIcon,{variant:"subtle",size:"sm",onClick:()=>{var l,i;return l=H[t+1].commitHash,i=e.commitHash,void(S(l),z(i),k(!0))},children:(0,i.jsx)(ey.A,{size:14})})})]})]})},e.commitHash)})})}),N>1&&(0,i.jsx)(o.Group,{justify:"center",mt:"md",children:(0,i.jsx)(iF.Pagination,{value:L,onChange:E,total:N,size:"sm"})})]}),(0,i.jsxs)(ep.Modal,{opened:f,onClose:()=>{j(!1),x(null)},title:(0,i.jsxs)(o.Group,{children:[(0,i.jsx)(d.Text,{fw:500,children:"Task Content"}),g&&(0,i.jsx)(y.Badge,{variant:"light",size:"sm",children:g.substring(0,7)})]}),size:"860px",styles:{body:{maxHeight:"calc(100vh - 200px)",overflowY:"auto"}},children:[R.isLoading&&(0,i.jsxs)(a.Stack,{align:"center",py:"xl",children:[(0,i.jsx)(iH.Loader,{size:"md"}),(0,i.jsx)(d.Text,{c:"dimmed",children:"Loading version content..."})]}),R.isError&&(0,i.jsxs)(ii.Alert,{color:"red",icon:(0,i.jsx)(iU.A,{size:16}),children:["Failed to load version: ",null==(l=R.error)?void 0:l.message]}),R.data&&(0,i.jsxs)(a.Stack,{gap:"md",children:[(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsxs)(d.Text,{size:"sm",c:"dimmed",children:["by"," ",(0,i.jsx)(d.Text,{span:!0,fw:500,children:R.data.author})]}),(0,i.jsxs)(d.Text,{size:"sm",c:"dimmed",children:["on ",R.data.date.toLocaleString()]})]}),(0,i.jsx)(iD.ScrollArea,{h:400,children:(0,i.jsx)(C.Paper,{p:"md",withBorder:!0,children:(0,i.jsx)(d.Text,{component:"pre",size:"sm",style:{whiteSpace:"pre-wrap"},children:R.data.content})})})]})]}),(0,i.jsx)(ep.Modal,{opened:b,onClose:()=>{k(!1),S(null),z(null)},title:(0,i.jsxs)(o.Group,{children:[(0,i.jsx)(d.Text,{fw:500,children:"Compare Versions"}),T&&A&&(0,i.jsxs)(o.Group,{gap:4,children:[(0,i.jsx)(y.Badge,{variant:"light",size:"sm",color:"red",children:T.substring(0,7)}),(0,i.jsx)(d.Text,{size:"sm",children:"→"}),(0,i.jsx)(y.Badge,{variant:"light",size:"sm",color:"green",children:A.substring(0,7)})]})]}),size:"860px",styles:{body:{maxHeight:"calc(100vh - 200px)",overflowY:"auto"}},children:T&&A&&(0,i.jsx)(iW,{taskId:p.id,fromHash:T,toHash:A})})]})}l(36242);let iq=["title","type","status","priority","due_date","content"],iZ=e=>(null!=e?e:"").trim(),iQ=["feature","bug","chore","refactor","test","doc"],iK=["low","medium","high"],iJ=[{value:"feature",label:"Feature"},{value:"bug",label:"Bug"},{value:"chore",label:"Chore"},{value:"refactor",label:"Refactor"},{value:"test",label:"Test"},{value:"doc",label:"Documentation"}],i$=[{value:"backlog",label:"Backlog"},{value:"in-progress",label:"In Progress"},{value:"review",label:"Review"},{value:"done",label:"Done"}],iY=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],iX="task-detail-unsaved-changes";function i1(e){var t,l,r,c,u,p,g,x,f,y,j,b,w;let{opened:T,onClose:S,mode:A,taskData:z,taskId:E,defaultStatus:R}=e,M="edit"===A?E||(null==z?void 0:z.id):null,[P,B]=(0,n.useState)({}),[D,F]=(0,n.useState)({}),[U,V]=(0,n.useState)(!1),[O,G]=(0,n.useState)(!1),[W,_]=(0,n.useState)(!1),[q,Q]=(0,n.useState)("details"),[K,J]=(0,n.useState)(!1),$=(0,Z.useRouter)(),Y=(0,Z.useSearchParams)(),X=(0,Z.usePathname)(),et=null!=X?X:"/",ei=(0,n.useRef)(null),en=(0,n.useRef)(!1),er=(0,n.useRef)(!1),ea=(0,n.useRef)(null),eo=(0,n.useRef)(null),es=(0,n.useRef)(""),ed=(0,n.useRef)({}),ec=(0,n.useRef)({}),eu=(0,n.useRef)(null),eb=(0,n.useRef)(null),ew=(0,N.jE)(),ek=(0,n.useCallback)(()=>({title:"",type:"feature",status:R||"backlog",priority:"medium",due_date:"",content:""}),[R]),eT=(0,n.useMemo)(()=>iq.some(e=>{let t=P[e],l=D[e];return"string"==typeof t||"string"==typeof l?iZ(t)!==iZ(l):t!==l}),[P,D]),eS="create"===A&&eT,eA=(0,n.useCallback)(()=>{let e=eu.current;eu.current=null,window.requestAnimationFrame(()=>{var t;if("undefined"==typeof document)return;let l=e&&document.contains(e)?e:eb.current;null==l||null==(t=l.focus)||t.call(l)})},[]),ez=(0,n.useCallback)(()=>{if(Q("details"),"create"===A){let e=ek();B({...e}),F({...e})}eu.current=null,ex.jQ.close(iX),S()},[ek,A,S]),eL=(0,n.useCallback)(e=>{if((null==e?void 0:e.force)||!eS)return void ez();if("undefined"!=typeof document){let e=document.activeElement;eu.current=e instanceof HTMLElement?e:null}ex.jQ.openConfirmModal({modalId:iX,title:"Discard unsaved changes?",centered:!0,withCloseButton:!1,closeOnEscape:!1,closeOnCancel:!0,labels:{confirm:"Stay",cancel:"Discard"},confirmProps:{autoFocus:!0},cancelProps:{color:"red",variant:"outline"},children:(0,i.jsx)(d.Text,{size:"sm",children:"You have unsaved task details. Closing now will discard your changes."}),onConfirm:eA,onCancel:ez})},[ez,eA,eS]);(0,n.useEffect)(()=>{ed.current=P},[P]),(0,n.useEffect)(()=>{ec.current=D},[D]);let eE=H(M||""),eI=(0,n.useMemo)(()=>{var e;return null!=(e=null==Y?void 0:Y.get("tab"))?e:null},[Y]);(0,n.useEffect)(()=>{if(eI){if("details"===eI)return void Q("details");"edit"===A&&"vibing"===eI&&Q("vibing")}},[eI,A]);let{data:eR,error:eM}=v.i.getTask.useQuery({id:M},{enabled:!!M&&T&&"edit"===A,refetchOnMount:!0,refetchOnWindowFocus:!1});(0,n.useEffect)(()=>{eM&&"edit"===A&&(console.warn("Failed to load task:",eM),alert("The requested task could not be found or is invalid."),S())},[eM,S,A]),b="edit"===A&&M||void 0,w=e=>{if(e&&e.id===M&&"edit"===A){en.current=!0;let t={title:e.title,content:e.content,type:e.type,status:e.status,priority:e.priority,due_date:e.due_date},l=ed.current,i=ec.current,n=e=>l[e]!==i[e],r={title:n("title")?l.title:t.title,content:n("content")?l.content:t.content,type:n("type")?l.type:t.type,status:n("status")?l.status:t.status,priority:n("priority")?l.priority:t.priority,due_date:n("due_date")?l.due_date:t.due_date},a={title:n("title")?i.title:t.title,content:n("content")?i.content:t.content,type:n("type")?i.type:t.type,status:n("status")?i.status:t.status,priority:n("priority")?i.priority:t.priority,due_date:n("due_date")?i.due_date:t.due_date};B(r),F(a),setTimeout(()=>{en.current=!1},100)}},v.i.onTaskUpdate.useSubscription({taskId:b},{enabled:!!b&&!!w,onData:e=>{"update"===e.type&&e.task&&w&&w(e.task)},onError:e=>{console.error("Task subscription error:",e)}}),(0,n.useEffect)(()=>{if(T){if("create"===A){Q("details");let e=ek();B({...e}),F({...e})}else if("edit"===A&&(eR||z)){let e=z||eR;if(e){let t={title:e.title,content:e.content,type:e.type,status:e.status,priority:e.priority,due_date:e.due_date};B(t),F(t)}}}},[ek,A,T,eR,z]);let eP=v.i.useUtils(),eN=v.i.listProviders.useQuery(void 0,{refetchOnWindowFocus:!1,staleTime:6e4}),eB=v.i.getRoutingPolicy.useQuery(void 0,{refetchOnWindowFocus:!1,staleTime:6e4}),eH=(null==(l=v.i.setOperationConfig)||null==(t=l.useMutation)?void 0:t.call(l))||{mutateAsync:async e=>{},isPending:!1},eD=v.i.openInEditor.useMutation(),eF=(null==(c=v.i.openInTerminal)||null==(r=c.useMutation)?void 0:r.call(c))||{mutateAsync:async()=>{},isPending:!1},eU=v.i.createWorktree.useMutation({onSuccess:async()=>{await eP.listWorktrees.invalidate()}}),eV=null==(p=v.i.cleanupWorktree)||null==(u=p.useMutation)?void 0:u.call(p,{onSuccess:async()=>{await eP.listWorktrees.invalidate()}}),eO=v.i.createTask.useMutation(),eG=v.i.improveTask.useMutation(),eW=v.i.updateTask.useMutation(),e_=v.i.createTask.useMutation({onSuccess:e=>{ew.invalidateQueries({queryKey:[["listTasks"]]}),m.notifications.show({title:"Task created",message:"".concat(e.id,": ").concat(e.title),color:"green"}),eL({force:!0})}}),eq=v.i.updateTask.useMutation({onSuccess:(e,t)=>{if(eP.listTasks.invalidate(),t){let{id:e,...l}=t;F({...D,...l}),void 0!==l.content&&(es.current=l.content)}G(!0),ea.current&&clearTimeout(ea.current),ea.current=setTimeout(()=>{G(!1)},2e3)},onError:e=>{console.warn("Auto-save failed:",e.message)}}),eZ=v.i.deleteTask.useMutation({onSuccess:()=>{eP.listTasks.invalidate(),S()}}),eQ=null==(g=v.i.commitChanges)?void 0:g.useMutation({onSuccess:()=>{eP.listTasks.invalidate(),F({...P}),_(!0),eo.current&&clearTimeout(eo.current),eo.current=setTimeout(()=>{_(!1)},3e3)},onError:e=>{console.error("Git commit failed:",e);let t=e.message||"Unknown error occurred";t.includes("not found")?alert("Failed to commit: Task may have been deleted or moved. Please refresh and try again."):alert("Failed to create git commit: "+t)}}),eK=(0,n.useCallback)((e,t)=>{ei.current&&clearTimeout(ei.current),ei.current=setTimeout(()=>{var l,i;let n=(null!=(i=null!=(l=e.title)?l:t.title)?i:"").trim();if("edit"===A&&""===n)return;let r=e.title!==t.title||e.content!==t.content||e.type!==t.type||e.status!==t.status||e.priority!==t.priority||e.due_date!==t.due_date;(null==eR?void 0:eR.id)&&r&&!eq.isPending&&eq.mutate({id:eR.id,...e})},1e3)},[null==eR?void 0:eR.id,eq,A]),eJ=(0,n.useCallback)(()=>{ei.current&&clearTimeout(ei.current),(null==eR?void 0:eR.id)&&!eq.isPending&&eq.mutate({id:eR.id,...P})},[null==eR?void 0:eR.id,P,eq]);(0,n.useEffect)(()=>()=>{ei.current&&clearTimeout(ei.current),ea.current&&clearTimeout(ea.current),eo.current&&clearTimeout(eo.current)},[]),(0,n.useEffect)(()=>{"edit"===A&&Object.keys(P).length>0&&Object.keys(D).length>0&&!en.current&&!er.current&&eK(P,D),er.current&&(er.current=!1)},[P,D,eK,A]);let e$=U||eO.isPending||eG.isPending||eW.isPending,eY=()=>{P.title&&e_.mutate({title:P.title,type:P.type,status:P.status,priority:P.priority,due_date:P.due_date||"",content:P.content||""})},eX=async()=>{let e=(P.title||"").trim();if(!e)return;let t={title:e,type:P.type||"feature",status:P.status||R||"backlog",priority:P.priority||"medium",due_date:P.due_date||"",content:P.content||""},l="create-improve-".concat(Date.now());V(!0),m.notifications.show({id:l,title:"Creating Task",message:"Creating task and kicking off Vibeman improvement...",loading:!0,autoClose:!1});let i=null;try{i=await eO.mutateAsync(t),await eP.listTasks.invalidate(),m.notifications.update({id:l,title:"Improving Task",message:"Task created. Vibeman will keep improving it in the background...",loading:!0,autoClose:!1}),eL();try{let e,n,r=await eG.mutateAsync({taskId:i.id,title:t.title,type:t.type,priority:t.priority,content:t.content}),a={title:"string"==typeof r.title?r.title:null,type:(e=r.type,"string"==typeof e&&iJ.some(t=>t.value===e))?r.type:null,priority:(n=r.priority,"string"==typeof n&&iY.some(e=>e.value===n))?r.priority:null,content:"string"==typeof r.content?r.content:null},o=function(e,t){let l="string"==typeof t.title?t.title.trim():"",i="string"==typeof t.content?t.content:null,n=t.type&&iQ.includes(t.type)?t.type:e.type,r=t.priority&&iK.includes(t.priority)?t.priority:e.priority,a=l.length>0?l:e.title,o=i&&i.trim().length>0?i:e.content;return{id:e.id,title:a,type:n,priority:r,content:o}}({id:i.id,title:t.title,type:t.type,priority:t.priority,content:t.content},a);await eW.mutateAsync(o),await eP.listTasks.invalidate(),m.notifications.update({id:l,title:"Task Created & Improved",message:"".concat(i.id,": ").concat(o.title),color:"green",loading:!1,autoClose:4e3})}catch(t){console.error("Task improvement failed after creation",t);let e=t instanceof Error?t.message:"Unknown error occurred";m.notifications.update({id:l,title:"Improvement Failed",message:"Task ".concat(i.id," was created, but improvement failed: ").concat(e,'. You can open the task later and run "Improve with Vibeman".'),color:"orange",loading:!1,autoClose:8e3})}}catch(t){console.error("Task creation failed during Create & Improve",t);let e=t instanceof Error?t.message:"Unknown error occurred";m.notifications.update({id:l,title:"Task Creation Failed",message:e,color:"red",loading:!1,autoClose:7e3})}finally{V(!1)}};if("edit"===A&&!eR&&!z)return null;let e1=async()=>{if(e9)try{await eU.mutateAsync({taskId:e9.id}),await eP.listWorktrees.invalidate()}catch(e){console.error("Failed to create worktree:",e)}},e0=async()=>{if(null==eE?void 0:eE.path)return eE.path;if(e9)try{var e,t;await eU.mutateAsync({taskId:e9.id});let l=await (null==(t=eP.getWorktreeInfo)||null==(e=t.fetch)?void 0:e.call(t,{taskId:e9.id}));if(l&&"object"==typeof l&&"path"in l)return l.path;await eP.listWorktrees.invalidate();return}catch(e){console.error("Failed to ensure worktree:",e);return}},e2=async()=>{try{let e=await e0()||(null==eE?void 0:eE.path);if(!e)return;await eD.mutateAsync({worktreePath:e})}catch(e){console.error("Failed to open editor:",e)}},e7=async()=>{try{let e=await e0()||(null==eE?void 0:eE.path);if(!e)return;await eF.mutateAsync({worktreePath:e})}catch(e){console.error("Failed to open Terminal:",e)}},e4=async()=>{if(e9&&(null==eE?void 0:eE.path)&&confirm("Remove this worktree and its branch? Uncommitted changes will be lost."))try{var e;if(eV)await eV.mutateAsync({taskId:e9.id,worktreePath:eE.path,branchName:eE.branchName,isConnectedToTask:!0,force:!0});else if(null==(e=v.i.deleteWorktree)?void 0:e.useMutation){let e=v.i.deleteWorktree.useMutation();await e.mutateAsync({taskId:e9.id,force:!0})}await eP.listWorktrees.invalidate()}catch(e){console.error("Failed to cleanup worktree:",e)}},e5=e=>{if(e){let t="create"===A&&"details"!==e?"details":e;Q(t);let l=ej(et,Y,"tab","details"===t?null:t);$.push(l,{scroll:!1})}},e9=z||eR;return(0,i.jsxs)(ep.Modal,{opened:T,onClose:eL,title:"create"===A?"Create New Task":(0,i.jsxs)(a.Stack,{gap:"xs",children:[(0,i.jsxs)(o.Group,{justify:"flex-start",children:[(0,i.jsx)(eh.Code,{children:null==e9?void 0:e9.id}),(0,i.jsx)(d.Text,{children:P.title||(null==e9?void 0:e9.title)})]}),eE&&(0,i.jsx)(iB,{worktree:eE,size:"sm",showActions:!0})]}),size:"860px",styles:{body:{maxHeight:"calc(100vh - 200px)",overflowY:"auto"}},children:["create"===A?(0,i.jsxs)(em.Tabs,{value:q,onChange:e5,children:[(0,i.jsx)(em.Tabs.List,{children:(0,i.jsx)(em.Tabs.Tab,{value:"details",leftSection:(0,i.jsx)(L.A,{size:16}),children:"Task Details"})}),(0,i.jsxs)(em.Tabs.Panel,{value:"details",pt:"md",children:[(0,i.jsxs)(a.Stack,{gap:"md",style:{paddingBottom:"10px"},children:[(0,i.jsx)(ee.TextInput,{label:"Title",value:P.title||"",onChange:e=>B({...P,title:e.target.value}),ref:eb}),(0,i.jsxs)(o.Group,{grow:!0,children:[(0,i.jsx)(el.Select,{label:"Type",value:P.type||"feature",data:iJ,onChange:e=>B({...P,type:e})}),(0,i.jsx)(el.Select,{label:"Status",value:P.status||R||"backlog",data:i$,onChange:e=>B({...P,status:e})}),(0,i.jsx)(el.Select,{label:"Priority",value:P.priority||"medium",data:iY,onChange:e=>B({...P,priority:e})}),(0,i.jsx)(ee.TextInput,{label:"Due Date",type:"date",value:P.due_date||"",onChange:e=>B({...P,due_date:e.target.value})})]}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)("div",{children:[(0,i.jsxs)(o.Group,{justify:"space-between",mb:"xs",children:[(0,i.jsx)(d.Text,{size:"sm",fw:500,children:"Content"}),(0,i.jsx)(o.Group,{gap:"sm",children:e9&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(eg.Menu,{withinPortal:!0,position:"bottom-start",shadow:"md",children:[(0,i.jsx)(eg.Menu.Target,{children:(0,i.jsx)(h.Button,{size:"xs",variant:"outline",loading:eN.isLoading,children:(()=>{var e;let t=eB.data,l=null==t||null==(e=t.operations)?void 0:e.improve_task,i=(null==l?void 0:l.provider)||(null==t?void 0:t.defaultProvider)||"Provider",n=(null==l?void 0:l.model)?":".concat(l.model):"";return"Improve Settings: ".concat(i).concat(n)})()})}),(0,i.jsxs)(eg.Menu.Dropdown,{children:[eN.isLoading&&(0,i.jsx)(eg.Menu.Label,{children:"Loading providers…"}),!eN.isLoading&&(!eN.data||0===eN.data.length)&&(0,i.jsx)(eg.Menu.Label,{children:"No providers found"}),null==(x=eN.data)?void 0:x.filter(e=>e.available).map((e,t)=>{var l;return(0,i.jsxs)("div",{children:[(0,i.jsx)(eg.Menu.Label,{children:e.displayName||e.name}),(e.models&&e.models.length>0?e.models:["default"]).map(t=>{let l="string"==typeof t?t:t.id||String(t),n="string"==typeof t?t:t.name||t.id||String(t);return(0,i.jsxs)(eg.Menu.Item,{onClick:async()=>{try{await eH.mutateAsync({operation:"improve_task",config:{provider:e.name,model:l}}),await eB.refetch()}catch(e){console.error("Failed to set improve_task routing:",e)}},children:[e.name,":",n]},"improve-".concat(e.name,":").concat(l))}),t<((null==(l=eN.data)?void 0:l.length)||1)-1&&(0,i.jsx)(k.Divider,{my:4})]},"improve-".concat(e.name,"-").concat(t))})]})]})})})]}),(0,i.jsx)(l7,{value:P.content||"",onChange:e=>B(t=>({...t,content:e})),placeholder:"Task description and acceptance criteria...",minHeight:"200px"})]})]}),(0,i.jsxs)(o.Group,{justify:"space-between",style:{position:"sticky",bottom:"-20px",left:0,right:0,padding:"16px",backgroundColor:"var(--mantine-color-body)",borderTop:"1px solid var(--mantine-color-default-border)",marginLeft:"-16px",marginRight:"-16px",marginBottom:"-16px",zIndex:10},children:[(0,i.jsx)(o.Group,{}),(0,i.jsxs)(o.Group,{justify:"flex-end",gap:"sm",children:[(0,i.jsx)(h.Button,{variant:"light",color:"violet",onClick:eX,leftSection:(0,i.jsx)(ef.A,{size:16}),disabled:!(P.title||"").trim()||e_.isPending||e$,loading:e$,children:"Create & Improve"}),(0,i.jsx)(h.Button,{onClick:eY,leftSection:(0,i.jsx)(ev.A,{size:16}),disabled:!(P.title||"").trim()||e$||eO.isPending,loading:e_.isPending,children:"Create Task"})]})]})]})]}):(0,i.jsxs)(em.Tabs,{value:q,onChange:e5,children:[(0,i.jsxs)(em.Tabs.List,{children:[(0,i.jsx)(em.Tabs.Tab,{value:"details",leftSection:(0,i.jsx)(L.A,{size:16}),children:"Task Details"}),"edit"===A&&e9&&(0,i.jsx)(em.Tabs.Tab,{value:"vibing",leftSection:(0,i.jsx)(I.A,{size:16}),children:"Vibing"})]}),(0,i.jsxs)(em.Tabs.Panel,{value:"details",pt:"md",children:[(0,i.jsxs)(a.Stack,{gap:"md",style:{paddingBottom:"10px"},children:[(0,i.jsx)(ee.TextInput,{label:"Title",value:P.title||"",onChange:e=>B({...P,title:e.target.value}),ref:eb}),(0,i.jsxs)(o.Group,{grow:!0,children:[(0,i.jsx)(el.Select,{label:"Type",value:P.type||(null==e9?void 0:e9.type),data:iJ,onChange:e=>B({...P,type:e})}),(0,i.jsx)(el.Select,{label:"Status",value:P.status||(null==e9?void 0:e9.status),data:i$,onChange:e=>B({...P,status:e})}),(0,i.jsx)(el.Select,{label:"Priority",value:P.priority||(null==e9?void 0:e9.priority),data:iY,onChange:e=>B({...P,priority:e})}),(0,i.jsx)(ee.TextInput,{label:"Due Date",type:"date",value:P.due_date||(null==e9?void 0:e9.due_date)||"",onChange:e=>B({...P,due_date:e.target.value})})]}),"edit"===A&&e9&&(0,i.jsx)(C.Paper,{p:"xs",withBorder:!0,children:(0,i.jsxs)(a.Stack,{gap:"xs",children:[(0,i.jsx)(s.Title,{order:6,children:"Quick Actions"}),(0,i.jsxs)(o.Group,{gap:"xs",wrap:"wrap",children:[(0,i.jsx)(h.Button,{size:"xs",onClick:e1,loading:eU.isPending,disabled:!!(null==eE?void 0:eE.path)||eU.isPending,children:"Setup Branch and Worktree"}),(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",color:"red",leftSection:(0,i.jsx)(eC.A,{size:14}),onClick:e4,loading:!!(null==eV?void 0:eV.isPending),disabled:!(null==eE?void 0:eE.path),children:"Cleanup Branch and Worktree"}),(0,i.jsx)(h.Button,{size:"xs",variant:"outline",onClick:e2,children:"Open in Code Editor"}),(0,i.jsx)(h.Button,{size:"xs",variant:"outline",onClick:e7,children:"Open in Terminal"})]})]})}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)("div",{children:[(0,i.jsxs)(o.Group,{justify:"space-between",mb:"xs",children:[(0,i.jsx)(d.Text,{size:"sm",fw:500,children:"Content"}),(0,i.jsxs)(o.Group,{gap:"sm",children:[O&&(0,i.jsx)(d.Text,{size:"xs",c:"green",fw:500,children:"✅ Auto Saved"}),W&&(0,i.jsx)(d.Text,{size:"xs",c:"blue",fw:500,children:"\uD83C\uDF89 Commit Success"}),e9&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(eg.Menu,{withinPortal:!0,position:"bottom-start",shadow:"md",children:[(0,i.jsx)(eg.Menu.Target,{children:(0,i.jsx)(h.Button,{size:"xs",variant:"outline",loading:eN.isLoading,children:(()=>{var e;let t=eB.data,l=null==t||null==(e=t.operations)?void 0:e.improve_task,i=(null==l?void 0:l.provider)||(null==t?void 0:t.defaultProvider)||"Provider",n=(null==l?void 0:l.model)?":".concat(l.model):"";return"Improve Settings: ".concat(i).concat(n)})()})}),(0,i.jsxs)(eg.Menu.Dropdown,{children:[eN.isLoading&&(0,i.jsx)(eg.Menu.Label,{children:"Loading providers…"}),!eN.isLoading&&(!eN.data||0===eN.data.length)&&(0,i.jsx)(eg.Menu.Label,{children:"No providers found"}),null==(f=eN.data)?void 0:f.filter(e=>e.available).map((e,t)=>{var l;return(0,i.jsxs)("div",{children:[(0,i.jsx)(eg.Menu.Label,{children:e.displayName||e.name}),(e.models&&e.models.length>0?e.models:["default"]).map(t=>{let l="string"==typeof t?t:t.id||String(t),n="string"==typeof t?t:t.name||t.id||String(t);return(0,i.jsxs)(eg.Menu.Item,{onClick:async()=>{try{await eH.mutateAsync({operation:"improve_task",config:{provider:e.name,model:l}}),await eB.refetch()}catch(e){console.error("Failed to set improve_task routing:",e)}},children:[e.name,":",n]},"improve2-".concat(e.name,":").concat(l))}),t<((null==(l=eN.data)?void 0:l.length)||1)-1&&(0,i.jsx)(k.Divider,{my:4})]},"improve2-".concat(e.name,"-").concat(t))})]})]}),(0,i.jsx)(h.Button,{size:"xs",variant:"outline",leftSection:(0,i.jsx)(ey.A,{size:14}),onClick:()=>J(!0),children:"View History"}),(0,i.jsx)(ie,{task:e9,title:P.title||e9.title,type:P.type||e9.type,priority:P.priority||e9.priority,content:P.content||e9.content,onAccept:e=>{"edit"===A&&(er.current=!0),B(t=>({...t,content:e.content,type:e.type,priority:e.priority,...e.title&&{title:e.title}}))}})]})]})]}),(0,i.jsx)(l7,{value:P.content||"",onChange:e=>B(t=>({...t,content:e})),onSave:"edit"===A?eJ:void 0,placeholder:"Task description and acceptance criteria...",minHeight:"200px"})]}),"edit"===A&&e9&&(0,i.jsxs)("div",{children:[(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["Created:"," ",(null==e9?void 0:e9.created_at)?new Date(e9.created_at).toLocaleString():"Unknown"]}),(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["Updated:"," ",(null==e9?void 0:e9.updated_at)?new Date(e9.updated_at).toLocaleString():"Unknown"]})]})]}),(0,i.jsxs)(o.Group,{justify:"space-between",style:{position:"sticky",bottom:"-20px",left:0,right:0,padding:"16px",backgroundColor:"var(--mantine-color-body)",borderTop:"1px solid var(--mantine-color-default-border)",marginLeft:"-16px",marginRight:"-16px",marginBottom:"-16px",zIndex:10},children:[(0,i.jsx)(o.Group,{children:e9&&(0,i.jsx)(h.Button,{variant:"filled",color:"red",onClick:()=>{confirm("Are you sure you want to delete this task?")&&eZ.mutate({id:e9.id})},leftSection:(0,i.jsx)(eC.A,{size:16}),children:"Delete Task"})}),(0,i.jsx)(o.Group,{justify:"flex-end",children:"edit"===A&&e9?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Button,{onClick:()=>{Q("vibing");let e=ej(et,Y,"tab","vibing");$.push(e,{scroll:!1})},leftSection:(0,i.jsx)(I.A,{size:16}),variant:"gradient",gradient:{from:"blue",to:"cyan"},children:"Start Vibing"}),(0,i.jsx)(h.Button,{onClick:()=>{var e,t;if("create"===A)return;let l=z||eR;if(!eQ||!l)return void alert("Git operations are not available. Please check if Git service is configured.");let i=(null!=(t=null!=(e=P.title)?e:l.title)?t:"").trim();if(!i)return void m.notifications.show({title:"Title required",message:"Please enter a task title.",color:"red"});let n="".concat("Update"," ").concat(l.id,": ").concat(i),r=".vibeman/tasks/".concat(l.id,".md");eQ.mutate({taskId:l.id,message:n,files:[r]})},leftSection:(0,i.jsx)(ev.A,{size:16}),disabled:!eQ||eQ.isPending||!(null!=(j=null!=(y=P.title)?y:null==e9?void 0:e9.title)?j:"").trim(),loading:null==eQ?void 0:eQ.isPending,children:"Save Changes"})]}):(0,i.jsx)(h.Button,{onClick:eY,leftSection:(0,i.jsx)(ev.A,{size:16}),disabled:!(P.title||"").trim(),loading:e_.isPending,children:"Create Task"})})]})]}),(0,i.jsx)(em.Tabs.Panel,{value:"vibing",pt:"md",children:e9&&(0,i.jsx)(iP,{task:e9,disableOptions:{autoCommit:!0,createPR:!0,autoMerge:!0}})})]}),e9&&(0,i.jsx)(ep.Modal,{opened:K,onClose:()=>J(!1),title:"Task History",size:"860px",styles:{body:{maxHeight:"calc(100vh - 200px)",overflowY:"auto"}},children:(0,i.jsx)(i_,{task:e9,onClose:()=>J(!1)})})]})}var i0=l(89475),i2=l(39669),i7=l(29122),i4=l(53563),i5=l(19664),i9=l.n(i5);let i3=[{value:"claude-code",label:"Claude Code"},{value:"codex",label:"Codex CLI"}],i6=[{value:"claude-sonnet-4-20250514",label:"Claude Sonnet 4"},{value:"claude-opus-4-1-20250805",label:"Claude Opus 4.1"},{value:"claude-3-5-haiku-20241022",label:"Claude 3.5 Haiku"}],i8=[{value:"gpt-5",label:"gpt‑5 (default)"},{value:"gpt-5-low",label:"gpt‑5 \xb7 low reasoning"},{value:"gpt-5-medium",label:"gpt‑5 \xb7 medium reasoning"},{value:"gpt-5-high",label:"gpt‑5 \xb7 high reasoning"},{value:"gpt-5-codex",label:"gpt‑5 Codex (default)"},{value:"gpt-5-codex-low",label:"gpt‑5 Codex \xb7 low reasoning"},{value:"gpt-5-codex-medium",label:"gpt‑5 Codex \xb7 medium reasoning"},{value:"gpt-5-codex-high",label:"gpt‑5 Codex \xb7 high reasoning"}];function ne(e){return"codex"===e?i8:i6}let nt=[{value:"vscode",label:"Visual Studio Code"},{value:"cursor",label:"Cursor"},{value:"vim",label:"Vim"},{value:"custom",label:"Custom"}],nl=[{value:"system",label:"System Default"},{value:"iterm2",label:"iTerm2"},{value:"warp",label:"Warp"},{value:"custom",label:"Custom"}];function ni(e){var t,l,r,s,g,x,f,C,y,j,b,T,S,z,L,E,I,R;let{opened:M,onClose:P}=e,N=e=>{let{label:t,tip:l}=e;return(0,i.jsxs)(o.Group,{gap:6,align:"center",children:[(0,i.jsx)(d.Text,{size:"sm",fw:500,children:t}),l&&(0,i.jsx)(w.Tooltip,{label:l,withArrow:!0,position:"right-start",children:(0,i.jsx)(c.ActionIcon,{variant:"subtle",size:"xs","aria-label":"".concat(t," help"),children:(0,i.jsx)(iV.A,{size:14})})})]})},[B,H]=(0,n.useState)(null),[F,U]=(0,n.useState)(null),[V,O]=(0,n.useState)(!1),[G,W]=(0,n.useState)([]),[_,q]=(0,n.useState)(!1),[Z,Q]=(0,n.useState)({}),[K,J]=(0,n.useState)(null),[$,Y]=(0,n.useState)(null),{data:X,isLoading:et}=v.i.getSettings.useQuery(void 0,{enabled:M}),ei=v.i.listProviders.useQuery(void 0,{enabled:M}),en=v.i.getEditorPresets.useQuery(void 0,{enabled:M}),er=v.i.getTerminalPresets.useQuery(void 0,{enabled:M}),ea=v.i.detectAllProviders.useQuery(void 0,{enabled:M}),eo=v.i.getLocalConfigInfo.useQuery(void 0,{enabled:M}),es=v.i.updateSettings.useMutation({onSuccess:()=>{m.notifications.show({title:"Settings Saved",message:"Your settings have been updated successfully.",color:"green",icon:(0,i.jsx)(iu.A,{size:16})}),m.notifications.show({title:"Restart May Be Required",message:"Some changes apply after restarting the command.",color:"blue",icon:(0,i.jsx)(iV.A,{size:16})}),O(!1),W([])},onError:e=>{m.notifications.show({title:"Save Failed",message:e.message,color:"red",icon:(0,i.jsx)(D.A,{size:16})})}}),ed=v.i.resetToDefaults.useMutation({onSuccess:e=>{H(e),U(e),O(!1),W([]),m.notifications.show({title:"Settings Reset",message:"Settings have been reset to defaults.",color:"blue",icon:(0,i.jsx)(A.A,{size:16})})}}),ec=v.i.detectQualityChecks.useMutation({onSuccess:e=>{(null==e?void 0:e.checks)?(H(t=>{if(!t)return t;let l={...t};return l.quality=l.quality||{checks:[]},l.quality.checks=e.checks,l}),O(!0),m.notifications.show({title:"Quality Checks Detected",message:"".concat(e.checks.length," check(s) detected and staged. Review and Save to persist."),color:"green",icon:(0,i.jsx)(iu.A,{size:16})})):m.notifications.show({title:"No Checks Detected",message:"AI could not determine suitable quality checks for this project.",color:"yellow",icon:(0,i.jsx)(iV.A,{size:16})})},onError:e=>{m.notifications.show({title:"Detection Failed",message:(null==e?void 0:e.message)||"Unable to detect quality checks.",color:"red",icon:(0,i.jsx)(D.A,{size:16})})}}),eu=v.i.applyEditorPreset.useMutation({onSuccess:(e,t)=>{if(e.success&&en.data){let e=en.data[t.presetName];if(e&&B){let t={...B};t.development={...t.development,editor:{...e}},H(t),m.notifications.show({title:"Editor Preset Applied",message:"Editor configuration has been updated.",color:"green",icon:(0,i.jsx)(iu.A,{size:16})})}}else{var l,n;m.notifications.show({title:"Failed to Apply Preset",message:(null==(n=e.errors)||null==(l=n[0])?void 0:l.message)||"Unknown error",color:"red",icon:(0,i.jsx)(D.A,{size:16})})}},onError:e=>{m.notifications.show({title:"Failed to Apply Preset",message:e.message,color:"red",icon:(0,i.jsx)(D.A,{size:16})})}}),eh=v.i.applyTerminalPreset.useMutation({onSuccess:(e,t)=>{if(e.success&&er.data){let e=er.data[t.presetName];if(e&&B){let t={...B};t.development={...t.development,terminal:{...e}},H(t),m.notifications.show({title:"Terminal Preset Applied",message:"Terminal configuration has been updated.",color:"green",icon:(0,i.jsx)(iu.A,{size:16})})}}else{var l,n;m.notifications.show({title:"Failed to Apply Preset",message:(null==(n=e.errors)||null==(l=n[0])?void 0:l.message)||"Unknown error",color:"red",icon:(0,i.jsx)(D.A,{size:16})})}},onError:e=>{m.notifications.show({title:"Failed to Apply Preset",message:e.message,color:"red",icon:(0,i.jsx)(D.A,{size:16})})}}),em=v.i.setProviderPath.useMutation({onSuccess:(e,t)=>{ea.refetch(),eo.refetch(),ei.refetch(),Q(e=>({...e,[t.provider]:t.path})),m.notifications.show({title:"Provider Path Updated",message:"Provider path has been set successfully.",color:"green",icon:(0,i.jsx)(iu.A,{size:16})})},onError:e=>{m.notifications.show({title:"Failed to Set Provider Path",message:e.message,color:"red",icon:(0,i.jsx)(D.A,{size:16})})}}),eg=v.i.clearProviderPath.useMutation({onSuccess:(e,t)=>{ea.refetch(),eo.refetch(),ei.refetch(),Q(e=>({...e,[t.provider]:""})),m.notifications.show({title:"Provider Path Cleared",message:"Provider path has been reset to auto-detection.",color:"blue",icon:(0,i.jsx)(A.A,{size:16})})},onError:e=>{m.notifications.show({title:"Failed to Clear Provider Path",message:e.message,color:"red",icon:(0,i.jsx)(D.A,{size:16})})}}),ex=(e,t)=>{Q(l=>({...l,[e]:t}))},ef=async e=>{var t;let l=(null!=(t=Z[e])?t:"").trim();if(!l)return void m.notifications.show({title:"Invalid Path",message:"Enter a binary path before updating.",color:"red",icon:(0,i.jsx)(D.A,{size:16})});J(e);try{await em.mutateAsync({provider:e,path:l})}catch(e){}finally{J(null)}},ev=async e=>{Y(e);try{await eg.mutateAsync({provider:e})}catch(e){}finally{Y(null)}};(0,n.useEffect)(()=>{X&&!B&&(H(X),U(X),O(!1))},[X,B]),(0,n.useEffect)(()=>{B&&F&&O(JSON.stringify(B)!==JSON.stringify(F))},[B,F]);let eC=(e,t)=>{if(!B)return;let l=JSON.parse(JSON.stringify(B)),i=l;for(let t=0;t<e.length-1;t++)i=i[e[t]];i[e[e.length-1]]=t,H(l)},ey=async()=>{if(B&&F){q(!0),W([]);try{var e,t,l,n,r,a;let o=(null==(e=B.quality)?void 0:e.checks)||[],s=[];if(o.forEach((e,t)=>{var l,i,n,r;if(!e)return;let a=(null==(i=e.name)||null==(l=i.trim)?void 0:l.call(i))||"",o=(null==(r=e.command)||null==(n=r.trim)?void 0:n.call(r))||"";a||s.push({path:["quality","checks",String(t),"name"],message:"Name is required"}),o||s.push({path:["quality","checks",String(t),"command"],message:"Command is required"})}),s.length>0){W(s),m.notifications.show({title:"Fix Quality Checks",message:"Each check must include a Name and Command.",color:"red",icon:(0,i.jsx)(D.A,{size:16})});return}let d=[],c=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let i in e){let n=[...l,i];"object"!=typeof e[i]||null===e[i]||Array.isArray(e[i])?e[i]!==t[i]&&d.push({path:n,value:e[i]}):t[i]?c(e[i],t[i],n):d.push({path:n,value:e[i]})}};c(B,F);let u=JSON.stringify((null==(t=B.quality)?void 0:t.checks)||[]),p=JSON.stringify((null==(l=F.quality)?void 0:l.checks)||[]);if(u!==p){for(let e=d.length-1;e>=0;e--)2===d[e].path.length&&"quality"===d[e].path[0]&&"checks"===d[e].path[1]&&d.splice(e,1);d.push({path:["quality","checks"],value:(null==(n=B.quality)?void 0:n.checks)||[]})}let h=B.agents.defaultProvider,g=B.agents.routingPolicy;if(g?g.defaultProvider!==h&&d.push({path:["agents","routingPolicy","defaultProvider"],value:h}):d.push({path:["agents","routingPolicy"],value:{defaultProvider:h,operations:{}}}),d.length>0){let e=await es.mutateAsync(d);e.success?U(B):(W(e.errors),m.notifications.show({title:"Save Failed",message:(null==(a=e.errors)||null==(r=a[0])?void 0:r.message)||"Validation failed. Please check inputs.",color:"red",icon:(0,i.jsx)(D.A,{size:16})}))}}catch(e){console.error("Failed to save settings:",e)}finally{q(!1)}}},ej=()=>{F&&(H(F),O(!1),W([]))};return et||!B?(0,i.jsx)(ep.Modal,{opened:M,onClose:P,title:"Settings",size:"lg",children:(0,i.jsx)(d.Text,{children:"Loading settings..."})}):(0,i.jsx)(ep.Modal,{opened:M,onClose:()=>{V?window.confirm("You have unsaved changes. Are you sure you want to close?")&&(ej(),P()):P()},title:(0,i.jsxs)(o.Group,{children:[(0,i.jsx)(u.A,{size:20}),(0,i.jsx)(d.Text,{fw:500,children:"Settings"})]}),size:"xl",closeOnClickOutside:!V,closeOnEscape:!V,children:(0,i.jsxs)(a.Stack,{gap:"md",children:[(0,i.jsx)(ii.Alert,{icon:(0,i.jsx)(iV.A,{size:16}),color:"blue",title:"Restart Required",children:(0,i.jsx)(d.Text,{size:"sm",children:"Some changes (e.g., provider/model, server host/port, git defaults) apply only after you restart the command."})}),G.length>0&&(0,i.jsx)(ii.Alert,{icon:(0,i.jsx)(D.A,{size:16}),color:"red",title:"Validation Errors",children:(0,i.jsx)(a.Stack,{gap:"xs",children:G.map((e,t)=>(0,i.jsxs)(d.Text,{size:"sm",children:[e.path.join("."),": ",e.message]},t))})}),(0,i.jsxs)(a.Stack,{gap:"md",children:[(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,mb:"sm",children:"Coding Agent"}),(0,i.jsxs)(o.Group,{gap:"sm",children:[(0,i.jsx)(el.Select,{label:(0,i.jsx)(N,{label:"Provider",tip:"AI provider"}),data:i3,value:B.agents.codingAgent.provider,size:"sm",onChange:e=>{var t;if(!e)return;let l=ne(e),i=B.agents.codingAgent.model,n=l.find(e=>e.value===i)?i:null==(t=l[0])?void 0:t.value;eC(["agents","codingAgent"],{...B.agents.codingAgent,provider:e,model:n})}}),(0,i.jsx)(el.Select,{label:(0,i.jsx)(N,{label:"Model",tip:"AI model used for code implementation"}),data:ne(B.agents.codingAgent.provider),value:B.agents.codingAgent.model,size:"sm",onChange:e=>e&&eC(["agents","codingAgent","model"],e)}),(0,i.jsx)(i0.NumberInput,{label:(0,i.jsx)(N,{label:"Max Tokens",tip:"Upper bound on output tokens. Leave blank for provider default (unlimited)."}),min:256,max:1e13,placeholder:"Unlimited (default)",value:null!=(y=B.agents.codingAgent.maxTokens)?y:void 0,size:"sm",onChange:e=>eC(["agents","codingAgent","maxTokens"],"number"==typeof e?e:void 0)})]})]}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,mb:"sm",children:"Review Agent"}),(0,i.jsxs)(o.Group,{gap:"sm",grow:!0,wrap:"wrap",children:[(0,i.jsx)(el.Select,{label:(0,i.jsx)(N,{label:"Provider",tip:"AI provider"}),data:i3,value:B.agents.judgeAgent.provider,size:"sm",onChange:e=>{var t;if(!e)return;let l=ne(e),i=B.agents.judgeAgent.model,n=l.find(e=>e.value===i)?i:null==(t=l[0])?void 0:t.value;eC(["agents","judgeAgent"],{...B.agents.judgeAgent,provider:e,model:n})}}),(0,i.jsx)(el.Select,{label:(0,i.jsx)(N,{label:"Model",tip:"AI model used for code review"}),data:ne(B.agents.judgeAgent.provider),value:B.agents.judgeAgent.model,size:"sm",onChange:e=>e&&eC(["agents","judgeAgent","model"],e)}),(0,i.jsx)(i0.NumberInput,{label:(0,i.jsx)(N,{label:"Max Tokens",tip:"Upper bound on output tokens. Leave blank for provider default (unlimited)."}),min:256,max:1e13,placeholder:"Unlimited (default)",value:null!=(j=B.agents.judgeAgent.maxTokens)?j:void 0,size:"sm",onChange:e=>eC(["agents","judgeAgent","maxTokens"],"number"==typeof e?e:void 0)}),(0,i.jsx)(i0.NumberInput,{label:(0,i.jsx)(N,{label:"Threshold Score",tip:"Minimum score required to pass AI review (0-100)"}),min:0,max:100,value:B.agents.judgeAgent.reviewThresholdScore,size:"sm",onChange:e=>"number"==typeof e&&eC(["agents","judgeAgent","reviewThresholdScore"],e)})]})]}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)("div",{children:[(0,i.jsxs)(o.Group,{justify:"space-between",mb:"sm",children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,children:"Provider Configuration"}),(0,i.jsx)(h.Button,{size:"xs",variant:"light",leftSection:(0,i.jsx)(A.A,{size:14}),loading:ea.isFetching,onClick:()=>{ea.refetch(),eo.refetch(),ei.refetch()},children:"Refresh Detection"})]}),(0,i.jsx)(a.Stack,{gap:"md",children:["claude-code","codex"].map(e=>{var t,l,n,r;let s=null==(t=ea.data)?void 0:t[e],u=null==(l=eo.data)?void 0:l.providers,m=null==u?void 0:u[e],g=null!=(n=null==m?void 0:m.binPath)?n:"",x=null!=(r=Z[e])?r:g,f=x.trim(),v=K===e,C=$===e,y=g.length>0,j=f.length>0&&f!==g&&!v&&!C,b="claude-code"===e?"Claude Code":"Codex CLI";return(0,i.jsxs)(p.Box,{p:"md",style:{border:"1px solid var(--mantine-color-gray-3)",borderRadius:"8px"},children:[(0,i.jsxs)(o.Group,{justify:"space-between",mb:"sm",children:[(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(d.Text,{size:"md",fw:500,children:b}),(null==s?void 0:s.found)?(0,i.jsx)(d.Text,{size:"xs",c:"teal",px:"xs",py:2,style:{backgroundColor:"var(--mantine-color-teal-1)",borderRadius:"4px"},children:"✓ Found"}):(0,i.jsx)(d.Text,{size:"xs",c:"red",px:"xs",py:2,style:{backgroundColor:"var(--mantine-color-red-1)",borderRadius:"4px"},children:"✗ Not Found"})]}),(0,i.jsx)(o.Group,{gap:"xs",children:(0,i.jsx)(h.Button,{size:"xs",variant:"subtle",disabled:!y||C,loading:C,onClick:()=>{ev(e)},children:"Reset to Auto"})})]}),(0,i.jsxs)(a.Stack,{gap:"xs",children:[(null==s?void 0:s.found)&&(0,i.jsxs)(o.Group,{gap:"sm",children:[(0,i.jsx)(d.Text,{size:"sm",c:"dimmed",children:"Path:"}),(0,i.jsx)(d.Text,{size:"sm",ff:"monospace",children:s.path}),s.method&&(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["(",s.method,")"]})]}),(null==s?void 0:s.version)&&(0,i.jsxs)(o.Group,{gap:"sm",children:[(0,i.jsx)(d.Text,{size:"sm",c:"dimmed",children:"Version:"}),(0,i.jsx)(d.Text,{size:"sm",children:s.version})]}),(null==s?void 0:s.error)&&(0,i.jsx)(d.Text,{size:"sm",c:"red",children:s.error}),(0,i.jsxs)(o.Group,{align:"flex-end",gap:"xs",wrap:"nowrap",children:[(0,i.jsx)(ee.TextInput,{style:{flex:1},label:(0,i.jsx)(N,{label:"Custom Binary Path",tip:"Override auto-detection with a specific path."}),placeholder:(null==s?void 0:s.found)?"Auto-detected: ".concat(s.path):"Enter path to binary",value:x,size:"sm",disabled:v||C,onChange:t=>{ex(e,t.target.value)},rightSection:x?(0,i.jsx)(c.ActionIcon,{variant:"subtle",color:"gray",size:"sm",onClick:()=>{ex(e,"")},disabled:v||C,children:(0,i.jsx)(D.A,{size:14})}):null,rightSectionPointerEvents:"auto"}),(0,i.jsx)(h.Button,{size:"xs",loading:v,disabled:!j,onClick:()=>{ef(e)},children:"Update"})]}),!(null==s?void 0:s.found)&&(0,i.jsxs)(d.Text,{size:"sm",c:"dimmed",children:["Not installed?"," ",(0,i.jsxs)(i9(),{href:"claude-code"===e?"https://docs.anthropic.com/en/docs/claude-code":"https://github.com/openai/codex",target:"_blank",children:["Install ",b]})]})]})]},e)})}),eo.data&&(0,i.jsx)(p.Box,{mt:"md",p:"sm",style:{backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"4px"},children:(0,i.jsxs)(d.Text,{size:"xs",c:"dimmed",children:["Local config: ",eo.data.exists?"✓":"✗"," ",eo.data.path]})})]}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,mb:"sm",children:"Default Prompts"}),(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsx)(i2.Textarea,{label:(0,i.jsx)(N,{label:"System Prompt",tip:"Default system prompt for AI agents"}),rows:4,value:B.agents.defaultPrompts.systemPrompt,size:"sm",onChange:e=>eC(["agents","defaultPrompts","systemPrompt"],e.target.value)}),(0,i.jsx)(i2.Textarea,{label:(0,i.jsx)(N,{label:"Task Prompt",tip:"Default prompt for task execution"}),rows:3,value:B.agents.defaultPrompts.taskPrompt,size:"sm",onChange:e=>eC(["agents","defaultPrompts","taskPrompt"],e.target.value)})]})]})]}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,children:"Vibing Automation"}),(0,i.jsx)(d.Text,{size:"sm",c:"dimmed",children:"this is the default configuration, you can change it for each Vibing."}),(0,i.jsxs)(o.Group,{gap:"sm",wrap:"wrap",children:[(0,i.jsx)(i7.Switch,{label:(0,i.jsx)(N,{label:"Auto Quality Checks",tip:"Automatically run quality checks after implementation"}),checked:B.defaultWorkflow.autoQualityChecks,size:"sm",onChange:e=>eC(["defaultWorkflow","autoQualityChecks"],e.target.checked)}),(0,i.jsx)(i7.Switch,{label:(0,i.jsx)(N,{label:"Require Human Approval",tip:"Require manual approval before merging changes"}),checked:B.defaultWorkflow.requireHumanApproval,size:"sm",onChange:e=>eC(["defaultWorkflow","requireHumanApproval"],e.target.checked)}),(0,i.jsx)(i7.Switch,{label:(0,i.jsx)(N,{label:"AI Code Review",tip:"Enable AI-powered code review before human review"}),checked:B.defaultWorkflow.aiCodeReview,size:"sm",onChange:e=>eC(["defaultWorkflow","aiCodeReview"],e.target.checked)}),(0,i.jsx)(i7.Switch,{label:(0,i.jsx)(N,{label:"Auto Commit",tip:"Automatically commit successful implementations"}),checked:B.defaultWorkflow.autoCommit,size:"sm",onChange:e=>eC(["defaultWorkflow","autoCommit"],e.target.checked)})]}),(0,i.jsx)(o.Group,{gap:"sm",grow:!0,wrap:"wrap",children:(0,i.jsx)(i0.NumberInput,{label:(0,i.jsx)(N,{label:"Max Implementation Attempts",tip:"Maximum retry attempts for failed implementations"}),min:1,max:10,value:B.defaultWorkflow.maxImplementationAttempts,size:"sm",onChange:e=>"number"==typeof e&&eC(["defaultWorkflow","maxImplementationAttempts"],e)})})]}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsxs)(o.Group,{justify:"space-between",children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,children:"Quality Checks"}),(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(h.Button,{size:"xs",variant:"light",leftSection:(0,i.jsx)(i4.A,{size:14}),loading:ec.isPending,onClick:()=>ec.mutate(),children:"Detect (AI)"}),(0,i.jsx)(h.Button,{size:"xs",variant:"default",onClick:()=>{let e=JSON.parse(JSON.stringify(B));e.quality=e.quality||{checks:[]},e.quality.checks=[...e.quality.checks||[],{name:"",command:"",args:[],timeout:3e4,enabled:!0}],H(e),O(!0)},children:"Add Check"})]})]}),(0,i.jsx)(d.Text,{size:"sm",c:"dimmed",children:"Configure fast, local quality checks. Empty means validation will be skipped."}),(0,i.jsxs)(a.Stack,{gap:"xs",children:[0===((null==(t=B.quality)?void 0:t.checks)||[]).length&&(0,i.jsx)(d.Text,{size:"sm",c:"dimmed",children:"No checks configured."}),((null==(l=B.quality)?void 0:l.checks)||[]).map((e,t)=>{var l;return(0,i.jsxs)(o.Group,{gap:"xs",align:"end",wrap:"wrap",children:[(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Name",tip:"Short label for this check"}),value:e.name||"",size:"sm",style:{minWidth:160},onChange:e=>{let l=JSON.parse(JSON.stringify(B));l.quality.checks[t].name=e.target.value,H(l),O(!0)}}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Command",tip:"Executable command (e.g., npm, yarn, cargo)"}),value:e.command||"",size:"sm",style:{minWidth:180},onChange:e=>{let l=JSON.parse(JSON.stringify(B));l.quality.checks[t].command=e.target.value,H(l),O(!0)}}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Args",tip:"Space-separated args (stored as array)"}),placeholder:"e.g., run lint",value:(e.args||[]).join(" "),size:"sm",style:{minWidth:220},onChange:e=>{let l=e.target.value.trim().length?e.target.value.split(/\s+/):[],i=JSON.parse(JSON.stringify(B));i.quality.checks[t].args=l,H(i),O(!0)}}),(0,i.jsx)(i0.NumberInput,{label:(0,i.jsx)(N,{label:"Timeout (ms)",tip:"1s–600000ms"}),min:1e3,max:6e5,value:null!=(l=e.timeout)?l:3e4,size:"sm",onChange:e=>{if("number"!=typeof e)return;let l=JSON.parse(JSON.stringify(B));l.quality.checks[t].timeout=Math.min(6e5,Math.max(1e3,e)),H(l),O(!0)}}),(0,i.jsx)(i7.Switch,{label:(0,i.jsx)(N,{label:"Enabled",tip:"Include in validation"}),checked:!1!==e.enabled,onChange:e=>{let l=JSON.parse(JSON.stringify(B));l.quality.checks[t].enabled=e.target.checked,H(l),O(!0)}}),(0,i.jsx)(h.Button,{size:"xs",color:"red",variant:"subtle",onClick:()=>{let e=JSON.parse(JSON.stringify(B));e.quality.checks.splice(t,1),H(e),O(!0)},children:"Remove"})]},"qc-".concat(t))})]})]}),(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,children:"Development Environment"}),(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Vibe Directory",tip:"Directory for Vibeman configuration and data. Leave blank for default (.vibeman)."}),placeholder:".vibeman (default)",value:null!=(b=B.development.vibeDir)?b:"",size:"sm",onChange:e=>eC(["development","vibeDir"],e.target.value||void 0)}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Default Git Branch",tip:"Default branch for new features and merging"}),value:B.development.git.defaultBranch,size:"sm",onChange:e=>eC(["development","git","defaultBranch"],e.target.value)}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Worktree Path",tip:"Base path for Git worktrees. Leave blank for default (../)."}),placeholder:"../ (default)",value:null!=(T=B.development.git.worktreePath)?T:"",size:"sm",onChange:e=>eC(["development","git","worktreePath"],e.target.value||void 0)}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.Text,{size:"md",fw:500,mb:"sm",children:"Code Editor"}),(0,i.jsxs)(o.Group,{gap:"sm",grow:!0,wrap:"wrap",children:[(0,i.jsx)(el.Select,{label:(0,i.jsx)(N,{label:"Editor Type",tip:"Select your preferred code editor"}),data:nt,value:null!=(S=null==(r=B.development.editor)?void 0:r.type)?S:"vscode",size:"sm",onChange:e=>eC(["development","editor","type"],e)}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Command",tip:"Executable command for the editor (e.g., 'code', 'cursor', 'vim')"}),placeholder:"Auto-detect based on type",value:null!=(z=null==(s=B.development.editor)?void 0:s.command)?z:"",size:"sm",onChange:e=>eC(["development","editor","command"],e.target.value||void 0)}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Display Name",tip:"Human-readable name for the editor"}),placeholder:"Auto-detect based on type",value:null!=(L=null==(g=B.development.editor)?void 0:g.name)?L:"",size:"sm",onChange:e=>eC(["development","editor","name"],e.target.value||void 0)})]}),en.data&&(0,i.jsxs)(o.Group,{mt:"xs",gap:"xs",children:[(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:"Quick presets:"}),Object.entries(en.data).map(e=>{let[t,l]=e;return(0,i.jsx)(h.Button,{size:"xs",variant:"light",onClick:()=>eu.mutate({presetName:t}),loading:eu.isPending,children:(null==l?void 0:l.name)||t},t)})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.Text,{size:"md",fw:500,mb:"sm",children:"Terminal"}),(0,i.jsxs)(o.Group,{gap:"sm",grow:!0,wrap:"wrap",children:[(0,i.jsx)(el.Select,{label:(0,i.jsx)(N,{label:"Terminal Type",tip:"Select your preferred terminal"}),data:nl,value:null!=(E=null==(x=B.development.terminal)?void 0:x.type)?E:"system",size:"sm",onChange:e=>eC(["development","terminal","type"],e)}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Command",tip:"Executable command for the terminal"}),placeholder:"Auto-detect based on type",value:null!=(I=null==(f=B.development.terminal)?void 0:f.command)?I:"",size:"sm",onChange:e=>eC(["development","terminal","command"],e.target.value||void 0)}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Display Name",tip:"Human-readable name for the terminal"}),placeholder:"Auto-detect based on type",value:null!=(R=null==(C=B.development.terminal)?void 0:C.name)?R:"",size:"sm",onChange:e=>eC(["development","terminal","name"],e.target.value||void 0)})]}),er.data&&(0,i.jsxs)(o.Group,{mt:"xs",gap:"xs",children:[(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:"Quick presets:"}),Object.entries(er.data).map(e=>{let[t,l]=e;return(0,i.jsx)(h.Button,{size:"xs",variant:"light",onClick:()=>eh.mutate({presetName:t}),loading:eh.isPending,children:(null==l?void 0:l.name)||t},t)})]})]})]})]}),(0,i.jsx)(k.Divider,{}),(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsx)(d.Text,{size:"lg",fw:500,children:"Server Configuration"}),(0,i.jsxs)(o.Group,{gap:"sm",grow:!0,wrap:"wrap",children:[(0,i.jsx)(i0.NumberInput,{label:(0,i.jsx)(N,{label:"Port",tip:"Server port (requires restart)"}),min:3e3,max:65535,value:B.server.port,size:"sm",onChange:e=>"number"==typeof e&&eC(["server","port"],e)}),(0,i.jsx)(ee.TextInput,{label:(0,i.jsx)(N,{label:"Host",tip:"Server host address (requires restart)"}),value:B.server.host,size:"sm",onChange:e=>eC(["server","host"],e.target.value)}),(0,i.jsx)(i7.Switch,{label:(0,i.jsx)(N,{label:"Auto Open Browser",tip:"Automatically open browser when server starts"}),checked:B.server.autoOpenBrowser,size:"sm",onChange:e=>eC(["server","autoOpenBrowser"],e.target.checked)})]})]})]}),(0,i.jsxs)(p.Box,{style:{position:"sticky",bottom:0,background:"var(--mantine-color-body)"},children:[(0,i.jsx)(k.Divider,{}),(0,i.jsxs)(o.Group,{justify:"space-between",style:{padding:"8px 0"},children:[(0,i.jsx)(o.Group,{children:(0,i.jsx)(h.Button,{variant:"light",color:"red",leftSection:(0,i.jsx)(A.A,{size:16}),onClick:()=>{ed.mutate()},loading:ed.isPending,children:"Reset to Defaults"})}),(0,i.jsxs)(o.Group,{children:[(0,i.jsx)(h.Button,{variant:"default",onClick:ej,disabled:!V,children:"Cancel"}),(0,i.jsx)(h.Button,{onClick:ey,loading:_,disabled:!V,leftSection:(0,i.jsx)(iu.A,{size:16}),children:"Save Changes"})]})]})]})]})})}var nn=l(9119),nr=l(47945),na=l(36190),no=l(87405),ns=l(99036),nd=l(26779),nc=l(2143);function nu(e){var t,l;let{opened:r,onClose:s}=e,{data:u,isLoading:p}=B(),[h,g]=(0,n.useState)(null),[x,f]=(0,n.useState)(new Set),C=(0,N.jE)(),j=v.i.openInEditor.useMutation(),k=(null==(l=v.i.openInTerminal)||null==(t=l.useMutation)?void 0:t.call(l))||{mutateAsync:async()=>({success:!1}),isPending:!1},T=v.i.cleanupWorktree.useMutation({onSuccess:(e,t)=>{let l=t.isConnectedToTask?t.taskId:t.worktreePath;f(e=>{let t=new Set(e);return t.delete(l),t}),m.notifications.show({title:"Success",message:"Worktree cleaned up successfully",color:"green"}),C.invalidateQueries({queryKey:[["listWorktrees"]]})},onError:(e,t)=>{let l=t.isConnectedToTask?t.taskId:t.worktreePath;f(e=>{let t=new Set(e);return t.delete(l),t}),m.notifications.show({title:"Error",message:e.message,color:"red"})}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ep.Modal,{opened:r,onClose:s,title:(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(P.A,{size:20}),(0,i.jsx)(d.Text,{fw:600,children:"Git Worktrees"})]}),size:"lg",centered:!0,children:(0,i.jsx)(a.Stack,{gap:"md",children:p?(0,i.jsxs)(o.Group,{justify:"center",p:"xl",children:[(0,i.jsx)(iH.Loader,{size:"md"}),(0,i.jsx)(d.Text,{c:"dimmed",children:"Loading worktrees..."})]}):u&&Array.isArray(u)&&0!==u.length?(0,i.jsxs)(a.Stack,{gap:"sm",children:[(0,i.jsxs)(d.Text,{size:"sm",fw:500,c:"dimmed",children:["Git Worktrees (",(null==u?void 0:u.length)||0,")"]}),Array.isArray(u)&&u.map(e=>(0,i.jsx)(b.Card,{withBorder:!0,p:"md",radius:"sm",children:(0,i.jsx)(a.Stack,{gap:"xs",children:(0,i.jsxs)(o.Group,{justify:"space-between",align:"flex-start",children:[(0,i.jsxs)("div",{style:{flex:1},children:[(0,i.jsxs)(o.Group,{gap:"xs",mb:"xs",children:[(0,i.jsx)(d.Text,{fw:600,size:"sm",children:e.taskId}),!e.isConnectedToTask&&(0,i.jsx)(y.Badge,{size:"xs",color:"orange",variant:"outline",children:"Unconnected"})]}),(0,i.jsxs)(o.Group,{gap:"xs",mb:"xs",children:[(0,i.jsx)(P.A,{size:14}),(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",children:e.branchName}),(0,i.jsx)(nn.CopyButton,{value:e.branchName,children:e=>{let{copied:t,copy:l}=e;return(0,i.jsx)(w.Tooltip,{label:t?"Copied":"Copy branch name",withArrow:!0,position:"top",children:(0,i.jsx)(c.ActionIcon,{color:t?"teal":"gray",variant:"subtle",size:"xs",onClick:l,children:t?(0,i.jsx)(iu.A,{style:{width:(0,nr.D)(12)}}):(0,i.jsx)(na.A,{style:{width:(0,nr.D)(12)}})})})}})]}),(0,i.jsxs)(o.Group,{gap:"xs",children:[(0,i.jsx)(no.A,{size:14}),(0,i.jsx)(d.Text,{size:"xs",c:"dimmed",truncate:!0,children:e.path}),(0,i.jsx)(nn.CopyButton,{value:e.path,children:e=>{let{copied:t,copy:l}=e;return(0,i.jsx)(w.Tooltip,{label:t?"Copied":"Copy path",withArrow:!0,position:"top",children:(0,i.jsx)(c.ActionIcon,{color:t?"teal":"gray",variant:"subtle",size:"xs",onClick:l,children:t?(0,i.jsx)(iu.A,{style:{width:(0,nr.D)(12)}}):(0,i.jsx)(na.A,{style:{width:(0,nr.D)(12)}})})})}})]})]}),(0,i.jsxs)(o.Group,{gap:"xs",align:"flex-start",children:[(0,i.jsx)(w.Tooltip,{label:"Open in VS Code",withArrow:!0,children:(0,i.jsx)(c.ActionIcon,{variant:"light",size:"sm",onClick:async()=>{try{await j.mutateAsync({worktreePath:e.path})}catch(e){console.error("Failed to open editor:",e)}},children:(0,i.jsx)(ns.A,{size:14})})}),(0,i.jsx)(w.Tooltip,{label:"Open in Terminal",withArrow:!0,children:(0,i.jsx)(c.ActionIcon,{variant:"light",size:"sm",onClick:async()=>{try{await k.mutateAsync({worktreePath:e.path})}catch(e){console.error("Failed to open Terminal:",e)}},children:(0,i.jsx)(nd.A,{size:14})})}),e.isConnectedToTask&&(0,i.jsx)(w.Tooltip,{label:"View Task Details",withArrow:!0,children:(0,i.jsx)(c.ActionIcon,{variant:"light",size:"sm",onClick:()=>g(e.taskId),children:(0,i.jsx)(nc.A,{size:14})})}),(0,i.jsx)(w.Tooltip,{label:"Remove worktree (branch + worktree)",withArrow:!0,children:(0,i.jsx)(c.ActionIcon,{variant:"light",color:"red",size:"sm",loading:x.has(e.isConnectedToTask?e.taskId:e.path),onClick:()=>{if(confirm("Are you sure you want to remove this worktree and its branch? This cannot be undone.")){let t=e.isConnectedToTask?e.taskId:e.path;f(e=>new Set(e).add(t)),T.mutate({taskId:e.isConnectedToTask?e.taskId:void 0,worktreePath:e.path,branchName:e.branchName,isConnectedToTask:e.isConnectedToTask,force:!0})}},children:(0,i.jsx)(eC.A,{size:14})})})]})]})})},e.taskId))]}):(0,i.jsx)(ii.Alert,{icon:(0,i.jsx)(iV.A,{size:16}),title:"No worktrees found",variant:"light",color:"gray",children:(0,i.jsx)(d.Text,{size:"sm",children:"No git worktrees are currently active."})})})}),h&&(0,i.jsx)(i1,{mode:"edit",taskId:h,opened:!!h,onClose:()=>g(null)})]})}function np(){let[e,t]=(0,n.useState)(!1),{data:l}=B();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Button,{variant:"light",leftSection:(0,i.jsx)(P.A,{size:16}),onClick:()=>t(!0),rightSection:l&&l.length>0?(0,i.jsx)(y.Badge,{size:"xs",variant:"filled",color:"blue",children:l.length}):null,children:"Worktrees"}),(0,i.jsx)(nu,{opened:e,onClose:()=>t(!1)})]})}function nh(){let[e,t]=(0,n.useState)(null),[l,p]=(0,n.useState)(!1),[h,m]=(0,n.useState)(),[g,x]=(0,n.useState)(!1),f=(0,Z.useRouter)(),v=(0,Z.useSearchParams)(),C=(0,Z.usePathname)(),y=null!=C?C:"/",j=(0,n.useMemo)(()=>{var e;return null!=(e=null==v?void 0:v.get("task"))?e:null},[v]);return(0,n.useEffect)(()=>{if(function(e){if(!e)return!1;let t=String(e).toUpperCase();return!(t.length>40)&&/^[A-Z0-9]+(?:-[A-Z0-9]+)+$/.test(t)}(j))t(j);else if(j){let e=ej(y,v,"task",null);f.replace(e,{scroll:!1})}},[j,y,v,f]),(0,i.jsxs)(r.Container,{size:"xl",py:"xl",children:[(0,i.jsxs)(a.Stack,{gap:"lg",children:[(0,i.jsxs)(o.Group,{justify:"space-between",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(s.Title,{order:1,children:"Vibeman Dashboard"}),(0,i.jsx)(d.Text,{c:"dimmed",children:"Git-native task management with AI assistance"})]}),(0,i.jsxs)(o.Group,{gap:"sm",children:[(0,i.jsx)(np,{}),(0,i.jsx)(c.ActionIcon,{variant:"light",size:"lg",onClick:()=>x(!0),title:"Settings",children:(0,i.jsx)(u.A,{size:18})})]})]}),(0,i.jsx)(eu,{onTaskClick:e=>{t(e.id);let l=ej(y,v,"task",e.id);f.push(l,{scroll:!1})},onCreateTask:e=>{m(e),p(!0)}})]}),(0,i.jsx)(i1,{mode:"edit",taskId:e,opened:!!e,onClose:()=>{var e;t(null);let l=new URLSearchParams((null==v||null==(e=v.toString)?void 0:e.call(v))||"");l.delete("task"),l.delete("tab");let i=l.toString(),n=i?"".concat(y,"?").concat(i):y;f.push(n,{scroll:!1})}}),(0,i.jsx)(i1,{mode:"create",opened:l,onClose:()=>{p(!1),m(void 0)},defaultStatus:h}),(0,i.jsx)(ni,{opened:g,onClose:()=>x(!1)})]})}function nm(){return(0,i.jsx)(n.Suspense,{fallback:null,children:(0,i.jsx)(nh,{})})}},29682:(e,t,l)=>{Promise.resolve().then(l.bind(l,23156))},33783:()=>{},33977:()=>{},38641:()=>{},46577:()=>{},46889:()=>{},66321:()=>{},78503:()=>{},81401:()=>{},81961:()=>{},90312:()=>{},92471:()=>{},92490:()=>{},98878:(e,t,l)=>{"use strict";l.d(t,{Rm:()=>c});var i=l(98978),n=l.n(i),r=l(77011);let a="undefined"!=typeof globalThis&&"window"in globalThis,o={level:"true"===r.env.VERBOSE||void 0!==r&&r.argv&&(r.argv.includes("--verbose")||r.argv.includes("-v"))?"debug":"error",...a?{browser:{asObject:!1}}:{formatters:{level:e=>({level:e}),log:e=>e},transport:{target:"pino-pretty",options:{colorize:!0}}}},s=n()(o);function d(e){return s.child({context:e})}let c={error:(e,t,l)=>{let i=l?d(l):s;t instanceof Error?i.error({err:t},e):t?i.error({error:t},e):i.error(e)},warn:(e,t,l)=>{let i=l?d(l):s;t?i.warn({data:t},e):i.warn(e)},info:(e,t,l)=>{let i=l?d(l):s;t?i.info({data:t},e):i.info(e)},debug:(e,t,l)=>{let i=l?d(l):s;t?i.debug({data:t},e):i.debug(e)},trace:(e,t,l)=>{let i=l?d(l):s;t?i.trace({data:t},e):i.trace(e)}}}},e=>{e.O(0,[109,956,598,194,249,575,823,587,18,358],()=>e(e.s=29682)),_N_E=e.O()}]);