PageSourceSearch

https://www.efuturanetworks.com/_next/static/chunks/2347.5894d2400d22bcab.js

js efuturanetworks.com collected 2026-10-05 03:15:34 UTC 30,438 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2347,5866],{3485:(e,t,a)=>{"use strict";a.d(t,{G:()=>l,I:()=>u});var s=a(54568),n=a(7620),i=a(90008),c=a(74731);let r=(0,n.createContext)(null),l=()=>(0,n.useContext)(r),d={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302"]},{urls:"stun:stun.cloudflare.com:3478"}]},o=(e,t)=>i.supabase.schema("consumer").from("calls").update(t).eq("id",e).then(e=>{let{error:t}=e;t&&console.error("Call status update failed:",t)}),u=e=>{let{user:t,children:a}=e,[l,u]=(0,n.useState)("idle"),m=(0,n.useRef)("idle"),p=e=>{m.current=e,u(e)},[h,v]=(0,n.useState)(null),[b,f]=(0,n.useState)(!1),[x,g]=(0,n.useState)(0),[y,_]=(0,n.useState)(null),j=(0,n.useRef)(null),k=(0,n.useRef)(null),w=(0,n.useRef)(null),N=(0,n.useRef)(null),C=(0,n.useRef)(null),S=(0,n.useRef)(null),A=(0,n.useRef)(null),z=(0,n.useRef)(null),q=(0,n.useCallback)(()=>{var e,t;null==(e=j.current)||e.close(),j.current=null,null==(t=k.current)||t.getTracks().forEach(e=>e.stop()),k.current=null,N.current&&(i.supabase.removeChannel(N.current),N.current=null),A.current&&(clearInterval(A.current),A.current=null),z.current&&(clearTimeout(z.current),z.current=null),C.current=null,S.current=null,p("idle"),v(null),f(!1),g(0),_(null)},[]),I=(0,n.useCallback)(function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ended",a=C.current;null==(e=N.current)||e.send({type:"broadcast",event:"hangup",payload:{}}),a&&o(a,{status:t,ended_at:new Date().toISOString()}),q()},[q]),T=(0,n.useCallback)(()=>{var e;let t=new RTCPeerConnection(d);return j.current=t,t.onicecandidate=e=>{if(e.candidate){var t;null==(t=N.current)||t.send({type:"broadcast",event:"ice-candidate",payload:{candidate:e.candidate}})}},t.ontrack=e=>{w.current&&(w.current.srcObject=e.streams[0],w.current.play().catch(()=>{}))},t.onconnectionstatechange=()=>{"connected"===t.connectionState?(z.current&&(clearTimeout(z.current),z.current=null),p("connected"),A.current||(A.current=setInterval(()=>g(e=>e+1),1e3))):"failed"===t.connectionState?(alert("The call couldn't connect on this network."),I("ended")):("disconnected"===t.connectionState||"closed"===t.connectionState)&&I("ended")},null==(e=k.current)||e.getTracks().forEach(e=>t.addTrack(e,k.current)),t},[I]),D=(0,n.useCallback)((e,t)=>{let a=i.supabase.channel("call:".concat(e));return N.current=a,a.on("broadcast",{event:"accept"},async()=>{if("caller"!==t||!j.current)return;let e=await j.current.createOffer();await j.current.setLocalDescription(e),a.send({type:"broadcast",event:"offer",payload:{sdp:e}})}).on("broadcast",{event:"offer"},async e=>{let{payload:s}=e;if("callee"!==t||!j.current)return;await j.current.setRemoteDescription(new RTCSessionDescription(s.sdp));let n=await j.current.createAnswer();await j.current.setLocalDescription(n),a.send({type:"broadcast",event:"answer",payload:{sdp:n}})}).on("broadcast",{event:"answer"},async e=>{let{payload:a}=e;"caller"===t&&j.current&&await j.current.setRemoteDescription(new RTCSessionDescription(a.sdp))}).on("broadcast",{event:"ice-candidate"},async e=>{let{payload:t}=e;if(j.current)try{await j.current.addIceCandidate(new RTCIceCandidate(t.candidate))}catch(e){}}).on("broadcast",{event:"hangup"},()=>q()).subscribe(),a},[q]),E=(0,n.useCallback)(async(e,a)=>{if(!(null==t?void 0:t.id)||"idle"!==m.current)return;try{k.current=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){alert("Microphone access is required to make a call.");return}let{data:s,error:n}=await i.supabase.schema("consumer").from("calls").insert({caller_id:t.id,callee_id:e}).select("id").single();if(n||!s){var r;null==(r=k.current)||r.getTracks().forEach(e=>e.stop()),k.current=null,alert((null==n?void 0:n.code)==="42501"?"".concat(a," can't receive calls from you."):"The call couldn't be started.");return}let l=s.id;C.current=l,S.current=e,v(a),p("outgoing"),T(),D(l,"caller"),(0,c.s)({category:"calls",recipientId:e,title:"Incoming call",body:"",url:"/",tag:"call-".concat(l)}),z.current=setTimeout(()=>{C.current===l&&"outgoing"===m.current&&(alert("".concat(a," didn't answer.")),I("missed"))},3e4)},[t,T,D,I]),R=(0,n.useCallback)(async()=>
1{if(!y)return;let{callId:e,callerId:t,callerName:a}=y;try{k.current=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(t){alert("Microphone access is required to answer the call."),o(e,{status:"declined",ended_at:new Date().toISOString()}),_(null),p("idle");return}C.current=e,S.current=t,v(a),_(null),o(e,{status:"accepted",answered_at:new Date().toISOString()}),T();let s=D(e,"callee");await new Promise(e=>{let t=setInterval(()=>{"joined"===s.state&&(clearInterval(t),e())},50);setTimeout(()=>{clearInterval(t),e()},3e3)}),s.send({type:"broadcast",event:"accept",payload:{}}),p("outgoing")},[y,T,D]),M=(0,n.useCallback)(()=>{y&&(o(y.callId,{status:"declined",ended_at:new Date().toISOString()}),_(null),v(null),p("idle"))},[y]),P=(0,n.useCallback)(()=>{I("connected"===m.current?"ended":"cancelled")},[I]),O=(0,n.useCallback)(()=>{if(!k.current)return;let e=!b;k.current.getAudioTracks().forEach(t=>t.enabled=!e),f(e)},[b]),B=(0,n.useRef)(null);return(0,n.useEffect)(()=>{B.current=h},[h]),(0,n.useEffect)(()=>{if(!(null==t?void 0:t.id))return;let e=async e=>{if("idle"!==m.current)return void o(e.id,{status:"busy",ended_at:new Date().toISOString()});let{data:t}=await i.supabase.from("profiles").select("name").eq("id",e.caller_id).maybeSingle(),a=(null==t?void 0:t.name)||"SETX 360 member";_({callId:e.id,callerId:e.caller_id,callerName:a}),v(a),p("incoming")},a=i.supabase.channel("calls-".concat(t.id)).on("postgres_changes",{event:"INSERT",schema:"consumer",table:"calls",filter:"callee_id=eq.".concat(t.id)},t=>{let{new:a}=t;"ringing"===a.status&&e(a)}).on("postgres_changes",{event:"UPDATE",schema:"consumer",table:"calls",filter:"callee_id=eq.".concat(t.id)},e=>{let{new:t}=e;"ringing"!==t.status&&"accepted"!==t.status&&_(e=>(null==e?void 0:e.callId)===t.id?(p("idle"),v(null),null):e)}).on("postgres_changes",{event:"UPDATE",schema:"consumer",table:"calls",filter:"caller_id=eq.".concat(t.id)},e=>{let{new:t}=e;if(t.id===C.current&&"outgoing"===m.current&&("declined"===t.status||"busy"===t.status)){let e=B.current||"They";q(),alert("busy"===t.status?"".concat(e," is on another call."):"".concat(e," declined the call."))}}).subscribe();return i.supabase.schema("consumer").from("calls").select("id, caller_id, status, created_at").eq("callee_id",t.id).eq("status","ringing").gte("created_at",new Date(Date.now()-3e4).toISOString()).order("created_at",{ascending:!1}).limit(1).then(t=>{let{data:a}=t;(null==a?void 0:a[0])&&e(a[0])}),()=>{i.supabase.removeChannel(a)}},[null==t?void 0:t.id]),(0,s.jsxs)(r.Provider,{value:{callState:l,remoteName:h,isMuted:b,callDurationSec:x,startCall:E,acceptCall:R,declineCall:M,hangUp:P,toggleMute:O},children:[a,(0,s.jsx)("audio",{ref:w,autoPlay:!0,style:{display:"none"}})]})}},12347:(e,t,a)=>{"use strict";a.r(t),a.d(t,{PhoneView:()=>R});var s=a(54568),n=a(7620),i=a(96897),c=a(74624),r=a(84990),l=a(56178),d=a(50769),o=a(12119);let u=(0,o.A)("phone-outgoing",[["path",{d:"m16 8 6-6",key:"oawc05"}],["path",{d:"M22 8V2h-6",key:"oqy2zc"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]),m=(0,o.A)("phone-missed",[["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"m22 2-6 6",key:"6f0sa0"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]),p=(0,o.A)("phone-incoming",[["path",{d:"M16 2v6h6",key:"1mfrl5"}],["path",{d:"m22 2-6 6",key:"6f0sa0"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);var h=a(3485),v=a(35049),b=a(90008),f=a(16325),x=a(74731),g=a(6158),y=a(66694),_=a(63104),j=a(60844),k=a(73102),w=a(64751),N=a(99935),C=a(48065),S=a(65202),A=a(14502),z=a(51166),q=a(19146),I=a(26862),T=a(95355);a(87840);let D=new Set(["friends","proplus","gigs","classifieds","businesses","recent","
1interactions"]),E=e=>{let{onBack:t,hideHeader:a,hideRecentTab:i,hideTabs:c,onNavigate:l}=e,{user:d}=(0,g.n)(),[o,u]=(0,n.useState)(i?"friends":"recent"),[m,p]=(0,n.useState)(""),[h,E]=(0,n.useState)([]),[R,M]=(0,n.useState)([]),[P,O]=(0,n.useState)([]),[B,U]=(0,n.useState)([]),[W,X]=(0,n.useState)([]),[L,F]=(0,n.useState)([]),[G,J]=(0,n.useState)([]),[V,Y]=(0,n.useState)([]),[H,K]=(0,n.useState)(!0),[$,Q]=(0,n.useState)(!1),[Z,ee]=(0,n.useState)(!1),[et,ea]=(0,n.useState)(null),[es,en]=(0,n.useState)([]),[ei,ec]=(0,n.useState)(new Set);(0,n.useEffect)(()=>{er()},[o]);let er=async()=>{K(!0);try{if("friends"===o)if(d){let{data:e}=await b.supabase.from("friend_requests").select("*, sender:sender_id(id, name, avatar_url, role, community, is_verified, handle), receiver:receiver_id(id, name, avatar_url, role, community, is_verified, handle)").or("sender_id.eq.".concat(d.id,",receiver_id.eq.").concat(d.id)).eq("status","accepted");if(e){let t=e.map(e=>e.sender_id===d.id?e.receiver:e.sender);M(t)}else M([])}else M([]);else if("proplus"===o)if(d){let{data:e}=await b.supabase.from("pro_connections").select("*").or("requester_id.eq.".concat(d.id,",recipient_id.eq.").concat(d.id)).eq("status","accepted");if(e&&e.length>0){let t=e.map(e=>e.requester_id===d.id?e.recipient_id:e.requester_id),{data:a}=await b.supabase.from("profiles").select("id, name, avatar_url, role, is_verified, community, county, state, country").in("id",t);F(a||[])}else F([])}else F([]);else if("businesses"===o){let{data:e}=await b.supabase.from("profiles").select("id, name, avatar_url, role, is_verified, community, county, state, country").in("role",["vendor","business","restaurant","store"]).limit(20);U(e||[])}else if("civic"===o){let{data:e}=await b.supabase.schema("gov").from("civic_directory").select("*").limit(20);X(e||[])}else if("recent"===o)if(d){let{data:e}=await b.supabase.schema("consumer").from("messages").select("sender_id, receiver_id, content, created_at, media_url, media_type").or("sender_id.eq.".concat(d.id,",receiver_id.eq.").concat(d.id)).order("created_at",{ascending:!1}).limit(100),t=[],a={};if((e||[]).forEach(e=>{let s=e.sender_id===d.id?e.receiver_id:e.sender_id;a[s]||(t.push(s),a[s]={content:e.content,created_at:e.created_at,media_url:e.media_url,media_type:e.media_type})}),t.length>0){let{data:e}=await b.supabase.from("profiles").select("id, name, avatar_url").in("id",t),s=new Map((e||[]).map(e=>[e.id,e]));E(t.map(e=>{let t=s.get(e),n=a[e];return{id:e,name:(null==t?void 0:t.name)||"Unknown",avatar_url:null==t?void 0:t.avatar_url,lastMessage:(0,f.IL)(n),time:(0,v.m)(new Date(n.created_at),{addSuffix:!0})}}))}else E([])}else E([]);else if("interactions"===o)if(d){let[{data:e},{data:t}]=await Promise.all([b.supabase.from("rides").select("rider_id, driver_id").or("rider_id.eq.".concat(d.id,",driver_id.eq.").concat(d.id)).not("driver_id","is",null),b.supabase.from("orders").select("customer_id, driver_id").eq("fulfillment_type","delivery").or("customer_id.eq.".concat(d.id,",driver_id.eq.").concat(d.id)).not("driver_id","is",null)]),a=new Map;(e||[]).forEach(e=>{e.rider_id===d.id&&e.driver_id?a.set(e.driver_id,"Your driver"):e.rider_id&&a.set(e.rider_id,"Your rider")}),(t||[]).forEach(e=>{e.customer_id===d.id&&e.driver_id?a.set(e.driver_id,a.get(e.driver_id)||"Delivery driver"):e.customer_id&&a.set(e.customer_id,a.get(e.customer_id)||"Delivery customer")}),a.delete(d.id);let s=Array.from(a.keys());if(s.length){let{data:e}=await b.supabase.from("profiles").select("id, name, avatar_url, is_verified, community").in("id",s);O((e||[]).map(e=>({...e,role:a.get(e.id)})))}else O([])}else O([]);else if("gigs"===o)if(d){let{data:e}=await b.supabase.from("gigs").select("id").eq("requester_id",d.id),t=(null==e?void 0:e.map(e=>e.id))||[],a=new Set;if(t.length>0){let{data:e}=await b.supabase.from("gig_applications").select("applicant_id").in("gig_id",t);e&&e.forEach(e=>a.add(e.applicant_id))}let{data:s}=await b.supabase.from("gig_applications").select("gig_id").eq("applicant_id",d.id);if(s&&s.length>0){let e=s.map(e=>e.gig_id),{data:t}=await b.supabase.from("gigs").select("requester_id").in("id",e);
1t&&t.forEach(e=>a.add(e.requester_id))}if(a.size>0){let{data:e}=await b.supabase.from("profiles").select("id, name, avatar_url, role, is_verified, community, county, state, country").in("id",Array.from(a));J(e||[])}else J([])}else J([]);else if("classifieds"===o)if(d){let{data:e}=await b.supabase.schema("consumer").from("messages").select("sender_id, receiver_id").or("sender_id.eq.".concat(d.id,",receiver_id.eq.").concat(d.id)).ilike("content","%[Classifieds]%"),t=new Set;if(e&&e.forEach(e=>t.add(e.sender_id===d.id?e.receiver_id:e.sender_id)),t.size>0){let{data:e}=await b.supabase.from("profiles").select("id, name, avatar_url, role, is_verified, community, county, state, country").in("id",Array.from(t)),{data:a}=await b.supabase.from("friend_requests").select("*").or("sender_id.eq.".concat(d.id,",receiver_id.eq.").concat(d.id)).eq("status","accepted"),s=new Set((null==a?void 0:a.map(e=>e.sender_id===d.id?e.receiver_id:e.sender_id))||[]),n=(e||[]).filter(e=>!s.has(e.id));Y(n)}else Y([])}else Y([])}catch(e){console.error("Error fetching contacts:",e)}finally{K(!1)}},el=async()=>{ea(null),en([]);let e=navigator.contacts;if(!e||!window.ContactsManager)return void ea("Contact sync needs the Contact Picker API, which your browser doesn't support yet -- try Chrome on Android.");Q(!0),ee(!1);try{let a=await e.select(["name","tel"],{multiple:!0}),s=new Map;for(let e of a||[]){var t;let a=(null==(t=e.name)?void 0:t[0])||"Unknown";for(let t of e.tel||[]){let e=t.replace(/\D/g,"").replace(/^1(?=\d{10}$)/,"");e.length>=10&&s.set(e.slice(-10),a)}}if(0===s.size){Q(!1),ea("No phone numbers found in the contacts you picked.");return}let{data:n,error:i}=await b.supabase.rpc("match_contacts_by_phone",{digests:Array.from(s.keys())});if(i){Q(!1),ea("Something went wrong matching your contacts. Try again.");return}let c=(n||[]).map(e=>({...e,pickedName:s.get(e.matched_digest)}));en(c),Q(!1),ee(!0),setTimeout(()=>ee(!1),3e3)}catch(e){Q(!1),(null==e?void 0:e.name)!=="SecurityError"&&(null==e?void 0:e.name)!=="AbortError"&&ea("Something went wrong reading your contacts. Try again.")}},ed=async e=>{if(!d)return;let{error:t}=await b.supabase.from("friend_requests").insert({sender_id:d.id,receiver_id:e});ec(t=>new Set(t).add(e)),t||(0,x.s)({category:"friend_requests",recipientId:e,title:d.name||"New friend request",body:"".concat(d.name||"Someone"," sent you a friend request"),url:"/?env=contacts",tag:"friend-request-".concat(d.id)})},eo=(e,t)=>{if(H)return(0,s.jsx)("div",{className:"contacts-loading",children:(0,s.jsx)(j.A,{className:"animate-spin",size:32,color:"var(--primary)"})});if(0===e.length)return(0,s.jsx)("div",{className:"contacts-empty",children:(0,s.jsx)("p",{children:"No contacts found in this section."})});let a=D.has(t);return(0,s.jsx)("div",{className:"contacts-list",children:e.filter(e=>(e.name||e.title||"").toLowerCase().includes(m.toLowerCase())).map(e=>(0,s.jsxs)("div",{className:"contact-card glass",children:[(0,s.jsxs)("div",{className:"contact-info",onClick:a?()=>null==l?void 0:l("social",void 0,{userId:e.id}):void 0,style:a?{cursor:"pointer"}:void 0,children:["civic"===t?(0,s.jsx)("div",{className:"civic-icon-wrap",children:(0,s.jsx)(k.A,{size:24})}):(0,s.jsx)(_.e,{url:e.avatar_url,name:e.name,size:48}),(0,s.jsxs)("div",{className:"contact-details",children:[(0,s.jsx)("h3",{children:e.name||e.title}),"recent"===t&&(0,s.jsxs)("p",{className:"subtitle",children:[e.lastMessage?"".concat(e.lastMessage.slice(0,40)).concat(e.lastMessage.length>40?"…":""," • "):"",e.time]}),"interactions"===t&&(0,s.jsx)("p",{className:"subtitle",children:e.role}),"businesses"===t&&(0,s.jsx)("p",{className:"subtitle capitalize",children:e.role||"Business"}),"civic"===t&&(0,s.jsx)("p",{className:"subtitle",children:e.department||e.jurisdiction||"Civic Department"})]})]}),(0,s.jsx)(y.o,{contactId:a?e.id:void 0,phone:e.phone||e.custom_phone,name:e.name||e.title,callerId:null==d?void 0:d.id,size:"medium",onMessageClick:a?()=>null==l?void 0:l("messages",void 0,{chatId:e.id}):void 0})]},e.id))})};return(0,s.jsxs)("div",{className:"contacts-platform",children:[!a&&(0,s.jsxs)("header",{className:"contacts-header glass",children:[t&&(0,s.jsx)("button",{className:"back-btn",onClick:t,children:(0,s.jsx)(w.A,{size:24})}),(0,s.jsxs)("div",{className:"header-title-row",style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,s.jsx)("h1",{children:"Contacts"}),(0,s.jsxs)("button",{className:"sync-contacts-btn",onClick:el,disabled:$,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"20px",background:"var(--primary)",color:"white",border:"none",cursor:"pointer",fontWeight:600,fontSize:"0.9rem",transition:"all 0.3s"},children:[$?(0,s.jsx)(j.A,{size:16,className:"animate-spin"}):Z?(0,s.jsx)(N.A,{size:16}):(0,s.jsx)(C.A,{size:16}),$?"Syncing...":Z?"Synced!":"Sync Phone"]})]}),et&&(0,s.jsx)("div",{style:{margin:"0 16px 12px",padding:"10px 14px",borderRadius:"10px",background:"rgba(239,68,68,0.1)",color:"var(--text)",fontSize:"0.85rem"},children:et}),es.length>0&&(0,s.jsxs)("div",{style:{margin:"0 16px 12px",display:"flex",flexDirection:"column",gap:"8px"},children:[(0,s.jsxs)("p",{style:{fontSize:"0.85rem",fontWeight:700,margin:0},children:["Found ",es.length," of your contacts on SETX 360"]}),es.map(e=>(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderRadius:"10px",background:"var(--bg-card)",border:"1px solid var(--border)"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,s.jsx)(_.e,{url:e.avatar_url,name:e.name,size:32}),(0,s.jsx)("span",{style:{fontSize:"0.9rem",fontWeight:600},children:e.name})]}),(0,s.jsx)("button",{className:"ghost-btn",style:{padding:"4px 12px",fontSize:"0.8rem"},onClick:()=>ed(e.id),disabled:ei.has(e.id),children:ei.has(e.id)?"Requested":"Add Friend"})]},e.id))]}),Z&&0===es.length&&!et&&(0,s.jsx)("p",{style:{margin:"0 16px 12px",fontSize:"0.85rem",color:"var(--text-muted)"},children:"None of the contacts you picked are on SETX 360 yet."}),(0,s.jsxs)("div",{className:"contacts-search-wrap",children:[(0,s.jsx)(S.A,{size:20,className:"search-icon"}),(0,s.jsx)("input",{type:"text",placeholder:"Search contacts...",value:m,onChange:e=>p(e.target.value)})]}
1),!c&&(0,s.jsxs)("nav",{className:"contacts-tabs no-scrollbar",children:[!i&&(0,s.jsxs)("button",{className:"tab-btn ".concat("recent"===o?"active":""),onClick:()=>u("recent"),children:[(0,s.jsx)(A.A,{size:16})," Recent"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("friends"===o?"active":""),onClick:()=>u("friends"),children:[(0,s.jsx)(r.A,{size:16})," Friends"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("interactions"===o?"active":""),onClick:()=>u("interactions"),children:[(0,s.jsx)(z.A,{size:16})," Interactions"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("businesses"===o?"active":""),onClick:()=>u("businesses"),children:[(0,s.jsx)(q.A,{size:16})," Businesses"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("civic"===o?"active":""),onClick:()=>u("civic"),children:[(0,s.jsx)(k.A,{size:16})," Civic"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("proplus"===o?"active":""),onClick:()=>u("proplus"),children:[(0,s.jsx)(I.A,{size:16})," Connect"]})]})]}),a&&(0,s.jsxs)("div",{style:{padding:"0 16px",marginTop:"16px"},children:[(0,s.jsxs)("div",{className:"contacts-search-wrap",style:{marginBottom:"16px"},children:[(0,s.jsx)(S.A,{size:20,className:"search-icon"}),(0,s.jsx)("input",{type:"text",placeholder:"Search contacts...",value:m,onChange:e=>p(e.target.value)})]}),!c&&(0,s.jsxs)("nav",{className:"contacts-tabs no-scrollbar",style:{marginBottom:"0",paddingBottom:"8px"},children:[!i&&(0,s.jsxs)("button",{className:"tab-btn ".concat("recent"===o?"active":""),onClick:()=>u("recent"),children:[(0,s.jsx)(A.A,{size:16})," Recent"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("friends"===o?"active":""),onClick:()=>u("friends"),children:[(0,s.jsx)(r.A,{size:16})," Friends"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("interactions"===o?"active":""),onClick:()=>u("interactions"),children:[(0,s.jsx)(z.A,{size:16})," Interactions"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("businesses"===o?"active":""),onClick:()=>u("businesses"),children:[(0,s.jsx)(q.A,{size:16})," Businesses"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("civic"===o?"active":""),onClick:()=>u("civic"),children:[(0,s.jsx)(k.A,{size:16})," Civic"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("proplus"===o?"active":""),onClick:()=>u("proplus"),children:[(0,s.jsx)(I.A,{size:16})," Connect"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("gigs"===o?"active":""),onClick:()=>u("gigs"),children:[(0,s.jsx)(q.A,{size:16})," Gigs"]}),(0,s.jsxs)("button",{className:"tab-btn ".concat("classifieds"===o?"active":""),onClick:()=>u("classifieds"),children:[(0,s.jsx)(T.A,{size:16})," Classifieds"]})]})]}),(0,s.jsxs)("main",{className:"contacts-main-content no-scrollbar",children:["recent"===o&&eo(h,"recent"),"friends"===o&&eo(R,"friends"),"interactions"===o&&eo(P,"interactions"),"businesses"===o&&eo(B,"businesses"),"civic"===o&&eo(W,"civic"),"proplus"===o&&eo(L,"proplus"),"gigs"===o&&eo(G,"gigs"),"classifieds"===o&&eo(V,"classifieds")]})]})};a(14509);let R=e=>{let{user:t,onNavigate:a}=e,[o,f]=(0,n.useState)(""),[x,g]=(0,n.useState)("keypad"),[y,_]=(0,n.use
1State)([]),[j,k]=(0,n.useState)(!1);(0,n.useEffect)(()=>{"recents"===x&&t&&N()},[x,t]);let w=(0,h.G)(),N=async()=>{k(!0);let[{data:e},{data:a}]=await Promise.all([b.supabase.from("call_log").select("phone_number, display_name, created_at").eq("caller_id",t.id).order("created_at",{ascending:!1}).limit(50),b.supabase.schema("consumer").from("calls").select("id, caller_id, callee_id, status, created_at").or("caller_id.eq.".concat(t.id,",callee_id.eq.").concat(t.id)).order("created_at",{ascending:!1}).limit(50)]),s=Array.from(new Set((a||[]).map(e=>e.caller_id===t.id?e.callee_id:e.caller_id))),{data:n}=s.length?await b.supabase.from("profiles").select("id, name").in("id",s):{data:[]},i=new Map((n||[]).map(e=>[e.id,e.name])),c=[...(e||[]).map(e=>({kind:"dial",key:"d-".concat(e.phone_number),phone_number:e.phone_number,display_name:e.display_name,created_at:e.created_at,direction:"out"})),...(a||[]).map(e=>{let a=e.callee_id===t.id,s=a?e.caller_id:e.callee_id;return{kind:"app",key:"a-".concat(s),otherId:s,display_name:i.get(s)||"SETX 360 member",created_at:e.created_at,direction:a?"in":"out",missed:a&&["missed","cancelled","ringing"].includes(e.status)}})].sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()),r=new Set,l=[];for(let e of c)r.has(e.key)||(r.add(e.key),l.push(e));_(l),k(!1)},C=e=>{f(t=>t+e)},S=e=>{let a=e||o;a&&((null==t?void 0:t.id)&&b.supabase.rpc("find_profile_by_phone",{p_phone:a}).then(e=>{let{data:s}=e,n=null==s?void 0:s[0];b.supabase.from("call_log").insert({caller_id:t.id,callee_id:(null==n?void 0:n.id)||null,phone_number:a,display_name:(null==n?void 0:n.name)||null})}),window.location.href="tel:".concat(a))};return(0,s.jsxs)("div",{className:"phone-platform",children:[(0,s.jsxs)("div",{className:"phone-tabs",children:[(0,s.jsxs)("button",{className:"phone-tab ".concat("recents"===x?"active":""),onClick:()=>g("recents"),children:[(0,s.jsx)(c.A,{size:24}),(0,s.jsx)("span",{children:"Recents"})]}),(0,s.jsxs)("button",{className:"phone-tab ".concat("contacts"===x?"active":""),onClick:()=>g("contacts"),children:[(0,s.jsx)(r.A,{size:24}),(0,s.jsx)("span",{children:"Contacts"})]}),(0,s.jsxs)("button",{className:"phone-tab ".concat("keypad"===x?"active":""),onClick:()=>g("keypad"),children:[(0,s.jsxs)("div",{className:"keypad-icon",children:[(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"}),(0,s.jsx)("div",{className:"dot"})]}),(0,s.jsx)("span",{children:"Keypad"})]})]}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",padding:"4px 12px 0"},children:(0,s.jsx)(i._,{platform:"phone",label:"Who called me?",title:"Ask Sabine about your calls",context:{type:"phone",title:"Phone",text:"The user is in the Phone app. Use get_my_calls to answer who called or missed calls, and contact_person to call someone back."}})}),(0,s.jsxs)("div",{className:"phone-content",style:"contacts"===x?{overflow:"hidden"}:{},children:["keypad"===x&&(0,s.jsxs)("div",{className:"keypad-container",children:[(0,s.jsx)("div",{className:"number-display",children:(0,s.jsx)("h2",{children:(e=>{if(!e)return"";let t=(""+e).replace(/\D/g,""),a="";11===t.length&&t.startsWith("1")&&(a="1 ",t=t.slice(1));let s=t.match(/^(\d{0,3})(\d{0,3})(\d{0,4})$/);return s?a+(s[2]?"(".concat(s[1],") ").concat(s[2])+(s[3]?"-".concat(s[3]):""):s[1]):e})(o)||" "})}),(0,s.jsxs)("div",{className:"keypad-grid",children:[(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("1"),children:["1",(0,s.jsx)("span",{className:"letters"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("2"),children:["2",(0,s.jsx)("span",{className:"letters",children:"ABC"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("3"),children:["3",(0,s.jsx)("span",{className:"letters",children:"DEF"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("4"),children:["4",(0,s.jsx)("span",{className:"letters",children:"GHI"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("5"),children:["5",(0,s.jsx)("span",{className:"letters",children:"JKL"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("6"),children:["6",(0,s.jsx)("span",{className:"letters",children:"MNO"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("7"),children:["7",(0,s.jsx)("span",{className:"letters",children:"PQRS"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("8"),children:["8",(0,s.jsx)("span",{className:"letters",children:"TUV"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("9"),children:["9",(0,s.jsx)("span",{className:"letters",children:"WXYZ"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("*"),children:["*",(0,s.jsx)("span",{className:"letters"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("0"),children:["0",(0,s.jsx)("span",{className:"letters",children:"+"})]}),(0,s.jsxs)("button",{className:"keypad-btn",onClick:()=>C("#"),children:["#",(0,s.jsx)("span",{className:"letters"})]})]}),(0,s.jsxs)("div",{className:"keypad-actions",children:[(0,s.jsx)("div",{style:{width:64}})," ",(0,s.jsx)("button",{className:"call-btn-large",onClick:()=>S(),children:(0,s.jsx)(l.A,{size:32,color:"#fff"})}),(0,s.jsx)("button",{className:"delete-btn",onClick:()=>{f(e=>e.slice(0,-1))},disabled:!o,children:o&&(0,s.jsx)(d.A,{size:28})})]})]}),"recents"===x&&(0,s.jsx)("div",{className:"recents-container",style:{height:"100%",overflow:"auto",padding:"8px 16px"},children:j?(0,s.jsx)("div",{style:{display:"flex",justifyContent:"center",padding:"32px"},children:(0,s.jsx)(c.A,{className:"animate-spin",size:24})}):0===y.length?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"48px 24px",opacity:.7},children:[(0,s.jsx)(u,{size:36,style:{margin:"0 auto 12px",opacity:.5}}),(0,s.jsx)("p",{children:"No calls yet. Dial a number or call a contact to see it here."})]}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:y.map(e=>(0,s.jsxs)("div",{onClick:()=>(e=>{"app"===e.kind&&e.otherId&&w?w.startCall(e.otherId,e.display_name||"SETX 360 member"):e.phone_number&&S(e.phone_number)})(e),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 8px",borderBottom:"1px solid var(--border)",cursor:"pointer"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(0,s.jsx)("div",{style:{width:40,height:40,borderRadius:"50%",background:"var(--bg-card)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.missed?(0,s.jsx)(m,{size:18,color:"#ef4444"}):"in"===e.direction?(0,s.jsx)(p,{size:18,color:"var(--primary)"}):(0,s.jsx)(u,{size:18,color:"var(--primary)"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:600,color:e.missed?"#ef4444":void 0},children:e.display_name||e.phone_number}),(0,s.jsxs)("div",{style:{fontSize:"0.75rem",opacity:.6},children:["app"===e.kind?e.missed?"Missed \xb7 ":"in"===e.direction?"Incoming \xb7 ":"Outgoing \xb7 ":"",(0,v.m)(new Date(e.created_at),{addSuffix:!0})]})]})]}),(0,s.jsx)(l.A,{size:18,color:"var(--primary)"})]},e.key))})}),"contacts"===x&&(0,s.jsx)("div",{className:"contacts-container",style:{height:"100%",overflow:"auto"},children:(0,s.jsx)(E,{hideHeader:!1,hideRecentTab:!0,onNavigate:a})})]})]})}},14509:()=>{},66694:(e,t,a)=>{"use strict";a.d(t,{o:()=>d});var s=a(54568);a(7620);var n=a(56178),i=a(20415),c=a(90008),r=a(3485),l=a(16325);a(93979);let d=e=>{let{contactId:t,phone:a,name:d,callerId:o,onMessageClick:u,onCallClick:m,size:p="medium"}=e,h=(0,r.G)();return(0,s.jsxs)("div",{className:"contact-action-buttons size-".concat(p),children:[(0,s.jsx)("button",{className:"action-btn call-btn",onClick:e=>{e.stopPropagation(),m?m():t&&h?h.startCall(t,d||"SETX 360 user"):a&&(o&&c.supabase.from("call_log").insert({caller_id:o,callee_id:t||null,phone_number:a,display_name:d||null}),window.location.href="tel:".concat(a))},title:"Call",children:(0,s.jsx)(n.A,{size:"small"===p?16:"medium"===p?20:24})}),(u||t)&&(0,s.jsx)("button",{className:"action-btn message-btn",onClick:e=>{e.stopPropagation(),u?u():t&&(0,l.JJ)(t)},title:"Message",children:(0,s.jsx)(i.A,{size:"small"===p?16:"medium"===p?20:24})})]})}},87840:()=>{},93979:()=>{}}]);

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.