@alook/app 0.0.138 → 0.0.139
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.
- package/bundled/email-worker/index.js +2 -0
- package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{2n2-erdcjib3l.js → 0pqa0bk3fnq2q.js} +2 -2
- package/bundled/web/.open-next/assets/_next/static/chunks/0pydx20mmtmb-.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{412d684t3r9n2.js → 0u04xzcqoxacf.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{24uei2njvsgf4.js → 10ey8by6dfgey.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{07ib-ldk87gmo.js → 1c0k_1upngs79.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/1fs7xmjtwdhjj.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{1n2ogp1w_pw5c.js → 1l3nq6kc3fbh-.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{19j0bml2m-9uo.js → 22y46i-vrrny_.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/25z9kj3uj7xzn.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{08owkyc3y3nuc.js → 2h7oy-ljwoem9.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{1uj4q_n378l_e.js → 2qc57pol1-1f3.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/2usqt49xbpqd2.css +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/3rbv_zutwzuxv.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{1ksb3nu_qkssl.js → 41k5317-tm9ix.js} +1 -1
- package/bundled/web/.open-next/cache/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/device.cache +1 -1
- package/bundled/web/.open-next/cache/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/privacy.cache +1 -1
- package/bundled/web/.open-next/cache/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/sitemap.xml.cache +1 -1
- package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
- package/bundled/web/.open-next/cloudflare/init.js +1 -1
- package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
- package/bundled/web/.open-next/middleware/handler.mjs +7 -7
- package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/app-path-routes-manifest.json +1 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/required-server-files.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/routes-manifest.json +8 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/artifacts/[id]/thumbnail/route.js +14 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/artifacts/[id]/thumbnail/route_client-reference-manifest.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/device/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app-paths-manifest.json +1 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/0_kl__next-internal_server_app_api_artifacts_[id]_thumbnail_route_actions_17k4myq.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1_d30qf._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1lpr5ex._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +15 -13
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0v95a0y._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_139j3zh._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1nfaney._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__172hwkq._.js → [root-of-the-server]__1e237f4._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +15 -13
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_04ht2b1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_09v4-yk._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0kozrym._.js → _0g_x3qh._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0lil2o-._.js +65 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0qgcnj5._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_00ft3vz._.js → _10-8eci._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_15s-tjk._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_17z3ujw._.js → _19hsbaa._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1vs9m39._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1xq5127._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0wq6umk._.js → node_modules__pnpm_0-sy0jc._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0fjz-0c._.js → node_modules__pnpm_03t1_eh._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0s5w--e._.js → node_modules__pnpm_0b_f_5l._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_1ve6v4p._.js → node_modules__pnpm_0lmr_qu._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_17siyfl._.js → node_modules__pnpm_0os8mdu._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_1ajm7qp._.js → node_modules__pnpm_0pd1a42._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_1o8q6qh._.js → node_modules__pnpm_0z21f3h._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_198l9yo._.js → node_modules__pnpm_1tajvfi._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0pwl5s4._.js +1 -1
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_home_page_tsx_0-vs82-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_avatar_0hmu31-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_home_home-page_tsx_1e1vr_i._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +160 -160
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +358 -239
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +6 -6
- package/bundled/web/migrations/0042_artifact_thumbnail.sql +1 -0
- package/bundled/web/wrangler.toml +1 -1
- package/bundled/ws-do/index.js +2 -0
- package/dist/cli/index.js +17 -0
- package/dist/cli/session-runner.js +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0b0bf61oxocmd.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/1o14pyvttt8vl.css +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2l42wg35hly5d.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2tyy_fxi6rlas.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/3ad50t_oqhpk_.js +0 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1xvbchf._.js +0 -65
- /package/bundled/web/.open-next/assets/_next/static/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{0jpboe0ecrihrJF2CMdwU → 0z9UpPLBZKa_jgTjfoBR5}/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?``:``},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)}];
|
|
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?``:``},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"}]]);var J=a.i(611606),J=J;let 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.default,{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
|