"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[90053],{175522(e,t,n){n.d(t,{A:()=>i,Q:()=>r});var a=n(416348);const i="_",r=[a.ZM,a.Je]},327769(e,t,n){n.r(t),n.d(t,{RadiosSidePanel:()=>O,default:()=>S});var a=n(469733),i=n(296540),r=n(951272),o=n(217439),s=n(870443),l=n(307330),d=n(96512),m=n(280062),c=n(329109),u=n(885358),_=n(605689),p=n(227902),b=n(689965),h=n(564985),g=n(171073),A=n(622238),f=n(126067),v=n(990417),E=n(255029),C=n(452269);const k=({device:e,radio:t})=>`${e._id}-${t.name}`,w=e=>{const[t,n]=e.split("-");return{device_id:t,radio_name:n}},y=({deviceRadios:e,radios:t,onRemoveDeviceRadio:n,onSelectMeshingParents:u})=>{const A=(0,a.useDispatch)(),v=(0,d.I)(),E=(0,i.useMemo)(()=>l.I.reduce((e,n)=>(t[n]&&e.radios.push(t[n]),e),{radios:[]}),[t]),C=(0,i.useMemo)(()=>s.A.object().shape({...(0,_.m)(e.filter(f.A.tx_power).flatMap(({radio:e})=>e),!0)}),[e]);return i.createElement(r.l1,{initialValues:E,onSubmit:async(t,{resetForm:n})=>{try{await(e=>{if(!e.length||!t.radios?.length)return Promise.resolve();const n=t.radios.reduce((t,n,a)=>{const i=n.type,r=(({type:e,name:t,...n},a)=>({radio:e,...Object.entries(n).reduce((e,[t,i])=>{let r=i;return void 0===r||"tx_power"===t&&n.tx_power_mode!==h.PB.CUSTOM||"tx_power_mode"===t&&r===h.PB.CUSTOM&&void 0===n.tx_power||a[t]===r||("ht"===t&&(r=i.toString()),e[t]=r),e},{})}))(n,E.radios[a]);return t[i]=((e,t)=>Object.entries(e).reduce((e,[n,a])=>{if(void 0===a)return e;const i=t.filter(e=>!f.A[n]||f.A[n](e));if(!i.length)return e;const r=i.map(k).sort().join(" ");return e[r]={...e[r],[n]:a},e},{}))(r,e.filter(({radio:{radio:e}})=>e===i)),t},{}),a={},i=(e,t,n,a)=>({id:e,data:{radio_table:[{radio_identifiers:t,...a,radio:n}]}});return l.I.forEach(e=>{const t=n[e];t&&Object.entries(t).forEach(([t,n])=>{const r=t.split(" ").map(w),o=[...new Set(r.map(({device_id:e})=>e).sort())],s=o.join(" ");if(a[s]&&!a[s]?.data?.radio_table.some(t=>t.radio===e)){const t=i(o,r,e,n);a[s]={...t,data:{radio_table:[...a[s]?.data?.radio_table||[],...t.data.radio_table]}}}else a[s]=i(o,r,e,n)})}),Promise.all(Object.values(a).map(e=>A((0,g.Nc)(e))))})(e)}catch(e){v(e)}finally{n({values:t})}},enableReinitialize:!0,validationSchema:C},({handleSubmit:a,handleReset:r,dirty:s,isValid:d})=>i.createElement(i.Fragment,null,l.I.filter(e=>!!t[e]).map((t,a)=>i.createElement(b.A,{key:t,type:b.I.ACCORDION,items:[{id:t,label:i.createElement(o.A,{weight:"bold",size:"medium"},i.createElement(m.A,{radio:t})),openByDefault:!0,renderContent:()=>i.createElement(p.sG,{radioType:t,radioIdx:a,deviceRadios:e.filter(({radio:e})=>e.radio===t),onRemoveDeviceRadio:n,onSelectMeshingParents:u,hideTitle:!0,showDeviceList:!0,mode:p.Hm.ONLY_RADIO,showKeyRadioMetrics:!0,defaultKeyRadioMetricsExpanded:e.length<=1})}]})),i.createElement(c.A,{isDirty:s,isInvalid:!d,onFormSubmit:a,onFormCancel:r})))},O=()=>{const e=(0,a.useDispatch)(),t=(0,a.useSelector)(v.mK),n=(0,a.useSelector)(v.If),r=n.map(e=>Object.fromEntries(Object.entries((0,u.S)(e.radio)).map(([t,n])=>!f.A[t]||f.A[t](e)?[t,n]:[t,E.Q]))).reduce((e,t)=>{return{...e,[t.type]:e[t.type]?(n=e[t.type],a=t,[...new Set([...Object.keys(n),...Object.keys(a)])].reduce((e,t)=>{if(p.eu.includes(t))return e;const i=n[t]!==E.Q?n[t]:a[t],r=i===(a[t]!==E.Q?a[t]:i)?i:void 0;return r===E.Q?e:{...e,[t]:r}},{})):t};var n,a},{}),o=(0,i.useCallback)(t=>{const a=t.map(A.R);e((0,C.V)(n.filter(({id:e})=>!a.includes(e)).map(({id:e})=>e)))},[e,n]),s=(0,i.useCallback)(()=>{e((0,C.V)([...new Set([...n.filter(({parentId:e})=>!e).map(({id:e})=>e),...n.flatMap(({parentId:e})=>Object.values(t).filter(t=>!t.parentId&&t.id===e).map(({id:e})=>e))])]))},[e,n,t]);return(0,i.useEffect)(()=>()=>{e((0,C.V)([]))},[e]),i.createElement(y,{deviceRadios:n,radios:r,onRemoveDeviceRadio:o,onSelectMeshingParents:s})},S=O},689965(e,t,n){n.d(t,{A:()=>p,I:()=>a});var a,i=n(296540),r=n(822336),o=n(963724),s=n(71479),l=n(825032),d=n(566723),m=n(294303),c=n(311785);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(a||(a={}));const u=(0,s.A)(m.A,(0,c.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"}-dark`:`desktop-color-neutral-${t?"01":"00"}-light`]};
  padding: ${({theme:e,isButtonList:t,padding:n})=>n||(t?`0 ${e.spacing["spacing-l"]}`:e.spacing["spacing-l"])};
  margin-bottom: ${({theme:e,marginBottom:t})=>t||e.spacing["spacing-l"]};
  ${({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  `:""}
