"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[32635],{147433(e,a,s){s.d(a,{A:()=>i});const i={PCAP:4194304,HWOFFLOAD_QOS_AND_SMART_QUEUE:2147483648,SUPPORT_FILE:65536}},889702(e,a,s){var i;s.d(a,{S:()=>i}),function(e){e.API_DEVICE_ADOPT="API_DEVICE_ADOPT",e.API_DEVICE_RESTART="API_DEVICE_RESTART",e.API_WIDGET_OS_STATS="API_WIDGET_OS_STATS"}(i||(i={}))},952566(e,a,s){s.d(a,{p:()=>o});var i=s(222102),t=s(591256),n=s(897166),l=s(570801),d=s(889702);const o=e=>(0,i.Mz)(n.ah,t.pw,n.dK,l.fR,(a,s,i,t)=>{switch(e){case d.S.API_DEVICE_ADOPT:case d.S.API_DEVICE_RESTART:return i||a.includes(e);case d.S.API_WIDGET_OS_STATS:return t||s.includes(e);default:return i}})},358935(e,a,s){s.d(a,{X2:()=>A,lX:()=>r,uC:()=>_});var i=s(571766),t=s(29472),n=s(159469),l=s(774366);const d=`${s(290454).w}/device/:mac:`,o=`${d}/replacement-candidates`,E=`${d}/replace?replacementDeviceMac=:replacement-mac:`,c=`${d}/replace`,r=(e={},a={})=>(0,t.Kd)("replacementCandidates",`${o.replace(":mac:",e.queryParams?.mac)}`,e.queryParams?.mac,e,{...a,idField:"mac"}),_=(e,a)=>s=>s((0,t.vB)(i.aC,null,null,l.A.POST,E.replace(":mac:",e).replace(":replacement-mac:",a),{},null,{})),A=e=>a=>a((0,t.vB)(i.aC,null,null,l.A.DELETE,c.replace(":mac:",e),{},null,{failureToast:()=>({icon:n.C.danger,message:"COMMON_UNKNOWN_ERROR"})}))},496953(e,a,s){s.d(a,{A:()=>N});var i=s(274934),t=s(602086),n=s(977872),l=s(762705),d=s(309130),o=s(470070),E=s(952566),c=s(889702),r=s(469890),_=s(956978),A=s(434521),m=s(45978),C=s(795206),O=s(963428),I=s(146215),u=s(100978);const T=({device:e,disabled:a,confirmTitle:s,confirmMessage:T,confirmButtonMessage:N,hidePoe:p,customName:R,unit_id:D})=>{const S=(0,n.wA)(),M=(0,n.d4)((0,E.p)(c.S.API_DEVICE_RESTART)),[h,x]=(0,t.useState)(!1),v=R||e.name||e.mac,b=(0,_.Tbi)(e)&&(0,r.b0)(e.port_table),j=(0,A.S9)(e),g=j!==m.g.CONNECTED&&j!==m.g.RFSCANNING,P=b||(0,_.moU)(e)||!e.bypassConfirmRestart,L=(0,t.useCallback)(()=>{S((0,C.CP)(e,h?"hard":"soft",D))},[S,e,h,D]);return M?(0,i.jsx)(I.A,{title:(0,i.jsx)(o.sA,{id:s||"DEVICE_ACTIONS_RESTART_CONFIRM_TITLE",values:{deviceName:v}}),message:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.sA,{id:T||"DEVICE_ACTIONS_RESTART_CONFIRM_MESSAGE",values:{deviceName:v}}),b&&!p?(0,i.jsx)(u.A,{paddingTop:d.kc,children:(0,i.jsx)(l.A,{checked:h,id:"hardReboot",onChange:()=>{x(e=>!e)},children:(0,i.jsx)(o.sA,{id:"DEVICE_ACTIONS_RESTART_CONFIRM_CYCLE_POE_POWER"})})}):null]}),confirmButtonLabel:N||"DEVICE_ACTIONS_RESTART",confirmButtonVariant:"destructive",onConfirm:L,trigger:P?(0,i.jsx)(O.A,{isDisabled:g||a,children:(0,i.jsx)(o.sA,{id:"DEVICE_ACTIONS_RESTART"})}):null}):null},N=(0,t.memo)(({device:e,disabled:a,confirmTitle:s,confirmMessage:t,confirmButtonMessage:n,hidePoe:l,customName:d,unit_id:o})=>(0,i.jsx)(T,{device:e,disabled:a,confirmTitle:s,confirmMessage:t,confirmButtonMessage:n,hidePoe:l,customName:d,unit_id:o}))},1943(e,a,s){s.d(a,{A:()=>m});var i=s(274934),t=s(602086),n=s(977872),l=s(247816),d=s(470070),o=s(956978),E=s(434521),c=s(45978),r=s(795206),_=s(648576);const A=(0,l.A)(_.Ay)`
  padding: 0;
  white-space: nowrap;
`,m=({device:e,labelId:a,disabled:s})=>{const l=(0,n.wA)(),_=(0,E.S9)(e),m=(0,t.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),(0,o.YdF)({type:e.type})&&e.peer_ubb?.mac&&l((0,r.VO)({locating:e.peer_ubb.locating,mac:e.peer_ubb.mac,name:e.peer_ubb.name,model:e.peer_ubb.model})),l((0,r.VO)({locating:e.locating,mac:e.mac,name:e.name,model:e.model}))},[l,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]);return(0,i.jsx)(A,{variant:"link",onClick:m,disabled:s||_!==c.g.CONNECTED,children:(0,i.jsx)(d.sA,{id:e.locating?"DEVICE_ACTIONS_LOCATE_STOP":a||"DEVICE_ACTIONS_LOCATE"})})}},54849(e,a,s){s.d(a,{A:()=>f});var i=s(274934),t=s(814557),n=s(602086),l=s(977872),d=s(125799),o=s(938984),E=s(247816),c=s(263705),r=s(409844),_=s(347625),A=s(250266),m=s(205521),C=s(470070),O=s(20049),I=s(177173),u=s(212635),T=s(251905),N=s(10695),p=s(393629),R=s(561500),D=s(598990),S=s(897166),M=s(434521),h=s(45978),x=s(795206),v=s(427714),b=s(408402),j=s(648576),g=s(291508);const P=(0,E.A)(j.Ay,(0,g.A)("disabled"))`
  padding: 0;
  ${({disabled:e})=>e?"pointer-events: none; opacity: 0.4;":""};
  color: ${({theme:{themeName:e,motifPalette:{red05:a}},disabled:s})=>s?a:t.Ay[`desktop-color-red-06-${e}`]};
  &:hover {
    color: ${({theme:{motifPalette:{red05:e}}})=>e};
  }
  &:active {
    color: ${({theme:{motifPalette:{red05:e,red07:a}},disabled:s})=>s?e:a};
  }
`,L=r.AH`
  flex: 1;
  width: 100%;
