"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[3300],{947059(e,t,a){a.d(t,{A:()=>_});var l=a(602086),i=a(830990),s=a(367989),n=a(455205),o=a(310749),c=a(568961),r=a(713035),d=a(655783);const h=(0,o.c)(n.A),m=e=>{const{className:t,forwardedRef:a,motif:i,style:s,...n}=(0,c.b)(e),{motif:o}=(0,r.A)(i),m=(0,d.p)(e);return l.createElement("span",{className:h.concat(t)("settingsGridBadge",`settingsGridBadge-${o}`),ref:a,style:{...s,...m},...n})};var g=l.forwardRef((e,t)=>l.createElement(m,{forwardedRef:t,...e})),u=a(224250),p=a(80308),A=a(548941);const b=(0,o.c)(n.A),T=e=>{const{alignWith:t,badge:a,badgeClassName:n,children:o,className:h,disableHover:m=!1,forwardedRef:T,highlight:_=!1,highlightDelay:C,highlightNoAutoScroll:f,highlightOutlineClassName:w,highlightOutlineColor:N,highlightType:E="none",htmlFor:v,icon:S,iconClassName:x,label:y,labelClassName:I,labelSize:O="body",labelWeight:M="normal",motif:R,style:j,textWrapperClassName:L,unlimitedWidth:k=!1,tooltip:D,tooltipWidth:G,tooltipProps:B,...W}=(0,c.b)(e),{motif:Y}=(0,r.A)(R),z=(0,d.p)(e),P=(0,l.useRef)(null),H=(0,l.useRef)(null);(0,s.iz)(!f&&_,C,P,E,T||H);const F=(0,s.gH)(_,C,E,v,T||H),V=!!_&&("auto"===E&&!1===F||"outline"===E);return l.createElement("div",{className:b.concat(h)("settingsGridLabelContainer",`settingsGridLabelContainer-${Y}`,"spotlight"===E&&_&&"settingsGridLabelContainer-selected",!k&&"settingsGridLabelContainer-limitedWidth","withLabel"===t&&"settingsGridLabelContainer-withLabel"),style:{..."number"==typeof t&&{paddingTop:t},...j,...z}},o||l.createElement(l.Fragment,null,"function"==typeof S?l.createElement(S,{className:b.concat(x)("labelIcon",`labelIcon-${Y}`)}):S,l.createElement("label",{className:b.concat(L)("label",!m&&"label-hover",V&&"label-highlighted"),htmlFor:v,ref:T||H,...W},("auto"===E||"outline"===E)&&l.createElement(u.A,{className:w,color:N,ref:P,show:V}),l.createElement(p.A,{color:"secondary",className:b.concat(I)("labelText",`labelText-${Y}`,S&&"labelText-alignWithIcon","spotlight"===E&&_&&"label-spotlightHighlight","spotlight"===E&&_&&`label-spotlightHighlight-${Y}`),size:O,weight:M,motif:Y},y,a&&l.createElement(g,{className:n},a)))),D&&l.createElement(A.A,{...B,description:D,className:b("labelTooltip"),width:G,motif:Y,onClick:e=>e.stopPropagation(),portal:!0},l.createElement(i.A,{isActive:!0,size:"original",className:b("labelTooltipSvg"),motif:Y,onClick:e=>e.preventDefault()})))},_=l.forwardRef((e,t)=>l.createElement(T,{forwardedRef:t,...e}));_.displayName="SettingsGridLabel"},421291(e,t,a){a.d(t,{A:()=>c,p:()=>o});var l=a(133530),i=a(715320);const s=[a(873866).WO.PERFORMANCE_INTEGRITY_AUTO_STP_EDGE_BLOCK],n=()=>(0,l.Y)(i.mv)[0]||null,o=()=>{const e=n();return null===e||s.includes(e)?null:e},c=n},1943(e,t,a){a.d(t,{A:()=>u});var l=a(274934),i=a(602086),s=a(977872),n=a(247816),o=a(470070),c=a(956978),r=a(434521),d=a(45978),h=a(795206),m=a(648576);const g=(0,n.A)(m.Ay)`
  padding: 0;
  white-space: nowrap;
