"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[27807],{668673(e,t,i){i.d(t,{LL:()=>o,TG:()=>n});const n=e=>{const{top:t,bottom:i}=e.getBoundingClientRect();return t>=0&&i<=(window.innerHeight||document.documentElement.clientHeight)};function o(e){"function"==typeof e.persist&&e.persist()}},751636(e,t,i){i.d(t,{A:()=>m});var n=i(274934),o=i(526744),r=i(470070),s=i(247816),a=i(291508),l=i(309130);const d=(0,s.A)("footer",(0,a.A)("hasFormResetButton"))`
  display: flex;
  justify-content: ${({hasFormResetButton:e})=>e?"space-between":"flex-end"};
  padding: ${l.S2} ${l.fS};
  gap: ${l.kc};
`,m=({allowCancel:e,isDirty:t,isInvalid:i,isSubmitting:s,onFormSubmit:a,onFormReset:l,onFormCancel:m,className:c,submitButtonText:p,customButton:u,applyButton:A,hideCancelButton:x,form:b,testConfigFooter:h})=>(0,n.jsx)(d,{className:c,hasFormResetButton:!!l,children:h||(0,n.jsxs)(n.Fragment,{children:[u,x?null:(0,n.jsx)(o.A,{name:"cancel",variant:"default",type:"button",onClick:m,disabled:!e&&!t,children:(0,n.jsx)(r.sA,{id:"COMMON_ACTION_CANCEL"})}),l?(0,n.jsx)(o.A,{name:"reset",variant:"default",type:"button",onClick:l,disabled:!t,children:(0,n.jsx)(r.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULT"})}):null,A||(0,n.jsx)(o.A,{name:"submit",variant:"primary",type:"submit",onClick:a,disabled:!t||i||s,form:b,children:(0,n.jsx)(r.sA,{id:p||"COMMON_ACTION_APPLY_CHANGES"})})]})})},269439(e,t,i){i.r(t),i.d(t,{default:()=>y});var n=i(418398),o=i(977872),r=i(843871),s=i(159469),a=i(950804),l=i(254585),d=i(449339),m=i(274934),c=i(602086),p=i(179102),u=i(505817),A=i(694076),x=i(247816),b=i(51411),h=i(309130),_=i(751636),E=i(120197),C=i(100978),O=i(205521),I=i(470070),g=i(197571),R=i(956978);const f=(0,x.A)(C.A)`
  position: relative;
  margin: -18px -30px 40px;
  padding-bottom: 12px;
  border-bottom: ${({theme:{themeName:e}})=>u.Ay[`desktop-border-divider-${e}`]};

  svg {
    position: absolute;
    left: 24px;
  }
`,j=(0,x.A)(p.A)`
  width: 100%;
  text-align: center;
`,v=(0,x.A)(C.A)`
  width: 100%;
  padding: 30px;
`,P=(0,x.A)(p.A)`
  margin-bottom: ${({theme:{spacing:e}})=>e["spacing-s"]};
`;var T=i(795206);const N=(0,r.bk)({enableReinitialize:!0,mapPropsToValues:({port:e})=>{const{nameOverride:t,enable:i}=e;return{name:t,enable:i??!0}},validationSchema:a.A.object().shape({enable:a.A.boolean(),name:a.A.string()}),handleSubmit:(e,{props:{activeItem:{_id:t,port_overrides:i,mac:n},port:o,updateDeviceWithIdEndpoint:r,intl:{formatMessage:a},propertyPanelActiveItemTab:l,showPropertyPanel:m}})=>{r({port_overrides:[...i?.filter(({port_idx:e})=>e!==o.portIdx)||[],{port_idx:o.portIdx,...e}]},t,n,{failureToast:{icon:s.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR",values:{section:a({id:"DEVICE_PROPERTY_HEADER_PORTS"})}},mergeAndOverrideKeys:["port_overrides"],extend:!0}).then(()=>m({type:d.H.DEVICE,id:n,tab:l}))}}),y=(0,n.Zz)(I.j4,(0,o.Ng)((e,{activeItem:t})=>({port:(0,R.NF$)(+((0,l.Oh)(e)?.replaceAll(/\D/g,"")||0)+1,t),propertyPanelActiveItemTab:(0,l.oI)(e)}),{updateDeviceWithIdEndpoint:T.ex,showPropertyPanel:O.XP}),N)(({activeItem:e,activeItem:{mac:t,model:i},port:n,submitForm:r,resetForm:s,dirty:a})=>{const u=(0,o.wA)(),x=(0,o.d4)(l.oI),T=(0,o.d4)(g.LV),N=(0,b.nL)(n.ifname,e,T),y=(0,c.useMemo)(()=>(0,R.KKO)(i,"poe"),[i]),D=(0,c.useCallback)(()=>{s(),u((0,O.XP)({type:d.H.DEVICE,id:t,tab:x}))},[s,u,x,t]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(v,{flexDirection:"column",flex:"1 1 85%",children:[(0,m.jsxs)(f,{alignItems:"center",children:[(0,m.jsx)(A.A,{onClick:D,style:{cursor:"pointer"}}),(0,m.jsx)(j,{size:"medium",weight:"bold",children:(0,m.jsx)(I.sA,{id:"DEVICE_PROPERTIES_PORT_WITH_NUMBER_AND_NETWORK_GROUP",values:{port:n.portIdx,networkGroup:N?.label}})})]}),(0,m.jsx)(C.A,{marginBottom:h.S2,children:(0,m.jsx)(E.A,{label:"COMMON_NAME",full:!0,name:"name"})}),y?(0,m.jsxs)(C.A,{marginBottom:h.S2,children:[(0,m.jsxs)(C.A,{flexDirection:"column",flex:1,children:[(0,m.jsx)(P,{size:"medium",children:(0,m.jsx)(I.sA,{id:"DEVICE_PORT_FORM_PORT_POWER_LABEL"})}),(0,m.jsx)(p.A,{color:"text-3",size:"medium",children:(0,m.jsx)(I.sA,{id:"DEVICE_PORT_FORM_PORT_POWER_DESCRIPTION"})})]}),(0,m.jsx)(E.A,{name:"enable",type:"checkbox"})]}):null]}),(0,m.jsx)(_.A,{isDirty:a,onFormSubmit:r,onFormCancel:D,allowCancel:!0})]})})}}]);