`,V=e=>(0,i.jsx)(d.A,{portal:!0,width:180,description:(0,i.jsx)(o.A,{style:{whiteSpace:"pre-wrap"},children:(0,i.jsx)(C.sA,{id:"DEVICE_ACTIONS_REMOVE_TOOLTIP"})}),className:L,children:e}),f=({device:e,disabled:a,variant:s})=>{const t=(0,l.wA)(),d=(0,c.u)(),[E,r]=(0,n.useState)(!1),[g,f]=(0,n.useState)(!1),y=(0,l.d4)(S.EL),k=(0,l.d4)(O.OA),w=(0,M.S9)(e),{isDeviceDisconnected:F,isDeviceAdoptionFailed:G,deviceBusy:U}=(0,n.useMemo)(()=>({isDeviceDisconnected:w===h.g.DISCONNECTED,isDeviceAdoptionFailed:w===h.g.ADOPTION_FAILED,deviceBusy:(0,M.C1)(w)}),[w]),W=(0,n.useMemo)(()=>a||U||y,[a,U,y]),B=(0,n.useMemo)(()=>(0,_.Q)({name:e.name,model:e.model,mac:e.mac}),[e.name,e.model,e.mac]),$=(0,n.useCallback)(()=>{const{id:a,type:s}=(0,T.Se)(k);s===u.F7.DEVICE&&a===e.mac&&(t((0,N.U)(I.Zt)),t((0,N.Ao)([])))},[e.mac,t,k]),Y=(0,n.useCallback)(async()=>{r(!0),t((0,R.Yl)(e.mac)).then(()=>{$(),t((0,p.W)(e.mac)),t((0,x.XL)(e.mac)),r(!1),f(!1),t((0,m.K5)()),t((0,D.Uc)()),t((0,v.O)())}).finally(()=>{r(!1),f(!1)})},[e.mac,t,$]),X=(0,n.useCallback)(()=>{r(!1),f(!1)},[]),z=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),f(!0)},[]);return(0,i.jsx)(b.A,{condition:U,wrapper:V,children:(0,i.jsx)(A.A,{isOpen:g,title:"COMMON_ACTION_REMOVE_CONFIRM_TITLE",titleValues:{deviceName:B},message:F||G?"DEVICE_DISCONNECTED_ACTIONS_REMOVE_CONFIRM_MESSAGE":"DEVICE_ACTIONS_REMOVE_CONFIRM_MESSAGE",messageValues:{deviceName:B},buttonMessage:"COMMON_ACTION_REMOVE",buttonVariant:"danger",handleConfirm:Y,handleClose:X,className:"tertiary"===s?L:"",children:(0,i.jsx)(P,{disabled:W,variant:"tertiary"===s?void 0:"link",className:"tertiary"===s?(0,j.sC)(d):"",onClick:z,loader:E?"spinner":null,type:"button",children:(0,i.jsx)(o.A,{color:"red-06",size:"medium",children:(0,i.jsx)(C.sA,{id:"COMMON_ACTION_REMOVE"})})})})})}},684096(e,a,s){s.d(a,{r:()=>l});var i=s(795206),t=s(869332),n=s(159469);const l=({name:e,model:a,mac:s,disabled:l,_id:d})=>o=>{o((0,i.uv)({device:{name:e,model:a,mac:s,disabled:l},onConfirm:()=>{o((0,i.c8)({disabled:!l},d,{failureToast:{icon:n.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR"}}))},onCancel:()=>{o((0,t.AS)())}}))}},728380(e,a,s){s.d(a,{i:()=>D,A:()=>S});var i=s(274934),t=s(602086),n=s(977872),l=s(762705),d=s(309130),o=s(250266),E=s(100978),c=s(470070),r=s(952566),_=s(889702),A=s(469890),m=s(956978),C=s(45978),O=s(795206),I=s(347625),u=s(496953),T=s(247816),N=s(648576);const p=(0,T.A)(N.Ay)`
  padding: 0;
`,R=({device:e,isConfirmOpen:a,setIsConfirmOpen:s,disabled:r})=>{const _=(0,n.wA)(),[u,T]=(0,t.useState)(!1),N=(0,t.useMemo)(()=>(0,I.Q)({name:e.name,model:e.model,mac:e.mac}),[e.name,e.model,e.mac]),R=(0,t.useMemo)(()=>(0,m.Tbi)({type:e.type})&&(0,A.b0)(e.port_table),[e.type,e.port_table]),D=(0,t.useMemo)(()=>e.deviceState!==C.g.CONNECTED&&e.deviceState!==C.g.RFSCANNING,[e.deviceState]),S=(0,t.useCallback)(()=>{_((0,O.CP)({name:e.name,model:e.model,mac:e.mac},u?"hard":"soft"))},[_,e.name,e.model,e.mac,u]),M=(0,t.useCallback)(()=>{s(!1)},[s]),h=(0,t.useCallback)(()=>{T(e=>!e)},[]),x=(0,t.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),R||(0,m.moU)({type:e.type,model:e.model,device_mode_override:e.device_mode_override})||!e.bypassConfirmRestart?s(!0):_((0,O.CP)({name:e.name,model:e.model,mac:e.mac}))},[_,R,e.bypassConfirmRestart,s,e.type,e.model,e.device_mode_override,e.name,e.mac]);return(0,i.jsx)(o.A,{isOpen:a,title:"DEVICE_ACTIONS_RESTART_CONFIRM_TITLE",titleValues:{deviceName:N},message:"DEVICE_ACTIONS_RESTART_CONFIRM_MESSAGE",messageValues:{deviceName:N},...R?{body:(0,i.jsx)(E.A,{paddingTop:d.kc,children:(0,i.jsx)(l.A,{checked:u,id:"hardReboot",onChange:h,children:(0,i.jsx)(c.sA,{id:"DEVICE_ACTIONS_RESTART_CONFIRM_CYCLE_POE_POWER"})})})}:{},buttonMessage:"DEVICE_ACTIONS_RESTART",buttonVariant:"danger",handleConfirm:S,handleClose:M,offset:-1,children:(0,i.jsx)(p,{variant:"link",onClick:x,disabled:D||r,children:(0,i.jsx)(c.sA,{id:"DEVICE_ACTIONS_RESTART"})})})},D=e=>(0,n.d4)((0,t.useMemo)(()=>(0,r.p)(_.S.API_DEVICE_RESTART),[]))?(0,i.jsx)(R,{...e}):null,S=(0,t.memo)(({device:e,disabled:a})=>(0,i.jsx)(u.A,{device:e,disabled:a}))},963428(e,a,s){s.d(a,{A:()=>c});var i=s(274934),t=s(977872),n=s(602086),l=s(954702),d=s(669439),o=s(897166),E=s(100978);const c=(0,n.forwardRef)(({allowReadOnly:e,disabledReason:a,...s},n)=>{const c=(0,t.d4)(o.EL)&&!e;return(0,i.jsx)(E.A,{alignItems:"center",children:(0,i.jsx)(d.A,{description:a,placement:"left",children:(0,i.jsx)(l.A,{fontSize:"medium",type:"button",...s,isDisabled:c||s.isDisabled||!!a,ref:n})})})})},532635(e,a,s){s.d(a,{f:()=>ha,A:()=>ba});var i=s(274934),t=s(977872),n=s(602086),l=s(125799),d=s(938984),o=s(853777),E=s(247816),c=s(669439),r=s(347625),_=s(706925),A=s(101134),m=s(586566),C=s(309130),O=s(378767),I=s(250266),u=s(120197),T=s(502129),N=s(100978),p=s(408402),R=s(728380),D=s(814557),S=s(599110),M=s(409844),h=s(743178),x=s(159469),v=s(613842),b=s(890932),j=s(974390),g=s(205521),P=s(700444),L=s(869332),V=s(771927),f=s(470070),y=s(393629),k=s(561500),w=s(594633),F=s(570801),G=s(956978),U=s(434521),W=s(333015),B=s(45978),$=s(795206),Y=s(228502),X=s(807811),z=s(541819);const Q=(0,E.A)(S.A)`
  padding: 0;
  color: ${({theme:{themeName:e}})=>D.Ay[`desktop-color-red-06-${e}`]};

  &:hover {
    color: ${({theme:{motifPalette:{red05:e}}})=>e};
  }

  &:active {
    color: ${({theme:{motifPalette:{red07:e}}})=>e};
  }
`,q=(0,E.A)("div")`
  margin-top: ${({theme:{space:e}})=>e[4]}px;
  line-height: 1.5;
`,H=(M.AH`
  width: auto !important;
  padding: 0 8px;