`,u=({device:e,labelId:t,disabled:a,unit_id:n})=>{const m=(0,s.wA)(),u=(0,r.S9)(e),p=(0,i.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),(0,c.YdF)({type:e.type})&&e.peer_ubb?.mac&&m((0,h.VO)({locating:e.peer_ubb.locating,mac:e.peer_ubb.mac,name:e.peer_ubb.name,model:e.peer_ubb.model})),m((0,h.VO)({locating:e.locating,mac:e.mac,name:e.name,model:e.model,unit_id:n}))},[m,e.type,e.mac,e.name,e.model,e.locating,e.peer_ubb?.mac,e.peer_ubb?.name,e.peer_ubb?.model,e.peer_ubb?.locating,n]);return(0,l.jsx)(g,{variant:"link",onClick:p,disabled:a||u!==d.g.CONNECTED,children:(0,l.jsx)(o.sA,{id:e.locating?"DEVICE_ACTIONS_LOCATE_STOP":t||"DEVICE_ACTIONS_LOCATE"})})}},3300(e,t,a){a.r(t),a.d(t,{default:()=>k});var l=a(274934),i=a(602086),s=a(977872),n=a(843871),o=a(159469),c=a(700444),r=a(869332),d=a(988191),h=a(956978),m=a(754924),g=a(795206),u=a(815436),p=a(179102),A=a(453117),b=a(748851),T=a(188664),_=a(247816),C=a(347625),f=a(916704),w=a(309130),N=a(721398),E=a(120197),v=a(100978),S=a(1943),x=a(470070),y=a(384783);const I=(0,_.A)(y.A)`
  width: 415px;
  .contentClassName {
    > div span {
      line-height: 24px;
    }
  }
`,O=(0,_.A)(p.A)`
  margin: ${w.Ln} 0;
`,M=(0,_.A)(v.A)`
  gap: 6px;
`,R=(0,_.A)(b.A)`
  flex: 1;
