"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[65118],{323572:(e,t,a)=>{a.d(t,{TG:()=>o,Ve:()=>c,Yl:()=>C,x_:()=>_,zK:()=>I,us:()=>u,jk:()=>T,p5:()=>A,RZ:()=>s,rA:()=>d,gM:()=>N,NA:()=>m,_F:()=>S});var l=a(691189),n=a(736318),i=a(294201),r=a(87485);const E="/api/s/{site}/cmd/sitemgr",s=(e={},t={})=>(0,l.t9)("autoIpsec","/v2/api/vpn/auto/sites",e,{idField:"id",...t}),c=e=>(0,l.Xj)(i.A.ADD_SITE_VPN,E,e),m=e=>(0,l.Xj)(i.A.REBUILD_SITE_VPN,E,e),o=e=>(0,l.Xj)(i.A.ADD_SITE,E,{desc:e}),d=e=>(0,l.Xj)(i.A.IMPORT_SITE,n.g1,{site_desc:e.newSiteName,backup_id:e.importedSiteId}),A=()=>(0,l.Xj)(i.A.EXPORT_SITE,n.g1),_=e=>(0,l.Xj)(i.A.DELETE_SITE,E,{site:e}),I=(e,t={})=>(0,l.Xj)(i.A.DELETE_SITE_VPN,E,{site:e.remote_site_id,name:e.name},t),T=(e,t={})=>(0,l.Xj)(i.A.ENABLE_SITE_VPN,E,{site:e.site,name:e.name},t),u=(e,t={})=>(0,l.Xj)(i.A.DISABLE_SITE_VPN,E,{site:e.site,name:e.name},t),S=e=>(0,l.Xj)(i.A.UPDATE_SITE,E,{desc:e}),C=(e,t={})=>(0,l.Xj)(i.A.DELETE_DEVICE,E,{macs:[].concat(e)},{...(0,r.rk)("COMMON_COMMAND_DELETE_DEVICE_TOAST_ERROR",{count:[].concat(e).length}),...t}),N=(e,t,a={})=>(0,l.Xj)(i.A.MOVE_DEVICE,E,{mac:e,site:t},a)},332918:(e,t,a)=>{a.d(t,{A:()=>i});var l=a(296540),n=a(629318);const i=(0,a(51946).w)(e=>(0,l.createElement)("svg",(0,n.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,l.createElement)("path",{d:"M16 5H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1Z",fill:"currentColor",className:e.twotonedclassname}),(0,l.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m10.367 13.887 2.12-2.121a.5.5 0 1 0-.706-.708l-1.267 1.268V3.5a.5.5 0 0 0-1 0v8.827l-1.268-1.269a.5.5 0 0 0-.707.708l2.12 2.121a.502.502 0 0 0 .708 0ZM17 6a1 1 0 0 0-1-1h-3v1h3v10H4V6h3V5H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6Z",fill:"currentColor",className:e.baseclassname}),(0,l.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.038 3a.75.75 0 0 1 .75.75v7.683l.479-.479a.747.747 0 0 1 1.06 0 .75.75 0 0 1 0 1.061l-1.767 1.768a.737.737 0 0 1-.53.22L9.958 14a.737.737 0 0 1-.47-.217L7.72 12.015a.752.752 0 0 1-.001-1.061.751.751 0 0 1 1.062 0l.507.507V3.75a.75.75 0 0 1 .75-.75ZM17 6.004a1 1 0 0 0-1-1h-3v1.5h2.5v9h-11v-9H7v-1.5H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-10Z",fill:"currentColor",className:e.fillclassname})))},542737:(e,t,a)=>{a.r(t),a.d(t,{default:()=>_e});var l=a(469733),n=a(296540),i=a(951272),r=a(585702),E=a(727270),s=a(927099),c=a(6510),m=a(870443),o=a(566723),d=a(294303),A=a(6176),_=a(699784),I=a(559478),T=a(602197),u=a(243938),S=a(546391);const C=[{id:"status",label:null,renderCell:({status:e,statusPulse:t})=>n.createElement(I.A,{status:e,pulsating:t,marginLeft:o.YC,marginRight:o.xO}),growthFactor:1,minWidth:30},{id:"name",label:n.createElement(_.sA,{id:"COMMON_NAME"}),renderCell:({name:e,model:t})=>n.createElement(d.A,{width:"100%"},n.createElement(A.A,{model:t,width:"18px",height:"18px"}),n.createElement(s.A,{size:"body",truncate:!0,color:"inherit",style:{marginLeft:12}},e)),minWidth:60},{id:"state",label:n.createElement(_.sA,{id:"COMMON_STATUS"}),renderCell:({state:e})=>{let t="warning";return t=e===T.g.CONNECTED?"success":e===T.g.DISCONNECTED?"secondary":"warning",n.createElement(s.A,{color:t,size:"body"},n.createElement(_.sA,{id:u.A[e]}))},minWidth:50},{id:"model",label:n.createElement(_.sA,{id:"COMMON_MODEL"}),renderCell:({model:e})=>n.createElement(s.A,{truncate:!0,color:"inherit",size:"body"},(0,c.Lm)(e)),minWidth:60},{id:"fw_version",label:n.createElement(_.sA,{id:"COMMON_VERSION"}),renderCell:({fw_version:e})=>n.createElement(s.A,{truncate:!0,color:"inherit",size:"body"},e?.length>0?e:n.createElement(_.sA,{id:"COMMON_FALLBACK"})),minWidth:60}],N=m.A.object().shape({inform_ip:m.A.string().label("COMMON_LABEL_HOSTNAME_IP").matches(S.vz,{message:n.createElement(_.sA,{id:"COMMON_VALIDATION_VALID_IP"})}).required(),inform_port:m.A.number().label("COMMON_PORT").required()});var O,M=a(71479),h=a(126457),R=a(532419);!function(e){e.EXPORT_SITE="export-site",e.MIGRATE_SITE="migrate-site",e.MIGRATE_DEVICES="migrate-devices"}(O||(O={}));const p="http://",g=":",b="/inform",v={inform_ip:"",inform_port:8080,macs:[]};var f=a(963070),G=a(162420),D=a(596441),V=a(822336);const L=(0,M.A)(d.A)`
  width: 100%;
  padding: 14px 16px;
  background: ${({theme:{motifPalette:{neutral02:e}}})=>e};
  border-radius: ${V.Ay["desktop-radius-base"]};

  > svg {
    margin-right: 12px !important;
  }
`,P=({children:e})=>n.createElement(L,null,e),x=(0,M.A)("div")`
  margin: 32px 0 20px;
`,y=({removeTableItems:e})=>n.createElement(d.A,{flexDirection:"column"},n.createElement(x,null,n.createElement(f.A,{idField:"mac",columns:C,items:e,headerHeight:32,rowHeight:D.I.ROW_HEIGHT,disableColumnFilters:!0,truncateHeaderCells:!0})),n.createElement(P,null,n.createElement(G.A,{size:"original",isActive:!0,variant:"fill"}),n.createElement(s.A,{size:"body"},n.createElement(_.sA,{id:"SETTINGS_SITE_CONFIGURATION_REMOVE_MIGRATED_DEVICES",values:{b:_.b,br:_.br}}))));var w=a(758649),U=a(742920),F=a(675359),z=a(83344),k=a(323572),j=a(171073),X=a(705426);const H=({handleRemoveModalClose:e,handleExportModalClose:t})=>{const{values:a}=(0,i.j7)(),r=(0,l.useDispatch)(),E=(0,n.useCallback)(()=>{r((0,k.Yl)(a.macs)).then(()=>{a.macs.forEach(e=>{r((0,z.W)(e)),r((0,j.XL)(e))}),e(),t()}).catch(()=>{r((0,F.ox)({icon:U.C.danger,message:"API_ERROR_DEVICE_REMOVE"}))})},[r,t,e,a.macs]);return n.createElement(X.A,{title:n.createElement(_.sA,{id:"DEVICE_ACTIONS_REMOVE_LABEL_PLURAL"}),onRequestClose:e,actions:[{type:"button",text:n.createElement(_.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:e},{type:"button",text:n.createElement(_.sA,{id:"COMMON_ACTION_REMOVE"}),onClick:E,variant:"danger"}],size:"small"},n.createElement(s.A,{size:"body",color:"secondary"},n.createElement(_.sA,{id:"DEVICE_ACTIONS_REMOVE_CONFIRM_MESSAGE_PLURAL"})))},$=(0,M.A)("footer")`
  padding: ${o.S2} ${o.fS};
`,B=(0,M.A)("div")`
  margin-left: ${o.Ln};
`,W=({handleCancel:e,hasMigrationStarted:t,isMigrateActionEnabled:a})=>{const{handleSubmit:l}=(0,i.j7)(),[r,E]=(0,n.useState)();return n.createElement(n.Fragment,null,n.createElement($,null,n.createElement(d.A,{alignItems:"center",justifyContent:"flex-end"},n.createElement(w.A,{type:"button",size:"medium",onClick:e},n.createElement(_.sA,{id:"COMMON_ACTION_SKIP"})),n.createElement(B,null,n.createElement(w.A,{type:"button",variant:t?"danger":"primary",onClick:t?()=>{E(!0)}:()=>{l()},disabled:!t&&!a},n.createElement(_.sA,{id:t?"DEVICE_ACTIONS_REMOVE_LABEL_PLURAL":"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES"}))))),r?n.createElement(H,{handleRemoveModalClose:()=>E(!1),handleExportModalClose:e}):null)},Z=(0,M.A)("div")`
  margin-left: 16px;
`,Y=(0,M.A)("footer")`
  padding: 24px 32px;
`,q=({handleNextStep:e,handleCancel:t})=>n.createElement(Y,null,n.createElement(d.A,{alignItems:"center",justifyContent:"flex-end"},n.createElement(w.A,{type:"button",size:"medium",onClick:t},n.createElement(_.sA,{id:"COMMON_ACTION_CANCEL"})),n.createElement(Z,null,n.createElement(w.A,{type:"button",size:"medium",variant:"primary",onClick:e},n.createElement(_.sA,{id:"COMMON_ACTION_CONTINUE"}))))),K=(0,M.A)(s.A)`
  margin: 32px 0 20px;
`;const J=function(){return n.createElement(d.A,null,n.createElement(K,{size:"body"},n.createElement(_.sA,{id:"SETTINGS_SITE_CONFIGURATION_MIGRATE_SITE_INSTRUCTION"})))};var Q=a(143811);const ee=(0,M.A)("div")`
  margin: ${o.fS} 0 ${o.Er};
`,te=(0,M.A)(s.A)`
  margin: ${o.fS} 0 ${o.Er};
`,ae=(0,M.A)(s.A)`
  margin: 0 ${o.kc};
`,le=(0,M.A)("div")`
  width: 50%;
`,ne=[],ie=({migrateTableItems:e})=>{const{setFieldValue:t}=(0,i.j7)();return n.createElement(d.A,{flexDirection:"column"},n.createElement(te,{size:"body"},n.createElement(_.sA,{id:"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES_INSTRUCTION"})),n.createElement(d.A,{alignItems:"baseline"},n.createElement(ae,{size:"body",color:"tertiary"},p),n.createElement(Q.A,{name:"inform_ip",variant:"secondary",label:"COMMON_LABEL_HOSTNAME_IP",helperMessage:"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES_INPUT_HELPER",full:!0}),n.createElement(ae,{size:"body",color:"tertiary"},g),n.createElement(le,null,n.createElement(Q.A,{name:"inform_port",variant:"secondary",label:"COMMON_PORT",full:!0})),n.createElement(ae,{size:"body",color:"tertiary"},b)),n.createElement(ee,null,e.length>0?n.createElement(f.A,{idField:"mac",columns:C,items:e,initialSelectedIds:ne,onChangeSelection:e=>{t("macs",e)},headerHeight:32,rowHeight:D.I.ROW_HEIGHT,multiSelectMode:!0,truncateHeaderCells:!0,disableColumnFilters:!0}):n.createElement(P,null,n.createElement(G.A,{size:"original",isActive:!0,variant:"fill"}),n.createElement(s.A,{size:"body"},n.createElement(_.sA,{id:"SETTINGS_SITE_CONFIGURATION_MIGRATE_NO_DEVICES"})))))};var re=a(300477),Ee=a(332918),se=a(602021),ce=a(441652);const me=(0,M.A)(s.A)`
  margin: 32px 0 20px;
`,oe=()=>{const{formatMessage:e}=(0,_.tz)(),t=(0,l.useDispatch)(),a=(0,l.useSelector)(se.Gd),[i,r]=(0,n.useState)(!1),E=a?.desc||"",s=(0,n.useCallback)(()=>{r(!0);const a=(0,re.A)();t((0,F.ox)({id:a,downloads:[{id:`file-${a}`,filename:e({id:"SETTINGS_SYSTEM_MAINTENANCE_SUPPORT_INFORMATION_PREPARING"}),status:e({id:"SETTINGS_SYSTEM_MAINTENANCE_SUPPORT_INFORMATION_FETCHING"}),progress:0,onCancel:()=>{t((0,F.uU)(a)),r(!1)}}],duration:0,notificationType:"DownloadsToast"})),t((0,k.p5)()).then(({data:e})=>{t((0,ce.LV)(e?.[0]?.url,a,()=>r(!1)))}).catch(()=>{r(!1),(0,F.uU)(a),t((0,F.ox)({icon:U.C.danger,message:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE_ERROR",values:{siteName:E}}))})},[E,t,e]);return n.createElement(d.A,{flexDirection:"column"},n.createElement(me,{size:"body"},n.createElement(_.sA,{id:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE_INSTRUCTION"})),n.createElement(d.A,null,n.createElement(w.A,{name:"download-current-site",type:"button",variant:"inline",size:"medium",Icon:Ee.A,iconProps:{size:"original",isActive:!i},onClick:s,disabled:i},n.createElement(_.sA,{id:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE_DOWNLOAD_BUTTON"}))))},de=(0,M.A)(X.A)`
  width: 600px !important;
`,Ae=({hasMigrationStarted:e})=>{const t=(0,l.useDispatch)(),{values:{inform_ip:a,inform_port:r,macs:E}}=(0,i.j7)(),[s,c]=(0,n.useState)(O.EXPORT_SITE),m=(0,l.useSelector)((0,n.useMemo)(()=>(0,R.lj)(e),[e])),o=(0,n.useMemo)(()=>m.filter(({mac:e})=>E.includes(e)),[m,E]),d=a&&r&&E.length>0,A=(0,n.useCallback)(()=>{t((0,h.AS)())},[t]),I=(0,n.useCallback)(()=>{switch(s){case O.MIGRATE_DEVICES:return{modalTitle:"SETTINGS_SITE_CONFIGURATION_MIGRATE_DEVICES",modalFooter:n.createElement(W,{handleCancel:A,hasMigrationStarted:e,isMigrateActionEnabled:d}),modalViewContent:e?n.createElement(y,{removeTableItems:o}):n.createElement(ie,{migrateTableItems:m})};case O.MIGRATE_SITE:return{modalTitle:"SETTINGS_SITE_CONFIGURATION_MIGRATE_SITE",modalFooter:n.createElement(q,{handleNextStep:()=>{c(O.MIGRATE_DEVICES)},handleCancel:A}),modalViewContent:n.createElement(J,null)};case O.EXPORT_SITE:default:return{modalTitle:"SETTINGS_SITE_CONFIGURATION_EXPORT_SITE",modalFooter:n.createElement(q,{handleNextStep:()=>{c(O.MIGRATE_SITE)},handleCancel:A}),modalViewContent:n.createElement(oe,null)}}},[A,e,d,m,s,o]),{modalTitle:T,modalFooter:u,modalViewContent:S}=I();return n.createElement(de,{title:n.createElement(_.sA,{id:T}),footer:u,size:"medium"},S)},_e=()=>{const e=(0,l.useDispatch)(),[t,a]=(0,n.useState)(!1),s=(0,n.useCallback)(t=>{const l={deviceMacs:t.macs,informUrl:`${E.DU}${t.inform_ip}:${t.inform_port}/inform`};a(!0),e((0,r.du)(l)).catch(()=>{a(!1)})},[e]);return n.createElement(i.l1,{initialValues:v,onSubmit:s,validationSchema:N},n.createElement(Ae,{hasMigrationStarted:t}))}}}]);