1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1081],{13835:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var r=a(37876);function s(e){let{value:t,label:a,icon:s}=e;return(0,r.jsxs)("div",{className:"text-center flex-1",children:[s&&(0,r.jsx)("div",{className:"flex items-center justify-center text-emerald-600 mb-1",children:s}),(0,r.jsx)("p",{className:"text-xl font-bold text-gray-900",children:t}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:a})]})}},15748:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var r=a(37876);function s(e){let{title:t,subtitle:a,icon:s,rightContent:l}=e;return(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[s&&(0,r.jsx)("div",{className:"p-2.5 bg-emerald-50 rounded-xl text-emerald-600",children:s}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:t}),a&&(0,r.jsx)("p",{className:"text-gray-500 text-sm mt-0.5",children:a})]})]}),l&&(0,r.jsx)("div",{children:l})]})})}},24446:(e,t,a)=>{"use strict";a.d(t,{fN:()=>r,mJ:()=>o});let r=100,s=new Set(["united states","united states of america","usa","us","u.s.","u.s.a.","america","canada","united kingdom","uk","great britain","gb","england","scotland","wales","northern ireland","ireland","australia","new zealand","germany","france","netherlands","holland","belgium","switzerland","austria","luxembourg","sweden","norway","denmark","finland","iceland","japan","singapore","hong kong","south korea","republic of korea","korea, republic of","united arab emirates","uae","qatar","kuwait","israel"]),l=new Set(["us","ca","gb","ie","au","nz","de","fr","nl","be","ch","at","lu","se","no","dk","fi","is","jp","sg","hk","kr","ae","qa","kw","il"]),i=new Set(["albania","andorra","austria","belarus","belgium","bosnia and herzegovina","bosnia","bosna i hercegovina","herzegovina","bulgaria","croatia","cyprus","czech republic","czechia","denmark","estonia","finland","france","germany","greece","hungary","iceland","ireland","italy","kosovo","latvia","liechtenstein","lithuania","luxembourg","malta","moldova","monaco","montenegro","netherlands","holland","north macedonia","macedonia","norway","poland","portugal","romania","russia","russian federation","san marino","serbia","slovakia","slovenia","spain","sweden","switzerland","ukraine","united kingdom","great britain","england","scotland","wales","northern ireland","vatican city","vatican"]),n=new Set(["al","ad","at","by","be","ba","bg","hr","cy","cz","dk","ee","fi","fr","de","gr","hu","is","ie","it","xk","lv","li","lt","lu","mt","md","mc","me","nl","mk","no","pl","pt","ro","ru","sm","rs","sk","si","es","se","ch","ua","gb","va"]);function o(e){let t=String(e||"").trim().toLowerCase();return t&&(s.has(t)||i.has(t)||2===t.length&&(l.has(t)||n.has(t)))?r:.99}},28077:(e,t,a)=>{"use strict";a.d(t,{Wu:()=>d,ZB:()=>o,Zp:()=>i,aR:()=>n});var r=a(37876),s=a(14232),l=a(93704);let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("rounded-xl border bg-card text-card-foreground shadow",a),...s})});i.displayName="Card";let n=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",a),...s})});n.displayName="CardHeader";let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("font-semibold leading-none tracking-tight",a),...s})});o.displayName="CardTitle",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",a),...s})}).displayName="CardDescription";let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",a),...s})});d.displayName="CardContent",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",a),...s})}).displayName="CardFooter"},34379:(e,t,a)=>{"use strict";a.d(t,{$:()=>d});var r=a(37876),s=a(14232),l=a(1138),i=a(47137),n=a(93704);let o=(0,i.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=s.forwardRef((e,t)=>
1{let{className:a,variant:s,size:i,asChild:d=!1,...c}=e,u=d?l.DX:"button";return(0,r.jsx)(u,{className:(0,n.cn)(o({variant:s,size:i,className:a})),ref:t,...c})});d.displayName="Button"},50854:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>i});var r=a(37876),s=a(77328),l=a.n(s);let i=e=>{let{title:t,description:a,noindex:s=!0}=e;return(0,r.jsxs)(l(),{children:[(0,r.jsx)("title",{children:t},"title"),a&&(0,r.jsx)("meta",{name:"description",content:a},"meta-description"),s&&(0,r.jsx)("meta",{name:"robots",content:"noindex, nofollow"},"robots"),s&&(0,r.jsx)("meta",{name:"googlebot",content:"noindex, nofollow"},"googlebot")]})}},52412:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var r=a(37876);function s(e){let{children:t,className:a="",variant:s="default",padding:l=!0}=e;return(0,r.jsx)("div",{className:`bg-white rounded-2xl border border-cream-200 overflow-hidden ${{default:"shadow-sm",elevated:"shadow-md",interactive:"shadow-sm hover:-translate-y-0.5 hover:shadow-md transition-all duration-200 cursor-pointer"}[s]} ${l?"p-5":""} ${a}`,children:t})}},68628:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/expert/dashboard",function(){return a(72315)}])},72315:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>G});var r=a(37876),s=a(14232),l=a(89099),i=a(98467),n=a(24446),o=a(76912),d=a(20485),c=a(93889),u=a(48230),m=a.n(u),x=a(50854),p=a(34379),h=a(79993),b=a(15748);a(95273);var g=a(85704),f=a(52412),y=a(13835),v=a(79247),w=a(8685),N=a(93784),j=a(28419),k=a(63200),A=a(83981),C=a(93990),S=a(31999),D=a(20708),I=a(23478),R=a(15682),T=a(54893),$=a(36867),M=a(20858),F=a(50665),E=a(74206),P=a(46293),_=a(64041),q=a(45798),O=a(25527),B=a(65102),L=a(77786),Y=a(41180),z=a(66762),U=a(63906),W=a(73305),V=a(81225),H=a(97445);function G(){let{t:e}=(0,H.Bd)(),[t,u]=(0,s.useState)(null),[G,Q]=(0,s.useState)(null),[Z,J]=(0,s.useState)("offline"),[K,X]=(0,s.useState)("both"),[ee,et]=(0,s.useState)(!1),[ea,er]=(0,s.useState)(!0),[es,el]=(0,s.useState)(null),[ei,en]=(0,s.useState)(null),[eo,ed]=(0,s.useState)(0),[ec,eu]=(0,s.useState)(0),[em,ex]=(0,s.useState)(0),[ep,eh]=(0,s.use
1State)(0),[eb,eg]=(0,s.useState)(0),[ef,ey]=(0,s.useState)(0),[ev,ew]=(0,s.useState)(!1),[eN,ej]=(0,s.useState)(null),[ek,eA]=(0,s.useState)(null),[eC,eS]=(0,s.useState)(!1),[eD,eI]=(0,s.useState)(""),[eR,eT]=(0,s.useState)(!1),[e$,eM]=(0,s.useState)(!1),[eF,eE]=(0,s.useState)(null),[eP,e_]=(0,s.useState)(null),[eq,eO]=(0,s.useState)(!1),[eB,eL]=(0,s.useState)(!1),[eY,ez]=(0,s.useState)(0),[eU,eW]=(0,s.useState)(null),[eV,eH]=(0,s.useState)(!1),[eG,eQ]=(0,s.useState)(!1),[eZ,eJ]=(0,s.useState)(!1),[eK,eX]=(0,s.useState)(null),[e0,e5]=(0,s.useState)(5),[e2,e1]=(0,s.useState)(""),[e4,e3]=(0,s.useState)(!1),e6=(0,s.useRef)(null),e7=(0,s.useRef)(!1),e8=(0,s.useRef)(null),e9=(0,s.useRef)(null),te=(0,s.useRef)(null),tt=(0,l.useRouter)(),ta=(0,V.a)(t?.uid);(0,s.useEffect)(()=>{let e=e=>{e6.current&&!e6.current.contains(e.target)&&e3(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,s.useEffect)(()=>{tt.query.callEnded&&t?.uid&&(async()=>{let e=(0,d.query)((0,d.collection)(i.db,"callLogs"),(0,d.where)("expertId","==",t.uid),(0,d.orderBy)("startTime","desc"),(0,d.limit)(1)),a=await (0,d.getDocs)(e);if(!a.empty){let e=a.docs[0];eW({id:e.id,...e.data()}),eH(!0)}})()},[tt.query.callEnded,t?.uid]),(0,s.useEffect)(()=>{eV&&eU&&(eQ(!0),eH(!1))},[eV,eU]);let tr=()=>{let{callEnded:e,...t}=tt.query;tt.replace({pathname:tt.pathname,query:t},void 0,{shallow:!0})};(0,s.useEffect)(()=>{if(!tt.isReady||eZ)return;let e=()=>{try{let e=localStorage.getItem("pendingMavenReview");if(e){let t=JSON.parse(e);return eX({...t,direction:"to_seeker"}),eJ(!0),localStorage.removeItem("pendingMavenReview"),!0}let t=localStorage.getItem("pendingCallReview");if(t){let e=JSON.parse(t);return eX({...e,direction:"to_maven",seekerName:e.expertName||"Maven"}),eJ(!0),localStorage.removeItem("pendingCallReview"),!0}}catch{}return!1};if(!e()&&("true"===tt.query.showReview||tt.query.callEnded)){let t=Date.now(),a=setInterval(()=>{if(eZ)return void clearInterval(a);(e()||Date.now()-t>5e3)&&clearInterval(a)},300);return()=>clearInterval(a)}},[tt.isReady,tt.query.showReview,tt.query.callEnded,eZ]);let ts=async()=>{if(eK?.expertId&&0!==e0)try{let e=await (0,d.addDoc)((0,d.collection)(i.db,"reviews"),{reviewType:"seeker_to_maven",expertId:eK.expertId,callerId:t?.uid||i.auth.currentUser?.uid||"anonymous",callerName:ek?.displayName||"Maven",rating:e0,comment:e2.trim(),callDuration:eK.duration,callId:eK.callLogId,callType:"audio",createdAt:(0,d.serverTimestamp)(),updatedAt:(0,d.serverTimestamp)(),verified:!0,platform:"web"});try{let e=(0,d.doc)(i.db,"users",eK.expertId);if((await (0,d.getDoc)(e)).exists()){let t=(await (0,d.getDocs)((0,d.query)((0,d.collection)(i.db,"reviews"),(0,d.where)("expertId","==",eK.expertId)))).docs.map(e=>({id:e.id,...e.data()})).filter(e=>"maven_to_seeker"!==e.reviewType);if(t.length>0){let a=t.reduce((e,t)=>e+(t.rating||0),0),r=Number((a/t.length).toFixed(2));await (0,d.updateDoc)(e,{rating:r,totalReviews:t.length,reviewSummary:{averageRating:r,totalReviews:t.length,recentReviews:t.sort((e,t)=>{let a=e.createdAt?.toDate?e.createdAt.toDate().getTime():0;return(t.createdAt?.toDate?t.createdAt.toDate().getTime():0)-a}).slice(0,3),lastUpdated:new Date().toISOString()},reviewsLastUpdated:(0,d.serverTimestamp)()})}}}catch{}if(eK.callLogId)try{await (0,d.updateDoc)((0,d.doc)(i.db,"callLogs",eK.callLogId),{reviewId:e.id,reviewRating:e0,reviewComment:e2.trim(),reviewedAt:(0,d.serverTimestamp)()})}catch{}eJ(!1),eX(null),e5(5),e1(""),tr()}catch(t){console.error("Error submitting caller review:",t),alert(e("dash.expert.submitReviewFailed","Failed to submit review. Please try again."))}},tl=async()=>{if(eK?.direction==="to_maven")return ts();if(eK?.seekerId&&0!==e0)try{let e=(0,d.doc)(i.db,"users",eK.seekerId);if(await (0,d.runTransaction)(i.db,async a=>{let r=await a.get(e),s=(0,d.doc)((0,d.collection)(i.db,"reviews"));if(a.set(s,{reviewType:"maven_to_seeker",seekerId:eK.seekerId,seekerName:eK.seekerName||"Seeker",reviewerId:t?.uid||i.auth.currentUser?.uid,reviewerName:ek?.displayName||"Maven",callId:eK.callLogId,rating:e0,comment:e2.trim(),callDuration:Math.ceil((eK.duration||0)/60),createdAt:(0,d.serverTimestamp)(),verified:!0,platform:"web"}),r.exists()){let t=r.data().seekerReviewSummary||{totalReviews:0,averageRating:0,ratingDistribution:{5:0,4:0,3:0,2:0,1:0}},s=t.totalReviews+1,l={...t.ratingDistribution};l[e0]=(l[e0]||0)+1;let i=Object.entries(l).reduce((e,t)=>
1{let[a,r]=t;return e+parseInt(a)*r},0),n=parseFloat((i/s).toFixed(2));a.update(e,{seekerReviewSummary:{totalReviews:s,averageRating:n,ratingDistribution:l,lastUpdated:(0,d.serverTimestamp)()},seekerRating:n,seekerTotalReviews:s})}}),eK.callLogId)try{await (0,d.updateDoc)((0,d.doc)(i.db,"callLogs",eK.callLogId),{mavenReviewRating:e0,mavenReviewComment:e2.trim(),mavenReviewedAt:(0,d.serverTimestamp)()})}catch{}eJ(!1),eX(null),e5(5),e1(""),tr()}catch(t){console.error("Error submitting maven review:",t),alert(e("dash.expert.submitReviewFailed","Failed to submit review. Please try again."))}},ti=e=>{if(!e)return null;if(Number.isFinite(e.durationSeconds))return Math.ceil(e.durationSeconds/60);if(Number.isFinite(e.durationMinutes))return Math.ceil(e.durationMinutes);if(Number.isFinite(e.duration))return Math.ceil(e.duration/60);if("string"==typeof e.duration&&e.duration.includes(":")){let[t,a]=e.duration.split(":").map(Number);if(Number.isFinite(t)&&Number.isFinite(a))return t+ +(a>0)}return null},tn=e=>{if(!e)return null;let t=[e.ratePerMinute,e.expertRate,e.expertRatePerMinute,e.rate].find(e=>"number"==typeof e&&!Number.isNaN(e)&&e>0);if("number"==typeof t)return t;let a=ti(e),r=[e.expertEarnings,e.earnings,e.expertPayout].map(e=>"string"==typeof e?Number.parseFloat(e):e).find(e=>"number"==typeof e&&!Number.isNaN(e)&&e>0);if(a&&a>0&&"number"==typeof r&&r>0){let e=r/a/.7;return Number.isFinite(e)?Math.round(100*e)/100:null}return null};(0,s.useEffect)(()=>{(async()=>{if(window.AudioContext)try{let e=new(window.AudioContext||window.webkitAudioContext);eE(e),"Notification"in window&&"default"===Notification.permission&&await Notification.requestPermission()}catch(e){}})()},[]);let to=async()=>{if(e8.current)return;if(eO(!0),e7.current=!0,"Notification"in window&&"granted"===Notification.permission){let t=new Notification(e("dash.expert.notifIncomingCallTitle","\uD83D\uDCDE Incoming Call"),{body:e("dash.expert.notifCallFrom","Call from {{name}}",{name:eN?.callerName||"Unknown"}),icon:"/favicon.ico",requireInteraction:!0,tag:"incoming-call"});t.onclick=()=>{window.focus(),t.close()},setTimeout(()=>t.close(),3e4)}try{let e=new Audio("/ringtone.mp3");e.loop=!0,e.volume=.7,e8.current=e,e_(e);let t=e.play();void 0!==t&&t.then(()=>{}).catch(e=>{td()})}catch(e){td()}"vibrate"in navigator&&navigator.vibrate([200,100,200,100,200]);let t=0,a=document.title;e9.current&&clearInterval(e9.current),e9.current=setInterval(()=>{if(!e7.current||t>20){document.title=a,clearInterval(e9.current),e9.current=null;return}document.title=t%2==0?e("dash.expert.titleFlashIncoming","\uD83D\uDCDE INCOMING CALL!"):a,t++},1e3)},td=()=>{if(eF)try{te.current&&clearInterval(te.current),te.current=setInterval(()=>{if(!e7.current){clearInterval(te.current),te.current=null;return}try{let e=eF.createOscillator(),t=eF.createGain();e.connect(t),t.connect(eF.destination),e.frequency.setValueAtTime(800,eF.currentTime),t.gain.setValueAtTime(.3,eF.currentTime),e.start(eF.currentTime),e.stop(eF.currentTime+.5)}catch(e){clearInterval(beepInterval)}},2e3)}catch(e){}},tc=()=>{if(eO(!1),e7.current=!1,e8.current){try{e8.current.pause(),e8.current.currentTime=0}catch{}e8.current=null}eP&&(eP.pause(),eP.currentTime=0,e_(null)),e9.current&&(clearInterval(e9.current),e9.current=null),te.current&&(clearInterval(te.current),te.current=null),"Notification"in window&&navigator.serviceWorker?.ready.then(e=>{e.getNotifications({tag:"incoming-call"}).then(e=>{e.forEach(e=>e.close())})})};(0,s.useEffect)(()=>{eN&&!eq?to():!eN&&eq&&tc()},[eN,eq]),(0,s.useEffect)(()=>()=>{eq&&tc(),eF&&"closed"!==eF.state&&eF.close(),e9.current&&(clearInterval(e9.current),e9.current=null),te.current&&(clearInterval(te.current),te.current=null)},[]),(0,s.useEffect)(()=>{let e=null,r=(0,c.onAuthStateChanged)(i.auth,async r=>{if(!r){e&&(e(),e=null),er(!1);return}try{u(r);let[s,l]=await Promise.all([(0,d.getDoc)((0,d.doc)(i.db,"experts",r.uid)),(0,d.getDoc)((0,d.doc)(i.db,"users",r.uid))]),n=l.exists()?l.data():{},o=n?.role;if(Q(o),el(n?.applicationStatus||null),en(n?.resubmitChangeRequest||null),ex(n?.earnings?.paid||0),eh(n?.earnings?.pending||0),eg(Number(n?.availableBalance||0)),ey(Number(n?.balance||0)),!0===n.inCall){let e=!n.callPlatform||"web"===n.callPlatform,t=n.currentCallStartedAt?new Date(n.currentCallStartedAt).getTime():0,a=!t||Date.now()-t>9e5;(e||a)&&(0,d.updateDoc)((0,d.doc)(i.db,"users",r.uid),{inCall:!1,callPlatform:(0,d.deleteField)(),currentCallStartedAt:(0,d.deleteField)(),status:"online",availability:"online"}).then(()=>console.log(`ð§¹ Cleared stuck inCall flag on dashboard load (platform=${n.callPlatform||"none"}, stale=${a})`)).catch(()=>{})}if("expert"!==o&&"admin"!==o){e&&(e(),e=null),er(!1);return}if(e=(0,d.onSnapshot)((0,d.doc)(i.db,"users",r.uid),e=>{if(e.exists()){let t=e.data();J(t.availability||"offline"),el(t.applicationStatus||null),en(t.resubmitChangeRequest||null),void 0!==t.rate&&eA(e=>({...e,rate:t.rate,ratePerMinute:t.rate}));let a=t?.payoutSettings?.cryptoWalletAddress,r=a&&""!==a.trim()&&a.startsWith("0x"),s=t?.stripeAccountId&&""!==t.stripeAccountId.trim(),l=t?.stripeConnectStatus?.fullyConnected||!1,i=!!t?.indiaBankDetail
1s?.accountNumber,n=!!(t?.wiseBankDetails?.iban||t?.wiseBankDetails?.accountNumber);eT(r||s&&l||i||n),ez(Number(t.seekerFavoritesCount||0)),ex(t?.earnings?.paid||0),eh(t?.earnings?.pending||0)}},e=>{console.error("â User data listener error in web maven dashboard:",e)}),!s.exists())return void er(!1);{let e=s.data();eA(e),J(n.availability||e.availability||"offline"),X(e.callMode||"both"),et(e.chatEnabled??!1);let t=n?.payoutSettings?.cryptoWalletAddress,a=t&&""!==t.trim()&&t.startsWith("0x"),r=n?.stripeAccountId&&""!==n.stripeAccountId.trim(),l=n?.stripeConnectStatus?.fullyConnected||!1,i=!!n?.indiaBankDetails?.accountNumber,o=!!(n?.wiseBankDetails?.iban||n?.wiseBankDetails?.accountNumber);eT(a||r&&l||i||o),ez(Number(n.seekerFavoritesCount||e.seekerFavoritesCount||0))}er(!1);let c=(0,d.query)((0,d.collection)(i.db,"billing"),(0,d.where)("expertId","==",r.uid)),m=await (0,d.getDocs)(c),x=0,p=0,h=0;m.forEach(e=>{let t=e.data(),a=Number(t.grandTotalExpertEarnings||t.expertEarnings||t.earnings||0),r=Number(t.platformFee||0),s=Number(t.amount||0);x+=a,p+=s,h+=r});try{let e=(0,d.query)((0,d.collection)(i.db,"chatBilling"),(0,d.where)("expertId","==",r.uid));(await (0,d.getDocs)(e)).forEach(e=>{let t=e.data();x+=Number(t.expertEarnings||0),h+=Number(t.platformFee||0)})}catch(e){console.warn("Chat billing query failed:",e.message)}try{let e=(0,d.query)((0,d.collection)(i.db,"userCallHistory"),(0,d.where)("userId","==",r.uid));(await (0,d.getDocs)(e)).forEach(e=>{let t=e.data();if("meeting_room_host"===t.callType){let e=Number(t.earnings||0);x+=e,h+=.3/.7*e,p+=1.25*e}})}catch(e){console.warn("Meeting billing query failed:",e.message)}let b=await (0,d.getDocs)((0,d.query)((0,d.collection)(i.db,"expertEarnings"),(0,d.where)("expertId","==",r.uid))),g=Date.now(),f=0,y=0,v=0;b.forEach(e=>{let t=e.data(),a=Number(t.amount||0);"reversed"!==t.status&&(f+=a);let r=t.releasableAt?.toDate?.(),s=r?.getTime?.()??null,l=null===s||s<=g;!t.payoutId&&("available"===t.status&&l||"completed"===t.status||"pending"===t.status&&null!==s&&l)&&(y+=a),"paid"===t.status&&(v+=a)}),b.empty?ed(x):(ed(Math.round(100*f)/100),eg(Math.round(100*y)/100),ex(Math.round(100*v)/100)),eu(h);let w=(0,d.query)((0,d.collection)(i.db,"callInvites"),(0,d.where)("expertId","==",r.uid)),N=await (0,d.getDocs)(w);Date.now();let j=new Date(Date.now()-12e4);for(let e of(Date.now(),N.docs)){let t,r=e.data();t=r.timestamp?.toDate?r.timestamp.toDate():new Date(r.timestamp?.seconds?1e3*r.timestamp.seconds:r.timestamp||Date.now());let s=r.status,l=!1;if(["expired","declined","cancelled"].includes(s)||"incoming"===s&&t<j?l=!0:("active"===s||"answered"===s)&&(l=!1),l)try{let{deleteDoc:t}=await Promise.resolve().then(a.bind(a,20485));await t((0,d.doc)(i.db,"callInvites",e.id))}catch(e){}}let k=(0,d.query)((0,d.collection)(i.db,"callInvites"),(0,d.where)("expertId","==",r.uid)),A=(0,d.onSnapshot)(k,async e=>{let r=null,s=Date.now();for(let l of e.docs){let e,o,c=l.data();if(eN&&l.id===eN.docId&&("cancelled"===c.status||"ended"===c.status)){ej(null),tc();continue}e=c.timestamp?.toDate?c.timestamp.toDate():c.timestamp?.seconds?new Date(1e3*c.timestamp.seconds):"number"==typeof c.timestamp?new Date(c.timestamp):new Date;let u=new Date(s-18e4);if(e.getTime(),!["active","accepted","answered"].includes(c.status)){if(e<u){try{await (0,d.updateDoc)((0,d.doc)(i.db,"callInvites",l.id),{status:"expired",expiredAt:(0,d.serverTimestamp)(),reason:"ghost_call_cleanup"});let e=c.callerId,r=c.expertId||t?.uid;if(e&&r){let t=`missed_${e}_${r}_${Date.now()}`;await (0,d.setDoc)((0,d.doc)(i.db,"callLogs",t),{callerId:e,expertId:r,callerName:c.callerName||"Quester",expertName:n?.displayName||"Expert",callerDisplayName:c.callerName||"Quester",expertDisplayName:n?.displayName||"Expert",status:"missed",callType:c.callType||"audio",durationSeconds:0,totalCost:0,expertEarnings:0,platformFee:0,startTime:c.timestamp||(0,d.serverTimestamp)(),endTime:(0,d.serverTimestamp)(),createdAt:(0,d.serverTimestamp)(),endReason:"expert_timeout",roomId:c.roomId||r,platform:"web"})}let{deleteDoc:s}=await Promise.resolve().then(a.bind(a,20485));await s((0,d.doc)(i.db,"callInvites",l.id))}catch(e){}continue}if(o=c.expiresAt?.toMillis?c.expiresAt.toMillis():c.expiresAt instanceof Date?c.expiresAt.getTime():"number"==typeof c.expiresAt?c.expiresAt:(c.timestamp?.toMillis?.()||0)+12e4,"incoming"===c.status&&o>s){let e=await (0,d.getDoc)((0,d.doc)(i.db,"users",c.callerId)),t=e.exists()?e.data():{};r={...c,docId:l.id,callerName:t.displayName||t.fullName||t.email||c.callerName||c.callerId,seekerRating:t.seekerRating||t.seekerReviewSummary?.averageRating||null,seekerTotalReviews:t.seekerTotalReviews||t.seekerReviewSummary?.totalReviews||0};break}if("incoming"===c.status&&o<=s)try{await (0,d.updateDoc)((0,d.doc)(i.db,"callInvites",l.id),{status:"missed",endedAt:(0,d.serverTimestamp)()})}catch(e){}}}ej(r)});return er(!1),()=>{A&&A()}}catch(e){console.error("[expert/dashboard] hydrate failed, showing shell anyway:",e?.message||e),er(!1)}});return()=>{r(),e&&e()}},[]);let tu=async a=>{if(t)try{if("online"===a||"busy"===a){let a=await (0,d.getDoc)((0,d.doc)(i.db,"users",t.uid));if((0,o.WS)(a.data()||{})){alert(e("dash.expert.workAuthGate","â ï¸ Your work authorization doesn't permit earning in the US, so you can't go online, busy, or host paid sessions.\n\nIf this is incorrect, update your Work Authorization in Profile.")),J("offline");return}}if("online"===a){let a=(0,d.doc)(i.db,"users",t.uid),r=(await (0,d.getDoc)(a)).data(),s=r?.applicationStatus;if("approved"!==s)return void("pending"===s?alert(e("dash.expert.appPendingOnline","â ï¸ Your expert application is pending review.\n\nYou cannot go online until your application is approved by our team.")):"rejected"===s?alert(e("dash.expert.appRejectedOnline","â ï¸ Your expert application was not approved.\n\nPlease contact support if you believe this was an error.")):alert(e("dash.expert.appNotSubmittedOnline","â ï¸ You must submit an expert application before going online.\n\nPlease complete your profile and submit for approval.")));let l=(0,d.doc)(i.db,"experts",t.uid),n=(await (0,d.getDoc)(l)).data(),o=n?.rate||n?.ratePerMinute||r?.rate||r?.ratePerMinute;if("number"!=typeof o||o<=0)return void alert(e("dash.expert.setRateBeforeOnline","â ï¸ You must set your rate per minute before going online."));let c=r?.payoutSettings?.cryptoWalletAddress,u=c&&""!==c.trim()&&c.startsWith("0x"),m=r?.stripeAccountId&&""!==r.stripeAccountId.trim(),x=r?.stripeConnectStatus?.fullyConnected||!1,p=!!r?.indiaBankDetail
1s?.accountNumber,h=!!(r?.wiseBankDetails?.iban||r?.wiseBankDetails?.accountNumber);if(!(u||m&&x||p||h))return void eM(!0)}J(a),await Promise.all([(0,d.setDoc)((0,d.doc)(i.db,"experts",t.uid),{availability:a,isAvailable:"online"===a,status:a},{merge:!0}),(0,d.setDoc)((0,d.doc)(i.db,"users",t.uid),{availability:a,isAvailable:"online"===a,status:a},{merge:!0})])}catch(t){J(Z),alert(e("dash.expert.updateAvailabilityFailed","Failed to update availability. Please try again."))}},tm=async a=>{if(t)try{X(a),await Promise.all([(0,d.setDoc)((0,d.doc)(i.db,"experts",t.uid),{callMode:a},{merge:!0}),(0,d.setDoc)((0,d.doc)(i.db,"users",t.uid),{callMode:a},{merge:!0})])}catch(t){X(K),alert(e("dash.expert.updateCallModeFailed","Failed to update call mode. Please try again."))}},tx=async a=>{if(t)try{et(a),await Promise.all([(0,d.setDoc)((0,d.doc)(i.db,"experts",t.uid),{chatEnabled:a},{merge:!0}),(0,d.setDoc)((0,d.doc)(i.db,"users",t.uid),{chatEnabled:a},{merge:!0})])}catch(t){et(ee),alert(e("dash.expert.updateChatFailed","Failed to update chat setting. Please try again."))}},tp=()=>{eS(!1),eI("")},th=async()=>{if(!t)return;let a=parseFloat(eD);if(isNaN(a)||a<.01)return void alert(e("dash.expert.rateMinimum","Rate must be at least $0.01 per minute"));if(.2>=(parseFloat(String(ek?.rate??ek?.ratePerMinute??"0"))||0)&&a>.2&&!confirm("Higher rates aren't automatically better.\n\nSeekers scanning the directory tend to book the lower-priced maven first â that's how you get your first reviews. Start at $0.20/min for a few weeks, then raise it once seekers are coming back.\n\nSave this rate anyway?"))return;let r="";try{let e=await (0,d.getDoc)((0,d.doc)(i.db,"users",t.uid));r=e.exists()&&e.data().country||""}catch(e){}let s=(0,n.mJ)(r);if(a>s)return void alert(e("dash.expert.rateMaximum","Rate cannot exceed ${{max}} per minute. To request a higher limit, email [email protected] or reach us through the Contact page.",{max:s.toFixed(2)}));try{await Promise.all([(0,d.setDoc)((0,d.doc)(i.db,"experts",t.uid),{rate:a,ratePerMinute:a,updatedAt:(0,d.serverTimestamp)()},{merge:!0}),(0,d.updateDoc)((0,d.doc)(i.db,"users",t.uid),{rate:a,ratePerMinute:a,updatedAt:(0,d.serverTimestamp)()})]),eA(e=>({...e,rate:a})),eS(!1),eI(""),alert(e("dash.expert.rateUpdated","Rate updated to ${{rate}}/min successfully!",{rate:a.toFixed(2)}))}catch(t){console.error("Error updating rate:",t),alert(e("dash.expert.updateRateFailed","Failed to update rate. Please try again."))}},tb=async()=>{if(!eB&&eN){eL(!0),tc();try{let r=await (0,d.getDoc)((0,d.doc)(i.db,"callInvites",eN.docId));if(!r.exists()){alert(e("dash.expert.callEndedByCaller","Call Ended\n\nThe caller has ended the call.")),eL(!1);return}let s=r.data()?.status;if("cancelled"===s||"ended"===s){alert(e("dash.expert.callEndedByCaller","Call Ended\n\nThe caller has ended the call.")),eL(!1);return}let{writeBatch:l}=await Promise.resolve().then(a.bind(a,20485)),n=l(i.db);n.update((0,d.doc)(i.db,"callInvites",eN.docId),{status:"accepted",acceptedAt:(0,d.serverTimestamp)(),expertAcceptedAt:(0,d.serverTimestamp)(),updatedAt:(0,d.serverTimestamp)()}),n.update((0,d.doc)(i.db,"users",t.uid),{availability:"busy",currentCallId:eN.docId,callStartedAt:(0,d.serverTimestamp)(),lastCallAcceptedAt:(0,d.serverTimestamp)(),lastActiveAt:(0,d.serverTimestamp)()}),n.set((0,d.doc)(i.db,"experts",t.uid),{lastCallAcceptedAt:(0,d.serverTimestamp)(),lastActiveAt:(0,d.serverTimestamp)()},{merge:!0});let o=n.commit(),c=new Promise((e,t)=>setTimeout(()=>t(Error("Firestore batch write timeout")),5e3));await Promise.race([o,c]),fetch("/api/mobile/cancel-call-ring",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expertId:t.uid,callInviteId:eN.docId,reason:"accepted_elsewhere"})}).catch(()=>{}),tt.push(`/call/${eN.roomId}?isExpert=true&callerId=${eN.callerId}`)}catch(t){console.error("â [Dashboard] Failed to accept call:",t),eL(!1),alert(e("dash.expert.acceptCallFailed","Failed to accept call. Please try again.\n\nIf the issue persists, please refresh the page.")),eN&&to(),confirm(e("dash.expert.refreshConfirm","Would you like to refresh the page to fix connection issues?"))&&window.location.reload()}}},tg=async()=>
1{if(eN){tc();try{await (0,d.updateDoc)((0,d.doc)(i.db,"callInvites",eN.docId),{status:"declined",declinedAt:(0,d.serverTimestamp)()})}catch(e){}try{let e=eN.callerId,a=t?.uid;if(e&&a){let r=`declined_${e}_${a}_${Date.now()}`,s=eN.callerName||eN.name||"Quester",l=t?.displayName||t?.profile?.firstName||"Expert";await (0,d.setDoc)((0,d.doc)(i.db,"callLogs",r),{callerId:e,expertId:a,callerName:s,expertName:l,callerDisplayName:s,expertDisplayName:l,status:"declined",callType:eN.callType||"audio",durationSeconds:0,totalCost:0,expertEarnings:0,platformFee:0,startTime:(0,d.serverTimestamp)(),endTime:(0,d.serverTimestamp)(),createdAt:(0,d.serverTimestamp)(),endReason:"expert_declined",roomId:eN.roomId||a,platform:"web"})}}catch(e){console.error("Error logging declined call:",e)}try{let{deleteDoc:e}=await Promise.resolve().then(a.bind(a,20485));await e((0,d.doc)(i.db,"callInvites",eN.docId))}catch(e){}ej(null)}};return ea?(0,r.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,r.jsxs)("div",{className:"text-center space-y-3",children:[(0,r.jsx)(v.A,{className:"w-8 h-8 text-gray-400 mx-auto animate-spin"}),(0,r.jsx)("p",{className:"text-gray-500 text-sm",children:e("dash.expert.loadingDashboard","Loading dashboard...")})]})}):null===G?(0,r.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,r.jsx)(f.A,{className:"max-w-md w-full",children:(0,r.jsxs)("div",{className:"text-center space-y-6 py-4",children:[(0,r.jsx)("div",{className:"mx-auto w-14 h-14 bg-emerald-50 rounded-2xl flex items-center justify-center",children:(0,r.jsx)(w.A,{className:"w-7 h-7 text-emerald-600"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:e("dash.expert.loginRequired","Login Required")}),(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-500",children:e("dash.expert.loginToAccess","Please log in to access your Maven Dashboard")})]}),(0,r.jsxs)("button",{onClick:()=>window.location.href="/login",className:"w-full flex items-center justify-center gap-2 py-3 px-4 text-sm font-semibold rounded-xl text-white bg-emerald-600 hover:bg-emerald-700 transition-colors",children:[(0,r.jsx)(w.A,{className:"w-4 h-4"}),e("dash.expert.loginToCamyvera","Login to Camyvera")]})]})})}):"expert"!==G&&"admin"!==G?(0,r.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,r.jsx)(f.A,{className:"max-w-md w-full",children:(0,r.jsxs)("div",{className:"text-center space-y-6 py-4",children:[(0,r.jsx)("div",{className:"mx-auto w-14 h-14 bg-red-50 rounded-2xl flex items-center justify-center",children:(0,r.jsx)(N.A,{className:"w-7 h-7 text-red-500"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:e("dash.expert.accessDenied","Access Denied")}),(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-500",children:e("dash.expert.accessDeniedDesc","This dashboard is for Mavens only. Your account doesn't have the required permissions.")})]}),(0,r.jsxs)("button",{onClick:()=>window.location.href="/",className:"w-full flex items-center justify-center gap-2 py-3 px-4 text-sm font-semibold rounded-xl text-white bg-gray-700 hover:bg-gray-800 transition-colors",children:[(0,r.jsx)(j.A,{className:"w-4 h-4"}),e("dash.expert.goToHomepage","Go to Homepage")]})]})})}):(0,r.jsxs)("div",{className:"pb-8 space-y-6",children:[(0,r.jsx)(x.default,{title:"Maven Dashboard",description:"Manage your maven account and track your earnings"}),(0,r.jsx)(b.A,{title:e("dash.expert.headerTitle","Maven Dashboard"),subtitle:e("dash.expert.headerSubtitle","Manage your Maven profile"),icon:(0,r.jsx)(k.A,{className:"w-5 h-5"}),rightContent:eC?(0,r.jsxs)("div",{className:"flex flex-col items-end space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-gray-500",children:"$"}),(0,r.jsx)("input",{type:"number",step:"0.01",min:"0.25",value:eD,onChange:e=>eI(e.target.value),onKeyDown:e=>{"Enter"===e.key&&th(),"Escape"===e.key&&tp()},className:"w-20 rounded-xl border border-gray-200 bg-gray-50 px-3 py-1.5 text-center text-sm font-semibold text-gray-900 focus:ring-2 focus:ring-emerald-500 focus:border-transparent",placeholder:"0.00",autoFocus:!0}),(0,r.jsx)("span",{className:"text-sm text-gray-500",children:e("dash.expert.perMin","/min")})]}),(0,r.jsxs)("div",{className:"flex space-x-2",children:[(0,r.jsxs)("button",{onClick:th,className:"flex items-center gap-1 rounded-full bg-emerald-500 px-3 py-1 text-xs font-medium text-white transition-colors hover:bg-emerald-600",children:[(0,r.jsx)(A.A,{className:"w-3 h-3"})," ",e("dash.expert.save","Save")]}),(0,r.jsxs)("button",{onClick:tp,className:"flex items-center gap-1 rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-200",children:[(0,r.jsx)(C.A,{className:"w-3 h-3"})," ",e("dash.expert.cancel","Cancel")]})]})]}):(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsxs)("p",{className:"text-lg font-bold text-emerald-600",children:["$",ek?.rate?.toFixed(2)||"0.00","/min"]}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:e("dash.expert.yourRate","Your rate")})]}),(0,r.jsx)("button",{onClick:()=>{eI(ek?.rate?.toString()||""),eS(!0)},className:"p-2 rounded-xl bg-gray-50 text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors",title:e("dash.expert.editRate","Edit rate"),children:(0,r.jsx)(S.A,{className:"w-4 h-4"})})]}),(0,r.jsxs)("div",{className:"relative",ref:e6,children:[(0,r.jsxs)("button",{onClick:()=>e3(!e4),className:"relative cursor-pointer",title:e("dash.expert.changeStatus","Change status"),children:[ek?.photoURL||ek?.photos?.[0]?.url?(0,r.jsx)("img",{src:ek.photos?.[0]?.url||ek.photoURL,alt:"",className:"w-10 h-10 rounded-full object-cover border-2 border-gray-200"}):(0,r.jsx)("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-emerald-500 to-teal-600 flex items-center justify-center text-white font-bold text-sm border-2 border-gray-200",children:(ek?.displayName||ek?.name||"M").charAt(0).toUpperCase()}),(0,r.jsx)("span",{className:`absolute bottom-0 right-0 w-3.5 h-3.5 rounded-full border-2 border-white ${"online"===Z?"bg-green-500":"busy"===Z?"bg-yellow-500":"bg-gray-400"}`})]}),e4&&(0,r.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-50 overflow-hidden",children:[(0,r.jsx)("div",{className:"px-4 py-2 border-b border-gray-100",children:(0,r.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase",children:e("dash.expert.statusLabel","Status")})}),[{key:"online",label:e("dash.expert.statusOnline","Online"),desc:e("dash.expert.statusOnlineDesc","Available now"),dotColor:"bg-green-500"},{key:"busy",label:e("dash.expert.statusBusy","Busy"),desc:e("dash.expert.statusBusyDesc","Delays expected"),dotColor:"bg-yellow-500"},{key:"offline",label:e("dash.expert.statusOffline","Offline"),desc:e("dash.expert.statusOfflineDesc","Not available"),dotColor:"bg-gray-400"}].map(e=>(0,r.jsxs)("button",{onClick:()=>{tu(e.key),e3(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-gray-100 ${Z===e.ke
1y?"bg-gray-50":""}`,children:[(0,r.jsx)("div",{className:`w-3 h-3 rounded-full ${e.dotColor}`}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-sm font-medium text-gray-800",children:e.label}),(0,r.jsx)("div",{className:"text-xs text-gray-500",children:e.desc})]}),Z===e.key&&(0,r.jsx)(A.A,{className:"h-4 w-4 ml-auto text-green-600"})]},e.key))]})]})]})}),eN&&(0,r.jsx)(f.A,{className:`sticky top-2 z-30 border-2 ${eq?"animate-pulse border-red-500 bg-red-50":"border-yellow-400 bg-yellow-50"}`,children:(0,r.jsxs)("div",{className:"text-center space-y-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center gap-4",children:[(0,r.jsx)("div",{className:`p-3 rounded-2xl ${eq?"bg-red-100":"bg-yellow-100"}`,children:(0,r.jsx)(D.A,{className:`w-8 h-8 ${eq?"text-red-600 animate-bounce":"text-yellow-600"}`})}),(0,r.jsxs)("div",{className:"text-left",children:[(0,r.jsx)("p",{className:`text-xl font-bold ${eq?"text-red-800":"text-yellow-800"}`,children:e("dash.expert.incomingCall","INCOMING CALL")}),(0,r.jsxs)("p",{className:"text-base font-semibold text-gray-700",children:[e("dash.expert.callFrom","from:")," ",eN.callerName]}),(0,r.jsx)("p",{className:"text-sm text-gray-500 flex items-center gap-1.5",children:"video"===eN.callType?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I.A,{className:"w-4 h-4"})," ",e("dash.expert.videoCall","Video Call")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{className:"w-4 h-4"})," ",e("dash.expert.audioCall","Audio Call")]})}),(0,r.jsxs)("p",{className:"text-sm text-gray-500 flex items-center gap-1.5",children:[(0,r.jsx)(T.A,{className:"w-4 h-4"})," $",ek?.rate,"/min"]}),eN.seekerRating>0&&(0,r.jsxs)("p",{className:"text-sm text-gray-500 flex items-center gap-1.5",children:[(0,r.jsx)($.A,{className:"w-4 h-4 fill-amber-400 text-amber-400"}),Number(eN.seekerRating).toFixed(1)," ",e("dash.expert.reviewsCount","({{count}} reviews)",{count:eN.seekerTotalReviews})]})]})]}),(0,r.jsxs)("div",{className:"flex justify-center gap-4",children:[(0,r.jsx)(p.$,{onClick:tb,disabled:!ek?.rate||ek.rate<=0||eB,size:"lg",className:`${!ek?.rate||ek.rate<=0||eB?"bg-gray-400":"bg-emerald-600 hover:bg-emerald-700"} px-8 py-4 text-base font-bold rounded-xl flex items-center gap-2`,children:eB?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.A,{className:"w-5 h-5 animate-spin"})," ",e("dash.expert.accepting","Accepting...")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A.A,{className:"w-5 h-5"})," ",e("dash.expert.acceptCall","Accept Call")]})}),(0,r.jsxs)(p.$,{variant:"destructive",onClick:tg,size:"lg",className:"px-8 py-4 text-base font-bold bg-red-600 hover:bg-red-700 rounded-xl flex items-center gap-2",children:[(0,r.jsx)(M.A,{className:"w-5 h-5"})," ",e("dash.expert.decline","Decline")]})]}),(!ek?.rate||ek.rate<=0)&&(0,r.jsxs)("p",{className:"text-red-600 font-medium text-sm flex items-center justify-center gap-1.5",children:[(0,r.jsx)(N.A,{className:"w-4 h-4"})," ",e("dash.expert.setRateFirst","Set your rate first to accept calls")]})]})}),(0,r.jsx)(g.A,{tabs:[{label:e("dash.expert.tabOverview","Overview"),href:"/expert/dashboard"},{label:e("dash.expert.earnings","Earnings"),href:"/expert/earnings"},{label:e("dash.expert.schedule","Schedule"),href:"/expert/schedule"},{label:e("dash.expert.tabCallHistory","Call History"),href:"/expert/history"},{label:e("dash.expert.tabReviews","Reviews"),href:"/expert/reviews"},{label:e("dash.expert.tabMessages","Messages"),href:"/expert/messages",badge:ta},{label:e("dash.expert.tabBlocked","Blocked"),href:"/expert/blocked-users"}]}),"approved"!==es&&(0,r.jsx)("div",{className:`rounded-xl p-4 border ${"pending"===es?"bg-amber-50 border-amber-200":"rejected"===es?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"}`,children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)(N.A,{className:`w-5 h-5 mt-0.5 flex-shrink-0 ${"pending"===es?"text-amber-600":"rejected"===es?"text-red-600":"text-blue-600"}`}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:`font-semibold text-sm ${"pending"===es?"text-amber-800":"rejected"===es?"text-red-800":"text-blue-800"}`,children:"pending"===es?e("dash.expert.appUnderReview","Application Under Review"):"rejected"===es?e("dash.expert.appNotApproved","Application Not Approved"):ei?e("dash.expert.changesRequested","Changes Requested â Please Update & Resubmit"):e("dash.expert.completeApp","Complete Your Maven Application")}),(0,r.jsx)("p",{className:`text-sm mt-1 ${"pending"===es?"text-amber-700":"rejected"===es?"text-red-700":"text-blue-700"}`,children:"pending"===es?e("dash.expert.appUnderReviewDesc","Your application is being reviewed by our team. You will be able to go online and receive calls once approved."):"rejected"===es?e("dash.expert.appRejectedDesc","Unfortunately your application was not approved. Please contact support for more information."):ei?e("dash.expert.changesRequestedDesc","Our team reviewed your application and asked for a few changes before approval. Update the requested details and resubmit."):e("dash.expert.completeAppDesc","Complete your expert profile and submit your application to start receiving calls.")}),"pending"!==es&&"rejected"!==es&&ei&&(0,r.jsxs)("div",{className:"mt-2 rounded-lg bg-white/70 border border-blue-200 p-3",children:[(0,r.jsx)("p",{className:"text-xs font-semibold text-blue-800 mb-1",children:e("dash.expert.whatToUpdate","What we'd like you to update:")}),(0,r.jsx)("p",{className:"text-sm text-blue-900 whitespace-pre-line",children:ei})]}),"pending"!==es&&"rejected"!==es&&(0,r.jsxs)("button",{onClick:()=>tt.push("/expert/application"),className:"mt-2 inline-flex items-center gap-1 px-4 py-2 text-sm font-semibold text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors",children:[ei?e("dash.expert.reviewResubmit","Review & Resubmit"):e("dash.expert.submitApplication","Submit Application")," ",(0,r.jsx)(j.A,{className:"w-4 h-4"})]}),"pending"===es&&(0,r.jsxs)("button",{onClick:()=>tt.push("/expert/profile-edit"),className:"mt-2 inline-flex items-center gap-1 px-4 py-2 text-sm font-semibold text-amber-800 bg-amber-100 hover:bg-amber-200 rounded-lg transition-colors",children:[e("dash.expert.viewApplication","Vie
1w Application")," ",(0,r.jsx)(j.A,{className:"w-4 h-4"})]})]})]})}),t?.uid&&(0,r.jsxs)("div",{className:"mb-4 rounded-2xl border-2 border-purple-200 bg-gradient-to-br from-purple-50 via-white to-fuchsia-50 p-5 sm:p-6",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg sm:text-xl font-bold text-slate-900 mb-1",children:e("dash.expert.yourMavenLink","Your Maven Link")}),(0,r.jsx)("p",{className:"text-sm text-slate-600",children:e("dash.expert.mavenLinkSubtitle","Share this on TikTok, Instagram, X, LinkedIn, YouTube, or your website â your audience calls, chats, and books you in one place.")})]}),(0,r.jsx)(F.A,{className:"h-6 w-6 text-purple-600 flex-shrink-0 hidden sm:block"})]}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,r.jsx)("input",{readOnly:!0,value:`https://www.camyvera.com/expert-profile/${t.uid}`,onClick:e=>e.target.select(),className:"flex-1 px-4 py-3 bg-white border border-slate-200 rounded-xl text-sm text-slate-700 font-mono truncate","aria-label":"Your Maven profile URL"}),(0,r.jsxs)("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(`https://www.camyvera.com/expert-profile/${t.uid}`),alert(e("dash.expert.copiedToClipboard","Profile link copied!"))},className:"inline-flex items-center justify-center gap-2 px-5 py-3 rounded-xl bg-slate-900 text-white font-semibold text-sm hover:bg-slate-800 transition",children:[(0,r.jsx)(E.A,{className:"h-4 w-4"}),e("dash.expert.copy","Copy")]}),"undefined"!=typeof navigator&&"function"==typeof navigator.share&&(0,r.jsxs)("button",{type:"button",onClick:()=>{navigator.share({title:`${ek?.displayName||"My"} Maven Profile`,text:"Book a call, chat, or session with me on Camyvera.",url:`https://www.camyvera.com/expert-profile/${t.uid}`}).catch(()=>{})},className:"inline-flex items-center justify-center gap-2 px-5 py-3 rounded-xl bg-purple-600 text-white font-semibold text-sm hover:bg-purple-700 transition",children:[(0,r.jsx)(F.A,{className:"h-4 w-4"}),e("dash.expert.share","Share")]})]})]}),(0,r.jsx)("div",{className:"overflow-x-auto no-scrollbar -mx-1 px-1",children:(0,r.jsx)("div",{className:"flex gap-3 min-w-max",children:[{label:e("dash.expert.navEditProfile","Edit Profile"),icon:(0,r.jsx)(S.A,{className:"w-5 h-5"}),action:()=>tt.push("/expert/profile-edit"),color:"text-blue-600 bg-blue-50"},{label:e("dash.expert.navMyProfile","My Profile"),icon:(0,r.jsx)(P.A,{className:"w-5 h-5"}),action:()=>tt.push(`/expert-profile/${t?.uid}`),color:"text-indigo-600 bg-indigo-50"},{label:e("dash.expert.navFavorites","Favorites"),icon:(0,r.jsx)($.A,{className:"w-5 h-5"}),action:()=>tt.push("/expert/favorites"),color:"text-pink-600 bg-pink-50"},{label:e("dash.expert.schedule","Schedule"),icon:(0,r.jsx)(_.A,{className:"w-5 h-5"}),action:()=>tt.push("/expert/schedule"),color:"text-purple-600 bg-purple-50"},{label:e("dash.expert.navMyBookings","My Bookings"),icon:(0,r.jsx)(_.A,{className:"w-5 h-5"}),action:()=>tt.push("/expert/bookings"),color:"text-violet-600 bg-violet-50"},{label:e("dash.expert.navGroupSession","Group Session"),icon:(0,r.jsx)(I.A,{className:"w-5 h-5"}),action:()=>tt.push("/expert/meeting-rooms"),color:"text-rose-600 bg-rose-50"},{label:e("dash.expert.earnings","Earnings"),icon:(0,r.jsx)(T.A,{className:"w-5 h-5"}),action:()=>tt.push("/expert/earnings"),color:"text-emerald-600 bg-emerald-50"},{label:e("dash.expert.addFunds","Add Funds"),icon:(0,r.jsx)(q.A,{className:"w-5 h-5"}),action:()=>tt.push("/settings/payment"),color:"text-teal-600 bg-teal-50"},{label:e("dash.expert.navSpending","Spending"),icon:(0,r.jsx)(v.A,{className:"w-5 h-5"}),action:()=>tt.push("/expert/billing-history"),color:"text-slate-600 bg-slate-50"},{label:e("dash.expert.navPayout","Payout"),icon:(0,r.jsx)(O.A,{className:"w-5 h-5"}),action:()=>tt.push("/settings/payout"),color:"text-amber-600 bg-amber-50"},{label:e("dash.expert.navShare","Share"),icon:(0,r.jsx)(F.A,{className:"w-5 h-5"}),action:()=>{let a=`https://www.camyvera.com/expert/${t.uid}`,r=`${ek?.displayName} - ${ek?.title||ek?.expertise||"Maven"} 2$${ek?.rate||"0.00"}/min on Camyvera 3 4${ek?.bio?ek.bio.substring(0,120)+"...":"Available for consultations"}`;navigator.share?navigator.share({title:e("dash.expert.shareProfileTitle","{{name}}'s Maven Profile",{name:ek?.displayName}),text:r,url:a}).catch(()=>{navigator.clipboard.writeText(r),alert(e("dash.expert.copiedToClipboard","Profile information copied to clipboard!"))}):(navigator.clipboard.writeText(r),alert(e("dash.expert.copiedToClipboard","Profile information copied to clipboard!")))},color:"text-pink-600 bg-pink-50"}].map(e=>(0,r.jsxs)("button",{onClick:e.action,className:"flex flex-col items-center gap-2 px-5 py-3 rounded-2xl bg-white border border-gray-100 shadow-sm hover:shadow-md hover:-translate-y-0.5 transition-all duration-200",children:[(0,r.jsx)("div",{className:`p-2.5 rounded-xl ${e.color}`,children:e.icon}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-700",children:e.label})]},e.label))})}),!eR&&(0,r.jsx)(f.A,{className:"border-2 border-blue-300 bg-blue-50",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"p-2 bg-blue-100 rounded-xl flex-shrink-0",children:(0,r.jsx)(O.A,{className:"w-5 h-5 text-blue-600"})}),(0,r.jsxs)("div",{className:"flex-grow",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-blue-900 mb-1",children:e("dash.expert.setupPayoutMethod","Setup Payout Method")}),(0,r.jsx)("p",{className:"text-sm text-blue-800 mb-3",children:e("dash.expert.payoutBannerDesc","Add your bank account to receive your earnings â Wise bank transfer (low fees, 1â3 business days). You can start taking calls now and set this up anytime.")}),(0,r.jsxs)(m(),{href:"/settings/payout",className:"inline-flex items-center gap-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-xl text-sm font-medium transition-colors",children:[(0,r.jsx)(O.A,{className:"w-4 h-4"}),e("dash.expert.setupPayoutMethod","Setup Payout Method")]})]})]})}
4),"online"!==Z&&(0,r.jsx)(f.A,{className:`border-2 ${"busy"===Z?"border-yellow-300 bg-yellow-50":"border-red-300 bg-red-50"}`,children:(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:`p-2.5 rounded-xl flex-shrink-0 ${"busy"===Z?"bg-yellow-100":"bg-red-100"}`,children:"busy"===Z?(0,r.jsx)(v.A,{className:"w-5 h-5 text-yellow-600"}):(0,r.jsx)(B.A,{className:"w-5 h-5 text-red-500"})}),(0,r.jsxs)("div",{className:"flex-grow",children:[(0,r.jsx)("h3",{className:`text-base font-semibold mb-0.5 ${"busy"===Z?"text-yellow-800":"text-red-800"}`,children:"busy"===Z?e("dash.expert.limitedAvailability","Limited Availability"):e("dash.expert.notAvailableForCalls","Not Available for Calls")}),(0,r.jsx)("p",{className:`text-sm ${"busy"===Z?"text-yellow-700":"text-red-700"}`,children:"busy"===Z?e("dash.expert.busyDesc","You may receive calls with delays. Set status to Online for immediate calls."):e("dash.expert.offlineDesc","You are offline and won't receive calls. Set status to Online to start earning.")})]}),(0,r.jsxs)(p.$,{onClick:()=>tu("online"),className:"bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-xl text-sm font-medium transition-colors flex-shrink-0",children:[(0,r.jsx)(L.A,{className:"w-4 h-4 mr-1.5"}),e("dash.expert.goOnline","Go Online")]})]})}),(0,r.jsx)(f.A,{className:"mb-5",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-11 h-11 rounded-full bg-teal-50 flex items-center justify-center",children:(0,r.jsx)(q.A,{className:"w-5 h-5 text-teal-600"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-medium text-gray-500",children:e("dash.expert.walletBalance","Wallet Balance")}),(0,r.jsxs)("div",{className:`text-2xl font-bold ${ef<1?"text-red-600":"text-gray-900"}`,children:["$",ef.toFixed(2)]}),(0,r.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:e("dash.expert.availableToCall","Available to call other mavens")})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{onClick:()=>tt.push("/expert/billing-history"),className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-800 text-sm font-semibold transition-colors",children:[(0,r.jsx)(v.A,{className:"w-4 h-4"})," ",e("dash.expert.billingHistory","Billing History")]}),(0,r.jsxs)("button",{onClick:()=>tt.push("/settings/payment"),className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-xl bg-teal-600 hover:bg-teal-700 text-white text-sm font-semibold transition-colors",children:[(0,r.jsx)(q.A,{className:"w-4 h-4"})," ",e("dash.expert.addFunds","Add Funds")]})]})]})}),(0,r.jsxs)(f.A,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)(Y.A,{className:"w-5 h-5 text-emerald-600"}),(0,r.jsx)("h3",{className:"text-base font-bold text-gray-900",children:e("dash.expert.earningsOverview","Earnings Overview")})]}),(0,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)(y.A,{value:`$${Math.max(0,eb).toFixed(2)}`,label:e("dash.expert.availableBalance","Available Balance"),icon:(0,r.jsx)(T.A,{className:"w-5 h-5"})}),(0,r.jsx)(y.A,{value:`$${eo.toFixed(2)}`,label:e("dash.expert.totalEarnings","Total Earnings"),icon:(0,r.jsx)(Y.A,{className:"w-5 h-5"})}),(0,r.jsx)(y.A,{value:`$${ec.toFixed(2)}`,label:e("dash.expert.platformFee","Platform Fee"),icon:(0,r.jsx)(z.A,{className:"w-5 h-5"})}),(0,r.jsx)(y.A,{value:`$${em.toFixed(2)}`,label:e("dash.expert.paidOut","Paid Out"),icon:(0,r.jsx)(A.A,{className:"w-5 h-5"})})]}),(0,r.jsx)("div",{className:"mt-5 p-4 bg-gray-50 rounded-xl",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-medium text-gray-800 text-sm",children:e("dash.expert.payoutStatus","Payout Status")}),ev&&(0,r.jsxs)("div",{className:"text-xs text-emerald-600 flex items-center gap-1 mt-0.5",children:[(0,r.jsx)(A.A,{className:"w-3.5 h-3.5"})," ",e("dash.expert.manualPayoutRequested","Manual payout requested")]}),ep>0&&(0,r.jsxs)("div",{className:"text-xs text-yellow-600 flex items-center gap-1 mt-0.5",children:["â³ ",e("dash.expert.pendingLabel","Pending:")," $",ep.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)("div",{className:"text-xs text-gray-500",children:e("dash.expert.availableForPayout","Available for payout")}),(0,r.jsxs)("div",{className:"font-bold text-gray-900",children:["$",Math.max(0,eb).toFixed(2)]})]})]})})]}),(0,r.jsxs)(f.A,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)(U.A,{className:"w-5 h-5 text-gray-600"}),(0,r.jsx)("h3",{className:"text-base font-bold text-gray-900",children:e("dash.expert.preferences","Preferences")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-sm mb-3 text-gray-700",children:e("dash.expert.callMode","Call Mode")}),(0,r.jsx)("div",{className:"flex gap-2",children:[{key:"audio",label:e("dash.expert.audioOnly","Audio Only"),icon:(0,r.jsx)(R.A,{className:"w-4 h-4"})},{key:"video",label:e("dash.expert.videoOnly","Video Only"),icon:(0,r.jsx)(I.A,{className:"w-4 h-4"})},{key:"both",label:e("dash.expert.audioAndVideo","Audio & Video"),icon:(0,r.jsx)(W.A,{className:"w-4 h-4"})}].map(e=>(0,r.jsxs)("button",{onClick:()=>tm(e.key),className:`flex items-center gap-2 px-3 py-2 rounded-xl transition-all text-sm ${K===e.key?"bg-blue-600 text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100"}`,children:[e.icon,(0,r.jsx)("span",{children:e.label})]},e.key))})]}),(0,r.jsxs)("div",{className:"border-t border-gray-100 mt-4 pt-4",children:[(0,r.jsx)("h4",{className:"font-semibold text-sm mb-3 text-gray-700",children:e("dash.expert.chatMessages","Chat Messages")}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-gray-700",children:e("dash.expert.allowSeekersMessage","Allow seekers to message you")}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:ee?e("dash.expert.chatChargeInfo","Charged at ${{amt}}/message (rate/10)",{amt:((ek?.rate||1)/10).toFixed(2)}):e("dash.expert.chatDisabled","Chat is disabled")})]}),(0,r.jsx)("button",{onClick:()=>tx(!ee),className:`px-4 py-2 rounded-xl text-sm font-medium transition-all ${ee?"bg-emerald-600 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:ee?e("dash.expert.enabled","Enabled"):e("dash.expert.disabled","Disabled")})]})]})]}),(0,r.jsx)(f.A,{padding:!1,children:(0,r.jsx)("div",{className:"p-5",children:(0,r.jsx)(h.default,{})})}),eZ&&eK&&(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white dark:bg-gray-900 rounded-2xl p-6 max-w-md w-full mx-4 shadow-xl",children:[(0,r.jsx)("h3",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"to_maven"===eK.direction?e("dash.expert.rateYourCall","Rate Your Call"):e("dash.expert.rateYourCaller","Rate Your Caller")}),(0,r.jsx)("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:e("dash.expert.howWasCallWith","How
4was your call with {{name}}?",{name:eK.seekerName})}),(0,r.jsx)("div",{className:"flex justify-center mb-4",children:[1,2,3,4,5].map(e=>(0,r.jsx)("button",{onClick:()=>e5(e),className:"mx-1",children:(0,r.jsx)($.A,{className:`w-8 h-8 ${e<=e0?"text-amber-400 fill-amber-400":"text-gray-300"}`})},e))}),(0,r.jsx)("textarea",{value:e2,onChange:e=>e1(e.target.value),placeholder:e("dash.expert.shareExperiencePlaceholder","Share your experience (optional)"),className:"w-full p-3 border border-gray-200 dark:border-gray-700 rounded-xl mb-4 resize-none bg-white dark:bg-gray-800 dark:text-white",rows:3}),(0,r.jsx)(f.A,{className:"mb-4 !p-3",children:(0,r.jsxs)("div",{className:"text-sm text-gray-600 dark:text-gray-400 space-y-1",children:[(0,r.jsxs)("p",{children:["Duration: ",(e=>{let t=Number.isFinite(Number(e))?Math.max(0,Math.floor(Number(e))):0,a=Math.floor(t/60);return`${a}:${String(t%60).padStart(2,"0")}`})(eK.duration)]}),(0,r.jsxs)("p",{children:["to_maven"===eK.direction?"Maven":"Seeker",": ",eK.seekerName]}),(0,r.jsxs)("p",{children:["Ended by: ","seeker"===eK.endedBy?"Other party":"You"]})]})}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("button",{onClick:()=>{eJ(!1),eX(null),e5(5),e1(""),tr()},className:"flex-1 px-4 py-2.5 text-gray-600 border border-gray-200 dark:border-gray-700 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-800 font-medium transition-colors",children:"Skip"}),(0,r.jsx)("button",{onClick:tl,className:"flex-1 px-4 py-2.5 bg-emerald-600 text-white rounded-xl hover:bg-emerald-700 font-medium transition-colors",children:"Submit Review"})]})]})}),eG&&eU&&(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white rounded-2xl p-6 max-w-md w-full mx-4 shadow-xl",children:[(0,r.jsx)("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Call Summary"}),(0,r.jsx)(f.A,{className:"mb-4 !p-3",children:(0,r.jsxs)("div",{className:"text-sm text-gray-700 space-y-2",children:[(0,r.jsxs)("p",{children:["Duration:"," ",(()=>{let e=ti(eU);return null!==e?`${e} minutes`:"N/A"})()]}),(0,r.jsxs)("p",{children:["Quester:"," ",eU.callerName||eU.questerName||eU.callerEmail||"Quester"]}),(0,r.jsxs)("p",{children:["Rate:"," ",(()=>{let e=tn(eU);return null!==e?`$${e.toFixed(2)}/min`:"N/A"})()]}),(0,r.jsxs)("p",{children:["Earnings:"," ",(()=>{let e=(e=>{if(!e)return null;let t=[e.expertEarnings,e.earnings,e.expertPayout].find(e=>null!=e);if("number"==typeof t&&!Number.isNaN(t))return t;if("string"==typeof t&&""!==t.trim()){let e=Number.parseFloat(t);if(!Number.isNaN(e))return e}let a=(e=>{if(!e)return null;let t=[e.totalCost,e.cost,e.amountCharged].find(e=>null!=e);if("number"==typeof t&&!Number.isNaN(t))return t;if("string"==typeof t&&""!==t.trim()){let e=Number.parseFloat(t);if(!Number.isNaN(e))return e}let a=tn(e),r=ti(e);return null!==a&&null!==r?a*r:null})(e);return null!==a?.7*a:null})(eU);return null!==e?`$${e.toFixed(2)}`:"N/A"})()]})]})}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("button",{onClick:()=>{eQ(!1),tr()},className:"flex-1 px-4 py-2.5 bg-emerald-600 text-white rounded-xl hover:bg-emerald-700 font-medium transition-colors",children:"Ok"}),(0,r.jsx)("button",{onClick:()=>tt.push("/expert/earnings"),className:"flex-1 px-4 py-2.5 text-gray-600 border border-gray-200 rounded-xl hover:bg-gray-50 font-medium transition-colors",children:"View Earnings"})]})]})}),e$&&(0,r.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white rounded-2xl p-6 max-w-md w-full mx-4 shadow-xl",children:[(0,r.jsx)("div",{className:"text-center mb-4",children:(0,r.jsx)("div",{className:"inline-flex h-12 w-12 items-center justify-center rounded-2xl bg-blue-600 text-white",children:(0,r.jsx)(O.A,{className:"h-6 w-6"})})}),(0,r.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-3 text-center",children:"Setup Payout Method"}),(0,r.jsx)("p",{className:"text-gray-700 mb-3",children:"To receive your call earnings, you'll need to set up a payout method."}),(0,r.jsxs)("div",{className:"bg-blue-50 rounded-xl p-3 mb-4",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-blue-900 mb-2",children:"Choose how you get paid:"}),(0,r.jsxs)("ul",{className:"text-sm text-blue-800 space-y-1",children:[(0,r.jsxs)("li",{className:"flex items-center gap-2",children:[(0,r.jsx)(A.A,{className:"w-3.5 h-3.5 text-blue-600 flex-shrink-0"})," Stripe â bank transfer, fast & secure"]}),(0,r.jsxs)("li",{className:"flex items-center gap-2",children:[(0,r.jsx)(A.A,{className:"w-3.5 h-3.5 text-blue-600 flex-shrink-0"})," Crypto â USDC stablecoins, instant & global"]})]})]}),(0,r.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:"You can set this up now or later from Settings > Payout."}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("button",{onClick:async()=>{eM(!1),J("online");try{await Promise.all([(0,d.setDoc)((0,d.doc)(i.db,"experts",t.uid),{availability:"online",isAvailable:!0,status:"online"},{merge:!0}),(0,d.setDoc)((0,d.doc)(i.db,"users",t.uid),{availability:"online",isAvailable:!0,status:"online"},{merge:!0})])}catch(e){console.error("Error updating availability:",e),J("offline")}},className:"flex-1 px-4 py-2.5 bg-gray-200 hover:bg-gray-300 text-gray-900 rounded-xl font-medium transition-colors",children:"Setup Later"}),(0,r.jsx)("button",{onClick:()=>{eM(!1),tt.push("/settings/payout")},className:"flex-1 px-4 py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-medium transition-colors",children:"Setup Now"})]})]})})]})}},79993:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>g});var r=a(37876),s=a(14232),l=a(83411),i=a(38672),n=a(40570),o=a(40178),d=a(33049),c=a(67657),u=a(20485),m=a(98467),x=a(93889),p=a(28077),h=a(93704);function b(e){let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,h.cn)("animate-pulse rounded-md bg-primary/10",t),...a})}
4function g(){let[e,t]=(0,s.useState)(null),[a,h]=(0,s.useState)([]),[g,f]=(0,s.useState)(0),[y,v]=(0,s.useState)(!0);return((0,s.useEffect)(()=>{let e=null,a=(0,x.onAuthStateChanged)(m.auth,async a=>{if(a){let r,s=(0,u.doc)(m.db,"users",a.uid),l=await (0,u.getDoc)(s),i=l.data()?.role;if(t(i),"sales"===i)r=(0,u.query)((0,u.collection)(m.db,"callLogs"),(0,u.where)("callerId","==",a.uid));else if("expert"===i)r=(0,u.query)((0,u.collection)(m.db,"callLogs"),(0,u.where)("expertId","==",a.uid));else{h([]),f(0),v(!1);return}e=(0,u.onSnapshot)(r,e=>{let t=0,a=[];e.forEach(e=>{let r=e.data();t+=r.totalCost||0;let s=r.startTime?.seconds?new Date(1e3*r.startTime.seconds):new Date;a.push({date:s.toLocaleDateString(),duration:r.durationMinutes||0,cost:r.totalCost||0})}),h(a),f(t.toFixed(2)),v(!1)})}});return()=>{a(),e&&e()}},[]),y)?(0,r.jsxs)("div",{className:"space-y-4 mt-6",children:[(0,r.jsx)(b,{className:"h-6 w-40"}),(0,r.jsxs)(p.Zp,{children:[(0,r.jsx)(p.aR,{children:(0,r.jsx)(p.ZB,{children:(0,r.jsx)(b,{className:"h-6 w-32"})})}),(0,r.jsxs)(p.Wu,{className:"space-y-2",children:[(0,r.jsx)(b,{className:"h-4 w-full"}),(0,r.jsx)(b,{className:"h-4 w-full"}),(0,r.jsx)(b,{className:"h-4 w-full"})]})]})]}):0===a.length?(0,r.jsx)("p",{className:"text-center text-muted-foreground mt-6",children:"You have no call history yet."}):(0,r.jsxs)(p.Zp,{className:"dark:bg-[rgb(255_255_255/_0.03)] transition-all",children:[(0,r.jsx)(p.aR,{children:(0,r.jsx)(p.ZB,{className:"text-lg text-muted-foreground",children:"Call Duration Over Time"})}),(0,r.jsx)(p.Wu,{className:"h-[250px]",children:(0,r.jsx)(l.u,{width:"100%",height:"100%",children:(0,r.jsxs)(i.b,{data:a,children:[(0,r.jsx)(n.W,{dataKey:"date",stroke:"#888"}),(0,r.jsx)(o.h,{}),(0,r.jsx)(d.m,{}),(0,r.jsx)(c.N,{type:"monotone",dataKey:"duration",stroke:"#3b82f6",strokeWidth:2})]})})})]})}},81225:(e,t,a)=>{"use strict";a.d(t,{a:()=>n});var r=a(14232),s=a(20485),l=a(98467);let i=e=>e?e.toDate?e.toDate().getTime():e.seconds?1e3*e.seconds:e instanceof Date?e.getTime():new Date(e).getTime():0;function n(e){let[t,a]=(0,r.useState)(0);return(0,r.useEffect)(()=>{if(!e)return;let t=(0,s.collection)(l.db,"chats"),r=(0,s.query)(t,(0,s.where)("participants","array-contains",e)),n=(0,s.onSnapshot)(r,t=>{let r=0;t.forEach(t=>{let a=t.data();if(a.deletedFor&&a.deletedFor[e])return;let s=a[`unreadCount_${e}`];if("number"==typeof s){r+=Math.max(0,s);return}if(a.lastMessageSenderId&&a.lastMessageSenderId!==e){let t=i(a[`lastReadAt_${e}`]),s=i(a.lastMessageAt);s>0&&(0===t||s>t)&&(r+=1)}}),a(r)},e=>{console.error("useChatUnreadCount error:",e)});return()=>n()},[e]),t}},85704:(e,t,a)=>{"use strict";a.d(t,{A:()=>n});var r=a(37876),s=a(89099),l=a(48230),i=a.n(l);function n(e){let{tabs:t}=e,a=(0,s.useRouter)();return(0,r.jsx)("div",{className:"bg-white rounded-2xl shadow-sm p-1 mb-6 overflow-x-auto no-scrollbar",children:(0,r.jsx)("div",{className:"flex gap-1 min-w-max",children:t.map(e=>{let t=a.pathname===e.href;return(0,r.jsxs)(i(),{href:e.href,className:`relative px-4 py-2 text-sm font-medium rounded-xl whitespace-nowrap transition-colors ${t?"bg-emerald-50 text-emerald-700":"text-gray-500 hover:text-gray-700 hover:bg-gray-50"}`,children:[e.label,null!=e.badge&&e.badge>0&&(0,r.jsx)("span",{className:"ml-1.5 inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 text-[10px] font-bold leading-none text-white bg-red-500 rounded-full",children:e.badge>99?"99+":e.badge})]},e.href)})})})}},93704:(e,t,a)=>{"use strict";a.d(t,{cn:()=>l});var r=a(69241),s=a(29573);function l(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.QP)((0,r.$)(t))}},95273:(e,t,a)=>{"use strict";a.d(t,{A:()=>o});var r=a(37876),s=a(14232),l=a(98467),i=a(93889),n=a(20485);function o(e){let t,a,{role:o="quester"}=e,[d,c]=(0,s.useState)(null),[u,m]=(0,s.useState)(null),[x,p]=(0,s.use
4State)(!1),[h,b]=(0,s.useState)("");if((0,s.useEffect)(()=>{let e=(0,i.onAuthStateChanged)(l.auth,e=>c(e));return()=>e&&e()},[]),(0,s.useEffect)(()=>{if(!d)return;let e=(0,n.onSnapshot)((0,n.doc)(l.db,"users",d.uid),e=>{let t=e.data()||{};m({kycStatus:t.kycStatus||"not_started",kycRejectionReason:t.kycRejectionReason||null})},e=>{console.warn("[KycBanner] snapshot error:",e?.message)});return()=>e&&e()},[d]),!d||!u||"approved"===u.kycStatus)return null;let g=async()=>{if(d){p(!0),b("");try{let e=await d.getIdToken(),t=await fetch("/api/kyc/start",{method:"POST",headers:{Authorization:`Bearer ${e}`}}),a=await t.json();if(!t.ok||!a.url)throw Error(a?.error||"Failed to start verification");window.open(a.url,"_blank","noopener,noreferrer")||b("Popup blocked â please allow popups for this site, or click again.")}catch(e){b(e.message||"Could not start verification. Please try again.")}finally{p(!1)}}},f=u.kycStatus,y="quester"===o,v="Verify Now";"declined"===f?(t="â ï¸ Identity verification was declined",a=y?`We couldn't verify your identity. ${u.kycRejectionReason||""} Adding funds is paused until verification is complete. Try again or contact support.`:`We couldn't verify your identity. ${u.kycRejectionReason||""} Payouts are paused until verification is complete. Try again or contact support.`,v="Try Again"):"expired"===f?(t="â Identity verification expired",a=y?"Your identity verification expired. Please verify again to add funds.":"Your identity verification expired. Please verify again to receive payouts.",v="Verify Again"):"in_progress"===f?(t="â³ Identity verification in progress",a=y?"Your verification is being reviewed. Adding funds will be unlocked once approved (usually within minutes).":"Your verification is being reviewed. Payouts will be unlocked once approved (usually within minutes).",v="Continue Verification"):(t="\uD83E\uDEAA Identity verification required",a=y?"To add a payment method and start booking sessions, please complete a quick identity check (~2 minutes). Required for fraud prevention and compliance.":"To receive payouts, please complete a quick identity check (~2 minutes). Required by US tax and compliance regulations before any earnings can be paid out.");let w="declined"===f||"expired"===f;return(0,r.jsx)("div",{className:`mb-6 rounded-lg border p-4 ${w?"border-red-300 bg-red-50 dark:border-red-700 dark:bg-red-900/20":"border-amber-300 bg-amber-50 dark:border-amber-700 dark:bg-amber-900/20"}`,children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:`font-semibold ${w?"text-red-800 dark:text-red-300":"text-amber-900 dark:text-amber-300"}`,children:t}),(0,r.jsx)("p",{className:`text-sm mt-1 ${w?"text-red-700 dark:text-red-200":"text-amber-800 dark:text-amber-200"}`,children:a}),h&&(0,r.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300 mt-2",children:h})]}),(0,r.jsx)("button",{onClick:g,disabled:x,className:`shrink-0 px-4 py-2 rounded-lg text-sm font-medium text-white disabled:opacity-50 ${w?"bg-red-600 hover:bg-red-700":"bg-amber-600 hover:bg-amber-700"}`,children:x?"Openingâ¦":v})]})})}}},e=>{e.O(0,[9573,1552,7941,636,6593,8792],()=>e(e.s=68628)),_N_E=e.O()}]); 5//# sourceMappingURL=dashboard-cd80ed23a47f5aa8.js.map
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.