@alook/app 0.0.133 → 0.0.135

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 (97) hide show
  1. package/bundled/email-worker/index.js +17 -9
  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/{1z4a4-hyguhc1.js → 29vahszwp_yzk.js} +3 -3
  8. package/bundled/web/.open-next/assets/_next/static/chunks/2nzhi1-lt9r-h.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/{2yh4j7b0i4eye.js → 3g9-r7m865tot.js} +2 -2
  13. package/bundled/web/.open-next/cache/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/_global-error.cache +1 -1
  14. package/bundled/web/.open-next/cache/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/_not-found.cache +1 -1
  15. package/bundled/web/.open-next/cache/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/device.cache +1 -1
  16. package/bundled/web/.open-next/cache/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/privacy.cache +1 -1
  17. package/bundled/web/.open-next/cache/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/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]__12fz1lr._.js +1 -1
  59. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +7 -5
  60. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{_1pt-oj4._.js → _0eu_mts._.js} +2 -2
  61. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{_0c6q0et._.js → _0kca2k0._.js} +2 -2
  62. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0r2vuif._.js +3 -0
  63. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0v95a0y._.js +14 -14
  64. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_139j3zh._.js +14 -14
  65. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1nfaney._.js +14 -14
  66. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1p90k-4._.js +3 -0
  67. 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
  68. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/1b4r_lucide-react_dist_esm_icons_0ci7b7p._.js +3 -0
  69. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +7 -5
  70. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0p54okk._.js +13 -13
  71. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0qgcnj5._.js +1 -1
  72. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0t5ob43._.js +3 -0
  73. 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
  74. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_lib_api_ts_1ffelwp._.js +1 -1
  75. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
  76. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
  77. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
  78. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
  79. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +99 -97
  80. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +181 -113
  81. package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +6 -6
  82. package/bundled/web/wrangler.toml +1 -1
  83. package/bundled/ws-do/index.js +17 -9
  84. package/dist/cli/index.js +1 -1
  85. package/dist/cli/session-runner.js +1 -1
  86. package/package.json +1 -1
  87. package/bundled/web/.open-next/assets/_next/static/chunks/0pd5shecdv7w3.js +0 -1
  88. package/bundled/web/.open-next/assets/_next/static/chunks/1ox78wqeeqant.js +0 -1
  89. package/bundled/web/.open-next/assets/_next/static/chunks/38j_4uwfj09mb.js +0 -1
  90. package/bundled/web/.open-next/assets/_next/static/chunks/3bfk44a51kg4q.js +0 -1
  91. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0qy7lt2._.js +0 -3
  92. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/1b4r_lucide-react_dist_esm_icons_0u7bkx8._.js +0 -3
  93. 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
  94. /package/bundled/web/.open-next/assets/_next/static/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/_buildManifest.js +0 -0
  95. /package/bundled/web/.open-next/assets/_next/static/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/_clientMiddlewareManifest.js +0 -0
  96. /package/bundled/web/.open-next/assets/_next/static/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/_ssgManifest.js +0 -0
  97. /package/bundled/web/.open-next/cache/{UUtXyb9u1pubazU2jTktS → sGrtuJLQm2artu6oSgWPT}/robots.txt.cache +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[221781,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(630991),e=a.i(506180),f=a.i(752792),g=a.i(588339);a.i(974936);var h=a.i(911509),i=a.i(732254),j=a.i(22902),k=a.i(983039),l=a.i(728778),m=a.i(443354),n=a.i(450274),o=a.i(297897),p=a.i(317703),q=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:a=>{let b=a.style.textAlign;return this.options.alignments.includes(b)?b:this.options.defaultAlignment},renderHTML:a=>a.textAlign?{style:`text-align: ${a.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:a=>({commands:b})=>!!this.options.alignments.includes(a)&&this.options.types.map(c=>b.updateAttributes(c,{textAlign:a})).some(a=>a),unsetTextAlign:()=>({commands:a})=>this.options.types.map(b=>a.resetAttributes(b,"textAlign")).some(a=>a),toggleTextAlign:a=>({editor:b,commands:c})=>!!this.options.alignments.includes(a)&&(b.isActive({textAlign:a})?c.unsetTextAlign():c.setTextAlign(a))}},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")}}}),r=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,s=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:a}){return["img",(0,p.mergeAttributes)(this.options.HTMLAttributes,a)]},parseMarkdown:(a,b)=>b.createNode("image",{src:a.href,title:a.title,alt:a.text}),renderMarkdown:a=>{var b,c,d,e,f,g;let h=null!=(c=null==(b=a.attrs)?void 0:b.src)?c:"",i=null!=(e=null==(d=a.attrs)?void 0:d.alt)?e:"",j=null!=(g=null==(f=a.attrs)?void 0:f.title)?g:"";return j?`![${i}](${h} "${j}")`:`![${i}](${h})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:a,minWidth:b,minHeight:c,alwaysPreserveAspectRatio:d}=this.options.resize;return({node:e,getPos:f,HTMLAttributes:g,editor:h})=>{let i=document.createElement("img");i.draggable=!1;let j=(0,p.mergeAttributes)(this.options.HTMLAttributes,g);Object.entries(j).forEach(([a,b])=>{if(null!=b)switch(a){case"width":case"height":break;default:i.setAttribute(a,b)}}),null!==j.src&&(i.src=j.src);let k=new p.ResizableNodeView({element:i,editor:h,node:e,getPos:f,onResize:(a,b)=>{i.style.width=`${a}px`,i.style.height=`${b}px`},onCommit:(a,b)=>{let c=f();void 0!==c&&this.editor.chain().setNodeSelection(c).updateAttributes(this.name,{width:a,height:b}).run()},onUpdate:(a,b,c)=>a.type===e.type,options:{directions:a,min:{width:b,height:c},preserveAspectRatio:!0===d}}),l=k.dom;return l.style.visibility="hidden",l.style.pointerEvents="none",i.onload=()=>{l.style.visibility="",l.style.pointerEvents=""},k}},addCommands(){return{setImage:a=>({commands:b})=>b.insertContent({type:this.name,attrs:a})}},addInputRules(){return[(0,p.nodeInputRule)({find:r,type:this.type,getAttributes:a=>{let[,,b,c,d]=a;return{src:c,alt:b,title:d}}})]}}),t=a.i(75118),u=a.i(525132),v=a.i(432340),w=a.i(334235),x=a.i(410732);let y=(0,x.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,x.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,x.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"}]]),B=(0,x.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,x.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"}]]),D=(0,x.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"}]]),E=(0,x.default)("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),F=(0,x.default)("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),G=(0,x.default)("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),H=(0,x.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"}]]),I=(0,x.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"}]]),J=(0,x.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"}]]),K=(0,x.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"}]]),L=(0,x.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 M=a.i(995900),M=M;function N({active:a,disabled:c,onAction:d,title:e,children:f}){return(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:c,onMouseDown:a=>a.preventDefault(),onClick:d,className:(0,t.cn)("text-muted-foreground/70",a&&"bg-accent text-foreground")}),children:f}),(0,b.jsx)(u.TooltipContent,{children:e})]})}function O(){return(0,b.jsx)("div",{className:"w-px h-4 bg-border/60 mx-0.5 shrink-0"})}function P({editor:a}){let[,d]=(0,c.useReducer)(a=>a+1,0),[e,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)("link"),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),s=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!a)return;let b=()=>d();return a.on("transaction",b),()=>{a.off("transaction",b)}},[a]),(0,c.useEffect)(()=>{e&&setTimeout(()=>r.current?.focus(),0)},[e]),!a)return null;let x="size-3.5",Q=()=>{let b=j.trim();if(b){try{new URL(b)}catch{m("Please enter a valid URL");return}if(m(""),"link"===g)if(p){let c=n.trim()||b;a.chain().focus().insertContent({type:"text",text:c,marks:[{type:"link",attrs:{href:b}}]}).run()}else a.chain().focus().extendMarkRange("link").setLink({href:b}).run();else a.chain().focus().setImage({src:b}).run();f(!1)}};return(0,b.jsxs)("div",{className:"flex items-center gap-0.5 px-3 py-1 overflow-x-auto",children:[(0,b.jsx)(N,{title:"Bold",active:a.isActive("bold"),onAction:()=>a.chain().focus().toggleBold().run(),children:(0,b.jsx)(y,{className:x})}),(0,b.jsx)(N,{title:"Italic",active:a.isActive("italic"),onAction:()=>a.chain().focus().toggleItalic().run(),children:(0,b.jsx)(z,{className:x})}),(0,b.jsx)(N,{title:"Underline",active:a.isActive("underline"),onAction:()=>a.chain().focus().toggleUnderline().run(),children:(0,b.jsx)(A,{className:x})}),(0,b.jsx)(N,{title:"Strikethrough",active:a.isActive("strike"),onAction:()=>a.chain().focus().toggleStrike().run(),children:(0,b.jsx)(B,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Heading 1",active:a.isActive("heading",{level:1}),onAction:()=>a.chain().focus().toggleHeading({level:1}).run(),children:(0,b.jsx)(K,{className:x})}),(0,b.jsx)(N,{title:"Heading 2",active:a.isActive("heading",{level:2}),onAction:()=>a.chain().focus().toggleHeading({level:2}).run(),children:(0,b.jsx)(L,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Bullet List",active:a.isActive("bulletList"),onAction:()=>a.chain().focus().toggleBulletList().run(),children:(0,b.jsx)(C,{className:x})}),(0,b.jsx)(N,{title:"Ordered List",active:a.isActive("orderedList"),onAction:()=>a.chain().focus().toggleOrderedList().run(),children:(0,b.jsx)(D,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Align Left",active:a.isActive({textAlign:"left"}),onAction:()=>a.chain().focus().setTextAlign("left").run(),children:(0,b.jsx)(E,{className:x})}),(0,b.jsx)(N,{title:"Align Center",active:a.isActive({textAlign:"center"}),onAction:()=>a.chain().focus().setTextAlign("center").run(),children:(0,b.jsx)(F,{className:x})}),(0,b.jsx)(N,{title:"Align Right",active:a.isActive({textAlign:"right"}),onAction:()=>a.chain().focus().setTextAlign("right").run(),children:(0,b.jsx)(G,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onMouseDown:b=>{b.preventDefault(),s.current=a.isActive("link")},onClick:()=>{s.current?a.chain().focus().unsetLink().run():(h("link"),k(""),m(""),o(""),q(a.state.selection.empty),f(!0))},className:(0,t.cn)("text-muted-foreground/70",a.isActive("link")&&"bg-accent text-foreground")}),children:a.isActive("link")?(0,b.jsx)(I,{className:x}):(0,b.jsx)(H,{className:x})}),(0,b.jsx)(u.TooltipContent,{children:a.isActive("link")?"Remove Link":"Insert Link"})]}),(0,b.jsx)(N,{title:"Insert Image",onAction:()=>{h("image"),k(""),m(""),f(!0)},children:(0,b.jsx)(J,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Horizontal Rule",onAction:()=>a.chain().focus().setHorizontalRule().run(),children:(0,b.jsx)(M.default,{className:x})}),(0,b.jsx)(v.Dialog,{open:e,onOpenChange:f,children:(0,b.jsxs)(v.DialogContent,{children:[(0,b.jsx)(v.DialogHeader,{children:(0,b.jsx)(v.DialogTitle,{children:"link"===g?"Insert Link":"Insert Image"})}),"link"===g&&p&&(0,b.jsx)(w.Input,{ref:r,value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"Display text"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(w.Input,{ref:"image"!==g&&p?void 0:r,value:j,onChange:a=>{k(a.target.value),m("")},onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"link"===g?"https://example.com":"https://example.com/image.png",type:"url","aria-invalid":!!l}),l&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:l})]}),(0,b.jsx)(v.DialogFooter,{children:(0,b.jsx)(i.Button,{onClick:Q,disabled:!j.trim(),children:"Insert"})})]})})]})}var Q=a.i(780956),R=a.i(554705),S=a.i(351360),T=a.i(84096),U=a.i(343558),V=a.i(354875);function W({fromAddress:d,onSend:e,onDiscard:f,initialTo:g="",initialSubject:h="",initialBody:j="",initialAttachments:p=[],inReplyTo:r,references:t}){let[v,x]=(0,c.useState)(g),[y,z]=(0,c.useState)(h),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(p),[E,F]=(0,c.useState)(!1),G=(0,c.useRef)(null),H=(0,k.useEditor)({immediatelyRender:!1,content:j||void 0,extensions:[l.default.configure({link:!1,underline:!1}),m.default.configure({placeholder:"Write your email..."}),n.default,o.default.configure({autolink:!0,openOnClick:!1,linkOnPaste:!0}),q.configure({types:["heading","paragraph"]}),s.configure({inline:!0,allowBase64:!0})],editorProps:{attributes:{class:"text-sm max-w-none focus:outline-none min-h-50 px-4 py-3"}}}),I=async()=>{if(v.trim()&&y.trim()&&H){B(!0);try{let a=H.getHTML();await e(v.trim(),y.trim(),a,C,r||t?{inReplyTo:r,references:t}:void 0)&&(x(""),z(""),D([]),H.commands.clearContent())}finally{B(!1)}}},J=async b=>{let c=b.target.files;if(c&&0!==c.length){F(!0);try{let{uploadEmailAttachment:b}=await a.A(81396);for(let a of Array.from(c)){if(a.size>0xa00000){Q.toast.error(`${a.name} exceeds 10 MB limit`);continue}let c=new URLSearchParams(window.location.search).get("workspace_id")??"",d=await b(a,c);D(a=>[...a,d])}}catch{Q.toast.error("Failed to upload attachment")}finally{F(!1),G.current&&(G.current.value="")}}};return(0,b.jsxs)("div",{className:"flex flex-col h-full w-full min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2",children:[(0,b.jsx)("h3",{className:"text-sm font-heading font-medium tracking-tight",children:"New Email"}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(i.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground h-7 px-2",onClick:f,disabled:A,children:[(0,b.jsx)(S.X,{className:"size-3 mr-1"}),"Discard"]}),(0,b.jsxs)(i.Button,{size:"sm",className:"text-xs h-7 px-3",onClick:I,disabled:A||!v.trim()||!y.trim(),children:[A?(0,b.jsx)(T.Loader2,{className:"size-3 mr-1 animate-spin"}):(0,b.jsx)(R.Send,{className:"size-3 mr-1"}),"Send"]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border/30 px-4 py-2.5 space-y-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{className:"text-muted-foreground truncate min-w-0",children:d})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{type:"email",value:v,onChange:a=>x(a.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,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"Subject"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{value:y,onChange:a=>z(a.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,b.jsxs)("div",{className:"flex items-center border-b border-border/30",children:[(0,b.jsx)(P,{editor:H}),(0,b.jsxs)("div",{className:"flex items-center gap-1 px-2 border-l border-border/30",children:[(0,b.jsx)("input",{ref:G,type:"file",multiple:!0,className:"hidden",onChange:J}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:E,onMouseDown:a=>a.preventDefault(),onClick:()=>G.current?.click(),className:"text-muted-foreground/70"}),children:E?(0,b.jsx)(T.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(U.Paperclip,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Attach file"})]})]})]}),C.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5 px-4 py-2 border-b border-border/30",children:C.map(a=>{var c;return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs",children:[(0,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-37.5",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:(c=a.size)<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`}),(0,b.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.key,void D(a=>a.filter(a=>a.key!==b))},className:"text-muted-foreground hover:text-foreground ml-0.5 cursor-pointer",children:(0,b.jsx)(S.X,{className:"size-3"})})]},a.key)})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar",children:(0,b.jsx)(k.EditorContent,{editor:H})})]})}var X=a.i(25668),Y=a.i(598169),Z=a.i(551798),$=a.i(784257),_=a.i(396439),aa=a.i(790107);let ab=(0,x.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"}]]),ac=(0,x.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 ad=a.i(340490),ae=a.i(613348);let af=(0,x.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 ag=a.i(450817),ah=a.i(946621),ai=a.i(586220),aj=a.i(559745),ak=a.i(135510);function al(a){let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return e<7?`${e}d ago`:b.toLocaleDateString(void 0,{month:"short",day:"numeric"})}a.s(["default",0,function(){let a=(0,d.useParams)().id,{workspaceId:k}=(0,e.useWorkspace)(),{agents:l,subscribeWs:m}=(0,f.useAgentContext)(),n=l.find(b=>b.id===a),o=(0,ai.useIsMobile)(),[p,q]=(0,c.useState)("inbox"),[r,s]=(0,c.useState)([]),v=(0,c.useMemo)(()=>r.filter(a=>"unread"===a.status).length,[r]),[w,x]=(0,c.useState)(!0),[y,z]=(0,c.useState)(null),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)({}),[I,J]=(0,c.useState)([]),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)({}),[O,P]=(0,c.useState)(!1),[S,am]=(0,c.useState)(null),[an,ao]=(0,c.useState)(!1),[ap,aq]=(0,c.useState)([]),[ar,as]=(0,c.useState)(!1),at=(0,c.useCallback)(a=>{q(a),s([]),z(null),B(null),F(!1)},[]),au=n?.email_handle?(0,h.toAlookAddress)(n.email_handle):"",av=[...au?[{type:"alook",address:au}]:[],...ap.map(a=>({type:"custom",address:a.email_address,accountId:a.id}))],[aw,ax]=(0,c.useState)(0),ay=av[aw]??av[0]??null,az=ay?.address??"",aA=ay?.type==="custom"?ay.accountId:void 0,aB=r.find(a=>a.id===y)??null,aC=(0,c.useCallback)(async(b,c)=>{x(!0);try{let d=await (0,g.listEmails)(a,k,b,c);s(d)}catch{Q.toast.error("Failed to load emails")}finally{x(!1)}},[a,k]);(0,c.useEffect)(()=>{(0,g.listEmailAccounts)(a,k).then(aq).catch(()=>{})},[a,k]),(0,c.useEffect)(()=>{aC(p,az)},[p,az,aC]),(0,c.useEffect)(()=>m(b=>{"email.received"===b.type&&b.agentId===a?((0,ah.trackEmailReceived)({agent_id:a,mailbox_type:ay?.type==="custom"?"imap":"alook"}),aC(p,az)):"email.sent"===b.type&&b.agentId===a&&aC(p,az)}),[m,a,p,az,aC,ay?.type]);let aD=async a=>{F(!1),z(a),B(null),D(!0),J([]),L(null),N({});try{let[b,c]=await Promise.all([(0,g.getEmailBody)(a,k),(0,g.getEmailThread)(a,k).catch(()=>[])]);B(b),J(c);let d=r.find(b=>b.id===a);d&&"unread"===d.status&&(0,g.updateEmailStatus)(a,k,"read").then(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"read"}:b))}).catch(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"unread"}:b))})}catch{B({content:"(body not available)",isHtml:!1})}finally{D(!1)}},aE=async a=>{if(K===a)return void L(null);if(L(a),!M[a])try{let b=await (0,g.getEmailBody)(a,k);N(c=>({...c,[a]:b}))}catch{N(b=>({...b,[a]:{content:"(body not available)",isHtml:!1}}))}},aF=async()=>{if(S){ao(!0);try{await (0,g.deleteEmail)(S,k),s(a=>a.filter(a=>a.id!==S)),y===S&&(z(null),B(null)),Q.toast.success("Email deleted")}catch{Q.toast.error("Failed to delete email")}finally{ao(!1),P(!1),am(null)}}},aG=async(b,c,d,e,f)=>{try{return await (0,g.sendEmail)(a,b,c,d,k,e.length>0?e:void 0,f,aA),(0,ah.trackEmailComposed)({agent_id:a,has_attachments:e.length>0}),Q.toast.success("Email sent"),F(!1),at("sent"),!0}catch{return Q.toast.error("Failed to send email"),!1}},aH=a=>`<br/><br/><div style="border-left: 2px solid #ccc; padding-left: 12px; margin-left: 0; color: #666;"><p><strong>From:</strong> ${a.from_email}<br/><strong>To:</strong> ${a.to_email}<br/><strong>Date:</strong> ${new Date(a.created_at).toLocaleString()}<br/><strong>Subject:</strong> ${a.subject}</p>`+(a.html_body?a.html_body:A?.isHtml?A.content:`<pre>${A?.content??""}</pre>`)+"</div>",aI=a=>({inReplyTo:a.message_id||void 0,references:[a.references,a.message_id].filter(Boolean).join(" ").trim()||void 0}),[aJ,aK]=(0,c.useState)(!1),aL=async()=>{if(az)try{await navigator.clipboard.writeText(az),aK(!0),setTimeout(()=>aK(!1),1500)}catch{Q.toast.error("Failed to copy")}},aM=(0,b.jsxs)("div",{className:"flex h-full flex-col",children:[av.length>0?(0,b.jsx)("div",{className:"px-3 pt-3 pb-1 relative",children:1===av.length?(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aL,className:"group flex items-center gap-1.5 text-left cursor-pointer w-full"}),children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:az}),aJ?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500 shrink-0"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/0 group-hover:text-muted-foreground/60 shrink-0 transition-colors"})]}),(0,b.jsx)(u.TooltipContent,{children:"Click to copy"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 w-full",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>as(!ar),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:az}),(0,b.jsx)(ag.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aL,className:"shrink-0 p-0.5"}),children:aJ?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),ar&&(0,b.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:av.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{ax(c),as(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===aw?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]})}):(0,b.jsx)("div",{className:"px-3 pt-3 pb-1",children:(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:"No email configured"})}),(0,b.jsx)("div",{className:"p-2",children:(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{size:"sm",className:"w-full justify-start text-xs h-8 gap-1.5",onClick:()=>{H({}),F(!0),z(null)},disabled:0===av.length}),children:[(0,b.jsx)(_.Plus,{className:"size-3.5"}),"New Email"]}),(0,b.jsx)(u.TooltipContent,{children:0===av.length?"Configure an email in agent settings to send emails":"Compose new email"})]})}),(0,b.jsxs)("nav",{className:"flex flex-col gap-0.5 px-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>at("inbox"),className:(0,t.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,b.jsx)($.Inbox,{className:"size-4 shrink-0"}),"Inbox","inbox"===p&&v>0&&(0,b.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,b.jsxs)("button",{type:"button",onClick:()=>at("sent"),className:(0,t.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,b.jsx)(R.Send,{className:"size-4 shrink-0"}),"Sent"]}),(0,b.jsxs)("button",{type:"button",onClick:()=>at("untrust"),className:(0,t.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,b.jsx)(af,{className:"size-4 shrink-0"}),"Untrust"]})]})]}),aN=(0,b.jsx)("div",{className:(0,t.cn)("h-full thin-scrollbar",r.length>0&&!w?"overflow-y-auto":"overflow-hidden"),children:w?(0,b.jsx)(b.Fragment,{children:Array.from({length:3}).map((a,c)=>(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-32"}),(0,b.jsx)(X.Skeleton,{className:"h-2.5 w-10"})]}),(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-48 mb-1.5"}),(0,b.jsx)(X.Skeleton,{className:"h-4 w-16 rounded-full"})]},c))}):0===r.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(Z.Mail,{className:"size-8 text-muted-foreground mb-3"}),(0,b.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"})]}):r.map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>aD(a.id),className:(0,t.cn)("w-full text-left px-4 py-3 border-b border-border/30 transition-colors duration-150 cursor-pointer",y===a.id?"bg-accent/60":"hover:bg-accent/30"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[(0,b.jsx)("p",{className:(0,t.cn)("text-sm truncate","unread"===a.status?"font-semibold":"font-medium text-muted-foreground"),children:"sent"===p?a.to_email:a.from_email}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:["sent"!==p&&(0,b.jsx)("span",{className:(0,t.cn)("text-[10px] rounded-full px-1.5 py-0.5 leading-none font-medium","unread"===a.status?"bg-blue-500/15 text-blue-600 dark:text-blue-400":"bg-muted text-muted-foreground"),children:"unread"===a.status?"unread":"read"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:al(a.created_at)})]})]}),(0,b.jsx)("p",{className:(0,t.cn)("text-[13px] truncate","unread"===a.status?"text-foreground":"text-muted-foreground"),children:a.subject||"(no subject)"})]},a.id))}),aO=(0,b.jsx)("div",{className:"h-full overflow-auto flex flex-col min-w-0 thin-scrollbar",children:E?(0,b.jsx)(W,{fromAddress:az,onSend:aG,onDiscard:()=>{F(!1),H({})},initialTo:G.to,initialSubject:G.subject,initialBody:G.body,initialAttachments:G.attachments,inReplyTo:G.inReplyTo,references:G.references},JSON.stringify(G)):aB?(0,b.jsxs)("div",{className:"flex flex-col h-full md:min-w-100 max-w-3xl mx-auto w-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-0.5 border-b border-border/40 px-4 py-1.5",children:["sent"!==p&&(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aB.subject.startsWith("Re:")?aB.subject:`Re: ${aB.subject}`,void(z(null),H({to:aB.from_email,subject:a,body:aH(aB),...aI(aB)}),F(!0))}}),children:(0,b.jsx)(ac,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Reply"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aB.subject.startsWith("Fwd:")?aB.subject:`Fwd: ${aB.subject}`,void(z(null),H({subject:a,body:aH(aB),attachments:aB.attachments??[],...aI(aB)}),F(!0))}}),children:(0,b.jsx)(ab,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Forward"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-destructive",onClick:()=>{am(aB.id),P(!0)}}),children:(0,b.jsx)(aa.Trash2,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Delete"})]})]}),I.length>0&&(0,b.jsx)("div",{className:"border-b border-border/30",children:I.map(a=>(0,b.jsxs)("div",{className:"border-b border-border/20 last:border-b-0",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>aE(a.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,b.jsx)("span",{className:"text-xs text-muted-foreground",children:K===a.id?"▾":"▸"}),(0,b.jsx)("span",{className:"text-sm font-medium truncate flex-1",children:a.from_email}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:al(a.created_at)})]}),K===a.id&&(0,b.jsxs)("div",{className:"px-5 pb-3",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:a.subject}),M[a.id]?M[a.id].isHtml?(0,b.jsx)(ak.EmailBodyFrame,{html:M[a.id].content,className:"max-w-full text-sm"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:M[a.id].content}):(0,b.jsx)(T.Loader2,{className:"size-3 animate-spin text-muted-foreground"})]})]},a.id))}),(0,b.jsxs)("div",{className:"p-5",children:[(0,b.jsx)("h2",{className:"text-lg font-heading font-semibold tracking-tight mb-1",children:aB.subject||"(no subject)"}),(0,b.jsxs)("div",{className:"text-sm space-y-1 mb-5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{children:aB.from_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("span",{children:aB.to_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"sent"===p?"Sent":"Received"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:new Date(aB.created_at).toLocaleString()})]})]}),C?(0,b.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,b.jsx)(T.Loader2,{className:"size-4 animate-spin text-muted-foreground"})}):aB.html_body?(0,b.jsx)(ak.EmailBodyFrame,{html:aB.html_body,className:"max-w-full"}):A?.isHtml?(0,b.jsx)(ak.EmailBodyFrame,{html:A.content,className:"max-w-full"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:A?.content}),aB.attachments&&aB.attachments.length>0&&(0,b.jsxs)("div",{className:"mt-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mb-2 text-xs text-muted-foreground",children:[(0,b.jsx)(U.Paperclip,{className:"size-3"}),aB.attachments.length," attachment",aB.attachments.length>1?"s":""]}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:aB.attachments.map((a,c)=>(0,b.jsxs)("a",{href:`/api/email/${aB.id}/attachment/${c}?workspace_id=${k}`,target:"_blank",rel:"noopener noreferrer",download:a.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,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-45",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:a.size<1024?`${a.size} B`:a.size<1048576?`${(a.size/1024).toFixed(1)} KB`:`${(a.size/1048576).toFixed(1)} MB`})]},a.key))})]})]})]}):(0,b.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select an email to view"})}),aP=E?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{F(!1),H({})},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"New Email"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aO})]}):y&&aB?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{z(null),B(null)},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium truncate",children:aB.subject||"(no subject)"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aO})]}):(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[av.length>1&&(0,b.jsxs)("div",{className:"relative px-3 pt-2 pb-1 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>as(!ar),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:az}),(0,b.jsx)(ag.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aL,className:"shrink-0 p-0.5"}),children:aJ?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),ar&&(0,b.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:av.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{ax(c),as(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===aw?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 border-b border-border/50 px-3 py-2",children:[(0,b.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(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>at(a.id),className:(0,t.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors",p===a.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.label,"inbox"===a.id&&"inbox"===p&&v>0&&(0,b.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})]},a.id))}),(0,b.jsx)(i.Button,{size:"icon-sm",variant:"ghost",onClick:()=>{H({}),F(!0),z(null)},disabled:0===av.length,children:(0,b.jsx)(_.Plus,{className:"size-4"})})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aN})]});return(0,b.jsxs)(b.Fragment,{children:[o?aP:(0,b.jsxs)(aj.ResizablePanelGroup,{orientation:"horizontal",children:[(0,b.jsx)(aj.ResizablePanel,{defaultSize:"15%",minSize:"10%",maxSize:"20%",children:aM}),(0,b.jsx)(aj.ResizableHandle,{withHandle:!0}),(0,b.jsx)(aj.ResizablePanel,{defaultSize:"30%",minSize:"15%",maxSize:"40%",children:aN}),(0,b.jsx)(aj.ResizableHandle,{withHandle:!0}),(0,b.jsx)(aj.ResizablePanel,{defaultSize:"55%",minSize:"25%",children:aO})]}),(0,b.jsx)(j.ConfirmDialog,{open:O,onOpenChange:P,title:"Delete email",description:"This will permanently delete this email.",loading:an,onConfirm:aF})]})}],221781)}];
1
+ module.exports=[221781,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(630991),e=a.i(506180),f=a.i(752792),g=a.i(588339);a.i(974936);var h=a.i(911509),i=a.i(732254),j=a.i(22902),k=a.i(983039),l=a.i(728778),m=a.i(443354),n=a.i(450274),o=a.i(297897),p=a.i(317703),q=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:a=>{let b=a.style.textAlign;return this.options.alignments.includes(b)?b:this.options.defaultAlignment},renderHTML:a=>a.textAlign?{style:`text-align: ${a.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:a=>({commands:b})=>!!this.options.alignments.includes(a)&&this.options.types.map(c=>b.updateAttributes(c,{textAlign:a})).some(a=>a),unsetTextAlign:()=>({commands:a})=>this.options.types.map(b=>a.resetAttributes(b,"textAlign")).some(a=>a),toggleTextAlign:a=>({editor:b,commands:c})=>!!this.options.alignments.includes(a)&&(b.isActive({textAlign:a})?c.unsetTextAlign():c.setTextAlign(a))}},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")}}}),r=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,s=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:a}){return["img",(0,p.mergeAttributes)(this.options.HTMLAttributes,a)]},parseMarkdown:(a,b)=>b.createNode("image",{src:a.href,title:a.title,alt:a.text}),renderMarkdown:a=>{var b,c,d,e,f,g;let h=null!=(c=null==(b=a.attrs)?void 0:b.src)?c:"",i=null!=(e=null==(d=a.attrs)?void 0:d.alt)?e:"",j=null!=(g=null==(f=a.attrs)?void 0:f.title)?g:"";return j?`![${i}](${h} "${j}")`:`![${i}](${h})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:a,minWidth:b,minHeight:c,alwaysPreserveAspectRatio:d}=this.options.resize;return({node:e,getPos:f,HTMLAttributes:g,editor:h})=>{let i=document.createElement("img");i.draggable=!1;let j=(0,p.mergeAttributes)(this.options.HTMLAttributes,g);Object.entries(j).forEach(([a,b])=>{if(null!=b)switch(a){case"width":case"height":break;default:i.setAttribute(a,b)}}),null!==j.src&&(i.src=j.src);let k=new p.ResizableNodeView({element:i,editor:h,node:e,getPos:f,onResize:(a,b)=>{i.style.width=`${a}px`,i.style.height=`${b}px`},onCommit:(a,b)=>{let c=f();void 0!==c&&this.editor.chain().setNodeSelection(c).updateAttributes(this.name,{width:a,height:b}).run()},onUpdate:(a,b,c)=>a.type===e.type,options:{directions:a,min:{width:b,height:c},preserveAspectRatio:!0===d}}),l=k.dom;return l.style.visibility="hidden",l.style.pointerEvents="none",i.onload=()=>{l.style.visibility="",l.style.pointerEvents=""},k}},addCommands(){return{setImage:a=>({commands:b})=>b.insertContent({type:this.name,attrs:a})}},addInputRules(){return[(0,p.nodeInputRule)({find:r,type:this.type,getAttributes:a=>{let[,,b,c,d]=a;return{src:c,alt:b,title:d}}})]}}),t=a.i(75118),u=a.i(525132),v=a.i(432340),w=a.i(334235),x=a.i(410732);let y=(0,x.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,x.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,x.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"}]]),B=(0,x.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,x.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"}]]),D=(0,x.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"}]]),E=(0,x.default)("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),F=(0,x.default)("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),G=(0,x.default)("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),H=(0,x.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"}]]),I=(0,x.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"}]]),J=(0,x.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"}]]),K=(0,x.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"}]]),L=(0,x.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 M=a.i(995900),M=M;function N({active:a,disabled:c,onAction:d,title:e,children:f}){return(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:c,onMouseDown:a=>a.preventDefault(),onClick:d,className:(0,t.cn)("text-muted-foreground/70",a&&"bg-accent text-foreground")}),children:f}),(0,b.jsx)(u.TooltipContent,{children:e})]})}function O(){return(0,b.jsx)("div",{className:"w-px h-4 bg-border/60 mx-0.5 shrink-0"})}function P({editor:a}){let[,d]=(0,c.useReducer)(a=>a+1,0),[e,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)("link"),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),s=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!a)return;let b=()=>d();return a.on("transaction",b),()=>{a.off("transaction",b)}},[a]),(0,c.useEffect)(()=>{e&&setTimeout(()=>r.current?.focus(),0)},[e]),!a)return null;let x="size-3.5",Q=()=>{let b=j.trim();if(b){try{new URL(b)}catch{m("Please enter a valid URL");return}if(m(""),"link"===g)if(p){let c=n.trim()||b;a.chain().focus().insertContent({type:"text",text:c,marks:[{type:"link",attrs:{href:b}}]}).run()}else a.chain().focus().extendMarkRange("link").setLink({href:b}).run();else a.chain().focus().setImage({src:b}).run();f(!1)}};return(0,b.jsxs)("div",{className:"flex items-center gap-0.5 px-3 py-1 overflow-x-auto",children:[(0,b.jsx)(N,{title:"Bold",active:a.isActive("bold"),onAction:()=>a.chain().focus().toggleBold().run(),children:(0,b.jsx)(y,{className:x})}),(0,b.jsx)(N,{title:"Italic",active:a.isActive("italic"),onAction:()=>a.chain().focus().toggleItalic().run(),children:(0,b.jsx)(z,{className:x})}),(0,b.jsx)(N,{title:"Underline",active:a.isActive("underline"),onAction:()=>a.chain().focus().toggleUnderline().run(),children:(0,b.jsx)(A,{className:x})}),(0,b.jsx)(N,{title:"Strikethrough",active:a.isActive("strike"),onAction:()=>a.chain().focus().toggleStrike().run(),children:(0,b.jsx)(B,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Heading 1",active:a.isActive("heading",{level:1}),onAction:()=>a.chain().focus().toggleHeading({level:1}).run(),children:(0,b.jsx)(K,{className:x})}),(0,b.jsx)(N,{title:"Heading 2",active:a.isActive("heading",{level:2}),onAction:()=>a.chain().focus().toggleHeading({level:2}).run(),children:(0,b.jsx)(L,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Bullet List",active:a.isActive("bulletList"),onAction:()=>a.chain().focus().toggleBulletList().run(),children:(0,b.jsx)(C,{className:x})}),(0,b.jsx)(N,{title:"Ordered List",active:a.isActive("orderedList"),onAction:()=>a.chain().focus().toggleOrderedList().run(),children:(0,b.jsx)(D,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Align Left",active:a.isActive({textAlign:"left"}),onAction:()=>a.chain().focus().setTextAlign("left").run(),children:(0,b.jsx)(E,{className:x})}),(0,b.jsx)(N,{title:"Align Center",active:a.isActive({textAlign:"center"}),onAction:()=>a.chain().focus().setTextAlign("center").run(),children:(0,b.jsx)(F,{className:x})}),(0,b.jsx)(N,{title:"Align Right",active:a.isActive({textAlign:"right"}),onAction:()=>a.chain().focus().setTextAlign("right").run(),children:(0,b.jsx)(G,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onMouseDown:b=>{b.preventDefault(),s.current=a.isActive("link")},onClick:()=>{s.current?a.chain().focus().unsetLink().run():(h("link"),k(""),m(""),o(""),q(a.state.selection.empty),f(!0))},className:(0,t.cn)("text-muted-foreground/70",a.isActive("link")&&"bg-accent text-foreground")}),children:a.isActive("link")?(0,b.jsx)(I,{className:x}):(0,b.jsx)(H,{className:x})}),(0,b.jsx)(u.TooltipContent,{children:a.isActive("link")?"Remove Link":"Insert Link"})]}),(0,b.jsx)(N,{title:"Insert Image",onAction:()=>{h("image"),k(""),m(""),f(!0)},children:(0,b.jsx)(J,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Horizontal Rule",onAction:()=>a.chain().focus().setHorizontalRule().run(),children:(0,b.jsx)(M.default,{className:x})}),(0,b.jsx)(v.Dialog,{open:e,onOpenChange:f,children:(0,b.jsxs)(v.DialogContent,{children:[(0,b.jsx)(v.DialogHeader,{children:(0,b.jsx)(v.DialogTitle,{children:"link"===g?"Insert Link":"Insert Image"})}),"link"===g&&p&&(0,b.jsx)(w.Input,{ref:r,value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"Display text"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(w.Input,{ref:"image"!==g&&p?void 0:r,value:j,onChange:a=>{k(a.target.value),m("")},onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"link"===g?"https://example.com":"https://example.com/image.png",type:"url","aria-invalid":!!l}),l&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:l})]}),(0,b.jsx)(v.DialogFooter,{children:(0,b.jsx)(i.Button,{onClick:Q,disabled:!j.trim(),children:"Insert"})})]})})]})}var Q=a.i(780956),R=a.i(554705),S=a.i(351360),T=a.i(84096),U=a.i(343558),V=a.i(354875);function W({fromAddress:d,onSend:e,onDiscard:f,initialTo:g="",initialSubject:h="",initialBody:j="",initialAttachments:p=[],inReplyTo:r,references:t}){let[v,x]=(0,c.useState)(g),[y,z]=(0,c.useState)(h),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(p),[E,F]=(0,c.useState)(!1),G=(0,c.useRef)(null),H=(0,k.useEditor)({immediatelyRender:!1,content:j||void 0,extensions:[l.default.configure({link:!1,underline:!1}),m.default.configure({placeholder:"Write your email..."}),n.default,o.default.configure({autolink:!0,openOnClick:!1,linkOnPaste:!0}),q.configure({types:["heading","paragraph"]}),s.configure({inline:!0,allowBase64:!0})],editorProps:{attributes:{class:"text-sm max-w-none focus:outline-none min-h-50 px-4 py-3"}}}),I=async()=>{if(v.trim()&&y.trim()&&H){B(!0);try{let a=H.getHTML();await e(v.trim(),y.trim(),a,C,r||t?{inReplyTo:r,references:t}:void 0)&&(x(""),z(""),D([]),H.commands.clearContent())}finally{B(!1)}}},J=async b=>{let c=b.target.files;if(c&&0!==c.length){F(!0);try{let{uploadEmailAttachment:b}=await a.A(81396);for(let a of Array.from(c)){if(a.size>0xa00000){Q.toast.error(`${a.name} exceeds 10 MB limit`);continue}let c=new URLSearchParams(window.location.search).get("workspace_id")??"",d=await b(a,c);D(a=>[...a,d])}}catch{Q.toast.error("Failed to upload attachment")}finally{F(!1),G.current&&(G.current.value="")}}};return(0,b.jsxs)("div",{className:"flex flex-col h-full w-full min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2",children:[(0,b.jsx)("h3",{className:"text-sm font-heading font-medium tracking-tight",children:"New Email"}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(i.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground h-7 px-2",onClick:f,disabled:A,children:[(0,b.jsx)(S.X,{className:"size-3 mr-1"}),"Discard"]}),(0,b.jsxs)(i.Button,{size:"sm",className:"text-xs h-7 px-3",onClick:I,disabled:A||!v.trim()||!y.trim(),children:[A?(0,b.jsx)(T.Loader2,{className:"size-3 mr-1 animate-spin"}):(0,b.jsx)(R.Send,{className:"size-3 mr-1"}),"Send"]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border/30 px-4 py-2.5 space-y-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{className:"text-muted-foreground truncate min-w-0",children:d})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{type:"email",value:v,onChange:a=>x(a.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,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"Subject"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{value:y,onChange:a=>z(a.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,b.jsxs)("div",{className:"flex items-center border-b border-border/30",children:[(0,b.jsx)(P,{editor:H}),(0,b.jsxs)("div",{className:"flex items-center gap-1 px-2 border-l border-border/30",children:[(0,b.jsx)("input",{ref:G,type:"file",multiple:!0,className:"hidden",onChange:J}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:E,onMouseDown:a=>a.preventDefault(),onClick:()=>G.current?.click(),className:"text-muted-foreground/70"}),children:E?(0,b.jsx)(T.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(U.Paperclip,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Attach file"})]})]})]}),C.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5 px-4 py-2 border-b border-border/30",children:C.map(a=>{var c;return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs",children:[(0,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-37.5",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:(c=a.size)<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`}),(0,b.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.key,void D(a=>a.filter(a=>a.key!==b))},className:"text-muted-foreground hover:text-foreground ml-0.5 cursor-pointer",children:(0,b.jsx)(S.X,{className:"size-3"})})]},a.key)})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar",children:(0,b.jsx)(k.EditorContent,{editor:H})})]})}var X=a.i(25668),Y=a.i(598169),Z=a.i(551798),$=a.i(784257),_=a.i(396439),aa=a.i(790107);let ab=(0,x.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"}]]),ac=(0,x.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 ad=a.i(340490),ae=a.i(613348);let af=(0,x.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 ag=a.i(340233),ah=a.i(450817),ai=a.i(946621),aj=a.i(586220),ak=a.i(559745),al=a.i(135510);function am(a){let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return e<7?`${e}d ago`:b.toLocaleDateString(void 0,{month:"short",day:"numeric"})}a.s(["default",0,function(){let a=(0,d.useParams)().id,{workspaceId:k}=(0,e.useWorkspace)(),{agents:l,subscribeWs:m}=(0,f.useAgentContext)(),n=l.find(b=>b.id===a),o=(0,aj.useIsMobile)(),[p,q]=(0,c.useState)("inbox"),[r,s]=(0,c.useState)([]),v=(0,c.useMemo)(()=>r.filter(a=>"unread"===a.status).length,[r]),[w,x]=(0,c.useState)(!0),[y,z]=(0,c.useState)(null),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)({}),[I,J]=(0,c.useState)([]),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)({}),[O,P]=(0,c.useState)(!1),[S,an]=(0,c.useState)(null),[ao,ap]=(0,c.useState)(!1),[aq,ar]=(0,c.useState)(!1),[as,at]=(0,c.useState)([]),[au,av]=(0,c.useState)(!1),aw=(0,c.useCallback)(a=>{q(a),s([]),z(null),B(null),F(!1)},[]),ax=n?.email_handle?(0,h.toAlookAddress)(n.email_handle):"",ay=[...ax?[{type:"alook",address:ax}]:[],...as.map(a=>({type:"custom",address:a.email_address,accountId:a.id}))],[az,aA]=(0,c.useState)(0),aB=ay[az]??ay[0]??null,aC=aB?.address??"",aD=aB?.type==="custom"?aB.accountId:void 0,aE=r.find(a=>a.id===y)??null,aF=(0,c.useCallback)(async(b,c)=>{x(!0);try{let d=await (0,g.listEmails)(a,k,b,c);s(d)}catch{Q.toast.error("Failed to load emails")}finally{x(!1)}},[a,k]);(0,c.useEffect)(()=>{(0,g.listEmailAccounts)(a,k).then(at).catch(()=>{})},[a,k]),(0,c.useEffect)(()=>{aF(p,aC)},[p,aC,aF]),(0,c.useEffect)(()=>m(b=>{"email.received"===b.type&&b.agentId===a?((0,ai.trackEmailReceived)({agent_id:a,mailbox_type:aB?.type==="custom"?"imap":"alook"}),aF(p,aC)):"email.sent"===b.type&&b.agentId===a&&aF(p,aC)}),[m,a,p,aC,aF,aB?.type]);let aG=async a=>{F(!1),z(a),B(null),D(!0),J([]),L(null),N({});try{let[b,c]=await Promise.all([(0,g.getEmailBody)(a,k),(0,g.getEmailThread)(a,k).catch(()=>[])]);B(b),J(c);let d=r.find(b=>b.id===a);d&&"unread"===d.status&&(0,g.updateEmailStatus)(a,k,"read").then(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"read"}:b))}).catch(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"unread"}:b))})}catch{B({content:"(body not available)",isHtml:!1})}finally{D(!1)}},aH=async a=>{if(K===a)return void L(null);if(L(a),!M[a])try{let b=await (0,g.getEmailBody)(a,k);N(c=>({...c,[a]:b}))}catch{N(b=>({...b,[a]:{content:"(body not available)",isHtml:!1}}))}},aI=async()=>{if(S){ap(!0);try{await (0,g.deleteEmail)(S,k),s(a=>a.filter(a=>a.id!==S)),y===S&&(z(null),B(null)),Q.toast.success("Email deleted")}catch{Q.toast.error("Failed to delete email")}finally{ap(!1),P(!1),an(null)}}},aJ=async(b,c,d,e,f)=>{try{return await (0,g.sendEmail)(a,b,c,d,k,e.length>0?e:void 0,f,aD),(0,ai.trackEmailComposed)({agent_id:a,has_attachments:e.length>0}),Q.toast.success("Email sent"),F(!1),aw("sent"),!0}catch{return Q.toast.error("Failed to send email"),!1}},aK=a=>`<br/><br/><div style="border-left: 2px solid #ccc; padding-left: 12px; margin-left: 0; color: #666;"><p><strong>From:</strong> ${a.from_email}<br/><strong>To:</strong> ${a.to_email}<br/><strong>Date:</strong> ${new Date(a.created_at).toLocaleString()}<br/><strong>Subject:</strong> ${a.subject}</p>`+(a.html_body?a.html_body:A?.isHtml?A.content:`<pre>${A?.content??""}</pre>`)+"</div>",aL=a=>({inReplyTo:a.message_id||void 0,references:[a.references,a.message_id].filter(Boolean).join(" ").trim()||void 0}),aM=async a=>{ar(!0);try{await (0,g.trustEmail)(a.id,k),Q.toast.success("Email trusted and sent to agent"),s(b=>b.filter(b=>b.id!==a.id)),z(null)}catch{Q.toast.error("Failed to trust email")}finally{ar(!1)}},[aN,aO]=(0,c.useState)(!1),aP=async()=>{if(aC)try{await navigator.clipboard.writeText(aC),aO(!0),setTimeout(()=>aO(!1),1500)}catch{Q.toast.error("Failed to copy")}},aQ=(0,b.jsxs)("div",{className:"flex h-full flex-col",children:[ay.length>0?(0,b.jsx)("div",{className:"px-3 pt-3 pb-1 relative",children:1===ay.length?(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"group flex items-center gap-1.5 text-left cursor-pointer w-full"}),children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500 shrink-0"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/0 group-hover:text-muted-foreground/60 shrink-0 transition-colors"})]}),(0,b.jsx)(u.TooltipContent,{children:"Click to copy"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 w-full",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>av(!au),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),(0,b.jsx)(ah.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"shrink-0 p-0.5"}),children:aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),au&&(0,b.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:ay.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{aA(c),av(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===az?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]})}):(0,b.jsx)("div",{className:"px-3 pt-3 pb-1",children:(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:"No email configured"})}),(0,b.jsx)("div",{className:"p-2",children:(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{size:"sm",className:"w-full justify-start text-xs h-8 gap-1.5",onClick:()=>{H({}),F(!0),z(null)},disabled:0===ay.length}),children:[(0,b.jsx)(_.Plus,{className:"size-3.5"}),"New Email"]}),(0,b.jsx)(u.TooltipContent,{children:0===ay.length?"Configure an email in agent settings to send emails":"Compose new email"})]})}),(0,b.jsxs)("nav",{className:"flex flex-col gap-0.5 px-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>aw("inbox"),className:(0,t.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,b.jsx)($.Inbox,{className:"size-4 shrink-0"}),"Inbox","inbox"===p&&v>0&&(0,b.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,b.jsxs)("button",{type:"button",onClick:()=>aw("sent"),className:(0,t.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,b.jsx)(R.Send,{className:"size-4 shrink-0"}),"Sent"]}),(0,b.jsxs)("button",{type:"button",onClick:()=>aw("untrust"),className:(0,t.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,b.jsx)(af,{className:"size-4 shrink-0"}),"Untrust"]})]})]}),aR=(0,b.jsx)("div",{className:(0,t.cn)("h-full thin-scrollbar",r.length>0&&!w?"overflow-y-auto":"overflow-hidden"),children:w?(0,b.jsx)(b.Fragment,{children:Array.from({length:3}).map((a,c)=>(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-32"}),(0,b.jsx)(X.Skeleton,{className:"h-2.5 w-10"})]}),(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-48 mb-1.5"}),(0,b.jsx)(X.Skeleton,{className:"h-4 w-16 rounded-full"})]},c))}):0===r.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(Z.Mail,{className:"size-8 text-muted-foreground mb-3"}),(0,b.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"})]}):r.map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>aG(a.id),className:(0,t.cn)("w-full text-left px-4 py-3 border-b border-border/30 transition-colors duration-150 cursor-pointer",y===a.id?"bg-accent/60":"hover:bg-accent/30"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[(0,b.jsx)("p",{className:(0,t.cn)("text-sm truncate","unread"===a.status?"font-semibold":"font-medium text-muted-foreground"),children:"sent"===p?a.to_email:a.from_email}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:["sent"!==p&&(0,b.jsx)("span",{className:(0,t.cn)("text-[10px] rounded-full px-1.5 py-0.5 leading-none font-medium","unread"===a.status?"bg-blue-500/15 text-blue-600 dark:text-blue-400":"bg-muted text-muted-foreground"),children:"unread"===a.status?"unread":"read"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:am(a.created_at)})]})]}),(0,b.jsx)("p",{className:(0,t.cn)("text-[13px] truncate","unread"===a.status?"text-foreground":"text-muted-foreground"),children:a.subject||"(no subject)"})]},a.id))}),aS=(0,b.jsx)("div",{className:"h-full overflow-auto flex flex-col min-w-0 thin-scrollbar",children:E?(0,b.jsx)(W,{fromAddress:aC,onSend:aJ,onDiscard:()=>{F(!1),H({})},initialTo:G.to,initialSubject:G.subject,initialBody:G.body,initialAttachments:G.attachments,inReplyTo:G.inReplyTo,references:G.references},JSON.stringify(G)):aE?(0,b.jsxs)("div",{className:"flex flex-col h-full md:min-w-100 max-w-3xl mx-auto w-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-0.5 border-b border-border/40 px-4 py-1.5",children:["untrust"===p&&(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",disabled:aq,onClick:()=>aM(aE)}),children:aq?(0,b.jsx)(T.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(ag.ShieldCheck,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Trust this email"})]}),"sent"!==p&&(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aE.subject.startsWith("Re:")?aE.subject:`Re: ${aE.subject}`,void(z(null),H({to:aE.from_email,subject:a,body:aK(aE),...aL(aE)}),F(!0))}}),children:(0,b.jsx)(ac,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Reply"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aE.subject.startsWith("Fwd:")?aE.subject:`Fwd: ${aE.subject}`,void(z(null),H({subject:a,body:aK(aE),attachments:aE.attachments??[],...aL(aE)}),F(!0))}}),children:(0,b.jsx)(ab,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Forward"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-destructive",onClick:()=>{an(aE.id),P(!0)}}),children:(0,b.jsx)(aa.Trash2,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Delete"})]})]}),I.length>0&&(0,b.jsx)("div",{className:"border-b border-border/30",children:I.map(a=>(0,b.jsxs)("div",{className:"border-b border-border/20 last:border-b-0",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>aH(a.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,b.jsx)("span",{className:"text-xs text-muted-foreground",children:K===a.id?"▾":"▸"}),(0,b.jsx)("span",{className:"text-sm font-medium truncate flex-1",children:a.from_email}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:am(a.created_at)})]}),K===a.id&&(0,b.jsxs)("div",{className:"px-5 pb-3",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:a.subject}),M[a.id]?M[a.id].isHtml?(0,b.jsx)(al.EmailBodyFrame,{html:M[a.id].content,className:"max-w-full text-sm"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:M[a.id].content}):(0,b.jsx)(T.Loader2,{className:"size-3 animate-spin text-muted-foreground"})]})]},a.id))}),(0,b.jsxs)("div",{className:"p-5",children:[(0,b.jsx)("h2",{className:"text-lg font-heading font-semibold tracking-tight mb-1",children:aE.subject||"(no subject)"}),(0,b.jsxs)("div",{className:"text-sm space-y-1 mb-5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{children:aE.from_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("span",{children:aE.to_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"sent"===p?"Sent":"Received"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:new Date(aE.created_at).toLocaleString()})]})]}),C?(0,b.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,b.jsx)(T.Loader2,{className:"size-4 animate-spin text-muted-foreground"})}):aE.html_body?(0,b.jsx)(al.EmailBodyFrame,{html:aE.html_body,className:"max-w-full"}):A?.isHtml?(0,b.jsx)(al.EmailBodyFrame,{html:A.content,className:"max-w-full"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:A?.content}),aE.attachments&&aE.attachments.length>0&&(0,b.jsxs)("div",{className:"mt-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mb-2 text-xs text-muted-foreground",children:[(0,b.jsx)(U.Paperclip,{className:"size-3"}),aE.attachments.length," attachment",aE.attachments.length>1?"s":""]}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:aE.attachments.map((a,c)=>(0,b.jsxs)("a",{href:`/api/email/${aE.id}/attachment/${c}?workspace_id=${k}`,target:"_blank",rel:"noopener noreferrer",download:a.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,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-45",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:a.size<1024?`${a.size} B`:a.size<1048576?`${(a.size/1024).toFixed(1)} KB`:`${(a.size/1048576).toFixed(1)} MB`})]},a.key))})]})]})]}):(0,b.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select an email to view"})}),aT=E?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{F(!1),H({})},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"New Email"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aS})]}):y&&aE?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{z(null),B(null)},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium truncate",children:aE.subject||"(no subject)"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aS})]}):(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[ay.length>1&&(0,b.jsxs)("div",{className:"relative px-3 pt-2 pb-1 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>av(!au),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),(0,b.jsx)(ah.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"shrink-0 p-0.5"}),children:aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),au&&(0,b.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:ay.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{aA(c),av(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===az?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 border-b border-border/50 px-3 py-2",children:[(0,b.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(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>aw(a.id),className:(0,t.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors",p===a.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.label,"inbox"===a.id&&"inbox"===p&&v>0&&(0,b.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})]},a.id))}),(0,b.jsx)(i.Button,{size:"icon-sm",variant:"ghost",onClick:()=>{H({}),F(!0),z(null)},disabled:0===ay.length,children:(0,b.jsx)(_.Plus,{className:"size-4"})})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aR})]});return(0,b.jsxs)(b.Fragment,{children:[o?aT:(0,b.jsxs)(ak.ResizablePanelGroup,{orientation:"horizontal",children:[(0,b.jsx)(ak.ResizablePanel,{defaultSize:"15%",minSize:"10%",maxSize:"20%",children:aQ}),(0,b.jsx)(ak.ResizableHandle,{withHandle:!0}),(0,b.jsx)(ak.ResizablePanel,{defaultSize:"30%",minSize:"15%",maxSize:"40%",children:aR}),(0,b.jsx)(ak.ResizableHandle,{withHandle:!0}),(0,b.jsx)(ak.ResizablePanel,{defaultSize:"55%",minSize:"25%",children:aS})]}),(0,b.jsx)(j.ConfirmDialog,{open:O,onOpenChange:P,title:"Delete email",description:"This will permanently delete this email.",loading:ao,onConfirm:aI})]})}],221781)}];
2
2
 
3
3
  //# sourceMappingURL=src_web_src_app_%28app%29_w_%5Bslug%5D_agents_%5Bid%5D_email_page_tsx_0gv3qni._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[588339,446827,a=>{"use strict";class b extends Error{status;details;constructor(a,b,c){super(a),this.name="ApiError",this.status=b,this.details=c}get isNetworkError(){return 0===this.status}get isRateLimit(){return 429===this.status}get isUnauthorized(){return 401===this.status}}function c(a,b){return"validation error"===a&&b?.length?function(a){let[b,...c]=a.split(":"),d=c.join(":").trim();if(!d)return a;let e=b.trim(),f=e.trim().replace(/[_-]+/g," ").replace(/\b\w/g,a=>a.toUpperCase()),g=d.replace(/^required$/i,"is required"),h=g.toLowerCase().replace(/[_-]+/g," "),i=e.toLowerCase().replace(/[_-]+/g," ");return i&&h.startsWith(`${i} `)&&(g=g.slice(e.length).trimStart()),f?`${f} ${g}`:g}(b[0]):a}async function d(a,d){let e;try{e=await fetch(""+a,{...d,credentials:"include",headers:{"Content-Type":"application/json",...d?.headers}})}catch(a){if(a instanceof TypeError)throw new b("Unable to connect — check your network",0);throw a}if(401===e.status)throw new b("Unauthorized",401);if(!e.ok){let a,d;try{let b=await e.json();a=b.error,d=b.details}catch{}if(429===e.status)throw new b("Please wait a moment before trying again",429);if(e.status>=500)throw new b(c(a,d)||"Something went wrong — please try again",e.status,d);throw new b(c(a,d)||"Something went wrong",e.status,d)}if(204!==e.status)return e.json()}function e(a,b){let c=new URLSearchParams({workspace_id:a,...b});return`?${c.toString()}`}a.s(["ApiError",0,b],446827),parseInt(process.env.NEXT_PUBLIC_MOCK_NETWORK_DELAY_MS||"300",10);let f=async(a,c,f,g,h)=>{let i;if(!g||0===g.length)return d(`/api/conversations/${a}/messages${e(f)}`,{method:"POST",body:JSON.stringify({content:c,...h?{metadata:h}:{}})});let j=new FormData;for(let a of(j.append("content",c),h&&j.append("metadata",JSON.stringify(h)),g))j.append("file",a);try{i=await fetch(`/api/conversations/${a}/messages${e(f)}`,{method:"POST",credentials:"include",body:j})}catch(a){if(a instanceof TypeError)throw new b("Unable to connect — check your network",0);throw a}if(401===i.status)throw new b("Unauthorized",401);if(!i.ok){let a,c;try{let b=await i.json();a=b.error,c=b.details}catch{}if(429===i.status)throw new b("Please wait a moment before trying again",429);if(i.status>=500)throw new b(a||"Something went wrong — please try again",i.status,c);throw new b(a||"Something went wrong",i.status,c)}return i.json()},g=async(a,b)=>{let c=new URLSearchParams({workspace_id:b}),d=await fetch(`/api/email/${a}/body?${c}`,{credentials:"include"});if(!d.ok)return{content:"(body not available)",isHtml:!1};let e=d.headers.get("Content-Type")??"";return{content:await d.text(),isHtml:e.includes("text/html")}},h=async(a,c)=>{let d=new FormData;d.append("file",a);let f=await fetch(`/api/email/upload${e(c)}`,{method:"POST",credentials:"include",body:d});if(!f.ok)throw new b(await f.text().catch(()=>"Upload failed"),f.status);return f.json()},i=async(a,c)=>{let f;if(!c.files||0===c.files.length)return d(`/api/issues${e(a)}`,{method:"POST",body:JSON.stringify({agent_id:c.agent_id,title:c.title,description:c.description})});let g=new FormData;for(let a of(c.agent_id&&g.append("agent_id",c.agent_id),g.append("title",c.title),g.append("description",c.description??""),c.files))g.append("file",a);try{f=await fetch(`/api/issues${e(a)}`,{method:"POST",credentials:"include",body:g})}catch(a){if(a instanceof TypeError)throw new b("Unable to connect — check your network",0);throw a}if(401===f.status)throw new b("Unauthorized",401);if(!f.ok){let a,c;try{let b=await f.json();a=b.error,c=b.details}catch{}if(429===f.status)throw new b("Please wait a moment before trying again",429);if(f.status>=500)throw new b(a||"Something went wrong — please try again",f.status,c);throw new b(a||"Something went wrong",f.status,c)}return f.json()},j=async(a,b)=>{let c=new URLSearchParams({workspace_id:b}),d=await fetch(`/api/artifacts/${a}/content?${c}`,{credentials:"include"});return d.ok?d.text():"(content not available)"};a.s(["acceptInvite",0,a=>d(`/api/invite/${a}`,{method:"POST"}),"addWhitelistEmail",0,(a,b,c)=>d(`/api/agents/${a}/whitelist${e(c)}`,{method:"POST",body:JSON.stringify({email:b})}),"approveMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings/${b}/approve${e(c)}`,{method:"POST"}),"cancelActiveTask",0,(a,b)=>d(`/api/conversations/${a}/active-task${e(b)}`,{method:"DELETE"}),"chatInit",0,(a,b,c)=>d(`/api/agents/${a}/chat-init${e(b)}`,{method:"POST",body:JSON.stringify({...c?{channel:c}:{}})}),"checkFreshness",0,(a,b)=>{let c={};return a.conversationId&&(c.conversation_id=a.conversationId),a.agentId&&(c.agent_id=a.agentId),a.channel&&(c.channel=a.channel),d(`/api/conversations/check-fresh${e(b,c)}`)},"conversationInit",0,(a,b,c)=>{let f={};return c?.newestMessageId&&(f.newest_message_id=c.newestMessageId),c?.messageCount&&(f.message_count=String(c.messageCount)),d(`/api/conversations/${a}/init${e(b,f)}`)},"createAgent",0,(a,b)=>d(`/api/agents${e(b)}`,{method:"POST",body:JSON.stringify(a)}),"createAgentLink",0,(a,b)=>d(`/api/agent-links${e(b)}`,{method:"POST",body:JSON.stringify(a)}),"createCalendarEvent",0,(a,b)=>d(`/api/calendar${e(b)}`,{method:"POST",body:JSON.stringify(a)}),"createChannelApi",0,(a,b)=>d(`/api/channels${e(a)}`,{method:"POST",body:JSON.stringify({name:b})}),"createConversation",0,(a,b,c)=>d(`/api/conversations${e(b)}`,{method:"POST",body:JSON.stringify({agent_id:a,...c?{channel:c}:{}})}),"createEmailAccount",0,(a,b,c)=>d(`/api/agents/${a}/email-accounts${e(c)}`,{method:"POST",body:JSON.stringify(b)}),"createInvite",0,a=>d(`/api/workspaces/${a}/invites${e(a)}`,{method:"POST"}),"createIssue",0,i,"createMachineToken",0,(a,b)=>d(`/api/machine-tokens${b?e(b):""}`,{method:"POST",body:JSON.stringify({name:a||"default"})}),"createMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings${e(b)}`,{method:"POST",body:JSON.stringify(c)}),"createThread",0,(a,b,c,f)=>d(`/api/conversations/${a}/threads${e(f)}`,{method:"POST",body:JSON.stringify({parent_message_id:b,content:c})}),"deleteAgent",0,(a,b)=>d(`/api/agents/${a}${e(b)}`,{method:"DELETE"}),"deleteAgentLink",0,(a,b)=>d(`/api/agent-links/${a}${e(b)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(a,b,c)=>d(`/api/calendar/${a}${e(b)}`,{method:"DELETE",...c&&c.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}:{}}),"deleteChannelApi",0,(a,b)=>d(`/api/channels/${a}${e(b)}`,{method:"DELETE"}),"deleteEmail",0,(a,b)=>d(`/api/email/${a}${e(b)}`,{method:"DELETE"}),"deleteEmailAccount",0,(a,b,c)=>d(`/api/agents/${a}/email-accounts/${b}${e(c)}`,{method:"DELETE"}),"deleteIssue",0,(a,b)=>d(`/api/issues/${b}${e(a)}`,{method:"DELETE"}),"deleteMachine",0,(a,b)=>d(`/api/runtimes/machine${e(b,{daemon_id:a})}`,{method:"DELETE"}),"deleteMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings/${b}${e(c)}`,{method:"DELETE"}),"deleteWorkspace",0,(a,b)=>d(`/api/workspaces/${a}${e(a)}`,{method:"DELETE",body:JSON.stringify({confirm_name:b})}),"fetchLatestCliVersion",0,()=>d("/api/cli/latest-version"),"fetchModelOptions",0,()=>d("/api/config/model-options"),"flagMessage",0,(a,b)=>d(`/api/flags${e(a)}`,{method:"POST",body:JSON.stringify({messageId:b})}),"getActiveTask",0,(a,b)=>d(`/api/conversations/${a}/active-task${e(b)}`),"getAgentSkills",0,(a,b)=>d(`/api/agents/${a}/skills${e(b)}`),"getArtifactContent",0,j,"getCalendarEvent",0,(a,b)=>d(`/api/calendar/${a}${e(b)}`),"getEmail",0,(a,b)=>d(`/api/email/${a}${e(b)}`),"getEmailBody",0,g,"getEmailThread",0,(a,b)=>d(`/api/email/${a}/thread${e(b)}`),"getFlaggedCount",0,a=>d(`/api/flags/count${e(a)}`),"getInboxCount",0,(a,b)=>{let c={};return b?.types?.length&&(c.types=b.types.join(",")),d(`/api/inbox/count${e(a,c)}`)},"getInviteInfo",0,a=>d(`/api/invite/${a}`),"getIssue",0,(a,b)=>d(`/api/issues/${b}${e(a)}`),"getMachineTokenStatus",0,()=>d("/api/machine-tokens/status"),"getMemberMe",0,a=>d(`/api/members/me${e(a)}`),"getMinCliVersion",0,()=>d("/api/config/min-version"),"getTask",0,(a,b)=>d(`/api/tasks/${a}${e(b)}`),"getTaskMessages",0,(a,b,c)=>d(`/api/tasks/${a}/messages${e(b,c?{since:String(c)}:void 0)}`),"getThreadSummaries",0,(a,b)=>d(`/api/conversations/${a}/threads${e(b)}`),"getTrace",0,(a,b)=>d(`/api/traces/${a}${e(b)}`),"getWorkspaceOverview",0,a=>d(`/api/workspaces/${a}/overview${e(a)}`),"grantAgentAccess",0,(a,b,c)=>d(`/api/agents/${b}/access${e(a)}`,{method:"POST",body:JSON.stringify({user_id:c})}),"listAgentAccess",0,(a,b)=>d(`/api/agents/${b}/access${e(a)}`),"listAgentActiveTaskCounts",0,a=>d(`/api/agents/active-task-counts${e(a)}`),"listAgentActivity",0,(a,b,c)=>{let f={};return c?.limit&&(f.limit=String(c.limit)),c?.before&&(f.before=c.before),c?.beforeId&&(f.before_id=c.beforeId),c?.status&&(f.status=c.status),c?.type&&(f.type=c.type),d(`/api/agents/${a}/activity${e(b,f)}`)},"listAgentLinks",0,a=>d(`/api/agent-links${e(a)}`),"listAgentPins",0,a=>d(`/api/agents/pins${e(a)}`),"listAgents",0,a=>d(`/api/agents${e(a)}`),"listArtifacts",0,(a,b)=>d(`/api/artifacts${e(b,{conversation_id:a})}`),"listCalendarEvents",0,(a,b)=>{let c={};return b?.agentId&&(c.agentId=b.agentId),b?.from&&(c.from=b.from),b?.to&&(c.to=b.to),d(`/api/calendar${e(a,c)}`)},"listChannels",0,a=>d(`/api/channels${e(a)}`),"listEmailAccounts",0,(a,b)=>d(`/api/agents/${a}/email-accounts${e(b)}`),"listEmails",0,(a,b,c,f)=>d(`/api/email${e(b,{agentId:a,...c?{folder:c}:{},...f?{address:f}:{}})}`),"listFlaggedItems",0,(a,b)=>{let c={};return b?.limit&&(c.limit=String(b.limit)),b?.before&&(c.before=b.before),d(`/api/flags${e(a,c)}`)},"listFlaggedMessageIds",0,(a,b)=>d(`/api/flags${e(a,{conversation_id:b,ids_only:"true"})}`),"listInboxItems",0,(a,b)=>{let c={};return b?.limit&&(c.limit=String(b.limit)),b?.before&&(c.before=b.before),b?.types?.length&&(c.types=b.types.join(",")),d(`/api/inbox${e(a,c)}`)},"listInvites",0,a=>d(`/api/workspaces/${a}/invites${e(a)}`),"listIssues",0,(a,b)=>{let c={};return b?.agentId&&(c.agentId=b.agentId),b?.status&&(c.status=b.status),b?.terminal!==void 0&&(c.terminal=String(b.terminal)),d(`/api/issues${e(a,c)}`)},"listMeetings",0,(a,b)=>d(`/api/agents/${a}/meetings${e(b)}`),"listMembers",0,a=>d(`/api/workspaces/${a}/members${e(a)}`),"listMessages",0,(a,b,c)=>{let f={};return c?.limit&&(f.limit=String(c.limit)),c?.before&&(f.before=c.before),c?.beforeId&&(f.before_id=c.beforeId),d(`/api/conversations/${a}/messages${e(b,f)}`)},"listMessagesAroundTask",0,(a,b,c)=>d(`/api/conversations/${a}/messages${e(b,{around_task:c})}`),"listPreviousConversations",0,(a,b,c)=>{let f={exclude:c.exclude,before:c.before};return c.channel&&(f.channel=c.channel),c.limit&&(f.limit=String(c.limit)),d(`/api/agents/${a}/conversations${e(b,f)}`)},"listRuntimes",0,a=>d(`/api/runtimes${e(a)}`),"listTraces",0,(a,b)=>{let c={};return b?.limit&&(c.limit=String(b.limit)),b?.before&&(c.before=b.before),b?.status&&(c.status=b.status),b?.multiAgent&&(c.multiAgent="true"),b?.agentId&&(c.agentId=b.agentId),b?.channel&&(c.channel=b.channel),d(`/api/traces${e(a,c)}`)},"listWhitelist",0,(a,b)=>d(`/api/agents/${a}/whitelist${e(b)}`),"listWorkspaceActiveTasks",0,a=>d(`/api/agents/active-tasks${e(a)}`),"listWorkspaces",0,()=>d("/api/workspaces"),"markAllInboxRead",0,a=>d(`/api/inbox/read-all${e(a)}`,{method:"POST"}),"markInboxRead",0,(a,b)=>d(`/api/inbox/read${e(b)}`,{method:"POST",body:JSON.stringify({conversationId:a})}),"pinAgent",0,(a,b)=>d(`/api/agents/${b}/pin${e(a)}`,{method:"POST"}),"removeMember",0,(a,b)=>d(`/api/workspaces/${a}/members/${b}${e(a)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(a,b,c)=>d(`/api/agents/${a}/whitelist/${b}${e(c)}`,{method:"DELETE"}),"renameChannelApi",0,(a,b,c)=>d(`/api/channels/${a}${e(b)}`,{method:"PATCH",body:JSON.stringify({name:c})}),"reorderAgentPins",0,(a,b)=>d(`/api/agents/pins/reorder${e(a)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:b})}),"reorderChannelsApi",0,(a,b)=>d(`/api/channels/reorder${e(a)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:b})}),"reorderUnpinnedAgents",0,(a,b)=>d(`/api/agents/sidebar/reorder${e(a)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:b})}),"requestWorkspaceBrowse",0,(a,b,c,f)=>d(`/api/agents/${a}/workspace/browse${e(b)}`,{method:"POST",body:JSON.stringify({request_type:c,path:f})}),"retryTask",0,(a,b)=>d(`/api/tasks/${a}/retry${e(b)}`,{method:"POST"}),"revokeAgentAccess",0,(a,b,c,f=!1)=>d(`/api/agents/${b}/access/${c}${e(a)}${f?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(a,b)=>d(`/api/workspaces/${a}/invites/${b}${e(a)}`,{method:"DELETE"}),"sendEmail",0,(a,b,c,f,g,h,i,j)=>d(`/api/email/send${e(g)}`,{method:"POST",body:JSON.stringify({agentId:a,to:b,subject:c,htmlBody:f,attachments:h,...i,customAccountId:j})}),"sendMessage",0,f,"stopMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings/${b}/stop${e(c)}`,{method:"POST"}),"syncEmailAccount",0,(a,b,c)=>d(`/api/agents/${a}/email-accounts/${b}/sync${e(c)}`,{method:"POST"}),"triggerRuntimeRescan",0,(a,b)=>d(`/api/runtimes/${a}/rescan${e(b)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(a,b)=>d(`/api/runtimes/${a}/update${e(b)}`,{method:"POST"}),"unflagMessage",0,(a,b)=>d(`/api/flags/${b}${e(a)}`,{method:"DELETE"}),"unpinAgent",0,(a,b)=>d(`/api/agents/${b}/pin${e(a)}`,{method:"DELETE"}),"updateAgent",0,(a,b,c)=>d(`/api/agents/${a}${e(c)}`,{method:"PATCH",body:JSON.stringify(b)}),"updateAgentLink",0,(a,b,c)=>d(`/api/agent-links/${a}${e(c)}`,{method:"PATCH",body:JSON.stringify(b)}),"updateCalendarEvent",0,(a,b,c)=>d(`/api/calendar/${a}${e(c)}`,{method:"PATCH",body:JSON.stringify(b)}),"updateEmailStatus",0,(a,b,c)=>d(`/api/email/${a}${e(b)}`,{method:"PATCH",body:JSON.stringify({status:c})}),"updateIssue",0,(a,b,c)=>d(`/api/issues/${b}${e(a)}`,{method:"PATCH",body:JSON.stringify(c)}),"updateMemberMe",0,(a,b)=>d(`/api/members/me${e(a)}`,{method:"PATCH",body:JSON.stringify({global_instruction:b})}),"updateWorkspace",0,(a,b)=>d(`/api/workspaces/${a}${e(a)}`,{method:"PATCH",body:JSON.stringify(b)}),"uploadEmailAttachment",0,h],588339)}];
1
+ module.exports=[588339,446827,a=>{"use strict";class b extends Error{status;details;constructor(a,b,c){super(a),this.name="ApiError",this.status=b,this.details=c}get isNetworkError(){return 0===this.status}get isRateLimit(){return 429===this.status}get isUnauthorized(){return 401===this.status}}function c(a,b){return"validation error"===a&&b?.length?function(a){let[b,...c]=a.split(":"),d=c.join(":").trim();if(!d)return a;let e=b.trim(),f=e.trim().replace(/[_-]+/g," ").replace(/\b\w/g,a=>a.toUpperCase()),g=d.replace(/^required$/i,"is required"),h=g.toLowerCase().replace(/[_-]+/g," "),i=e.toLowerCase().replace(/[_-]+/g," ");return i&&h.startsWith(`${i} `)&&(g=g.slice(e.length).trimStart()),f?`${f} ${g}`:g}(b[0]):a}async function d(a,d){let e;try{e=await fetch(""+a,{...d,credentials:"include",headers:{"Content-Type":"application/json",...d?.headers}})}catch(a){if(a instanceof TypeError)throw new b("Unable to connect — check your network",0);throw a}if(401===e.status)throw new b("Unauthorized",401);if(!e.ok){let a,d;try{let b=await e.json();a=b.error,d=b.details}catch{}if(429===e.status)throw new b("Please wait a moment before trying again",429);if(e.status>=500)throw new b(c(a,d)||"Something went wrong — please try again",e.status,d);throw new b(c(a,d)||"Something went wrong",e.status,d)}if(204!==e.status)return e.json()}function e(a,b){let c=new URLSearchParams({workspace_id:a,...b});return`?${c.toString()}`}a.s(["ApiError",0,b],446827),parseInt(process.env.NEXT_PUBLIC_MOCK_NETWORK_DELAY_MS||"300",10);let f=async(a,c,f,g,h)=>{let i;if(!g||0===g.length)return d(`/api/conversations/${a}/messages${e(f)}`,{method:"POST",body:JSON.stringify({content:c,...h?{metadata:h}:{}})});let j=new FormData;for(let a of(j.append("content",c),h&&j.append("metadata",JSON.stringify(h)),g))j.append("file",a);try{i=await fetch(`/api/conversations/${a}/messages${e(f)}`,{method:"POST",credentials:"include",body:j})}catch(a){if(a instanceof TypeError)throw new b("Unable to connect — check your network",0);throw a}if(401===i.status)throw new b("Unauthorized",401);if(!i.ok){let a,c;try{let b=await i.json();a=b.error,c=b.details}catch{}if(429===i.status)throw new b("Please wait a moment before trying again",429);if(i.status>=500)throw new b(a||"Something went wrong — please try again",i.status,c);throw new b(a||"Something went wrong",i.status,c)}return i.json()},g=async(a,b)=>{let c=new URLSearchParams({workspace_id:b}),d=await fetch(`/api/email/${a}/body?${c}`,{credentials:"include"});if(!d.ok)return{content:"(body not available)",isHtml:!1};let e=d.headers.get("Content-Type")??"";return{content:await d.text(),isHtml:e.includes("text/html")}},h=async(a,c)=>{let d=new FormData;d.append("file",a);let f=await fetch(`/api/email/upload${e(c)}`,{method:"POST",credentials:"include",body:d});if(!f.ok)throw new b(await f.text().catch(()=>"Upload failed"),f.status);return f.json()},i=async(a,c)=>{let f;if(!c.files||0===c.files.length)return d(`/api/issues${e(a)}`,{method:"POST",body:JSON.stringify({agent_id:c.agent_id,title:c.title,description:c.description})});let g=new FormData;for(let a of(c.agent_id&&g.append("agent_id",c.agent_id),g.append("title",c.title),g.append("description",c.description??""),c.files))g.append("file",a);try{f=await fetch(`/api/issues${e(a)}`,{method:"POST",credentials:"include",body:g})}catch(a){if(a instanceof TypeError)throw new b("Unable to connect — check your network",0);throw a}if(401===f.status)throw new b("Unauthorized",401);if(!f.ok){let a,c;try{let b=await f.json();a=b.error,c=b.details}catch{}if(429===f.status)throw new b("Please wait a moment before trying again",429);if(f.status>=500)throw new b(a||"Something went wrong — please try again",f.status,c);throw new b(a||"Something went wrong",f.status,c)}return f.json()},j=async(a,b)=>{let c=new URLSearchParams({workspace_id:b}),d=await fetch(`/api/artifacts/${a}/content?${c}`,{credentials:"include"});return d.ok?d.text():"(content not available)"};a.s(["acceptInvite",0,a=>d(`/api/invite/${a}`,{method:"POST"}),"addWhitelistEmail",0,(a,b,c)=>d(`/api/agents/${a}/whitelist${e(c)}`,{method:"POST",body:JSON.stringify({email:b})}),"approveMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings/${b}/approve${e(c)}`,{method:"POST"}),"cancelActiveTask",0,(a,b)=>d(`/api/conversations/${a}/active-task${e(b)}`,{method:"DELETE"}),"chatInit",0,(a,b,c)=>d(`/api/agents/${a}/chat-init${e(b)}`,{method:"POST",body:JSON.stringify({...c?{channel:c}:{}})}),"checkFreshness",0,(a,b)=>{let c={};return a.conversationId&&(c.conversation_id=a.conversationId),a.agentId&&(c.agent_id=a.agentId),a.channel&&(c.channel=a.channel),d(`/api/conversations/check-fresh${e(b,c)}`)},"conversationInit",0,(a,b,c)=>{let f={};return c?.newestMessageId&&(f.newest_message_id=c.newestMessageId),c?.messageCount&&(f.message_count=String(c.messageCount)),d(`/api/conversations/${a}/init${e(b,f)}`)},"createAgent",0,(a,b)=>d(`/api/agents${e(b)}`,{method:"POST",body:JSON.stringify(a)}),"createAgentLink",0,(a,b)=>d(`/api/agent-links${e(b)}`,{method:"POST",body:JSON.stringify(a)}),"createCalendarEvent",0,(a,b)=>d(`/api/calendar${e(b)}`,{method:"POST",body:JSON.stringify(a)}),"createChannelApi",0,(a,b)=>d(`/api/channels${e(a)}`,{method:"POST",body:JSON.stringify({name:b})}),"createConversation",0,(a,b,c)=>d(`/api/conversations${e(b)}`,{method:"POST",body:JSON.stringify({agent_id:a,...c?{channel:c}:{}})}),"createEmailAccount",0,(a,b,c)=>d(`/api/agents/${a}/email-accounts${e(c)}`,{method:"POST",body:JSON.stringify(b)}),"createInvite",0,a=>d(`/api/workspaces/${a}/invites${e(a)}`,{method:"POST"}),"createIssue",0,i,"createMachineToken",0,(a,b)=>d(`/api/machine-tokens${b?e(b):""}`,{method:"POST",body:JSON.stringify({name:a||"default"})}),"createMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings${e(b)}`,{method:"POST",body:JSON.stringify(c)}),"createThread",0,(a,b,c,f)=>d(`/api/conversations/${a}/threads${e(f)}`,{method:"POST",body:JSON.stringify({parent_message_id:b,content:c})}),"deleteAgent",0,(a,b)=>d(`/api/agents/${a}${e(b)}`,{method:"DELETE"}),"deleteAgentLink",0,(a,b)=>d(`/api/agent-links/${a}${e(b)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(a,b,c)=>d(`/api/calendar/${a}${e(b)}`,{method:"DELETE",...c&&c.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}:{}}),"deleteChannelApi",0,(a,b)=>d(`/api/channels/${a}${e(b)}`,{method:"DELETE"}),"deleteEmail",0,(a,b)=>d(`/api/email/${a}${e(b)}`,{method:"DELETE"}),"deleteEmailAccount",0,(a,b,c)=>d(`/api/agents/${a}/email-accounts/${b}${e(c)}`,{method:"DELETE"}),"deleteIssue",0,(a,b)=>d(`/api/issues/${b}${e(a)}`,{method:"DELETE"}),"deleteMachine",0,(a,b)=>d(`/api/runtimes/machine${e(b,{daemon_id:a})}`,{method:"DELETE"}),"deleteMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings/${b}${e(c)}`,{method:"DELETE"}),"deleteWorkspace",0,(a,b)=>d(`/api/workspaces/${a}${e(a)}`,{method:"DELETE",body:JSON.stringify({confirm_name:b})}),"fetchLatestCliVersion",0,()=>d("/api/cli/latest-version"),"fetchModelOptions",0,()=>d("/api/config/model-options"),"flagMessage",0,(a,b)=>d(`/api/flags${e(a)}`,{method:"POST",body:JSON.stringify({messageId:b})}),"getActiveTask",0,(a,b)=>d(`/api/conversations/${a}/active-task${e(b)}`),"getAgentSkills",0,(a,b)=>d(`/api/agents/${a}/skills${e(b)}`),"getArtifactContent",0,j,"getCalendarEvent",0,(a,b)=>d(`/api/calendar/${a}${e(b)}`),"getEmail",0,(a,b)=>d(`/api/email/${a}${e(b)}`),"getEmailBody",0,g,"getEmailThread",0,(a,b)=>d(`/api/email/${a}/thread${e(b)}`),"getFlaggedCount",0,a=>d(`/api/flags/count${e(a)}`),"getInboxCount",0,(a,b)=>{let c={};return b?.types?.length&&(c.types=b.types.join(",")),d(`/api/inbox/count${e(a,c)}`)},"getInviteInfo",0,a=>d(`/api/invite/${a}`),"getIssue",0,(a,b)=>d(`/api/issues/${b}${e(a)}`),"getMachineTokenStatus",0,()=>d("/api/machine-tokens/status"),"getMemberMe",0,a=>d(`/api/members/me${e(a)}`),"getMinCliVersion",0,()=>d("/api/config/min-version"),"getTask",0,(a,b)=>d(`/api/tasks/${a}${e(b)}`),"getTaskMessages",0,(a,b,c)=>d(`/api/tasks/${a}/messages${e(b,c?{since:String(c)}:void 0)}`),"getThreadSummaries",0,(a,b)=>d(`/api/conversations/${a}/threads${e(b)}`),"getTrace",0,(a,b)=>d(`/api/traces/${a}${e(b)}`),"getWorkspaceOverview",0,a=>d(`/api/workspaces/${a}/overview${e(a)}`),"grantAgentAccess",0,(a,b,c)=>d(`/api/agents/${b}/access${e(a)}`,{method:"POST",body:JSON.stringify({user_id:c})}),"listAgentAccess",0,(a,b)=>d(`/api/agents/${b}/access${e(a)}`),"listAgentActiveTaskCounts",0,a=>d(`/api/agents/active-task-counts${e(a)}`),"listAgentActivity",0,(a,b,c)=>{let f={};return c?.limit&&(f.limit=String(c.limit)),c?.before&&(f.before=c.before),c?.beforeId&&(f.before_id=c.beforeId),c?.status&&(f.status=c.status),c?.type&&(f.type=c.type),d(`/api/agents/${a}/activity${e(b,f)}`)},"listAgentLinks",0,a=>d(`/api/agent-links${e(a)}`),"listAgentPins",0,a=>d(`/api/agents/pins${e(a)}`),"listAgents",0,a=>d(`/api/agents${e(a)}`),"listArtifacts",0,(a,b)=>d(`/api/artifacts${e(b,{conversation_id:a})}`),"listCalendarEvents",0,(a,b)=>{let c={};return b?.agentId&&(c.agentId=b.agentId),b?.from&&(c.from=b.from),b?.to&&(c.to=b.to),d(`/api/calendar${e(a,c)}`)},"listChannels",0,a=>d(`/api/channels${e(a)}`),"listEmailAccounts",0,(a,b)=>d(`/api/agents/${a}/email-accounts${e(b)}`),"listEmails",0,(a,b,c,f)=>d(`/api/email${e(b,{agentId:a,...c?{folder:c}:{},...f?{address:f}:{}})}`),"listFlaggedItems",0,(a,b)=>{let c={};return b?.limit&&(c.limit=String(b.limit)),b?.before&&(c.before=b.before),d(`/api/flags${e(a,c)}`)},"listFlaggedMessageIds",0,(a,b)=>d(`/api/flags${e(a,{conversation_id:b,ids_only:"true"})}`),"listInboxItems",0,(a,b)=>{let c={};return b?.limit&&(c.limit=String(b.limit)),b?.before&&(c.before=b.before),b?.types?.length&&(c.types=b.types.join(",")),d(`/api/inbox${e(a,c)}`)},"listInvites",0,a=>d(`/api/workspaces/${a}/invites${e(a)}`),"listIssues",0,(a,b)=>{let c={};return b?.agentId&&(c.agentId=b.agentId),b?.status&&(c.status=b.status),b?.terminal!==void 0&&(c.terminal=String(b.terminal)),d(`/api/issues${e(a,c)}`)},"listMeetings",0,(a,b)=>d(`/api/agents/${a}/meetings${e(b)}`),"listMembers",0,a=>d(`/api/workspaces/${a}/members${e(a)}`),"listMessages",0,(a,b,c)=>{let f={};return c?.limit&&(f.limit=String(c.limit)),c?.before&&(f.before=c.before),c?.beforeId&&(f.before_id=c.beforeId),d(`/api/conversations/${a}/messages${e(b,f)}`)},"listMessagesAroundTask",0,(a,b,c)=>d(`/api/conversations/${a}/messages${e(b,{around_task:c})}`),"listPreviousConversations",0,(a,b,c)=>{let f={exclude:c.exclude,before:c.before};return c.channel&&(f.channel=c.channel),c.limit&&(f.limit=String(c.limit)),d(`/api/agents/${a}/conversations${e(b,f)}`)},"listRuntimes",0,a=>d(`/api/runtimes${e(a)}`),"listTraces",0,(a,b)=>{let c={};return b?.limit&&(c.limit=String(b.limit)),b?.before&&(c.before=b.before),b?.status&&(c.status=b.status),b?.multiAgent&&(c.multiAgent="true"),b?.agentId&&(c.agentId=b.agentId),b?.channel&&(c.channel=b.channel),d(`/api/traces${e(a,c)}`)},"listWhitelist",0,(a,b)=>d(`/api/agents/${a}/whitelist${e(b)}`),"listWorkspaceActiveTasks",0,a=>d(`/api/agents/active-tasks${e(a)}`),"listWorkspaces",0,()=>d("/api/workspaces"),"markAllInboxRead",0,a=>d(`/api/inbox/read-all${e(a)}`,{method:"POST"}),"markInboxRead",0,(a,b)=>d(`/api/inbox/read${e(b)}`,{method:"POST",body:JSON.stringify({conversationId:a})}),"pinAgent",0,(a,b)=>d(`/api/agents/${b}/pin${e(a)}`,{method:"POST"}),"removeMember",0,(a,b)=>d(`/api/workspaces/${a}/members/${b}${e(a)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(a,b,c)=>d(`/api/agents/${a}/whitelist/${b}${e(c)}`,{method:"DELETE"}),"renameChannelApi",0,(a,b,c)=>d(`/api/channels/${a}${e(b)}`,{method:"PATCH",body:JSON.stringify({name:c})}),"reorderAgentPins",0,(a,b)=>d(`/api/agents/pins/reorder${e(a)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:b})}),"reorderChannelsApi",0,(a,b)=>d(`/api/channels/reorder${e(a)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:b})}),"reorderUnpinnedAgents",0,(a,b)=>d(`/api/agents/sidebar/reorder${e(a)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:b})}),"requestWorkspaceBrowse",0,(a,b,c,f)=>d(`/api/agents/${a}/workspace/browse${e(b)}`,{method:"POST",body:JSON.stringify({request_type:c,path:f})}),"retryTask",0,(a,b)=>d(`/api/tasks/${a}/retry${e(b)}`,{method:"POST"}),"revokeAgentAccess",0,(a,b,c,f=!1)=>d(`/api/agents/${b}/access/${c}${e(a)}${f?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(a,b)=>d(`/api/workspaces/${a}/invites/${b}${e(a)}`,{method:"DELETE"}),"sendEmail",0,(a,b,c,f,g,h,i,j)=>d(`/api/email/send${e(g)}`,{method:"POST",body:JSON.stringify({agentId:a,to:b,subject:c,htmlBody:f,attachments:h,...i,customAccountId:j})}),"sendMessage",0,f,"stopMeeting",0,(a,b,c)=>d(`/api/agents/${a}/meetings/${b}/stop${e(c)}`,{method:"POST"}),"syncEmailAccount",0,(a,b,c)=>d(`/api/agents/${a}/email-accounts/${b}/sync${e(c)}`,{method:"POST"}),"triggerRuntimeRescan",0,(a,b)=>d(`/api/runtimes/${a}/rescan${e(b)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(a,b)=>d(`/api/runtimes/${a}/update${e(b)}`,{method:"POST"}),"trustEmail",0,(a,b)=>d(`/api/email/${a}/trust${e(b)}`,{method:"POST"}),"unflagMessage",0,(a,b)=>d(`/api/flags/${b}${e(a)}`,{method:"DELETE"}),"unpinAgent",0,(a,b)=>d(`/api/agents/${b}/pin${e(a)}`,{method:"DELETE"}),"updateAgent",0,(a,b,c)=>d(`/api/agents/${a}${e(c)}`,{method:"PATCH",body:JSON.stringify(b)}),"updateAgentLink",0,(a,b,c)=>d(`/api/agent-links/${a}${e(c)}`,{method:"PATCH",body:JSON.stringify(b)}),"updateCalendarEvent",0,(a,b,c)=>d(`/api/calendar/${a}${e(c)}`,{method:"PATCH",body:JSON.stringify(b)}),"updateEmailStatus",0,(a,b,c)=>d(`/api/email/${a}${e(b)}`,{method:"PATCH",body:JSON.stringify({status:c})}),"updateIssue",0,(a,b,c)=>d(`/api/issues/${b}${e(a)}`,{method:"PATCH",body:JSON.stringify(c)}),"updateMemberMe",0,(a,b)=>d(`/api/members/me${e(a)}`,{method:"PATCH",body:JSON.stringify({global_instruction:b})}),"updateWorkspace",0,(a,b)=>d(`/api/workspaces/${a}${e(a)}`,{method:"PATCH",body:JSON.stringify(b)}),"uploadEmailAttachment",0,h],588339)}];
2
2
 
3
3
  //# sourceMappingURL=src_web_src_lib_api_ts_1ffelwp._.js.map
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
7
7
  "static/chunks/0cz1d0mv5g_q7.js"
8
8
  ],
9
9
  "lowPriorityFiles": [
10
- "static/UUtXyb9u1pubazU2jTktS/_buildManifest.js",
11
- "static/UUtXyb9u1pubazU2jTktS/_ssgManifest.js",
12
- "static/UUtXyb9u1pubazU2jTktS/_clientMiddlewareManifest.js"
10
+ "static/sGrtuJLQm2artu6oSgWPT/_buildManifest.js",
11
+ "static/sGrtuJLQm2artu6oSgWPT/_ssgManifest.js",
12
+ "static/sGrtuJLQm2artu6oSgWPT/_clientMiddlewareManifest.js"
13
13
  ],
14
14
  "rootMainFiles": [
15
15
  "static/chunks/3drpmcjhmx9ln.js",
@@ -25,11 +25,11 @@
25
25
  "wasm": [],
26
26
  "assets": [],
27
27
  "env": {
28
- "__NEXT_BUILD_ID": "UUtXyb9u1pubazU2jTktS",
29
- "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "7BobXaQe9jCNnw3+TBDi7SJX7zqPRF0Hyz1kyATgS8g=",
30
- "__NEXT_PREVIEW_MODE_ID": "7825e0b32f9836c23f00348f89abd9a3",
31
- "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "87110e5ba8125500f6fecac2172f9c846217d3d27953c4eace37f10d36dc3adb",
32
- "__NEXT_PREVIEW_MODE_SIGNING_KEY": "f12fb67b52e238dadbac7eb6a323ce1b6aacc73f58aa74fa462d715609b23da4"
28
+ "__NEXT_BUILD_ID": "sGrtuJLQm2artu6oSgWPT",
29
+ "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "tsV1xV1zvXrOCypBt9CPgRgMZGokIjZGRUyMvhU5+XQ=",
30
+ "__NEXT_PREVIEW_MODE_ID": "a55d665bc9622d0f653d9ada4f50f522",
31
+ "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "05e4074289d8f4722723d7fc296ba515c77b923f2de6530cc3a8f85935b90ca0",
32
+ "__NEXT_PREVIEW_MODE_SIGNING_KEY": "de562fa9c3247b2cc6ea83f1d0d8cccb9aba59096376352bbe23bc4f2db6b519"
33
33
  }
34
34
  }
35
35
  },
@@ -1 +1 @@
1
- self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"7BobXaQe9jCNnw3+TBDi7SJX7zqPRF0Hyz1kyATgS8g=\"\n}"
1
+ self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"tsV1xV1zvXrOCypBt9CPgRgMZGokIjZGRUyMvhU5+XQ=\"\n}"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": {},
3
3
  "edge": {},
4
- "encryptionKey": "7BobXaQe9jCNnw3+TBDi7SJX7zqPRF0Hyz1kyATgS8g="
4
+ "encryptionKey": "tsV1xV1zvXrOCypBt9CPgRgMZGokIjZGRUyMvhU5+XQ="
5
5
  }