1import{r as a,j as e}from"./vendor-react-DL1ATZgj.js";import{J as f}from"./vendor-utils-CKG6n7M2.js";import{B as n,s as Y}from"./index-BZi1svY4.js";import{T as Z,a as K,b as U,c as E}from"./tabs-B04Hs90S.js";import{u as ce}from"./vendor-query-C11xQHO0.js";import{C as ee,f as se,h as te,j as ne,L as R,I as L,i as oe,B as de}from"./advisor-Tn_MCrkH.js";import{X as ae,aV as ie,ax as k,F as me,N as xe,an as O,aw as he,$ as _,aW as ue,aT as je,aX as ge,D as re,aR as B,d as pe,aY as fe,S as ve,aB as Ne,aZ as ye}from"./vendor-icons-D3hnpUoP.js";import{D as G,a as V,b as W,c as H,e as q}from"./dialog-DeRVZ2Zh.js";import{S as F,a as I,b as A,c as z,d as m}from"./select-B3FaqEbT.js";import{A as we,a as be}from"./alert-BinKgVrR.js";import{T as Se,a as Ce,b as X,c as P,d as Re,e as T}from"./table-cEBdkd4F.js";import{f as De}from"./vendor-dates-CdwHMIsk.js";import"./vendor-ui-qAC6ZjNC.js";import"./vendor-supabase-CVBsuquN.js";import"./index-BCaLenm-.js";import"./vendor-pdf-DtdnXsY-.js";import"./vendor-sentry-BSoXv3Ge.js";function Me({recording:t,onClose:l}){const[g,i]=a.useState(!1),[w,y]=a.useState(35),[N,v]=a.useState({minutes:15,seconds:45}),p=a.useRef(null),s=a.useRef();a.useEffect(()=>{if(p.current){const c=r(100),o=p.current.getContext("2d");o&&h(o,c)}return()=>{s.current&&window.clearInterval(s.current)}},[]);const x=()=>{g?(s.current&&window.clearInterval(s.current),i(!1)):(i(!0),b())},r=c=>{const o=[];for(let d=0;d<c;d++)o.push(Math.random()*.8+.1);return o},h=(c,o)=>{const{width:d}=c.canvas,{height:S}=c.canvas,j=d/o.length;c.clearRect(0,0,d,S),c.fillStyle="#4a6cf7";for(let u=0;u<o.length;u++){const M=o[u]*S,$=u*j,J=(S-M)/2;c.fillRect($,J,j-1,M)}},b=()=>{s.current=window.setInterval(()=>{if(y(c=>c>=100?(s.current&&window.clearInterval(s.current),i(!1),100):c+.5),v(c=>{let o=c.seconds+1,d=c.minutes;return o>=60&&(o=0,d++),{minutes:d,seconds:o}}),p.current){const c=r(100),o=p.current.getContext("2d");o&&h(o,c)}},1e3)},C=(c,o)=>`${c.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`;return e.jsxs(ee,{className:"mb-6",children:[e.jsx(se,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(te,{children:t.title}),e.jsxs(n,{variant:"ghost",size:"icon",onClick:l,className:"h-8 w-8","aria-label":"Close player",children:[e.jsx(ae,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})}),e.jsx(ne,{children:e.jsxs(Z,{defaultValue:"audio",className:"w-full",children:[e.jsxs(K,{className:"grid w-full grid-cols-2 mb-6",children:[e.jsx(U,{value:"audio",children:"Audio"}),e.jsx(U,{value:"transcript",children:"Transcript"})]}),e.jsx(E,{value:"audio",className:"space-y-4",children:e.jsxs("div",{className:"bg-muted rounded-md p-4",children:[e.jsx("canvas",{ref:p,className:"w-full h-24 rounded-md",width:"800",height:"96"}),e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:C(N.minutes,N.seconds)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.duration})]}),e.jsx("div",{className:"mt-1 w-full bg-muted-foreground/20 h-2 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full rounded-full transition-all duration-300",style:{width:`${w}%`}})})]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(n,{variant:"outline",size:"icon",className:"h-12 w-12 rounded-full",onClick:x,children:g?e.jsx(ie,{className:"h-6 w-6"}):e.jsx(k,{className:"h-6 w-6"})})}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Details"}),e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Prospect:"}),e.jsx("span",{className:"text-sm font-medium",children:t.prospectName})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Type:"}),e.jsx("span",{className:"text-sm font-medium",children:t.type})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Date:"}),e.jsx("span",{className:"text-sm font-medium",children:t.date})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Duration:"}),e.jsx("span",{className:"text-sm font-medium",children:t.duration})]})]})]})]})}),e.jsx(E,{value:"transcript",children:e.jsxs("div",{className:"bg-muted rounded-md p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(me,{className:"h-5 w-5 mr-2"}),e.jsx("h3",{className:"font-medium",children:"AI-Generated Transcript"})]}),e.jsx(n,{variant:"outline",size:"sm",children:"Download"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:"Adv
1isor"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"00:01:23"})]}),e.jsx("p",{className:"text-sm",children:"Thank you for coming in today. I'd like to learn more about your financial goals and what you're hoping to achieve in the next 5 to 10 years."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:t.prospectName}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"00:01:45"})]}),e.jsx("p",{className:"text-sm",children:"Well, my main concern is retirement planning. I'm 52 now and ideally would like to retire at 60. I'm not sure if my current savings and investments will be sufficient for that timeline."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:"Advisor"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"00:02:10"})]}),e.jsx("p",{className:"text-sm",children:"That's a great starting point. Can you tell me more about your current retirement accounts and other investments you have?"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:t.prospectName}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"00:02:30"})]}),e.jsx("p",{className:"text-sm",children:"I have a 401(k) through my employer with about $420,000. I also have a Roth IRA with approximately $150,000 and some individual stocks worth around $200,000."})]})]})]})})]})})]})}const Pe=[{id:"google-meet",name:"Google Meet",type:"google-meet",isConnected:!1,icon:"Video"},{id:"zoom",name:"Zoom",type:"zoom",isConnected:!1,icon:"Video"},{id:"twilio",name:"Twilio",type:"twilio",isConnected:!1,icon:"Mic"},{id:"amazon-chime",name:"Amazon Chime",type:"amazon-chime",isConnected:!1,icon:"Video"},{id:"browser",name:"Browser Recording",type:"browser",isConnected:!0,icon:"Mic"}],Te=()=>Pe,ke=async t=>new Promise(l=>{setTimeout(()=>{l(!0)},1500)}),Fe=async t=>new Promise(l=>{setTimeout(()=>{l(!0)},1e3)});let D=null,Q=[];const Ie=async()=>{try{const t=await navigator.mediaDevices.getUserMedia({audio:!0});return D=new MediaRecorder(t),Q=[],D.addEventListener("dataavailable",l=>{Q.push(l.data)}),D.start(),!0}catch(t){return console.error("Error starting browser recording:",t),!1}},Ae=async()=>new Promise(t=>{if(!D){t(null);return}D.addEventListener("stop",()=>{const l=new Blob(Q,{type:"audio/wav"});D?.stream?.getTracks().forEach(g=>g.stop()),D=null,t(l)}),D.stop()}),ze=async t=>!0;function Ue({open:t,onOpenChange:l,onStartMeeting:g}){const[i,w]=a.useState("Meeting with New Prospect"),[y,N]=a.useState(""),[v,p]=a.useState("Initial Discovery"),[s,x]=a.useState(!1),[r,h]=a.useState(!1),[b,C]=a.useState(""),c=()=>{h(!0),setTimeout(()=>{x(!0),C("https://meet.google.com/abc-defg-hij"),h(!1)},1500)},o=async()=>{if(!s){f.error("Please connect to Google Meet first");return}h(!0);try{await ze("mock-meeting-id")?(f.success("Google Meet recording started"),g(),l(!1)):f.error("Failed to start recording")}catch(d){f.error(`Error: ${d}`)}finally{h(!1)}};return e.jsx(G,{open:t,onOpenChange:l,children:e.jsxs(V,{className:"sm:max-w-[500px]",children:[e.jsx(W,{children:e.jsx(H,{children:"Start Google Meet Recording"})}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"meeting-title",children:"Meeting Title"}),e.jsx(L,{id:"meeting-title",value:i,onChange:d=>w(d.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"prospect",children:"Prospect"}),e.jsxs(F,{value:y,onValueChange:N,children:[e.jsx(I,{id:"prospect",children:e.jsx(A,{placeholder:"Select a prospect..."})}),e.jsxs(z,{children:[e.jsx(m,{value:"john-doe",children:"John Doe"}),e.jsx(m,{value:"mary-smith",children:"Mary Smith"}),e.jsx(m,{value:"robert-johnson",children:"Robert Johnson"}),e.jsx(m,{value:"alice-williams",children:"Alice Williams"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"meeting-type",children:"Meeting Type"}),e.jsxs(F,{value:v,onValueChange:p,children:[e.jsx(I,{id:"meeting-type",children:e.jsx(A,{})}),e.jsxs(z,{children:[e.jsx(m,{value:"Initial Discovery",children:"Initial Discovery"}),e.jsx(m,{value:"Follow-up Discussion",children:"Follow-up Discussion"}),e.jsx(m,{value:"Financial Planning",children:"Financial Planning"}),e.jsx(m,{value:"Investment Strategy",children:"Investment Strategy"}),e.jsx(m,{value:"Estate Planning",children:"Estate Planning"})]})]})]}),s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border rounded-lg bg-muted/40",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium text-sm",children:"Google Meet URL"}),e.jsxs(n,{variant:"ghost",size:"sm",className:"h-6 p-0",onClick:()=>window.open(b,"_blank"),children:[e.jsx(he,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Open meeting"})]})]}),e.jsx("code",{className:"text-xs break-all",children:b})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This will start a Google Meet session and automatically record the meeting."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(we,{className:"bg-primary/10 border-primary/20",children:[e.jsx(xe,{className:"h-4 w-4"}),e.jsx(be,{children:"You need to connect to Google Meet to start a recorded meeting."})]}),e.jsxs(n,{onClick:c,className:"w-full",disabled:r,children:[e.jsx(O,{className:"mr-2 h-4 w-4"}),r?"Connecting...":"Connect to Google Meet"]})]})]}),e.jsxs(q,{children:[e.jsx(n,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(n,{onClick:o,disabled:!s||r,children:r?"Starting...":"Start Meeting"})]})]})})}function Ee({onSave:t,onCancel:l}){const[g,i]=a.useState(!1),[w,y]=a.useState(0),[N,v]=a.useState(null),[p,s]=a.useState(!1),x=a.useRef(null),r=a.useRef(null);a.useEffect(()=>()=>{r.current&&window.clearInterval(r.current)},[]);const h=async()=>{await Ie()?(i(!0),y(0),v(null),r.current=window.setInterval(()=>{y(S=>S+1)},1e3),f.success("Recording started")):f.error("Failed to start recording. Please check microphone permissions.")},b=async()=>{r.current&&(window.clearInterval(r.current),r.current=null);const d=await Ae();i(!1),d?(v(d),x.current&&(x.current.src=URL.createObjectURL(d)),f.success("Recording completed")):f.error("Failed to capture recording")},C=()=>
1{!x.current||!N||(p?x.current.pause():x.current.play(),s(!p))},c=()=>{N&&t(N,w)},o=d=>{const S=Math.floor(d/60),j=d%60;return`${S.toString().padStart(2,"0")}:${j.toString().padStart(2,"0")}`};return e.jsxs("div",{className:"p-4 border rounded-lg space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-medium",children:"Browser Recording"}),e.jsx("span",{className:"text-sm font-mono",children:o(w)})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:g?e.jsx(_,{className:"h-8 w-8 text-red-500 animate-pulse"}):e.jsx(ue,{className:"h-8 w-8 text-muted-foreground"})})}),e.jsx("audio",{ref:x,className:"hidden",onEnded:()=>s(!1),children:e.jsx("track",{kind:"captions"})}),e.jsx("div",{className:"flex justify-center space-x-2",children:g?e.jsx(n,{onClick:b,variant:"destructive",children:"Stop Recording"}):e.jsx(e.Fragment,{children:N?e.jsxs(e.Fragment,{children:[e.jsxs(n,{onClick:C,variant:"outline",children:[p?e.jsx(ie,{className:"mr-2 h-4 w-4"}):e.jsx(k,{className:"mr-2 h-4 w-4"}),p?"Pause":"Play"]}),e.jsxs(n,{onClick:c,variant:"default",children:[e.jsx(je,{className:"mr-2 h-4 w-4"}),"Save Recording"]}),e.jsxs(n,{onClick:l,variant:"outline",children:[e.jsx(ge,{className:"mr-2 h-4 w-4"}),"Discard"]})]}):e.jsxs(n,{onClick:h,variant:"default",children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Start Recording"]})})})]})}function Le({open:t,onOpenChange:l,onStartRecording:g}){const[i,w]=a.useState("In-Office Meeting"),[y,N]=a.useState(""),[v,p]=a.useState("Initial Discovery"),[s,x]=a.useState(!1),r=()=>{if(!i||!y||!v){f.warning("Please fill in all fields");return}x(!0)},h=()=>{f.error("Recording was not saved: recording upload is not enabled yet.")},b=()=>{x(!1)};return e.jsx(G,{open:t,onOpenChange:l,children:e.jsxs(V,{className:"sm:max-w-[500px]",children:[e.jsx(W,{children:e.jsx(H,{children:"Start In-Office Recording"})}),s?e.jsx(Ee,{onSave:h,onCancel:b}):e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"meeting-title",children:"Meeting Title"}),e.jsx(L,{id:"meeting-title",value:i,onChange:C=>w(C.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"prospect",children:"Prospect"}),e.jsxs(F,{value:y,onValueChange:N,children:[e.jsx(I,{id:"prospect",children:e.jsx(A,{placeholder:"Select a prospect..."})}),e.jsxs(z,{children:[e.jsx(m,{value:"john-doe",children:"John Doe"}),e.jsx(m,{value:"mary-smith",children:"Mary Smith"}),e.jsx(m,{value:"robert-johnson",children:"Robert Johnson"}),e.jsx(m,{value:"alice-williams",children:"Alice Williams"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"meeting-type",children:"Meeting Type"}),e.jsxs(F,{value:v,onValueChange:p,children:[e.jsx(I,{id:"meeting-type",children:e.jsx(A,{})}),e.jsxs(z,{children:[e.jsx(m,{value:"Initial Discovery",children:"Initial Discovery"}),e.jsx(m,{value:"Follow-up Discussion",children:"Follow-up Discussion"}),e.jsx(m,{value:"Financial Planning",children:"Financial Planning"}),e.jsx(m,{value:"Investment Strategy",children:"Investment Strategy"}),e.jsx(m,{value:"Estate Planning",children:"Estate Planning"})]})]})]}),e.jsxs(q,{className:"mt-4",children:[e.jsx(n,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(n,{onClick:r,children:"Start Recording"})]})]})]})})}function Oe({open:t,onOpenChange:l}){return e.jsx(G,{open:t,onOpenChange:l,children:e.jsxs(V,{className:"sm:max-w-[425px]",children:[e.jsx(W,{children:e.jsx(H,{children:"Get Mobile Recording App"})}),e.jsxs("div",{className:"py-6 flex flex-col items-center",children:[e.jsx("div",{className:"w-40 h-40 bg-muted rounded-lg mb-4 flex items-center justify-center",children:e.jsx("div",{className:"text-xs text-muted-foreground text-center p-4",children:"QR Code Placeholder"})}),e.jsx("p",{className:"text-sm text-center mb-4",children:"Scan this QR code with your mobile device to download the app."}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(n,{variant:"outline",size:"lg",className:"flex items-center gap-2",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 19c-4.3 0-7.8-3.4
1-7.8-7.8S7.7 3.4 12 3.4s7.8 3.4 7.8 7.8-3.4 7.8-7.8 7.8z"}),e.jsx("path",{d:"M12 19V3.4"}),e.jsx("path",{d:"M12 3.4C9.8 6.9 8.5 9.9 8.5 13.5c0 2.3 1.5 4.8 3.5 5.5"}),e.jsx("path",{d:"M12 3.4c2.2 3.5 3.5 6.5 3.5 10.1 0 2.3-1.5 4.8-3.5 5.5"})]}),"App Store"]}),e.jsxs(n,{variant:"outline",size:"lg",className:"flex items-center gap-2",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Google Play"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-4 text-center",children:"The mobile app allows you to record meetings on-the-go and automatically syncs with your advisor portal."})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(n,{onClick:()=>l(!1),children:"Close"})})]})})}function _e({open:t,onOpenChange:l,onUpload:g}){const[i,w]=a.useState("Uploaded Meeting"),[y,N]=a.useState(""),[v,p]=a.useState("Initial Discovery"),[s,x]=a.useState(null),[r,h]=a.useState([]),[b,C]=a.useState(!1);a.useEffect(()=>{t&&c()},[t]);const c=async()=>{C(!0);try{const{data:j,error:u}=await Y.from("prospects").select("id, first_name, last_name").order("last_name",{ascending:!0}).limit(100);u?console.error("Error fetching prospects:",u):h(j||[])}catch(j){console.error("Error fetching prospects:",j)}finally{C(!1)}},o=j=>{const u=j.first_name||"",M=j.last_name||"";return`${u} ${M}`.trim()||"Unnamed Prospect"},d=j=>{const u=j.target.files?.[0]||null;x(u)},S=()=>{g()};return e.jsx(G,{open:t,onOpenChange:l,children:e.jsxs(V,{className:"sm:max-w-[425px]",children:[e.jsx(W,{children:e.jsx(H,{children:"Upload Recording"})}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"meeting-title",children:"Meeting Title"}),e.jsx(L,{id:"meeting-title",value:i,onChange:j=>w(j.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"prospect",children:"Prospect"}),e.jsxs(F,{value:y,onValueChange:N,children:[e.jsx(I,{id:"prospect",children:e.jsx(A,{placeholder:"Select a prospect..."})}),e.jsx(z,{children:b?e.jsxs("div",{className:"flex items-center justify-center py-2",children:[e.jsx(re,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]}):r.length>0?r.map(j=>e.jsx(m,{value:j.id,children:o(j)},j.id)):e.jsx("div",{className:"py-2 px-2 text-sm text-muted-foreground",children:"No prospects found"})})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"meeting-type",children:"Meeting Type"}),e.jsxs(F,{value:v,onValueChange:p,children:[e.jsx(I,{id:"meeting-type",children:e.jsx(A,{})}),e.jsxs(z,{children:[e.jsx(m,{value:"Initial Discovery",children:"Initial Discovery"}),e.jsx(m,{value:"Follow-up Discussion",children:"Follow-up Discussion"}),e.jsx(m,{value:"Financial Planning",children:"Financial Planning"}),e.jsx(m,{value:"Investment Strategy",children:"Investment Strategy"}),e.jsx(m,{value:"Estate Planning",children:"Estate Planning"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(R,{htmlFor:"recording-file",children:"Recording File"}),e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 flex flex-col items-center justify-center gap-2",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:e.jsx(B,{className:"h-5 w-5 text-primary"})}),e.jsx("p",{className:"text-sm font-medium",children:"Choose file or drag here"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported formats: MP3, WAV, M4A, MP4"}),e.jsx(L,{id:"recording-file",type:"file",className:"hidden",accept:".mp3,.wav,.m4a,.mp4",onChange:d}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,className:"mt-2",children:e.jsx("label",{htmlFor:"recording-file",children:"Choose file"})}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Selected: ",s.name]})]})]})]}),e.jsxs(q,{children:[e.jsx(n,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(n,{onClick:S,children:"Upload"})]})]})})}function $e(){const[t,l]=a.useState(Te()),[g,i]=a.useState(null),[w,y]=a.useState(null),N=async s=>{i(s);try{await ke(s)?(l(r=>r.map(h=>h.id===s?{...h,isConnected:!0,lastSynced:new Date().toISOString()}:h)),f.success(`Connected to ${t.find(r=>r.id===s)?.name}`)):f.error(`Failed to connect to ${t.find(r=>r.id===s)?.name}`)}
1catch(x){f.error(`Error connecting to service: ${x}`)}finally{i(null)}},v=async s=>{y(s);try{await Fe(s)?(l(r=>r.map(h=>h.id===s?{...h,isConnected:!1,lastSynced:void 0}:h)),f.success(`Disconnected from ${t.find(r=>r.id===s)?.name}`)):f.error(`Failed to disconnect from ${t.find(r=>r.id===s)?.name}`)}catch(x){f.error(`Error disconnecting from service: ${x}`)}finally{y(null)}},p=s=>{switch(s){case"Video":return e.jsx(O,{className:"h-5 w-5 text-primary"});case"Mic":return e.jsx(_,{className:"h-5 w-5 text-primary"});default:return e.jsx(O,{className:"h-5 w-5 text-primary"})}};return e.jsxs(ee,{children:[e.jsxs(se,{children:[e.jsx(te,{children:"Recording Integrations"}),e.jsx(oe,{children:"Connect to recording services to capture meetings with prospects"})]}),e.jsx(ne,{children:e.jsx("div",{className:"grid gap-4",children:t.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:p(s.icon)}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.isConnected?s.lastSynced?`Last synced: ${new Date(s.lastSynced).toLocaleDateString()}`:"Connected":"Not connected"})]})]}),e.jsx("div",{children:s.isConnected?e.jsx(n,{variant:"outline",onClick:()=>v(s.id),disabled:w===s.id,children:w===s.id?e.jsx(e.Fragment,{children:"Disconnecting..."}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"mr-2 h-4 w-4"}),"Disconnect"]})}):e.jsx(n,{variant:"outline",onClick:()=>N(s.id),disabled:g===s.id,children:g===s.id?e.jsx(e.Fragment,{children:"Connecting..."}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"mr-2 h-4 w-4"}),"Connect"]})})})]},s.id))})})]})}const Be=({onOpenMeetingDialog:t,onOpenRecordingDialog:l,onOpenAppDialog:g,onOpenUploadDialog:i})=>e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Recording Methods"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start",children:[e.jsx(O,{className:"h-5 w-5 mr-2 text-primary"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Google Meet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Record virtual meetings with automatic transcription"})]})]}),e.jsx(n,{size:"sm",variant:"secondary",onClick:t,children:"Start Meeting"})]}),e.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start",children:[e.jsx(_,{className:"h-5 w-5 mr-2 text-primary"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"In-Office"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Record in-person meetings using computer microphone"})]})]}),e.jsx(n,{size:"sm",variant:"secondary",onClick:l,children:"Start Recording"})]}),e.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start",children:[e.jsx(fe,{className:"h-5 w-5 mr-2 text-primary"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Mobile App"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Record meetings on-the-go with our mobile app"})]})]}),e.jsx(n,{size:"sm",variant:"secondary",onClick:g,children:"Get App"})]}),e.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start",children:[e.jsx(B,{className:"h-5 w-5 mr-2 text-primary"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Upload"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Upload existing recordings from other platforms"})]})]}),e.jsx(n,{size:"sm",variant:"secondary",onClick:i,children:"Upload File"})]})]})]}),Ge={success:"bg-green-100 text-green-800 border-green-200"},Ve=({recordings:t,onPlayRecording:l})=>{const g=i=>{switch(i){case"google-meet":case"zoom":case"amazon-chime":return e.jsx(O,{className:"h-4 w-4 text-blue-500"});case"twilio":case"browser":return e.jsx(_,{className:"h-4 w-4 text-green-500"});case"upload":return e.jsx(B,{className:"h-4 w-4 text-purple-500"});default:return e.jsx(ye,{className:"h-4 w-4 text-gray-500"})}};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Recent Recordings"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ve,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(L,{placeholder:"Search recordings...",className:"pl-8 w-[250px]"})]}),e.jsxs(n,{variant:"outline",size:"icon",children:[e.jsx(Ne,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Filter"})]})]})]}),e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsxs(Se,{children:[e.jsx(Ce,{children:e.jsxs(X,{children:[e.jsx(P,{children:"Source"}),e.jsx(P,{children:"Prospect"}),e.jsx(P,{children:"Meeting Type"}),e.jsx(P,{children:"Date"}),e.jsx(P,{children:"Duration"}),e.jsx(P,{children:"Status"}),e.jsx(P,{children:"Actions"})]})}),e.jsx(Re,{children:t.map(i=>e.jsxs(X,{children:[e.jsx(T,{children:e.jsxs("div",{className:"flex items-center",children:[g(i.source),e.jsx("span",{className:"ml-2 text-xs text-muted-foreground capitalize",children:i.source||"Unknown"})]})}),e.jsx(T,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-xs font-medium",children:i.initial}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:i.prospectName}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i.email})]})]})}),e.jsx(T,{children:i.type}),e.jsx(T,{children:i.date}),e.jsx(T,{children:i.duration}),e.jsx(T,{children:e.jsx(de,{className:i.status?.includes("Complete")?Ge.success:"",variant:"outline",children:i.status})}),e.jsx(T,{children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{size:"icon",variant:"ghost",onClick:()=>l(i),children:e.jsx(k,{className:"h-4 w-4"})})})})]},i.id))})]}),e.jsx("div",{className:"flex items-center justify-center py-4 border-t",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(n,{variant:"outline",size:"icon",className:"h-8 w-8 p-0",disabled:!0,children:[e.jsx("span",{className:"sr-only",children:"Previous page"}),e.jsx(k,{className:"h-4 w-4 rotate-180"})]}),e.jsx(n,{variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-primary text-primary-foreground",children:"1"}),e.jsx(n,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",children:"2"}),e.jsx(n,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",children:"3"}),e.jsxs(n,{variant:"outline",size:"icon",className:"h-8 w-8 p-0",children:[e.jsx("span",{className:"sr-only",children:"Next page"}),e.jsx(k,{className:"h-4 w-4"})]})]})})]})]})},We=()=>e.jsxs("div",{className:"border rounded-lg p-6",children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Recording Settings"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-4",children:"Audio Processing"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm",children:"Auto Transcription"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Automatically transcribe recordings"})]}),e.jsx(n,{variant:"outline",children:"Configure"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm",children:"AI Analysis"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate insights from recordings"})]}),e.jsx(n,{variant:"outline",children:"Configure"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-medium mb-4",children:"Storage Options"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm",children:"Retention Period"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"How long recordings are stored"})]}),e.jsx(n,{variant:"outline",children:"Configure"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm",children:"Storage Location"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Where recordings are stored"})]}),e.jsx(n,{variant:"outline",children:"Configure"})]})]})]})]}),e.jsxs("div",{className:"pt-4 border-t",children:[e.jsx("h3",{className:"text-base font-medium mb-4",children:"Advanced Options"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm",children:"Export Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure export formats and destinations"})]}),e.jsx(n,{variant:"outline",children:"Configure"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm",children:"Default Recording Source"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your preferred recording method"})]}),e.jsx(n,{variant:"outline",children:"Configure"})]})]})]})]})]});function He(){const[t,l]=a.useState(null),[g,i]=a.useState(!1),[w,y]=a.useState("recordings"),[N,v]=a.useState(!1),[p,s]=a.useState(!1),[x,r]=a.useState(!1),[h,b]=a.useState(!1),{data:C=[],isLoading:c}=ce({queryKey:["meetings-recordings"],queryFn:async()=>{const{data:S,error:j}=await Y.from("meetings").select(` 2 id, 3 meeting_topic, 4 start_time, 5 ai_summary, 6 status, 7 meeting_type, 8 recording_url, 9 lead_id, 10 leads (name, email) 11 `).order("start_time",{ascending:!1});return j?(console.error("[graceful]",j.message),[]):(S??[]).map(u=>{const M=u.leads,$=M?.name??"Unknown",J=$.split(" ").map(le=>le[0]).join("").toUpperCase().slice(0,2);return{id:u.id,title:u.meeting_topic??"Untitled Meeting",prospectName:$,prospectId:u.lead_id??"",type:u.meeting_type??"General",date:u.start_time?De(new Date(u.start_time),"yyyy-MM-dd"):"N/A",duration:"N/A",hasAiAnalysis:!!u.ai_summary,status:u.ai_summary?"Analysis Complete":u.status??"Pending",email:M?.email??void 0,initial:J||"UN",source:"zoom",recordingUrl:u.recording_url??void 0}})}}),o=S=>{l(S),i(!0)},d=()=>{i(!1)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Meeting Recordings"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(n,{variant:"outline",onClick:()=>b(!0),children:[e.jsx(B,{className:"mr-2 h-4 w-4"}),"Upload Recording"]}),e.jsxs(n,{onClick:()=>v(!0),children:[e.jsx(k,{className:"mr-2 h-4 w-4"}),"Record New Meeting"]})]})]}),e.jsxs(Z,{value:w,onValueChange:y,className:"w-full",children:[e.jsxs(K,{className:"grid w-full grid-cols-3",children:[e.jsx(U,{value:"recordings",children:"Recordings"}),e.jsx(U,{value:"integrations",children:"API Integrations"}),e.jsx(U,{value:"settings",children:"Settings"})]}),e.jsxs(E,{value:"recordings",children:[g&&t&&e.jsx(Me,{recording:t,onClose:d}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Be,{onOpenMeetingDialog:()=>v(!0),onOpenRecordingDialog:()=>s(!0),onOpenAppDialog:()=>r(!0),onOpenUploadDialog:()=>b(!0)}),c?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx(re,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(Ve,{recordings:C,onPlayRecording:o})]})]}),e.jsx(E,{value:"integrations",children:e.jsx($e,{})}),e.jsx(E,{value:"settings",children:e.jsx(We,{})})]}),e.jsx(Ue,{open:N,onOpenChange:v,onStartMeeting:()=>{v(!1),f.info("Google Meet session starting...")}}),e.jsx(Le,{open:p,onOpenChange:s,onStartRecording:()=>{s(!1),f.success("Recording started")}}),e.jsx(Oe,{open:x,onOpenChange:r}),e.jsx(_e,{open:h,onOpenChange:b,onUpload:()=>{b(!1),f.info("File upload started"),setTimeout(()=>f.success("Recording uploaded successfully"),2e3)}})]})}const ds=()=>e.jsx(He,{});export{ds as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.