`,M.AH`
  button {
    border-radius: 0;
    font-size: 12px;
  }
`),K=({device:e,showOnlyIfInactive:a})=>{const{formatMessage:s}=(0,f.tz)(),{mac:l,name:d,adopted:o,model:E}=e,c=(0,t.wA)(),[r,_]=(0,n.useState)(!1),A=(0,t.d4)(w.S$),m=(0,t.d4)(b.p),C=(0,t.d4)(Y.A),O=(0,t.d4)(F.ay),I=(0,h.Qh)(A),u=(0,G.tNJ)(e),T=(0,W.zQ)(e),N=(0,U.S9)(e),p=u&&(!a||[B.g.UNKNOWN,B.g.FIRMWARE_MISMATCH,B.g.ADOPTION_FAILED,B.g.DISCONNECTED].includes(N)),R=(0,n.useCallback)(async()=>{try{await c((0,k.Yl)(l)),c((0,$.XL)(l)),c((0,y.W)(l)),c((0,g.K5)()),T||setTimeout(()=>{c((0,P.ox)({duration:0,onClose:()=>c((0,P.uU)("LTE_SUBSCRIPTION_NEEDS_ATTENTION")),type:x.C.warning,title:s({id:"ON_LOAD_WARNING_SUBSCRIPTION_NEEDS_ATTENTION_TITLE"}),message:"ON_LOAD_WARNING_SUBSCRIPTION_NEEDS_ATTENTION_BODY",iconUrl:j.C.getRemoteImagePath(C[E],z.Xh.MEDIUM),stateIndicator:x.C.info,primaryButton:{label:s({id:"ON_LOAD_WARNING_PAYMENT_ACTION_CANCEL_SUBSCRIPTIONS"}),onClick:()=>v.A.open(`${X.DU}${I}/subscriptions`)},className:H},"LTE_SUBSCRIPTION_NEEDS_ATTENTION"))},10),c((0,L.AS)())}catch{_(!1)}},[I,c,l,T,E,m,O,C,s]),D=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!0);const a={name:d&&d!==l?d:s({id:"DEVICE_TYPE_ULTE"})};T?R():c((0,V.E)({title:"DEVICE_ULTE_REMOVE_HEADER",titleValues:a,message:"DEVICE_ULTE_REMOVE_DETAILS",messageValues:a,confirmButtonProps:{text:(0,i.jsx)(f.sA,{id:"COMMON_ACTION_REMOVE"}),variant:"primary"},children:(0,i.jsx)(q,{children:(0,i.jsx)(f.sA,{id:"DEVICE_ULTE_REMOVE_INFO"})}),onConfirm:R,onCancel:()=>{c((0,L.AS)()),_(!1)}}))},[l,d,T,s,c,R]);return p&&o?(0,i.jsx)(Q,{variant:"link",onClick:D,loader:r?"spinner":null,children:(0,i.jsx)(f.sA,{id:"DEVICE_ACTIONS_REMOVE_LABEL"})}):null};var J=s(54849),Z=s(954702),ee=s(29472),ae=s(897166),se=s(664102),ie=s(193730),te=s(146215),ne=s(642687);const le=({children:e,countdownFrom:a,renderCountdownLabel:s,autoStart:t,...l})=>{const[d,o]=(0,n.useState)(-1),[E,c]=(0,n.useState)(!1),r=(0,n.useRef)(null),_=l.isDisabled||E,A=(0,n.useCallback)(()=>{clearInterval(r.current),r.current=null},[r]),m=(0,n.useCallback)(()=>{c(!1),o(-1),A()},[A,c,o]),C=(0,n.useCallback)(()=>{m()},[m]);return(0,n.useEffect)(()=>{E&&0===d&&C()},[d,m]),(0,n.useEffect)(()=>(t&&(c(!0),o(a),r.current=setInterval(()=>o(e=>e-1),1e3)),A),[A]),(0,i.jsx)(ne.A,{isDisabled:_,...l,children:E?s(d):e})},de=(0,n.memo)(({mac:e,vbms_table:{is_battery_mode:a}={is_battery_mode:!1},deviceState:s,disabled:l})=>{const d=(0,t.wA)(),o=(0,t.d4)(ae.EL),E=(0,n.useRef)(null),[c,r]=(0,n.useState)(!1),_=l||o||a||(0,U.C1)(s)||c,A=(0,n.useCallback)(()=>{r(!0),d((0,ee.Xj)(ie.A.OUTLET_CTL,se.CMD_PATH,{mac:e,delay_time_to_off:0})).catch(({msg:e})=>{d((0,P.ox)({icon:x.C.danger,message:e||"COMMON_NOTICE_REQUEST_ERROR"}))}).finally(()=>{r(!0),E.current=setTimeout(()=>r(!1),3e4)})},[e,d,r]);return(0,i.jsx)(N.A,{justifyContent:"space-between",alignItems:"center",children:(0,i.jsx)(N.A,{gap:C.Ln,children:(0,i.jsx)(te.A,{message:(0,i.jsx)(f.sA,{id:"DEVICE_REMOTE_POWER_CYCLE_TOOLTIP",values:{seconds:60}}),title:(0,i.jsx)(f.sA,{id:"DEVICE_OUTLET_POWER_CYCLE"}),trigger:(0,i.jsx)(Z.A,{type:"button",fontSize:"medium",variant:"destructive",isDisabled:_,children:(0,i.jsx)(f.sA,{id:"DEVICE_REMOTE_POWER_CYCLE"})}),renderConfirmButton:e=>(0,i.jsx)(le,{autoStart:!0,countdownFrom:5,renderCountdownLabel:e=>(0,i.jsx)(f.sA,{id:"DEVICE_REMOTE_POWER_CYCLING_IN",values:{seconds:e}}),onPress:()=>{e(),A()},variant:"destructive",motif:"dark",children:(0,i.jsx)(f.sA,{id:"COMMON_ACTION_PROCEED"})}),onConfirm:A})})})});var oe=s(630849);const Ee=(0,n.memo)(({_id:e,mac:a,name:s,model:l,outlet_enabled:d,disabled:o})=>{const E=(0,t.wA)(),c=(0,t.d4)(ae.EL),[_,A]=(0,n.useState)(!1),[m,C]=(0,n.useState)(!1),O=c||m||o,u=(0,oe.I)(),T=(0,n.useCallback)(()=>{C(!0),E((0,$.ex)({outlet_enabled:!d},e,a,{})).catch(e=>{u(e)}).finally(()=>{C(!1)})},[e,a,d,E,u]),N=(0,n.useCallback)(()=>{A(!1)},[A]),p=(0,n.useCallback)(()=>{A(!0)},[A]);return(0,i.jsx)(I.A,{isOpen:_,title:d?"DEVICE_ACTIONS_REMOTE_POWER_OFF_CONFIRM_TITLE":"DEVICE_ACTIONS_REMOTE_POWER_ON_CONFIRM_TITLE",message:d?"DEVICE_ACTIONS_REMOTE_POWER_OFF_AC_CONFIRM_MESSAGE":"DEVICE_ACTIONS_REMOTE_POWER_ON_CONFIRM_MESSAGE",messageValues:{deviceName:(0,r.Q)({name:s,model:l,mac:a})},buttonMessage:"COMMON_ACTION_PROCEED",buttonVariant:d?"danger":"primary",handleConfirm:T,handleClose:N,children:(0,i.jsx)(Z.A,{type:"button",fontSize:"medium",variant:d?"destructive":"emphasis",isDisabled:O,onClick:p,children:(0,i.jsx)(f.sA,{id:d?"DEVICE_ACTIONS_REMOTE_POWER_OFF":"DEVICE_ACTIONS_REMOTE_POWER_ON"})})})});var ce=s(1943),re=s(648576);const _e=(0,E.A)(re.Ay)`
  padding: 0;