`,j=({onChange:e,onClose:t,withTest:a})=>{const{values:{batteryMac:i,targetMac:o},handleSubmit:c}=(0,n.j7)(),r=(0,s.d4)(m.qD),d=(0,s.d4)(m.ID).find(({mac:e})=>e===i),h=r.map(({name:e,model:t,mac:a})=>({value:a,label:(0,C.Q)({name:e,model:t,mac:a})}));return(0,l.jsxs)(I,{allowOverflow:!0,title:(0,l.jsx)(p.A,{weight:"bold",size:"large",children:(0,l.jsx)(x.sA,{id:"ASSIGN_BATTERY_MODAL_TITLE"})}),size:"small",contentClassName:"contentClassName",actions:[{variant:"tertiary",text:(0,l.jsx)(x.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:t,type:"button"},{variant:"primary",text:(0,l.jsx)(x.sA,{id:a?"ASSIGN_AND_TEST_BATTERY_ACTION":"ASSIGN_BATTERY_ACTION"}),onClick:()=>c(),type:"button",disabled:!o}],onRequestClose:t,children:[(0,l.jsx)(O,{size:"medium",children:(0,l.jsx)(x.sA,{id:"ASSIGN_BATTERY_MODAL_CONTENT"})}),(0,l.jsxs)(M,{alignItems:"center",children:[(0,l.jsx)(S.A,{device:d,labelId:"DEVICE_ACTIONS_LOCATE_BATTERY"}),(0,l.jsx)(N.A,{messageId:"DEVICE_ACTIONS_LOCATE_DEVICE_DESCRIPTION",tooltipClassName:"tooltip-position-fixer"})]}),(0,l.jsx)(T.A,{padding:"none",children:(0,l.jsxs)(A.A,{children:[(0,l.jsx)(f.A,{style:{flex:1},type:"input",label:(0,l.jsx)(x.sA,{id:"ASSIGN_BATTERY_ITEM",values:{id:(0,C.Q)(d)}})}),(0,l.jsx)(R,{column:!0,width:"50%",children:(0,l.jsx)(E.A,{name:"targetMac",type:"dropdown",variant:"secondary",translateLabel:!0,label:"COMMON_ASSIGN_TO",options:h,onChange:e,width:"100%"})})]})})]})},L=(e,t,a,l)=>{const i=new Set([...l||[],...t.connected_battery_overrides||[]].map(({mac:e})=>e));a&&i.add(a);const s=[...i].map(e=>({mac:e}));return e((0,g.ex)({connected_battery_overrides:s},t._id,t.mac,{extend:!0})),s},k=({activeMacs:e,selectedHost:t})=>{const a=(0,s.d4)((0,m.nH)(e)).filter(h.OFJ),p=(0,s.wA)(),A=(0,s.d4)(m.ID),b=(0,s.d4)(m.qD),T=t?[t]:b,[_,C]=(0,i.useState)({withTest:1===a.length,hostMac:void 0}),[f,w]=(0,i.useState)(void 0),[N,E]=(0,i.useState)(a.map(({mac:e})=>e)),v=(0,i.useCallback)(()=>{p((0,r.AS)())},[p]);(0,i.useEffect)(()=>{if(!T.length)return p((0,r.AS)()),void p((0,c.ox)({icon:o.C.warning,message:"ASSIGN_BATTERY_MODAL_NO_HOSTS_WARNING"}));const e={withTest:1===a.length,hostMac:T[0].mac};a.forEach(e=>{!e.adopted&&p((0,g.Hk)(e))});const t=a.filter(e=>!(0,d.rs)(e.mac,A)).map(({mac:e})=>({mac:e}));if(t.length){const l=L(p,T[0],void 0,t);e.withTest=e.withTest&&1===l.length,1===T.length?(p((0,r.AS)()),e.withTest&&p((0,r.to)({modalType:u.A.TEST_SMART_BATTERY,modalProps:{batteryMac:a[0].mac,hostMac:e.hostMac}}))):C(e)}},[]);const S={batteryMac:N[0],targetMac:f||(0,d.rs)(N[0],A)?.mac||T[0].mac};return T.length?(0,l.jsx)(n.l1,{enableReinitialize:!0,initialValues:S,onSubmit:({batteryMac:e,targetMac:t})=>{const l=(0,d.rs)(e,A),i={withTest:_.withTest,hostMac:t};if(l?.mac!==t){l&&(0,d.jq)(e,l,p);const a=A.find(({mac:e})=>e===t),s=L(p,a,e);i.withTest=i.withTest&&1===s.length}else i.withTest=i.withTest&&1===l.connected_battery_overrides.length;C(i),w(void 0),N.shift(),0===N.length?(p((0,r.AS)()),i.withTest&&p((0,r.to)({modalType:u.A.TEST_SMART_BATTERY,modalProps:{batteryMac:a[0].mac,hostMac:i.hostMac}}))):E(N)},children:(0,l.jsx)(j,{onClose:v,onChange:e=>{const t=A.find(({mac:t})=>t===e.value);C({..._,withTest:1===a.length&&0===(t.connected_battery_overrides||[]).filter(({mac:e})=>e!==N[0]).length}),w(e.value)},withTest:_.withTest})}):null}},721398(e,t,a){a.d(t,{A:()=>o});var l=a(274934),i=a(548941),s=a(247368),n=a(470070);const o=({messageId:e,tooltipClassName:t,values:a,isInteractive:o,portal:c,variant:r="twoTone",size:d="medium"})=>(0,l.jsx)(i.A,{description:(0,l.jsx)(n.sA,{id:e,values:a}),width:210,isInteractive:o,portal:c,tooltipClassName:t,children:(0,l.jsx)(s.A,{isActive:!0,omitSvgMargin:!0,variant:r,size:d})})},133530(e,t,a){a.d(t,{Y:()=>s});var l=a(602086),i=a(237725);function s(e){const t=(0,i.zy)(),a=(0,i.W6)(),s=(0,l.useMemo)(()=>new URLSearchParams(t.search),[t.search]),n=s.get(e),o=(0,l.useCallback)(l=>{const i=new URLSearchParams(s.toString());return l?i.set(e,l):i.delete(e),a.replace({...t,search:i.toString()})},[a,e,t,s]);return(0,l.useMemo)(()=>[n,o],[n,o])}},916704(e,t,a){a.d(t,{A:()=>c});var l=a(274934),i=a(184931),s=a(309130),n=a(14916);const o=e=>{if(e)switch(e){case"picklist":case"realCheckbox":case"radio":case"input":case"dropdown":case"tabs":case"button":case"link":case"table":case"label":case"text":default:return;case"dropdownWithLabel":case"inputWithLabel":return"withLabel"}},c=({type:e,disabled:t,style:a,...c})=>{const r=(0,i.iL)();return(0,l.jsx)(n.A,{alignWith:o(e),style:{...t||r?{opacity:s.xN,pointerEvents:"none",userSelect:"none"}:void 0,...a},...c})}},14916(e,t,a){a.d(t,{A:()=>o});var l=a(274934),i=a(602086),s=a(947059),n=a(421291);const o=({htmlFor:e,searchHtmlFor:t,searchIgnore:a,searchIsApplicable:o,searchTags:c,searchText:r,...d})=>{const h=(0,n.A)(),m=(0,i.useRef)(null),g=h===e||h===t;return(0,i.useEffect)(()=>{if(g&&m.current){const{y:e}=m.current.getBoundingClientRect?.()||{y:0};(e<150||e+200>window.innerHeight)&&setTimeout(()=>{m.current?.scrollIntoView?.({behavior:"smooth",block:"center"})},50)}},[g]),(0,l.jsx)(s.A,{highlight:g,highlightType:"spotlight",htmlFor:t||e,forwardedRef:m,highlightNoAutoScroll:!0,...d})}}}]);