1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3466],{37872:(e,t,s)=>{s.d(t,{GI:()=>b,GS:()=>g,NB:()=>d,WI:()=>c,k2:()=>m,pS:()=>x,zg:()=>u});var a=s(9829),n=s(60349),r=s(37904);let l="chat_guest_id",i="chat_guest_token",o="chat_guest_verified",c=async(e,t)=>(await fetch("".concat((0,r.bj)(),"/messaging/guest-otp/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,mobile:t})})).json(),d=async(e,t)=>(await fetch("".concat((0,r.bj)(),"/messaging/guest-otp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mobile:e,otp:t})})).json(),x=()=>"1"===sessionStorage.getItem(o),u=async(e,t)=>{let s=sessionStorage.getItem(l)||void 0,a=await fetch("".concat((0,r.bj)(),"/messaging/guest-session"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guestId:s,name:e,phone:t})});if(!a.ok)throw Error("Failed to start guest chat session");let n=await a.json();return sessionStorage.setItem(l,n.guestId),sessionStorage.setItem(i,n.token),sessionStorage.setItem("chat_guest_name",n.name||""),sessionStorage.setItem("chat_guest_phone",n.phone||""),sessionStorage.setItem(o,"1"),n},m=async()=>{let e=(0,n.c4)()||(0,n.dt)();if(e)return e;let t=sessionStorage.getItem(i);if(t&&x())return t;throw Error("Guest chat requires a verified session â call startVerifiedGuestSession first")},h=null,p=null,g=()=>(null==h?void 0:h.connected)?Promise.resolve(h):p||(p=(async()=>{let e=await m(),{url:t,path:s}=(()=>{let e=new URL((0,r.bj)());return{url:e.origin,path:/^\/api(\/|$)/.test(e.pathname)?"/api/socket.io/":"/socket.io/"}})(),n=(0,a.io)(t,{path:s,auth:{token:e,clientId:(0,r._t)().id},transports:["websocket","polling"]});return await new Promise((e,t)=>{n.once("connect",()=>e()),n.once("connect_error",e=>t(e))}),h=n,p=null,n})()),f=0,b=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a="".concat(Date.now(),"-").concat(f++);return new Promise((n,r)=>{let l="".concat(t,":response"),i=t=>{t.requestId===a&&(e.off(l,i),t.error?r(Error(t.error)):n(t.data))};e.on(l,i),e.emit(t,{...s,requestId:a})})}},61778:(e,t,s)=>{s.d(t,{H:()=>n});var a=s(12115);function n(){let[e,t]=(0,a.useState)(!1),s=(0,a.useCallback)(()=>t(e=>!e),[]),n=(0,a.useCallback)(()=>t(!1),[]);return(0,a.useEffect)(()=>{if(!e)return;let s=e=>{"Escape"===e.key&&t(!1)},a=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s),document.body.style.overflow=a}},[e]),{isFullscreen:e,toggle:s,exit:n}}},86408:(e,t,s)=>{s.d(t,{A:()=>F});var a=s(95155),n=s(12115),r=s(30643),l=s(71408),i=s(33636),o=s(50470),c=s(44371),d=s(61586),x=s(28368),u=s(47538),m=s(24722),h=s(89559),p=s(37354),g=s(65229),f=s(5937),b=s(24033),w=s(14285),j=s(18085);let v={green:{bubbleGradient:"from-green-500 to-emerald-600",bubbleShadow:"shadow-emerald-900/15",focusBorder:"focus:border-green-500",focusRing:"focus:ring-green-500/15",sendGradient:"from-green-500 to-emerald-600",sendShadow:"shadow-green-600/30",emptyIconBg:"bg-green-50 text-green-600",viewChipText:"text-green-700",viewChipHoverBg:"hover:bg-green-50"},indigo:{bubbleGradient:"from-indigo-500 to-violet-600",bubbleShadow:"shadow-indigo-900/15",focusBorder:"focus:border-indigo-500",focusRing:"focus:ring-indigo-500/15",sendGradient:"from-indigo-500 to-violet-600",sendShadow:"shadow-indigo-600/30",emptyIconBg:"bg-indigo-50 text-indigo-600",viewChipText:"text-indigo-700",viewChipHoverBg:"hover:bg-indigo-50"}},y=(0,n.createContext)("green"),N=(0,n.createContext)(new Map),C=(0,n.createContext)(new Map),k=(0,n.createContext)(new Map),S=(0,n.createContext)(void 0),E=e=>e?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",_={initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18}},R=e=>{let{attachment:t,compact:s=!1}=e;return(0,a.jsxs)("table",{className:"".concat(s?"text-[11px]":"text-xs"," w-full border-collapse"),children:[(0,a.jsx)("thead",{className:"sticky top-0 bg-slate-50",children:(0,a.jsx)("tr",{children:t.headers.map((e,t)=>(0,a.jsx)("th",{className:"px-2 py-1.5 text-left font-medium text-slate-600 border-b border-slate-100 whitespace-nowrap",children:e||"Column ".concat(t+1)},t))})}),(0,a.jsx)("tbody",{children:t.rows.map((e,t)=>(0,a.jsx)("tr",{className:t%2?"bg-slate-50/60":"",children:e.map((e,t)=>(0,a.jsx)("td",{className:"px-2 py-1 text-slate-600 border-b border-slate-50 whitespace-nowrap",children:null==e||""===e?"â":String(e)},t))},t))})]})},A=e=>{let{attachment:t,onReplace:s}
1=e,[i,o]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1),[x,u]=(0,n.useState)(null),f=(0,n.useRef)(null),b=v[(0,n.useContext)(y)],w=(0,n.useContext)(S);(0,n.useEffect)(()=>{if(!i)return;let e=e=>{"Escape"===e.key&&o(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[i]);let j=async e=>{var t;let a=null==(t=e.target.files)?void 0:t[0];if(e.target.value="",a&&s){u(null),d(!0);try{await s(a)}catch(e){u(e instanceof Error?e.message:"Failed to replace attachment")}finally{d(!1)}}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(r.P.div,{..._,className:"max-w-[82%] w-full rounded-2xl border border-slate-200 bg-white shadow-sm shadow-slate-900/5 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 px-3.5 py-3",children:[(0,a.jsx)("div",{className:"h-9 w-9 shrink-0 rounded-lg bg-slate-100 flex items-center justify-center text-slate-500",children:(0,a.jsx)(m.A,{size:17})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-slate-700 truncate",children:t.filename}),(0,a.jsxs)("p",{className:"text-[10px] text-slate-400",children:[t.rowCount," row",1===t.rowCount?"":"s"," received"]})]}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{ref:f,type:"file",accept:".xlsx,.xls,.csv",className:"hidden",onChange:j}),(0,a.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=f.current)?void 0:e.click()},disabled:c,title:c?"Replacingâ¦":"Replace with a new file","aria-label":"Replace with a new file",className:"shrink-0 p-1.5 rounded-full text-slate-400 hover:text-slate-600 hover:bg-slate-100 transition-colors disabled:opacity-40",children:(0,a.jsx)(h.A,{size:13,className:c?"animate-spin":""})})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>o(!0),className:"shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-medium ".concat(b.viewChipText," ").concat(b.viewChipHoverBg," transition-colors"),children:[(0,a.jsx)(p.A,{size:12}),"View"]}
1)]}),x&&(0,a.jsx)("div",{className:"px-3.5 pb-2.5 -mt-1 text-[10px] text-red-600",children:x})]}),(0,a.jsx)(l.N,{children:i&&(0,a.jsxs)(r.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-50 bg-white flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 sm:px-6 py-3.5 border-b border-slate-100 shrink-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)(m.A,{size:16,className:"text-slate-500 shrink-0"}),(0,a.jsx)("h2",{className:"text-sm sm:text-base font-semibold text-slate-800 truncate",children:t.filename}),(0,a.jsxs)("span",{className:"text-xs text-slate-400 shrink-0",children:[t.rowCount," row",1===t.rowCount?"":"s"]})]}),w&&(0,a.jsxs)("p",{className:"text-xs text-slate-400 mt-0.5 ml-[22px] truncate",children:["From chat with ",w]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>o(!1),"aria-label":"Close",className:"shrink-0 p-2 rounded-full hover:bg-slate-100 transition-colors text-slate-500",children:(0,a.jsx)(g.A,{size:20})})]}),t.truncated&&(0,a.jsx)("div",{className:"px-4 sm:px-6 py-2 text-xs text-brand2-700 bg-brand2-50 border-b border-brand2-100 shrink-0",children:"This preview is capped - the original sheet has more rows/columns than shown here."}),(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:(0,a.jsx)(R,{attachment:t})})]})})]})},P=e=>{let{image:t}=e,[s,i]=(0,n.useState)(!1),o=(0,n.useContext)(S);return(0,n.useEffect)(()=>{if(!s)return;let e=e=>{"Escape"===e.key&&i(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.P.button,{..._,type:"button",onClick:()=>i(!0),className:"block max-w-[220px] rounded-2xl overflow-hidden border border-slate-200 shadow-sm shadow-slate-900/5",children:(0,a.jsx)("img",{src:t.url,alt:"Shared photo",className:"block w-full h-auto max-h-64 object-cover"})}),(0,a.jsx)(l.N,{children:s&&(0,a.jsxs)(r.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-50 bg-black/90 flex flex-col",onClick:()=>i(!1),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 sm:px-6 py-3.5 shrink-0",children:[(0,a.jsx)("p",{className:"text-xs text-white/70 truncate",children:o?"From chat with ".concat(o):"Photo"}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),i(!1)},"aria-label":"Close",className:"shrink-0 p-2 rounded-full hover:bg-white/10 transition-colors text-white",children:(0,a.jsx)(g.A,{size:20})})]}),(0,a.jsx)("div",{className:"flex-1 min-h-0 flex items-center justify-center px-4 pb-4",children:(0,a.jsx)("img",{src:t.url,alt:"Shared photo",className:"max-w-full max-h-full object-contain",onClick:e=>e.stopPropagation()})})]})})]})},I=()=>{let e=(0,i.JX)(e=>e.createdAt),t=(0,i.JX)(e=>e.id),s=v[(0,n.useContext)(y)],l=(0,n.useContext)(N),c=(0,n.useContext)(C),d=(0,n.useContext)(k),x=l.get(t),u=c.get(t),m=d.get(t),h=u?u.hasCaption:!m||m.hasCaption;return(0,a.jsxs)(o.QF.Root,{className:"flex flex-col items-end mb-3.5 gap-1.5",children:[x&&(0,a.jsx)("span",{className:"text-[10px] font-medium text-slate-400 mr-1 -mb-1",children:x}),h&&(0,a.jsx)(r.P.div,{..._,className:"max-w-[82%] min-w-0 break-words rounded-2xl rounded-br-md bg-gradient-to-br ".concat(s.bubbleGradient," text-white px-3.5 py-2.5 text-sm leading-relaxed shadow-md ").concat(s.bubbleShadow),children:(0,a.jsx)(o.QF.Content,{})}),u&&(0,a.jsx)(A,{attachment:u.attachment,onReplace:u.onReplace}),m&&(0,a.jsx)(P,{image:m.image}),(0,a.jsx)("span",{className:"text-[10px] text-slate-400 mr-1",children:E(e)})]})},z=()=>{let e=(0,i.JX)(e=>e.createdAt),t=(0,i.JX)(e=>e.id),s=(0,n.useContext)(N),l=(0,n.useContext)(C),c=(0,n.useContext)(k),d=s.get(t),x=l.get(t),u=c.get(t),m=x?x.hasCaption:!u||u.hasCaption;return(0,a.jsxs)(o.QF.Root,{className:"flex flex-col items-start mb-3.5 gap-1.5",children:[d&&(0,a.jsx)("span",{className:"text-[10px] font-medium text-slate-400 ml-1 -mb-1",children:d}),m&&(0,a.jsx)(r.P.div,{..._,className:"max-w-[82%] min-w-0 break-words rounded-2xl rounded-bl-md bg-white text-slate-700 px-3.5 py-2.5 text-sm leading-relaxed shadow-sm shadow-slate-900/5 ring-1 ring-slate-100",children:(0,a.jsx)(o.QF.Content,{})}),x&&(0,a.jsx)(A,{attachment:x.attachment,onReplace:x.onReplace}),u&&(0,a.jsx)(P,{image:u.image}),(0,a.jsx)("span",{className:"text-[10px] text-slate-400 ml-1",children:E(e)})]})},M=()=>(0,a.jsx)("span",{className:"flex items-center gap-1",children:[0,.15,.3].map(e=>(0,a.jsx)(r.P.span,{className:"h-1.5 w-1.5 rounded-full bg-slate-400",animate:{y:[0,-4,0]},transition:{duration:.9,repeat:1/0,delay:e,ease:"easeInOut"}},e))}),T=()=>{let e=v[(0,n.useContext)(y)];return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center text-center h-full gap-2 px-6",children:[(0,a.jsx)("div",{className:"h-11 w-11 rounded-full ".concat(e.emptyIconBg," flex items-center justify-center"),children:(0,a.jsx)(f.A,{size:20})}),(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Send us a message and our team will get back to you shortly."})]})},F=e=>{let{messages:t,isMine:s,onSend:l,isConnected:i,placeholder:o="Type a messageâ¦",emptyState:m,accent:h="green",senderLabel:p,onSendAttachment:f,attachmentAccept:E=".xlsx,.xls,.csv,image/*",conversationLabel:R,onReplaceAttachment:A,canReplaceAttachment:P,typingLabel:F,onTypingChange:B}=e,G=v[h],L=(0,n.useRef)(null),Q=(0,n.useRef)(!1),J=(0,n.useRef)(0),O=(0,n.useRef)(null),[U,V]=(0,n.useState)(!1),[D,X]=(0,n.useState)(null),H=(0,n.useMemo)(()=>{let e=new Map;return p&&t.forEach(t=>{let s=p(t);s&&e.set(t._id,s)}),e},[t,p]),q=(0,n.useMemo)(()=>{let e=new Map;return t.forEach(t=>{if(t.attachment){var a;let n=P?P(t):s(t);e.set(t._id,{attachment:t.attachment,hasCaption:!!(null==(a=t.message)?void 0:a.trim()),onReplace:A&&n?e=>A(t,e):void 0})}}),e},[t,A,P,s]),W=(0,n.useMemo)(()=>{let e=new Map;return t.forEach(t=>{if(t.image){var s;e.set(t._id,{image:t.image,hasCaption:!!(null==(s=t.message)?void 0:s.trim())})}}),e},[t]),Y=()=>{O.current&&(clearTimeout(O.current),O.current=null)},$=(0,n.useCallback)(()=>{Y(),Q.current&&(Q.current=!1,null==B||B(!1))},[B]),K=(0,n.useCallback)(e=>{if(!B)return;if(!e.target.value.trim())return void $();let t=Date.now();(!Q.current||t-J.current>=2e3)&&(Q.current=!0,J.current=t,B(!0)),Y(),O.current=setTimeout($,3e3)},[B,$]);(0,n.useEffect)(()=>{i||$()},[i,$]),(0,n.useEffect)(()=>()=>Y(),[]);let Z=async e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];if(e.target.value="",s&&f){X(null),V(!0);try{await f(s)}catch(e){X(e instanceof Error?e.message:"Failed to upload attachment")}finally{V(!1)}}},ee=(0,c.U)({messages:t,isRunning:!1,isSendDisabled:!i,convertMessage:e=>({role:s(e)?"user":"assistant",content:e.message,id:e._id,createdAt:new Date(e.createdAt)}),onNew:async e=>{let t=(e=>{var t;if("string"==typeof e)return e;let s=e.find(e=>"text"===e.type);return null!=(t=null==s?void 0:s.text)?t:""})(e.content).trim();t&&($(),await l(t))}}),et=t.length>0;return(0,a.jsx)(d.o,{runtime:ee,children:(0,a.jsx)(S.Provider,{value:R,children:(0,a.jsx)(N.Provider,{value:H,children:(0,a.jsx)(C.Provider,{value:q,children:(0,a.jsx)(k.Provider,{value:W,children:(0,a.jsx)(y.Provider,{value:h,children:(0,a.jsxs)(x.hQ.Root,{className:"flex flex-col h-full bg-gradient-to-b from-slate-50 to-slate-50/60 relative",children:[!i&&(0,a.jsxs)("div",{className:"absolute top-2.5 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 rounded-full bg-brand2-100/95 backdrop-blur-sm px-3 py-1 text-[11px] font-medium text-brand2-700 shadow-sm ring-1 ring-brand2-200",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-brand2-500 animate-pulse"}),"Reconnectingâ¦"]}),(0,a.jsxs)(x.hQ.Viewport,{className:"flex-1 overflow-y-auto overflow-x-hidden px-3.5 py-3 scroll-smooth",children:[!et&&(null!=m?m:(0,a.jsx)(T,{})),(0,a.jsx)(x.hQ.Messages,{components:{UserMessage:I,AssistantMessage:z}}),F&&(0,a.jsx)(r.P.div,{..._,role:"status","aria-label":F,title:F,className:"flex flex-col items-start mb-3.5 gap-1.5",children:(0,a.jsx)("div",{className:"rounded-2xl rounded-bl-md bg-white px-3.5 py-2.5 shadow-sm shadow-slate-900/5 ring-1 ring-slate-100",children:(0,a.jsx)(M,{})})})]}),(0,a.jsx)(x.hQ.ScrollToBottom,{className:"absolute bottom-[4.75rem] right-4 z-10 flex h-9 w-9 items-center justify-center rounded-full bg-white text-slate-500 shadow-md shadow-slate-900/10 ring-1 ring-slate-200 transition-all hover:text-slate-700 hover:shadow-lg disabled:hidden","aria-label":"Scroll to latest",children:(0,a.jsx)(b.A,{size:16})}),D&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3.5 py-1.5 text-[11px] text-red-700 bg-red-50 border-t border-red-100",children:[(0,a.jsx)("span",{children:D}),(0,a.jsx)("button",{type:"button",onClick:()=>X(null),"aria-label":"Dismiss",className:"shrink-0 text-red-400 hover:text-red-600 transition-colors",children:(0,a.jsx)(g.A,{size:12})})]}),(0,a.jsxs)(u.z.Root,{className:"flex items-end gap-2 border-t border-slate-100 bg-white px-3 py-2.5",children:[f&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{ref:L,t
1ype:"file",accept:E,className:"hidden",onChange:Z}),(0,a.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=L.current)?void 0:e.click()},disabled:!i||U,title:U?"Uploadingâ¦":"image/*"===E?"Attach a photo":"Attach a photo or Excel/CSV",className:"shrink-0 flex items-center justify-center h-10 w-10 rounded-full text-slate-500 hover:bg-slate-100 transition-colors disabled:opacity-40","aria-label":"image/*"===E?"Attach a photo":"Attach a photo or Excel/CSV file",children:(0,a.jsx)(w.A,{size:17,className:U?"animate-pulse":""})})]}),(0,a.jsx)(u.z.Input,{placeholder:o,rows:1,onChange:K,className:"flex-1 resize-none max-h-28 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm leading-normal outline-none transition-colors focus:bg-white focus:ring-2 placeholder:text-slate-400 ".concat(G.focusBorder," ").concat(G.focusRing)}),(0,a.jsx)(u.z.Send,{asChild:!0,children:(0,a.jsx)("button",{type:"button",disabled:!i,title:i?"Send":"Connectingâ¦",className:"shrink-0 flex items-center justify-center h-10 w-10 rounded-full bg-gradient-to-br ".concat(G.sendGradient," text-white shadow-sm ").concat(G.sendShadow," transition-transform enabled:hover:scale-105 enabled:active:scale-95 disabled:opacity-40 disabled:shadow-none"),"aria-label":"Send message",children:(0,a.jsx)(j.A,{size:16,className:i?"":"animate-pulse"})})})]})]})})})})})})})}},96918:(e,t,s)=>{s.d(t,{BM:()=>o,TV:()=>i,fW:()=>r,jy:()=>l});let a=!1,n=!1,r=e=>{a=e},l=e=>{n=e},i=()=>a,o=()=>n},98120:(e,t,s)=>{s.d(t,{Em:()=>c,UY:()=>r,Um:()=>l,Xs:()=>i,tc:()=>d,vM:()=>o});let a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,s=new Audio(e);s.volume=t,s.play().catch(()=>{})},n="macpay_admin_support_chat_bell_volume",r=()=>{try{let e=window.localStorage.getItem(n);if(null===e)return 1;let t=parseFloat(e);if(Number.isNaN(t))return 1;return Math.min(1,Math.max(0,t))}catch(e){return 1}},l=e=>{let t=Math.min(1,Math.max(0,e));try{window.localStorage.setItem(n,String(t))}catch(e){}},i=()=>a("/bell_icon.mp3",r()),o=()=>a("/internal.mp3"),c=()=>a("/out.mp3"),d=()=>a("/in.mp3")}}]);
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.