`,_=(0,s.A)(o.A,(0,c.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"}-dark`:`desktop-color-neutral-${t?"01":"00"}-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-dark":"desktop-color-neutral-00-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:o,width:s,nested:l,...d})=>"items"in d?i.createElement(_,{marginBottom:t,margin:n,padding:r,flex:o,nested:l,...d}):i.createElement(u,{nested:l,width:s,marginBottom:t,margin:n,padding:r,flex:o,isButtonList:e===a.BUTTON_LIST,...d},d.children)},821580(e,t,n){n.d(t,{A:()=>s});var a=n(296540),i=n(454195),r=n(566723),o=n(294303);const s=e=>a.createElement(o.A,{paddingTop:r.YC,paddingBottom:r.YC,gap:r.Ln,rowGap:r.YC,flexWrap:"wrap",minHeight:i.b,alignItems:"center",...e})},137625(e,t,n){n.d(t,{A:()=>d});var a=n(296540),i=n(353899),r=n(132196),o=n(372737),s=n(566723),l=n(916537);const d=({children:e=null,title:t,titleValues:n,message:d,messageValues:m,handleConfirm:c=()=>null,handleClose:u=()=>null,handleCancel:_,isOpen:p,buttonVariant:b="primary",cancelButtonVariant:h="tertiary",cancelButtonMessage:g="COMMON_ACTION_CANCEL",buttonMessage:A="COMMON_ACTION_CONFIRM",buttonDisabled:f=!1,position:v="top",offset:E,showHeaderClose:C=!1,contentClassName:k="",body:w,titleBody:y,className:O,rootClose:S=!1,footerActions:x})=>{const R=(0,a.useCallback)(e=>{p&&(e.stopPropagation(),e.key===o.U.ENTER?c():e.key===o.U.ESCAPE&&u(!1))},[p,c,u]);(0,a.useEffect)(()=>(window.addEventListener("keydown",R,!0),()=>{window.removeEventListener("keydown",R,!0)}),[R]);const N=(0,a.useCallback)(()=>{u(!1),_?.()},[u,_]),$=(0,a.useCallback)(()=>{u(!1),c()},[u,c]),M=(0,a.useMemo)(()=>[{text:a.createElement(l.sA,{id:g}),variant:h,onClick:N},{text:a.createElement(l.sA,{id:A}),disabled:f,variant:b,onClick:$}],[A,b,g,h,N,$,f]),I=(0,a.useCallback)(()=>{u(!1)},[u]),B=r.AH`
    ${t?"":`margin-top: ${s.xO}`}
  `;return a.createElement(i.A,{title:t?a.createElement(l.sA,{id:t,values:n}):y||null,...d?{body:a.createElement(a.Fragment,null,a.createElement(l.sA,{id:d,values:m}),w)}:{body:w},position:v,portal:!0,offset:E,actions:x||M,showHeaderClose:C,contentClassName:r.AH`
        ${B}
        ${k}
      `,onRequestClose:I,isOpen:p,allowOverflow:!0,rootClose:S,className:O},e)}},373229(e,t,n){n.d(t,{A:()=>m});var a=n(296540),i=n(758649),r=n(71479),o=n(566723),s=n(916537),l=n(311785);const d=(0,r.A)("footer",(0,l.A)("hasFormResetButton"))`
  display: flex;
  justify-content: ${({hasFormResetButton:e})=>e?"space-between":"flex-end"};
  padding: ${o.S2} ${o.fS};
  gap: ${o.kc};