`;var Ae=s(684096);const me=(0,n.memo)(({device:{_id:e,name:a,model:s,mac:l,disabled:d}})=>{const o=(0,t.wA)(),E=(0,n.useCallback)(i=>{i.preventDefault(),i.stopPropagation(),o((0,Ae.r)({name:a,model:s,mac:l,disabled:d,_id:e}))},[o,e,a,s,l,d]);return(0,i.jsx)(_e,{variant:"link",onClick:E,children:(0,i.jsx)(f.sA,{id:d?"COMMON_ACTION_ENABLE":"COMMON_ACTION_DISABLE"})})}),Ce=(0,E.A)(re.Ay)`
  padding: 0;
`,Oe=({device:e,disabled:a,device:{name:s,upgrade_to_firmware:l,mac:d}})=>{const o=(0,t.wA)(),[E,c]=(0,n.useState)(!1),r=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),o((0,$.xv)({titleValues:{deviceName:s},messageValues:{deviceName:s,toVersion:l},onConfirm:()=>{c(!0),o((0,$.Pv)(d,s)).finally(()=>c(!1))},onCancel:()=>{o((0,L.AS)()),c(!1)}}))},[s,l,d,o]);return(0,i.jsx)(Ce,{variant:"link",onClick:r,disabled:a||E||(0,U.S9)(e)!==B.g.CONNECTED,children:(0,i.jsx)(f.sA,{id:"COMMON_ACTION_UPDATE_DEVICE"})})},Ie=(0,E.A)(re.Ay)`
  padding: 0;
`,ue=({device:e})=>{const a=(0,t.wA)(),[s,l]=(0,n.useState)(!1),d=(0,U.S9)(e);return(0,i.jsx)(Ie,{variant:"link",onClick:async()=>{l(!0),await a((0,$.ci)({device:e})),l(!1)},disabled:s||d!==B.g.CONNECTED,children:(0,i.jsx)(f.sA,{id:"DEVICE_ACTIONS_DEBUG_LABEL"})})};var Te=s(590979);var Ne=s(815436),pe=s(158402),Re=s(726831);const De=(0,E.A)(re.Ay)`
  padding: 0;
`,Se=({device:e})=>{const{isUbbAlignmentToolModalClosed:a}=(0,t.d4)(F.tg),s=(0,t.wA)(),l=(e=>{const[a,s]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{fetch(e,{mode:"no-cors"}).then(()=>{s(!0)}).catch(()=>s(!1))},[e]),a})(`${Re.A.feStaticAssets}/videos`);return(0,i.jsx)(De,{variant:"link",onClick:i=>{i.preventDefault(),i.stopPropagation(),e.is_aligning||a||!l||s((0,L.to)({modalType:Ne.A.UBB_ALIGNMENT_TOOL,modalProps:{closeModal:()=>{s((0,pe.i4)({isUbbAlignmentToolModalClosed:!0})),s((0,L.AS)())}}})),s((0,$.MF)(e))},disabled:(0,U.S9)(e)!==B.g.CONNECTED,...Te.A.addDataTestId(Te.A.TestId.MODAL_TRIGGER),children:(0,i.jsx)(f.sA,{id:e.is_aligning?"DEVICE_ACTIONS_ALIGNMENT_DISABLE":"DEVICE_ACTIONS_ALIGNMENT_ENABLE"})})};var Me=s(104997),he=s(291935),xe=s(591256),ve=s(952566),be=s(889702),je=s(314229),ge=s(469890),Pe=s(853109),Le=s(857780),Ve=s(754924),fe=s(969288),ye=s(147433),ke=s(183743),we=s(999837),Fe=s(956731);const Ge=(0,E.A)(re.Ay)`
  padding: 0;
`,Ue=({mac:e,deviceName:a})=>{const s=(0,t.wA)(),l=(0,t.d4)(ae.n),d=(0,t.d4)(he.HG),o=(0,n.useCallback)(()=>{s((0,L.to)({modalType:Ne.A.MOVE_TO_SITE,modalProps:{mac:e,deviceName:a}}))},[s,e,a]);return d||l.length>1?(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_MOVE_TO_SITE_DISABLED_TOOLTIP",children:(0,i.jsx)(Ge,{variant:"link",onClick:o,disabled:l.length<2,children:(0,i.jsx)(f.sA,{id:"DEVICE_ACTIONS_MOVE_TO_SITE"})})}):null};var We=s(696264),Be=s(130847),$e=s(237887),Ye=s(222102),Xe=s(656466),ze=s(401042),Qe=s(290454);const qe=`${Qe.w}/device/:mac:/clone-candidates`,He=(e={},a={})=>(0,ee.Kd)("cloneCandidates",`${qe.replace(":mac:",e.queryParams?.mac)}`,e.queryParams?.mac,e,{...a,idField:"mac"});var Ke,Je=s(947414);!function(e){e.MAC="mac",e.NAME="name",e.MODEL="model",e.CLONE_CANDIDATE="cloneCandidate",e.SET_CLONE_CANDIDATE="setCloneCandidate"}(Ke||(Ke={}));const Ze=(0,n.createContext)({[Ke.MAC]:void 0,[Ke.MODEL]:void 0,[Ke.NAME]:void 0,[Ke.CLONE_CANDIDATE]:void 0,[Ke.SET_CLONE_CANDIDATE]:Je.P1}),ea=(0,E.A)(N.A)`
  flex-direction: column;
  gap: ${C.Ln};
`,aa=(0,E.A)(N.A)`
  flex-direction: column;
`,sa=(0,E.A)("ul")`
  margin: 0;
  padding-inline-start: ${C.Er};
`,ia=(0,n.memo)(()=>{const e=(0,t.wA)(),{formatMessage:a}=(0,f.tz)(),[s,l]=(0,n.useState)([]),{mac:o,model:E,name:c,cloneCandidate:r,setCloneCandidate:_}=(0,n.useContext)(Ze),A=(0,t.d4)((0,n.useMemo)(()=>(e=>(0,Ye.Mz)((e=>(0,Xe.uh)(He({queryParams:{mac:e}})))(e),e=>(0,ze.i6)(e)?.devices||[]))(o),[o])),m=(0,n.useMemo)(()=>A.map(({mac:e,model:a,name:s})=>({label:s,value:e,image:(0,i.jsx)(j.A,{model:a}),additionalInfo:e})),[A]),C=(0,n.useCallback)(async({value:a})=>{const s=A.find(e=>e.mac===a);e((0,$.aU)({mac:o,name:c,model:E},s,!0)).then(e=>{l(e?.data?.[0]?.failures||[]),_(s)})},[_,e,A,o,c,E]);return(0,n.useEffect)(()=>{e(He({queryParams:{mac:o}}))},[e,o]),(0,i.jsxs)(ea,{children:[(0,i.jsx)(d.A,{color:"text-2",size:"medium",children:(0,i.jsx)(f.sA,{id:"DEVICE_LOAD_CONFIGURATION_DESCRIPTION"})}),(0,i.jsx)($e.A.Sorted,{value:r.mac,label:(0,i.jsx)(f.sA,{id:"COMMON_DEVICE"}),width:"100%",searchable:!0,direction:"bottom",onChange:C,optionsWidth:"contentWidth",searchEmptyMessage:a({id:"DEVICE_NO_DEVICES_FOUND"}),options:m}),s.length?(0,i.jsx)(Be.A,{type:"info",text:(0,i.jsxs)(aa,{children:[(0,i.jsx)(d.A,{size:"medium",color:"text-2",children:(0,i.jsx)(f.sA,{id:"DEVICE_LOAD_CONFIGURATION_MISSING_FEATURES"})}),(0,i.jsx)(sa,{children:s.map(e=>(0,i.jsx)("li",{children:e},e))})]})}):null]})}),ta=(0,E.A)(re.Ay)`
  padding: 0;
