"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[6862],{224063:(e,t,s)=>{s.d(t,{A:()=>f});var r=s(296540),a=s(469733),o=s(459449),n=s(20044),i=s(977178),l=s(130851),c=s(573363),u=s(198494),d=s(6176);const f=()=>{const{formatMessage:e}=(0,o.tz)(),{createNotification:t,removeNotification:s}=(0,a.useSelector)(i.o),f=(0,a.useSelector)(i.v),m=(0,r.useRef)(new Set(Object.keys(f))),p=(0,a.useSelector)(l.p),g=(0,a.useSelector)(c.A),y=(0,a.useSelector)(u.ay);return(0,r.useEffect)(()=>{Object.keys(f).filter(e=>!m.current.has(e)).forEach(s=>{const{toastProps:{details:a,errorMessage:o,errorValues:i,message:l="COMMON_UNKNOWN_ERROR",primaryButton:c,secondaryButton:u,values:v,title:b,titleValues:k,translateTitle:h,notificationType:M,icon:N,...C},option:B={}}=f[s];t({details:a&&"function"==typeof a?a(e):a??(0,n.L)(e,{message:l,values:v,errorValues:i,errorMessage:o}),id:String(s),primaryButton:c&&c.label?c:(0,n.I)(e,{button:c}),secondaryButton:u&&u.label?u:(0,n.I)(e,{button:u}),title:h?e({id:b},k):b,notificationType:M,icon:B.deviceModel?r.createElement(d.C,{width:53,height:53,model:B.deviceModel,theme:y,imagePath:p,deviceModelMap:g}):N,...C}),m.current.add(s)}),m.current.forEach(e=>{f[e]||(s(e),m.current.delete(e))})},[p,t,e,y,g,f,s]),null}},388944:(e,t,s)=>{s.r(t),s.d(t,{default:()=>d});var r=s(296540),a=s(469733),o=s(459449),n=s(20044),i=s(224063),l=s(675359),c=s(614460);const u=(e,{details:t,translated:s=!1})=>{if(s||"string"==typeof t)return t;const{props:{id:r,values:a}}=t;return e({id:r},a)},d=()=>{const e=(0,a.useDispatch)(),{formatMessage:t}=(0,o.tz)(),s=(0,r.useCallback)(e=>{const{props:s}=e;try{if(s.primaryButton||s.secondaryButton){const{details:e,message:r,values:a,primaryButton:o,secondaryButton:i}=s,l={message:e||(0,n.L)(t,{message:r,values:a})};return o&&(l.primary=o.label?o:{...(0,n.I)(t,{button:o}),callback:o.onClick}),i&&(l.secondary=i.label?i:{...(0,n.I)(t,{button:i}),callback:i.onClick}),l}if(s.details){const e=s.icon||s.type;return{level:"info"!==e?e:"neutral",message:u(t,s)}}if(s.message){const e=void 0!==s.errorMessage?"danger":"success";return{level:e,message:(0,n.L)(t,s)}}}catch(e){0}return{}},[t]),d=(0,r.useCallback)(t=>{const{level:r,message:a,primary:o,secondary:n}=s(t);return o||n?e((0,c.I7)(a,o,n)):r&&a&&e((0,c.Iz)(r,a)),""},[e,s]),f=(0,r.useCallback)(e=>{},[]);return(0,r.useEffect)(()=>{e((0,l.Ez)({createNotification:d,updateNotification:d,removeNotification:f}))},[e,d,f]),r.createElement(i.A,null)}},20044:(e,t,s)=>{s.d(t,{I:()=>r,L:()=>a});const r=(e,{button:t})=>t?{...t,label:e({id:t.message},t.values)}:void 0,a=(e,{message:t,values:s,errorMessage:r,errorValues:a})=>{const o=r&&e({id:r},a);return`${e({id:t},s)}${o?`. ${o}`:""}`}}}]);