`,m=({allowCancel:e,isDirty:t,isInvalid:n,isSubmitting:r,onFormSubmit:o,onFormReset:l,onFormCancel:m,className:c,submitButtonText:u,customButton:_,applyButton:p,applyButtonFirst:b,hideCancelButton:h,form:g})=>{const A=(0,a.useMemo)(()=>p||a.createElement(i.A,{name:"submit",variant:"primary",type:"submit",onClick:o,disabled:!t||n||r,form:g},a.createElement(s.sA,{id:u||"COMMON_ACTION_APPLY_CHANGES"})),[p,g,t,n,r,o,u]);return a.createElement(d,{className:c,hasFormResetButton:!!l},b?A:_,h?null:a.createElement(i.A,{name:"cancel",variant:"default",type:"button",onClick:m,disabled:!e&&!t},a.createElement(s.sA,{id:"COMMON_ACTION_CANCEL"})),l?a.createElement(i.A,{name:"reset",variant:"default",type:"button",onClick:l,disabled:!t},a.createElement(s.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULT"})):null,b?_:A)}},329109(e,t,n){n.d(t,{A:()=>m});var a=n(296540),i=n(691441),r=n(71479),o=n(132196),s=n(373229);const l=(0,r.A)("div")`
  height: 66px;
`,d=o.AH`
  padding: 0px !important;
