1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,675779,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(174080),s=e.i(647163);e.i(728231);var a=e.i(993899),i=e.i(86906);let l=(0,n.memo)(function({reactions:e,onReact:n}){return e.length?(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1 mt-0.5",children:e.map(e=>(0,t.jsxs)("button",{type:"button",className:(0,s.cn)("inline-flex items-center gap-1 rounded-xl border px-2 py-0.5 text-[11px] leading-none transition-all duration-150 min-w-[24px] justify-center",e.viewerReacted?"border-chart-1/60 bg-chart-1/10 dark:border-chart-1/50 dark:bg-chart-1/15 hover:bg-chart-1/15 dark:hover:bg-chart-1/20":"border-border bg-muted/50 hover:bg-muted dark:border-border dark:bg-muted/30 dark:hover:bg-muted/50"),onClick:()=>n?.(e.emoji,e.viewerReacted?"remove":"add"),title:`${e.emoji} ${e.count}`,children:[(0,t.jsx)("span",{className:"text-[13px] leading-none",children:e.emoji}),e.count>1&&(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground font-medium",children:e.count})]},e.emoji))}):null});e.s(["MessageReactions",0,l,"ReactionPicker",0,function({onReact:e,onClose:l,anchorRef:o}
1){let c=(0,i.usePaneContainer)(),[d,u]=(0,n.useState)({position:"fixed",zIndex:9999}),[m,p]=(0,n.useState)(!1),f=(0,n.useRef)(0);(0,n.useEffect)(()=>{f.current=Date.now()},[]),(0,n.useEffect)(()=>{if(!o.current)return;let e=o.current.getBoundingClientRect(),t=c?(0,i.findScaledFrame)(c):null;if(t){let n=t.scale,r=(e.top-t.rect.top)/n,s=(e.bottom-t.rect.top)/n,a=(e.left-t.rect.left)/n,i=t.height-s-8;u({position:"absolute",zIndex:9999,top:Math.max(8,Math.min(r-8>=i||i<360?r-360-8:s+8,t.height-360-8)),left:Math.max(8,Math.min(a,t.width-280-8))}),p(!0);return}p(!1);let n=window.visualViewport,r=n?n.height:window.innerHeight,s=n?n.width:window.innerWidth,a=n?n.offsetTop:0,l=n?n.offsetLeft:0,d={position:"fixed",zIndex:9999},m=e.top-a-8,f=a+r-e.bottom-8;m>=f||f<360?d.top=Math.max(a+8,Math.min(e.top-360-8,a+r-360-8)):d.top=Math.max(a+8,Math.min(e.bottom+8,a+r-360-8)),d.left=Math.max(l+8,Math.min(e.left,l+s-280-8)),u(d)},[o,c]);let h=(0,n.useCallback)(()=>{Date.now()-f.current<150||l()},[l]),x=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,s.cn)(m?"absolute":"fixed","inset-0 z-[9998]"),onClick:h}),(0,t.jsx)("div",{style:d,onClick:e=>e.stopPropagation(),children:(0,t.jsx)(a.EmojiPicker,{onSelect:t=>{e(t),l()},onClose:l})})]});return m&&c?(0,r.createPortal)(x,c):"u"<typeof document?x:(0,r.createPortal)(x,document.body)}])},764355,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(138108);let s=/(^|[^A-Za-z0-9_])@(\d{7,20})\b/g;function a(e,t){return t[e]??t[e.slice(-8)]}let i=(0,n.memo)(function({url:e}){let[r,s]=(0,n.useState)(null);if((0,n.useEffect)(()=>{let t=!1;return fetch(`/api/og-preview?url=${encodeURIComponent(e)}`).then(e=>e.ok?e.json():null).then(e=>{!t&&e&&(e.title||e.image)&&s(e)}).catch(()=>{}),()=>{t=!0}},[e]),!r)return null;let a=(()=>{try{return new URL(e).hostname.replace(/^www\./,"")}catch{return""}})();return(0,t.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg overflow-hidden border border-black/5 mt-1.5 mb-0.5 hover:opacity-90 transition-opacity",children:[r.image&&(0,t.jsx)("img",{src:r.image,alt:"",className:"w-full h-32 object-cover",onError:e=>{e.target.style.display="none"}}),(0,t.jsxs)("div",{className:"px-2.5 py-2 bg-black/[0.03]",children:[a&&(0,t.jsx)("p",{className:"text-[10px] text-gray-500 uppercase tracking-wide mb-0.5",children:a}),r.title&&(0,t.jsx)("p",{className:"text-xs font-medium text-gray-900 line-clamp-2",children:r.title}),r.description&&(0,t.jsx)("p",{className:"text-[11px] text-gray-500 line-clamp-2 mt-0.5",children:r.description})]})]})}),l=(0,n.memo)(function({text:e,mentionNames:l,inline:o=!1}){let c=(0,r.extractFirstUrl)(e),d=(0,n.useMemo)(()=>{if(!l||0===Object.keys(l).length)return[(0,t.jsx)(r.MessageText,{text:e},"t")];let n=[],i=0;for(let o of e.matchAll(s)){let s=o.index,c=o[1],d=o[2],u=s+c.length,m=s+o[0].length,p=a(d,l);p&&(u>i&&n.push((0,t.jsx)(r.MessageText,{text:e.slice(i,u)},`t-${i}`)),n.push((0,t.jsxs)("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:["@",p]},`m-${u}`)),i=m)}return i<e.length&&n.push((0,t.jsx)(r.MessageText,{text:e.slice(i)},`t-${i}`)),n.length>0?n:[(0,t.jsx)(r.MessageText,{text:e},"t")]},[e,l]);return o?(0,t.jsx)("span",{className:"whitespace-pre-wrap break-words [word-break:break-word] [overflow-wrap:anywhere]",children:d}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"whitespace-pre-wrap break-words [word-break:break-word] [overflow-wrap:anywhere]",children:d}),c&&(0,t.jsx)(i,{url:c})]})});e.s(["LinkifiedText",0,l,"substituteMentions",0,function(e,t){return e&&t&&0!==Object.keys(t).length?e.replace(s,(e,n,r)=>{let s=a(r,t);return s?`${n}@${s}`:e}):e}])},84020,471467,582994,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(691551),s=e.i(150513),a=e.i(831377),i=e.i(174080),l=e.i(401851),o=e.i(980797),c=e.i(383482),d=e.i(550516),u=e.i(82453),m=e.i(647163),p=e.i(340024),f=e.i(503116),h=e.i(643531),x=e.i(794771),g=e.i(541071),y=e.i(329006),b=e.i(788699),w=e.i(903659),j=e.i(37727),_=e.i(63209),v=e.i(199053),k=e.i(14050),N=e.i(190895),T=e.i(675779),C=e.i(403986),I=e.i(728231),S=e.i(764355),M=e.i(969878),R=e.i(158061),E=e.i(184189),D=e.i(777845),P=e.i(341256),O=e.i(625458),A=e.i(602944),L=e.i(609216);function U({src:e,onImageClick:n,onImageDoubleTap:r}){let a=(0,s.useDoubleTap)(()=>n?.(e),()=>r?.());return(0,t.jsx)("button",{type:"button",className:"inline-block rounded-lg cursor-pointer border-0 p-0 overflow-hidden align-top touch-manipulation focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-1",...a,children:(0,t.jsx)("img",{src:e,alt:"",className:"rounded-lg max-w-[280px] max-h-[280px] block",loading:"lazy"})})}function $({msg:e,onImageClick:n,onImageDoubleTap:r}){if(!e.media_type||!e.media_url)return null;switch(e.media_type){case"image":case"sticker":return(0,t.jsx)("div",{className:"mb-1",children:(0,t.jsx)(U,{src:e.media_url,onImageClick:n,onImageDoubleTap:r})});case"video":return(0,t.jsx)("div",{className:"mb-1",children:(0,t.jsx)(L.VideoPlayer,{src:e.media_url,className:"rounded-lg",videoClassName:"max-w-[280px] max-h-[280px]"})});case"audio":return(0,t.jsx)("div",{className:"mb-1",children:(0,t.jsx)(k.AudioPlayer,{src:e.media_url})});case"document":{let n=e.media_url.split("/").pop()||"",r=e.content&&e.content.trim()||n||"Download file";return(0,t.jsx)("div",{className:"mb-1",children:(0,t.jsx)(N.InlineDocumentPreview,{url:e.media_url,filename:r})})}default:return null}}function z({status:e}){if(!e)return null;switch(e){case"sending":return(0,t.jsx)(f.Clock,{className:"h-3 w-3 text-gray-400"});case"sent":return(0,t.jsx)(h.Check,{className:"h-3 w-3 text-gray-400"});case"delivered":return(0,t.jsx)(x.CheckCheck,{className:"h-3 w-3 text-gray-400"});case"read":return(0,t.jsx)(x.CheckCheck,{className:"h-3 w-3 text-blue-500"});case"failed":return(0,t.jsxs)(I.Tooltip,{children:[(0,t.jsx)(I.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-red-600 dark:text-red-400",children:[(0,t.jsx)(_.AlertCircle,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"text-[10px] font-medium",children:"Not delivered"})]})}),(0,t.jsx)(I.TooltipContent,{side:"top",children:"WhatsApp never confirmed delivery after 3 retries. Check the number is correct."})]});default:return null}}function H({replyTo:e,mentionNames:n}
1){return e?(0,t.jsxs)("button",{type:"button","data-reply-quote":!0,className:"mb-1.5 px-2 py-1 rounded-lg bg-black/5 dark:bg-white/10 border-l-2 border-green-600 dark:border-green-400 text-left cursor-pointer hover:bg-black/10 dark:hover:bg-white/15 transition-colors w-full",onClick:()=>{let t=e.messageId;t&&(0,D.jumpToThreadMessage)(t,{outline:"2px solid rgba(34, 197, 94, 0.4)"})},children:[(0,t.jsx)("p",{className:"text-[10px] font-semibold text-green-700 dark:text-green-300 truncate",children:e.name||"You"}),(0,t.jsx)("p",{className:"text-[11px] text-gray-700 dark:text-gray-200 truncate",children:(0,S.substituteMentions)(e.text,n)})]}):null}function q({reactions:e,onReact:n}){if(!e?.length)return null;let r=new Map;for(let t of e){let e=r.get(t.emoji);e?(e.count++,"me"===t.from&&(e.byMe=!0)):r.set(t.emoji,{count:1,byMe:"me"===t.from})}return(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1 mt-0.5",children:Array.from(r.entries()).map(([e,{count:r,byMe:s}])=>(0,t.jsxs)("button",{type:"button",className:(0,m.cn)("inline-flex items-center gap-1 rounded-xl border px-2 py-0.5 text-[11px] leading-none transition-all duration-150 min-w-[24px] justify-center",s?"border-chart-1/60 bg-chart-1/10 dark:border-chart-1/50 dark:bg-chart-1/15 hover:bg-chart-1/15 dark:hover:bg-chart-1/20":"border-border bg-muted/50 hover:bg-muted dark:border-border dark:bg-muted/30 dark:hover:bg-muted/50"),onClick:()=>n?.(s?"":e),title:`${e} ${r}`,children:[(0,t.jsx)("span",{className:"text-[13px] leading-none",children:e}),r>1&&(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground font-medium",children:r})]},e))})}let F=(0,n.memo)(function({msg:e,contactName:s,actions:o,inboundBg:c,isGroup:d,showSenderHeader:p,senderImageUrl:f,senderName:x,meImageUrl:_,meName:k,showMeHeader:N,mentionNames:C,replyRun:M=null}){let R,E=x||e.sender_name||null,D=(0,l.format)(new Date(e.sent_at),"h:mm a"),L=e.is_outbound,U="sending"===e._status,F=e.id.startsWith("temp-"),B=e.is_forwarded?(0,t.jsxs)("div",{className:"flex items-center gap-1 mb-0.5 text-[11px] italic text-gray-500 dark:text-gray-400",children:[(0,t.jsx)(v.Forward,{className:"h-3 w-3"}),"Forwarded"]}):null,V=/\.\w{2,4}$/.test(e.content||""),W=!!e.media_type&&!!e.media_url,Y=!!e.content&&!["Voice note","Image","Video","Video message","Sticker",""].includes(e.content)&&!(W&&V),[G,J]=(0,n.useState)(!1),[Q,K]=(0,n.useState)(null),X=(0,n.useRef)(null),[Z,ee]=(0,n.use
1State)(!1),[et,en]=(0,n.useState)(!1),[er,es]=(0,n.useState)(e.content),ea=(0,n.useRef)(null),ei=(0,n.useRef)(null),el=(0,n.useRef)(null),eo=(0,r.useMessageActionPill)(ei,L),ec=eo.touchProps,ed=eo.orientation,eu=(0,a.useSwipeReply)(o?.onReply?()=>o.onReply(e):void 0),em=L&&!F&&!e.is_deleted&&15>=(0,u.differenceInMinutes)(new Date,new Date(e.sent_at));(0,n.useEffect)(()=>{et&&el.current&&(el.current.focus(),el.current.style.height="auto",el.current.style.height=el.current.scrollHeight+"px")},[et]);let ep=(0,n.useCallback)(()=>{let e=X.current;if(!e)return;let t=e.getBoundingClientRect(),n=30*((em&&o?.onEdit?1:0)+ +!!o?.onDelete)+8;K({top:window.innerHeight-t.bottom<n+8?Math.max(8,t.top-n-4):Math.min(t.bottom+4,window.innerHeight-n-8),left:Math.min(Math.max(8,("above"===ed?!L:L)?t.left:t.right-120),window.innerWidth-120-8)}),J(!0)},[em,o,ed,L]);(0,n.useEffect)(()=>{if(!G)return;let e=()=>J(!1);return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[G]);let ef=()=>{er.trim()&&er!==e.content&&o?.onEdit?.({...e,content:er.trim()}),en(!1)};if(e.is_deleted)return(0,t.jsx)("div",{className:(0,m.cn)("flex transition-opacity duration-300",L?"justify-end":"justify-start"),children:(0,t.jsxs)("div",{className:(0,m.cn)("max-w-[75%] rounded-2xl px-3.5 py-2 text-sm italic text-gray-400",L?"rounded-br-md bg-[#D9FDD4] dark:bg-[#0a3a1f]":(0,m.cn)("oat-surface rounded-bl-md",c||"bg-[#F0EFED] dark:bg-muted")),children:[(0,t.jsx)("p",{children:"This message was deleted"}),(0,t.jsx)("div",{className:"flex items-center justify-end gap-1 mt-1",children:(0,t.jsx)("span",{className:"text-[10px] text-gray-400",children:D})})]})});let eh=!!d&&!L,ex=(E||"?").split(/\s+/).map(e=>e[0]||"").join("").slice(0,2).toUpperCase();return(0,t.jsxs)("div",{ref:ea,"data-wa-message-id":e.whatsapp_message_id??e.id,className:(0,m.cn)("group relative flex transition-opacity duration-200",L?"justify-end":"justify-start",U?"opacity-60":"opacity-100"),children:[e.reply_to&&(0,A.showsReplyQuote)(M??"solo")&&(0,t.jsx)(O.ReplyRunBracket,{side:L?"right":"left"}),eh&&(0,t.jsx)("div",{className:"w-7 mr-1.5 shrink-0 self-start pt-0.5",children:p?(R=f?(0,t.jsx)("img",{src:f,alt:E||"",className:"h-7 w-7 squircle object-cover",loading:"lazy"}):(0,t.jsx)("div",{className:"h-7 w-7 squircle bg-muted text-[10px] font-medium flex items-center justify-center text-muted-foreground",children:ex}),e.sender_contact_id?(0,t.jsx)("a",{href:`/people/${e.sender_contact_id}`,className:"block squircle focus:outline-none focus:ring-2 focus:ring-green-500","aria-label":`Open ${E||"sender"} profile`,children:R}):R):null}),(0,t.jsxs)("div",{className:(0,m.cn)("flex flex-col min-w-0 max-w-[75%]",L?"items-end":"items-start"),children:[Z&&o?.onReact&&(0,t.jsx)(T.ReactionPicker,{anchorRef:ea,onReact:t=>{o.onReact(e,t),ee(!1)},onClose:()=>ee(!1)}),d&&!L&&p&&E&&(e.sender_contact_id?(0,t.jsx)("a",{href:`/people/${e.sender_contact_id}`,className:"text-[11px] font-medium px-1 mb-0.5 hover:underline focus:outline-none focus:underline",style:{color:"var(--participant-color, hsl(var(--foreground)))"},children:E}):(0,t.jsx)("span",{className:"text-[11px] font-medium px-1 mb-0.5",style:{color:"var(--participant-color, hsl(var(--foreground)))"},children:E})),(0,A.showsReplyQuote)(M??(e.reply_to?"solo":null))&&(0,t.jsx)(H,{replyTo:e.reply_to,mentionNames:C}),et?(0,t.jsx)("div",{className:"flex flex-col gap-1 w-full",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("textarea",{ref:el,value:er,onChange:e=>{es(e.target.value),e.target.style.height="auto",e.target.style.height=e.target.scrollHeight+"px"},onKeyDown:e=>{let t=window.matchMedia("(max-width: 767px)").matches;"Enter"!==e.key||e.shiftKey||t||(e.preventDefault(),ef()),"Escape"===e.key&&en(!1)},className:"w-full rounded-lg border border-border/40 bg-muted/30 px-3 py-2 pb-8 text-sm resize-none outline-none min-w-[200px]",rows:1}),(0,t.jsxs)("div",{className:"absolute bottom-1.5 right-1.5 flex items-center gap-0.5",children:[(0,t.jsx)("button",{type:"button",title:"Cancel",onClick:()=>en(!1),className:"h-5 w-5 flex items-center justify-center rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(j.X,{className:"h-3 w-3"})}),(0,t.jsx)("button",{type:"button",title:"Save",onClick:ef,disabled:!er.trim(),className:"h-5 w-5 flex items-center justify-center rounded hover:bg-muted text-foreground transition-colors disabled:opacity-40",children:(0,t.jsx)(h.Check,{className:"h-3 w-3"})})]})]})}):(0,t.jsxs)("div",{ref:ei,className:"relative",onTouchStart:e=>{ec.onTouchStart(e),eu.onTouchStart(e)},onTouchMove:e=>{ec.onTouchMove(e),eu.onTouchMove(e)},onTouchEnd:()=>{ec.onTouchEnd(),eu.onTouchEnd()},onContextMenu:ec.onContextMenu,"data-reply-run-end":"end"===M||"solo"===M?"":void 0,children:[eu.isSwiping&&(0,t.jsx)("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 -translate-x-full pl-1 flex items-center",style:{opacity:eu.swipeProgress}
1,children:(0,t.jsx)(y.Reply,{className:"h-4 w-4 text-muted-foreground"})}),o&&!F&&(0,t.jsxs)(r.MessageActionPill,{revealed:eo.revealed,onDismiss:eo.dismiss,orientation:ed,isOutbound:L,forceVisible:G,hoverGroup:"group",children:[(0,t.jsx)(r.MessageStarButton,{channel:"whatsapp",messageId:e.id}),o.onReply&&(0,t.jsxs)(I.Tooltip,{children:[(0,t.jsx)(I.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:()=>o.onReply(e),className:"h-6 w-6 flex items-center justify-center squircle hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(y.Reply,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(I.TooltipContent,{side:"top",children:"Reply"})]}),o.onReact&&(0,t.jsxs)(I.Tooltip,{children:[(0,t.jsx)(I.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:()=>ee(!0),className:"h-6 w-6 flex items-center justify-center squircle hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(w.SmilePlus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(I.TooltipContent,{side:"top",children:"React"})]}),L&&(em||o.onDelete)&&(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)(I.Tooltip,{children:[(0,t.jsx)(I.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{ref:X,type:"button",onClick:()=>{G?J(!1):ep()},className:"h-6 w-6 flex items-center justify-center squircle hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(g.MoreHorizontal,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(I.TooltipContent,{side:"top",children:"More"})]}),G&&Q&&"u">typeof document&&(0,i.createPortal)((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-[60]",onClick:()=>J(!1)}),(0,t.jsxs)("div",{className:"fixed z-[61] bg-popover border rounded-md shadow-md py-1 min-w-[100px] w-[120px]",style:{top:Q.top,left:Q.left},children:[em&&o.onEdit&&(0,t.jsxs)("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent text-left",onClick:()=>{en(!0),es(e.content),J(!1)},children:[(0,t.jsx)(b.Pencil,{className:"h-3 w-3"})," Edit"]}),o.onDelete&&(0,t.jsxs)("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent text-left text-destructive",onClick:()=>{o.onDelete(e),J(!1)},children:[(0,t.jsx)(P.TrashIcon,{className:"h-3 w-3"})," Delete"]})]})]}),document.body)]})]}),Y?(0,t.jsxs)("div",{className:(0,m.cn)("rounded-2xl px-3.5 py-3.5 text-sm leading-relaxed text-gray-900 dark:text-gray-100 break-words [word-break:break-word] overflow-hidden",L?"rounded-br-md bg-[#D9FDD4] dark:bg-[#0a3a1f]":(0,m.cn)("oat-surface rounded-bl-md",c||"bg-[#F0EFED] dark:bg-muted")),style:eu.style,children:[B,(0,t.jsx)($,{msg:e,onImageClick:o?.onImageClick,onImageDoubleTap:eo.reveal}),(0,t.jsx)(S.LinkifiedText,{text:e.content,mentionNames:C}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1 mt-1",children:[e.is_edited&&(0,t.jsx)("span",{className:"text-[9px] text-gray-400 italic",children:"edited"}),(0,t.jsx)("span",{className:"text-[10px] text-gray-500",children:D}),L&&(0,t.jsx)(z,{status:e._status})]})]}):W?(0,t.jsxs)("div",{style:eu.style,className:(0,m.cn)("flex flex-col min-w-0",L?"items-end":"items-start"),children:[B,(0,t.jsx)($,{msg:e,onImageClick:o?.onImageClick,onImageDoubleTap:eo.reveal}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1 mt-1 px-1",children:[e.is_edited&&(0,t.jsx)("span",{className:"text-[9px] text-gray-400 italic",children:"edited"}),(0,t.jsx)("span",{className:"text-[10px] text-gray-500",children:D}),L&&(0,t.jsx)(z,{status:e._status})]})]}):(0,t.jsxs)("div",{className:(0,m.cn)("rounded-2xl px-3.5 py-3.5 text-sm leading-relaxed text-gray-900 dark:text-gray-100 break-words [word-break:break-word] overflow-hidden",L?"rounded-br-md bg-[#D9FDD4] dark:bg-[#0a3a1f]":(0,m.cn)("oat-surface rounded-bl-md",c||"bg-[#F0EFED] dark:bg-muted")),style:eu.style,children:[B,(0,t.jsx)("span",{className:"italic text-gray-500 dark:text-gray-400",children:("Image"===e.content?"Photo":e.content||"Attachment")+" - only on your phone"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1 mt-1",children:[(0,t.jsx)("span",{className:"text-[10px] text-gray-500",children:D}),L&&(0,t.jsx)(z,{status:e._status})]})]})]}),(0,t.jsx)(q,{reactions:e.reactions,onReact:o?.onReact?t=>o.onReact(e,t):void 0})]}),d&&L&&(0,t.jsx)("div",{className:"w-7 ml-1.5 shrink-0 self-start pt-0.5",children:N?_?(0,t.jsx)("img",{src:_,alt:k||"You",className:"h-7 w-7 squircle object-cover",loading:"lazy"}):(0,t.jsx)("div",{className:"h-7 w-7 squircle bg-muted text-[10px] font-medium flex items-center justify-center text-muted-foreground",children:(k||"Y").charAt(0).toUpperCase()}):null})]})},(e,t)=>
1{if(e.actions!==t.actions||e.contactName!==t.contactName||e.inboundBg!==t.inboundBg||e.isGroup!==t.isGroup||e.showSenderHeader!==t.showSenderHeader||e.senderImageUrl!==t.senderImageUrl||e.senderName!==t.senderName||e.meImageUrl!==t.meImageUrl||e.showMeHeader!==t.showMeHeader||e.mentionNames!==t.mentionNames||e.replyRun!==t.replyRun)return!1;let n=e.msg,r=t.msg;return n.id===r.id&&n.content===r.content&&n.is_forwarded===r.is_forwarded&&n._status===r._status&&n.is_edited===r.is_edited&&n.is_deleted===r.is_deleted&&n.media_url===r.media_url&&n.reply_to?.messageId===r.reply_to?.messageId&&n.reply_to?.name===r.reply_to?.name&&n.reply_to?.text===r.reply_to?.text&&n.reactions===r.reactions});async function B(e){try{var t;let n=await (t=e.blob,new Promise((e,n)=>{let r=new FileReader;r.onloadend=()=>{e(r.result.split(",")[1])},r.onerror=n,r.readAsDataURL(t)})),r=await fetch("/api/whatsapp/send-media",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phone:e.phone,conversationId:e.conversationId,data:n,mimetype:e.mimetype,filename:e.filename,caption:e.caption,ptt:e.ptt,contactId:e.contactId,workspaceId:e.workspaceId})});if(!r.ok){let e=await r.text().catch(()=>`HTTP ${r.status}`);return console.error("Send media failed:",r.status,e),{success:!1,error:`Send failed (${r.status}): ${e.slice(0,100)}`}}let s=await r.json();if(!s.success)return{success:!1,error:s.error||"Send failed on WhatsApp service"};return s}catch(e){return console.error("sendMediaToWhatsApp error:",e),{success:!1,error:e instanceof Error?e.message:"Unknown error"}}}e.s(["WhatsAppMessageList",0,function({messages:e,contactName:r,hasMore:s,loadingMore:a,onLoadMore:u,actions:f,emptyMessage:h,conversationKey:x,isGroup:g,meImageUrl:y,meName:b}){let w=(0,n.useRef)(null),j=(0,n.useRef)(null),_=(0,n.useRef)(null),v=(0,n.useRef)(new Set),k=(0,n.useRef)(0),N=(0,n.useRef)(!1),T=(0,n.useRef)(!0),[I,S]=(0,n.useState)(null),[D,P]=(0,n.useState)({}),[O,L]=(0,n.useState)({}),[U,$]=(0,n.useState)({}),z=(0,M.useScrollPinBottom)(w,j,T,x??e[0]?.id??null);(0,n.useMemo)(()=>(0,E.buildParticipantColorMap)(e.map(e=>({key:e.is_outbound?"__me__":e.sender_name||r,isOutbound:e.is_outbound}))),[e,r]),(0,n.useEffect)(()=>{if(!g)return;let t=[],n=new Map,r=[];for(let s of e){if(s.is_outbound)continue;let e=s.sender_jid;e&&(e in D||(t.includes(e)||t.push(e),s.sender_contact_id&&!n.has(e)?n.set(e,s.sender_contact_id):!s.sender_contact_id&&e.endsWith("@s.whatsapp.net")&&!n.has(e)&&!r.includes(e)&&r.push(e)))}if(0===t.length)return;let s=!1;return(async()=>{try{let e=t.slice(0,50),a=[...new Set(e.map(e=>n.get(e)).filter(e=>!!e))],i=r.filter(t=>e.includes(t)),[l,o,c]=await Promise.all([fetch("/api/whatsapp/profile-pictures",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jids:e})}),a.length>0?fetch("/api/contacts/avatars",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contactIds:a})}):Promise.resolve(null),i.length>0?fetch("/api/whatsapp/jid-contacts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jids:i})}):Promise.resolve(null)]),d=l.ok?await l.json():null,u=o&&o.ok?await o.json():null,m=c&&c.ok?await c.json():null;if(s)return;let p=d?.urls||{},f=u?.urls||{},h=u?.names||{},x=m?.contacts||{};P(t=>{let r={...t};for(let t of e){let e=p[t],s=n.get(t),a=s?f[s]:null,i=x[t]?.imageUrl??null;r[t]=e||a||i||""}return r}),L(t=>{let r={...t};for(let t of e){let e=n.get(t),s=e?h[e]:x[t]?.name??null;s&&(r[t]=s)}return r})}catch{}})(),()=>{s=!0}},[g,e,D]),(0,n.useEffect)(()=>{let t={};for(let n of e){if(n.is_outbound||!n.sender_jid||!n.sender_name)continue;let e=n.sender_jid.split("@")[0].replace(/\D/g,"");e&&!t[e]&&(t[e]=n.sender_name)}let n=/(?:^|[^A-Za-z0-9_])@(\d{7,20})\b/g,r=new Set;for(let s of e)for(let e of[s.content,s.reply_to?.text])if(e)for(let s of e.matchAll(n)){let e=s[1];!U[e]&&(t[e]||r.add(e))}if(Object.keys(t).length>0&&$(e=>{let n=!1,r={...e};for(let[e,s]of Object.entries(t))r[e]!==s&&(r[e]=s,n=!0);return n?r:e}),0===r.size)return;let s=!1;return(async()=>{try{let e=await fetch("/api/whatsapp/resolve-jids",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({digits:Array.from(r)})});if(!e.ok)return;let t=await e.json();if(s)return;let n=t?.names||{};$(e=>({...e,...n}))}catch{}})(),()=>{s=!0}},[e,U]);let H=(0,n.useMemo)(()=>({...f,onImageClick:e=>S(e)}),[f]),q=(0,n.useCallback)(()=>{let e=w.current;e&&(T.current=e.scrollHeight-e.scrollTop-e.clientHeight<200)},[]);if((0,n.useEffect)(()=>{let t=w.current;if(!t)return;let n=new Set(e.map(e=>e.id)),r=v.current,s=k.current;if(v.current=n,k.current=t.scrollHeight,!N.current){t.scrollTop=t.scrollHeight,N.current=!0;return}let a=e[e.length-1];if(!a||r.has(a.id)){let e=t.scrollHeight-s;e>0&&(t.scrollTop+=e);return}(a.is_outbound||T.current)&&(t.scrollTop=t.scrollHeight)},[e]),(0,n.useEffect)(()=>{let e=w.current,t=_.current;if(!e||!t||!u)return;let n=new IntersectionObserver(e=>{e[0]?.isIntersecting&&s&&!a&&u()},{root:e,threshold:.1});return n.observe(t),()=>n.disconnect()},[u,s,a]),0===e.length)return(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:h??"No messages yet. Send the first one!"});let B=[];for(let t of e){let e=new Date(t.sent_at),n=B[B.length-1];n&&(0,d.isSameDay)(n.date,e)?n.msgs.push(t):B.push({date:e,msgs:[t]})}let V=new Map;for(let e of B){let t=(0,A.replyRunPositions)(e.msgs,{target:e=>e.reply_to?.messageId,sender:e=>e.is_outbound?"out":`in:${e.sender_jid||e.sender_name||""}`});
1e.msgs.forEach((e,n)=>V.set(e.id,t[n]))}let W=I?[{url:I,mediaType:"image/jpeg",filename:"Image",size:0}]:[];return(0,t.jsxs)("div",{className:"flex-1 min-h-0 relative flex flex-col",children:[!z&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 bg-card pointer-events-none flex flex-col overflow-hidden",children:(0,t.jsx)(R.MessageListSkeleton,{})}),(0,t.jsx)("div",{ref:w,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden",onScroll:q,children:(0,t.jsxs)("div",{ref:j,className:(0,m.cn)(p.THREAD_GUTTER_X,"py-3 space-y-3"),children:[I&&"u">typeof document&&(0,i.createPortal)((0,t.jsx)(C.MediaPreviewModal,{media:W,initialIndex:0,onClose:()=>S(null)}),document.body),(0,t.jsx)("div",{ref:_,className:"h-1"}),a&&(0,t.jsx)("div",{className:"flex justify-center py-2",children:(0,t.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading older messages..."})}),!1===s&&e.length>0&&(0,t.jsx)("div",{className:"flex justify-center py-1",children:(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Beginning of conversation"})}),B.map(e=>{var n;return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex items-center justify-center my-2",children:(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--background)"},children:(n=e.date,(0,o.isToday)(n)?"Today":(0,c.isYesterday)(n)?"Yesterday":(0,l.format)(n,"d MMMM, yyyy"))})}),(0,t.jsx)("div",{className:"space-y-1.5","data-reply-run-scope":!0,children:e.msgs.map((n,s)=>{let a=V.get(n.id)??null,i=!1;if(g&&!n.is_outbound){let t=e.msgs[s-1];!t||t.is_outbound?i=!0:(t.sender_jid||t.sender_name||"")!==(n.sender_jid||n.sender_name||"")&&(i=!0)}let l=!1;if(g&&n.is_outbound){let t=e.msgs[s-1];t&&t.is_outbound||(l=!0)}let o=n.sender_jid?D[n.sender_jid]:void 0,c=n.sender_jid?O[n.sender_jid]??null:null;return(0,t.jsx)(F,{msg:n,contactName:r,actions:H,inboundBg:null,isGroup:g,showSenderHeader:i,senderImageUrl:void 0===o?void 0:o,senderName:c,showMeHeader:l,meImageUrl:y,meName:b,mentionNames:U,replyRun:a},n.id)})})]},e.date.toISOString())})]})})]})}],84020),e.s(["sendMediaToWhatsApp",0,B],471467);let V="wa_sync_triggered",W={status:"none",hasQR:!1},Y=null,G=null;function J(){return Y?Date.now()-Y.at>3e4?(Y=null,null):Y.state:null}async function Q(e){if(!e){let e=J();if(e)return e}return G||(G=(async()=>{try{let e=await fetch("/api/whatsapp/status"),t=await e.json(),n={status:t.status||"none",hasQR:!!t.hasQR};return Y={state:n,at:Date.now()},n}catch{return W}finally{G=null}})())}e.s(["useWhatsAppStatus",0,function(e){let t=J(),[r,s]=(0,n.useState)(t??W),{status:a,hasQR:i}=r,[l,o]=(0,n.useState)(!t),c=(0,n.useRef)(!1),d=(0,n.useRef)(null),u=(0,n.useRef)("none"),m=(0,n.useCallback)(async e=>{try{let t=await Q(!!e?.force);return s(t),t}finally{o(!1)}},[]),p=(0,n.useCallback)(async()=>{if(!c.current){c.current=!0;try{await fetch("/api/whatsapp/connect",{method:"POST"})}catch{}d.current=setInterval(async()=>{let e=(await m({force:!0})).status;("connected"===e||"none"===e||"logged_out"===e||"failed"===e)&&(d.current&&clearInterval(d.current),d.current=null,c.current=!1)},3e3),setTimeout(()=>{d.current&&(clearInterval(d.current),d.current=null,c.current=!1)},6e4)}},[m]);return(0,n.useEffect)(()=>(m(),()=>{d.current&&clearInterval(d.current)}),[m]),(0,n.useEffect)(()=>{i||("restorable"===a||"reconnecting"===a)&&p()},[a,i,p]),(0,n.useEffect)(()=>{let t="connected"!==u.current;if(u.current=a,"connected"===a&&t){if(sessionStorage.getItem(V))return;sessionStorage.setItem(V,"1"),setTimeout(()=>{fetch("/api/whatsapp/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:e?.workspaceId})}).catch(()=>{})},15e3)}},[a,e?.workspaceId]),{status:a,hasQR:i,needsScan:r.hasQR&&"connected"!==r.status,checking:l,checkStatus:m}}],582994)},456174,444256,e=>{"use strict";var t=e.i(271645),n=e.i(920755),r=e.i(48589);e.s(["useMergeVars",0,function(e){let[s,a]=(0,t.useState)({});return(0,t.useEffect)(()=>{let t=!1;return(async()=>{let s=(0,n.createClient)(),i={},{data:l}=await s.auth.getUser();if(l?.user){let{data:e}=await s.from("profiles").select("full_name, email, phone").eq("id",l.user.id).maybeSingle();
1if(e){let t=e.full_name||"",n=t.split(" ").filter(Boolean);i.owner_name=t,i.owner_first_name=n[0]||"",i.owner_last_name=n.slice(1).join(" ")||"",i.owner_email=e.email||"",i.owner_phone=e.phone||""}}if(e){let{data:t}=await s.from("contacts").select("first_name, last_name, nickname, name, email, phone, job_title, headline, location, linkedin_url, company:companies!contacts_company_id_fkey(name, domain, industry, employee_range, employee_count)").eq("id",e).maybeSingle();if(t){let e=t.company,n=Array.isArray(e)?e[0]:e;Object.assign(i,{first_name:(0,r.preferredFirstName)({nickname:t.nickname,firstName:t.first_name,fullName:t.name}),last_name:t.last_name||"",full_name:t.name||"",nickname:t.nickname||"",name:t.name||"",email:t.email||"",phone:t.phone||"",job_title:t.job_title||"",headline:t.headline||"",location:t.location||"",linkedin_url:t.linkedin_url||"",city:t.location?.split(",")[0]?.trim()||"",company_name:n?.name||"",company_domain:n?.domain||"",company_industry:n?.industry||"",company_size:n?.employee_range||(n?.employee_count!=null?n.employee_count.toLocaleString():"")})}}t||a(i)})(),()=>{t=!0}},[e]),s}],456174);let s=/\{\{(\w+)\}\}/g,a=/\{\{(\w+(?:\|\w+)+)\}\}/g,i=/\{\{#if\s+(\w+)\}\}([\s\S]*?)(?:\{\{else\}\}([\s\S]*?))?\{\{\/if\}\}/g;e.s(["resolveTemplateVars",0,function(e,t){let n=e.replace(i,(e,n,r,s)=>{let a=t[n];return a&&a.trim()?r:s??""});return(n=n.replace(a,(e,n)=>{for(let e of n.split("|")){let n=t[e];if(n&&n.trim())return n}return""})).replace(s,(e,n)=>t[n]??"")},"resolveTemplateVarsLenient",0,function(e,t){let n=e.replace(i,(e,n,r,s)=>{if(!(n in t))return e;let a=t[n];return a&&a.trim()?r:s??""});return(n=n.replace(a,(e,n)=>{let r=n.split("|");if(!r.some(e=>e in t))return e;for(let e of r){let n=t[e];if(n&&n.trim())return n}return""})).replace(s,(e,n)=>n in t?t[n]??"":e)}],444256)},923508,369680,724057,e=>{"use strict";var t=e.i(271645),n=e.i(920755);let r="typing";function s(e){return`utyping:${e}`}e.s(["TYPING_EVENT",0,r,"TYPING_IDLE_MS",0,5e3,"TYPING_REANNOUNCE_MS",0,3e3,"TYPING_TTL_MS",0,8e3,"resolveTypingChannel",0,function(e,t){return"whatsapp"===e||"imessage"===e||"linkedin"===e?e:"messages"===e&&"imessage"===t?"imessage":null},"typingTopic",0,s],369680);let a=new Set,i=null,l=null,o=0;function c(e=!1){if(e||(o=Math.max(0,o-1)),!e&&o>0)return;let t=(0,n.createClient)();i&&t.removeChannel(i),i=null,l=null}let d=null,u=null;e.s(["useTypingIndicator",0,function({channel:e,conversationId:m,userId:p,sendOverride:f}){let[h,x]=(0,t.useState)(!1),[g,y]=(0,t.useState)(d),b=p??g;(0,t.useEffect)(()=>{if(b)return;let e=!1;return(d?Promise.resolve(d):u??=(0,n.createClient)().auth.getUser().then(({data:e})=>d=e.user?.id??null).catch(()=>null)).then(t=>{e||y(t)}),()=>{e=!0}},[b]);let w=(0,t.useRef)(null),j=(0,t.useRef)(0),_=(0,t.useRef)(null),v=(0,t.useRef)(!1),k=!!e&&!!m,N=(0,t.useCallback)((e="composing")=>{(w.current&&clearTimeout(w.current),"paused"===e)?x(!1):(x(!0),w.current=setTimeout(()=>x(!1),8e3))},[]);(0,t.useEffect)(()=>{if(!k||!b)return;!function(e){if(o+=1,i&&l===e)return;i&&c(!0);let t=(0,n.createClient)();l=e,(i=t.channel(s(e),{config:{private:!0}})).on("broadcast",{event:r},({payload:e})=>{if(e&&1===e.v&&e.conversationId)for(let t of a)t(e)}).subscribe()}(b);let t=t=>{t.channel===e&&t.conversationId===m&&N(t.state)};return a.add(t),()=>{a.delete(t),c(),w.current&&clearTimeout(w.current),x(!1)}},[k,b,e,m,N]);let T=(0,t.useRef)(f);(0,t.useEffect)(()=>{T.current=f},[f]);let C=(0,t.useCallback)((t,n=!1)=>{if(e&&m){if(T.current)return void T.current(t);fetch("/api/messaging/typing",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:e,conversationId:m,state:t}),keepalive:n}).catch(()=>{})}},[e,m]),I=(0,t.useCallback)((e=!1)=>{_.current&&clearTimeout(_.current),_.current=null,v.current&&(v.current=!1,j.current=0,C("paused",e))},[C]),S=(0,t.useCallback)(()=>{if(!k)return;let e=Date.now();e-j.current>=3e3&&(j.current=e,v.current=!0,C("composing")),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>I(),5e3)},[k,C,I]);return(0,t.useEffect)(()=>{if(!k)return;let e=()=>{"hidden"===document.visibilityState&&I(!0)};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e),I(!0)}},[k,I]),{peerTyping:h,notifyTyping:S,stopTyping:I,markPeerTyping:N}}],923508);var m=e.i(843476);e.s(["TypingIndicator",0,function({name:e}){let t=e?.trim().split(/\s+/)[0]||"They";return(0,m.jsx)("div",{className:"flex justify-start px-1 pb-1","aria-live":"polite",children:(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("div",{className:"flex items-center gap-[3px] rounded-2xl border border-border bg-card px-3 py-2",children:[0,1,2].map(e=>(0,m.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-muted-foreground animate-bounce",style:{animationDelay:`${.15*e}s`,animationDuration:"1s"},"aria-hidden":!0},e))}),(0,m.jsxs)("span",{className:"sr-only",children:[t," is typing"]})]})})}],724057)},311652,e=>{"use strict";async function t(e,t){if(!t)return!0;try{let{data:n}=await e.auth.getSession(),r=n.session?.user?.id;return!r||r===t}catch{return!0}}e.s(["isOwnConnectionRow",0,t])},581438,e=>{"use strict";var t=e.i(395913),n=e.i(417955),r=e.i(542633),s=e.i(846696);let a=new Map,i=new Map;function l(e){let t=a.get(e.profileUrn);if(t)for(let n of[...t])n(e)}async function o(e,t,n){try{let r=await fetch("/api/linkedin/connect/persist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileUrn:e,contactId:t.contactId,workspaceId:t.
1workspaceId,status:"connected",connectedAt:n})});if(!r.ok)return!1;let s=await r.json();return!0===s.accepted}catch{return!1}}async function c(e,t,n){let a=await o(e,t,n);l({profileUrn:e,status:"connected",connectedAt:n}),a&&(await (0,r.ensurePreferences)(),(0,r.canDeliver)({event:"linkedin.connection_accepted",channel:"linkedin"},"toast")&&s.toast.success(t.label?`${t.label} accepted your connection request`:"Connection request accepted"))}async function d(e){let r,s=i.get(e);if(!s||s.settled||"u">typeof document&&document.hidden||!(0,t.isExtensionInstalled)())return;let a=null;try{let t=await (0,n.checkConnectionStatus)(e);r=t.status,a=t.connectedAt}catch{return}if("connected"!==r)return;let l=i.get(e);l&&!l.settled&&(l.settled=!0,await c(e,l.ctx,a))}e.s(["publishConnectionUpdate",0,l,"reportConnectionAccepted",0,c,"startConnectionPoll",0,function(e,t){if(!e)return()=>{};let n=i.get(e);if(n)n.refs+=1,t.label&&!n.ctx.label&&(n.ctx={...n.ctx,label:t.label}),t.contactId&&!n.ctx.contactId&&(n.ctx={...n.ctx,contactId:t.contactId});else{let n={refs:1,timer:null,settled:!1,ctx:t,onVisibility:()=>{document.hidden||d(e)}};n.timer=setInterval(()=>void d(e),2e4),document.addEventListener("visibilitychange",n.onVisibility),i.set(e,n)}let r=!1;return()=>{if(r)return;r=!0;let t=i.get(e);!t||(t.refs-=1,t.refs>0||(t.timer&&clearInterval(t.timer),document.removeEventListener("visibilitychange",t.onVisibility),i.delete(e)))}},"subscribeToConnection",0,function(e,t){if(!e)return()=>{};let n=a.get(e);return n||(n=new Set,a.set(e,n)),n.add(t),()=>{let n=a.get(e);n&&(n.delete(t),0===n.size&&a.delete(e))}}])},762836,e=>{"use strict";var t=e.i(920755),n=e.i(694533);let r=new Map,s=new Map;function a(e){return`li:${e}`}function i(e){let t=r.get(a(e));return t?Date.now()-t.timestamp>12e4?(r.delete(a(e)),null):t:null}function l(e,t,r){let s=e.filter(e=>{let t=new Date(e.sent_at).getTime();return!!(t&&!(t<864e5)&&(e.content||e.media_urls?.length>0))}),a=s.filter(e=>e.is_outbound&&"string"==typeof e.linkedin_message_id&&e.linkedin_message_id.startsWith("urn:"));return s.filter(e=>{let t=e.linkedin_message_id;return!t?.startsWith("outbound-")||!a.some(t=>(t.content===e.content||!e.content&&!t.content)&&1e4>Math.abs(new Date(t.sent_at).getTime()-new Date(e.sent_at).getTime()))}).map(e=>{let s=e.is_outbound,a=e.sender_linkedin_urn?.trim(),i=r&&a?(0,n.linkedinUrnsReferToSameEntity)(a,r)&&t||"":t||"",l=e.sender_name||(s?"You":i);return{id:e.id||e.linkedin_message_id,content:e.content,senderName:l,senderUrn:e.sender_linkedin_urn||"",senderPictureUrl:e.sender_picture_url??null,sentAt:e.sent_at,isOutbound:s,isDeleted:"deleted"===e.message_type,messageType:e.message_type||"text",media:e.media_urls??[],reactions:e.reactions??[],replyTo:e.reply_to??null}})}async function o(e,n,s,i){let o=(0,t.createClient)(),c=s.replace("urn:li:fsd_profile:",""),{data:d}=await o.from("linkedin_conversations").select("*").eq("workspace_id",n).eq("is_group",!1).or(`participant_linkedin_urn.eq.${s},participant_linkedin_urn.ilike.%${c}%`).order("last_message_at",{ascending:!1,nullsFirst:!1}).order("updated_at",{ascending:!1}).limit(1).maybeSingle();if(!d)return null;let{data:u}=await o.from("linkedin_messages").select("*").eq("conversation_id",d.id).order("sent_at",{ascending:!0}),m=l(u||[],i,d.participant_linkedin_urn),p={conversation:{id:d.id,linkedin_conversation_id:d.linkedin_conversation_id,participant_picture_url:d.participant_picture_url,last_synced_message_at:d.last_synced_message_at},messages:m,timestamp:Date.now()};return r.set(a(e),p),p}let c=new Map,d=new Map;function u(e){return`li-conv:${e}`}function m(e){let t=c.get(u(e));return t?Date.now()-t.timestamp>12e4?(c.delete(u(e)),null):t:null}async function p(e,n){let r=(0,t.createClient)(),{data:s}=await r.from("linkedin_conversations").select("*").eq("id",e).single();if(!s)return null;let{data:a}=await r.from("linkedin_messages").select("*").eq("conversation_id",e).order("sent_at",{ascending:!0}),i=l(a||[],n,s.participant_linkedin_urn),o={conversation:{id:s.id,linkedin_conversation_id:s.linkedin_conversation_id,participant_picture_url:s.participant_picture_url,last_synced_message_at:s.last_synced_message_at},messages:i,timestamp:Date.now()};return c.set(u(e),o),o}e.s(["getCachedConversation",0,i,"getCachedLinkedInByConversationId",0,m,"getLinkedInByConversationIdInflight",0,function(e){return d.get(u(e))},"prefetchLinkedInByConversationId",0,function(e){let t=u(e.conversationId);if(m(e.conversationId)||d.has(t))return;let n=p(e.conversationId,e.contactName).finally(()=>d.delete(t));d.set(t,n)},"prefetchLinkedInConversation",0,function(e){let t=a(e.contactId);if(i(e.contactId)||s.has(t))return;let n=o(e.contactId,e.workspaceId,e.profileUrn,e.contactName).finally(()=>s.delete(t));s.set(t,n)},"setCachedLinkedInByConversationId",0,function(e,t){c.set(u(e),{...t,timestamp:Date.now()})}])},837665,e=>{"use strict";e.s(["notifyVideoUploaded",0,function(e){try{window.dispatchEvent(new CustomEvent("boring-app-video-uploaded",{detail:e}))}catch{}}])},779784,e=>{"use strict";let t=(0,e.i(475254).default)("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);e.s(["default",0,t])}]);
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.