@alook/app 0.0.132 → 0.0.134

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 (104) hide show
  1. package/bundled/email-worker/index.js +36 -17
  2. package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
  3. package/bundled/web/.open-next/assets/BUILD_ID +1 -1
  4. package/bundled/web/.open-next/assets/_next/static/chunks/0vq-9me5zdpwe.js +1 -0
  5. package/bundled/web/.open-next/assets/_next/static/chunks/{3issuq6aouf1q.js → 1soxnit9hjz-0.js} +1 -1
  6. package/bundled/web/.open-next/assets/_next/static/chunks/{1iux65sajp19w.js → 25mf0rxvnm36s.js} +1 -1
  7. package/bundled/web/.open-next/assets/_next/static/chunks/29vahszwp_yzk.js +3 -0
  8. package/bundled/web/.open-next/assets/_next/static/chunks/2evdmhjrm4fp4.js +1 -0
  9. package/bundled/web/.open-next/assets/_next/static/chunks/2owkk0a9xurql.js +1 -0
  10. package/bundled/web/.open-next/assets/_next/static/chunks/{27vz1_55bn5h_.js → 2vvce1uli_yf3.js} +1 -1
  11. package/bundled/web/.open-next/assets/_next/static/chunks/3ad50t_oqhpk_.js +1 -0
  12. package/bundled/web/.open-next/assets/_next/static/chunks/3g9-r7m865tot.js +63 -0
  13. package/bundled/web/.open-next/cache/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/_global-error.cache +1 -1
  14. package/bundled/web/.open-next/cache/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/_not-found.cache +1 -1
  15. package/bundled/web/.open-next/cache/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/device.cache +1 -1
  16. package/bundled/web/.open-next/cache/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/privacy.cache +1 -1
  17. package/bundled/web/.open-next/cache/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/sitemap.xml.cache +1 -1
  18. package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
  19. package/bundled/web/.open-next/cloudflare/init.js +1 -1
  20. package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
  21. package/bundled/web/.open-next/middleware/handler.mjs +6 -6
  22. package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
  23. package/bundled/web/.open-next/server-functions/default/src/web/.next/app-path-routes-manifest.json +1 -0
  24. package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
  25. package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
  26. package/bundled/web/.open-next/server-functions/default/src/web/.next/required-server-files.json +3 -1
  27. package/bundled/web/.open-next/server-functions/default/src/web/.next/routes-manifest.json +8 -0
  28. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
  29. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
  30. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page_client-reference-manifest.js +1 -1
  31. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page_client-reference-manifest.js +1 -1
  32. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page_client-reference-manifest.js +1 -1
  33. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page_client-reference-manifest.js +1 -1
  34. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page_client-reference-manifest.js +1 -1
  35. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page_client-reference-manifest.js +1 -1
  36. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page_client-reference-manifest.js +1 -1
  37. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page_client-reference-manifest.js +1 -1
  38. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
  39. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
  40. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
  41. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page_client-reference-manifest.js +1 -1
  42. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
  43. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
  44. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page_client-reference-manifest.js +1 -1
  45. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
  46. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
  47. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/[traceId]/page_client-reference-manifest.js +1 -1
  48. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/page_client-reference-manifest.js +1 -1
  49. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
  50. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agents/recruit/route.js +1 -1
  51. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/[id]/trust/route.js +15 -0
  52. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/[id]/trust/route_client-reference-manifest.js +3 -0
  53. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/notify/route.js +2 -2
  54. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/send/route.js +1 -1
  55. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page/react-loadable-manifest.json +1 -1
  56. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
  57. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app-paths-manifest.json +1 -0
  58. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0xdps2u._.js +1 -1
  59. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__12fz1lr._.js +1 -1
  60. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +7 -5
  61. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{_1pt-oj4._.js → _0eu_mts._.js} +2 -2
  62. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{_0c6q0et._.js → _0kca2k0._.js} +2 -2
  63. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0r2vuif._.js +3 -0
  64. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0v95a0y._.js +14 -14
  65. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_139j3zh._.js +14 -14
  66. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_14_8l-b._.js +2 -2
  67. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1cdibag._.js +1 -1
  68. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1fn4mxe._.js +1 -1
  69. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1iaevpj._.js +2 -2
  70. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1nfaney._.js +14 -14
  71. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1oeo-oa._.js +1 -1
  72. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1p90k-4._.js +3 -0
  73. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/src_web__next-internal_server_app_api_email_[id]_trust_route_actions_0rx9apz.js +3 -0
  74. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/1b4r_lucide-react_dist_esm_icons_0ci7b7p._.js +3 -0
  75. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +7 -5
  76. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0p54okk._.js +13 -13
  77. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0qgcnj5._.js +1 -1
  78. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0t5ob43._.js +3 -0
  79. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1vs9m39._.js +1 -1
  80. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1xvbchf._.js +1 -1
  81. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_email_page_tsx_0gv3qni._.js +1 -1
  82. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_lib_api_ts_1ffelwp._.js +1 -1
  83. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
  84. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
  85. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
  86. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
  87. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +106 -104
  88. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +173 -105
  89. package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +6 -6
  90. package/bundled/ws-do/index.js +36 -17
  91. package/package.json +1 -1
  92. package/bundled/web/.open-next/assets/_next/static/chunks/0pd5shecdv7w3.js +0 -1
  93. package/bundled/web/.open-next/assets/_next/static/chunks/168g60th5ox02.js +0 -63
  94. package/bundled/web/.open-next/assets/_next/static/chunks/184t7di0k1wt-.js +0 -3
  95. package/bundled/web/.open-next/assets/_next/static/chunks/1ox78wqeeqant.js +0 -1
  96. package/bundled/web/.open-next/assets/_next/static/chunks/38j_4uwfj09mb.js +0 -1
  97. package/bundled/web/.open-next/assets/_next/static/chunks/3bfk44a51kg4q.js +0 -1
  98. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0qy7lt2._.js +0 -3
  99. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/1b4r_lucide-react_dist_esm_icons_0u7bkx8._.js +0 -3
  100. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_meetings_page_tsx_0ciapb3._.js +0 -3
  101. /package/bundled/web/.open-next/assets/_next/static/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/_buildManifest.js +0 -0
  102. /package/bundled/web/.open-next/assets/_next/static/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/_clientMiddlewareManifest.js +0 -0
  103. /package/bundled/web/.open-next/assets/_next/static/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/_ssgManifest.js +0 -0
  104. /package/bundled/web/.open-next/cache/{LwRrk9IiQO-kR73n2jKLg → VmFOnIGsnimmwjDQLrNlX}/robots.txt.cache +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,716032,e=>{"use strict";e.i(811374);var s=e.i(653772),t=e.i(511043),a=e.i(255334),r=e.i(613349),i=e.i(516266),n=e.i(126942),l=e.i(500324),c=e.i(23055),d=e.i(222862),o=e.i(186339),m=e.i(903477),u=e.i(473131),x=e.i(728886),h=e.i(553617),p=e.i(205189);function f(){let{workspaceId:e,slug:a}=(0,l.useWorkspace)(),r=(0,c.useSession)(),f=(0,n.useRouter)(),[g,j]=(0,t.useState)(""),[v,N]=(0,t.useState)(!0),[b,y]=(0,t.useState)(""),[k,w]=(0,t.useState)(""),[C,T]=(0,t.useState)(""),[S,E]=(0,t.useState)(""),[_,M]=(0,t.useState)(!1),[P,z]=(0,t.useState)({}),[I,O]=(0,t.useState)(""),[R,$]=(0,t.useState)(!1),F=(0,t.useCallback)(async()=>{N(!0);try{let s=r.data?.user?.id,[t,a]=await Promise.all([(0,d.listMembers)(e),(0,d.listWorkspaces)()]),i=t.find(e=>e.user_id===s);j(i?.role??"");let n=a.find(s=>s.id===e);n&&(y(n.name),w(n.slug),T(n.name),E(n.slug))}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to load workspace info")}finally{N(!1)}},[e,r.data?.user?.id]);(0,t.useEffect)(()=>{r.data&&F()},[F,r.data]);let A=b!==C||k!==S,D=async()=>{let s=(0,h.validateWorkspaceForm)({name:b,slug:k});if(z(s),!(0,h.hasWorkspaceFormErrors)(s)){M(!0);try{let s=await (0,d.updateWorkspace)(e,{name:b.trim(),slug:k.trim()});(0,p.trackSettingsUpdated)({setting_tab:"general"}),T(s.name),E(s.slug),i.toast.success("Workspace updated"),s.slug!==a&&f.replace(`/w/${s.slug}/settings`)}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to update workspace")}finally{M(!1)}}},L=async()=>{if(I===C){$(!0);try{await (0,d.deleteWorkspace)(e,C),i.toast.success("Workspace deleted"),f.replace("/workspaces")}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to delete workspace")}finally{$(!1)}}};return v?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(x.Skeleton,{className:"h-4 w-32"}),(0,s.jsx)(x.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(x.Skeleton,{className:"h-10 w-full"})]}):"owner"!==g?(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Only workspace owners can edit workspace settings."}):(0,s.jsxs)("div",{className:"space-y-10",children:[(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h2",{className:"text-sm font-medium",children:"Workspace"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(u.Label,{htmlFor:"workspace-name",children:"Name"}),(0,s.jsx)(m.Input,{id:"workspace-name",value:b,onChange:e=>{let s=e.target.value;y(s),P.name&&s.trim()&&z(e=>({...e,name:void 0}))},placeholder:"Workspace name","aria-invalid":!!P.name,"aria-describedby":P.name?"workspace-name-error":void 0}),P.name&&(0,s.jsx)("p",{id:"workspace-name-error",className:"text-xs text-destructive",children:P.name})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(u.Label,{htmlFor:"workspace-slug",children:"Slug"}),(0,s.jsx)(m.Input,{id:"workspace-slug",value:k,onChange:e=>{let s=e.target.value;w(s),P.slug&&s.trim()&&z(e=>({...e,slug:void 0}))},placeholder:"workspace-slug","aria-invalid":!!P.slug,"aria-describedby":P.slug?"workspace-slug-error":void 0}),P.slug&&(0,s.jsx)("p",{id:"workspace-slug-error",className:"text-xs text-destructive",children:P.slug}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:["Used in URLs: /w/",k,"/"]})]})]}),(0,s.jsx)(o.Button,{size:"sm",onClick:D,disabled:!A||_,children:_?"Saving…":"Save"})]}),(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h2",{className:"text-sm font-medium text-destructive",children:"Danger Zone"}),(0,s.jsxs)("div",{className:"rounded-md border border-destructive/30 p-4 space-y-3",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Deleting this workspace is permanent and cannot be undone. All agents, conversations, and data will be lost."}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsxs)(u.Label,{htmlFor:"delete-confirm",className:"text-xs",children:["Type ",(0,s.jsx)("span",{className:"font-medium text-foreground",children:C})," to confirm"]}),(0,s.jsx)(m.Input,{id:"delete-confirm",value:I,onChange:e=>O(e.target.value),placeholder:C})]}),(0,s.jsx)(o.Button,{size:"sm",variant:"destructive",onClick:L,disabled:I!==C||R,children:R?"Deleting…":"Delete Workspace"})]})]})]})}var g=e.i(740513);function j({ratio:e,size:t=16,stroke:a=1.5}){let i=(t-a)/2,n=2*Math.PI*i,l=(e<=0?0:e>=1?1:Math.log1p(99*e)/Math.log(100))*n;return(0,s.jsxs)("svg",{width:t,height:t,className:"shrink-0 -rotate-90","aria-hidden":!0,children:[(0,s.jsx)("circle",{cx:t/2,cy:t/2,r:i,fill:"none",stroke:"currentColor",strokeWidth:a,className:"text-border"}),(0,s.jsx)("circle",{cx:t/2,cy:t/2,r:i,fill:"none",stroke:"currentColor",strokeWidth:a,strokeDasharray:`${l} ${n-l}`,strokeLinecap:"round",className:(0,r.cn)("transition-all duration-300",e>.9?"text-destructive/70":e>.7?"text-yellow-500/50":"text-muted-foreground/30")})]})}function v(){let{workspaceId:e}=(0,l.useWorkspace)(),[a,r]=(0,t.useState)(""),[n,c]=(0,t.useState)(""),[o,m]=(0,t.useState)(!0),u=(0,t.useRef)(a);(0,t.useEffect)(()=>{u.current=a},[a]);let h=(0,t.useRef)(n);(0,t.useEffect)(()=>{h.current=n},[n]);let p=(0,t.useRef)(null),f=(0,t.useRef)(!1),v=(0,t.useCallback)(async()=>{m(!0);try{let s=await (0,d.getMemberMe)(e);r(s.global_instruction),c(s.global_instruction)}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to load settings")}finally{m(!1)}},[e]);(0,t.useEffect)(()=>{v()},[v]);let N=(0,t.useRef)(()=>{}),b=(0,t.useCallback)(async()=>{if(f.current)return;let s=u.current;if(s!==h.current){f.current=!0;try{let t=await (0,d.updateMemberMe)(e,s);c(t.global_instruction)}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to save")}finally{f.current=!1,u.current!==h.current&&N.current()}}},[e]),y=(0,t.useCallback)(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(b,500)},[b]);(0,t.useEffect)(()=>{N.current=y},[y]);let k=(0,t.useCallback)(e=>{r(e),y()},[y]);(0,t.useEffect)(()=>{let s=()=>{if(p.current&&clearTimeout(p.current),u.current!==h.current){let s=new URLSearchParams({workspace_id:e});fetch(`/api/members/me?${s}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:u.current}),keepalive:!0})}};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[e]),(0,t.useEffect)(()=>()=>{if(p.current&&clearTimeout(p.current),u.current!==h.current){let s=new URLSearchParams({workspace_id:e});fetch(`/api/members/me?${s}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:u.current}),keepalive:!0})}},[e]);let w=a.length/5e4;return o?(0,s.jsxs)("div",{className:"px-6 py-6 space-y-4",children:[(0,s.jsx)(x.Skeleton,{className:"h-4 w-48"}),(0,s.jsx)(x.Skeleton,{className:"h-40 w-full"})]}):(0,s.jsxs)("div",{className:"flex flex-col h-full",children:[(0,s.jsx)("div",{className:"flex-1 px-6 pt-4 pb-4",children:(0,s.jsx)(g.MarkdownEditor,{value:a,onChange:k,placeholder:"Write instructions that every agent you own will follow...",minHeight:"calc(100vh - 240px)",contentType:"markdown",variant:"seamless"})}),(0,s.jsxs)("div",{className:"flex items-center gap-2 px-6 py-3",children:[(0,s.jsx)(j,{ratio:w}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"This instruction is prepended to every agent's individual instruction."})]})]})}var N=e.i(330746),b=e.i(813141),y=e.i(947308),k=e.i(419412);let w=(0,k.default)("user-minus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);var C=e.i(329686);function T(e){return`${window.location.origin}/invite/${e}`}function S(){let{workspaceId:e}=(0,l.useWorkspace)(),a=(0,c.useSession)(),n=a.data?.user?.id,[m,u]=(0,t.useState)([]),[h,f]=(0,t.useState)([]),[g,j]=(0,t.useState)(!0),[v,k]=(0,t.useState)(!1),S=m.find(e=>e.user_id===n)?.role==="owner",E=(0,t.useCallback)(async()=>{j(!0);try{let[s,t]=await Promise.all([(0,d.listMembers)(e),(0,d.listInvites)(e).catch(()=>[])]);u(s),f(t)}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to load members")}finally{j(!1)}},[e]);(0,t.useEffect)(()=>{E()},[E]);let _=async()=>{k(!0);try{let s=await (0,d.createInvite)(e);(0,p.trackTeamMemberInvited)({workspace_id:e}),f(e=>[...e,s]);let t=T(s.token);await navigator.clipboard.writeText(t),i.toast.success("Invite link copied to clipboard")}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to generate invite")}finally{k(!1)}},M=async e=>{let s=T(e);try{await navigator.clipboard.writeText(s),i.toast.success("Invite link copied")}catch{i.toast.error("Failed to copy link")}},P=async s=>{try{await (0,d.revokeInvite)(e,s),f(e=>e.filter(e=>e.id!==s)),i.toast.success("Invite revoked")}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to revoke invite")}},z=async s=>{try{await (0,d.removeMember)(e,s),u(e=>e.filter(e=>e.id!==s)),i.toast.success("Member removed")}catch(e){i.toast.error(e instanceof Error?e.message:"Failed to remove member")}};return g?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(x.Skeleton,{className:"h-4 w-24"}),(0,s.jsx)(x.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(x.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(x.Skeleton,{className:"h-4 w-24 mt-6"}),(0,s.jsx)(x.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(x.Skeleton,{className:"h-10 w-full"})]}):(0,s.jsxs)("div",{className:"space-y-8",children:[S&&(0,s.jsxs)("section",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-sm font-medium",children:"Pending Invites"}),(0,s.jsxs)(o.Button,{size:"sm",variant:"outline",onClick:_,disabled:v,children:[(0,s.jsx)(y.Plus,{className:"size-3.5 mr-1"}),v?"Generating…":"Generate invite link"]})]}),0===h.length?(0,s.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:"No active invite links. Generate one to invite someone to this workspace."}):(0,s.jsx)("div",{className:"space-y-1.5",children:h.map(e=>{let t=new Date(e.expires_at),a=t<new Date;return(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2 text-xs",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:(0,r.cn)("font-mono truncate",a&&"text-muted-foreground line-through"),children:["/invite/",e.token.slice(0,12),"…"]}),(0,s.jsx)("p",{className:(0,r.cn)("text-muted-foreground/70 mt-0.5",a&&"text-destructive/70"),children:a?"Expired":`Expires ${t.toLocaleDateString()}`})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 ml-2 shrink-0",children:[!a&&(0,s.jsxs)(C.Tooltip,{children:[(0,s.jsx)(C.TooltipTrigger,{render:(0,s.jsx)(o.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>M(e.token)}),children:(0,s.jsx)(N.Copy,{className:"size-3.5"})}),(0,s.jsx)(C.TooltipContent,{children:"Copy invite link"})]}),(0,s.jsxs)(C.Tooltip,{children:[(0,s.jsx)(C.TooltipTrigger,{render:(0,s.jsx)(o.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:()=>P(e.id)}),children:(0,s.jsx)(b.Trash2,{className:"size-3.5"})}),(0,s.jsx)(C.TooltipContent,{children:"Revoke invite"})]})]})]},e.id)})})]}),(0,s.jsxs)("section",{className:"space-y-3",children:[(0,s.jsx)("h2",{className:"text-sm font-medium",children:"Members"}),(0,s.jsx)("div",{className:"space-y-1.5",children:m.map(e=>{let t=e.user_id===n,a=e.name?e.name.split(" ").map(e=>e[0]).join("").slice(0,2).toUpperCase():e.email.slice(0,2).toUpperCase();return(0,s.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/50 px-3 py-2",children:[(0,s.jsx)("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground shrink-0 overflow-hidden",children:e.image?(0,s.jsx)("img",{src:e.image,alt:e.name,className:"size-full object-cover"}):a}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"text-sm font-medium truncate leading-tight",children:[e.name||e.email,t&&(0,s.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"(you)"})]}),e.name&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.email})]}),(0,s.jsx)("span",{className:(0,r.cn)("text-xs px-1.5 py-0.5 rounded shrink-0","owner"===e.role?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:e.role}),S&&!t&&(0,s.jsxs)(C.Tooltip,{children:[(0,s.jsx)(C.TooltipTrigger,{render:(0,s.jsx)(o.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive shrink-0",onClick:()=>z(e.id)}),children:(0,s.jsx)(w,{className:"size-3.5"})}),(0,s.jsx)(C.TooltipContent,{children:"Remove member"})]})]},e.id)})})]})]})}var E=e.i(885515),_=e.i(254618),M=e.i(899746);function P(){let[e,a]=(0,t.useState)(!1),[r,n]=(0,t.useState)([...M.NOTIFICATION_EVENTS]),[l,c]=(0,t.useState)(!0),[d,o]=(0,t.useState)(!1);(0,t.useEffect)(()=>{c((0,M.isNotificationSupported)()),a((0,M.getNotificationEnabled)()),n((0,M.getNotificationEvents)()),(0,M.isNotificationSupported)()&&o("denied"===Notification.permission)},[]);let m=async e=>{if(!e){a(!1),(0,M.setNotificationEnabled)(!1);return}await (0,M.requestNotificationPermission)()?(a(!0),(0,M.setNotificationEnabled)(!0)):(o(!0),i.toast.error("Notification permission denied. Please enable it in browser settings."))};return l?(0,s.jsx)("div",{className:"space-y-6",children:(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h2",{className:"text-sm font-medium",children:"Browser Notifications"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)("p",{className:"text-sm",children:"Enable notifications"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get notified when tasks finish while the tab is in the background"})]}),(0,s.jsx)(_.Switch,{checked:e,onCheckedChange:m,disabled:d&&!e})]}),d&&!e&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:"Notification permission was denied. Please allow it in your browser settings."}),e&&(0,s.jsxs)("div",{className:"space-y-2 pl-0.5",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Notify me when:"}),M.NOTIFICATION_EVENTS.map(e=>(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[(0,s.jsx)(E.Checkbox,{checked:r.includes(e),onCheckedChange:()=>{n(s=>{let t=s.includes(e)?s.filter(s=>s!==e):[...s,e];return(0,M.setNotificationEvents)(t),t})}}),M.NOTIFICATION_EVENT_LABELS[e]]},e))]})]})]})}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your browser does not support notifications."})}let z=(0,k.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);var I=e.i(399561),O=e.i(460520),R=e.i(961909),$=e.i(790961);function F(){let[e,a]=(0,t.useState)(!1),[i,n]=(0,t.useState)(I.CLOUD_CODE_MONSTER_PET_PRESETS[0].id),l=(0,I.getCloudCodeMonsterPreset)(i);return(0,t.useEffect)(()=>{a((0,$.readHomePetSettings)().enabled),n((0,I.readCloudCodeMonsterPetPresetId)());let e=e=>{let s=e.detail?.presetId;n(s?(0,I.getCloudCodeMonsterPreset)(s).id:(0,I.readCloudCodeMonsterPetPresetId)())};return window.addEventListener(O.CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT,e),()=>{window.removeEventListener(O.CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT,e)}},[]),(0,s.jsxs)("div",{className:"space-y-8",children:[(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h2",{className:"text-sm font-medium",children:"Pet"}),(0,s.jsx)("div",{className:"space-y-4",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(u.Label,{htmlFor:"pet-enabled",className:"text-sm",children:"Enable pet"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Off by default. Turn it on when you want the workspace companion."})]}),(0,s.jsx)(_.Switch,{id:"pet-enabled",checked:e,onCheckedChange:e=>{a(e),(0,$.writeHomePetSettings)({enabled:e})}})]})})]}),e?(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-sm font-medium",children:"Preset"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l.name})]}),(0,s.jsx)("div",{className:"grid size-14 place-items-center rounded-md bg-card ring-1 ring-border/60",children:(0,s.jsx)(R.CloudCodeMonsterPresetPreview,{preset:l,className:"size-11"})})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:I.CLOUD_CODE_MONSTER_PET_PRESETS.map(e=>{let t=e.id===l.id;return(0,s.jsxs)("button",{type:"button","aria-pressed":t,onClick:()=>{n((0,I.writeCloudCodeMonsterPetPresetId)(e.id))},className:(0,r.cn)("group grid h-28 min-w-0 grid-rows-[1fr_auto] rounded-md border bg-card/60 p-2 text-left transition-all hover:border-foreground/20 hover:bg-accent/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",t?"border-primary/50 bg-accent text-foreground":"border-border/50 text-muted-foreground"),children:[(0,s.jsx)("div",{className:"grid place-items-center rounded bg-background/70 ring-1 ring-border/35",children:(0,s.jsx)(R.CloudCodeMonsterPresetPreview,{preset:e,className:"size-14 transition-transform duration-200 group-hover:scale-105"})}),(0,s.jsxs)("div",{className:"mt-1.5 flex min-w-0 items-center justify-between gap-1 text-[10px] leading-none",children:[(0,s.jsx)("span",{className:"truncate font-medium text-foreground",children:e.name}),t?(0,s.jsx)(z,{className:"size-3 shrink-0 text-primary"}):(0,s.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.id.replace("pet-","#")})]})]},e.id)})})]}):null]})}var A=e.i(355578),D=e.i(934351),L=e.i(875061);let W=(0,k.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var U=e.i(896210),B=e.i(392277);let H=(0,k.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);var q=e.i(646769);let G=(0,k.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function V({icon:e,label:t,value:a,sub:r}){return(0,s.jsx)(D.Card,{size:"sm",children:(0,s.jsxs)(D.CardContent,{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,s.jsx)(e,{className:"size-4"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,s.jsx)("p",{className:"text-2xl font-semibold leading-none tracking-tight",children:a}),r&&(0,s.jsx)(L.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4 font-normal",children:r})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground truncate",children:t})]})]})})}function J({agents:e,runtimes:t,activeTaskCounts:a,overview:r}){let i=new Map;for(let e of t){let s=e.daemon_id??e.id;i.set(s,i.get(s)||"online"===e.status)}let n=i.size,l=[...i.values()].filter(Boolean).length,c=Object.values(a).reduce((e,s)=>e+s,0),d=e.filter(e=>{let s=t.find(s=>s.id===e.runtime_id);return s?.status==="online"}).length;return(0,s.jsxs)("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-3 lg:grid-cols-6",children:[(0,s.jsx)(V,{icon:q.Monitor,label:"Machines",value:`${l}/${n}`,sub:"online"}),(0,s.jsx)(V,{icon:W,label:"Agents",value:e.length,sub:`${d} online`}),(0,s.jsx)(V,{icon:H,label:"Members",value:r.members.length,sub:r.pending_invites>0?`${r.pending_invites} pending`:void 0}),(0,s.jsx)(V,{icon:G,label:"Active Tasks",value:c,sub:r.task_stats.queued>0?`${r.task_stats.queued} queued`:void 0}),(0,s.jsx)(V,{icon:B.Send,label:"Emails Sent",value:r.email_stats.outbound,sub:`${r.email_stats.unread} unread`}),(0,s.jsx)(V,{icon:U.Mail,label:"Custom Emails",value:r.email_accounts.length})]})}function K({overview:e}){let{completed:t,failed:a,cancelled:r,queued:i,stale:n}=e.task_stats,l=t+a,c=l>0?(a/l*100).toFixed(1):"0";return(0,s.jsxs)(D.Card,{children:[(0,s.jsx)(D.CardHeader,{children:(0,s.jsx)(D.CardTitle,{children:"Task Health (Today)"})}),(0,s.jsx)(D.CardContent,{children:(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsx)(Q,{label:"Completed",value:t}),(0,s.jsx)(Q,{label:"Failed",value:a,className:a>0?"text-destructive":void 0}),(0,s.jsx)(Q,{label:"Cancelled",value:r}),(0,s.jsx)(Q,{label:"Failure Rate",value:`${c}%`,className:Number(c)>10?"text-destructive":void 0}),(0,s.jsx)(Q,{label:"Queue Backlog",value:i,className:i>10?"text-amber-500":void 0}),(0,s.jsx)(Q,{label:"Stale Tasks",value:n,className:n>0?"text-destructive":void 0})]})})]})}function Q({label:e,value:t,className:a}){return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:`text-xl font-semibold ${a??""}`,children:t}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e})]})}function Y({overview:e,agents:t}){let{inbound:a,outbound:r,unread:i,rejected:n}=e.email_stats,l=new Map(t.map(e=>[e.id,e.name]));return(0,s.jsxs)(D.Card,{children:[(0,s.jsx)(D.CardHeader,{children:(0,s.jsx)(D.CardTitle,{children:"Email Summary"})}),(0,s.jsxs)(D.CardContent,{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xl font-semibold",children:a}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Received"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xl font-semibold",children:r}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Sent"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:`text-xl font-semibold ${i>0?"text-primary":""}`,children:i}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Unread"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:`text-xl font-semibold ${n>0?"text-amber-500":""}`,children:n}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Untrust"})]})]}),e.email_accounts.length>0&&(0,s.jsxs)("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Custom Mailboxes"}),e.email_accounts.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsxs)(C.Tooltip,{children:[(0,s.jsx)(C.TooltipTrigger,{render:(0,s.jsx)("span",{className:`size-1.5 shrink-0 rounded-full ${"active"===e.status?"bg-emerald-500":"bg-destructive"}`})}),(0,s.jsx)(C.TooltipContent,{side:"top",children:"active"===e.status?"Active":`Error: ${e.error_message||"inactive"}`})]}),(0,s.jsx)("span",{className:"truncate",children:e.email_address})]}),(0,s.jsx)("span",{className:"text-muted-foreground shrink-0",children:l.get(e.agent_id)??"—"})]},e.id))]})]})]})}var Z=e.i(345262);function X({runtimes:e,agents:t}){let a=(0,n.useRouter)(),{slug:r}=(0,l.useWorkspace)(),i=new Map;for(let s of e){let e=s.daemon_id??s.id;i.has(e)||i.set(e,{runtimes:[],deviceInfo:s.device_info??""}),i.get(e).runtimes.push(s)}let c=[...i.entries()];return 0===c.length?(0,s.jsxs)(D.Card,{children:[(0,s.jsxs)(D.CardHeader,{children:[(0,s.jsx)(D.CardTitle,{children:"Machines"}),(0,s.jsx)(D.CardAction,{children:(0,s.jsx)("button",{type:"button",onClick:()=>a.push(`/w/${r}/runtimes`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,s.jsx)(Z.ArrowUpRight,{className:"size-4"})})})]}),(0,s.jsx)(D.CardContent,{children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"No machines connected."})})]}):(0,s.jsxs)(D.Card,{children:[(0,s.jsx)(D.CardHeader,{children:(0,s.jsx)(D.CardTitle,{children:"Machines"})}),(0,s.jsx)(D.CardContent,{className:"space-y-3",children:c.map(([e,a])=>{let r=a.runtimes.some(e=>"online"===e.status),i=a.runtimes.map(e=>e.last_seen_at).filter(Boolean).sort().reverse()[0],n=t.filter(e=>a.runtimes.some(s=>s.id===e.runtime_id)),l=a.runtimes.some(e=>e.pending_update_version),c=a.runtimes.find(e=>e.pending_update_version)?.pending_update_version;return(0,s.jsxs)("div",{className:"flex items-start gap-3 text-xs",children:[(0,s.jsxs)(C.Tooltip,{children:[(0,s.jsx)(C.TooltipTrigger,{render:(0,s.jsx)("span",{className:`mt-1 size-2 shrink-0 rounded-full ${r?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,s.jsx)(C.TooltipContent,{side:"top",children:r?"Online":"Offline"})]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium truncate",children:a.deviceInfo||e.slice(0,12)}),l&&(0,s.jsxs)(C.Tooltip,{children:[(0,s.jsx)(C.TooltipTrigger,{render:(0,s.jsx)("span",{children:(0,s.jsx)(L.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-amber-500 border-amber-500/30",children:"update"})})}),(0,s.jsxs)(C.TooltipContent,{side:"top",children:["Pending update to v",c]})]})]}),(0,s.jsxs)("div",{className:"text-muted-foreground mt-0.5",children:[n.length>0?n.map(e=>e.name).join(", "):"No agents"," · ",function(e){if(!e)return"never";let s=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(s<60)return`${s}s ago`;let t=Math.floor(s/60);if(t<60)return`${t}m ago`;let a=Math.floor(t/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}(i??null)]})]})]},e)})})]})}function ee({overview:e}){let t=(0,n.useRouter)(),{slug:a}=(0,l.useWorkspace)(),{members:r,pending_invites:i}=e;return(0,s.jsxs)(D.Card,{children:[(0,s.jsxs)(D.CardHeader,{children:[(0,s.jsx)(D.CardAction,{children:(0,s.jsx)("button",{type:"button",onClick:()=>t.push(`/w/${a}/settings`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,s.jsx)(Z.ArrowUpRight,{className:"size-4"})})}),(0,s.jsxs)(D.CardTitle,{children:["Team",i>0&&(0,s.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:["(",i," pending invite",i>1?"s":"",")"]})]})]}),(0,s.jsx)(D.CardContent,{className:"p-0",children:(0,s.jsx)("div",{className:"divide-y divide-border/50",children:[...r].sort((e,s)=>"owner"===e.role?-1:+("owner"===s.role)).map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[e.image?(0,s.jsx)("img",{src:e.image,alt:e.name,className:"size-7 rounded-full shrink-0"}):(0,s.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-medium",children:(e.name||e.email).charAt(0).toUpperCase()}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"text-sm font-medium truncate block",children:e.name||e.email}),e.name&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground truncate block",children:e.email})]}),(0,s.jsx)(L.Badge,{variant:"owner"===e.role?"default":"secondary",className:"text-[10px] px-1.5 py-0 shrink-0",children:e.role})]},e.id))})})]})}function es(){let{agents:e,runtimes:a,loading:r,activeTaskCounts:i}=(0,A.useAgentContext)(),{workspaceId:n}=(0,l.useWorkspace)(),[c,o]=(0,t.useState)(null),[m,u]=(0,t.useState)(!1);return((0,t.useEffect)(()=>{if(r)return;let e=!1;return u(!0),(0,d.getWorkspaceOverview)(n).then(s=>{e||o(s)}).catch(()=>{}).finally(()=>{e||u(!1)}),()=>{e=!0}},[r,n]),m||!c)?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(x.Skeleton,{className:"h-44 rounded-xl"}),(0,s.jsx)(x.Skeleton,{className:"h-44 rounded-xl"}),(0,s.jsx)(x.Skeleton,{className:"h-44 rounded-xl"}),(0,s.jsx)(x.Skeleton,{className:"h-44 rounded-xl"})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(J,{agents:e,runtimes:a,activeTaskCounts:i,overview:c}),(0,s.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,s.jsx)(K,{overview:c}),(0,s.jsx)(Y,{overview:c,agents:e})]}),(0,s.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,s.jsx)(X,{runtimes:a,agents:e}),(0,s.jsx)(ee,{overview:c})]})]})}let et=[{id:"general",label:"General"},{id:"pet",label:"Pet"},{id:"instruction",label:"Global Instruction"},{id:"notifications",label:"Notifications"},{id:"members",label:"Members"},{id:"usages",label:"Usages"}];e.s(["default",0,function(){let[e,i]=(0,t.useState)("general");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between border-b border-border/50 px-3 md:px-5 py-2.5 gap-3",children:(0,s.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,s.jsx)("h1",{className:"text-sm font-medium",children:"Settings"})})}),(0,s.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,s.jsxs)("nav",{className:"w-48 shrink-0 border-r border-border/50 py-3 px-2 hidden md:flex md:flex-col",children:[(0,s.jsx)("div",{className:"flex-1",children:et.map(t=>(0,s.jsx)("button",{onClick:()=>i(t.id),className:(0,r.cn)("w-full rounded-md px-2.5 py-1.5 text-left text-sm transition-colors",e===t.id?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:t.label},t.id))}),(0,s.jsxs)("div",{className:"px-2.5 pt-3 border-t border-border/50 text-[11px] text-muted-foreground/60",children:["v","0.0.134"]})]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,s.jsx)("div",{className:"px-4 pt-2 md:hidden",children:(0,s.jsx)(a.Tabs,{className:"items-center",value:e,onValueChange:e=>i(e),children:(0,s.jsx)(a.TabsList,{className:"h-auto gap-1",children:et.map(e=>(0,s.jsx)(a.TabsTrigger,{value:e.id,children:e.label},e.id))})})}),(0,s.jsx)("div",{className:(0,r.cn)("flex-1 overflow-y-auto thin-scrollbar","instruction"!==e&&"px-5 py-5"),children:"instruction"===e?(0,s.jsx)(v,{}):"usages"===e?(0,s.jsx)(es,{}):(0,s.jsxs)("div",{className:"mx-auto max-w-md",children:["general"===e&&(0,s.jsx)(f,{}),"pet"===e&&(0,s.jsx)(F,{}),"notifications"===e&&(0,s.jsx)(P,{}),"members"===e&&(0,s.jsx)(S,{})]})}),(0,s.jsxs)("div",{className:"px-4 py-2 text-[11px] text-muted-foreground/60 md:hidden",children:["v","0.0.134"]})]})]})]})}],716032)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,573404,e=>{"use strict";let t=(0,e.i(419412).default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",0,t])},392277,e=>{"use strict";let t=(0,e.i(419412).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["Send",0,t],392277)},32273,e=>{"use strict";let t=(0,e.i(419412).default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["ShieldCheck",0,t],32273)},888917,e=>{"use strict";let t,n;var r=e.i(653772),a=e.i(511043);function i({groupSize:e,panelElement:t,styleProp:n}){let r,[a,o]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(o){case"%":r=a/100*e;break;case"px":r=a;break;case"rem":r=a*parseFloat(getComputedStyle(t.ownerDocument.documentElement).fontSize);break;case"em":r=a*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=a/100*window.innerHeight;break;case"vw":r=a/100*window.innerWidth}return r}function o(e){return parseFloat(e.toFixed(3))}function l({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function s(e){let{panels:t}=e,n=l({group:e});return 0===n?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:a}=e,l=0;void 0!==a.collapsedSize&&(l=o(i({groupSize:n,panelElement:r,styleProp:a.collapsedSize})/n*100)),void 0!==a.defaultSize&&(t=o(i({groupSize:n,panelElement:r,styleProp:a.defaultSize})/n*100));let s=0;void 0!==a.minSize&&(s=o(i({groupSize:n,panelElement:r,styleProp:a.minSize})/n*100));let u=100;return void 0!==a.maxSize&&(u=o(i({groupSize:n,panelElement:r,styleProp:a.maxSize})/n*100)),{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:l,collapsible:!0===a.collapsible,defaultSize:t,disabled:a.disabled,minSize:s,maxSize:u,panelId:e.id}})}function u(e,t="Assertion error"){if(!e)throw Error(t)}function d(e,t){return Array.from(t).sort("horizontal"===e?f:p)}function f(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function p(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function c(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function h(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function g(e){let{element:n,orientation:r,panels:a,separators:i}=e,o=d(r,Array.from(n.children).filter(c).map(e=>({element:e}))).map(({element:e})=>e),s=[],f=!1,p=!1,g=-1,v=-1,m=0,y,b=[];{let e=-1;for(let t of o)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(m++,-1===g&&(g=e),v=e))}if(m>1){let n=-1;for(let d of o)if(d.hasAttribute("data-panel")){n++;let i=a.find(e=>e.element===d);if(i){if(y){let a,o=y.element.getBoundingClientRect(),c=d.getBoundingClientRect();if(p){let e="horizontal"===r?new DOMRect(o.right,o.top,0,o.height):new DOMRect(o.left,o.bottom,o.width,0),t="horizontal"===r?new DOMRect(c.left,c.top,0,c.height):new DOMRect(c.left,c.top,c.width,0);switch(b.length){case 0:a=[e,t];break;case 1:{let n=b[0],i=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},a,i=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=h(r,n),l="horizontal"===e?t:o;l<i&&(i=l,a=n)}return u(a,"No rect found"),a}({orientation:r,rects:[o,c],targetRect:n.element.getBoundingClientRect()});a=[n,i===o?t:e];break}default:a=b}}else a=b.length?b:["horizontal"===r?new DOMRect(o.right,c.top,c.left-o.right,c.height):new DOMRect(c.left,o.bottom,c.width,c.top-o.bottom)];for(let r of a){let a="width"in r?r:r.element.getBoundingClientRect(),o=(void 0===t&&(t="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),t)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(a.width<o){let e=o-a.width;a=new DOMRect(a.x-e/2,a.y,a.width+e,a.height)}if(a.height<o){let e=o-a.height;a=new DOMRect(a.x,a.y-e/2,a.width,a.height+e)}let u=n<=g||n>v;f||u||s.push({group:e,groupSize:l({group:e}),panels:[y,i],separator:"width"in r?void 0:r,rect:a}),f=!1}}p=!1,y=i,b=[]}}else if(d.hasAttribute("data-separator")){null!==d.ariaDisabled&&(f=!0);let e=i.find(e=>e.element===d);e?b.push(e):(y=void 0,b=[])}else p=!0}return s}class v{#e={};addListener(e,t){let n=this.#e[e];return void 0===n?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,a=Array.from(n);for(let n=0;n<a.length;n++){let i=a[n];try{i.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}}let m=new Map,y=new v;function b(e,t){for(let[t]of m)if(t.id===e)return t}function z(e,t){for(let[t,n]of m)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function S(e,t){return y.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function x(e,t){let n=m.get(e);(m=new Map(m)).set(e,t),y.emit("groupChange",{group:e,prev:n,next:t})}let w=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function C(e){let t=e.length;for(;t--;){let n=e[t];if(u(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(R(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||w.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function P(e){return e&&Number(getComputedStyle(e).zIndex)||0}function L(e){let t=[];for(;e;)t.push(e),e=R(e);return t}function R(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function E(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let a=g(r),i=function(e,t,n){let r,a={x:1/0,y:1/0};for(let i of t){let t=h(n,i.rect);switch(e){case"horizontal":t.x<=a.x&&(r=i,a=t);break;case"vertical":t.y<=a.y&&(r=i,a=t)}}return r?{distance:a,hitRegion:r}:void 0}(r.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!c(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:L(e),b:L(t)};for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();u(n,"Stacking order can only be calculated for elements with a common ancestor");let a={a:P(C(r.a)),b:P(C(r.b))};if(a.a===a.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},a=e.length;for(;a--;){let n=e[a];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(a.a-a.b)}(n,e)>0){let a=n;for(;a;){var r;if(a.contains(e))break;if(r=a.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;a=a.parentElement}}return!0}({groupElement:r.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&n.push(i.hitRegion)}),n}function k(e,t,n=0){return Math.abs(o(e)-o(t))<=n}function M(e,t){return k(e,t)?0:e>t?1:-1}function D({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:a=0,collapsible:i,disabled:l,maxSize:s=100,minSize:u=0}=t;return l&&!e?n:(0>M(r,u)&&(r=i&&0>M(r,(a+u)/2)?a:u),o(r=Math.min(s,r)))}function T({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:i}){if(k(e,0))return t;let o="imperative-api"===i,l=Object.values(t),s=Object.values(a),d=[...l],[f,p]=r;u(null!=f,"Invalid first pivot index"),u(null!=p,"Invalid second pivot index");let c=0;if("keyboard"===i){{let t=e<0?p:f,r=n[t];u(r,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,minSize:o=0}=r;if(i){let n=l[t];if(u(null!=n,`Previous layout not found for panel index ${t}`),k(n,a)){let t=o-n;M(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?f:p,r=n[t];u(r,`No panel constraints found for index ${t}`);let{collapsedSize:a=0,collapsible:i,minSize:o=0}=r;if(i){let n=l[t];if(u(null!=n,`Previous layout not found for panel index ${t}`),k(n,o)){let t=n-a;M(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?p:f,r=n[t];u(r,`Panel constraints not found for index ${t}`);let a=l[t],{collapsible:i,collapsedSize:o,minSize:s}=r;if(i&&0>M(a,s))if(e>0){let t=s-o;0>M(a+e,s)&&(e=0>=M(e,t/2)?0:t)}else{let t=s-o;0>M(a-e,s)&&(e=M(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,r=e<0?p:f,a=0;for(;;){let e=l[r];if(u(null!=e,`Previous layout not found for panel index ${r}`),a+=D({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e,(r+=t)<0||r>=n.length)break}let i=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-i:i}{let t=e<0?f:p;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(c),a=l[t];u(null!=a,`Previous layout not found for panel index ${t}`);let i=a-r,s=D({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:a,size:i});if(!k(a,s)&&(c+=a-s,d[t]=s,c.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(s,d))return a;{let t=e<0?p:f,r=l[t];u(null!=r,`Previous layout not found for panel index ${t}`);let a=r+c,i=D({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:a});if(d[t]=i,!k(i,a)){let t=a-i,r=e<0?p:f;for(;r>=0&&r<n.length;){let a=d[r];u(null!=a,`Previous layout not found for panel index ${r}`);let i=a+t,l=D({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:a,size:i});if(k(a,l)||(t-=l-a,d[r]=l),k(t,0))break;e>0?r--:r++}}}if(!k(Object.values(d).reduce((e,t)=>t+e,0),100,.1))return a;let h=Object.keys(a);return d.reduce((e,t,n)=>(e[h[n]]=t,e),{})}function I(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==M(e[n],t[n]))return!1;return!0}function O({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],a=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!k(a,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];u(null!=t,`No layout data found for index ${e}`);let n=100/a*t;r[e]=n}let i=0;for(let e=0;e<t.length;e++){let a=n[e];u(null!=a,`No layout data found for index ${e}`);let o=r[e];u(null!=o,`No layout data found for index ${e}`);let l=D({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:a,size:o});o!=l&&(i+=o-l,r[e]=l)}if(!k(i,0))for(let e=0;e<t.length;e++){let n=r[e];u(null!=n,`No layout data found for index ${e}`);let a=n+i,o=D({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:a});if(n!==o&&(i-=o-n,r[e]=o,k(i,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function j({groupId:e,panelId:t}){let n=()=>{for(let[t,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:a,groupSize:i,separatorToPanels:o}]of m)if(t.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:t,groupSize:i,layout:a,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},a=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},s=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},u=e=>{if(e===s())return;let{defaultLayoutDeferred:r,derivedPanelConstraints:a,group:i,groupSize:l,layout:u,separatorToPanels:d}=n(),f=O({layout:(({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:a})=>{let i=s(),l=n.findIndex(e=>e.id===t),u=0===l,d=l===n.length-1;if(d&&e<i&&(u||n.slice(0,l).every((e,t)=>{let n=a[t];return n?.collapsible&&k(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,l).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:o(100-e)}}return T({delta:d?i-e:e-i,initialLayout:r,panelConstraints:a,pivotIndices:d?[l-1,l]:[l,l+1],prevLayout:r,trigger:"imperative-api"})})({nextSize:e,panels:i.panels,prevLayout:u,derivedPanelConstraints:a}),panelConstraints:a});I(u,f)||x(i,{defaultLayoutDeferred:r,derivedPanelConstraints:a,groupSize:l,layout:f,separatorToPanels:d})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=a(),i=s();e&&i!==t&&(n.expandToSize=i,u(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:i}=a(),o=s();if(e&&o===t){let e=i.expandToSize??n;0===e&&(e=1),u(e)}},getSize:()=>{let{group:e}=n(),t=s(),{element:r}=a();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=s();return e&&k(t,n)},resize:e=>{let{group:t}=n(),{element:r}=a(),s=l({group:t});u(o(i({groupSize:s,panelElement:r,styleProp:e})/s*100))}}}function N(e){e.defaultPrevented||E(e,m).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(n){let r=n.panelConstraints.defaultSize,a=j({groupId:t.group.id,panelId:n.id});a&&void 0!==r&&(a.resize(r),e.preventDefault())}}})}function F(e){for(let[t]of m)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function A({groupId:e}){let t=()=>{for(let[t,n]of m)if(t.id===e)return{group:t,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:a,groupSize:i,layout:o,separatorToPanels:l}=t(),s=O({layout:e,panelConstraints:r});return n?o:(I(o,s)||x(a,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:i,layout:s,separatorToPanels:l}),s)}}}function $(e,t){let n=F(e),r=z(n.id,!0),a=n.separators.find(t=>t.element===e);u(a,"Matching separator not found");let i=r.separatorToPanels.get(a);u(i,"Matching panels not found");let o=i.map(e=>n.panels.indexOf(e)),l=A({groupId:n.id}).getLayout(),s=O({layout:T({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:l,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});I(l,s)||x(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:s,separatorToPanels:r.separatorToPanels})}function G(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=F(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&$(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&$(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&$(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&$(t,-5);break;case"End":e.preventDefault(),$(t,100);break;case"Enter":{e.preventDefault();let n=F(t),{derivedPanelConstraints:r,layout:a,separatorToPanels:i}=z(n.id,!0),o=n.separators.find(e=>e.element===t);u(o,"Matching separator not found");let l=i.get(o);u(l,"Matching panels not found");let s=l[0],d=r.find(e=>e.panelId===s.id);if(u(d,"Panel metadata not found"),d.collapsible){let e=a[s.id];$(t,(d.collapsedSize===e?n.mutableState.expandedPanelSizes[s.id]??d.minSize:d.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=F(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);u(null!==r,"Index not found");let a=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[a].focus({preventScroll:!0});break}case"Home":e.preventDefault(),$(t,-100)}}let B={cursorFlags:0,state:"inactive"},W=new v;function H(e){let t=B;B=e,W.emit("change",{prev:t,next:e})}function V(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=m,n=E(e,t),r=new Map,a=!1;n.forEach(e=>{e.separator&&(a||(a=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),H({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}let X=e=>e,U=()=>{};function Y(){return void 0===n&&(n=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(n=!0)),n}let _=new WeakMap;function K(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=_.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=B;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,a=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":a++}})}if(0!==r||0!==a){if("active"===n&&e&&Y()){let t=(4&e)!=0,n=(8&e)!=0;if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}return Y()?r>0&&a>0?"move":r>0?"ew-resize":"ns-resize":r>0&&a>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),a=`*, *:hover {cursor: ${e} !important; }`;if(t===a)return;t=a,e?0===n.cssRules.length?n.insertRule(a):n.replaceSync(a):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}_.set(e,{prevStyle:t,styleSheet:n})}function q({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:a,pointerDownAtPoint:i,prevCursorFlags:o}){var l;let s,u,d=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:l,panels:s}=n,{disableCursor:u}=n.mutableState,f=0;f=i?"horizontal"===l?(t.clientX-i.x)/o*100:(t.clientY-i.y)/o*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),c=a.get(n);if(!p||!c)return;let{defaultLayoutDeferred:h,derivedPanelConstraints:g,groupSize:v,layout:m,separatorToPanels:y}=c;if(g&&m&&y){let t=T({delta:f,initialLayout:p,panelConstraints:g,pivotIndices:e.panels.map(e=>s.indexOf(e)),prevLayout:m,trigger:"mouse-or-touch"});if(I(t,m)){if(0!==f&&!u)switch(l){case"horizontal":d|=f<0?1:2;break;case"vertical":d|=f<0?4:8}}else x(e.group,{defaultLayoutDeferred:h,derivedPanelConstraints:g,groupSize:v,layout:t,separatorToPanels:y})}});let f=0;0===t.movementX?f|=3&o:f|=3&d,0===t.movementY?f|=12&o:f|=12&d,l=f,s=B,(u={...B}).cursorFlags=l,B=u,W.emit("change",{prev:s,next:u}),K(e)}function J(e){let t=m,n=B;"active"===n.state&&q({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function Q(e){if(e.defaultPrevented)return;let t=B,n=m;if("active"===t.state){if(0===e.buttons){H({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);x(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}q({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=E(e,n);0===r.length?"inactive"!==t.state&&H({cursorFlags:0,state:"inactive"}):H({cursorFlags:0,hitRegions:r,state:"hover"}),K(e.currentTarget)}}function Z(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===B.state&&H({cursorFlags:0,state:"inactive"})}function ee(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=B;"active"===t.state&&(H({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(K(e.currentTarget),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);x(e.group,t)}),e.preventDefault()))}function et(e){let t=0,n=0,r={};for(let a of e)if(void 0!==a.defaultSize){t++;let e=o(a.defaultSize);n+=e,r[a.panelId]=e}else r[a.panelId]=void 0;let a=e.length-t;if(0!==a){let t=o((100-n)/a);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let en=new Map;function er(e){let t=(0,a.useId)();return`${e??t}`}let ea="u">typeof window?a.useLayoutEffect:a.useEffect;function ei(e){let t=(0,a.useRef)(e);return ea(()=>{t.current=e},[e]),(0,a.useCallback)((...e)=>t.current?.(...e),[t])}function eo(...e){return ei(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function el(e){let t=(0,a.useRef)({...e});return ea(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}let es=(0,a.createContext)(null);function eu({children:e,className:t,defaultLayout:n,disableCursor:i,disabled:f,elementRef:p,groupRef:c,id:h,onLayoutChange:v,onLayoutChanged:y,orientation:w="horizontal",resizeTargetMinimumSize:C={coarse:20,fine:10},style:P,...L}){let R,E=(0,a.useRef)({onLayoutChange:{},onLayoutChanged:{}}),M=ei(e=>{I(E.current.onLayoutChange,e)||(E.current.onLayoutChange=e,v?.(e))}),D=ei(e=>{I(E.current.onLayoutChanged,e)||(E.current.onLayoutChanged=e,y?.(e))}),T=er(h),j=(0,a.useRef)(null),[F,$]=function(){let[e,t]=(0,a.useState)({});return[e,(0,a.useCallback)(()=>t({}),[])]}(),W=(0,a.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:C,separators:[]}),H=eo(j,p);R=(0,a.useRef)({getLayout:()=>({}),setLayout:X}),(0,a.useImperativeHandle)(c,()=>R.current,[]),ea(()=>{Object.assign(R.current,A({groupId:T}))});let U=ei((e,t)=>{let r=B,a=b(e),i=z(e);if(i){let e=!1;return"active"===r.state&&(e=r.hitRegions.some(e=>e.group===a)),{flexGrow:i.layout[t]??1,pointerEvents:e?"none":void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),Y=el({defaultLayout:n,disableCursor:i}),_=(0,a.useMemo)(()=>({get disableCursor(){return!!Y.disableCursor},getPanelStyles:U,id:T,orientation:w,registerPanel:e=>{let t=W.current;return t.panels=d(w,[...t.panels,e]),$(),()=>{t.panels=t.panels.filter(t=>t!==e),$()}},registerSeparator:e=>{let t=W.current;return t.separators=d(w,[...t.separators,e]),$(),()=>{t.separators=t.separators.filter(t=>t!==e),$()}},updatePanelProps:(e,{disabled:t})=>{let n=W.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=b(T),a=z(T);r&&a&&x(r,{...a,derivedPanelConstraints:s(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=W.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[U,T,$,w,Y]),K=(0,a.useRef)(null);return ea(()=>{let e,t,n,r,a,i,d,p,c,h,v,y,b,C=j.current;if(null===C)return;let P=W.current;if(void 0!==Y.defaultLayout&&Object.keys(Y.defaultLayout).length===P.panels.length)for(let t of(e={},P.panels)){let n=Y.defaultLayout[t.id];void 0!==n&&(e[t.id]=n)}let L={disabled:!!f,element:C,id:T,mutableState:{defaultLayout:e,disableCursor:!!Y.disableCursor,expandedPanelSizes:W.current.lastExpandedPanelSizes,layouts:W.current.layouts},orientation:w,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};K.current=L;let R=(t=!0,u(L.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),n=L.element.ownerDocument.defaultView.ResizeObserver,r=new Set,a=new Set,(i=new n(e=>{for(let n of e){let{borderBoxSize:e,target:r}=n;if(r===L.element){if(t){let e=l({group:L});if(0===e)return;let t=z(L.id);if(!t)return;let n=s(L),r=t.defaultLayoutDeferred?et(n):t.layout,a=O({layout:function({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let a=0,i=0,l=!1,s=new Map,u=[];for(let d of e.panels){let e=r[d.id]??0;if("preserve-pixel-size"===d.panelConstraints.groupResizeBehavior){l=!0;let r=o(e/100*n/t*100);s.set(d.id,r),a+=r}else u.push(d.id),i+=e}if(!l||0===u.length)return r;let d=100-a,f={...r};if(s.forEach((e,t)=>{f[t]=e}),i>0)for(let e of u){let t=r[e]??0;f[e]=o(t/i*d)}else{let e=o(d/u.length);for(let t of u)f[t]=e}return f}({group:L,nextGroupSize:e,prevGroupSize:t.groupSize,prevLayout:r}),panelConstraints:n});if(!t.defaultLayoutDeferred&&I(t.layout,a)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)&&t.groupSize===e)return;x(L,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:e,layout:a,separatorToPanels:t.separatorToPanels})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let a=l({group:e}),i="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,s=r.mutableValues.prevSize,u={asPercentage:o(i/a*100),inPixels:i};r.mutableValues.prevSize=u,r.onResize(u,r.id,s)}(L,r,e)}})).observe(L.element),L.panels.forEach(e=>{u(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&i.observe(e.element)}),d=l({group:L}),p=s(L),c=L.panels.map(({id:e})=>e).join(","),(h=L.mutableState.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(L.panels,h)||(h=void 0)),v=O({layout:L.mutableState.layouts[c]??h??et(p),panelConstraints:p}),y=L.element.ownerDocument,en.set(y,(en.get(y)??0)+1),b=new Map,g(L).forEach(e=>{e.separator&&b.set(e.separator,e.panels)}),x(L,{defaultLayoutDeferred:0===d,derivedPanelConstraints:p,groupSize:d,layout:v,separatorToPanels:b}),L.separators.forEach(e=>{u(!a.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),a.add(e.id),e.element.addEventListener("keydown",G)}),1===en.get(y)&&(y.addEventListener("dblclick",N,!0),y.addEventListener("pointerdown",V,!0),y.addEventListener("pointerleave",J),y.addEventListener("pointermove",Q),y.addEventListener("pointerout",Z),y.addEventListener("pointerup",ee,!0)),function(){t=!1,en.set(y,Math.max(0,(en.get(y)??0)-1)),(m=new Map(m)).delete(L),L.separators.forEach(e=>{e.element.removeEventListener("keydown",G)}),en.get(y)||(y.removeEventListener("dblclick",N,!0),y.removeEventListener("pointerdown",V,!0),y.removeEventListener("pointerleave",J),y.removeEventListener("pointermove",Q),y.removeEventListener("pointerout",Z),y.removeEventListener("pointerup",ee,!0)),i.disconnect()}),{defaultLayoutDeferred:E,derivedPanelConstraints:F,layout:A}=z(L.id,!0);!E&&F.length>0&&(M(A),D(A));let $=S(T,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:r}=e.next;if(t||0===n.length)return;let a=L.panels.map(({id:e})=>e).join(",");L.mutableState.layouts[a]=r,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=k(t.collapsedSize,r[t.panelId]),a=k(t.collapsedSize,n[t.panelId]);e&&!a&&(L.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let i="active"!==B.state;M(r),i&&D(r)});return()=>{K.current=null,R(),$()}},[f,T,D,M,w,F,Y]),(0,a.useEffect)(()=>{let e=K.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!i)}),(0,r.jsx)(es.Provider,{value:_,children:(0,r.jsx)("div",{...L,className:t,"data-group":!0,"data-testid":T,id:T,ref:H,style:{height:"100%",width:"100%",overflow:"hidden",...P,display:"flex",flexDirection:"horizontal"===w?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===w?"pan-y":"pan-x"},children:e})})}function ed(){let e=(0,a.useContext)(es);return u(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function ef({children:e,className:t,collapsedSize:n="0%",collapsible:i=!1,defaultSize:o,disabled:l,elementRef:s,groupResizeBehavior:u="preserve-relative-size",id:d,maxSize:f="100%",minSize:p="0%",onResize:c,panelRef:h,style:g,...v}){let m,y=!!d,b=er(d),z=el({disabled:l}),x=(0,a.useRef)(null),w=eo(x,s),{getPanelStyles:C,id:P,orientation:L,registerPanel:R,updatePanelProps:E}=ed(),k=null!==c,M=ei((e,t,n)=>{c?.(e,d,n)});ea(()=>{let e=x.current;if(null!==e)return R({element:e,id:b,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:k?M:void 0,panelConstraints:{groupResizeBehavior:u,collapsedSize:n,collapsible:i,defaultSize:o,disabled:z.disabled,maxSize:f,minSize:p}})},[u,n,i,o,k,b,y,f,p,M,R,z]),(0,a.useEffect)(()=>{E(b,{disabled:l})},[l,b,E]),function(e,t){let{id:n}=ed(),r=(0,a.useRef)({collapse:U,expand:U,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:U});(0,a.useImperativeHandle)(t,()=>r.current,[]),ea(()=>{Object.assign(r.current,j({groupId:n,panelId:e}))})}(b,h);let D=()=>{let e=C(P,b);if(e)return JSON.stringify(e)},T=(0,a.useSyncExternalStore)(e=>S(P,e),D,D);return m=T?JSON.parse(T):void 0!==o?{flexGrow:void 0,flexShrink:void 0,flexBasis:o}:{flexGrow:1},(0,r.jsx)("div",{...v,"data-disabled":l||void 0,"data-panel":!0,"data-testid":b,id:b,ref:w,style:{...ep,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...m},children:(0,r.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...g,touchAction:"horizontal"===L?"pan-y":"pan-x"},children:e})})}eu.displayName="Group",ef.displayName="Panel";let ep={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function ec({children:e,className:t,disabled:n,disableDoubleClick:i,elementRef:o,id:l,style:s,...u}){let d,f,p=er(l),c=el({disabled:n,disableDoubleClick:i}),[h,g]=(0,a.useState)({}),[v,m]=(0,a.useState)("inactive"),[y,b]=(0,a.useState)(!1),z=(0,a.useRef)(null),x=eo(z,o),{disableCursor:w,id:C,orientation:P,registerSeparator:L,updateSeparatorProps:R}=ed();return ea(()=>{let e=z.current;if(null!==e){var t;let n={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:e,id:p},r=L(n),a=(t=e=>{m("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===n)?e.next.state:"inactive")},W.addListener("change",t)),i=S(C,e=>{let{derivedPanelConstraints:t,layout:r,separatorToPanels:a}=e.next,i=a.get(n);if(i){let e=i[0],n=i.indexOf(e);g(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let a,i,o=e[n],l=t.find(e=>e.panelId===n);if(l){let s=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];i=O({layout:T({delta:u-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],a=O({layout:T({delta:s-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:a,valueMin:i,valueNow:o}}({layout:r,panelConstraints:t,panelId:e.id,panelIndex:n}))}});return()=>{a(),i(),r()}}},[C,p,L,c]),(0,a.useEffect)(()=>{R(p,{disabled:n,disableDoubleClick:i})},[n,i,p,R]),n&&!w&&(d="not-allowed"),f=n?"disabled":"active"===v?"active":y?"focus":v,(0,r.jsx)("div",{...u,"aria-controls":h.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===P?"vertical":"horizontal","aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:e,className:t,"data-separator":f,"data-testid":p,id:p,onBlur:()=>b(!1),onFocus:()=>b(!0),ref:x,role:"separator",style:{flexBasis:"auto",cursor:d,...s,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}ec.displayName="Separator";var eh=e.i(613349);e.s(["ResizableHandle",0,function({withHandle:e,className:t,...n}){return(0,r.jsx)(ec,{"data-slot":"resizable-handle",className:(0,eh.cn)("relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&(0,r.jsx)("div",{className:"z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border"})})},"ResizablePanel",0,function({...e}){return(0,r.jsx)(ef,{"data-slot":"resizable-panel",...e})},"ResizablePanelGroup",0,function({className:e,...t}){return(0,r.jsx)(eu,{"data-slot":"resizable-panel-group",className:(0,eh.cn)("flex h-full w-full aria-[orientation=vertical]:flex-col",e),...t})}],888917)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,879486,384265,e=>{"use strict";e.i(811374);var t=e.i(511043),a=e.i(92615),i=e.i(298604),n=e.i(990966),s=e.i(372252),r=e.i(154680);let o=t.createContext(void 0);function d(e=!1){let a=t.useContext(o);if(void 0===a&&!e)throw Error((0,r.default)(16));return a}function l(e){return(0,a.isHTMLElement)(e)&&"BUTTON"===e.tagName}e.s(["CompositeRootContext",0,o,"useCompositeRootContext",0,d],384265),e.s(["useButton",0,function(e={}){let{disabled:a=!1,focusableWhenDisabled:r,tabIndex:o=0,native:c=!0,composite:u}=e,p=t.useRef(null),g=d(!0),m=u??void 0!==g,{props:h}=function(e){let{focusableWhenDisabled:a,disabled:i,composite:n=!1,tabIndex:s=0,isNativeButton:r}=e,o=n&&!1!==a,d=n&&!1===a;return{props:t.useMemo(()=>{let e={onKeyDown(e){i&&a&&"Tab"!==e.key&&e.preventDefault()}};return n||(e.tabIndex=s,!r&&i&&(e.tabIndex=a?s:-1)),(r&&(a||o)||!r&&i)&&(e["aria-disabled"]=i),r&&(!a||d)&&(e.disabled=i),e},[n,i,a,o,d,r,s])}}({focusableWhenDisabled:r,disabled:a,composite:m,tabIndex:o,isNativeButton:c}),f=t.useCallback(()=>{let e=p.current;l(e)&&m&&a&&void 0===h.disabled&&e.disabled&&(e.disabled=!1)},[a,h.disabled,m]);return(0,n.useIsoLayoutEffect)(f,[f]),{getButtonProps:t.useCallback((e={})=>{let{onClick:t,onMouseDown:i,onKeyUp:n,onKeyDown:r,onPointerDown:o,...d}=e;return(0,s.mergeProps)({onClick(e){a?e.preventDefault():t?.(e)},onMouseDown(e){a||i?.(e)},onKeyDown(e){var i;if(a||((0,s.makeEventPreventable)(e),r?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,o=e.currentTarget,d=l(o),u=!c&&(i=o,!!(i?.tagName==="A"&&i?.href)),p=n&&(c?d:!u),g="Enter"===e.key,h=" "===e.key,f=o.getAttribute("role"),$=f?.startsWith("menuitem")||"option"===f||"gridcell"===f;if(n&&m&&h){if(e.defaultPrevented&&$)return;e.preventDefault(),u||c&&d?(o.click(),e.preventBaseUIHandler()):p&&(t?.(e),e.preventBaseUIHandler());return}p&&(!c&&(h||g)&&e.preventDefault(),!c&&g&&t?.(e))},onKeyUp(e){a||(((0,s.makeEventPreventable)(e),n?.(e),e.target===e.currentTarget&&c&&m&&l(e.currentTarget)&&" "===e.key)?e.preventDefault():!e.baseUIHandlerPrevented&&(e.target!==e.currentTarget||c||m||" "!==e.key||t?.(e)))},onPointerDown(e){a?e.preventDefault():o?.(e)}},c?{type:"button"}:{role:"button"},h,d)},[a,h,m,c]),buttonRef:(0,i.useStableCallback)(e=>{p.current=e,f()})}}],879486)},294237,e=>{"use strict";var t=e.i(7284);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=t.clsx;e.s(["cva",0,(e,t)=>n=>{var s;if((null==t?void 0:t.variants)==null)return i(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:r,defaultVariants:o}=t,d=Object.keys(r).map(e=>{let t=null==n?void 0:n[e],i=null==o?void 0:o[e];if(null===t)return null;let s=a(t)||a(i);return r[e][s]}),l=n&&Object.entries(n).reduce((e,t)=>{let[a,i]=t;return void 0===i||(e[a]=i),e},{});return i(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:a,className:i,...n}=t;return Object.entries(n).every(e=>{let[t,a]=e;return Array.isArray(a)?a.includes({...o,...l}[t]):({...o,...l})[t]===a})?[...e,a,i]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}])},186339,e=>{"use strict";var t=e.i(653772);e.i(811374);var a=e.i(511043),i=e.i(879486),n=e.i(695681);let s=a.forwardRef(function(e,t){let{render:a,className:s,disabled:r=!1,focusableWhenDisabled:o=!1,nativeButton:d=!0,style:l,...c}=e,{getButtonProps:u,buttonRef:p}=(0,i.useButton)({disabled:r,focusableWhenDisabled:o,native:d});return(0,n.useRenderElement)("button",e,{state:{disabled:r},ref:[t,p],props:[c,u]})});var r=e.i(294237),o=e.i(613349);let d=(0,r.cva)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});e.s(["Button",0,function({className:e,variant:a="default",size:i="default",...n}){return(0,t.jsx)(s,{"data-slot":"button",className:(0,o.cn)(d({variant:a,size:i,className:e})),...n})},"buttonVariants",0,d],186339)},126942,(e,t,a)=>{t.exports=e.r(871628)},222862,636557,e=>{"use strict";var t=e.i(811374);class a extends Error{status;details;constructor(e,t,a){super(e),this.name="ApiError",this.status=t,this.details=a}get isNetworkError(){return 0===this.status}get isRateLimit(){return 429===this.status}get isUnauthorized(){return 401===this.status}}function i(e,t){return"validation error"===e&&t?.length?function(e){let[t,...a]=e.split(":"),i=a.join(":").trim();if(!i)return e;let n=t.trim(),s=n.trim().replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),r=i.replace(/^required$/i,"is required"),o=r.toLowerCase().replace(/[_-]+/g," "),d=n.toLowerCase().replace(/[_-]+/g," ");return d&&o.startsWith(`${d} `)&&(r=r.slice(n.length).trimStart()),s?`${s} ${r}`:r}(t[0]):e}async function n(e,t){let n;try{n=await fetch(""+e,{...t,credentials:"include",headers:{"Content-Type":"application/json",...t?.headers}})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===n.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!n.ok){let e,t;try{let a=await n.json();e=a.error,t=a.details}catch{}if(429===n.status)throw new a("Please wait a moment before trying again",429);if(n.status>=500)throw new a(i(e,t)||"Something went wrong — please try again",n.status,t);throw new a(i(e,t)||"Something went wrong",n.status,t)}if(204!==n.status)return n.json()}function s(e,t){let a=new URLSearchParams({workspace_id:e,...t});return`?${a.toString()}`}e.s(["ApiError",0,a],636557),parseInt(t.default.env.NEXT_PUBLIC_MOCK_NETWORK_DELAY_MS||"300",10);let r=async(e,t,i,r,o)=>{let d;if(!r||0===r.length)return n(`/api/conversations/${e}/messages${s(i)}`,{method:"POST",body:JSON.stringify({content:t,...o?{metadata:o}:{}})});let l=new FormData;for(let e of(l.append("content",t),o&&l.append("metadata",JSON.stringify(o)),r))l.append("file",e);try{d=await fetch(`/api/conversations/${e}/messages${s(i)}`,{method:"POST",credentials:"include",body:l})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===d.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!d.ok){let e,t;try{let a=await d.json();e=a.error,t=a.details}catch{}if(429===d.status)throw new a("Please wait a moment before trying again",429);if(d.status>=500)throw new a(e||"Something went wrong — please try again",d.status,t);throw new a(e||"Something went wrong",d.status,t)}return d.json()},o=async(e,t)=>{let a=new URLSearchParams({workspace_id:t}),i=await fetch(`/api/email/${e}/body?${a}`,{credentials:"include"});if(!i.ok)return{content:"(body not available)",isHtml:!1};let n=i.headers.get("Content-Type")??"";return{content:await i.text(),isHtml:n.includes("text/html")}},d=async(e,t)=>{let i=new FormData;i.append("file",e);let n=await fetch(`/api/email/upload${s(t)}`,{method:"POST",credentials:"include",body:i});if(!n.ok)throw new a(await n.text().catch(()=>"Upload failed"),n.status);return n.json()},l=async(e,t)=>{let i;if(!t.files||0===t.files.length)return n(`/api/issues${s(e)}`,{method:"POST",body:JSON.stringify({agent_id:t.agent_id,title:t.title,description:t.description})});let r=new FormData;for(let e of(t.agent_id&&r.append("agent_id",t.agent_id),r.append("title",t.title),r.append("description",t.description??""),t.files))r.append("file",e);try{i=await fetch(`/api/issues${s(e)}`,{method:"POST",credentials:"include",body:r})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===i.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!i.ok){let e,t;try{let a=await i.json();e=a.error,t=a.details}catch{}if(429===i.status)throw new a("Please wait a moment before trying again",429);if(i.status>=500)throw new a(e||"Something went wrong — please try again",i.status,t);throw new a(e||"Something went wrong",i.status,t)}return i.json()},c=async(e,t)=>{let a=new URLSearchParams({workspace_id:t}),i=await fetch(`/api/artifacts/${e}/content?${a}`,{credentials:"include"});return i.ok?i.text():"(content not available)"};e.s(["acceptInvite",0,e=>n(`/api/invite/${e}`,{method:"POST"}),"addWhitelistEmail",0,(e,t,a)=>n(`/api/agents/${e}/whitelist${s(a)}`,{method:"POST",body:JSON.stringify({email:t})}),"approveMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}/approve${s(a)}`,{method:"POST"}),"cancelActiveTask",0,(e,t)=>n(`/api/conversations/${e}/active-task${s(t)}`,{method:"DELETE"}),"chatInit",0,(e,t,a)=>n(`/api/agents/${e}/chat-init${s(t)}`,{method:"POST",body:JSON.stringify({...a?{channel:a}:{}})}),"checkFreshness",0,(e,t)=>{let a={};return e.conversationId&&(a.conversation_id=e.conversationId),e.agentId&&(a.agent_id=e.agentId),e.channel&&(a.channel=e.channel),n(`/api/conversations/check-fresh${s(t,a)}`)},"conversationInit",0,(e,t,a)=>{let i={};return a?.newestMessageId&&(i.newest_message_id=a.newestMessageId),a?.messageCount&&(i.message_count=String(a.messageCount)),n(`/api/conversations/${e}/init${s(t,i)}`)},"createAgent",0,(e,t)=>n(`/api/agents${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createAgentLink",0,(e,t)=>n(`/api/agent-links${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createCalendarEvent",0,(e,t)=>n(`/api/calendar${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createChannelApi",0,(e,t)=>n(`/api/channels${s(e)}`,{method:"POST",body:JSON.stringify({name:t})}),"createConversation",0,(e,t,a)=>n(`/api/conversations${s(t)}`,{method:"POST",body:JSON.stringify({agent_id:e,...a?{channel:a}:{}})}),"createEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts${s(a)}`,{method:"POST",body:JSON.stringify(t)}),"createInvite",0,e=>n(`/api/workspaces/${e}/invites${s(e)}`,{method:"POST"}),"createIssue",0,l,"createMachineToken",0,(e,t)=>n(`/api/machine-tokens${t?s(t):""}`,{method:"POST",body:JSON.stringify({name:e||"default"})}),"createMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings${s(t)}`,{method:"POST",body:JSON.stringify(a)}),"createThread",0,(e,t,a,i)=>n(`/api/conversations/${e}/threads${s(i)}`,{method:"POST",body:JSON.stringify({parent_message_id:t,content:a})}),"deleteAgent",0,(e,t)=>n(`/api/agents/${e}${s(t)}`,{method:"DELETE"}),"deleteAgentLink",0,(e,t)=>n(`/api/agent-links/${e}${s(t)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(e,t,a)=>n(`/api/calendar/${e}${s(t)}`,{method:"DELETE",...a&&a.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}:{}}),"deleteChannelApi",0,(e,t)=>n(`/api/channels/${e}${s(t)}`,{method:"DELETE"}),"deleteEmail",0,(e,t)=>n(`/api/email/${e}${s(t)}`,{method:"DELETE"}),"deleteEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts/${t}${s(a)}`,{method:"DELETE"}),"deleteIssue",0,(e,t)=>n(`/api/issues/${t}${s(e)}`,{method:"DELETE"}),"deleteMachine",0,(e,t)=>n(`/api/runtimes/machine${s(t,{daemon_id:e})}`,{method:"DELETE"}),"deleteMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}${s(a)}`,{method:"DELETE"}),"deleteWorkspace",0,(e,t)=>n(`/api/workspaces/${e}${s(e)}`,{method:"DELETE",body:JSON.stringify({confirm_name:t})}),"fetchLatestCliVersion",0,()=>n("/api/cli/latest-version"),"fetchModelOptions",0,()=>n("/api/config/model-options"),"flagMessage",0,(e,t)=>n(`/api/flags${s(e)}`,{method:"POST",body:JSON.stringify({messageId:t})}),"getActiveTask",0,(e,t)=>n(`/api/conversations/${e}/active-task${s(t)}`),"getAgentSkills",0,(e,t)=>n(`/api/agents/${e}/skills${s(t)}`),"getArtifactContent",0,c,"getCalendarEvent",0,(e,t)=>n(`/api/calendar/${e}${s(t)}`),"getEmail",0,(e,t)=>n(`/api/email/${e}${s(t)}`),"getEmailBody",0,o,"getEmailThread",0,(e,t)=>n(`/api/email/${e}/thread${s(t)}`),"getFlaggedCount",0,e=>n(`/api/flags/count${s(e)}`),"getInboxCount",0,(e,t)=>{let a={};return t?.types?.length&&(a.types=t.types.join(",")),n(`/api/inbox/count${s(e,a)}`)},"getInviteInfo",0,e=>n(`/api/invite/${e}`),"getIssue",0,(e,t)=>n(`/api/issues/${t}${s(e)}`),"getMachineTokenStatus",0,()=>n("/api/machine-tokens/status"),"getMemberMe",0,e=>n(`/api/members/me${s(e)}`),"getMinCliVersion",0,()=>n("/api/config/min-version"),"getTask",0,(e,t)=>n(`/api/tasks/${e}${s(t)}`),"getTaskMessages",0,(e,t,a)=>n(`/api/tasks/${e}/messages${s(t,a?{since:String(a)}:void 0)}`),"getThreadSummaries",0,(e,t)=>n(`/api/conversations/${e}/threads${s(t)}`),"getTrace",0,(e,t)=>n(`/api/traces/${e}${s(t)}`),"getWorkspaceOverview",0,e=>n(`/api/workspaces/${e}/overview${s(e)}`),"grantAgentAccess",0,(e,t,a)=>n(`/api/agents/${t}/access${s(e)}`,{method:"POST",body:JSON.stringify({user_id:a})}),"listAgentAccess",0,(e,t)=>n(`/api/agents/${t}/access${s(e)}`),"listAgentActiveTaskCounts",0,e=>n(`/api/agents/active-task-counts${s(e)}`),"listAgentActivity",0,(e,t,a)=>{let i={};return a?.limit&&(i.limit=String(a.limit)),a?.before&&(i.before=a.before),a?.beforeId&&(i.before_id=a.beforeId),a?.status&&(i.status=a.status),a?.type&&(i.type=a.type),n(`/api/agents/${e}/activity${s(t,i)}`)},"listAgentLinks",0,e=>n(`/api/agent-links${s(e)}`),"listAgentPins",0,e=>n(`/api/agents/pins${s(e)}`),"listAgents",0,e=>n(`/api/agents${s(e)}`),"listArtifacts",0,(e,t)=>n(`/api/artifacts${s(t,{conversation_id:e})}`),"listCalendarEvents",0,(e,t)=>{let a={};return t?.agentId&&(a.agentId=t.agentId),t?.from&&(a.from=t.from),t?.to&&(a.to=t.to),n(`/api/calendar${s(e,a)}`)},"listChannels",0,e=>n(`/api/channels${s(e)}`),"listEmailAccounts",0,(e,t)=>n(`/api/agents/${e}/email-accounts${s(t)}`),"listEmails",0,(e,t,a,i)=>n(`/api/email${s(t,{agentId:e,...a?{folder:a}:{},...i?{address:i}:{}})}`),"listFlaggedItems",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),n(`/api/flags${s(e,a)}`)},"listFlaggedMessageIds",0,(e,t)=>n(`/api/flags${s(e,{conversation_id:t,ids_only:"true"})}`),"listInboxItems",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),t?.types?.length&&(a.types=t.types.join(",")),n(`/api/inbox${s(e,a)}`)},"listInvites",0,e=>n(`/api/workspaces/${e}/invites${s(e)}`),"listIssues",0,(e,t)=>{let a={};return t?.agentId&&(a.agentId=t.agentId),t?.status&&(a.status=t.status),t?.terminal!==void 0&&(a.terminal=String(t.terminal)),n(`/api/issues${s(e,a)}`)},"listMeetings",0,(e,t)=>n(`/api/agents/${e}/meetings${s(t)}`),"listMembers",0,e=>n(`/api/workspaces/${e}/members${s(e)}`),"listMessages",0,(e,t,a)=>{let i={};return a?.limit&&(i.limit=String(a.limit)),a?.before&&(i.before=a.before),a?.beforeId&&(i.before_id=a.beforeId),n(`/api/conversations/${e}/messages${s(t,i)}`)},"listMessagesAroundTask",0,(e,t,a)=>n(`/api/conversations/${e}/messages${s(t,{around_task:a})}`),"listPreviousConversations",0,(e,t,a)=>{let i={exclude:a.exclude,before:a.before};return a.channel&&(i.channel=a.channel),a.limit&&(i.limit=String(a.limit)),n(`/api/agents/${e}/conversations${s(t,i)}`)},"listRuntimes",0,e=>n(`/api/runtimes${s(e)}`),"listTraces",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),t?.status&&(a.status=t.status),t?.multiAgent&&(a.multiAgent="true"),t?.agentId&&(a.agentId=t.agentId),t?.channel&&(a.channel=t.channel),n(`/api/traces${s(e,a)}`)},"listWhitelist",0,(e,t)=>n(`/api/agents/${e}/whitelist${s(t)}`),"listWorkspaceActiveTasks",0,e=>n(`/api/agents/active-tasks${s(e)}`),"listWorkspaces",0,()=>n("/api/workspaces"),"markAllInboxRead",0,e=>n(`/api/inbox/read-all${s(e)}`,{method:"POST"}),"markInboxRead",0,(e,t)=>n(`/api/inbox/read${s(t)}`,{method:"POST",body:JSON.stringify({conversationId:e})}),"pinAgent",0,(e,t)=>n(`/api/agents/${t}/pin${s(e)}`,{method:"POST"}),"removeMember",0,(e,t)=>n(`/api/workspaces/${e}/members/${t}${s(e)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(e,t,a)=>n(`/api/agents/${e}/whitelist/${t}${s(a)}`,{method:"DELETE"}),"renameChannelApi",0,(e,t,a)=>n(`/api/channels/${e}${s(t)}`,{method:"PATCH",body:JSON.stringify({name:a})}),"reorderAgentPins",0,(e,t)=>n(`/api/agents/pins/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"reorderChannelsApi",0,(e,t)=>n(`/api/channels/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:t})}),"reorderUnpinnedAgents",0,(e,t)=>n(`/api/agents/sidebar/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"requestWorkspaceBrowse",0,(e,t,a,i)=>n(`/api/agents/${e}/workspace/browse${s(t)}`,{method:"POST",body:JSON.stringify({request_type:a,path:i})}),"retryTask",0,(e,t)=>n(`/api/tasks/${e}/retry${s(t)}`,{method:"POST"}),"revokeAgentAccess",0,(e,t,a,i=!1)=>n(`/api/agents/${t}/access/${a}${s(e)}${i?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(e,t)=>n(`/api/workspaces/${e}/invites/${t}${s(e)}`,{method:"DELETE"}),"sendEmail",0,(e,t,a,i,r,o,d,l)=>n(`/api/email/send${s(r)}`,{method:"POST",body:JSON.stringify({agentId:e,to:t,subject:a,htmlBody:i,attachments:o,...d,customAccountId:l})}),"sendMessage",0,r,"stopMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}/stop${s(a)}`,{method:"POST"}),"syncEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts/${t}/sync${s(a)}`,{method:"POST"}),"triggerRuntimeRescan",0,(e,t)=>n(`/api/runtimes/${e}/rescan${s(t)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(e,t)=>n(`/api/runtimes/${e}/update${s(t)}`,{method:"POST"}),"unflagMessage",0,(e,t)=>n(`/api/flags/${t}${s(e)}`,{method:"DELETE"}),"unpinAgent",0,(e,t)=>n(`/api/agents/${t}/pin${s(e)}`,{method:"DELETE"}),"updateAgent",0,(e,t,a)=>n(`/api/agents/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateAgentLink",0,(e,t,a)=>n(`/api/agent-links/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateCalendarEvent",0,(e,t,a)=>n(`/api/calendar/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateEmailStatus",0,(e,t,a)=>n(`/api/email/${e}${s(t)}`,{method:"PATCH",body:JSON.stringify({status:a})}),"updateIssue",0,(e,t,a)=>n(`/api/issues/${t}${s(e)}`,{method:"PATCH",body:JSON.stringify(a)}),"updateMemberMe",0,(e,t)=>n(`/api/members/me${s(e)}`,{method:"PATCH",body:JSON.stringify({global_instruction:t})}),"updateWorkspace",0,(e,t)=>n(`/api/workspaces/${e}${s(e)}`,{method:"PATCH",body:JSON.stringify(t)}),"uploadEmailAttachment",0,d],222862)},728886,e=>{"use strict";var t=e.i(653772),a=e.i(613349);e.s(["Skeleton",0,function({className:e,...i}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...i})}])},29437,e=>{"use strict";var t=e.i(653772),a=e.i(511043),i=e.i(126942),n=e.i(516266),s=e.i(222862),r=e.i(205189),o=e.i(186339),d=e.i(728886);e.s(["default",0,function(){let{token:e}=(0,i.useParams)(),l=(0,i.useRouter)(),[c,u]=(0,a.useState)("loading"),[p,g]=(0,a.useState)(null),[m,h]=(0,a.useState)("");(0,a.useEffect)(()=>{e&&(0,s.getInviteInfo)(e).then(e=>{g(e),u("ready")}).catch(e=>{h(e instanceof Error?e.message:"Invalid or expired invite link"),u("error")})},[e]);let f=async()=>{if(e){u("accepting");try{let t=await (0,s.acceptInvite)(e);(0,r.trackInviteAccepted)({workspace_id:t.workspace_id??""}),u("done"),n.toast.success(`Joined ${p?.workspace_name??"workspace"}`),l.replace(`/w/${t.workspace_slug}/home`)}catch(e){h(e instanceof Error?e.message:"Failed to join workspace"),u("error")}}};return(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center p-6",children:(0,t.jsxs)("div",{className:"w-full max-w-sm space-y-6 text-center",children:["loading"===c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(d.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-9 w-32 mx-auto"})]}),"ready"===c&&p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"You've been invited"}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:[p.invited_by," invited you to join"]})]}),(0,t.jsxs)("div",{className:"rounded-md border border-border/50 px-4 py-3 text-left space-y-0.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:p.workspace_name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Workspace"})]}),(0,t.jsx)(o.Button,{className:"w-full",onClick:f,children:"Join Workspace"})]}),"accepting"===c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(d.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Joining workspace…"})]}),"error"===c&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"Invite unavailable"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m})]}),(0,t.jsx)(o.Button,{variant:"outline",onClick:()=>l.replace("/workspaces"),children:"Go to workspaces"})]})]})})}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,879486,384265,e=>{"use strict";e.i(811374);var t=e.i(511043),a=e.i(92615),i=e.i(298604),n=e.i(990966),s=e.i(372252),r=e.i(154680);let o=t.createContext(void 0);function d(e=!1){let a=t.useContext(o);if(void 0===a&&!e)throw Error((0,r.default)(16));return a}function l(e){return(0,a.isHTMLElement)(e)&&"BUTTON"===e.tagName}e.s(["CompositeRootContext",0,o,"useCompositeRootContext",0,d],384265),e.s(["useButton",0,function(e={}){let{disabled:a=!1,focusableWhenDisabled:r,tabIndex:o=0,native:c=!0,composite:u}=e,p=t.useRef(null),g=d(!0),m=u??void 0!==g,{props:h}=function(e){let{focusableWhenDisabled:a,disabled:i,composite:n=!1,tabIndex:s=0,isNativeButton:r}=e,o=n&&!1!==a,d=n&&!1===a;return{props:t.useMemo(()=>{let e={onKeyDown(e){i&&a&&"Tab"!==e.key&&e.preventDefault()}};return n||(e.tabIndex=s,!r&&i&&(e.tabIndex=a?s:-1)),(r&&(a||o)||!r&&i)&&(e["aria-disabled"]=i),r&&(!a||d)&&(e.disabled=i),e},[n,i,a,o,d,r,s])}}({focusableWhenDisabled:r,disabled:a,composite:m,tabIndex:o,isNativeButton:c}),f=t.useCallback(()=>{let e=p.current;l(e)&&m&&a&&void 0===h.disabled&&e.disabled&&(e.disabled=!1)},[a,h.disabled,m]);return(0,n.useIsoLayoutEffect)(f,[f]),{getButtonProps:t.useCallback((e={})=>{let{onClick:t,onMouseDown:i,onKeyUp:n,onKeyDown:r,onPointerDown:o,...d}=e;return(0,s.mergeProps)({onClick(e){a?e.preventDefault():t?.(e)},onMouseDown(e){a||i?.(e)},onKeyDown(e){var i;if(a||((0,s.makeEventPreventable)(e),r?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,o=e.currentTarget,d=l(o),u=!c&&(i=o,!!(i?.tagName==="A"&&i?.href)),p=n&&(c?d:!u),g="Enter"===e.key,h=" "===e.key,f=o.getAttribute("role"),$=f?.startsWith("menuitem")||"option"===f||"gridcell"===f;if(n&&m&&h){if(e.defaultPrevented&&$)return;e.preventDefault(),u||c&&d?(o.click(),e.preventBaseUIHandler()):p&&(t?.(e),e.preventBaseUIHandler());return}p&&(!c&&(h||g)&&e.preventDefault(),!c&&g&&t?.(e))},onKeyUp(e){a||(((0,s.makeEventPreventable)(e),n?.(e),e.target===e.currentTarget&&c&&m&&l(e.currentTarget)&&" "===e.key)?e.preventDefault():!e.baseUIHandlerPrevented&&(e.target!==e.currentTarget||c||m||" "!==e.key||t?.(e)))},onPointerDown(e){a?e.preventDefault():o?.(e)}},c?{type:"button"}:{role:"button"},h,d)},[a,h,m,c]),buttonRef:(0,i.useStableCallback)(e=>{p.current=e,f()})}}],879486)},294237,e=>{"use strict";var t=e.i(7284);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=t.clsx;e.s(["cva",0,(e,t)=>n=>{var s;if((null==t?void 0:t.variants)==null)return i(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:r,defaultVariants:o}=t,d=Object.keys(r).map(e=>{let t=null==n?void 0:n[e],i=null==o?void 0:o[e];if(null===t)return null;let s=a(t)||a(i);return r[e][s]}),l=n&&Object.entries(n).reduce((e,t)=>{let[a,i]=t;return void 0===i||(e[a]=i),e},{});return i(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:a,className:i,...n}=t;return Object.entries(n).every(e=>{let[t,a]=e;return Array.isArray(a)?a.includes({...o,...l}[t]):({...o,...l})[t]===a})?[...e,a,i]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}])},186339,e=>{"use strict";var t=e.i(653772);e.i(811374);var a=e.i(511043),i=e.i(879486),n=e.i(695681);let s=a.forwardRef(function(e,t){let{render:a,className:s,disabled:r=!1,focusableWhenDisabled:o=!1,nativeButton:d=!0,style:l,...c}=e,{getButtonProps:u,buttonRef:p}=(0,i.useButton)({disabled:r,focusableWhenDisabled:o,native:d});return(0,n.useRenderElement)("button",e,{state:{disabled:r},ref:[t,p],props:[c,u]})});var r=e.i(294237),o=e.i(613349);let d=(0,r.cva)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});e.s(["Button",0,function({className:e,variant:a="default",size:i="default",...n}){return(0,t.jsx)(s,{"data-slot":"button",className:(0,o.cn)(d({variant:a,size:i,className:e})),...n})},"buttonVariants",0,d],186339)},126942,(e,t,a)=>{t.exports=e.r(871628)},222862,636557,e=>{"use strict";var t=e.i(811374);class a extends Error{status;details;constructor(e,t,a){super(e),this.name="ApiError",this.status=t,this.details=a}get isNetworkError(){return 0===this.status}get isRateLimit(){return 429===this.status}get isUnauthorized(){return 401===this.status}}function i(e,t){return"validation error"===e&&t?.length?function(e){let[t,...a]=e.split(":"),i=a.join(":").trim();if(!i)return e;let n=t.trim(),s=n.trim().replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),r=i.replace(/^required$/i,"is required"),o=r.toLowerCase().replace(/[_-]+/g," "),d=n.toLowerCase().replace(/[_-]+/g," ");return d&&o.startsWith(`${d} `)&&(r=r.slice(n.length).trimStart()),s?`${s} ${r}`:r}(t[0]):e}async function n(e,t){let n;try{n=await fetch(""+e,{...t,credentials:"include",headers:{"Content-Type":"application/json",...t?.headers}})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===n.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!n.ok){let e,t;try{let a=await n.json();e=a.error,t=a.details}catch{}if(429===n.status)throw new a("Please wait a moment before trying again",429);if(n.status>=500)throw new a(i(e,t)||"Something went wrong — please try again",n.status,t);throw new a(i(e,t)||"Something went wrong",n.status,t)}if(204!==n.status)return n.json()}function s(e,t){let a=new URLSearchParams({workspace_id:e,...t});return`?${a.toString()}`}e.s(["ApiError",0,a],636557),parseInt(t.default.env.NEXT_PUBLIC_MOCK_NETWORK_DELAY_MS||"300",10);let r=async(e,t,i,r,o)=>{let d;if(!r||0===r.length)return n(`/api/conversations/${e}/messages${s(i)}`,{method:"POST",body:JSON.stringify({content:t,...o?{metadata:o}:{}})});let l=new FormData;for(let e of(l.append("content",t),o&&l.append("metadata",JSON.stringify(o)),r))l.append("file",e);try{d=await fetch(`/api/conversations/${e}/messages${s(i)}`,{method:"POST",credentials:"include",body:l})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===d.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!d.ok){let e,t;try{let a=await d.json();e=a.error,t=a.details}catch{}if(429===d.status)throw new a("Please wait a moment before trying again",429);if(d.status>=500)throw new a(e||"Something went wrong — please try again",d.status,t);throw new a(e||"Something went wrong",d.status,t)}return d.json()},o=async(e,t)=>{let a=new URLSearchParams({workspace_id:t}),i=await fetch(`/api/email/${e}/body?${a}`,{credentials:"include"});if(!i.ok)return{content:"(body not available)",isHtml:!1};let n=i.headers.get("Content-Type")??"";return{content:await i.text(),isHtml:n.includes("text/html")}},d=async(e,t)=>{let i=new FormData;i.append("file",e);let n=await fetch(`/api/email/upload${s(t)}`,{method:"POST",credentials:"include",body:i});if(!n.ok)throw new a(await n.text().catch(()=>"Upload failed"),n.status);return n.json()},l=async(e,t)=>{let i;if(!t.files||0===t.files.length)return n(`/api/issues${s(e)}`,{method:"POST",body:JSON.stringify({agent_id:t.agent_id,title:t.title,description:t.description})});let r=new FormData;for(let e of(t.agent_id&&r.append("agent_id",t.agent_id),r.append("title",t.title),r.append("description",t.description??""),t.files))r.append("file",e);try{i=await fetch(`/api/issues${s(e)}`,{method:"POST",credentials:"include",body:r})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===i.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!i.ok){let e,t;try{let a=await i.json();e=a.error,t=a.details}catch{}if(429===i.status)throw new a("Please wait a moment before trying again",429);if(i.status>=500)throw new a(e||"Something went wrong — please try again",i.status,t);throw new a(e||"Something went wrong",i.status,t)}return i.json()},c=async(e,t)=>{let a=new URLSearchParams({workspace_id:t}),i=await fetch(`/api/artifacts/${e}/content?${a}`,{credentials:"include"});return i.ok?i.text():"(content not available)"};e.s(["acceptInvite",0,e=>n(`/api/invite/${e}`,{method:"POST"}),"addWhitelistEmail",0,(e,t,a)=>n(`/api/agents/${e}/whitelist${s(a)}`,{method:"POST",body:JSON.stringify({email:t})}),"approveMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}/approve${s(a)}`,{method:"POST"}),"cancelActiveTask",0,(e,t)=>n(`/api/conversations/${e}/active-task${s(t)}`,{method:"DELETE"}),"chatInit",0,(e,t,a)=>n(`/api/agents/${e}/chat-init${s(t)}`,{method:"POST",body:JSON.stringify({...a?{channel:a}:{}})}),"checkFreshness",0,(e,t)=>{let a={};return e.conversationId&&(a.conversation_id=e.conversationId),e.agentId&&(a.agent_id=e.agentId),e.channel&&(a.channel=e.channel),n(`/api/conversations/check-fresh${s(t,a)}`)},"conversationInit",0,(e,t,a)=>{let i={};return a?.newestMessageId&&(i.newest_message_id=a.newestMessageId),a?.messageCount&&(i.message_count=String(a.messageCount)),n(`/api/conversations/${e}/init${s(t,i)}`)},"createAgent",0,(e,t)=>n(`/api/agents${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createAgentLink",0,(e,t)=>n(`/api/agent-links${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createCalendarEvent",0,(e,t)=>n(`/api/calendar${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createChannelApi",0,(e,t)=>n(`/api/channels${s(e)}`,{method:"POST",body:JSON.stringify({name:t})}),"createConversation",0,(e,t,a)=>n(`/api/conversations${s(t)}`,{method:"POST",body:JSON.stringify({agent_id:e,...a?{channel:a}:{}})}),"createEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts${s(a)}`,{method:"POST",body:JSON.stringify(t)}),"createInvite",0,e=>n(`/api/workspaces/${e}/invites${s(e)}`,{method:"POST"}),"createIssue",0,l,"createMachineToken",0,(e,t)=>n(`/api/machine-tokens${t?s(t):""}`,{method:"POST",body:JSON.stringify({name:e||"default"})}),"createMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings${s(t)}`,{method:"POST",body:JSON.stringify(a)}),"createThread",0,(e,t,a,i)=>n(`/api/conversations/${e}/threads${s(i)}`,{method:"POST",body:JSON.stringify({parent_message_id:t,content:a})}),"deleteAgent",0,(e,t)=>n(`/api/agents/${e}${s(t)}`,{method:"DELETE"}),"deleteAgentLink",0,(e,t)=>n(`/api/agent-links/${e}${s(t)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(e,t,a)=>n(`/api/calendar/${e}${s(t)}`,{method:"DELETE",...a&&a.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}:{}}),"deleteChannelApi",0,(e,t)=>n(`/api/channels/${e}${s(t)}`,{method:"DELETE"}),"deleteEmail",0,(e,t)=>n(`/api/email/${e}${s(t)}`,{method:"DELETE"}),"deleteEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts/${t}${s(a)}`,{method:"DELETE"}),"deleteIssue",0,(e,t)=>n(`/api/issues/${t}${s(e)}`,{method:"DELETE"}),"deleteMachine",0,(e,t)=>n(`/api/runtimes/machine${s(t,{daemon_id:e})}`,{method:"DELETE"}),"deleteMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}${s(a)}`,{method:"DELETE"}),"deleteWorkspace",0,(e,t)=>n(`/api/workspaces/${e}${s(e)}`,{method:"DELETE",body:JSON.stringify({confirm_name:t})}),"fetchLatestCliVersion",0,()=>n("/api/cli/latest-version"),"fetchModelOptions",0,()=>n("/api/config/model-options"),"flagMessage",0,(e,t)=>n(`/api/flags${s(e)}`,{method:"POST",body:JSON.stringify({messageId:t})}),"getActiveTask",0,(e,t)=>n(`/api/conversations/${e}/active-task${s(t)}`),"getAgentSkills",0,(e,t)=>n(`/api/agents/${e}/skills${s(t)}`),"getArtifactContent",0,c,"getCalendarEvent",0,(e,t)=>n(`/api/calendar/${e}${s(t)}`),"getEmail",0,(e,t)=>n(`/api/email/${e}${s(t)}`),"getEmailBody",0,o,"getEmailThread",0,(e,t)=>n(`/api/email/${e}/thread${s(t)}`),"getFlaggedCount",0,e=>n(`/api/flags/count${s(e)}`),"getInboxCount",0,(e,t)=>{let a={};return t?.types?.length&&(a.types=t.types.join(",")),n(`/api/inbox/count${s(e,a)}`)},"getInviteInfo",0,e=>n(`/api/invite/${e}`),"getIssue",0,(e,t)=>n(`/api/issues/${t}${s(e)}`),"getMachineTokenStatus",0,()=>n("/api/machine-tokens/status"),"getMemberMe",0,e=>n(`/api/members/me${s(e)}`),"getMinCliVersion",0,()=>n("/api/config/min-version"),"getTask",0,(e,t)=>n(`/api/tasks/${e}${s(t)}`),"getTaskMessages",0,(e,t,a)=>n(`/api/tasks/${e}/messages${s(t,a?{since:String(a)}:void 0)}`),"getThreadSummaries",0,(e,t)=>n(`/api/conversations/${e}/threads${s(t)}`),"getTrace",0,(e,t)=>n(`/api/traces/${e}${s(t)}`),"getWorkspaceOverview",0,e=>n(`/api/workspaces/${e}/overview${s(e)}`),"grantAgentAccess",0,(e,t,a)=>n(`/api/agents/${t}/access${s(e)}`,{method:"POST",body:JSON.stringify({user_id:a})}),"listAgentAccess",0,(e,t)=>n(`/api/agents/${t}/access${s(e)}`),"listAgentActiveTaskCounts",0,e=>n(`/api/agents/active-task-counts${s(e)}`),"listAgentActivity",0,(e,t,a)=>{let i={};return a?.limit&&(i.limit=String(a.limit)),a?.before&&(i.before=a.before),a?.beforeId&&(i.before_id=a.beforeId),a?.status&&(i.status=a.status),a?.type&&(i.type=a.type),n(`/api/agents/${e}/activity${s(t,i)}`)},"listAgentLinks",0,e=>n(`/api/agent-links${s(e)}`),"listAgentPins",0,e=>n(`/api/agents/pins${s(e)}`),"listAgents",0,e=>n(`/api/agents${s(e)}`),"listArtifacts",0,(e,t)=>n(`/api/artifacts${s(t,{conversation_id:e})}`),"listCalendarEvents",0,(e,t)=>{let a={};return t?.agentId&&(a.agentId=t.agentId),t?.from&&(a.from=t.from),t?.to&&(a.to=t.to),n(`/api/calendar${s(e,a)}`)},"listChannels",0,e=>n(`/api/channels${s(e)}`),"listEmailAccounts",0,(e,t)=>n(`/api/agents/${e}/email-accounts${s(t)}`),"listEmails",0,(e,t,a,i)=>n(`/api/email${s(t,{agentId:e,...a?{folder:a}:{},...i?{address:i}:{}})}`),"listFlaggedItems",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),n(`/api/flags${s(e,a)}`)},"listFlaggedMessageIds",0,(e,t)=>n(`/api/flags${s(e,{conversation_id:t,ids_only:"true"})}`),"listInboxItems",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),t?.types?.length&&(a.types=t.types.join(",")),n(`/api/inbox${s(e,a)}`)},"listInvites",0,e=>n(`/api/workspaces/${e}/invites${s(e)}`),"listIssues",0,(e,t)=>{let a={};return t?.agentId&&(a.agentId=t.agentId),t?.status&&(a.status=t.status),t?.terminal!==void 0&&(a.terminal=String(t.terminal)),n(`/api/issues${s(e,a)}`)},"listMeetings",0,(e,t)=>n(`/api/agents/${e}/meetings${s(t)}`),"listMembers",0,e=>n(`/api/workspaces/${e}/members${s(e)}`),"listMessages",0,(e,t,a)=>{let i={};return a?.limit&&(i.limit=String(a.limit)),a?.before&&(i.before=a.before),a?.beforeId&&(i.before_id=a.beforeId),n(`/api/conversations/${e}/messages${s(t,i)}`)},"listMessagesAroundTask",0,(e,t,a)=>n(`/api/conversations/${e}/messages${s(t,{around_task:a})}`),"listPreviousConversations",0,(e,t,a)=>{let i={exclude:a.exclude,before:a.before};return a.channel&&(i.channel=a.channel),a.limit&&(i.limit=String(a.limit)),n(`/api/agents/${e}/conversations${s(t,i)}`)},"listRuntimes",0,e=>n(`/api/runtimes${s(e)}`),"listTraces",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),t?.status&&(a.status=t.status),t?.multiAgent&&(a.multiAgent="true"),t?.agentId&&(a.agentId=t.agentId),t?.channel&&(a.channel=t.channel),n(`/api/traces${s(e,a)}`)},"listWhitelist",0,(e,t)=>n(`/api/agents/${e}/whitelist${s(t)}`),"listWorkspaceActiveTasks",0,e=>n(`/api/agents/active-tasks${s(e)}`),"listWorkspaces",0,()=>n("/api/workspaces"),"markAllInboxRead",0,e=>n(`/api/inbox/read-all${s(e)}`,{method:"POST"}),"markInboxRead",0,(e,t)=>n(`/api/inbox/read${s(t)}`,{method:"POST",body:JSON.stringify({conversationId:e})}),"pinAgent",0,(e,t)=>n(`/api/agents/${t}/pin${s(e)}`,{method:"POST"}),"removeMember",0,(e,t)=>n(`/api/workspaces/${e}/members/${t}${s(e)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(e,t,a)=>n(`/api/agents/${e}/whitelist/${t}${s(a)}`,{method:"DELETE"}),"renameChannelApi",0,(e,t,a)=>n(`/api/channels/${e}${s(t)}`,{method:"PATCH",body:JSON.stringify({name:a})}),"reorderAgentPins",0,(e,t)=>n(`/api/agents/pins/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"reorderChannelsApi",0,(e,t)=>n(`/api/channels/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:t})}),"reorderUnpinnedAgents",0,(e,t)=>n(`/api/agents/sidebar/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"requestWorkspaceBrowse",0,(e,t,a,i)=>n(`/api/agents/${e}/workspace/browse${s(t)}`,{method:"POST",body:JSON.stringify({request_type:a,path:i})}),"retryTask",0,(e,t)=>n(`/api/tasks/${e}/retry${s(t)}`,{method:"POST"}),"revokeAgentAccess",0,(e,t,a,i=!1)=>n(`/api/agents/${t}/access/${a}${s(e)}${i?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(e,t)=>n(`/api/workspaces/${e}/invites/${t}${s(e)}`,{method:"DELETE"}),"sendEmail",0,(e,t,a,i,r,o,d,l)=>n(`/api/email/send${s(r)}`,{method:"POST",body:JSON.stringify({agentId:e,to:t,subject:a,htmlBody:i,attachments:o,...d,customAccountId:l})}),"sendMessage",0,r,"stopMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}/stop${s(a)}`,{method:"POST"}),"syncEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts/${t}/sync${s(a)}`,{method:"POST"}),"triggerRuntimeRescan",0,(e,t)=>n(`/api/runtimes/${e}/rescan${s(t)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(e,t)=>n(`/api/runtimes/${e}/update${s(t)}`,{method:"POST"}),"trustEmail",0,(e,t)=>n(`/api/email/${e}/trust${s(t)}`,{method:"POST"}),"unflagMessage",0,(e,t)=>n(`/api/flags/${t}${s(e)}`,{method:"DELETE"}),"unpinAgent",0,(e,t)=>n(`/api/agents/${t}/pin${s(e)}`,{method:"DELETE"}),"updateAgent",0,(e,t,a)=>n(`/api/agents/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateAgentLink",0,(e,t,a)=>n(`/api/agent-links/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateCalendarEvent",0,(e,t,a)=>n(`/api/calendar/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateEmailStatus",0,(e,t,a)=>n(`/api/email/${e}${s(t)}`,{method:"PATCH",body:JSON.stringify({status:a})}),"updateIssue",0,(e,t,a)=>n(`/api/issues/${t}${s(e)}`,{method:"PATCH",body:JSON.stringify(a)}),"updateMemberMe",0,(e,t)=>n(`/api/members/me${s(e)}`,{method:"PATCH",body:JSON.stringify({global_instruction:t})}),"updateWorkspace",0,(e,t)=>n(`/api/workspaces/${e}${s(e)}`,{method:"PATCH",body:JSON.stringify(t)}),"uploadEmailAttachment",0,d],222862)},728886,e=>{"use strict";var t=e.i(653772),a=e.i(613349);e.s(["Skeleton",0,function({className:e,...i}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...i})}])},29437,e=>{"use strict";var t=e.i(653772),a=e.i(511043),i=e.i(126942),n=e.i(516266),s=e.i(222862),r=e.i(205189),o=e.i(186339),d=e.i(728886);e.s(["default",0,function(){let{token:e}=(0,i.useParams)(),l=(0,i.useRouter)(),[c,u]=(0,a.useState)("loading"),[p,g]=(0,a.useState)(null),[m,h]=(0,a.useState)("");(0,a.useEffect)(()=>{e&&(0,s.getInviteInfo)(e).then(e=>{g(e),u("ready")}).catch(e=>{h(e instanceof Error?e.message:"Invalid or expired invite link"),u("error")})},[e]);let f=async()=>{if(e){u("accepting");try{let t=await (0,s.acceptInvite)(e);(0,r.trackInviteAccepted)({workspace_id:t.workspace_id??""}),u("done"),n.toast.success(`Joined ${p?.workspace_name??"workspace"}`),l.replace(`/w/${t.workspace_slug}/home`)}catch(e){h(e instanceof Error?e.message:"Failed to join workspace"),u("error")}}};return(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center p-6",children:(0,t.jsxs)("div",{className:"w-full max-w-sm space-y-6 text-center",children:["loading"===c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(d.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-9 w-32 mx-auto"})]}),"ready"===c&&p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"You've been invited"}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:[p.invited_by," invited you to join"]})]}),(0,t.jsxs)("div",{className:"rounded-md border border-border/50 px-4 py-3 text-left space-y-0.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:p.workspace_name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Workspace"})]}),(0,t.jsx)(o.Button,{className:"w-full",onClick:f,children:"Join Workspace"})]}),"accepting"===c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(d.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Joining workspace…"})]}),"error"===c&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"Invite unavailable"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m})]}),(0,t.jsx)(o.Button,{variant:"outline",onClick:()=>l.replace("/workspaces"),children:"Go to workspaces"})]})]})})}])}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,129396,e=>{"use strict";var t=e.i(653772),s=e.i(511043),n=e.i(126942),i=e.i(500324),a=e.i(355578),l=e.i(222862);e.i(954194);var r=e.i(439769),o=e.i(186339),d=e.i(393153),c=e.i(720115),u=e.i(941693),m=e.i(37476),x=e.i(16770),h=e.i(928059),p=e.i(729432),f=p.Extension.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(s=>t.updateAttributes(s,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:s})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?s.unsetTextAlign():s.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),g=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,j=p.Node.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",(0,p.mergeAttributes)(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,s,n,i,a,l;let r=null!=(s=null==(t=e.attrs)?void 0:t.src)?s:"",o=null!=(i=null==(n=e.attrs)?void 0:n.alt)?i:"",d=null!=(l=null==(a=e.attrs)?void 0:a.title)?l:"";return d?`![${o}](${r} "${d}")`:`![${o}](${r})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:e,minWidth:t,minHeight:s,alwaysPreserveAspectRatio:n}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:l,editor:r})=>{let o=document.createElement("img");o.draggable=!1;let d=(0,p.mergeAttributes)(this.options.HTMLAttributes,l);Object.entries(d).forEach(([e,t])=>{if(null!=t)switch(e){case"width":case"height":break;default:o.setAttribute(e,t)}}),null!==d.src&&(o.src=d.src);let c=new p.ResizableNodeView({element:o,editor:r,node:i,getPos:a,onResize:(e,t)=>{o.style.width=`${e}px`,o.style.height=`${t}px`},onCommit:(e,t)=>{let s=a();void 0!==s&&this.editor.chain().setNodeSelection(s).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,s)=>e.type===i.type,options:{directions:e,min:{width:t,height:s},preserveAspectRatio:!0===n}}),u=c.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",o.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},c}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[(0,p.nodeInputRule)({find:g,type:this.type,getAttributes:e=>{let[,,t,s,n]=e;return{src:s,alt:t,title:n}}})]}}),b=e.i(613349),y=e.i(329686),v=e.i(779646),N=e.i(903477),k=e.i(419412);let w=(0,k.default)("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),z=(0,k.default)("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),A=(0,k.default)("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),T=(0,k.default)("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),C=(0,k.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),S=(0,k.default)("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]),M=(0,k.default)("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),H=(0,k.default)("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),B=(0,k.default)("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),E=(0,k.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),L=(0,k.default)("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]),R=(0,k.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),_=(0,k.default)("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),$=(0,k.default)("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);var D=e.i(573404),D=D;function I({active:e,disabled:s,onAction:n,title:i,children:a}){return(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon-sm",disabled:s,onMouseDown:e=>e.preventDefault(),onClick:n,className:(0,b.cn)("text-muted-foreground/70",e&&"bg-accent text-foreground")}),children:a}),(0,t.jsx)(y.TooltipContent,{children:i})]})}function F(){return(0,t.jsx)("div",{className:"w-px h-4 bg-border/60 mx-0.5 shrink-0"})}function P({editor:e}){let[,n]=(0,s.useReducer)(e=>e+1,0),[i,a]=(0,s.useState)(!1),[l,r]=(0,s.useState)("link"),[d,c]=(0,s.useState)(""),[u,m]=(0,s.useState)(""),[x,h]=(0,s.useState)(""),[p,f]=(0,s.useState)(!1),g=(0,s.useRef)(null),j=(0,s.useRef)(!1);if((0,s.useEffect)(()=>{if(!e)return;let t=()=>n();return e.on("transaction",t),()=>{e.off("transaction",t)}},[e]),(0,s.useEffect)(()=>{i&&setTimeout(()=>g.current?.focus(),0)},[i]),!e)return null;let k="size-3.5",O=()=>{let t=d.trim();if(t){try{new URL(t)}catch{m("Please enter a valid URL");return}if(m(""),"link"===l)if(p){let s=x.trim()||t;e.chain().focus().insertContent({type:"text",text:s,marks:[{type:"link",attrs:{href:t}}]}).run()}else e.chain().focus().extendMarkRange("link").setLink({href:t}).run();else e.chain().focus().setImage({src:t}).run();a(!1)}};return(0,t.jsxs)("div",{className:"flex items-center gap-0.5 px-3 py-1 overflow-x-auto",children:[(0,t.jsx)(I,{title:"Bold",active:e.isActive("bold"),onAction:()=>e.chain().focus().toggleBold().run(),children:(0,t.jsx)(w,{className:k})}),(0,t.jsx)(I,{title:"Italic",active:e.isActive("italic"),onAction:()=>e.chain().focus().toggleItalic().run(),children:(0,t.jsx)(z,{className:k})}),(0,t.jsx)(I,{title:"Underline",active:e.isActive("underline"),onAction:()=>e.chain().focus().toggleUnderline().run(),children:(0,t.jsx)(A,{className:k})}),(0,t.jsx)(I,{title:"Strikethrough",active:e.isActive("strike"),onAction:()=>e.chain().focus().toggleStrike().run(),children:(0,t.jsx)(T,{className:k})}),(0,t.jsx)(F,{}),(0,t.jsx)(I,{title:"Heading 1",active:e.isActive("heading",{level:1}),onAction:()=>e.chain().focus().toggleHeading({level:1}).run(),children:(0,t.jsx)(_,{className:k})}),(0,t.jsx)(I,{title:"Heading 2",active:e.isActive("heading",{level:2}),onAction:()=>e.chain().focus().toggleHeading({level:2}).run(),children:(0,t.jsx)($,{className:k})}),(0,t.jsx)(F,{}),(0,t.jsx)(I,{title:"Bullet List",active:e.isActive("bulletList"),onAction:()=>e.chain().focus().toggleBulletList().run(),children:(0,t.jsx)(C,{className:k})}),(0,t.jsx)(I,{title:"Ordered List",active:e.isActive("orderedList"),onAction:()=>e.chain().focus().toggleOrderedList().run(),children:(0,t.jsx)(S,{className:k})}),(0,t.jsx)(F,{}),(0,t.jsx)(I,{title:"Align Left",active:e.isActive({textAlign:"left"}),onAction:()=>e.chain().focus().setTextAlign("left").run(),children:(0,t.jsx)(M,{className:k})}),(0,t.jsx)(I,{title:"Align Center",active:e.isActive({textAlign:"center"}),onAction:()=>e.chain().focus().setTextAlign("center").run(),children:(0,t.jsx)(H,{className:k})}),(0,t.jsx)(I,{title:"Align Right",active:e.isActive({textAlign:"right"}),onAction:()=>e.chain().focus().setTextAlign("right").run(),children:(0,t.jsx)(B,{className:k})}),(0,t.jsx)(F,{}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onMouseDown:t=>{t.preventDefault(),j.current=e.isActive("link")},onClick:()=>{j.current?e.chain().focus().unsetLink().run():(r("link"),c(""),m(""),h(""),f(e.state.selection.empty),a(!0))},className:(0,b.cn)("text-muted-foreground/70",e.isActive("link")&&"bg-accent text-foreground")}),children:e.isActive("link")?(0,t.jsx)(L,{className:k}):(0,t.jsx)(E,{className:k})}),(0,t.jsx)(y.TooltipContent,{children:e.isActive("link")?"Remove Link":"Insert Link"})]}),(0,t.jsx)(I,{title:"Insert Image",onAction:()=>{r("image"),c(""),m(""),a(!0)},children:(0,t.jsx)(R,{className:k})}),(0,t.jsx)(F,{}),(0,t.jsx)(I,{title:"Horizontal Rule",onAction:()=>e.chain().focus().setHorizontalRule().run(),children:(0,t.jsx)(D.default,{className:k})}),(0,t.jsx)(v.Dialog,{open:i,onOpenChange:a,children:(0,t.jsxs)(v.DialogContent,{children:[(0,t.jsx)(v.DialogHeader,{children:(0,t.jsx)(v.DialogTitle,{children:"link"===l?"Insert Link":"Insert Image"})}),"link"===l&&p&&(0,t.jsx)(N.Input,{ref:g,value:x,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&O()},placeholder:"Display text"}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(N.Input,{ref:"image"!==l&&p?void 0:g,value:d,onChange:e=>{c(e.target.value),m("")},onKeyDown:e=>{"Enter"===e.key&&O()},placeholder:"link"===l?"https://example.com":"https://example.com/image.png",type:"url","aria-invalid":!!u}),u&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:u})]}),(0,t.jsx)(v.DialogFooter,{children:(0,t.jsx)(o.Button,{onClick:O,disabled:!d.trim(),children:"Insert"})})]})})]})}var O=e.i(516266),U=e.i(392277),q=e.i(692670),V=e.i(945074),K=e.i(966662),W=e.i(492451);function G({fromAddress:n,onSend:i,onDiscard:a,initialTo:l="",initialSubject:r="",initialBody:d="",initialAttachments:p=[],inReplyTo:g,references:b}){let[v,k]=(0,s.useState)(l),[w,z]=(0,s.useState)(r),[A,T]=(0,s.useState)(!1),[C,S]=(0,s.useState)(p),[M,H]=(0,s.useState)(!1),B=(0,s.useRef)(null),E=(0,c.useEditor)({immediatelyRender:!1,content:d||void 0,extensions:[u.default.configure({link:!1,underline:!1}),m.default.configure({placeholder:"Write your email..."}),x.default,h.default.configure({autolink:!0,openOnClick:!1,linkOnPaste:!0}),f.configure({types:["heading","paragraph"]}),j.configure({inline:!0,allowBase64:!0})],editorProps:{attributes:{class:"text-sm max-w-none focus:outline-none min-h-50 px-4 py-3"}}}),L=async()=>{if(v.trim()&&w.trim()&&E){T(!0);try{let e=E.getHTML();await i(v.trim(),w.trim(),e,C,g||b?{inReplyTo:g,references:b}:void 0)&&(k(""),z(""),S([]),E.commands.clearContent())}finally{T(!1)}}},R=async t=>{let s=t.target.files;if(s&&0!==s.length){H(!0);try{let{uploadEmailAttachment:t}=await e.A(302482);for(let e of Array.from(s)){if(e.size>0xa00000){O.toast.error(`${e.name} exceeds 10 MB limit`);continue}let s=new URLSearchParams(window.location.search).get("workspace_id")??"",n=await t(e,s);S(e=>[...e,n])}}catch{O.toast.error("Failed to upload attachment")}finally{H(!1),B.current&&(B.current.value="")}}};return(0,t.jsxs)("div",{className:"flex flex-col h-full w-full min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2",children:[(0,t.jsx)("h3",{className:"text-sm font-heading font-medium tracking-tight",children:"New Email"}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)(o.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground h-7 px-2",onClick:a,disabled:A,children:[(0,t.jsx)(q.X,{className:"size-3 mr-1"}),"Discard"]}),(0,t.jsxs)(o.Button,{size:"sm",className:"text-xs h-7 px-3",onClick:L,disabled:A||!v.trim()||!w.trim(),children:[A?(0,t.jsx)(V.Loader2,{className:"size-3 mr-1 animate-spin"}):(0,t.jsx)(U.Send,{className:"size-3 mr-1"}),"Send"]})]})]}),(0,t.jsxs)("div",{className:"border-b border-border/30 px-4 py-2.5 space-y-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,t.jsx)("span",{className:"text-muted-foreground truncate min-w-0",children:n})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,t.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,t.jsx)(N.Input,{type:"email",value:v,onChange:e=>k(e.target.value),placeholder:"recipient@example.com",className:"h-7 text-sm border-0 bg-transparent px-1.5 shadow-none focus-visible:ring-0 placeholder:text-muted-foreground/50",disabled:A})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"Subject"}),(0,t.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,t.jsx)(N.Input,{value:w,onChange:e=>z(e.target.value),placeholder:"Email subject",className:"h-7 text-sm border-0 bg-transparent px-1.5 shadow-none focus-visible:ring-0 placeholder:text-muted-foreground/50",disabled:A})})]})]}),(0,t.jsxs)("div",{className:"flex items-center border-b border-border/30",children:[(0,t.jsx)(P,{editor:E}),(0,t.jsxs)("div",{className:"flex items-center gap-1 px-2 border-l border-border/30",children:[(0,t.jsx)("input",{ref:B,type:"file",multiple:!0,className:"hidden",onChange:R}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon-sm",disabled:M,onMouseDown:e=>e.preventDefault(),onClick:()=>B.current?.click(),className:"text-muted-foreground/70"}),children:M?(0,t.jsx)(V.Loader2,{className:"size-3.5 animate-spin"}):(0,t.jsx)(K.Paperclip,{className:"size-3.5"})}),(0,t.jsx)(y.TooltipContent,{children:"Attach file"})]})]})]}),C.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 px-4 py-2 border-b border-border/30",children:C.map(e=>{var s;return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs",children:[(0,t.jsx)(W.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate max-w-37.5",children:e.filename}),(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:(s=e.size)<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`}),(0,t.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.key,void S(e=>e.filter(e=>e.key!==t))},className:"text-muted-foreground hover:text-foreground ml-0.5 cursor-pointer",children:(0,t.jsx)(q.X,{className:"size-3"})})]},e.key)})}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar",children:(0,t.jsx)(c.EditorContent,{editor:E})})]})}var X=e.i(728886),J=e.i(967723),Q=e.i(896210),Y=e.i(46464),Z=e.i(947308),ee=e.i(813141);let et=(0,k.default)("forward",[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]),es=(0,k.default)("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);var en=e.i(330746),ei=e.i(353155);let ea=(0,k.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var el=e.i(32273),er=e.i(584761),eo=e.i(205189),ed=e.i(996718),ec=e.i(888917),eu=e.i(940931);function em(e){let t=new Date(e),s=Math.floor((new Date().getTime()-t.getTime())/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let n=Math.floor(s/60);if(n<24)return`${n}h ago`;let i=Math.floor(n/24);return i<7?`${i}d ago`:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}e.s(["default",0,function(){let e=(0,n.useParams)().id,{workspaceId:c}=(0,i.useWorkspace)(),{agents:u,subscribeWs:m}=(0,a.useAgentContext)(),x=u.find(t=>t.id===e),h=(0,ed.useIsMobile)(),[p,f]=(0,s.useState)("inbox"),[g,j]=(0,s.useState)([]),v=(0,s.useMemo)(()=>g.filter(e=>"unread"===e.status).length,[g]),[N,k]=(0,s.useState)(!0),[w,z]=(0,s.useState)(null),[A,T]=(0,s.useState)(null),[C,S]=(0,s.useState)(!1),[M,H]=(0,s.useState)(!1),[B,E]=(0,s.useState)({}),[L,R]=(0,s.useState)([]),[_,$]=(0,s.useState)(null),[D,I]=(0,s.useState)({}),[F,P]=(0,s.useState)(!1),[q,ex]=(0,s.useState)(null),[eh,ep]=(0,s.useState)(!1),[ef,eg]=(0,s.useState)(!1),[ej,eb]=(0,s.useState)([]),[ey,ev]=(0,s.useState)(!1),eN=(0,s.useCallback)(e=>{f(e),j([]),z(null),T(null),H(!1)},[]),ek=x?.email_handle?(0,r.toAlookAddress)(x.email_handle):"",ew=[...ek?[{type:"alook",address:ek}]:[],...ej.map(e=>({type:"custom",address:e.email_address,accountId:e.id}))],[ez,eA]=(0,s.useState)(0),eT=ew[ez]??ew[0]??null,eC=eT?.address??"",eS=eT?.type==="custom"?eT.accountId:void 0,eM=g.find(e=>e.id===w)??null,eH=(0,s.useCallback)(async(t,s)=>{k(!0);try{let n=await (0,l.listEmails)(e,c,t,s);j(n)}catch{O.toast.error("Failed to load emails")}finally{k(!1)}},[e,c]);(0,s.useEffect)(()=>{(0,l.listEmailAccounts)(e,c).then(eb).catch(()=>{})},[e,c]),(0,s.useEffect)(()=>{eH(p,eC)},[p,eC,eH]),(0,s.useEffect)(()=>m(t=>{"email.received"===t.type&&t.agentId===e?((0,eo.trackEmailReceived)({agent_id:e,mailbox_type:eT?.type==="custom"?"imap":"alook"}),eH(p,eC)):"email.sent"===t.type&&t.agentId===e&&eH(p,eC)}),[m,e,p,eC,eH,eT?.type]);let eB=async e=>{H(!1),z(e),T(null),S(!0),R([]),$(null),I({});try{let[t,s]=await Promise.all([(0,l.getEmailBody)(e,c),(0,l.getEmailThread)(e,c).catch(()=>[])]);T(t),R(s);let n=g.find(t=>t.id===e);n&&"unread"===n.status&&(0,l.updateEmailStatus)(e,c,"read").then(()=>{j(t=>t.map(t=>t.id===e?{...t,status:"read"}:t))}).catch(()=>{j(t=>t.map(t=>t.id===e?{...t,status:"unread"}:t))})}catch{T({content:"(body not available)",isHtml:!1})}finally{S(!1)}},eE=async e=>{if(_===e)return void $(null);if($(e),!D[e])try{let t=await (0,l.getEmailBody)(e,c);I(s=>({...s,[e]:t}))}catch{I(t=>({...t,[e]:{content:"(body not available)",isHtml:!1}}))}},eL=async()=>{if(q){ep(!0);try{await (0,l.deleteEmail)(q,c),j(e=>e.filter(e=>e.id!==q)),w===q&&(z(null),T(null)),O.toast.success("Email deleted")}catch{O.toast.error("Failed to delete email")}finally{ep(!1),P(!1),ex(null)}}},eR=async(t,s,n,i,a)=>{try{return await (0,l.sendEmail)(e,t,s,n,c,i.length>0?i:void 0,a,eS),(0,eo.trackEmailComposed)({agent_id:e,has_attachments:i.length>0}),O.toast.success("Email sent"),H(!1),eN("sent"),!0}catch{return O.toast.error("Failed to send email"),!1}},e_=e=>`<br/><br/><div style="border-left: 2px solid #ccc; padding-left: 12px; margin-left: 0; color: #666;"><p><strong>From:</strong> ${e.from_email}<br/><strong>To:</strong> ${e.to_email}<br/><strong>Date:</strong> ${new Date(e.created_at).toLocaleString()}<br/><strong>Subject:</strong> ${e.subject}</p>`+(e.html_body?e.html_body:A?.isHtml?A.content:`<pre>${A?.content??""}</pre>`)+"</div>",e$=e=>({inReplyTo:e.message_id||void 0,references:[e.references,e.message_id].filter(Boolean).join(" ").trim()||void 0}),eD=async e=>{eg(!0);try{await (0,l.trustEmail)(e.id,c),O.toast.success("Email trusted and sent to agent"),j(t=>t.filter(t=>t.id!==e.id)),z(null)}catch{O.toast.error("Failed to trust email")}finally{eg(!1)}},[eI,eF]=(0,s.useState)(!1),eP=async()=>{if(eC)try{await navigator.clipboard.writeText(eC),eF(!0),setTimeout(()=>eF(!1),1500)}catch{O.toast.error("Failed to copy")}},eO=(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[ew.length>0?(0,t.jsx)("div",{className:"px-3 pt-3 pb-1 relative",children:1===ew.length?(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsxs)(y.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:eP,className:"group flex items-center gap-1.5 text-left cursor-pointer w-full"}),children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:eC}),eI?(0,t.jsx)(ei.Check,{className:"size-2.5 text-green-500 shrink-0"}):(0,t.jsx)(en.Copy,{className:"size-2.5 text-muted-foreground/0 group-hover:text-muted-foreground/60 shrink-0 transition-colors"})]}),(0,t.jsx)(y.TooltipContent,{children:"Click to copy"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 w-full",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>ev(!ey),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:eC}),(0,t.jsx)(er.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:eP,className:"shrink-0 p-0.5"}),children:eI?(0,t.jsx)(ei.Check,{className:"size-2.5 text-green-500"}):(0,t.jsx)(en.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,t.jsx)(y.TooltipContent,{children:"Copy address"})]})]}),ey&&(0,t.jsx)("div",{className:"absolute left-2 right-2 top-full mt-0.5 z-10 rounded-lg border border-border bg-popover shadow-md py-1",children:ew.map((e,s)=>(0,t.jsxs)("button",{type:"button",onClick:()=>{eA(s),ev(!1)},className:(0,b.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",s===ez?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,t.jsx)(Q.Mail,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.address}),"custom"===e.type&&(0,t.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},e.address))})]})}):(0,t.jsx)("div",{className:"px-3 pt-3 pb-1",children:(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:"No email configured"})}),(0,t.jsx)("div",{className:"p-2",children:(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsxs)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{size:"sm",className:"w-full justify-start text-xs h-8 gap-1.5",onClick:()=>{E({}),H(!0),z(null)},disabled:0===ew.length}),children:[(0,t.jsx)(Z.Plus,{className:"size-3.5"}),"New Email"]}),(0,t.jsx)(y.TooltipContent,{children:0===ew.length?"Configure an email in agent settings to send emails":"Compose new email"})]})}),(0,t.jsxs)("nav",{className:"flex flex-col gap-0.5 px-2",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>eN("inbox"),className:(0,b.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","inbox"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,t.jsx)(Y.Inbox,{className:"size-4 shrink-0"}),"Inbox","inbox"===p&&v>0&&(0,t.jsx)("span",{className:"ml-auto text-xs bg-blue-500 text-white rounded-full px-1.5 py-0.5 leading-none min-w-5 text-center",children:v})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>eN("sent"),className:(0,b.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","sent"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,t.jsx)(U.Send,{className:"size-4 shrink-0"}),"Sent"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>eN("untrust"),className:(0,b.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","untrust"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,t.jsx)(ea,{className:"size-4 shrink-0"}),"Untrust"]})]})]}),eU=(0,t.jsx)("div",{className:(0,b.cn)("h-full thin-scrollbar",g.length>0&&!N?"overflow-y-auto":"overflow-hidden"),children:N?(0,t.jsx)(t.Fragment,{children:Array.from({length:3}).map((e,s)=>(0,t.jsxs)("div",{className:"px-4 py-3 border-b border-border/30",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[(0,t.jsx)(X.Skeleton,{className:"h-3.5 w-32"}),(0,t.jsx)(X.Skeleton,{className:"h-2.5 w-10"})]}),(0,t.jsx)(X.Skeleton,{className:"h-3.5 w-48 mb-1.5"}),(0,t.jsx)(X.Skeleton,{className:"h-4 w-16 rounded-full"})]},s))}):0===g.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,t.jsx)(Q.Mail,{className:"size-8 text-muted-foreground mb-3"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"inbox"===p?"No emails from trusted senders":"sent"===p?"No emails sent yet":"No untrusted emails"})]}):g.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>eB(e.id),className:(0,b.cn)("w-full text-left px-4 py-3 border-b border-border/30 transition-colors duration-150 cursor-pointer",w===e.id?"bg-accent/60":"hover:bg-accent/30"),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[(0,t.jsx)("p",{className:(0,b.cn)("text-sm truncate","unread"===e.status?"font-semibold":"font-medium text-muted-foreground"),children:"sent"===p?e.to_email:e.from_email}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:["sent"!==p&&(0,t.jsx)("span",{className:(0,b.cn)("text-[10px] rounded-full px-1.5 py-0.5 leading-none font-medium","unread"===e.status?"bg-blue-500/15 text-blue-600 dark:text-blue-400":"bg-muted text-muted-foreground"),children:"unread"===e.status?"unread":"read"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:em(e.created_at)})]})]}),(0,t.jsx)("p",{className:(0,b.cn)("text-[13px] truncate","unread"===e.status?"text-foreground":"text-muted-foreground"),children:e.subject||"(no subject)"})]},e.id))}),eq=(0,t.jsx)("div",{className:"h-full overflow-auto flex flex-col min-w-0 thin-scrollbar",children:M?(0,t.jsx)(G,{fromAddress:eC,onSend:eR,onDiscard:()=>{H(!1),E({})},initialTo:B.to,initialSubject:B.subject,initialBody:B.body,initialAttachments:B.attachments,inReplyTo:B.inReplyTo,references:B.references},JSON.stringify(B)):eM?(0,t.jsxs)("div",{className:"flex flex-col h-full md:min-w-100 max-w-3xl mx-auto w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-0.5 border-b border-border/40 px-4 py-1.5",children:["untrust"===p&&(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",disabled:ef,onClick:()=>eD(eM)}),children:ef?(0,t.jsx)(V.Loader2,{className:"size-3.5 animate-spin"}):(0,t.jsx)(el.ShieldCheck,{className:"size-3.5"})}),(0,t.jsx)(y.TooltipContent,{children:"Trust this email"})]}),"sent"!==p&&(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let e;return e=eM.subject.startsWith("Re:")?eM.subject:`Re: ${eM.subject}`,void(z(null),E({to:eM.from_email,subject:e,body:e_(eM),...e$(eM)}),H(!0))}}),children:(0,t.jsx)(es,{className:"size-3.5"})}),(0,t.jsx)(y.TooltipContent,{children:"Reply"})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let e;return e=eM.subject.startsWith("Fwd:")?eM.subject:`Fwd: ${eM.subject}`,void(z(null),E({subject:e,body:e_(eM),attachments:eM.attachments??[],...e$(eM)}),H(!0))}}),children:(0,t.jsx)(et,{className:"size-3.5"})}),(0,t.jsx)(y.TooltipContent,{children:"Forward"})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-destructive",onClick:()=>{ex(eM.id),P(!0)}}),children:(0,t.jsx)(ee.Trash2,{className:"size-3.5"})}),(0,t.jsx)(y.TooltipContent,{children:"Delete"})]})]}),L.length>0&&(0,t.jsx)("div",{className:"border-b border-border/30",children:L.map(e=>(0,t.jsxs)("div",{className:"border-b border-border/20 last:border-b-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>eE(e.id),className:"w-full flex items-center gap-2 px-5 py-2.5 text-left hover:bg-accent/30 transition-colors cursor-pointer",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:_===e.id?"▾":"▸"}),(0,t.jsx)("span",{className:"text-sm font-medium truncate flex-1",children:e.from_email}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:em(e.created_at)})]}),_===e.id&&(0,t.jsxs)("div",{className:"px-5 pb-3",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:e.subject}),D[e.id]?D[e.id].isHtml?(0,t.jsx)(eu.EmailBodyFrame,{html:D[e.id].content,className:"max-w-full text-sm"}):(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:D[e.id].content}):(0,t.jsx)(V.Loader2,{className:"size-3 animate-spin text-muted-foreground"})]})]},e.id))}),(0,t.jsxs)("div",{className:"p-5",children:[(0,t.jsx)("h2",{className:"text-lg font-heading font-semibold tracking-tight mb-1",children:eM.subject||"(no subject)"}),(0,t.jsxs)("div",{className:"text-sm space-y-1 mb-5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,t.jsx)("span",{children:eM.from_email})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,t.jsx)("span",{children:eM.to_email})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"sent"===p?"Sent":"Received"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:new Date(eM.created_at).toLocaleString()})]})]}),C?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(V.Loader2,{className:"size-4 animate-spin text-muted-foreground"})}):eM.html_body?(0,t.jsx)(eu.EmailBodyFrame,{html:eM.html_body,className:"max-w-full"}):A?.isHtml?(0,t.jsx)(eu.EmailBodyFrame,{html:A.content,className:"max-w-full"}):(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:A?.content}),eM.attachments&&eM.attachments.length>0&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mb-2 text-xs text-muted-foreground",children:[(0,t.jsx)(K.Paperclip,{className:"size-3"}),eM.attachments.length," attachment",eM.attachments.length>1?"s":""]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:eM.attachments.map((e,s)=>(0,t.jsxs)("a",{href:`/api/email/${eM.id}/attachment/${s}?workspace_id=${c}`,target:"_blank",rel:"noopener noreferrer",download:e.filename,className:"flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/50 px-2.5 py-1.5 text-xs hover:bg-muted transition-colors cursor-pointer",children:[(0,t.jsx)(W.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate max-w-45",children:e.filename}),(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:e.size<1024?`${e.size} B`:e.size<1048576?`${(e.size/1024).toFixed(1)} KB`:`${(e.size/1048576).toFixed(1)} MB`})]},e.key))})]})]})]}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select an email to view"})}),eV=M?(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,t.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{H(!1),E({})},children:(0,t.jsx)(J.ArrowLeft,{className:"size-4"})}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"New Email"})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:eq})]}):w&&eM?(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,t.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{z(null),T(null)},children:(0,t.jsx)(J.ArrowLeft,{className:"size-4"})}),(0,t.jsx)("span",{className:"text-sm font-medium truncate",children:eM.subject||"(no subject)"})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:eq})]}):(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[ew.length>1&&(0,t.jsxs)("div",{className:"relative px-3 pt-2 pb-1 border-b border-border/30",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>ev(!ey),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:eC}),(0,t.jsx)(er.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:eP,className:"shrink-0 p-0.5"}),children:eI?(0,t.jsx)(ei.Check,{className:"size-2.5 text-green-500"}):(0,t.jsx)(en.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,t.jsx)(y.TooltipContent,{children:"Copy address"})]})]}),ey&&(0,t.jsx)("div",{className:"absolute left-2 right-2 top-full mt-0.5 z-10 rounded-lg border border-border bg-popover shadow-md py-1",children:ew.map((e,s)=>(0,t.jsxs)("button",{type:"button",onClick:()=>{eA(s),ev(!1)},className:(0,b.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",s===ez?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,t.jsx)(Q.Mail,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.address}),"custom"===e.type&&(0,t.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},e.address))})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 border-b border-border/50 px-3 py-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-0.5 flex-1 min-w-0",children:[{id:"inbox",label:"Inbox"},{id:"sent",label:"Sent"},{id:"untrust",label:"Untrust"}].map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>eN(e.id),className:(0,b.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors",p===e.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.label,"inbox"===e.id&&"inbox"===p&&v>0&&(0,t.jsx)("span",{className:"ml-0.5 text-[10px] bg-blue-500 text-white rounded-full px-1 leading-none min-w-4 text-center",children:v})]},e.id))}),(0,t.jsx)(o.Button,{size:"icon-sm",variant:"ghost",onClick:()=>{E({}),H(!0),z(null)},disabled:0===ew.length,children:(0,t.jsx)(Z.Plus,{className:"size-4"})})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:eU})]});return(0,t.jsxs)(t.Fragment,{children:[h?eV:(0,t.jsxs)(ec.ResizablePanelGroup,{orientation:"horizontal",children:[(0,t.jsx)(ec.ResizablePanel,{defaultSize:"15%",minSize:"10%",maxSize:"20%",children:eO}),(0,t.jsx)(ec.ResizableHandle,{withHandle:!0}),(0,t.jsx)(ec.ResizablePanel,{defaultSize:"30%",minSize:"15%",maxSize:"40%",children:eU}),(0,t.jsx)(ec.ResizableHandle,{withHandle:!0}),(0,t.jsx)(ec.ResizablePanel,{defaultSize:"55%",minSize:"25%",children:eq})]}),(0,t.jsx)(d.ConfirmDialog,{open:F,onOpenChange:P,title:"Delete email",description:"This will permanently delete this email.",loading:eh,onConfirm:eL})]})}],129396)}]);