`,m=({isDirty:e,onFormSubmit:t,onFormCancel:n,isInvalid:r,...o})=>e?a.createElement(i.A,null,a.createElement(s.A,{isDirty:e,onFormCancel:n,onFormSubmit:t,isInvalid:r,className:d,...o})):a.createElement(l,null)},885358(e,t,n){n.d(t,{J:()=>_,S:()=>u});var a=n(296540),i=n(943805),r=n(564985),o=n(170459),s=n(803167),l=n(430126),d=n(661010),m=n(605689),c=n(94017);const u=({antenna_id:e,antenna_gain:t,name:n,radio:a,ht:i,channel:o,tx_power_mode:l,tx_power:m,min_txpower:u,vwire_enabled:_,min_rssi_enabled:p,min_rssi:b,hard_noise_floor_enabled:h,sens_level_enabled:g,sens_level:A,assisted_roaming_enabled:f,assisted_roaming_rssi:v})=>({antenna_id:e,antenna_gain:t,name:n,type:a,ht:+i||s.L[a],channel:Number(o)||c.YQ,tx_power_mode:l||r.PB.AUTO,tx_power:m||u||0,vwire_enabled:_??!0,min_rssi_enabled:p||!1,min_rssi:+b||d.XN.DEFAULT,assisted_roaming_enabled:f||!1,assisted_roaming_rssi:v??d.Wh.DEFAULT,hard_noise_floor_enabled:h||!1,sens_level_enabled:g,sens_level:A}),_=e=>{const t=(0,a.useMemo)(()=>({...(()=>{const t=(e.radio_table||[]).find(({radio:e})=>e===i.A.NA.type)?.vwire_enabled??!0,n=e.mesh_sta_vap_enabled??!0,a=t||n;return{radios:(e.support_wifi6e?e.radio_table:e.radio_table?.filter(({radio:e})=>e!==r.sx.RADIO_6E))?.map(u)?.sort(o.j3),atf_enabled:e.atf_enabled||!1,meshingEnabled:a,uplinkMeshEnabled:n,uplinkPriority1:e.mesh_uplink_1||"",uplinkPriority2:e.mesh_uplink_2||""}})()}),[e.radio_table,e.mesh_sta_vap_enabled,e.mesh_uplink_1,e.mesh_uplink_2,e.atf_enabled,e.support_wifi6e]),n=(0,a.useMemo)(()=>e.radio_table?.reduce((t,{radio:n})=>(t[n]=(0,l.k)({wifi_caps:e.wifi_caps,hide_ch_width:e.hide_ch_width},n),t),{}),[e.radio_table,e.wifi_caps,e.hide_ch_width]);return{initialValues:t,getSubmitData:(0,a.useCallback)(t=>{const{meshingEnabled:a,uplinkMeshEnabled:i,uplinkPriority1:r,uplinkPriority2:s,radios:l,...d}=t,m={...d};return r&&(m.mesh_uplink_1=r,s&&(m.mesh_uplink_2=s)),m.mesh_sta_vap_enabled=t.uplinkMeshEnabled,m.radio_table=l.map(t=>{const a=(e.radio_table||[]).find(({name:e})=>e===t.name),i=(0,o.kb)({model:e.model},a.antenna_id)?null:(0,o.Sb)(e.antenna_table||[],a.antenna_id);return(({isChannelWidthHidden:e,antenna:t,minRssiStrictModeSupported:n},a)=>{const{name:i,type:r,sens_level:s,sens_level_enabled:l,...d}=a,m={...d,sens_level_enabled:l,sens_level:s,radio:r,name:i};return"custom"!==d.tx_power_mode&&delete m.tx_power,m.antenna_id&&t?m.antenna_gain=(0,o.pK)(t,i):delete m.antenna_id,n||m.min_rssi_enabled||delete m.hard_noise_floor_enabled,m.min_rssi_enabled||delete m.min_rssi,m.assisted_roaming_enabled||delete m.assisted_roaming_rssi,m.sens_level_enabled||delete m.sens_level,e&&(delete m.channel,delete m.ht),m})({isChannelWidthHidden:n[t.type],antenna:i&&a&&(0,o.Jj)(i,a.name)?i:null,minRssiStrictModeSupported:a&&(0,o.Wg)(a)},t)}),m},[e.radio_table,e.model,e.antenna_table,n]),validationSchema:(0,m.m)(e.radio_table)}}},280258(e,t,n){n.d(t,{H:()=>a});const a=""},372737(e,t,n){var a;n.d(t,{U:()=>a}),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"}(a||(a={}))},307330(e,t,n){n.d(t,{I:()=>i});var a=n(564985);const i=[a.sx.RADIO_NG,a.sx.RADIO_NA,a.sx.RADIO_6E,a.sx.RADIO_AD]},362412(e,t,n){n.d(t,{A:()=>c});var a=n(296540),i=n(469733),r=n(436331),o=n(805837),s=n(282556),l=n(71265);const d=e=>a.createElement(r.A,{renderOption:o.q,...e}),m=e=>a.createElement(d,{...e});m.Sorted=e=>{const t=(0,i.useSelector)(s.zi),n=(0,a.useMemo)(()=>(0,l.k)(t),[t]);return a.createElement(d,{...e,sortBy:n})};const c=m},71265(e,t,n){n.d(t,{R:()=>c,k:()=>u});var a=n(280258),i=n(190497),r=n(953048),o=n(175522),s=n(936621),l=n(742525);const d=[...new Set([a.H,o.Q.join(o.A),r.Zt,s.F,i.nc,l.Vr])],m={numeric:!0,sensitivity:"base"},c=(e,t)=>{const n=[];for(let a=e;a<=t;a+=1)n.push({value:a,label:String(a)});return n},u=e=>({value:t,label:n},{value:a,label:i})=>d.includes(t?.toString())||d.includes(a?.toString())?1/0:n?.toString().localeCompare(i?.toString(),e,m)??-1}}]);