`,na=(0,n.memo)(({mac:e,model:a,name:s,disabled:l=!1})=>{const d=(0,t.wA)(),[o,E]=(0,n.useState)(!1),[c,r]=(0,n.useState)(!1),[_,A]=(0,n.useState)({}),m=(0,n.useCallback)(()=>{E(!0)},[]),C=(0,n.useCallback)(()=>{A({}),E(!1),r(!1)},[]),O=(0,n.useCallback)(()=>{d((0,P.ox)({icon:x.C.success,message:"DEVICE_CONFIGURATION_LOADED",duration:3e3}))},[d]),I=(0,n.useCallback)(()=>{d((0,P.ox)({icon:x.C.warning,message:"DEVICE_FAILED_TO_LOAD_CONFIGURATION",duration:3e3}))},[d]),u=(0,n.useCallback)(()=>{r(!0),d((0,$.aU)({mac:e,model:a,name:s},_)).then(O).then(C).catch(I).finally(()=>{r(!1)})},[d,O,I,e,a,s,C,_]),T=(0,n.useMemo)(()=>Boolean(_.mac),[_.mac]),N=(0,n.useMemo)(()=>[{text:(0,i.jsx)(f.sA,{id:"COMMON_ACTION_CANCEL"}),variant:"tertiary",onClick:C},{text:(0,i.jsx)(f.sA,{id:"COMMON_ACTION_APPLY"}),variant:"primary",onClick:u,disabled:!T||c,loader:c?"spinner":null}],[C,u,T,c]),p=(0,n.useMemo)(()=>({[Ke.MAC]:e,[Ke.MODEL]:a,[Ke.NAME]:s,[Ke.CLONE_CANDIDATE]:_,[Ke.SET_CLONE_CANDIDATE]:A}),[e,a,s,_]);return(0,i.jsx)(Ze.Provider,{value:p,children:(0,i.jsx)(We.A,{allowOverflow:!0,title:(0,i.jsx)(f.sA,{id:"DEVICE_LOAD_CONFIGURATION"}),body:(0,i.jsx)(ia,{}),position:"top",portal:!0,actions:N,onRequestClose:C,isOpen:o,children:(0,i.jsx)(ta,{variant:"link",type:"button",onClick:m,disabled:c||l,children:(0,i.jsx)(f.sA,{id:"DEVICE_LOAD_CONFIGURATION"})})})})});var la=s(87449),da=s(129402),oa=(s(232087),s(976458)),Ea=s(224012);const ca=/_([0-9]+\.[0-9]+\.[0-9]+)\+/,ra=(0,n.memo)(({name:e,model:a,mac:s,version:l,disabled:d})=>{const o=(0,t.wA)(),E=(0,t.d4)(w.S$),c=(0,h.GO)(E),_=(0,t.d4)(xe.Eh),A=(0,t.d4)(oa.ap),m=(0,t.d4)(oa.YL),C=(0,n.useCallback)(e=>{o((0,L.to)({modalType:Ne.A.DOWNGRADE_FEEDBACK,modalProps:e}))},[o]),O=(0,n.useCallback)(async(e,s,i)=>{const t=`${X.DU}${Ea.Fx[c]}/v1/firmware-downgrade`;try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Captcha":i},mode:"cors",body:JSON.stringify({message:e,applicationName:"Network",applicationVersion:_,deviceModel:(0,r.Lm)(a),deviceFirmwareCurrentVersion:(0,da._)(l),deviceFirmwareNewVersion:s,anonymousId:A})})}catch(e){}},[A,c,a,_,l]),I=(0,n.useCallback)(i=>{if(o((0,$._1)({name:e,model:a,mac:s},i)),o((0,L.AS)()),m)return;const t=(e=>{const a=ca.exec(e);return a?.[1]?(0,da._)(a[1]):null})(i);t&&(0,la.compare)(t,(0,da._)(l))<0&&C({onSubmit:(e,a)=>O(e,t,a)})},[o,e,a,s,m,l,C,O]),u=(0,n.useCallback)(()=>{o((0,$.IK)({onConfirm:I,onCancel:()=>{o((0,L.AS)())}}))},[o,I]);return(0,i.jsx)(re.Ay,{style:{padding:0},name:"customUpgrade",variant:"link",type:"submit",onClick:u,disabled:d,children:(0,i.jsx)(f.sA,{id:"DEVICE_ACTIONS_CUSTOM_UPGRADE_CONFIRM_TITLE"})})});var _a=s(571766),Aa=s(774366),ma=s(430986),Ca=s(379983),Oa=s(296261),Ia=s(426594);const ua=`${Qe.w}/support/{mac}`,Ta=`${ua}/generation`,Na=`${ua}/download`;var pa;!function(e){e.READY_TO_GENERATE="READY_TO_GENERATE",e.GENERATING="GENERATING",e.READY_TO_DOWNLOAD="READY_TO_DOWNLOAD"}(pa||(pa={}));var Ra=s(213582),Da=s(348185);const Sa=({onClick:e,children:a,isDisabled:s})=>(0,i.jsx)(Z.A,{type:"button",onClick:e,isDisabled:s,children:(0,i.jsx)(d.A,{size:"medium",color:"inherit",children:a})}),Ma=({mac:e,disabled:a,name:s=e})=>{const l=(0,t.wA)(),[d,o]=(0,n.useState)(pa.READY_TO_GENERATE),[E,c]=(0,n.useState)(!1),r=(0,n.useCallback)(()=>{l((e=>a=>a((0,ee.vB)(_a.aC,null,null,Aa.A.POST,(0,ma.P)(Ta,{mac:e}),{},null,{fetchConfig:{headers:{"Content-Type":"application/json"}}})))(e)).then(()=>{o(pa.GENERATING)}).catch(({msg:e})=>{l((0,P.ox)({icon:x.C.danger,message:e||"COMMON_UNKNOWN_ERROR",values:{name:s}}))})},[l,e,s]),_=(0,n.useCallback)(()=>{c(!0),l(((e,a,{isCancelled:s,...i}={})=>async(t,n)=>{const l=(0,ma.P)(Na,{mac:e}),d=await t((0,ee.t2)(Ca.A,l,void 0,i));return s?.call(null)?Promise.resolve():(0,Oa.LR)((0,Ia.k)(n())(l),a??(0,Oa.v6)(d),!0)})(e)).then(()=>{o(pa.READY_TO_GENERATE)}).catch(({msg:e})=>{l((0,P.ox)({icon:x.C.danger,message:e||"COMMON_UNKNOWN_ERROR",values:{name:s}}))}).finally(()=>{c(!1)})},[l,e,s]),A=(0,n.useCallback)((a={})=>{e===a?.mac&&a?.status&&a.status in pa&&o(a.status)},[e]);(0,Ra.A)(Da.E.DEVICE_SUPPORT_FILE,A),(0,n.useEffect)(()=>{l((e=>a=>a((0,ee.vB)(_a.aC,null,null,Aa.A.GET,(0,ma.P)(ua,{mac:e}),{},null,{})))(e)).then(({data:e={}})=>{A(e)})},[l,e,A]);const m=(0,n.useMemo)(()=>{switch(d){case pa.READY_TO_GENERATE:return(0,i.jsx)(Sa,{onClick:r,isDisabled:a,children:(0,i.jsx)(f.sA,{id:"DEVICE_GENERATE_SUPPORT_FILE"})});case pa.GENERATING:return(0,i.jsxs)(Sa,{isDisabled:!0,children:[(0,i.jsx)(f.sA,{id:"COMMON_GENERATING"}),"... ",(0,i.jsx)(f.sA,{id:"COMMON_ESTIMATED_TIME",values:{time:(0,i.jsxs)(i.Fragment,{children:["3 ",(0,i.jsx)(f.sA,{id:"COMMON_UNIT_MIN"})]})}})]});case pa.READY_TO_DOWNLOAD:return(0,i.jsx)(Sa,{onClick:_,isDisabled:a||E,children:(0,i.jsx)(f.sA,{id:"DEVICE_DOWNLOAD_SUPPORT_FILE"})});default:return null}},[r,_,d,a,E]);return d?(0,i.jsx)(Fe.A,{tooltipId:"DEVICE_DOWNLOAD_SUPPORT_FILE_TOOLTIP",children:m}):null},ha="manage",xa=(0,E.A)(N.A)`
  > div:last-child {
    border-bottom: none;
    padding-bottom: 0px;
    height: 36px;
  }
