import{a as P}from"./chunk-7UVHMAU4.mjs";import{a as h}from"./chunk-7QNW3TWW.mjs";import{a as S}from"./chunk-OXQEMCBT.mjs";import{a as O}from"./chunk-SKLEC6DT.mjs";import{b as M}from"./chunk-WZBKNXYZ.mjs";import{useCallback as D}from"react";import{datesDontHaveSameDay as k}from"@baseapp-frontend/utils";import{Box as K,Divider as R,Typography as B,useTheme as C}from"@mui/material";import{jsx as n,jsxs as F}from"react/jsx-runtime";function l(s){"@babel/helpers - typeof";return l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(s)}function j(s,e){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(s);e&&(t=t.filter(function(u){return Object.getOwnPropertyDescriptor(s,u).enumerable})),r.push.apply(r,t)}return r}function x(s){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?j(Object(r),!0).forEach(function(t){N(s,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(r,t))})}return s}function N(s,e,r){return(e=A(e))in s?Object.defineProperty(s,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[e]=r,s}function A(s){var e=_(s,"string");return l(e)=="symbol"?e:e+""}function _(s,e){if(l(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var t=r.call(s,e||"default");if(l(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}var H=function(e){var r=e.allMessages,t=e.allMessagesLastIndex,u=e.hasNext,p=e.message,g=e.messageIndex,d=e.isGroup,w=d===void 0?!1:d,m=e.firstUnreadMessageId,c=e.SystemMessage,U=c===void 0?P:c,f=e.SystemMessageProps,G=f===void 0?{}:f,v=e.UserMessage,T=v===void 0?h:v,y=e.UserMessageProps,I=y===void 0?{}:y,b=C(),E=D(function(i){var o=r?.[i+1],a=r?.[i],L=i===t&&!u;return L||k(o?.created,a?.created)?n(O,{color:"grey.600",variant:"caption",children:S(a?.created)}):null},[r,t,u]),$=D(function(i){var o=r?.[i];return o?.id===m?n(R,{variant:"fullWidth",sx:{"&.MuiDivider-root::before, &.MuiDivider-root::after":{borderTop:"1px solid ".concat(b.palette.error.light)}},children:n(B,{variant:"caption",color:"error",sx:{textAlign:"center"},children:"New Messages"})}):null},[r,m,b.palette.error.light]);return p?F(K,{display:"flex",flexDirection:"column",sx:{paddingTop:1/2,paddingRight:2},children:[$(g),E(g),p.messageType===M.system?n(U,x({messageRef:p},G)):n(T,x({allMessages:r,allMessagesLastIndex:t,message:p,messageIndex:g,isGroup:w},I))]}):null},ee=H;export{ee as a};
//# sourceMappingURL=chunk-IW4CXVWF.mjs.map