1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5384],{33088:(e,t,n)=>{"use strict";n.d(t,{D9:()=>r,K7:()=>c,lQ:()=>a,pT:()=>o});let a=6,r=4,i=e=>{if("string"==typeof e&&""!==e.trim())try{let t=new URL(e.trim());if("https:"===t.protocol)return t.href;if("mailto:"===t.protocol)return t.pathname.includes("@")?t.href:void 0;return}catch{return}},o=(e,t=a)=>{if(!Array.isArray(e))return[];let n=[],r=new Set;for(let a of e){let e=null;if("string"==typeof a)""!==a.trim()&&(e={label:a});else if(a&&"object"==typeof a){let t=a.label,n=i(a.url);"string"==typeof t&&""!==t.trim()&&n&&(e={label:t,url:n})}if(!e)continue;let o=JSON.stringify([e.url||"",e.label]);if(!r.has(o)&&(r.add(o),n.push(e),n.length>=t))break}return n},s=[{re:/discord/i,icon:"fa-brands fa-discord"},{re:/telegram/i,icon:"fa-brands fa-telegram"},{re:/whatsapp/i,icon:"fa-brands fa-whatsapp"},{re:/e-?mail/i,icon:"fa-solid fa-envelope"},{re:/leave (my|a different) contact|leave.*contact/i,icon:"fa-solid fa-pen"},{re:/wait here/i,icon:"fa-solid fa-hourglass-half"},{re:/question|help|frage|ayuda/i,icon:"fa-solid fa-circle-question"},{re:/looking for|specific service|search|find/i,icon:"fa-solid fa-magnifying-glass"},{re:/gold/i,icon:"fa-solid fa-coins"},{re:/language|speak|deutsch|fran[cç]ais|espa[nñ]ol/i,icon:"fa-solid fa-language"},{re:/coupon|discount|promo|% ?off/i,icon:"fa-solid fa-tag"},{re:/order|delivery|status/i,icon:"fa-solid fa-box-open"}],l=/^((?:\p{Regional_Indicator}\p{Regional_Indicator})|\p{Extended_Pictographic}�)\s*/u,c=e=>{let t=e.match(l),n=!!t&&/\p{Regional_Indicator}/u.test(t[1]),a=t?e.slice(t[0].length):e;if(t&&n)return{icon:null,emoji:t[1],label:a};let r=s.find(e=>e.re.test(a));return r?{icon:r.icon,emoji:null,label:a}:t?{icon:null,emoji:t[1],label:a}:{icon:null,emoji:null,label:e}}},40536:e=>{e.exports={chatButton:"chatPanel_chatButton__W0amu",chatButtonGlyph:"chatPanel_chatButtonGlyph__KO63K",chatButtonOpen:"chatPanel_chatButtonOpen__owb6_",chatButtonRing:"chatPanel_chatButtonRing__Q5EgM",cbRing:"chatPanel_cbRing__xnic3",chatButtonPresence:"chatPanel_chatButtonPresence__CeChg",cbPresencePulse:"chatPanel_cbPresencePulse__Y1SY_",chatButtonPresenceLeft:"chatPanel_chatButtonPresenceLeft__7n7DB",chatBadge:"chatPanel_chatBadge__PvypY",panel:"chatPanel_panel__wKjVY",panelSlideUp:"chatPanel_panelSlideUp__YtNyY",listHeader:"chatPanel_listHeader__SMU0h",conversationList:"chatPanel_conversationList__X99F8",conversationRow:"chatPanel_conversationRow__2Nisd",conversationRowUnread:"chatPanel_conversationRowUnread___mdGX",conversationLabel:"chatPanel_conversationLabel__bZ4Rd",conversationRowFlash:"chatPanel_conversationRowFlash__Awi4h",conversationFlash:"chatPanel_conversationFlash__2F_9g",conversationIcon:"chatPanel_conversationIcon__OtGkD",conversationBody:"chatPanel_conversationBody__7MATn",conversationPreview:"chatPanel_conversationPreview__qawMg",conversationMeta:"chatPanel_conversationMeta__2R2lf",conversationTime:"chatPanel_conversationTime__oVE5a",conversationUnread:"chatPanel_conversationUnread__vLXDV",emptyList:"chatPanel_emptyList__8xQzr",emptyListIcon:"chatPanel_emptyListIcon__bNdho",popupWrap:"chatPanel_popupWrap__sOXyR",popupFadeIn:"chatPanel_popupFadeIn__zBKlt",popupDismiss:"chatPanel_popupDismiss__pnCYO",popupBubbles:"chatPanel_popupBubbles__Ohwj_",popupBubble:"chatPanel_popupBubble__P22OY",popupSenderRow:"chatPanel_popupSenderRow__fTdrR",popupAvatar:"chatPanel_popupAvatar__cf7fS",popupSenderName:"chatPanel_popupSenderName___fcH6",popupLabel:"chatPanel_popupLabel__IP53H",popupContent:"chatPanel_popupContent__fziG_",popupViewAll:"chatPanel_popupViewAll__TXduK",pickerHeader:"chatPanel_pickerHeader__R5KtV",pickerLogo:"chatPanel_pickerLogo__WXGBf",pickerHeaderText:"chatPanel_pickerHeaderText__WLz_k",pickerTitle:"chatPanel_pickerTitle__KK6ee",pickerPresence:"chatPanel_pickerPresence__jZ_7h",pickerPresenceDot:"chatPanel_pickerPresenceDot__lztBU",pickerClose:"chatPanel_pickerClose__Y7ce0",convList:"chatPanel_convList__f5xkK",convScrollSep:"chatPanel_convScrollSep__xnjmP",convScrollArea:"chatPanel_convScrollArea__jphwK",convRow:"chatPanel_convRow__7hAOC",convRowPinned:"chatPanel_convRowPinned__SZxbd",convRowUnread:"chatPanel_convRowUnread__RqtLN",convLabel:"chatPanel_convLabel__NjMdn",convPreview:"chatPanel_convPreview__Pt0Yu",convRowFlash:"chatPanel_convRowFlash__xC3z2",convIcon:"chatPanel_convIcon__VWzSP",convIconGeneral:"chatPanel_convIconGeneral__P7p_P",convIconOrder:"chatPanel_convIconOrder__dR5nc",convBody:"chatPanel_convBody__Ipj4S",convHeadLine:"chatPanel_convHeadLine__0YEXW",convPinIcon:"chatPanel_convPinIcon__kHsr4",convTime:"chatPanel_convTime__tVdJD",convStatus:"chatPanel_convStatus__IpfWv",convOrderMeta:"chatPanel_convOrderMeta__f53CV",convOrderDate:"chatPanel_convOrderDate__proGH",convOrderStatus:"chatPanel_convOrderStatus__0hmy2",convOrderStatusDot:"
1chatPanel_convOrderStatusDot__14wbJ",archiveSection:"chatPanel_archiveSection__OQQKV",archiveToggle:"chatPanel_archiveToggle__sSuJE",archiveCount:"chatPanel_archiveCount__JaoIW",archiveChevron:"chatPanel_archiveChevron__q5l84",archiveRowWrap:"chatPanel_archiveRowWrap__29D9O",convUnread:"chatPanel_convUnread__HhzUw",triggerChips:"chatPanel_triggerChips__GXYuf",triggerChip:"chatPanel_triggerChip__Ix_V5",chipIcon:"chatPanel_chipIcon__AGOQi",chipLabel:"chatPanel_chipLabel__MajzG",chipArrow:"chatPanel_chipArrow__pJoIV",chipExternal:"chatPanel_chipExternal__igfAM",teaserCard:"chatPanel_teaserCard__l5_F5",teaserWrap:"chatPanel_teaserWrap__sBiZB",teaserOpen:"chatPanel_teaserOpen__Wj15c",popupLabelOnline:"chatPanel_popupLabelOnline__Sc3If",teaserPresenceDot:"chatPanel_teaserPresenceDot__RUeDd",teaserWrapLeft:"chatPanel_teaserWrapLeft__mCdCe",teaserCardIn:"chatPanel_teaserCardIn__3PRY8",teaserChipIn:"chatPanel_teaserChipIn__C0S9A",teaserFadeIn:"chatPanel_teaserFadeIn__MU2yQ",teaserClosing:"chatPanel_teaserClosing__lnFKE"}},46183:e=>{e.exports={chatHeader:"chat_chatHeader__l5ijQ",chatBackBtn:"chat_chatBackBtn__2nvhx",chatHeaderText:"chat_chatHeaderText__gY6Qb",chatTitle:"chat_chatTitle__jSFM3",chatHeaderPresence:"chat_chatHeaderPresence__z7Y5X",chatHeaderPresenceDot:"chat_chatHeaderPresenceDot__Kt0Bq",chatHeaderPresencePulse:"chat_chatHeaderPresencePulse__ZzuqG",chatCloseBtn:"chat_chatCloseBtn__MuFMO",chatscapeWrap:"chat_chatscapeWrap__R8GD4",chatEmpty:"chat_chatEmpty__0OR6l",chatEmptyState:"chat_chatEmptyState__uuEZv",chatEmptyIcon:"chat_chatEmptyIcon__nk_as",chatEmptyTitle:"chat_chatEmptyTitle___lVZB",chatEmptyText:"chat_chatEmptyText__9nvQL",activityMessage:"chat_activityMessage__Gl0jO",activityTime:"chat_activityTime__fnW8Q",inputArea:"chat_inputArea__13Qzj",messageInputWrap:"chat_messageInputWrap__8lr5Z",chatToolbar:"chat_chatToolbar__RlG8y",chatIconBtn:"chat_chatIconBtn__Oz0Bd",emojiPickerPopup:"chat_emojiPickerPopup__TOBOd",emojiLoading:"chat_emojiLoading__BokuL",emojiPickerSheet:"chat_emojiPickerSheet__PAYvn",chatInput:"chat_chatInput__Gu2W5",chatTextarea:"chat_chatTextarea__joxux",chatSendBtn:"chat_chatSendBtn__rhIXL",chatSendBtnKbd:"chat_chatSendBtnKbd__aJKiW",chatSendBtnSpinner:"chat_chatSendBtnSpinner__p3hop",chatSendSpin:"chat_chatSendSpin__kmT7z",reactionRow:"chat_reactionRow__Qt3oD",reactionPill:"chat_reactionPill__Kxf0h",reactionPillMine:"chat_reactionPillMine__oMjdO",reactionPillEmoji:"chat_reactionPillEmoji__511Dw",reactionPillCount:"chat_reactionPillCount__X16r6",reactionPillSingle:"chat_reactionPillSingle__Nf_Im",chatToolbarRow:"chat_chatToolbarRow__7ezN0",stagingBar:"chat_stagingBar__tQZ7T",stagingThumb:"chat_stagingThumb__78qyd",stagingRemove:"chat_stagingRemove__ydUAO",stagingSize:"chat_stagingSize__ocUNY",stagingAdd:"chat_stagingAdd__aWHNY",dropZoneActive:"chat_dropZoneActive__ar_ce",albumGrid:"chat_albumGrid__UNG4y",albumItem:"chat_albumItem__N_2Bo",albumItemWide:"chat_albumItemWide__EXDsK",msgRowOutgoing:"chat_msgRowOutgoing__5W0Pb",msgRowIncoming:"chat_msgRowIncoming__QC3aL",bubbleAnchor:"chat_bubbleAnchor__aPf_8",hoverActions:"chat_hoverActions__3QKk6",hoverActionsLeft:"chat_hoverActionsLeft__hKMNC",hoverActionsRight:"chat_hoverActionsRight__9h0Nx",hoverActionsVisible:"chat_hoverActionsVisible__a7tJx",hoverActionBtn:"chat_hoverActionBtn__u7EbY",receiptDelivered:"chat_receiptDelivered__bwCWX",receiptRead:"chat_receiptRead__ZHiZ7",receiptText:"chat_receiptText__qMr_B",triggerChipRow:"chat_triggerChipRow___tzEQ",triggerChipBtn:"chat_triggerChipBtn___T12N",chipRowIn:"chat_chipRowIn__8gMrV",chipIcon:"chat_chipIcon__PNg8x",chipExternal:"chat_chipExternal___7hyk",chipRowFade:"chat_chipRowFade__8_IV8"}},75384:(e,t,n)=>{"use strict";n.d(t,{IC:()=>W,qA:()=>N});var a=n(95155),r=n(12115),i=n(47650),o=n(16153);let s=[".png",".jpg",".jpeg",".gif",".webp"],l=[{ext:"png",check:e=>137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]},{ext:"jpeg",check:e=>255===e[0]&&216===e[1]&&255===e[2]},{ext:"gif",check:e=>71===e[0]&&73===e[1]&&70===e[2]&&56===e[3]},{ext:"webp",check:e=>82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]}];async function c(e){let t=e.name.toLowerCase(),n=t.lastIndexOf("."),a=n>=0?t.slice(n):"";if(!s.includes(a))return{valid:!1,error:`Unsupported file type: ${a||"unknown"}. Allowed: ${s.join(", ")}`};if(e.size>0xa00000)return{valid:!1,error:`File too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum: 10 MB.`};try{let t=await e.slice(0,12).arrayBuffer(),n=new Uint8Array(t);if(!l.some(e=>e.check(n)))return{valid:!1,error:"File content does not match a supp
1orted image format."}}catch{return{valid:!1,error:"Unable to read file."}}return{valid:!0}}function d(e){return new Promise((t,n)=>{let a=URL.createObjectURL(e),r=new Image;r.onload=()=>t({img:r,url:a}),r.onerror=()=>{URL.revokeObjectURL(a),n(Error("Failed to load image"))},r.src=a})}async function h(e){if(e.size<=204800||"image/gif"===e.type||/\.gif$/i.test(e.name))return e;let{img:t,url:n}=await d(e),{width:a,height:r}=t;(a>1920||r>1920)&&(a>=r?(r=Math.round(1920/a*r),a=1920):(a=Math.round(1920/r*a),r=1920));let i=document.createElement("canvas");return i.width=a,i.height=r,i.getContext("2d").drawImage(t,0,0,a,r),URL.revokeObjectURL(n),new Promise((e,t)=>{i.toBlob(n=>{n?e(n):t(Error("Canvas toBlob returned null"))},"image/jpeg",.85)})}async function u(e){let{img:t,url:n}=await d(e),a=document.createElement("canvas");a.width=96,a.height=96;let r=a.getContext("2d"),i=Math.min(t.width,t.height),o=(t.width-i)/2,s=(t.height-i)/2;return r.drawImage(t,o,s,i,i,0,0,96,96),URL.revokeObjectURL(n),a.toDataURL("image/jpeg",.7)}async function p(e){let t=await c(e);if(!t.valid)return console.warn(`Image rejected: ${t.error}`),null;try{let t=await h(e),n=await u(t);return{id:"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,originalName:e.name,blob:t,previewUrl:n,size:t.size}}catch(e){return console.warn("Image processing failed:",e),null}}var g=n(84870);let m=/((?:https?:\/\/|www\.)[^\s<]+)/gi,_=/<((?:https?:\/\/|www\.)[^>\s]+)>/gi;function f(e){let t=(e??"").replace(_,"$1");if(!t||-1===t.indexOf("http")&&-1===t.toLowerCase().indexOf("www."))return t;let n=[],r=0,i=0;for(let e of t.matchAll(m)){let o=e.index??0,{url:s,tail:l}=function(e){let t=e.length;for(;t>0;){let n=e[t-1];if(".,!?;:\"'".includes(n)||")"===n&&!e.slice(0,t-1).includes("(")){t--;continue}break}return{url:e.slice(0,t),tail:e.slice(t)}}(e[0]),c=function(e){let t=/^www\./i.test(e)?`https://${e}`:e;try{let e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol?e.href:null}catch{return null}}(s);o>r&&n.push(t.slice(r,o)),c?n.push((0,a.jsx)("a",{href:c,target:"_blank",rel:"noopener noreferrer nofollow",translate:"no",style:{color:"#54CDE4",textDecoration:"underline",wordBreak:"break-all"},children:s},`l${i++}`)):n.push(s),l&&n.push(l),r=o+e[0].length}return r<t.length&&n.push(t.slice(r)),n}var x=n(40536),y=n.n(x),b=n(46183),v=n.n(b);let w=e=>new Date("number"==typeof e?1e3*e:e).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1}),j=({side:e,visible:t,message:n,onShow:r,onReply:i,onContextMenu:o})=>(0,a.jsxs)("div",{role:"group","aria-label":"Message actions",onMouseEnter:r,className:[v().hoverActions,"left"===e?v().hoverActionsLeft:v().hoverActionsRight,t?v().hoverActionsVisible:""].filter(Boolean).join(" "),children:[(0,a.jsx)("button",{type:"button",className:v().hoverActionBtn,onClick:()=>i?.(n),title:"Reply","aria-label":"Reply to this message",children:(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,a.jsx)("polyline",{points:"9 17 4 12 9 7"}),(0,a.jsx)("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"})]})}),(0,a.jsx)("button",{type:"button",className:v().hoverActionBtn,onClick:e=>o?.(e,n),title:"More","aria-label":"More actions for this message","aria-haspopup":"menu",children:(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[(0,a.jsx)("circle",{cx:"5",cy:"12",r:"1.5"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"1.5"}),(0,a.jsx)("circle",{cx:"19",cy:"12",r:"1.5"})]})})]}),k=({createdAt:e,readAt:t})=>{let n=t>0&&e<=t;return(0,a.jsxs)("span",{className:n?v().receiptRead:v().receiptDelivered,"aria-label":n?"Read":"Delivered",children:[(0,a.jsxs)("svg",{viewBox:"0 0 18 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,a.jsx)("polyline",{points:"1 8 5 12 11.5 4"}),(0,a.jsx)("polyline",{points:"7 12 13.5 4"})]}),(0,a.jsx)("span",{className:v().receiptText,children:n?`Read ${w(t)}`:"Delivered"})]})},P=({attachments:e,onImageClick:t})=>{let n=e.filter(e=>"image"===e.file_type),r=e.filter(e=>"image"!==e.file_type),i=n.length>=3&&n.length%2==1;return(0,a.jsxs)(a.Fragment,{children:[1===n.length&&(0,a.jsx)("img",{src:n[0].data_url,alt:"attachment",loading:"lazy",draggable:!1,onClick:()=>t?.(n[0].data_url),style:{maxWidth:"100%",maxHeight:200,borderRadius:8,cursor:"zoom-in",marginTop:2}}),n.length>=2&&(0,a.jsx)("div",{className:v().albumGrid,children:n.map((e,n)=>(0,a.jsx)("div",{className:[v().albumItem,i&&0===n?v().albumItemWide:""].filter(
1Boolean).join(" "),children:(0,a.jsx)("img",{src:e.data_url,alt:"attachment",loading:"lazy",draggable:!1,onClick:()=>t?.(e.data_url)})},e.id))}),r.map(e=>(0,a.jsxs)("a",{href:e.data_url,target:"_blank",rel:"noopener noreferrer",style:{color:"#54CDE4",fontSize:12,textDecoration:"underline",marginTop:2},children:[(0,a.jsx)("i",{className:"fa-solid fa-paperclip",style:{marginRight:4}}),(0,a.jsx)("span",{translate:e.data_url?"no":void 0,children:e.data_url?.split("/").pop()||"Download"})]},e.id))]})},C=r.memo(({message:e,messages:t,index:n,onImageClick:i,onReply:o,onContextMenu:s,onScrollToMessage:l,onReaction:c,readAt:d=0})=>{let h,u,[p,g]=r.useState(!1),m=r.useRef(null),_=r.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),g(!0)},[]),x=r.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{m.current=null,g(!1)},200)},[]);r.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);let b={onMouseEnter:_,onMouseLeave:x},C=(()=>{if(2===e.message_type||e.private)return!1;let a=t[n-1];return!a||2===a.message_type||!!a.private||a.message_type!==e.message_type||(a.sender?.id??null)!==(e.sender?.id??null)})(),S=(()=>{if(2===e.message_type||e.private)return!1;let a=t[n+1];return!a||2===a.message_type||!!a.private||a.message_type!==e.message_type||(a.sender?.id??null)!==(e.sender?.id??null)})(),I=!(u=t[n-1])||2===u.message_type||!!u.private||2===e.message_type||!!e.private||u.message_type!==e.message_type||(u.sender?.id??null)!==(e.sender?.id??null)||Math.abs((e.created_at||0)-(u.created_at||0))>=120,R=C||I,M=(()=>{if(0===n)return 0;let a=t[n-1];return a?2===a.message_type||2===e.message_type?4:a.private||e.private?10:a.message_type!==e.message_type?14:I?10:2:0})(),B=(h=C&&S,0===e.message_type?h||S?"12px 2px 12px 12px":"12px 2px 2px 12px":h||S?"2px 12px 12px 12px":"2px 12px 12px 2px"),L=e.sender?.thumbnail||null,E=e.sender?.name?.charAt(0)?.toUpperCase()||"?";if(e.private||!(2!==e.message_type||(e.content||"").includes("joined the chat"))&&1)return null;if(2===e.message_type){let t=(e.content||"").replace(/\s*\([^)]+\)\s*(?=joined)/," "),n="string"==typeof e.content&&e.content.startsWith("\uD83D\uDC4B Welcome to your order chat");return(0,a.jsxs)("div",{className:y().activityMessage,"data-ms-welcome-activity":n?"":void 0,style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"center",gap:8,margin:"8px 0",fontStyle:"italic",fontSize:12,color:"rgba(255,255,255,0.55)",textAlign:"center"},children:[(0,a.jsx)("span",{children:t}),(0,a.jsx)("span",{style:{fontSize:11,color:"rgba(255,255,255,0.3)"},children:w(e.created_at)})]})}let T=e.content_attributes?.reactions?.length>0?(0,a.jsx)("div",{className:v().reactionRow,children:Object.values(e.content_attributes.reactions.reduce((e,t)=>{e[t.emoji]||(e[t.emoji]={emoji:t.emoji,count:0,names:[],isMine:!1}),e[t.emoji].count++;let n=t.contact_id?"You":t.user_name||"";return t.contact_id&&(e[t.emoji].isMine=!0),n&&!e[t.emoji].names.includes(n)&&e[t.emoji].names.push(n),e},{})).map(t=>{let n=[v().reactionPill];return t.isMine&&n.push(v().reactionPillMine),1===t.count&&n.push(v().reactionPillSingle),(0,a.jsxs)("span",{title:t.names.join(", "),role:"button",tabIndex:0,"aria-pressed":t.isMine,"aria-label":`${t.emoji} reaction (${t.count} ${1===t.count?"person":"people"}${t.isMine?", including you":""}). ${t.isMine?"Press to remove yours":"Press to add yours"}`,onClick:()=>c?.(e.id,t.emoji),onKeyDown:n=>{("Enter"===n.key||" "===n.key)&&(n.preventDefault(),c?.(e.id,t.emoji))},className:n.join(" "),children:[(0,a.jsx)("span",{className:v().reactionPillEmoji,children:t.emoji}),(0,a.jsx)("span",{className:v().reactionPillCount,children:t.count})]},t.emoji)})}):null,N=n=>{let r=e.content_attributes?.reply_to_message_id;if(!r)return null;let i=t.find(e=>e.id===r);return i?(0,a.jsx)("div",{style:{marginBottom:4,padding:"6px 8px",borderRadius:6,background:"rgba(255,255,255,0.04)",borderLeft:`3px solid ${0===n?"rgba(196,162,245,0.5)":"rgba(224,131,148,0.5)"}`,cursor:"pointer"},onClick:()=>l?.(r),children:(0,a.jsx)("div",{style:{fontSize:11,color:"rgba(255,255,255,0.35)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(i.content||"").substring(0,40)||"[Attachment]"})}):null};if(0===e.message_type)return e.attachments?.length?(0,a.jsxs)("div",{"data-msg-id":e.id,className:v().msgRowOutgoing,style:{display:"flex",flexDirection:"column",alignItems:"flex-end",marginTop:M,padding:0},...b,onContextMenu:t=>{t.preventDefault(),s?.(t,e)}
1,children:[R&&(0,a.jsxs)("div",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",marginBottom:2},children:[(0,a.jsx)("span",{style:{color:"rgba(255, 255, 255, 0.66)",fontWeight:600},children:"You"})," ",(0,a.jsx)("span",{style:{color:"rgba(255,255,255,0.2)"},children:w(e.created_at)})]}),(0,a.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:4,alignSelf:"flex-end",maxWidth:"100%"},children:(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",minWidth:0,alignItems:"flex-end"},children:[(0,a.jsxs)("div",{className:v().bubbleAnchor,children:[(0,a.jsx)(j,{side:"left",visible:p,message:e,onShow:_,onReply:o,onContextMenu:s}),e.content?.trim()&&(0,a.jsxs)("div",{style:{background:"rgba(196,162,245,0.15)",border:"1px solid rgba(196,162,245,0.12)",borderRadius:B,padding:"8px 12px",color:"rgba(255,255,255,0.9)",fontSize:13,whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"normal",marginBottom:4},children:[N(0),f(e.content)]}),(0,a.jsx)(P,{attachments:e.attachments,onImageClick:i})]}),T,S&&(0,a.jsx)(k,{createdAt:e.created_at,readAt:d})]})})]}):(0,a.jsxs)("div",{"data-msg-id":e.id,className:v().msgRowOutgoing,style:{display:"flex",flexDirection:"column",alignItems:"flex-end",marginTop:M,padding:0},...b,onContextMenu:t=>{t.preventDefault(),s?.(t,e)},children:[R&&(0,a.jsxs)("div",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",marginBottom:2},children:[(0,a.jsx)("span",{style:{color:"rgba(255, 255, 255, 0.66)",fontWeight:600},children:"You"})," ",(0,a.jsx)("span",{style:{color:"rgba(255,255,255,0.2)"},children:w(e.created_at)})]}),(0,a.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:4,alignSelf:"flex-end",maxWidth:"100%"},children:(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",minWidth:0,alignItems:"flex-end"},children:[(0,a.jsxs)("div",{className:v().bubbleAnchor,children:[(0,a.jsx)(j,{side:"left",visible:p,message:e,onShow:_,onReply:o,onContextMenu:s}),(0,a.jsxs)("div",{style:{background:"rgba(196,162,245,0.15)",border:"1px solid rgba(196,162,245,0.12)",borderRadius:B,padding:"8px 12px",color:"rgba(255,255,255,0.9)",fontSize:13,whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"normal"},children:[N(0),f(e.content)||" "]})]}),T,S&&(0,a.jsx)(k,{createdAt:e.created_at,readAt:d})]})})]});let A=!!e.content_attributes?.ms_trigger,D=A?e.content_attributes?.ms_trigger_agent||"Mythic":e.sender?.name||"Support",W=!!e.attachments?.length,z=S?(0,a.jsx)("div",{style:{width:28,height:28,borderRadius:"50%",flexShrink:0,overflow:"hidden",background:A?"rgba(255,223,111,0.10)":"rgba(224,131,148,0.15)",display:"flex",alignItems:"center",justifyContent:"center"},children:A?(0,a.jsx)("img",{src:"/images/logo-color.svg",alt:"",width:16,height:16,style:{width:16,height:16}}):L?(0,a.jsx)("img",{src:L,style:{width:"100%",height:"100%",objectFit:"cover"}}):(0,a.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"rgba(224,131,148,0.8)"},translate:"no",children:E})}):(0,a.jsx)("div",{style:{width:28,flexShrink:0}});return W?(0,a.jsx)("div",{"data-msg-id":e.id,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",marginTop:M,padding:0},...b,onContextMenu:t=>{t.preventDefault(),s?.(t,e)},children:(0,a.jsxs)("div",{className:v().msgRowIncoming,style:{display:"flex",alignItems:"flex-end",gap:8},children:[z,(0,a.jsxs)("div",{style:{minWidth:0,flex:1},children:[(C||R)&&(0,a.jsxs)("div",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",marginBottom:2},children:[(0,a.jsx)("span",{translate:"no",style:{color:A?"#FFDF6F":"#54CDE4",fontWeight:600},children:D})," ",R&&(0,a.jsx)("span",{style:{color:"rgba(255,255,255,0.2)"},children:w(e.created_at)})]}),(0,a.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:4,maxWidth:"100%"},children:(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",minWidth:0,alignItems:"flex-start"},children:[(0,a.jsxs)("div",{className:v().bubbleAnchor,children:[(0,a.jsx)(j,{side:"right",visible:p,message:e,onShow:_,onReply:o,onContextMenu:s}),e.content?.trim()&&(0,a.jsxs)("div",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(162,164,245,0.08)",borderRadius:B,padding:"8px 12px",color:"rgba(255,255,255,0.9)",fontSize:13,whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"normal",marginBottom:4},children:[N(1),f(e.content)]}),(0,a.jsx)(P,{attachments:e.attachments,onImageClick:i})]}),T]})})]})]})}):(0,a.jsx)("div",{"data-msg-id":e.id,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",marginTop:M,padding:0},...b,onContextMenu:t=>{t.preventDefault(),s?.(t,e)},children:(0,a.jsxs)("div",{className:v().msgRowIncoming,style:{display:"flex",alignItems:"flex-end",gap:8},children:[z,(0,a.jsxs)("div",{style:{minWidth:0,flex:1}
1,children:[(C||R)&&(0,a.jsxs)("div",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",marginBottom:2},children:[(0,a.jsx)("span",{translate:"no",style:{color:A?"#FFDF6F":"#54CDE4",fontWeight:600},children:D})," ",R&&(0,a.jsx)("span",{style:{color:"rgba(255,255,255,0.2)"},children:w(e.created_at)})]}),(0,a.jsx)("div",{style:{display:"flex",alignItems:"flex-start",gap:4,maxWidth:"100%"},children:(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",minWidth:0,alignItems:"flex-start"},children:[(0,a.jsxs)("div",{className:v().bubbleAnchor,children:[(0,a.jsx)(j,{side:"right",visible:p,message:e,onShow:_,onReply:o,onContextMenu:s}),(0,a.jsxs)("div",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(162,164,245,0.08)",borderRadius:B,padding:"8px 12px",color:"rgba(255,255,255,0.9)",fontSize:13,whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"normal"},children:[N(1),f(e.content)||" "]})]}),T]})})]})]})})},(e,t)=>{if(e.message.id!==t.message.id||e.message.content!==t.message.content||e.message.updated_at!==t.message.updated_at||(e.message.attachments?.length||0)!==(t.message.attachments?.length||0)||e.message.content_attributes!==t.message.content_attributes)return!1;let n=e.message.content_attributes?.reactions,a=t.message.content_attributes?.reactions;if(n!==a||(n?.length||0)!==(a?.length||0))return!1;let r=e.messages[e.index-1],i=t.messages[t.index-1];if(r?.id!==i?.id)return!1;let o=e.messages[e.index+1],s=t.messages[t.index+1];return o?.id===s?.id&&(e.readAt||0)===(t.readAt||0)});var S=n(33088),I=n(99544),R=n(89007);let M=({src:e,onClose:t})=>{let[n,o]=r.useState(1),[s,l]=r.useState(!1),[c,d]=r.useState({x:0,y:0}),h=r.useRef({x:0,y:0,ox:0,oy:0});r.useEffect(()=>{let e=e=>{"Escape"===e.key&&t(),("+"===e.key||"="===e.key)&&o(e=>Math.min(e+.5,5)),"-"===e.key&&o(e=>{let t=Math.max(e-.5,1);return 1===t&&d({x:0,y:0}),t}),"0"===e.key&&(o(1),d({x:0,y:0}))},n=e=>{e.preventDefault(),o(t=>{let n=Math.max(1,Math.min(5,t+(e.deltaY>0?-.25:.25)));return 1===n&&d({x:0,y:0}),n})};return document.addEventListener("keydown",e),document.addEventListener("wheel",n,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",n)}},[t]);let u=()=>l(!1);return i.createPortal((0,a.jsxs)("div",{onClick:t,onMouseMove:e=>{s&&d({x:h.current.ox+(e.clientX-h.current.x),y:h.current.oy+(e.clientY-h.current.y)})},onMouseUp:u,onMouseLeave:u,style:{position:"fixed",inset:0,zIndex:9999,background:"rgba(0,0,0,0.88)",backdropFilter:"blur(10px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:n>1?s?"grabbing":"grab":"zoom-out",userSelect:"none"},children:[(0,a.jsxs)("div",{onClick:e=>e.stopPropagation(),style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:4,background:"rgba(255,255,255,0.08)",borderRadius:8,padding:4},children:[(0,a.jsx)("button",{onClick:()=>{o(e=>Math.max(e-.5,1)),n<=1.5&&d({x:0,y:0})},style:{background:"none",border:"none",color:"#fff",fontSize:16,width:32,height:32,cursor:"pointer",borderRadius:6,display:"flex",alignItems:"center",justifyContent:"center"},title:"Zoom out (-)",children:(0,a.jsx)("i",{className:"fa-solid fa-minus"})}),(0,a.jsxs)("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:12,display:"flex",alignItems:"center",padding:"0 6px",minWidth:40,justifyContent:"center"},children:[Math.round(100*n),"%"]}),(0,a.jsx)("button",{onClick:()=>o(e=>Math.min(e+.5,5)),style:{background:"none",border:"none",color:"#fff",fontSize:16,width:32,height:32,cursor:"pointer",borderRadius:6,display:"flex",alignItems:"center",justifyContent:"center"},title:"Zoom in (+)",children:(0,a.jsx)("i",{className:"fa-solid fa-plus"})}),(0,a.jsx)("div",{style:{width:1,background:"rgba(255,255,255,0.15)",margin:"4px 2px"}}),(0,a.jsx)("button",{onClick:()=>{o(1),d({x:0,y:0})},style:{background:"none",border:"none",color:"#fff",fontSize:14,width:32,height:32,cursor:"pointer",borderRadius:6,display:"flex",alignItems:"center",justifyContent:"center"},title:"Reset zoom (0)",children:(0,a.jsx)("i",{className:"fa-solid fa-arrows-rotate"})}),(0,a.jsx)("button",{onClick:()=>window.open(e,"_blank"),style:{background:"none",border:"none",color:"#fff",fontSize:14,width:32,height:32,cursor:"pointer",borderRadius:6,display:"flex",alignItems:"center",justifyContent:"center"},title:"Open full size in new tab",children:(0,a.jsx)("i",{className:"fa-solid fa-up-right-from-square"})}),(0,a.jsx)("div",{style:{width:1,background:"rgba(255,255,255,0.15)",margin:"4px 2px"}}),(0,a.jsx)("button",{onClick:t,style:{background:"none",border:"none",color:"#fff",fontSize:16,width:32,height:32,cursor:"pointer",borderRadius:6,display:"flex",alignItems:"center",justifyContent:"center"},title:"Close (Esc)",children:(0,a.jsx)("i",{className:"fa-solid fa-xmark"})})]}),(0,a.jsx)("img",{src:e,alt:"Preview",draggable:!1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>{e.stopPropagation(),n>1?(o(1),d({x:0,y:0})):o(2.5)},onMouseDown:e=>{n<=1||(e.preventDefault(),l(!0),h.current={x:e.clientX,y:e.clientY,ox:c.x,oy:c.y})},style:{maxWidth:"90vw",maxHeight:"85vh",borderRadius:6,objectFit:"contain",transform:`scale(${n}) translate(${c.x/n}px, ${c.y/n}px)`,transition:s?"none":"transform 0.2s ease",cursor:n>
11?s?"grabbing":"grab":"zoom-in"}})]}),document.body)};n(85821),n(52963);var B=n(77433),L=n(21263);let E=r.lazy(()=>Promise.all([n.e(4758),n.e(1364)]).then(n.bind(n,61364))),T="ms_chat_draft_v1:",N="ms_chat_pending_draft_v1";function A(e,t){try{t?window.sessionStorage.setItem(`${T}${e}`,t):window.sessionStorage.removeItem(`${T}${e}`)}catch{}}let D=e=>!!e.private||!(2!==e.message_type||(e.content||"").includes("joined the chat")),W=({conversationId:e,showHeader:t=!0,label:n,showBack:s,onBack:l,onClose:c,welcomeBanner:d,context:h="embedded",operatorPresence:u})=>{let m=(0,o.CU)(),[_,f]=r.useState([]),[x,y]=r.useState(!0),[b,w]=r.useState(()=>(function(e){try{let t=window.sessionStorage.getItem(`${T}${e}`);if(t)return t;let n=window.sessionStorage.getItem(N);if(n)return window.sessionStorage.removeItem(N),n;return""}catch{return""}})(e)),[j,k]=r.useState(!1),[P,W]=r.useState(!1),[z,O]=r.useState(null),[F,U]=r.useState(null),[H,$]=r.useState(null),[K,Y]=r.useState(null),[G,V]=r.useState([]),[Q,q]=r.useState(!1),[X,Z]=r.useState(!1),[J,ee]=r.useState(""),et=r.useRef(null),en=r.useRef(null),[ea,er]=r.useState(0),ei=r.useRef(null),eo=r.useRef(null),es=r.useRef(null),el=r.useRef(null),ec=r.useRef(null),[ed,eh]=r.useState(null),eu=r.useRef(!1),[ep,eg]=r.useState(null),em=r.useRef(0),e_=r.useRef(0),ef=r.useMemo(()=>{let e=_.filter(e=>!D(e)),t=e[e.length-1];return t?.message_type!==1?[]:(0,S.pT)(t?.content_attributes?.ms_suggestions,S.lQ)},[_]),ex=async t=>{if(!j){k(!0);try{let n=await m.sendChatwootMessage(e,t);f(e=>{if(e.some(e=>e.id===n.id))return e;let t=[...e,n];return em.current=Math.max(em.current,t.length),t}),$(null)}catch(e){console.error("Failed to send suggestion:",e)}finally{k(!1)}}},ey=r.useCallback(e=>{f(t=>{let n=new Map(t.map(e=>[e.id,e])),a=[],r=t.map(t=>{let n=e.find(e=>e.id===t.id);if(!n)return t;let a=(n.attachments?.length||0)!==(t.attachments?.length||0),r=JSON.stringify(n.content_attributes||{})!==JSON.stringify(t.content_attributes||{});return a||r?{...t,attachments:n.attachments,content_attributes:n.content_attributes}:t});return(e.forEach(e=>{n.has(e.id)||a.push(e)}),a.length)?[...r,...a].sort((e,t)=>e.created_at-t.created_at):r})},[]);r.useEffect(()=>{let t=t=>{let n=t.detail;n?.conversationId===e&&m.getChatwootMessages(e).then(e=>{Array.isArray(e)&&(ey(e),em.current=Math.max(em.current,e.length),e_.current=Math.max(e_.current,e.filter(e=>1===e.message_type).length))}).catch(()=>{})};return window.addEventListener("ms:trigger-engaged",t),()=>window.removeEventListener("ms:trigger-engaged",t)},[e,ey]);let eb=r.useRef(b);eb.current=b,r.useEffect(()=>()=>{A(e,eb.current)},[e]),r.useEffect(()=>{if("embedded"===h)return window.__msTracker?.sendChatViewed(e),m.setState({chatActiveConversationId:e}),()=>{m.setState({chatActiveConversationId:null}),window.__msTracker?.sendChatClosed?.()}},[e,h]),r.useEffect(()=>{y(!0),m.getChatwootMessages(e).then(e=>{Array.isArray(e)&&(f(e),em.current=e.length,e_.current=e.filter(e=>1===e.message_type).length,eg(null))}).catch(()=>{}).finally(()=>y(!1))},[e]),r.useEffect(()=>{let t=null,n=()=>{t&&clearTimeout(t),t=setTimeout(()=>{m.getChatwootMessages(e).then(e=>{Array.isArray(e)&&ey(e)}).catch(()=>{})},300)};return window.addEventListener("chatwoot:on-message",n),()=>{t&&clearTimeout(t),window.removeEventListener("chatwoot:on-message",n)}},[e]),r.useEffect(()=>{if(!e)return;let t=!1,n=null,a=null;return(async()=>{try{let r=await new Promise(e=>{let t=window.__msTracker;t?e(t):a=setInterval(()=>{let t=window.__msTracker;t&&(a&&clearInterval(a),a=null,e(t))},200)});if(t)return;let{pubsub_token:i}=await (0,g.apiRequest)("chatwoot.getPubsubToken",{conversationId:e});if(t||!i)return;r.subscribeMsConversation?.(e,i),n=setTimeout(()=>{t||r.subscribeMsConversation?.(e,i)},500)}catch(e){console.error("[MS Reaction] subscription setup failed:",e)}})(),()=>{t=!0,n&&clearTimeout(n),a&&clearInterval(a),window.__msTracker?.unsubscribeMsConversation?.(e)}},[e]),r.useEffect(()=>{let t=t=>{let n=t.detail;n&&n.conversationId===e&&f(e=>e.map(e=>{if(e.id!==n.messageId)return e;let t=e.content_attributes||{};return{...e,content_attributes:{...t,reactions:n.reactions}}}))};return window.addEventListener("ms:reaction-update",t),()=>window.removeEventListener("ms:reaction-update",t)},[e]),r.useEffect(()=>{let t=setInterval(async()=>{try{let t=await m.getChatwootMessages(e);if(Array.isArray(t)){let e=t.filter(e=>1===e.message_type).length;e>e_.current&&(e_.current=e,(0,I.s)(),t.length>em.current&&eg(e=>e??(t[em.current]?.id||null))),ey(t)}}catch{}},3e4);return()=>clearInterval(t)},[e]),r.useEffect(()=>{let t=t=>{let n=t.detail;n.conversationId&&n.conversationId!==e||m.getChatwootMessages(e).then(e=>{if(Array.isArray(e)){let t=e.filter(e=>1===e.message_type).length;t>e_.current&&(e_.current=t,(0,I.s)(),e.length>em.current&&eg(t=>t??(e[em.current]?.id||null))),ey(e)}}).catch(()=>{})};return window.addEventListener("ms:new-message",t),()=>window.removeEventListener("ms:new-message",t)},[e]),r.useEffect(()=>{let t=t=>{let n=t.detail;n&&(!n.conversationId||n.conversationId===e)&&(n.typing?(Z(!0),ee(n.agentName||"Supp
1ort"),et.current&&clearTimeout(et.current),et.current=setTimeout(()=>Z(!1),1e4)):(Z(!1),et.current&&clearTimeout(et.current)))};return window.addEventListener("ms:operator-typing",t),()=>{window.removeEventListener("ms:operator-typing",t),et.current&&clearTimeout(et.current),Z(!1)}},[e]),r.useEffect(()=>{let t=0;for(let e of _)1===e.message_type&&e.id>t&&(t=e.id);let n=en.current;if(!n||n.conversationId!==e){en.current={conversationId:e,messageId:t};return}!(t<=n.messageId)&&(en.current={conversationId:e,messageId:t},Z(!1),et.current&&clearTimeout(et.current))},[_,e]),r.useEffect(()=>{let t=t=>{let n=t.detail;if(!n||n.conversationId!==e)return;let a="number"==typeof n.readAt?n.readAt:0;a&&er(e=>a>e?a:e)};return window.addEventListener("ms:read-update",t),()=>window.removeEventListener("ms:read-update",t)},[e]),r.useEffect(()=>{if(!P)return;let e=e=>{let t=e.target;el.current?.contains(t)||es.current&&!es.current.contains(t)&&(W(!1),eh(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[P]);let ev=e=>{let t=document.querySelector(`[data-msg-id="${e}"]`);t&&(t.scrollIntoView({behavior:"smooth",block:"center"}),t.style.background="rgba(196,162,245,0.08)",setTimeout(()=>{t.style.background=""},1500))};r.useEffect(()=>{let e=()=>{let e=_[_.length-1];if(!e)return;let t=document.querySelector(`[data-msg-id="${e.id}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"end"})};return window.addEventListener("ms:chat-keyboard-open",e),()=>window.removeEventListener("ms:chat-keyboard-open",e)},[_]);let ew=async(t,n,a)=>{let r=_.find(e=>e.id===t),i=(r?.content_attributes?.reactions||[]).some(e=>e.emoji===n&&e.contact_id),o=a??(i?"remove":"add");f(e=>e.map(e=>{let a;if(e.id!==t)return e;let r=e.content_attributes||{},i=r.reactions||[];if("add"===o){if(i.some(e=>e.emoji===n&&e.contact_id))return e;a=[...i,{emoji:n,contact_id:-1,user_name:"You",created_at:Math.floor(Date.now()/1e3)}]}else a=i.filter(e=>!(e.emoji===n&&e.contact_id));return{...e,content_attributes:{...r,reactions:a}}}));try{let a=await (0,g.apiRequest)("chatwoot.toggleReaction",{conversationId:e,messageId:t,emoji:n,action:o});a?.reactions&&f(e=>e.map(e=>{if(e.id!==t)return e;let n=e.content_attributes||{};return{...e,content_attributes:{...n,reactions:a.reactions}}}))}catch(t){console.error("[MS Reaction] Failed:",t);try{let t=await m.getChatwootMessages(e);f(t)}catch{}}},ej=async t=>{if("widget"!==h)return null;try{let n=null;if(m.client?._id)n=await m.createGeneralConversation?.();else{let e=window.__msTracker?.getSessionId?.();if(!e)return null;n=await m.createGeneralForVisitor?.("guest_"+e)}if(!n?.id)return null;return t&&A(n.id,t),window.dispatchEvent(new CustomEvent("ms:chat-conversation-replaced",{detail:{oldId:e,newConversation:n}})),n.id}catch(e){return console.error("Chat recovery failed:",e),null}},ek=async()=>{let t=b.trim();if(!t&&0===G.length||j)return;k(!0);let n=e,a=async e=>{if(t){let n=await m.sendChatwootMessage(e,t,H?.id);f(e=>[...e,n]),w("")}if(G.length>0){let t=G.map(e=>new File([e.blob],e.originalName,{type:e.blob.type})),n=await m.sendChatwootFiles(e,t);f(e=>[...e,n])}};try{try{await a(n)}catch(r){let e;if(((e=r?.message||String(r||"")).includes("Conversation not found")||e.includes("Access denied"))&&"widget"===h){let e=await ej(t);if(!e)throw r;n=e,await a(n)}else throw r}V([]),$(null),window.__msTracker?.sendTyping("",n),setTimeout(()=>window.__msTracker?.sendTypingStop(),100),"widget"!==h||eu.current||(window.__msTracker?.sendChatOpened(n),eu.current=!0)}catch(e){console.error("Failed to send:",e),(0,R.P)("Couldn't send your message â please try again in a moment.")}finally{k(!1)}},eP=e=>{w(t=>t+e.native),W(!1),eh(null)},eC=async e=>{for(let t of Array.from(e)){if(G.length>=5)break;let e=await p(t);e&&V(t=>t.length<5?[...t,e]:t)}};r.useEffect(()=>{let e=e=>{if(!ei.current?.contains(document.activeElement))return;let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e=0;e<t.length;e++)if(t[e].type.startsWith("image/")){let a=t[e].getAsFile();a&&n.push(a)}n.length>0&&(e.preventDefault(),eC(n))};return document.addEventListener("paste",e),()=>document.removeEventListener("paste",e)},[G.length]);let eS=_.filter(e=>!D(e));return(0,a.jsxs)("div",{ref:ei,style:{display:"contents"},onClick:()=>{null!==ep&&(eg(null),em.current=_.length)},children:[t&&(0,a.jsxs)("div",{className:v().chatHeader,children:[!1!==s&&l&&(0,a.jsx)("button",{className:v().chatBackBtn,onClick:l,children:(0,a.jsx)("i",{className:"fa-solid fa-arrow-left"})}),(0,a.jsxs)("div",{className:v().chatHeaderText,children:[(0,a.jsx)("span",{className:v().chatTitle,children:n&&n.startsWith("Order #")?(0,a.jsx)("a",{translate:"no",href:`/account/orders/${n.replace("Order #","")}`,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline",textUnderlineOffset:2},children:n}):n||""}),"widget"===h&&u&&u.online_count>0&&(0,a.jsxs)("span",{className:v().chatHeaderPresence,children:[(0,a.jsx)("span",{className:v().chatHeaderPresenceDot}),(0,a.jsx)("span",{children:`Online \xb7 replies in ~${u.reply_eta_minutes} min`})]})]}),c&&(0,a.jsx)("button",{className:v().chatCloseBtn,onClick:c,children:(0,a.jsx)("i",{className:"fa-solid fa-xmark"})})]}),d&&(0,a.jsx)("div",{style:{padding:"8px 12px"},children:d}),(0,a.jsx)("div",{className:`${v().chatscapeWrap} ${Q?v().dropZoneActive:""}`,onDragOver:e=>{e.preventDefault(),q(!0)},onDragLeave:()=>q(!1),onDrop:e=>{e.preventDefault(),q(!1),e.dataTransfer.files.length>0&&eC(e.dataTransfer.files)},children:(0,a.jsx)(B.cW,{children:(0,a.jsxs)(B.Mf,{children:[x&&0===eS.length&&(0,a.jsx)(B.Mf.Content,{children:(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"20px 0"},children:[1,2,3].map(e=>(0,a.jsx)("div",{style:{display:"flex",flexDirection:e%2==0?"row-reverse":"row",gap:8,alignItems:"flex-end"},children:(0,a.jsx)("div",{style:{width:`${40+20*e}%`,height:32,borderRadius:12,background:"rgba(255,255,255,0.04)",animation:"pulse 1.5s ease-in-out infinite",animationDelay:`${.2*e}s`}})},e))})}),!x&&0===eS.length&&(0,a.jsx)(B.Mf.Content,{children:(0,a.jsxs)("div",{className:v().chatEmptyState,children:[(0,a.jsx)("div",{className:v().chatEmptyIcon,"aria-hidden":"true",children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})}),(0,a.jsx)("p",{className:v().chatEmptyTitle,children:"Hi there \uD83D\uDC4B"}),(0,a.jsx)("p",{className:v().chatEmptyText,children:"Type below or upload a screenshot â we usually reply within a few minutes."})]})}),eS.map((e,t)=>(0,a.jsxs)(r.Fragment,{children:[ep===e.id&&(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,margin:"8px 0"},children:[(0,a.jsx)("div",{style:{flex:1,height:1,background:"rgba(196,162,245,0.4)"}}
1),(0,a.jsx)("span",{style:{fontSize:10,color:"rgba(196,162,245,0.7)",whiteSpace:"nowrap",fontWeight:500},children:"New Messages"}),(0,a.jsx)("div",{style:{flex:1,height:1,background:"rgba(196,162,245,0.4)"}})]}),(0,a.jsx)(C,{message:e,messages:eS,index:t,onImageClick:O,onReply:$,onContextMenu:(e,t)=>U({messageId:t.id,x:e.clientX,y:e.clientY}),onScrollToMessage:ev,onReaction:ew,readAt:ea})]},e.id)),X&&(0,a.jsx)(B.QB,{model:{direction:"incoming",position:"single"},children:(0,a.jsx)(B.QB.CustomContent,{children:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5},children:[(0,a.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:"rgba(196,162,245,0.6)",animation:"typingBounce 1.2s ease-in-out infinite",display:"inline-block"}}),(0,a.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:"rgba(196,162,245,0.6)",animation:"typingBounce 1.2s ease-in-out 0.2s infinite",display:"inline-block"}}),(0,a.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:"rgba(196,162,245,0.6)",animation:"typingBounce 1.2s ease-in-out 0.4s infinite",display:"inline-block"}})]}),(0,a.jsxs)("span",{style:{fontSize:10,color:"rgba(255,255,255,0.3)",fontStyle:"italic"},children:[(0,a.jsx)("span",{translate:"no",children:J})," is typing..."]})]})})})]})})}),F&&i.createPortal((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{style:{position:"fixed",inset:0,zIndex:1100},onClick:()=>U(null),onContextMenu:e=>{e.preventDefault(),U(null)}}),(0,a.jsxs)("div",{style:{position:"fixed",left:Math.min(F.x,window.innerWidth-220),top:Math.min(F.y,window.innerHeight-120),zIndex:1101,width:200,background:"rgba(23,23,26,0.98)",backdropFilter:"blur(12px)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 4px 16px rgba(0,0,0,0.4)",padding:4},children:[(0,a.jsxs)("div",{style:{display:"flex",gap:4,padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.06)"},children:[["\uD83D\uDC4D","â¤ï¸","â
","\uD83D\uDE4F"].map(e=>(0,a.jsx)("button",{style:{width:32,height:32,border:"none",background:"transparent",fontSize:18,cursor:"pointer",borderRadius:6,display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.1s"},onMouseEnter:e=>e.currentTarget.style.background="rgba(255,255,255,0.08)",onMouseLeave:e=>e.currentTarget.style.background="transparent",onClick:()=>{ew(F.messageId,e),U(null)},children:e},e)),(0,a.jsx)("button",{style:{width:32,height:32,border:"none",background:"transparent",color:"rgba(255,255,255,0.4)",fontSize:16,cursor:"pointer",borderRadius:6,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>e.currentTarget.style.background="rgba(255,255,255,0.08)",onMouseLeave:e=>e.currentTarget.style.background="transparent",onClick:()=>{Y({messageId:F.messageId,x:F.x,y:F.y}),U(null)},title:"More reactions",children:"+"})]}),(0,a.jsxs)("button",{style:{width:"100%",height:32,display:"flex",alignItems:"center",gap:8,padding:"0 10px",border:"none",background:"transparent",color:"rgba(255,255,255,0.8)",fontSize:12,cursor:"pointer",borderRadius:6},onClick:()=>{let e=_.find(e=>e.id===F.messageId);e&&$(e),U(null)},children:[(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,a.jsx)("polyline",{points:"9 17 4 12 9 7"}),(0,a.jsx)("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"})]}),"Reply"]}),(0,a.jsxs)("button",{style:{width:"100%",height:32,display:"flex",alignItems:"center",gap:8,padding:"0 10px",border:"none",background:"transparent",color:"rgba(255,255,255,0.8)",fontSize:12,cursor:"pointer",borderRadius:6},onClick:()=>{let e=_.find(e=>e.id===F.messageId);e&&navigator.clipboard.writeText(e.content||""),U(null)},children:[(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,a.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,a.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy Text"]})]})]}),document.body),K&&i.createPortal((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{style:{position:"fixed",inset:0,zIndex:1100},onClick:()=>Y(null)}),(0,a.jsx)("div",{style:{position:"fixed",left:Math.min(K.x,window.innerWidth-280),top:Math.min(K.y-60,window.innerHeight-120),zIndex:1101},children:(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,padding:8,background:"rgba(23,23,26,0.98)",backdropFilter:"blur(12px)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:12,boxShadow:"0 4px 16px rgba(0,0,0,0.4)",maxWidth:260},children:["\uD83D\uDC4D","â¤ï¸","\uD83D\uDE02","\uD83D\uDE2E","\uD83D\uDE22","\uD83D\uDD25","\uD83D\uDC4E","â
","â","\uD83D\uDC40","\uD83C\uDF89","\uD83D\uDCAF","\uD83D\uDE4F","\uD83D\uDC4F"].map(e=>(0,a.jsx)("button",{style:{width:36,height:36,border:"none",background:"transparent",fontSize:20,cursor:"pointer",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.1s"},onMouseEnter:e=>e.currentTarget.style.background="rgba(255,255,255,0.08)",onMouseLeave:e=>e.currentTarget.style.background="transparent",onClick:()=>{ew(K.messageId,e),Y(null)},children:e},e))})})]}),document.body),G.length>0&&(0,a.jsxs)("div",{className:v().stagingBar,children:[G.map(e=>(0,a.jsxs)("div",{className:v().stagingThumb,children:[(0,a.jsx)("img",{src:e.previewUrl,alt:e.originalName}),(0,a.jsx)("button",{className:v().stagingRemove,onClick:()=>V(t=>t.filter(t=>t.id!==e.id)),children:(0,a.jsx)("i",{className:"fa-solid fa-xmark"})}),(0,a.jsxs)("span",{className:v().stagingSize,children:[(e.size/1024).toFixed(0),"KB"]})]},e.id)),G.length<5&&(0,a.jsx)("button",{className:v().stagingAdd,onClick:()=>eo.current?.click(),children:(0,a.jsx)("i",{className:"fa-solid fa-plus"})})]}),ef.length>0&&(0,a.jsx)("div",{className:v().triggerChipRow,children:ef.map(e=>{let t=(0,S.K7)(e.label),n=(0,a.jsxs)(a.Fragment,{children:[t.icon?(0,a.jsx)("span",{className:v().chipIcon,children:(0,a.jsx)("i",{className:t.icon,"aria-hidden":"true"})}):t.emoji?(0,a.jsx)("span",{className:v().chipIcon,"aria-hidden":"true",children:t.emoji}):null,(0,a.jsx)("span",{children:t.label})]});return e.url?(0,a.jsxs)("a",{className:v().triggerChipBtn,href:e.url,target:"_blank",rel:"noopener noreferrer",children:[n,(0,a.jsxs)("svg",{className:v().chipExternal,width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,a.jsx)("path",{d:"M14 4h6v6"}),(0,a.jsx)("path",{d:"M20 4 11 13"}),(0,a.jsx)("path",{d:"M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"})]})]},`${e.url} ${e.label}`):(0,a.jsx)("button",{className:v().triggerChipBtn,disabled:j,onClick:()=>ex(e.label),children:n},e.label)})}),H&&(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",borderTop:"1px solid rgba(162,164,245,0.08)",background:"rgba(196,162,245,0.03)"},children:[(0,a.jsx)("div",{style:{width:3,borderRadius:2,flexShrink:0,alignSelf:"stretch",background:0===H.message_type?"rgba(196,162,245,0.6)":"rgba(224,131,148,0.6)"}}),(0,a.jsx)("div",{style:{flex:1,minWidth:0},children:(0,a.jsx)("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(H.content||"").substring(0,40)||"[Attachment]"})}),(0,a.jsx)("button",{style:{width:20,height:20,border:"none",background:"transparent",color:"rgba(255,255,255,0.3)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},onClick:()=>$(null),children:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,a.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,a.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),(0,a.jsxs)("div",{className:v().chatInput,ref:ec,children:[(0,a.jsx)("textarea",{value:b,onChange:t=>{w(t.target.value),window.__msTracker?.sendTyping(t.target.value,e),null!==ep&&(eg(null),em.current=_.length)},onKeyDown:e=>{let t=window.innerWidth<480;"Enter"!==e.key||e.shiftKey||t||(e.preventDefault(),ek())},onBlur:()=>{window.__msTracker?.sendTypingStop()},disabled:j,className:v().chatTextarea,placeholder:"Type a message...",rows:2}),(0,a.jsxs)("div",{className:v().chatToolbarRow,children:[(0,a.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,a.jsx)("button",{ref:el,className:v().chatIconBtn,onClick:()=>
1{if(P){W(!1),eh(null);return}if("widget"===h&&(window.matchMedia?.("(pointer: coarse)")?.matches||window.innerWidth<640)){let e=(ec.current?.offsetHeight??96)+8;eh({mode:"sheet",bottom:e,height:`clamp(180px, calc(100% - ${e+64}px), 435px)`}),W(!0);return}let e=el.current?.getBoundingClientRect();e&&eh({mode:"floating",top:Math.max(8,e.top-370),left:Math.max(8,Math.min(e.left-150,window.innerWidth-328))}),W(!0)},title:"Emoji",children:(0,a.jsx)("i",{className:"fa-regular fa-face-smile"})}),(0,a.jsx)("button",{className:v().chatIconBtn,onClick:()=>eo.current?.click(),title:"Attach image",children:(0,a.jsx)("i",{className:"fa-solid fa-paperclip"})})]}),(0,a.jsx)("input",{ref:eo,type:"file",multiple:!0,onChange:e=>{e.target.files&&eC(e.target.files),eo.current&&(eo.current.value="")},style:{display:"none"},accept:"image/png,image/jpeg,image/gif,image/webp"}),(0,a.jsxs)("button",{className:v().chatSendBtn,onClick:()=>ek(),disabled:j||!b.trim()&&0===G.length,"aria-label":"Send (Enter)","aria-busy":j,children:[j?(0,a.jsx)("svg",{className:v().chatSendBtnSpinner,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}):(0,a.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,a.jsx)("path",{d:"M22 2L11 13"}),(0,a.jsx)("path",{d:"M22 2l-7 20-4-9-9-4 20-7z"})]}),j?"Sendingâ¦":"Send",!j&&(0,a.jsx)("span",{className:v().chatSendBtnKbd,children:"âµ"})]})]})]}),P&&ed?.mode==="sheet"&&(0,a.jsx)("div",{className:`${v().emojiPickerPopup} ${v().emojiPickerSheet}`,ref:es,style:{bottom:ed.bottom,height:ed.height},children:(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("div",{className:v().emojiLoading,children:"Loading..."}),children:(0,a.jsx)(E,{data:L,onEmojiSelect:eP,theme:"dark",dynamicWidth:!0,maxFrequentRows:1,previewPosition:"none",skinTonePosition:"none"})})}),P&&ed?.mode==="floating"&&"u">typeof document&&i.createPortal((0,a.jsx)("div",{className:v().emojiPickerPopup,ref:es,style:{top:ed.top,left
1:ed.left},children:(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("div",{className:v().emojiLoading,children:"Loading..."}),children:(0,a.jsx)(E,{data:L,onEmojiSelect:eP,theme:"dark",perLine:8,maxFrequentRows:1,previewPosition:"none",skinTonePosition:"none"})})}),document.body),z&&(0,a.jsx)(M,{src:z,onClose:()=>O(null)})]})}},85821:()=>{},99544:(e,t,n)=>{"use strict";n.d(t,{s:()=>_,t:()=>m});let a=null,r=!1,i=0,o=!1,s=null,l=Math.random().toString(36).slice(2),c=0,d=new Map;function h(){if(!a)try{(a=new Audio("/notifications/chat-notification.mp3")).preload="auto",a.volume=.5}catch{a=null}return a}function u(){if("u"<typeof BroadcastChannel)return null;if(!s)try{(s=new BroadcastChannel("ms-chat-sound")).onmessage=e=>{let t=e?.data;t&&t.tabId!==l&&("played"===t.type?c=Date.now():"intent"===t.type&&d.set(String(t.tabId),Date.now()))}}catch{s=null}return s}function p(e){try{u()?.postMessage({type:e,tabId:l})}catch{}}function g(){let e=h();if(e){i=Date.now(),p("played");try{e.currentTime=0,e.play().catch(()=>{})}catch{}}}function m(){if(o)return;o=!0,u();let e=()=>{if(r)return;let t=h();if(t){r=!0;try{t.muted=!0;let e=t.play(),n=()=>{try{t.pause(),t.currentTime=0,t.muted=!1}catch{}};e&&"function"==typeof e.then?e.then(n).catch(()=>{try{t.muted=!1}catch{}r=!1}):n()}catch{r=!1}r&&(window.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",e,!0),window.removeEventListener("touchend",e,!0))}};window.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",e,!0),window.addEventListener("touchend",e,!0)}function _(){m();let e=Date.now();if(!(e-i<1500)&&!(e-c<1500)){if(!document.hidden)return void g();d.clear(),p("intent"),window.setTimeout(()=>{let e=Date.now();if(!(e-c<1500)&&!(e-i<1500)){for(let[t,n]of d)if(e-n<=1750&&t<l)return;g()}},250)}}}}]);
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.