`,va=(0,E.A)("div")`
  margin-right: 6px;
`,ba=({activeItem:e,hideLocate:a,disableLocateWithReason:s,hideRestart:E,disableRestartWithReason:D,hideRemove:S,disableRemoveWithReason:M,hideManualFwUpdate:h,disableManualFwUpdateWithReason:x,hideDowngrade:v,disableDowngradeWithReason:b,hideReplacementDevice:j,hideSnmp:g,hideDebug:P,hideCopyConfig:L,hideReplace:V,disableCopyConfigWithReason:y,values:k={},setFieldValue:w,renderApFields:F,showEnableDisableSwitch:$,additionalItems:Y=null,unpairItem:X=null,disableRemotePowerOffWithReason:z,restartButton:Q=null})=>{const q=`${(0,A.A)(Me.VO.DEVICES)}?${fe.Ej}`,H=(0,t.d4)((0,n.useMemo)(()=>(0,Ve.Xr)({model:e.model,type:e.type,device_mode_override:e.device_mode_override}),[e.model,e.type,e.device_mode_override])),Z=(0,U.S9)(e),ee=(0,t.d4)(he.G3),ae=(0,t.d4)(xe.kC),se=(0,t.d4)((0,ve.p)(be.S.API_DEVICE_RESTART)),ie=(0,t.d4)(Ve.ID),te=(0,Pe.$Y)({device:e,devices:ie}),ne=(0,n.useMemo)(()=>(0,G.jS2)(e.version,e.upgrade_to_firmware),[e.version,e.upgrade_to_firmware]),le=(0,n.useMemo)(()=>(0,m.Vq)(e.fw_caps)&&!P,[e.fw_caps,P]),oe=(0,n.useMemo)(()=>(0,je.Pi)(e.psu_table)?.online,[e.psu_table]),re=(0,n.useMemo)(()=>Z===B.g.UPGRADING?"DEVICE_ACTIONS_CUSTOM_UPGRADE_IN_PROGRESS":ee?"DEVICE_ACTIONS_CUSTOM_UPGRADE_NOT_AVAILABLE":"DEVICE_ACTIONS_CUSTOM_UPGRADE_INFO",[Z,ee]),[_e,Ae]=(0,n.useState)(!1),Ce=(0,n.useMemo)(()=>(e.port_table||[]).some(ge.PA),[e.port_table]),Ie=(0,n.useCallback)(()=>{k.lowpfmode_override?w?.("lowpfmode_override",!1):Ce?Ae(!0):w?.("lowpfmode_override",!0)},[w,k.lowpfmode_override,Ce]);return(0,i.jsxs)(xa,{flexDirection:"column",children:[F?(0,i.jsxs)(i.Fragment,{children:[(0,m.mo)(e)?(0,i.jsxs)(N.A,{marginBottom:C.Ln,gap:C.YC,alignItems:"center",children:[(0,i.jsx)(u.A,{type:"realCheckbox",name:"green_ap_enabled",children:(0,i.jsx)(f.sA,{id:"COMMON_ENHANCED_POE_PLUS_INTEROPERABILITY"})}),(0,i.jsx)(l.A,{width:220,description:(0,i.jsx)(f.sA,{id:"COMMON_ENHANCED_POE_PLUS_INTEROPERABILITY_DESC"}),children:(0,i.jsx)(o.A,{isActive:!0,size:"original"})})]}):null,g?null:(0,m.A6)(e)?(0,i.jsx)(N.A,{marginBottom:C.Ln,flexDirection:"column",children:(0,i.jsx)(ke.A,{})}):null,e.lowpfmode?(0,i.jsxs)(N.A,{marginBottom:C.Ln,justifyContent:"space-between",children:[(0,i.jsxs)(N.A,{alignItems:"center",children:[(0,i.jsx)(d.A,{size:"medium",children:(0,i.jsx)(va,{children:(0,i.jsx)(f.sA,{id:"COMMON_LOW_PERFORMANCE_MODE"})})}),(0,i.jsx)(l.A,{width:200,description:(0,i.jsx)(f.sA,{id:(0,m.gU)(e,te),values:{name:(0,r.Q)(e)}}),children:(0,i.jsx)(o.A,{isActive:!0,size:"original"})})]}),(0,i.jsx)(I.A,{title:"DEVICE_PROPERTIES_LABEL_LOW_PRFM_MODE_CONFIRM_TITLE",message:"DEVICE_PROPERTIES_LABEL_LOW_PRFM_MODE_CONFIRM_MESSAGE",handleClose:()=>Ae(!1),handleConfirm:()=>w?.("lowpfmode_override",!0),isOpen:_e,position:"topStart",buttonMessage:"COMMON_ACTION_PROCEED",children:(0,i.jsx)(u.A,{type:"checkbox",name:"lowpfmode_override",onChange:Ie})})]}):null]}):null,(0,_.G)({type:e.type,model:e.model})&&!j?(0,i.jsxs)(O.A,{children:[V?null:(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_SET_REPLACEMENT_DEVICE_DESCRIPTION",children:(0,i.jsx)(we.A,{mac:e.mac,model:e.model,type:e.type,hideTooltip:!0})}),L?null:(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_LOAD_CONFIGURATION_DESCRIPTION",disabledTooltip:y,children:(0,i.jsx)(na,{mac:e.mac,model:e.model,name:e.name,disabled:!!y})})]}):null,(0,m.W4)(e,ye.A.SUPPORT_FILE)?(0,i.jsx)(Ma,{mac:e.mac,name:(0,r.Q)(e),disabled:Z!==B.g.CONNECTED}):null,le?(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_ACTIONS_DEBUG_INFO",children:(0,i.jsx)(ue,{device:e})}):null,ae?(0,i.jsx)(Ue,{mac:e.mac,deviceName:(0,r.Q)(e)}):null,H||h?null:(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_ACTIONS_CUSTOM_UPGRADE_INFO",tooltipProps:{messageId:re,values:{button:(0,i.jsx)(T.A,{to:q,children:(0,i.jsx)(f.sA,{id:"DEVICE_ACTIONS_CUSTOM_UPGRADE_NOT_AVAILABLE_BUTTON"})})},isInteractive:!0},disabledTooltip:x,children:(0,i.jsx)(p.A,{condition:oe,wrapper:e=>(0,i.jsx)(l.A,{description:(0,i.jsx)(f.sA,{id:"DEVICE_ACTIONS_CUSTOM_UPGRADE_EXTERNAL_BATTERY_WARNING"}),position:"topLeft",width:245,children:e}),children:(0,i.jsx)(ra,{name:e.name,model:e.model,mac:e.mac,version:e.version,disabled:oe||Z===B.g.UPGRADING||ee||!!x})})}),a?null:(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_ACTIONS_LOCATE_DEVICE_DESCRIPTION",disabledTooltip:s,children:(0,i.jsx)(ce.A,{device:e,disabled:!!s})}),!E&&se?(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_ACTIONS_RESTART_INFO",disabledTooltip:D,children:Q||(0,i.jsx)(R.A,{device:e,disabled:!!D})}):null,$||e.disabled?(0,i.jsx)(Fe.R,{tooltipId:e.disabled?"DEVICE_ACTIONS_ENABLE_INFO":"DEVICE_ACTIONS_DISABLE_INFO",children:(0,i.jsx)(me,{device:{_id:e._id,name:e.name,model:e.model,mac:e.mac,disabled:e.disabled}})}):null,e.type===Le.bq.UBB||(0,G.vyh)(e)?(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_ACTIONS_ALIGNMENT_INFO",children:(0,i.jsx)(Se,{device:e})}):null,ne&&!v?(0,i.jsx)(Fe.R,{disabledTooltip:b,children:(0,i.jsx)(Oe,{device:e,disabled:!!b})}):null,(0,G.VkX)({model:e.model})?(0,i.jsxs)(i.Fragment,{children:[!e.vbms_table?.is_battery_mode&&e.outlet_enabled?(0,i.jsx)(Fe.R,{flexDirection:"column",tooltipId:"DEVICE_REMOTE_POWER_CYCLE_TOOLTIP",tooltipProps:{values:{seconds:60}},children:(0,i.jsx)(de,{_id:e._id,mac:e.mac,vbms_table:e.vbms_table,deviceState:e.deviceState,disabled:!e.outlet_enabled||Z!==B.g.CONNECTED})}):null,(0,i.jsx)(Fe.R,{tooltipId:e.outlet_enabled?"DEVICE_ACTIONS_REMOTE_POWER_OFF_TOOLTIP":"DEVICE_ACTIONS_REMOTE_POWER_ON_TOOLTIP",tooltipProps:{values:{deviceName:(0,i.jsx)(i.Fragment,{children:(0,r.Q)({name:e.name,model:e.model,mac:e.mac})})}},disabledTooltip:z,children:(0,i.jsx)(Ee,{_id:e._id,mac:e.mac,name:e.name,model:e.model,outlet_enabled:e.outlet_enabled,disabled:!!z||Z!==B.g.CONNECTED})})]}):null,X,S?null:(0,i.jsx)(Fe.R,{tooltipId:"DEVICE_ACTIONS_REMOVE_INFO",children:(0,W.pY)(e)?(0,i.jsx)(K,{device:e}):(0,i.jsx)(c.A,{description:M??(oe?(0,i.jsx)(f.sA,{id:"DEVICE_ACTIONS_REMOVE_EXTERNAL_BATTERY_WARNING"}):void 0),children:(0,i.jsx)("span",{children:(0,i.jsx)(J.A,{device:e,disabled:oe||!!M})})})}),Y]})}},721398(e,a,s){s.d(a,{A:()=>d});var i=s(274934),t=s(125799),n=s(853777),l=s(470070);const d=({messageId:e,tooltipClassName:a,values:s,isInteractive:d,portal:o,variant:E="twoTone",size:c="medium"})=>(0,i.jsx)(t.A,{description:(0,i.jsx)(l.sA,{id:e,values:s}),width:210,isInteractive:d,portal:o,tooltipClassName:a,children:(0,i.jsx)(n.A,{isActive:!0,omitSvgMargin:!0,variant:E,size:c})})},183743(e,a,s){s.d(a,{A:()=>_,U:()=>r});var i=s(274934),t=s(602086),n=s(843871),l=s(950804),d=s(89469),o=s(120197),E=s(796091),c=s(470070);const r={snmpEnabled:l.A.boolean(),snmp_location:l.A.string().when("snmpEnabled",{is:!0,then:l.A.string().test({name:"provideEitherLocationOrContact",test:(e,{parent:{snmp_contact:a},createError:s})=>!(!e&&!a)||s({message:(0,i.jsx)(c.sA,{id:"DEVICE_VALIDATION_LOCATION_OR_CONTACT_REQUIRED"})})})}),snmp_contact:l.A.string().when("snmpEnabled",{is:!0,then:l.A.string().test({name:"provideEitherLocationOrContact",test:(e,{parent:{snmp_location:a},createError:s})=>!(!e&&!a)||s({message:(0,i.jsx)(c.sA,{id:"DEVICE_VALIDATION_LOCATION_OR_CONTACT_REQUIRED"})})})})},_=(0,t.memo)(({disabled:e,valueOverride:a})=>(0,i.jsxs)(d.A,{children:[(0,i.jsx)(E.A,{children:(0,i.jsx)(o.A,{type:"realCheckbox",name:"snmpEnabled",disabled:e,checked:a,children:(0,i.jsx)(c.sA,{id:"COMMON_SNMP"})})}),(0,n.j7)()?.values?.snmpEnabled?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.A,{label:"COMMON_LOCATION",name:"snmp_location",full:!0,variant:"secondary"}),(0,i.jsx)(o.A,{label:"DEVICE_PROPERTIES_LABEL_SNMP_CONTACT",name:"snmp_contact",full:!0,variant:"secondary"})]}):null]}))},956731(e,a,s){s.d(a,{A:()=>_,R:()=>r});var i=s(274934),t=s(814557),n=s(247816),l=s(669439),d=s(309130),o=s(100978),E=s(721398);const c=(0,n.A)(o.A)`
  flex-direction: column;
  height: ${48}px;
  border-bottom: ${({theme:{themeName:e}})=>t.Ay[`desktop-border-divider-${e}`]};
  padding: ${d.xO} 0;
  position: relative;
  .tooltip-position-fixer {
    margin-right: -${d.Ln};
  }
