1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[96297],{WqM6:function(e,n,t){t.r(n)},pgUe:function(e,n,t){t.r(n),t.d(n,{PERSONAL_AREA_FOOTER_BOTTOM_PROPS:function(){return Ze},default:function(){return en}});var s=t("sViW"),a=t("M5j3"),l=t("5ene"),i=t("jg1C"),r=t("ERkP"),o=t("aWzz"),c=t.n(o),d=t("0bwO"),u=t("pRvs"),m=t("+hKN"),h=t("ogaj"),x=t("c0N1"),p=t("mG/d"),f="re-UserBannerTenantCTA",v="https://www.fotocasa.es/seguro-impago/estudio-solvencia-alquiler/?utm_source=fotocasa&utm_medium=ap_mis_mensajes";function E(){var e=(0,m.s9)(),n=(0,h.A)(),t=n.trackEvent,s=n.TRACKING_EVENTS.SEGMENT;return(0,x.A)((function(){t({channel:"my_account",component_label:"calculate_insurance",eventName:s.UPSELLING_INSURANCE_MODULE_SHOWED,eventVersion:2,page_type:"my_account",position:"my_messages"})})),(0,i.jsxs)("div",{className:f,role:"banner",children:[(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:e.t("USER.MY_MESSAGES.CTA.QUESTION")})," ",e.t("USER.MY_MESSAGES.CTA.TEXT")]}),(0,i.jsx)(p.Y,{href:v,className:"ml-lg no-underline",intent:"main",title:e.t("USER.MY_MESSAGES.CTA.BUTTON_TEXT"),rel:"nofollow",target:"_blank",children:e.t("USER.MY_MESSAGES.CTA.BUTTON_TEXT")})]})}E.propTypes={};var g=t("cZ61"),S=t("fXOh"),j=(0,r.createContext)(null),N=function(e){var n=e.children,t=(0,r.useState)(new Map),s=t[0],a=t[1],l=(0,r.useState)(!1),o=l[0],c=l[1],d=(0,r.useState)(null),u=d[0],m=d[1],h=(0,r.useState)(!1),x=h[0],p=h[1],f=(0,r.useState)(0),v=f[0],E=f[1],g=(0,r.useState)(0),S=g[0],N=g[1],_=(0,r.useState)(!1),b=_[0],A=_[1],y=(0,r.useMemo)((function(){return{selectedChannels:s,edit:o,channels:u,customActiveChannel:x,channelKey:v,showBlockedUsers:b,blockedUsersKey:S,setSelectedChannels:a,setEdit:c,setChannels:m,setCustomActiveChannel:p,setChannelKey:E,setShowBlockedUsers:A,setBlockedUsersKey:N}}),[s,o,u,x,v,b,S]);return(0,i.jsx)(j.Provider,{value:y,children:n})},_=function(){var e=(0,r.useContext)(j);if(!e)throw new Error("useMessagingContext must be used within the MessagingProvider");return e};N.propTypes={children:c().object};var b=t("nMSI"),A=t("8OqJ"),y=t("HejH"),I=t("A54u"),R=t("AnbT"),T=t("Wj7w"),C=t("CIgQ"),M=t("yaX/"),O=t("WSWA"),G=t("meUR"),U=t("CE13"),w=t("UtOZ"),L=t("6aWq"),k=t("CJ1Y"),P=function(e){var n=e.onClick,t=e.disabled,s="left"===e.direction;return(0,i.jsx)(k.K,{variant:"solid",intent:"surface",size:"lg",onClick:n,disabled:t,className:"absolute z-raised top-[calc(50%-24px)] shadow-md "+(s?"ml-lg":"mr-lg right-none"),children:(0,i.jsx)(L.I,{size:"sm",children:s?(0,i.jsx)(U.nk,{}):(0,i.jsx)(w.Qp,{})})})};P.displayName="NavArrow",P.propTypes={onClick:c().func,disabled:c().bool,direction:c().string};var B=function(e){var n=e.images,t=[];return Object.values(n).forEach((function(e){e.image_url&&t.push({original:e.image_url})})),(0,i.jsx)(G.A,{items:t,showNav:!0,showFullscreenButton:!0,showPlayButton:!1,showIndex:!0,renderLeftNav:function(e,n){return(0,i.jsx)(P,{onClick:e,disabled:n,direction:"left"})},renderRightNav:function(e,n){return(0,i.jsx)(P,{onClick:e,disabled:n,direction:"right"})}})};B.propTypes={images:c().object.isRequired};var K=t("vSET"),D=t("4bTS"),z=t("4sKF"),W=function(e){var n=e.attachmentId,t=e.removeAttachments;return(0,i.jsx)(k.K,{size:"md",intent:"surface",variant:"solid",className:"absolute top-sm right-sm shadow-md",onClick:function(){t(n)},children:(0,i.jsx)(L.I,{size:"sm",children:(0,i.jsx)(z.yT,{})})})};W.displayName="CloseButton",W.propTypes={attachmentId:c().string,removeAttachments:c().func};var F=function(e){var n,t,s,a=e.attachment,l=e.removeAttachments,r="uploading"===(null==a||null==(n=a.localMetadata)?void 0:n.uploadState);return(0,i.jsx)("div",{className:"flex "+(r?"justify-center":" justify-start")+" items-center relative rounded-md min-w-208 w-208 h-80 bg-main-container overflow-hidden",children:r?(0,i.jsx)(O.y,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"max-w-[65%] text-body-1 line-clamp-3 whitespace-normal mx-lg my-md",children:null==a?void 0:a.title}),(0,i.jsx)(W,{attachmentId:null==a||null==(t=a.localMetadata)?void 0:t.id,removeAttachments:l})]})},(null==a||null==(s=a.localMetadata)?void 0:s.id)||(null==a?void 0:a.image_url))};F.displayName="FilePreview",F.propTypes={attachment:c().object,removeAttachments:c().func};var H=function(e){var n,t,s,a=e.attachment,l=e.removeAttachments,r="uploading"===(null==a||null==(n=a.localMetadata)?void 0:n.uploadState);return(0,i.jsx)("div",{className:"flex justify-center items-center relative rounded-md w-80 h-80",children:r?(0,i.jsx)(O.y,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("img",{src:null==a?void 0:a.image_url,alt:null==a?void 0:a.fallback,
1className:"w-80 h-80 object-cover rounded-md"}),(0,i.jsx)(W,{removeAttachments:l,attachmentId:null==a||null==(t=a.localMetadata)?void 0:t.id})]})},(null==a||null==(s=a.localMetadata)?void 0:s.id)||(null==a?void 0:a.image_url))};H.displayName="ImagePreview",H.propTypes={attachment:c().object,removeAttachments:c().func};var Y=function(e){var n=(0,K.t)().attachments;return(null==n?void 0:n.length)?(0,i.jsx)(D.o,(0,a.A)({},e,{ImageAttachmentPreview:H,FileAttachmentPreview:F,VideoAttachmentPreview:F})):null},V=t("fTPE"),q=t("o1GQ"),J=t("tcvQ"),Q=t("3aSz"),X=function(){var e=_(),n=e.selectedChannels,t=e.customActiveChannel,s=e.setCustomActiveChannel,a=(0,Q.vd)().setActiveChannel;return{handleActiveChannel:function(e){var l=null==e?void 0:e.channel,i=null==e?void 0:e.forceClear,r=n.get(null==t?void 0:t.id),o=(null==l?void 0:l.id)===(null==t?void 0:t.id),c=i&&o,d=i&&!l;l&&!i?function(e){a(e),s(e)}(l):(r||c||d)&&(a(null),s(null))}}},$=t("iIqQ"),Z=t("1t3e"),ee=t("dTs1"),ne=t("e4R/"),te=function(){var e=_().setChannels,n=(0,m.Jd)();return{loadChannels:(0,r.useCallback)((0,s.A)((function(t){var s,a,i,r,o,c,d,u,m;return(0,l.YH)(this,(function(l){switch(l.label){case 0:if(!t||!(null==n?void 0:n.id))return[2];s={members:{$in:[null==n?void 0:n.id]},type:"messaging"},a={last_message_at:-1},i=[],r=30,o=!0,c=0,l.label=1;case 1:return o?(u={presence:!0,state:!0,limit:30,offset:c},[4,t.queryChannels(s,a,u)]):[3,3];case 2:return m=l.sent(),(d=i).push.apply(d,m),m.length<r&&(o=!1),c+=r,[3,1];case 3:return e((function(e){return(null==e?void 0:e.length)!==i.length?i:e})),[2]}}))})),[null==n?void 0:n.id,e])}},se=t("A2hN"),ae=function(){var e=(0,m.s9)(),n=function(n){var t=n.action,s=n.status,a=n.count,l=function(n,t){var s,a;switch(n){case"block":s=e.t("USER.MESSAGING.BLOCK_ALERT_TITLE"),a=e.t("USER.MESSAGING.BLOCK_ALERT_DESCRIPTION");break;case"unblock":s=e.t("USER.MESSAGING.UNBLOCK_ALERT_TITLE"),a=e.t("USER.MESSAGING.UNBLOCK_ALERT_DESCRIPTION");break;case"delete":s=e.t("USER.MESSAGING.DELETE_ALERT_TITLE",{smart_count:t}),a=e.t("USER.MESSAGING.DELETE_ALERT_DESCRIPTION",{smart_count:t});break;case"error":s=e.t("USER.MESSAGING.GENERIC_ERROR_ALERT_TITLE"),a=e.t("USER.MESSAGING.GENERIC_ERROR_ALERT_DESCRIPTION")}return{title:s,description:a}}(t,void 0===a?1:a),i=l.title,r=l.description;(0,se.oR)({title:i,description:r,status:s},{duration:3e3})};return{displayToast:n,displayError:function(){return n({action:"apiError",status:"error"})}}},le=t("bUKB"),ie=t("/y3p"),re=function(e){var n,t,s,a=e.isOpen,l=e.onOpenChange,r=e.confirmAction,o=e.type,c=e.count,d=void 0===c?1:c,u=(0,m.s9)();switch(o){case"block":n=u.t("USER.MESSAGING.BLOCK_PROFILE_ACTION"),t=u.t("USER.MESSAGING.BLOCK_PROFILE_CONFIRMATION_TEXT"),s=u.t("USER.MESSAGING.BLOCK");break;case"delete":n=u.t("USER.MESSAGING.REMOVE_CONVERSATION_ACTION"),t=u.t("USER.MESSAGING.DELETE_CONFIRMATION_TEXT",{smart_count:d}),s=u.t("USER.MESSAGING.REMOVE")}return(0,i.jsx)(le.Lt,{open:a,onOpenChange:l,children:(0,i.jsxs)(le.P4,{children:[(0,i.jsx)(le.LA,{}),(0,i.jsxs)(le.EO,{children:[(0,i.jsx)(le.wd,{children:(0,i.jsx)(le.r7,{asChild:!0,children:(0,i.jsx)("h3",{className:"m-none",children:n})})}),(0,i.jsx)(le.vZ,{children:(0,i.jsx)(le.$v,{asChild:!0,children:(0,i.jsx)("p",{className:"m-none",children:t})})}),(0,i.jsxs)(le.ck,{className:"flex justify-end gap-md",children:[(0,i.jsx)(le.Zr,{asChild:!0,children:(0,i.jsx)(ie.$,{variant:"outlined",children:u.t("CANCEL")})}),(0,i.jsx)(le.Rx,{asChild:!0,children:(0,i.jsx)(ie.$,{onClick:r,children:s})})]})]})]})})};re.displayName="ConfirmationModal",re.propTypes={isOpen:c().bool,onOpenChange:c().func,confirmAction:c().func,type:c().string,count:c().number};var oe=function(e){var n=e.isChannelList,t=void 0!==n&&n,s=e.receiver,a=e.channel,l=(0,m.s9)(),o=(0,m.sn)(),c=(0,m.Jd)(),d=_().setChannelKey,u=X().handleActiveChannel,h=te().loadChannels,x=ae(),p=x.displayToast,f=x.displayError,v=(0,Q.vd)().client,E=(0,r.useState)(!1),g=E[0],S=E[1],j=(0,r.useState)(null),N=j[0],b=j[1],A=function(e){S(!1),b(e)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(ne.rI,{open:g,onOpenChange:S,children:[(0,i.jsx)(ne.ty,{asChild:!0,children:(0,i.jsx)(k.K,{variant:"ghost","aria-label":l.t("USER.MESSAGING.OPTIONS_MENU_BUTTON"),className:"absolute right-lg "+(t?"top-[25px]":"top-md"),children:(0,i.jsx)(L.I,{size:"md",children:(0,i.jsx)(ee.kO,{})})})}),(0,i.jsxs)(ne.SQ,{children:[(0,i.jsxs)(ne._2,{onSelect:function(){return A("delete")},children:[(0,i.jsx)(L.I,{children:(0,i.jsx)($.sK,{})}),(0,i.jsx)("span",{children:l.t("USER.MESSAGING.REMOVE_CONVERSATION_ACTION")})]}),(0,i.jsxs)(ne._2,{onSelect:function(){return A("block")},children:[(0,i.jsx)(L.I,{children:(0,i.jsx)(Z.$h,{})}),(0,i.jsx)("span",{children:l.t("USER.MESSAGING.BLOCK_PROFILE_ACTION")})]})]})]}),(0,i.jsx)(re,{isOpen:Boolean(N),onOpenChange:function(){return b(null)},type:N,confirmAction:"block"===N?function(){var e;o.get("block_user_messaging_use_case").execute({userId:null==c?void 0:c.id,blockedUserId:null==s||null==(e=s.user)?void 0:e.id}).then((function(){u({channel:a,forceClear:!0}),p({action:"block",status:"success"}),d((function(e){return++e})),h(v)})).catch((function(){return f()}))}:function(){o.get("hide_conversation_messaging_use_case").execute({userId:null==c?void 0:c.id,channelIds:[a.id]}).then((function(){u({channel:a,forceClear:!0}),p({action:"delete",status:"success"})})).catch((function(){return f()}))}})]})};oe.displayName="DropDownMenu",oe.propTypes={isChannelList:c().bool,receiver:c().object,channel:c().object};var ce=t("wFAJ"),de=t.n(ce),ue=t("MJec"),me=function(e){var n,t,s,a=e.type,l=e.channel,o=(0,m.s9)(),c=(0,m.Jd)(),d=(0,Q.vd)().client,u=null!=(s=null==l||null==(n=l.state)?void 0:n.members)?s:{},h=Object.values(u).find((function(e){return e.user_id!==(null==c?void 0:c.id)})),x=null==h||null==(t=h.user)?void 0:t.online,p=(0,r.useState)(x),f=p[0],v=p[1],E=f?o.t("USER.MESSAGING.ONLINE"):o.t("USER.MESSAGING.OFFLINE"),g=o.t("USER.MESSAGING.BLOCKED");return(0,r.useEffect)((function(){var e=function(e){(null==e?void 0:e.user.id)===(null==h?void 0:h.user_id
1)&&v(null==e?void 0:e.user.online)};return e(),d.on("user.presence.changed",e),function(){d.off("user.presence.changed",e)}}),[d,null==h?void 0:h.user_id]),"block"===a?(0,i.jsx)(ue.v,{intent:"alert",className:"ml-mdp",children:g}):"text"===a?(0,i.jsx)("span",{className:de()("text-caption md:block md:text-right ",{"text-success":f,"text-error":!f}),children:(0,i.jsx)("strong",{children:E})}):"status"===a&&f?(0,i.jsx)(ue.v,{intent:"success",variant:"tinted",className:"ml-mdp",children:E}):null};me.displayName="UserStatus",me.propTypes={channel:c().object,type:c().oneOf(["text","status","block"]).isRequired};var he=function(){var e,n,t,s,a=(0,m.s9)(),l=(0,m.Jd)(),r=(0,V.BX)(),o=r.channel,c=r.members,d=X().handleActiveChannel,u=Object.values(c).find((function(e){return e.user_id!==(null==l?void 0:l.id)})),h=null==o||null==(e=o.state)||null==(n=e._channel)||null==(t=n.data)?void 0:t.ad;return(0,i.jsxs)("div",{className:"pt-md md:flex md:flex-row-reverse md:border-b-sm md:border-outline md:border-solid",children:[(0,i.jsx)(k.K,{"aria-label":a.t("USER.MESSAGING.BACK_BUTTON"),className:"absolute top-md left-lg md:hidden",onClick:function(){return d({forceClear:!0})},variant:"ghost",children:(0,i.jsx)(L.I,{size:"md",children:(0,i.jsx)(J.o6,{})})}),(0,i.jsxs)("div",{className:"px-[72px] pb-md md:flex-1 md:max-w-[50%] md:pl-none",children:[(0,i.jsx)("h2",{className:"truncate m-none text-body-2 md:text-right",children:null==u||null==(s=u.user)?void 0:s.name}),(0,i.jsx)(me,{type:"text",channel:o})]}),(0,i.jsxs)("a",{href:null==h?void 0:h.linkUrl,className:"flex no-underline bg-support-container border-solid px-lg py-md border-b-sm border-outline gap-lg text-body-2 md:flex-1 md:max-w-[50%] md:bg-background md:border-none md:pt-none",children:[(0,i.jsx)(q.A,{alt:null==h?void 0:h.description,autoRotation:!0,className:"rounded-md",height:"40",pinchHeight:56,pinchWidth:56,src:null==h?void 0:h.imageUrl,title:null==h?void 0:h.description,width:"40"}),(0,i.jsx)("div",{className:"flex flex-col flex-1 justify-center truncate",children:(0,i.jsx)("p",{className:"truncate m-none text-basic",children:(0,i.jsx)("strong",{children:null==h?void 0:h.description})})})]}),(0,i.jsx)(oe,{receiver:u,channel:o})]})};he.displayName="ChannelHeader";var xe=t("MrZ4"),pe=function(e){var n=e.isEmptyBlockList,t=(0,m.UK)(["resourcesHost"])[0],s=(0,m.s9)(),a=n?s.t("USER.MESSAGING.NO_BLOCKED_USERS"):s.t("USER.MESSAGING.NO_MESSAGES"),l=n?s.t("USER.MESSAGING.NO_BLOCKED_USERS_DESCRIPTION"):s.t("USER.MESSAGING.NO_MESSAGES_DESCRIPTION"),r=n?s.t("USER.MESSAGING.NO_BLOCKED_USERS_CALL_TO_ACTION_TEXT"):s.t("USER.MESSAGING.NO_MESSAGES_CALL_TO_ACTION_TEXT");return(0,i.jsx)("div",{className:"w-full h-full overflow-y-auto py-lg px-md",children:(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-full",children:[(0,i.jsx)("img",{alt:a,"aria-hidden":"true",height:"200",src:t+"/img/messaging/messaging_empty.svg",title:a,width:"296"}),(0,i.jsx)("h2",{className:"text-headline-1 my-xl",children:a}),(0,i.jsxs)("ul",{className:"max-w-320 m-none pl-xl text-body-1 text-wrap",children:[(0,i.jsx)("li",{children:l}),(0,i.jsx)("li",{children:r})]})]})})};pe.displayName="EmptyView",pe.propTypes={isEmptyBlockList:c().bool};var fe=function(e){var n=e.blockObject,t=(0,m.s9)(),s=(0,m.sn)(),a=_().setBlockedUsersKey,l=ae(),o=l.displayToast,c=l.displayError,d=(0,r.useState)(!1),u=d[0],h=d[1];if(n){return(0,i.jsxs)("div",{className:"flex items-center justify-between w-full p-lg pb-md max-w-416 gap-md",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"truncate text-body-2 m-none mb-sm",children:(0,i.jsx)("strong",{children:n.blocked_user.name})}),(0,i.jsx)(ue.v,{intent:"danger",variant:"tinted",children:t.t("USER.MESSAGING.BLOCKED")})]}),(0,i.jsx)(ie.$,{size:"sm",intent:"main",variant:"outlined",onClick:function(){h(!0),s.get("unblock_user_messaging_use_case").execute({userId:n.user.id,blockedUserId:n.blocked_user_id}).then((function(){o({action:"unblock",status:"success"}),a((function(e){return++e}))})).catch((function(){return c()})).finally((function(){return h(!1)}))},isLoading:u,children:t.t("USER.MESSAGING.UNBLOCK")})]})}};fe.displayName="BlockedUser",fe.propTypes={blockObject:c().object};var ve=function(){var e=(0,m.s9)(),n=_(),t=n.setShowBlockedUsers,s=n.blockedUsersKey,a=(0,Q.vd)().client,l=(0,r.useState)([]),o=l[0],c=l[1],d=(0,r.useState)(!0),u=d[0],h=d[1],x=0===o.length;(0,r.useEffect)((function(){null==a||a.getBlockedUsers().then((function(e){var n=e.blocks;c(n),h(!1)}))}),[a,s]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex items-center h-56 border-solid pl-md border-b-sm border-outline",children:[(0,i.jsx)(k.K,{"aria-label":e.t("USER.MESSAGING.BACK_BUTTON"),onClick:function(){return t(!1)},variant:"ghost",children:(0,i.jsx)(L.I,{size:"md",children:(0,i.jsx)(J.o6,{})})}),(0,i.jsx)("span",{className:"text-body-2 ml-md",children:(0,i.jsx)("strong",{children:e.t("USER.MESSAGING.BLOCKED_PROFILES")})})]},s),(0,i.jsx)("div",{className:"flex flex-col h-full md:overflow-y-auto",children:u?(0,i.jsx)("div",{className:"flex flex-col items-center justify-center w-full h-full py-lg",children:(0,i.jsx)(O.y,{intent:"main",size:"md"})}):x?(0,i.jsx)(pe,{isEmptyBlockList:!0}):o.map((function(e){return(0,i.jsx)(fe,{blockObject:e},e.blocked_user_id)}))})]})},Ee=t("I/9y"),ge=t("7xQW"),Se=function(){var e=(0,m.sn)(),n=(0,m.s9)(),t=(0,m.Jd)(),s=_(),a=s.channels,l=s.edit,o=s.selectedChannels,c=s.setEdit,d=s.setSelectedChannels,u=s.setShowBlockedUsers,h=X().handleActiveChannel,x=ae(),p=x.displayToast,f=x.displayError,v=(0,r.useState)(null),E=v[0],g=v[1],S=o.size,j=function(){return d(new Map)},N=function(){c(!1),j()};return(0,i.jsxs)("div",{className:"border-solid "+(l?"":"border-b-sm")+" border-outline",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between min-h-56 px-lg",children:[(0,i.jsxs)("h2",{className:"text-subhead m-none",children:[" ",n.t("USER.MESSAGING.MESSAGES")]}),l?(0,i.jsx)(k.K,{"aria-label":n.t("USER.MESSAGING.CLOSE_BUTTON"),onClick:N,variant:"ghost",children:(0,i.jsx)(L.I,{children:(0,i.jsx)(Ee.bm,{})})}):(0,i.jsxs)(ne.rI,{children:[(0,i.jsx)(ne.ty,{asChild:!0,children:(0,i.jsx)(k.K,{variant:"ghost","aria-label":n.t("USER.MESSAGING.OPTIONS_MENU_BUTTON"),children:(0,i.jsx)(L.I,{size:"md",children:(0,i.jsx)(ee.kO,{})})})}),(0,i.jsxs)(ne.SQ,{children:[(0,i.jsxs)(ne._2,{onSelect:function(){return c(!0)},children:[(0,i.jsx)(L.I,{size:"sm",children:(0,i.jsx)($.sK,{})}),(0,i.jsx)("span",{children:n.t("USER.MESSAGING.REMOVE_CONVERSATIONS_ACTION")})]}),(0,i.jsxs)(ne._2,{onSelect:function(){return u(!0)},children:[(0,i.jsx)(L.I,{size:"sm",children:(0,i.jsx)(ge.$q,{})}),(0,i.jsx)("span",{children:n.t("USER.MESSAGING.UNBLOCK_PROFILES_ACTION")})]})]})]})]}),l&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(ie.$,{disabled:0===S,onClick:function(){return g("delete")},className:"ml-lg",children:[n.t("USER.MESSAGING.DELETE_CONVERSATION")," ","("+S+")"]}),(0,i.jsx)("hr",{className:"border-solid border-b-sm border-outline my-md"}),(null==a?void 0:a.length)!==S?(0,i.jsx)(ie.$,{intent:"main",variant:"ghost",onClick:function(){var e=new Map;
1a.forEach((function(n){e.set(n.id,n)})),d(e)},className:"ml-lg mb-md",children:n.t("USER.MESSAGING.SELECT_ALL")}):(0,i.jsx)(ie.$,{intent:"main",variant:"ghost",onClick:j,className:"ml-lg mb-md",children:n.t("USER.MESSAGING.UNSELECT_ALL")})]}),(0,i.jsx)(re,{isOpen:Boolean(E),onOpenChange:function(){return g(null)},count:S,confirmAction:function(){var n=Array.from(o.values()).map((function(e){return e.id}));e.get("hide_conversation_messaging_use_case").execute({userId:null==t?void 0:t.id,channelIds:n}).then((function(){return p({action:"delete",status:"success",count:n.length})})).catch((function(){return f()})).finally((function(){N(),h()}))},type:E})]})};Se.displayName="ChannelListHeader";var je=t("vIJK"),Ne=function(e){var n,t,s,a,l,o,c,d=e.active,u=e.channel,h=e.lastMessage,x=(0,m.s9)(),p=(0,m.Jd)(),f=_(),v=f.selectedChannels,E=f.setSelectedChannels,g=f.edit,S=f.setEdit,j=f.customActiveChannel,N=X().handleActiveChannel;!function(e){var n=_().setChannels;(0,r.useEffect)((function(){if(e){var t=e.on("channel.hidden",(function(e){return n((function(n){return function(e,n){return e.filter((function(e){return(null==e?void 0:e.cid)!==(null==n?void 0:n.cid)}))}(n,e)}))}));return function(){return t.unsubscribe()}}}),[e,n])}(u);var b=v.has(u.id),A=null==u||null==(n=u.state)?void 0:n.unreadCount,y=Object.values(null==u||null==(t=u.state)?void 0:t.members).find((function(e){return e.user_id!==(null==p?void 0:p.id)})),I=null==u||null==(s=u.data)?void 0:s.image,R=null==u||null==(a=u.data)?void 0:a.name,T=new Date(null==h?void 0:h.updated_at),C=T.getDate()+"/"+(T.getMonth()+1),M=(null==h||null==(l=h.attachments)?void 0:l.length)&&!(null==h?void 0:h.text)?x.t("USER.MESSAGING.FILE_ADDED",{smart_count:null==h||null==(o=h.attachments)?void 0:o.length}):null==h?void 0:h.text,O=!(null==h?void 0:h.attachments.length)&&(null==h?void 0:h.text)?C+" - "+M:"";return(0,i.jsxs)("div",{className:"relative hover:bg-basic-container-hovered "+(d&&j?"bg-basic-container":""),children:[g&&(0,i.jsx)(je.S,{"aria-label":R,checked:b,className:"absolute border-solid top-lg left-lg",onCheckedChange:function(){E((function(e){var n=new Map(e);return n.has(u.id)?n.delete(u.id):n.set(u.id,u),0===n.size&&S(!1),n}))}}),(0,i.jsxs)("button",{className:"flex items-center gap-md text-left w-full pr-[56px] h-[90] cursor-pointer "+(g?"pl-[56px]":"pl-lg"),onClick:function(){return N({channel:u})},children:[(0,i.jsx)(q.A,{alt:R,autoRotation:!0,className:"rounded-md",pinchHeight:56,pinchWidth:56,src:I,title:R}),(0,i.jsxs)("div",{className:"overflow-hidden",children:[(0,i.jsxs)("p",{className:"m-none text-body-2 whitespace-nowrap",children:[null==y||null==(c=y.user)?void 0:c.name," ",(0,i.jsx)(me,{type:"status",channel:u})]}),(0,i.jsx)("p",{className:"truncate m-none text-body-2",children:(0,i.jsx)("strong",{children:R})}),(0,i.jsx)("p",{className:"truncate m-none text-caption",children:O})]}),A>0&&(0,i.jsx)("span",{className:"absolute top-[10px] aspect-square inline-flex justify-center items-center leading-[0] rounded-full bg-error text-surface text-caption !m-none p-sm "+(g?"left-[48px]":"left-[10px]"),children:A})]}),(0,i.jsx)(oe,{isChannelList:!0,receiver:y,channel:u})]})};Ne.displayName="ChannelPreview",Ne.propTypes={active:c().bool,channel:c().object,lastMessage:c().object};var _e=function(e){var n={members:{$in:[e.currentUserId]},type:"messaging"},t=_(),s=t.channels,a=t.channelKey,l=t.showBlockedUsers,r=(null==s?void 0:s.length)>0&&!l;return(0,i.jsxs)("div",{className:"relative flex flex-col w-full md:min-w-320 "+(r?"md:w-[33%] md:border-r-sm border-main-container border-solid":""),children:[l&&(0,i.jsx)(ve,{}),r&&(0,i.jsx)(Se,{}),(0,i.jsx)("div",{className:(l?"hidden":"flex-1")+" md:overflow-y-auto",children:(0,i.jsx)(xe.Y,{sort:{last_message_at:-1},filters:n,options:{presence:!0,state:!0},Preview:Ne,setActiveChannelOnMount:!1,EmptyStateIndicator:pe},a)})]})};_e.displayName="ChannelList",_e.propTypes={currentUserId:c().string};var be=t("R9Vz"),Ae=function(e){var n=e.date,t=e.unread,s=(0,m.s9)(),a=n.toLocaleDateString(s.culture,{day:"2-digit",month:"2-digit",year:"numeric"}),l=t?s.t("USER.MESSAGING.NEW_LABEL")+" - "+a:a;return(0,i.jsx)("div",{className:"p-lg",children:(0,i.jsx)("div",{className:"flex items-center justify-center",children:(0,i.jsx)("span",{className:(0,be.cn)("font-bold rounded-lg opacity-dim-1 py-sm px-md text-caption",{"bg-accent text-on-accent":t,"bg-overlay text-on-overlay":!t}),children:l})})})};Ae.displayName="CustomDateSeparator",Ae.propTypes={date:c().string.isRequired,unread:c().bool.isRequired};var ye=t("Z1Mj"),Ie=t("M+oL"),Re=t("SE3Q"),Te=t("BAgf"),Ce=t("6gvC"),Me=t("OBvh"),Oe=function(e){var n=e.inputRef,t=(0,Ie.N)();return(0,i.jsxs)("label",{className:"cursor-pointer p-md",children:[(0,i.jsx)(L.I,{size:"sm",children:(0,i.jsx)(Me.o3,{})}),(0,i.jsx)("input",{accept:".jpg, .jpeg, .png, .heic. webp",type:"file",multiple:!0,className:"sr-only",onChange:function(e){var s,a=e.currentTarget.files;a&&a.length>0&&(t.attachmentManager.uploadFiles(Array.from(a)),e.currentTarget.value="",null==n||null==(s=n.current)||s.focus())}})]})};Oe.displayName="AttachmentUploadButton",Oe.propTypes={inputRef:c().object.isRequired};var Ge=function(){var e=(0,m.s9)(),n=(0,ye.Oy)().handleSubmit,t=(0,Ie.N)(),s=(0,r.useState)(""),a=s[0],l=s[1];(0,r.useEffect)((function(){t.attachmentManager.maxNumberOfFilesPerMessage=20}),[t]);var o=(0,r.useRef)(null),c=(0,Re.aD)().AttachmentPreviewList,d=void 0===c?D.o:c;return(0,i.jsx)("form",{onSubmit:function(e){e.preventDefault(),t.textComposer.setText(a),n(e),l("")},className:"relative flex flex-col z-raised mb-none pt-sm border-t-sm border-solid border-outline",children:(0,i.jsxs)("fieldset",{className:"min-w-0
1w-full m-none",children:[(0,i.jsx)(d,{}),(0,i.jsxs)("div",{className:"flex flex-row items-center justify-center gap-md",children:[(0,i.jsx)(Oe,{inputRef:o}),(0,i.jsx)(Ce.pd,{className:"border-solid",placeholder:e.t("USER.MESSAGING.INPUT_PLACEHOLDER"),value:a,onChange:function(e){var n=e.target.value;l(n),t.textComposer.setText(n)},onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),t.textComposer.setText(a),n(e),l(""))},ref:o}),(0,i.jsx)(ie.$,{"aria-label":e.t("USER.MESSAGING.SEND_MESSAGE_BUTTON"),size:"md",type:"submit",children:(0,i.jsx)(L.I,{size:"sm",children:(0,i.jsx)(Te.Rc,{})})})]})]})})},Ue=t("pCUQ"),we=t("D62k"),Le=t("/L6T"),ke=function(){return(0,i.jsx)(L.I,{size:"sm",children:(0,i.jsx)(we.Jl,{})})},Pe=function(){return(0,i.jsx)(L.I,{size:"sm",children:(0,i.jsx)(Le.IQ,{})})},Be=function(e){return(0,i.jsx)(Ue.q,(0,a.A)({},e,{MessageDeliveredStatus:ke,MessageReadStatus:Pe}))},Ke=t("35CA"),De=function(e){return(0,i.jsx)(Ke.g,(0,a.A)({},e,{calendar:!1,format:"HH:mm"}))},ze=JSON.parse('{"New Messages!":"Nous missatges!"}'),We=t("OXIv"),Fe=function(){var e,n=(0,V.BX)().channelConfig,t=(0,Q.vd)().client,s=(0,We.w6)().typing,a=void 0===s?{}:s;if(!1===(null==n?void 0:n.typing_events))return null;var l=Object.values(a).find((function(e){var n,s=e.user;return(null==s?void 0:s.id)!==(null==(n=t.user)?void 0:n.id)})),r=null==l||null==(e=l.user)?void 0:e.name;return l?(0,i.jsxs)("div",{className:de()("str-chat__typing-indicator","w-[calc(100%-17px)] flex items-baseline gap-4 py-md px-xl absolute bottom-[1px]",{"str-chat__typing-indicator--typing":l}),children:[(0,i.jsx)("div",{className:"flex mr-md",children:(0,i.jsx)("div",{className:"font-bold text-on-background text-body-1",children:r})}),(0,i.jsxs)("div",{className:"flex border-none ml-none w-fit gap-x-[4px]",children:[(0,i.jsx)("div",{className:"flex bg-current opacity-none h-[6px] w-[6px] rounded-full animate-bounce [animation-delay:-0.3s]"}),(0,i.jsx)("div",{className:"flex bg-current opacity-none h-[6px] w-[6px] rounded-full animate-bounce [animation-delay:-0.15s]"}),(0,i.jsx)("div",{className:"flex bg-current opacity-none h-[6px] w-[6px] rounded-full animate-bounce"})]})]}):null},He=t("FsSp"),Ye=function(e){return(0,i.jsx)(He.E,{showCount:!0})},Ve=function(){var e=(0,m.UK)(["resourcesHost"])[0],n=(0,m.s9)();return(0,i.jsx)("div",{className:"w-full h-full overflow-y-auto py-lg px-md",children:(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-full",children:[(0,i.jsx)("img",{alt:n.t("USER.MESSAGING.EMPTY_VIEW_TITLE"),"aria-hidden":"true",height:"186",src:e+"/img/messaging/messaging_detail_empty.svg",title:n.t("USER.MESSAGING.EMPTY_VIEW_TITLE"),width:"248"}),(0,i.jsx)("h2",{className:"text-headline-1 my-xl",children:n.t("USER.MESSAGING.EMPTY_VIEW_TITLE")}),(0,i.jsxs)("ul",{className:"max-w-320 m-none pl-xl text-body-1 text-wrap",children:[(0,i.jsx)("li",{children:n.t("USER.MESSAGING.EMPTY_VIEW_ITEM_1")}),(0,i.jsx)("li",{children:n.t("USER.MESSAGING.EMPTY_VIEW_ITEM_2")})]})]})})},qe=t("OjEx"),Je=function(){var e=(0,m.s9)();return(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center w-full text-center border-solid p-xl border-main-container border-sm",children:[(0,i.jsx)(L.I,{size:"xl",children:(0,i.jsx)(qe.Sl,{})}),(0,i.jsx)("h2",{children:e.t("USER.MESSAGING.GENERIC_ERROR_ALERT_TITLE")}),(0,i.jsx)("p",{children:e.t("USER.MESSAGING.GENERIC_ERROR_ALERT_DESCRIPTION")})]})},Qe=function(e){var n=e.currentUser,t=(0,m.sn)(),a=(0,m.lT)(),o=(0,m.Ul)(),c=(0,m.UK)(["streamApiKey"])[0],d=(0,r.useState)(!1),u=d[0],h=d[1],x=_(),p=x.channels,f=x.customActiveChannel,v=x.showBlockedUsers,E=te().loadChannels,g=(0,M.fT)("(max-width:767px)"),S=(0,m.s9)(),j=!v&&(f||(null==p?void 0:p.length)>0&&!g),N=new A.L("ca"===S.locale?{language:"es",translationsForLanguage:ze}:{language:S.locale}),G=b.hxx.getInstance(c),U=(0,r.useCallback)((0,s.A)((function(){var e;return(0,l.YH)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,G.connectUser({id:null==n?void 0:n.id,name:null==n?void 0:n.username},(0,s.A)((function(){var e,s;return(0,l.YH)(this,(function(l){switch(l.label){case 0:return[4,t.get("get_stream_token_messaging_use_case").execute({cookies:a,userId:null==n?void 0:n.id})];case 1:return[2,null==(s=l.sent())||null==(e=s.token)?void 0:e.sessionToken]}}))})))];case 1:return i.sent(),o.metric({name:"messaging_chat_init",tags:[{key:"error",value:!1}]}),[4,E(G)];case 2:return i.sent(),[3,4];case 3:return e=i.sent(),o.metric({name:"messaging_chat_init",tags:[{key:"error",value:!0}]}),o.metric({name:"initializing_chat_messaging_errors",tags:[{key:"message",value:(null==e?void 0:e.message)||"Unknown error"}]}
1),h(!0),o.error({name:"initializing_chat_messaging_error",message:null==e?void 0:e.message,stack:null==e?void 0:e.stack}),[3,4];case 4:return[2]}}))})),[G,a,null==n?void 0:n.id,null==n?void 0:n.username,t,E,o]);return(0,r.useEffect)((function(){U()}),[U]),function(e){var n=te().loadChannels;(0,r.useEffect)((function(){if(e){var t=e.on((function(t){var s="message.new"===t.type,a="notification.message_new"===t.type,l="channel.hidden"===t.type;(s||a||l)&&n(e)}));return function(){return t.unsubscribe()}}}),[e,n])}(G),u?(0,i.jsx)(Je,{}):p?(0,i.jsx)("div",{id:"chat",className:"flex w-full border-solid border-main-container border-sm md:max-h-lg md:min-h-[50dvh] md:h-full md:border-sm overflow-y-auto",children:(0,i.jsxs)(y.r,{client:G,i18nInstance:N,children:[(0,i.jsx)(_e,{currentUserId:null==n?void 0:n.id}),(0,i.jsx)("div",{className:(j?"flex-1":"hidden")+" md:w-full md:overflow-hidden",children:(0,i.jsx)(I.c,{AttachmentPreviewList:Y,Avatar:function(){return null},DateSeparator:Ae,markReadOnMount:!0,MessageStatus:Be,MessageTimestamp:De,ModalGallery:B,TypingIndicator:Fe,UnreadMessagesSeparator:Ye,EmptyPlaceholder:(0,i.jsx)(Ve,{}),children:(0,i.jsxs)(R.p,{children:[(0,i.jsx)(he,{}),(0,i.jsx)(T.t,{disableDateSeparator:!1,scrollToLatestMessageOnFocus:!0,additionalVirtuosoProps:{alignToBottom:!0,followOutput:!0},shouldGroupByUser:!0,messageActions:[],channelUnreadUiState:!1}),(0,i.jsx)(C.E,{Input:Ge})]})})})]})}):(0,i.jsx)("div",{className:"flex items-center justify-center w-full min-h-[50dvh]",children:(0,i.jsx)(O.y,{intent:"main",size:"md"})})};Qe.propTypes={currentUser:c().object.isRequired};var Xe=Qe,$e="re-UserMyMessagesPage",Ze={titleTranslationKey:"USER.NAV.MY_MESSAGES_LITERAL",altTranslationKey:"USER.NAV.MY_MESSAGES_LITERAL",src:"https://frtassets.fotocasa.es/statics/img/user_messages_footer.svg"};function en(e){var n=e.seo,t=e.location,s=e.hasRentalAd,l=(0,h.A)().trackPageView,o=t.pathname,c=(0,m.Jd)(),d=(0,m.s9)();return(0,r.useEffect)((function(){l({pathname:o})}),[]),(0,i.jsxs)(g.A,{bottomImageProps:Ze,children:[(0,i.jsx)("header",{children:(0,i.jsx)(u.A,(0,a.A)({},n))}),(0,i.jsxs)("section",{className:$e,children:[(0,i.jsx)("h1",{className:$e+"-titlePage",children:d.t("USER.NAV.MY_MESSAGES_LITERAL")}),s&&(0,i.jsx)(E,{}),(0,i.jsx)(N,{children:(0,i.jsx)(Xe,{currentUser:c})})]})]})}var nn,tn=(nn=(0,s.A)((function(e){var n,t,s,a,i,r,o,c,d,u,m,h,x,p,f,v;return(0,l.YH)(this,(function(l){switch(l.label){case 0:n=e.context,t=e.routeInfo,s=n.domain,a=n.cookies,i=n.i18n,r=n.user,o=i.culture,c=s.get("config"),d=c("oldApiHost"),u=c("common"),m=u.ERRORS,l.label=1;case 1:return l.trys.push([1,5,,6]),[4,s.get("get_head_seo_use_case").execute({culture:o,page:en.displayName})];case 2:return h=l.sent(),[4,s.get("get_contact_details_ads_use_case").execute({cookies:a,userId:null==r?void 0:r.id})];case 3:return x=l.sent(),[4,s.get("new_get_my_ads_use_case").execute({cookies:a,user:r,contactDetails:x})];case 4:return p=l.sent().hasRentalAd,[2,{seo:h,hasRentalAd:p}];case 5:return(f=l.sent())instanceof m.UnauthorizedError||"UnauthorizedError"===(null==f?void 0:f.name)||401===(null==f?void 0:f.status)?[2,{__HTTP__:{redirectTo:(0,S.a)({basePath:d,pathName:(null==n?void 0:n.pathName)||"/mymessages",lang:(null==t||null==(v=t.params)?void 0:v.lang)||(null==i?void 0:i.culture)})}}]:[2,{seo:{},hasRentalAd:!1,streamToken:null}];case 6:return[2]}}
1))})),function(e){return nn.apply(this,arguments)});en.displayName="UserMyMessagesPage",en.propTypes={seo:c().object,hasRentalAd:c().bool,location:c().object},en.renderLoading=function(){return(0,i.jsx)(g.A,{isLoading:!0,bottomImageProps:Ze})};var sn=(0,S.O)(tn);en.getInitialProps=(0,d.sT)(sn)},o1GQ:function(e,n,t){t.d(n,{A:function(){return x}});var s=t("M5j3"),a=t("KnaF"),l=t("jg1C"),i=t("aWzz"),r=t.n(i),o="",c=function(){},d={AUTO:"auto",ASYNC:"async",SYNC:"sync"},u={AUTO:"auto",HIGH:"high",LOW:"low"},m={EAGER:"eager",LAZY:"lazy"},h=function(e){var n=e.autoRotation,t=void 0!==n&&n,s=e.customRule,a=e.format,l=e.pinchHeight,i=e.pinchWidth,r=e.src,o=e.usePrivateWaterMark,c=void 0!==o&&o;if(!(null==r?void 0:r.includes("https://static.")))return r;if(c&&1200===i){var d=r.split("?")[0];return t?d+"?rule=web_detail_wm_ar":d+"?rule=web_detail_wm"}var u=s&&t?s+"_ar":s;return r.split("?")[0]+"?rule="+(u||"web_"+(i+"x"+l)+(a&&"_"+a)+(t?"_ar":""))};function x(e){var n=e.alt,t=e.autoRotation,i=void 0!==t&&t,r=e.customRule,x=e.format,p=void 0===x?o:x,f=e.height,v=e.isLazyLoad,E=void 0===v||v,g=e.onLoadImage,S=void 0===g?c:g,j=e.pinchHeight,N=e.pinchWidth,_=e.src,b=e.usePrivateWaterMark,A=void 0!==b&&b,y=e.width,I=(0,a.A)(e,["alt","autoRotation","customRule","format","height","isLazyLoad","onLoadImage","pinchHeight","pinchWidth","src","usePrivateWaterMark","width"]),R=h({autoRotation:i,customRule:r,format:p,pinchHeight:j,pinchWidth:N,src:_,usePrivateWaterMark:A});return(0,l.jsx)("img",(0,s.A)({},"original"!==r&&{height:f||j},"original"!==r&&{width:y||N},I,{alt:n,decoding:E?d.ASYNC:d.SYNC,fetchpriority:E?u.LOW:u.HIGH,loading:E?m.LAZY:m.EAGER,onLoad:S,src:R}))}x.displayName="ImagePincher",x.propTypes={autoRotation:r().bool,alt:r().string,customRule:r().string,format:r().string,height:r().number,isLazyLoad:r().bool,onLoadImage:r().func,pinchHeight:r().oneOfType([r().number,r().string]).isRequired,pinchWidth:r().oneOfType([r().number,r().string]).isRequired,src:r().string.isRequired,usePrivateWaterMark:r().bool,width:r().number}}}]);
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.