"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[55080],{637084(e,t,i){i.d(t,{A:()=>O});var r=i(274934),s=i(602086),o=i(843871),n=i(977872),a=i(418398),l=i(396489),u=i.n(l),c=i(205521),d=i(232410),m=i(933671),v=i(260288),f=i(619619),p=i(702147),A=i(507792),y=i(621309);const I=(0,o.bk)({enableReinitialize:!0,mapPropsToValues:({powerSupervisor:e,device:t})=>({powerSupervisor:(0,f.f)(e,(0,A.lD)(t,e))}),handleSubmit:(e,{resetForm:t})=>t({values:e}),validationSchema:p.Ay}),O=(0,a.Zz)((0,n.Ng)((e,{device:{mac:t}})=>({powerSupervisor:(0,d.x0)(t)(e)})))(I(({powerSupervisor:e,device:t,setFormDirty:i,setFormInvalid:o,validateForm:a,values:l,resetForm:d,initialValues:f,dirty:p,isValid:A,formName:I=v.r8})=>{const O=(0,n.wA)();return(0,s.useEffect)(()=>(O((0,c.uo)({[I]:()=>({})})),O((0,c.Oo)({[I]:()=>{u()(l,f)||a().then(t=>{Object.keys(t).length||O((0,y.A)(e?.id,l.powerSupervisor))})}})),O((0,c.rW)({[I]:d})),()=>{O((0,c.uo)({[I]:null})),O((0,c.Oo)({[I]:null})),O((0,c.rW)({[I]:null}))}),[O,d,l.powerSupervisor,I,a,e?.id,l,f]),(0,s.useEffect)(()=>{i?.(I,p),o?.(I,!A)},[i,p,o,A,I]),(0,r.jsx)(m.A,{device:t})}))},55080(e,t,i){i.r(t),i.d(t,{default:()=>y});var r=i(274934),s=i(418398),o=i(977872),n=i(159469),a=i(478961),l=i(376892),u=i(535322),c=i(446863),d=i(795206),m=i(637084),v=i(115114),f=i(532635),p=i(269935),A=i(795928);const y=(0,s.Zz)((0,a.A)([A.UH,p.h]))(({activeItem:e,setFormDirty:t,setFormInvalid:i,isDirty:s,isInvalid:a})=>{const y=(0,o.d4)(c.n0),I=(0,o.d4)(c.Lq),O=(0,o.d4)(c.H5),{_id:j,mac:C}=e,E=(0,o.wA)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A.Ay,{activeItem:e,setFormDirty:t,setFormInvalid:i}),(0,r.jsx)(m.A,{device:e,setFormDirty:t,setFormInvalid:i}),(0,r.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:p.h,openByDefault:!0,label:(0,r.jsx)(l.A,{id:"DEVICE_PROPERTY_HEADER_TOUCHSCREEN"}),renderContent:()=>(0,r.jsx)(p.A,{activeItem:e,setFormDirty:t,setFormInvalid:i})}]}),(0,r.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:f.f,openByDefault:!0,label:(0,r.jsx)(l.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>(0,r.jsx)(f.A,{activeItem:e,hideManualFwUpdate:!0})}]}),(0,r.jsx)(v.A,{isDirty:s,isInvalid:a,onFormSubmit:()=>{const e=Object.entries(y).reduce((e,[t,i])=>{if("function"==typeof i){const t=i();if("object"==typeof t&&t&&Object.keys(t).length)return{...e,...t}}return e},{});E((0,d.ex)(e,j,C,{failureToast:{icon:n.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR"},extend:!0})).then(()=>{Object.values(I).forEach(e=>{"function"==typeof e&&e()})})},onFormCancel:()=>{Object.values(O).forEach(e=>{"function"==typeof e&&e()})}})]})})}}]);