`,r=({tooltipId:e,disabledTooltip:a,children:s,tooltipProps:t={},...n})=>(0,i.jsx)(c,{...n,children:(0,i.jsxs)(o.A,{justifyContent:"space-between",alignItems:"center",children:[(0,i.jsx)(l.A,{description:a,placement:"left",children:(0,i.jsx)("span",{children:s})}),e?(0,i.jsx)(E.A,{messageId:e,tooltipClassName:"tooltip-position-fixer",variant:"outline",...t}):null]})}),_=r},999837(e,a,s){s.d(a,{A:()=>B});var i=s(274934),t=s(977872),n=s(602086),l=s(696264),d=s(599110),o=s(159469),E=s(706925),c=s(700444),r=s(470070),_=s(222102),A=s(656466),m=s(401042),C=s(358935);var O,I,u=s(857780),T=s(570866);!function(e){e.EXISTING="existing",e.NEW="new"}(O||(O={})),function(e){e.MAC="mac",e.TYPE="type",e.MODEL="model"}(I||(I={}));var N,p=s(990330),R=s(125799),D=s(843615),S=s(853777),M=s(489714),h=s(947414);!function(e){e.DEVICE_REPLACEMENT_MODE="deviceReplacementMode",e.SET_DEVICE_REPLACEMENT_MODE="setDeviceReplacementMode",e.NEW_MAC="newMac",e.SET_NEW_MAC="setNewMac",e.EXISTING_MAC="existingMac",e.SET_EXISTING_MAC="setExistingMac",e.REPLACEMENT_CANDIDATES="replacementCandidates",e.ERROR="error",e.RESET_ERROR="resetError"}(N||(N={}));const x=(0,n.createContext)({[N.DEVICE_REPLACEMENT_MODE]:void 0,[N.SET_DEVICE_REPLACEMENT_MODE]:h.P1,[N.NEW_MAC]:void 0,[N.SET_NEW_MAC]:h.P1,[N.EXISTING_MAC]:void 0,[N.SET_EXISTING_MAC]:h.P1,[N.REPLACEMENT_CANDIDATES]:[],[N.ERROR]:void 0,[N.RESET_ERROR]:h.P1}),v=s(409844).AH`
  height: 54px;
