"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[48150],{446863(e,t,n){n.d(t,{H5:()=>l,Lq:()=>s,n0:()=>a});var o=n(909924),i=n(573534),r=n(172205);const a=e=>e[r.U.SHARED][i.N.PROPERTY_PANEL]?.[o.Io.TAB_GET_DATA_FUNCTION]||{},s=e=>e[r.U.SHARED][i.N.PROPERTY_PANEL]?.[o.Io.TAB_SUBMIT_FUNCTION]||{},l=e=>e[r.U.SHARED][i.N.PROPERTY_PANEL]?.[o.Io.TAB_RESET_FUNCTION]||{}},535322(e,t,n){n.d(t,{A:()=>p,I:()=>o});var o,i=n(274934),r=n(814557),a=n(158885),s=n(247816),l=n(565527),d=n(309130),c=n(100978),m=n(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(o||(o={}));const u=(0,s.A)(c.A,(0,m.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||r.Ay[n===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  padding: ${({isButtonList:e,padding:t})=>t||(e?`0 ${d.Ln}`:d.Ln)};
  margin-bottom: ${({marginBottom:e})=>e||d.Ln};
  ${({margin:e})=>e?`margin: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  width: ${({width:e="100%"})=>e};
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  ${({isButtonList:e})=>e?`\n    > div {\n      display: flex;\n      height: 48px;\n      border-bottom: ${({theme:{themeName:e}})=>r.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,A=(0,s.A)(a.A,(0,m.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||r.Ay[n===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  margin-bottom: ${({theme:e,marginBottom:t})=>t||e.spacing["spacing-l"]};
  ${({margin:e})=>e?`margin: ${e};`:""}
  ${({padding:e})=>e?`padding: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  > li {
    > div:first-child {
      background: ${({background:e,theme:{themeName:t}})=>e||r.Ay[t===l.S.DARK?`desktop-color-neutral-01-${l.S.DARK}`:`desktop-color-neutral-00-${l.S.LIGHT}`]};
      height: 48px;
      padding: 0 ${d.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0;
      > div {
        padding: 0 ${d.Ln} ${d.Ln};
      }
    }
  }
`,p=({type:e,marginBottom:t,margin:n,padding:r,flex:a,width:s,nested:l,...d})=>"items"in d?(0,i.jsx)(A,{marginBottom:t,margin:n,padding:r,flex:a,nested:l,...d}):(0,i.jsx)(u,{nested:l,width:s,marginBottom:t,margin:n,padding:r,flex:a,isButtonList:e===o.BUTTON_LIST,...d,children:d.children})},796091(e,t,n){n.d(t,{A:()=>s});var o=n(274934),i=n(833466),r=n(309130),a=n(100978);const s=e=>(0,o.jsx)(a.A,{paddingTop:r.YC,paddingBottom:r.YC,gap:r.Ln,rowGap:r.YC,flexWrap:"wrap",minHeight:i.b,alignItems:"center",...e})},89469(e,t,n){n.d(t,{A:()=>s});var o=n(274934),i=n(602086),r=n(309130),a=n(100978);const s=(0,i.forwardRef)((e,t)=>(0,o.jsx)(a.A,{ref:t,flexDirection:"column",gap:r.kc,width:"100%",...e}))},250266(e,t,n){n.d(t,{A:()=>c});var o=n(274934),i=n(602086),r=n(696264),a=n(409844),s=n(521376),l=n(309130),d=n(470070);const c=({children:e=null,title:t,titleValues:n,message:c,messageValues:m,handleConfirm:u=()=>null,handleClose:A=()=>null,handleCancel:p,isOpen:f,buttonVariant:b="primary",cancelButtonVariant:h="tertiary",cancelButtonMessage:g="COMMON_ACTION_CANCEL",buttonMessage:x="COMMON_ACTION_CONFIRM",buttonDisabled:v=!1,position:C="top",offset:O,showHeaderClose:N=!1,contentClassName:E="",body:j,titleBody:y,className:_,rootClose:w=!1,footerActions:I})=>{const R=(0,i.useCallback)(e=>{f&&(e.stopPropagation(),e.key===s.U.ENTER?u():e.key===s.U.ESCAPE&&A(!1))},[f,u,A]);(0,i.useEffect)(()=>(window.addEventListener("keydown",R,!0),()=>{window.removeEventListener("keydown",R,!0)}),[R]);const T=(0,i.useCallback)(()=>{A(!1),p?.()},[A,p]),k=(0,i.useCallback)(()=>{A(!1),u()},[A,u]),S=(0,i.useMemo)(()=>[{text:(0,o.jsx)(d.sA,{id:g}),variant:h,onClick:T},{text:(0,o.jsx)(d.sA,{id:x}),disabled:v,variant:b,onClick:k}],[x,b,g,h,T,k,v]),F=(0,i.useCallback)(()=>{A(!1)},[A]),$=a.AH`
    ${t?"":`margin-top: ${l.xO}`}
  `;return(0,o.jsx)(r.A,{title:t?(0,o.jsx)(d.sA,{id:t,values:n}):y||null,...c?{body:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.sA,{id:c,values:m}),j]})}:{body:j},position:C,portal:!0,offset:O,actions:I||S,showHeaderClose:N,contentClassName:a.AH`
        ${$}
        ${E}
      `,onRequestClose:F,isOpen:f,allowOverflow:!0,rootClose:w,className:_,children:e})}},637084(e,t,n){n.d(t,{A:()=>h});var o=n(274934),i=n(602086),r=n(843871),a=n(977872),s=n(418398),l=n(205521),d=n(232410),c=n(1469),m=n(260288),u=n(619619),A=n(876809),p=n(113454),f=n(621309);const b=(0,r.bk)({enableReinitialize:!0,mapPropsToValues:({powerSupervisor:e,device:t})=>({powerSupervisor:(0,u.f)(e,(0,p.lD)(t,e))}),handleSubmit:(e,{resetForm:t})=>t({values:e}),validationSchema:A.A}),h=(0,s.Zz)((0,a.Ng)((e,{device:{mac:t}})=>({powerSupervisor:(0,d.x0)(t)(e)})))(b(({powerSupervisor:e,device:t,setFormDirty:n,setFormInvalid:r,validateForm:s,values:d,resetForm:u,dirty:A,isValid:p,formName:b=m.r8})=>{const h=(0,a.wA)();return(0,i.useEffect)(()=>(h((0,l.uo)({[b]:()=>({})})),h((0,l.Oo)({[b]:()=>{s().then(t=>{Object.keys(t).length||h((0,f.A)(e?.id,d.powerSupervisor))})}})),h((0,l.rW)({[b]:u})),()=>{h((0,l.uo)({[b]:null})),h((0,l.Oo)({[b]:null})),h((0,l.rW)({[b]:null}))}),[h,u,d.powerSupervisor,b,s,e?.id]),(0,i.useEffect)(()=>{n?.(b,A),r?.(b,!p)},[n,A,r,p,b]),(0,o.jsx)(c.A,{device:t})}))},876809(e,t,n){n.d(t,{A:()=>r,q:()=>i});var o=n(950804);const i=o.A.object().shape({power_sources:o.A.array().transform(e=>e.filter(e=>e.power_source_mac)).of(o.A.object().shape({client_psu_index:o.A.number().required(),power_source_mac:o.A.string().label("COMMON_POWER_SOURCE").required(),power_source_index:o.A.string().label("COMMON_OUTLET").required()})).label("COMMON_POWER_SOURCE").min(1)}).optional(),r=o.A.object().shape({powerSupervisor:i})},376892(e,t,n){n.d(t,{A:()=>a});var o=n(274934),i=n(938984),r=n(470070);const a=({id:e,children:t,values:n})=>(0,o.jsxs)(i.A,{color:"text-1",weight:"bold",size:"medium",children:[e?(0,o.jsx)(r.sA,{id:e,values:n}):null,t]})},594492(e,t,n){n.d(t,{A:()=>m});var o=n(274934),i=n(602086),r=n(599110),a=n(247816),s=n(309130),l=n(470070),d=n(291508);const c=(0,a.A)("footer",(0,d.A)("hasFormResetButton"))`
  display: flex;
  justify-content: ${({hasFormResetButton:e})=>e?"space-between":"flex-end"};
  padding: ${s.S2} ${s.fS};
  gap: ${s.kc};
`,m=({allowCancel:e,isDirty:t,isInvalid:n,isSubmitting:a,onFormSubmit:s,onFormReset:d,onFormCancel:m,className:u,submitButtonText:A,customButton:p,applyButton:f,applyButtonFirst:b,hideCancelButton:h,form:g})=>{const x=(0,i.useMemo)(()=>f||(0,o.jsx)(r.A,{name:"submit",variant:"primary",type:"submit",onClick:s,disabled:!t||n||a,form:g,children:(0,o.jsx)(l.sA,{id:A||"COMMON_ACTION_APPLY_CHANGES"})}),[f,g,t,n,a,s,A]);return(0,o.jsxs)(c,{className:u,hasFormResetButton:!!d,children:[b?x:p,h?null:(0,o.jsx)(r.A,{name:"cancel",variant:"default",type:"button",onClick:m,disabled:!e&&!t,children:(0,o.jsx)(l.sA,{id:"COMMON_ACTION_CANCEL"})}),d?(0,o.jsx)(r.A,{name:"reset",variant:"default",type:"button",onClick:d,disabled:!t,children:(0,o.jsx)(l.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULT"})}):null,b?p:x]})}},115114(e,t,n){n.d(t,{A:()=>c});var o=n(274934),i=n(232932),r=n(247816),a=n(409844),s=n(594492);const l=(0,r.A)("div")`
  height: 66px;
`,d=a.AH`
  padding: 0px !important;
`,c=({isDirty:e,onFormSubmit:t,onFormCancel:n,isInvalid:r,...a})=>e?(0,o.jsx)(i.A,{children:(0,o.jsx)(s.A,{isDirty:e,onFormCancel:n,onFormSubmit:t,isInvalid:r,className:d,...a})}):(0,o.jsx)(l,{})},504487(e,t,n){n.r(t),n.d(t,{default:()=>O});var o=n(274934),i=n(418398),r=n(977872),a=n(478961),s=n(630849),l=n(376892),d=n(535322),c=n(446863),m=n(795206),u=n(637084),A=n(115114),p=n(532635),f=n(602086),b=n(843871),h=n(120197),g=n(100978),x=n(205521);const v="general",C=(0,b.bk)({enableReinitialize:!0,mapPropsToValues:({activeItem:{name:e,mac:t}})=>({name:e!==t?e:""}),handleSubmit:(e,{resetForm:t})=>{t({values:e})}})(({submitForm:e,values:t,dirty:n,isValid:i,resetForm:a,setFormDirty:s,setFormInvalid:l})=>{const d=(0,r.wA)();return(0,f.useEffect)(()=>{s(v,n),l(v,!i)},[s,l,n,i]),(0,f.useEffect)(()=>(d((0,x.uo)({[v]:()=>t})),d((0,x.Oo)({[v]:e})),d((0,x.rW)({[v]:a})),()=>{d((0,x.uo)({[v]:null})),d((0,x.Oo)({[v]:null})),d((0,x.rW)({[v]:null}))}),[d,a,e,t]),(0,o.jsx)(g.A,{flexDirection:"column",children:(0,o.jsx)(g.A,{flexDirection:"column",children:(0,o.jsx)(h.A,{full:!0,name:"name",variant:"secondary",label:"COMMON_NAME"})})})}),O=(0,i.Zz)((0,a.A)([v,p.f]))(({activeItem:{mac:e,_id:t},activeItem:n,setFormDirty:i,setFormInvalid:a,isDirty:f,isInvalid:b})=>{const h=(0,r.wA)(),g=(0,r.d4)(c.n0),x=(0,r.d4)(c.Lq),O=(0,r.d4)(c.H5),N=(0,s.I)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.A,{type:d.I.ACCORDION,items:[{id:v,openByDefault:!0,label:(0,o.jsx)(l.A,{id:"COMMON_NAME"}),renderContent:()=>(0,o.jsx)(C,{activeItem:n,setFormDirty:i,setFormInvalid:a})}]}),(0,o.jsx)(u.A,{device:n,setFormDirty:i,setFormInvalid:a}),(0,o.jsx)(d.A,{type:d.I.ACCORDION,items:[{id:p.f,openByDefault:!0,label:(0,o.jsx)(l.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>(0,o.jsx)(p.A,{activeItem:n})}]}),(0,o.jsx)(A.A,{isDirty:f,isInvalid:b,onFormSubmit:()=>{const n=Object.entries(g).reduce((e,[t,n])=>{if("function"==typeof n){const t=n();if("object"==typeof t&&t&&Object.keys(t).length)return{...e,...t}}return e},{});h((0,m.ex)(n,t,e,{extend:!0})).then(()=>{Object.values(x).forEach(e=>{"function"==typeof e&&e()})}).catch(N)},onFormCancel:()=>{Object.values(O).forEach(e=>{"function"==typeof e&&e()})}})]})})},378767(e,t,n){n.d(t,{A:()=>a});var o=n(274934),i=n(977872),r=n(897166);const a=({children:e=null})=>(0,i.d4)(r.EL)?null:(0,o.jsx)(o.Fragment,{children:e})},521376(e,t,n){var o;n.d(t,{U:()=>o}),function(e){e.ARROW_LEFT="ArrowLeft",e.ARROW_RIGHT="ArrowRight",e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.ESCAPE="Escape",e.BACKSPACE="Backspace",e.DELETE="Delete",e.TAB="Tab"}(o||(o={}))},478961(e,t,n){n.d(t,{A:()=>r});var o=n(274934),i=n(602086);const r=function(e){return t=>n=>{const[r,a]=(0,i.useState)(Object.fromEntries(e.map(e=>[e,!1]))),[s,l]=(0,i.useState)(Object.fromEntries(e.map(e=>[e,!1]))),d=(0,i.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[]),c=(0,i.useCallback)((e,t)=>{l(n=>({...n,[e]:t}))},[]),m=!!Object.values(r).find(e=>e),u=!!Object.values(s).find(e=>e);return(0,o.jsx)(t,{isDirty:m,isInvalid:u,formStates:r,setFormDirty:d,setFormInvalid:c,...n})}}}}]);