`;var b=s(247816),j=s(309130),g=s(100978);const P=(0,b.A)(g.A)`
  align-items: center;
  gap: ${j.YC};
`,L=(0,n.memo)(()=>{const{newMac:e,setNewMac:a,error:s,resetError:t}=(0,n.useContext)(x),l=(0,n.useCallback)(({target:{value:e}})=>{a((0,M.Z)(e)),t()},[a,t]);return(0,i.jsx)(D.A,{className:v,value:e,onChange:l,onFocus:t,variant:"secondary",label:(0,i.jsxs)(P,{children:[(0,i.jsx)(r.sA,{id:"COMMON_MAC_ADDRESS"}),(0,i.jsx)(R.A,{portal:!0,width:"100%",maxWidth:248,description:(0,i.jsx)(r.sA,{id:"DEVICE_REPLACEMENT_MAC_LOCATION"}),children:(0,i.jsx)(S.A,{isActive:!0})})]}),width:"100%",invalid:s})});var V=s(237887),f=s(974390);const y=(0,n.memo)(()=>{const{replacementCandidates:e,existingMac:a,setExistingMac:s,error:t,resetError:l}=(0,n.useContext)(x),d=(0,n.useMemo)(()=>e.map(({mac:e,model:a,name:s})=>({label:s,value:e,image:(0,i.jsx)(f.A,{model:a}),additionalInfo:e})),[e]),o=(0,n.useCallback)(({value:e})=>{s(String(e)),l()},[s,l]);return(0,i.jsx)(V.A.Sorted,{value:a,label:(0,i.jsx)(r.sA,{id:"COMMON_DEVICE"}),width:"100%",searchable:!0,onChange:o,onFocus:l,maxHeight:228,options:d,invalid:t})}),k=(0,b.A)(g.A)`
  flex-direction: column;
  gap: ${j.kc};
`,w=(0,n.memo)(()=>{const{replacementCandidates:e,deviceReplacementMode:a,setDeviceReplacementMode:s,resetError:t}=(0,n.useContext)(x),l=(0,n.useMemo)(()=>e.length?[{id:O.EXISTING,children:(0,i.jsx)(r.sA,{id:"COMMON_EXISTING"}),onChange:()=>{s(O.EXISTING),t()},checked:a===O.EXISTING},{id:O.NEW,children:(0,i.jsx)(r.sA,{id:"COMMON_NEW"}),onChange:()=>{s(O.NEW),t()},checked:a===O.NEW}]:[],[e.length,a,s,t]);return(0,i.jsxs)(k,{children:[(0,i.jsx)(p.A,{direction:"row",items:l}),a===O.EXISTING?(0,i.jsx)(y,{}):null,a===O.NEW?(0,i.jsx)(L,{}):null]})}),F=(0,b.A)(g.A)`
  align-items: center;
  gap: ${j.YC};
  width: fit-content;
`;var G=s(721398);const U={[u.gQ.INCOMPATIBLE_REPLACEMENT]:"DEVICE_REPLACEMENT_DEVICE_INCOMPATIBLE_REPLACEMENT_ERROR",[u.gQ.REPLACEMENT_ALREADY_ASSIGNED]:"DEVICE_REPLACEMENT_DEVICE_REPLACEMENT_ALREADY_ASSIGNED_ERROR"},W=({mac:e,hideTooltip:a=!1})=>{const{formatMessage:s}=(0,r.tz)(),E=(0,t.wA)(),[I,p]=(0,n.useState)(!1),[R,D]=(0,n.useState)(!1),[S,M]=(0,n.useState)(O.NEW),[h,v]=(0,n.useState)(""),[b,j]=(0,n.useState)(""),[g,P]=(0,n.useState)(void 0),L=(0,t.d4)((0,n.useMemo)(()=>(e=>(0,_.Mz)((e=>(0,A.uh)((0,C.lX)({queryParams:{mac:e}})))(e),e=>(0,m.i6)(e)?.devices||[]))(e),[e])),V=(0,n.useCallback)(()=>{p(!0)},[]),f=(0,n.useCallback)(()=>{p(!1),v(""),j(""),D(!1),M(O.NEW),P(void 0)},[]),y=(0,n.useCallback)(()=>{switch(S){case O.EXISTING:return b;case O.NEW:return h;default:return}},[S,b,h]),k=(0,n.useCallback)(()=>{E((0,c.ox)({icon:o.C.success,message:"DEVICE_REPLACEMENT_DEVICE_SET",duration:3e3})),f()},[E,f]),W=(0,n.useCallback)(e=>{switch(e.apiData?.replacement_state){case u.gQ.INCOMPATIBLE_REPLACEMENT:case u.gQ.REPLACEMENT_ALREADY_ASSIGNED:P(s({id:U[e.apiData.replacement_state]}));break;default:E((0,c.ox)({icon:o.C.danger,message:"DEVICE_FAILED_TO_SET_REPLACEMENT_DEVICE",duration:3e3}))}},[E,s]),B=(0,n.useCallback)(()=>{D(!1)},[]),$=(0,n.useCallback)(()=>{D(!0),E((0,C.uC)(e,y())).then(k).catch(W).finally(B)},[E,k,W,e,y,B]),Y=(0,n.useMemo)(()=>Boolean(y().match(T.b8)),[y]),X=(0,n.useMemo)(()=>[{text:(0,i.jsx)(r.sA,{id:"COMMON_ACTION_CANCEL"}),variant:"tertiary",onClick:f},{text:(0,i.jsx)(r.sA,{id:"COMMON_ACTION_APPLY"}),variant:"primary",onClick:$,disabled:!Y||R,loader:R?"spinner":void 0}],[f,$,Y,R]),z=(0,n.useCallback)(()=>{P(void 0)},[P]),Q=(0,n.useMemo)(()=>({[N.DEVICE_REPLACEMENT_MODE]:S,[N.SET_DEVICE_REPLACEMENT_MODE]:M,[N.NEW_MAC]:h,[N.SET_NEW_MAC]:v,[N.EXISTING_MAC]:b,[N.SET_EXISTING_MAC]:j,[N.REPLACEMENT_CANDIDATES]:L,[N.ERROR]:g,[N.RESET_ERROR]:z}),[S,h,b,L,g,z]);return(0,n.useEffect)(()=>{E((0,C.lX)({queryParams:{mac:e}}))},[E,e]),(0,i.jsx)(x.Provider,{value:Q,children:(0,i.jsx)(l.A,{allowOverflow:!0,title:(0,i.jsx)(r.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"}),body:(0,i.jsx)(w,{}),position:"top",portal:!0,actions:X,isOpen:I,onRequestClose:f,children:(0,i.jsxs)(F,{children:[(0,i.jsx)(d.A,{type:"button",variant:"inline",size:"medium",onClick:V,children:(0,i.jsx)(r.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"})}),a?null:(0,i.jsx)(G.A,{messageId:"DEVICE_SET_REPLACEMENT_DEVICE_DESCRIPTION",variant:"outline"})]})})})},B=(0,n.memo)(({model:e,type:a,...s})=>(0,E.G)({type:a,model:e})?(0,i.jsx)(W,{type:a,model:e,...s}):null)},706925(e,a,s){s.d(a,{G:()=>d});var i=s(956978),t=s(857780);const n=[t.bq.USW,t.bq.UAP,t.bq.USP],l=[t.W4.UDBA69F],d=({type:e,model:a})=>(n.includes(e)||l.includes(a))&&!(0,i.tNJ)({model:a})},489714(e,a,s){s.d(a,{Z:()=>t});var i=s(570866);const t=e=>e?e.replace(i.SD,"").replace(i.fA,"$&:").substring(0,17).toLowerCase():e}}]);