"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[40064,89965],{137625:(e,t,o)=>{o.d(t,{A:()=>d});var n=o(296540),r=o(353899),a=o(132196),i=o(372737),l=o(566723),s=o(699784);const d=({children:e=null,title:t,titleValues:o,message:d,messageValues:m,handleConfirm:c=()=>null,handleClose:_=()=>null,handleCancel:u,isOpen:E,buttonVariant:f="primary",cancelButtonVariant:g="tertiary",cancelButtonMessage:p="COMMON_ACTION_CANCEL",buttonMessage:A="COMMON_ACTION_CONFIRM",buttonDisabled:C=!1,position:h="top",showHeaderClose:N=!1,contentClassName:T="",body:y,titleBody:S,className:b,rootClose:O=!1,footerActions:v})=>{const k=(0,n.useCallback)(e=>{E&&(e.stopPropagation(),e.key===i.U.ENTER?c():e.key===i.U.ESCAPE&&_(!1))},[E,c,_]);(0,n.useEffect)(()=>(window.addEventListener("keydown",k,!0),()=>{window.removeEventListener("keydown",k,!0)}),[k]);const I=(0,n.useCallback)(()=>{_(!1),u?.()},[_,u]),F=(0,n.useCallback)(()=>{_(!1),c()},[_,c]),R=(0,n.useMemo)(()=>[{text:n.createElement(s.sA,{id:p}),variant:g,onClick:I},{text:n.createElement(s.sA,{id:A}),disabled:C,variant:f,onClick:F}],[A,f,p,g,I,F,C]),w=(0,n.useCallback)(()=>{_(!1)},[_]),U=a.AH`
    ${t?"":`margin-top: ${l.xO}`}
  `;return n.createElement(r.A,{title:t?n.createElement(s.sA,{id:t,values:o}):S||null,...d?{body:n.createElement(n.Fragment,null,n.createElement(s.sA,{id:d,values:m}),y)}:{body:y},position:h,portal:!0,actions:v||R,showHeaderClose:N,contentClassName:a.AH`
        ${U}
        ${T}
      `,onRequestClose:w,isOpen:E,allowOverflow:!0,rootClose:O,className:b},e)}},141046:(e,t,o)=>{o.d(t,{A:()=>n});const n=(e,t)=>!!t.current&&e.composedPath().includes(t.current)},252093:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(296540),r=o(271856),a=o(162420),i=o(699784);const l=({messageId:e,tooltipClassName:t,values:o,isInteractive:l,portal:s,variant:d="twoTone",size:m="medium"})=>n.createElement(r.A,{description:n.createElement(i.sA,{id:e,values:o}),width:210,isInteractive:l,portal:s,tooltipClassName:t},n.createElement(a.A,{isActive:!0,omitSvgMargin:!0,variant:d,size:m}))},263130:(e,t,o)=>{o.d(t,{A:()=>m});var n=o(296540),r=o(927099),a=o(71479),i=o(998837),l=o(566723),s=o(294303);const d=(0,a.A)(r.A)`
  line-height: 20px;
`,m=({icon:e,description:t,action:o,footer:r,background:a,...m})=>{const c=(0,i.u)().motifPalette.neutral01;return n.createElement(s.A,{flexGrow:1,borderRadius:l.YC,padding:l.kc,background:a||c,gap:l.kc,flexDirection:"column",...m},n.createElement(s.A,{flexGrow:1,gap:l.kc},e,t?n.createElement(d,{size:"body"},t):null,o?n.createElement(s.A,{marginLeft:"auto"},n.createElement(d,{size:"body"},o)):null),r)}},335928:(e,t,o)=>{o.d(t,{A:()=>a});var n=o(951272),r=o(465543);const a=()=>{const{dirty:e}=(0,n.j7)();return(0,r.w)(e),null}},353899:(e,t,o)=>{o.d(t,{A:()=>u});var n=o(296540);(0,o(349005).A)(".tooltip-container__vRGVdKCu{display:inline-block}.tooltip__vRGVdKCu{border-radius:8px;cursor:default;padding:0}.tooltip__vRGVdKCu .content__vRGVdKCu{padding-bottom:12px;padding-top:8px}.modal-header__vRGVdKCu{font-family:var(--desktop-font-family-default);font-size:var(--desktop-font-size-medium);font-weight:var(--desktop-font-weight-semibold);line-height:20px}");var r=o(722860),a=o(159318),i=o(325898),l=o(141046),s=o(271856),d=o(255905),m=o(136283);const c=(0,r.c)({"tooltip-container":"tooltip-container__vRGVdKCu",tooltip:"tooltip__vRGVdKCu",content:"content__vRGVdKCu","modal-header":"modal-header__vRGVdKCu"}),_=100*a.Uq["desktop-sizing-base"],u=e=>{const{children:t,position:o,portal:r,offset:a,autoPosition:u,tooltipClassName:E,width:f=_,title:g,headerClassName:p,contentClassName:A,footerClassName:C,body:h,actions:N=[],allowOverflow:T,onRequestClose:y,showHeaderClose:S=!0,motif:b,rootClose:O=!0,isOpen:v,className:k,style:I,...F}=e,R=(0,n.useRef)(null),w=(0,n.useRef)(null),[U,x]=(0,n.useState)(!1),{motif:M}=(0,i.A)(b),P="boolean"==typeof v,G=N.map(({onClick:e,...t})=>({...t,onClick:t=>e&&e(t,x)})),L={padding:0,margin:0,...I},X=(0,n.useCallback)(e=>y?y(e,x):x(!1),[y,x]);return(0,n.useEffect)(()=>{const e=e=>{!(0,l.A)(e,w)&&O&&X(e)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[P,X,O]),n.createElement(s.A,{ref:w,isOpen:P?v:U,className:c.concat(k)("tooltip-container"),tooltipClassName:c.concat(E)("tooltip"),maxWidth:_,width:f,onClick:e=>{P||(e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),x(!0))},position:o,portal:r,offset:a,motif:M,autoPosition:u,isInteractive:!0,description:n.createElement("div",{ref:R,onClick:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()},style:L},n.createElement(d.A.Provider,{value:{motif:"dark"}},n.createElement(m.A,{title:g,headerClassName:c.concat(p)("modal-header"),contentClassName:c.concat(A)("content"),footerClassName:C,actions:G,allowOverflow:T,onRequestClose:S?X:void 0},h))),...F},t)}},360965:(e,t,o)=>{o.d(t,{o:()=>r});var n=o(589681);const r=[n.o.HOTSPOT,n.o.INTERNAL]},372737:(e,t,o)=>{var n;o.d(t,{U:()=>n}),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.ESCAPE="Escape"}(n||(n={}))},391855:(e,t,o)=>{o.d(t,{A:()=>m});var n=o(296540),r=o(271856),a=o(858931),i=o(823858),l=o(71479),s=o(699784);const d=(0,l.A)(i.A)`
  color: #ffffff;
`,m=(0,n.memo)(({isDisabled:e,showLoader:t,showWarning:o,showWarningIcon:i,warning:l,label:m="COMMON_ACTION_APPLY_CHANGES",onSubmit:c,form:_})=>n.createElement(r.A,{description:o?l??n.createElement(s.sA,{id:"COMMON_FORM_CHANGES_TRIGGER_PROVISION"}):null,portal:!0,width:240},n.createElement(a.A,{disabled:e,type:"submit",onClick:c,variant:"primary",Icon:o||i?n.createElement(d,{variant:"fill"}):null,loader:t?"loading":void 0,form:_},n.createElement(s.sA,{id:m}))))},465543:(e,t,o)=>{o.d(t,{w:()=>i});var n=o(469733),r=o(296540),a=o(845030);const i=e=>{const t=(0,n.useDispatch)();(0,r.useEffect)(()=>{t((0,a.SQ)(e))},[t,e])}},499906:(e,t,o)=>{o.d(t,{W:()=>s});var n=o(801081),r=o(25553),a=o(87485),i=o(160044);const l=(0,r.uh)((0,i.g)()),s=(0,n.Mz)(l,a.kh)},689965:(e,t,o)=>{o.d(t,{A:()=>u,I:()=>n});var n,r=o(296540),a=o(822336),i=o(427853),l=o(71479),s=o(825032),d=o(566723),m=o(294303);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(n||(n={}));const c=(0,l.A)(m.A,{shouldForwardProp:e=>!["marginBottom","isButtonList","margin","flex","width","padding","nested","background"].includes(e)})`
  background-color: ${({background:e,nested:t,theme:{themeName:o}})=>e||a.Ay[o===s.S.DARK?`desktop-color-neutral-${t?"00":"01"}-dark`:`desktop-color-neutral-${t?"01":"00"}-light`]};
  padding: ${({theme:e,isButtonList:t,padding:o})=>o||(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}})=>a.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,_=(0,l.A)(i.A,{shouldForwardProp:e=>!["marginBottom","margin","flex","padding","nested","background"].includes(e)})`
  background-color: ${({background:e,nested:t,theme:{themeName:o}})=>e||a.Ay[o===s.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||a.Ay[t===s.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 ${d.Ln} ${d.Ln};
      > div {
        padding: 0;
      }
    }
  }
`,u=({type:e,marginBottom:t,margin:o,padding:a,flex:i,width:l,nested:s,...d})=>"items"in d?r.createElement(_,{marginBottom:t,margin:o,padding:a,flex:i,nested:s,...d}):r.createElement(c,{nested:s,width:l,marginBottom:t,margin:o,padding:a,flex:i,isButtonList:e===n.BUTTON_LIST,...d},d.children)},794372:(e,t,o)=>{o.d(t,{A:()=>r});var n=o(349005),r={formFooter:"formFooter__8cy4UfEX","formFooter-light":"formFooter-light__8cy4UfEX","formFooter-bordered":"formFooter-bordered__8cy4UfEX","formFooter-dark":"formFooter-dark__8cy4UfEX",formFooterContent:"formFooterContent__8cy4UfEX","formFooterContent-light":"formFooterContent-light__8cy4UfEX",backgroundGradient:"backgroundGradient__8cy4UfEX","formFooterContent-dark":"formFooterContent-dark__8cy4UfEX","formFooterContent-align-left":"formFooterContent-align-left__8cy4UfEX","formFooterContent-align-center":"formFooterContent-align-center__8cy4UfEX","formFooterContent-align-right":"formFooterContent-align-right__8cy4UfEX","formFooterContent-align-space-between":"formFooterContent-align-space-between__8cy4UfEX",formFooterWithTransform:"formFooterWithTransform__8cy4UfEX",formFooterButtonWrap:"formFooterButtonWrap__8cy4UfEX",formFooterTertiaryButtonWrap:"formFooterTertiaryButtonWrap__8cy4UfEX","formFooterButton-default-size-small":"formFooterButton-default-size-small__8cy4UfEX","formFooterButton-default-size-medium":"formFooterButton-default-size-medium__8cy4UfEX","formFooterButton-default-size-large":"formFooterButton-default-size-large__8cy4UfEX",formFooterSummary:"formFooterSummary__8cy4UfEX",formFooterSummaryTitle:"formFooterSummaryTitle__8cy4UfEX",formFooterSummaryParagraph:"formFooterSummaryParagraph__8cy4UfEX"};(0,n.A)(".formFooter__8cy4UfEX{flex:none;overflow:hidden;position:relative;width:100%}.formFooter-light__8cy4UfEX.formFooter-bordered__8cy4UfEX{border-top:1px solid rgba(33,35,39,.07)}.formFooter-dark__8cy4UfEX.formFooter-bordered__8cy4UfEX{border-top:1px solid hsla(214,8%,98%,.07)}.formFooterContent__8cy4UfEX{align-items:flex-start;display:flex;width:100%}.formFooterContent-light__8cy4UfEX.backgroundGradient__8cy4UfEX{background:linear-gradient(90deg,#fff 0,#f4f5f6)}.formFooterContent-dark__8cy4UfEX.backgroundGradient__8cy4UfEX{background:linear-gradient(90deg,#131416 0,#282b2f)}.formFooterContent-align-left__8cy4UfEX{justify-content:flex-start}.formFooterContent-align-center__8cy4UfEX{justify-content:center}.formFooterContent-align-right__8cy4UfEX{justify-content:flex-end}.formFooterContent-align-space-between__8cy4UfEX{justify-content:space-between}.formFooterWithTransform__8cy4UfEX{transition:height .1s ease,transform .1s ease}.formFooterWithTransform__8cy4UfEX .formFooterContent__8cy4UfEX{position:absolute}.formFooterButtonWrap__8cy4UfEX{flex:0 1 100px}.formFooterButtonWrap__8cy4UfEX:not(:last-child){margin-right:16px}.formFooterTertiaryButtonWrap__8cy4UfEX:not(:last-child){margin-right:28px}button.formFooterButton-default-size-small__8cy4UfEX{height:30px}button.formFooterButton-default-size-medium__8cy4UfEX{height:34px}button.formFooterButton-default-size-large__8cy4UfEX{height:50px}.formFooterSummary__8cy4UfEX{flex:1}.formFooterSummary__8cy4UfEX:not(:last-child){margin-right:16px}.formFooterSummaryTitle__8cy4UfEX{margin-bottom:8px;margin-top:0}.formFooterSummaryParagraph__8cy4UfEX{margin-bottom:0;margin-top:0}")},813040:(e,t,o)=>{o.d(t,{A:()=>_,R:()=>c});var n=o(296540),r=o(822336),a=o(718073),i=o(71479),l=o(566723),s=o(294303),d=o(252093);const m=(0,i.A)(s.A)`
  flex-direction: column;
  height: ${48}px;
  border-bottom: ${({theme:{themeName:e}})=>r.Ay[`desktop-border-divider-${e}`]};
  padding: ${l.xO} 0;
  position: relative;
  .tooltip-position-fixer {
    margin-right: -${l.Ln};
  }
`,c=({tooltipId:e,disabledTooltip:t,children:o,tooltipProps:r={},...i})=>n.createElement(m,{...i},n.createElement(s.A,{justifyContent:"space-between",alignItems:"center"},n.createElement(a.A,{description:t,placement:"left"},n.createElement("span",null,o)),e?n.createElement(d.A,{messageId:e,tooltipClassName:"tooltip-position-fixer",variant:"outline",...r}):null)),_=c},823084:(e,t,o)=>{o.d(t,{A:()=>l});var n=o(296540),r=o(162420),a=o(998837),i=o(263130);const l=({children:e,icon:t,background:o,...l})=>{const{motifPalette:{uBlue06:s}}=(0,a.u)();return n.createElement(i.A,{icon:t||n.createElement(r.A,{variant:"fill",size:"original",color:s}),description:e,background:o,...l})}},858931:(e,t,o)=>{o.d(t,{A:()=>d});var n=o(296540),r=o(933095),a=o(794372),i=o(722860),l=o(758649);const s=(0,i.c)(a.A),d=({size:e="medium",variant:t,wrapClassName:o,className:a,...i})=>n.createElement(l.A,{className:s.concat(a)(t===r.HI[0]&&`formFooterButton-default-size-${e}`),size:e,wrapClassName:s.concat(o)("tertiary"===t?"formFooterTertiaryButtonWrap":"formFooterButtonWrap"),variant:t,...i})},894145:(e,t,o)=>{var n,r;o.d(t,{g:()=>r,r:()=>n}),function(e){e.NETWORK="NETWORK",e.DEVICE="DEVICE"}(n||(n={})),function(e){e.APP_ID="APP_ID",e.APP_CATEGORY="APP_CATEGORY"}(r||(r={}))},940064:(e,t,o)=>{o.r(t),o.d(t,{default:()=>Y});var n=o(469733),r=o(296540),a=o(951272),i=o(742920),l=o(335928),s=o(398300),d=o(845030),m=o(675359),c=o(160044),_=o(707362),u=o(414783),E=o(959341),f=o(870443);const g=f.A.object().shape({name:f.A.string().label("SETTINGS_SECURITY_ZONE_NAME").max(32).required(),network_ids:f.A.array().of(f.A.string()).label("SETTINGS_SECURITY_NETWORKS_INTERFACES")});var p=o(758649),A=o(566723),C=o(823084),h=o(294303),N=o(689965),T=o(699784),y=o(602021),S=o(813040),b=o(217439),O=o(137625),v=o(391855),k=o(894145),I=o(499906),F=o(360965),R=o(366188),w=o(714610),U=o(181694),x=o(319797);const M=({isDisabled:e,isLoading:t,values:o,submitForm:a,existingRecord:i})=>{const l=(0,n.useSelector)(x.HC),s=(0,n.useSelector)(w.Cw),d=(0,n.useSelector)(R.Ct),m=(0,n.useSelector)(I.W),c=!!i?._id,_=(0,r.useMemo)(()=>{const e=c?s.filter(e=>e._id!==i?._id):s;return d.flatMap(t=>{if(!o.network_ids.includes(t._id))return[];const n=e.find(e=>e.network_ids.includes(t._id));return n?[{network:t,fromFirewallZone:n}]:[]})},[s,c,d,i?._id,o.network_ids]),u=(0,r.useMemo)(()=>_.length?l.filter(({source:e,destination:t})=>_.some(({fromFirewallZone:o,network:n})=>(0,U.Ix)(n._id,o._id,e)||(0,U.Ix)(n._id,o._id,t))):[],[l,_]),E=(0,r.useMemo)(()=>!F.o.includes(i?.zone_key)&&m.some(({network_ids:e,type:t})=>t===k.r.NETWORK&&_.some(({network:{_id:t}})=>e?.includes(t))),[i?.zone_key,_,m]),f=!!_.length||!!u.length||E,[g,p]=(0,r.useState)(!1);return r.createElement(O.A,{isOpen:g,handleClose:()=>p(!1),handleConfirm:()=>{a(),p(!1)},rootClose:!0,buttonVariant:"danger",buttonMessage:"COMMON_ACTION_PROCEED",title:"SETTINGS_SECURITY_MOVE_NETWORK_TO_ZONE_TITLE",titleValues:{count:_.length},body:r.createElement(b.A,{variant:"inherit"},[r.createElement(T.sA,{id:"SETTINGS_SECURITY_MOVE_NETWORK_TO_ZONE_MESSAGE"}),E?r.createElement(T.sA,{id:"SETTINGS_SECURITY_MOVE_NETWORK_TO_ZONE_MESSAGE_SIMPLE_APP_BLOCK_WARNING",values:{count:_.length}}):null,1===u.length?r.createElement(T.sA,{id:"SETTINGS_SECURITY_MOVE_NETWORK_TO_ZONE_MESSAGE_PAUSE_SINGLE",values:{policyName:u[0]?.name}}):u.length>1?r.createElement(T.sA,{id:"SETTINGS_SECURITY_MOVE_NETWORK_TO_ZONE_MESSAGE_PAUSE_MULTIPLE",values:{count:u.length}}):null].filter(Boolean).map(e=>r.createElement(r.Fragment,null,e," ")))},r.createElement(v.A,{showWarningIcon:f,onSubmit:f?e=>{e.preventDefault(),e.stopPropagation(),p(!0)}:void 0,isDisabled:e,showLoader:t,label:c?"COMMON_ACTION_APPLY_CHANGES":"SETTINGS_COMMON_ADD_ENTRY"}))};var P=o(143811),G=o(589681),L=o(209909),X=o(317672);const B=[G.o.HOTSPOT,G.o.DMZ],W=({disabled:e,existingRecord:t})=>{const{formatMessage:o}=(0,T.tz)(),i=(0,n.useSelector)(w.Av),l=(0,n.useSelector)(w.xs),{initialValues:s}=(0,a.j7)(),d=(0,r.useMemo)(()=>i.filter(({purpose:e,isDefaultNetwork:o})=>L.x[t?.zone_key||G.o.INTERNAL].includes(e)&&(!B.includes(t?.zone_key)||!o)).map(e=>{const n=((e,t,o,n)=>o===G.o.HOTSPOT&&e.network_isolation_enabled&&!n?.includes(e._id)?r.createElement(T.sA,{id:"SETTINGS_NETWORKS_HOTSPOT_ZONE_DISABLED_ISOLATE_NETWORK"}):t.some(({zone_key:t,network_ids:r})=>t===o&&r?.includes(e._id)&&n?.includes(e._id))?r.createElement(T.sA,{id:"SETTINGS_SECURITY_ZONE_NETWORK_CANNOT_BE_REMOVED"}):void 0)(e,l,t?.zone_key,s.network_ids);return{label:e.name,value:e._id,additionalInfo:e.ip||o({id:"COMMON_FALLBACK"}),disabled:!!n,tooltipDescription:n,tooltipPortal:!0,tooltipPosition:"left"}}),[i,t?.zone_key,l,s.network_ids,o]);return r.createElement(P.A,{type:"picklist",options:d,name:"network_ids",triggerButtonText:"COMMON_SELECT",label:r.createElement(X.A,{tooltip:r.createElement(T.sA,{id:"SETTINGS_SECURITY_NETWORKS_INTERFACES_DESCRIPTION"})},r.createElement(T.sA,{id:"SETTINGS_SECURITY_NETWORKS_INTERFACES"})),isFullWidth:!0,truncateLabels:!0,disabled:e})};var z=o(902146);const $=({disabled:e,existingRecord:t})=>{const{formatMessage:o}=(0,T.tz)();return t?.default_zone&&t?.zone_key?r.createElement(P.A,{name:"name",variant:"secondary",disabled:!0,label:r.createElement(T.sA,{id:"SETTINGS_SECURITY_ZONE_NAME"}),value:o({id:z.F[t.zone_key]})}):r.createElement(P.A,{name:"name",variant:"secondary",disabled:e||t?.default_zone,label:r.createElement(T.sA,{id:"SETTINGS_SECURITY_ZONE_NAME"})})};var D=o(734707);const V=({name:e,id:t})=>{const o=(0,n.useDispatch)(),[a,i]=(0,r.useState)(!1);return r.createElement(O.A,{isOpen:a,title:"SETTINGS_SECURITY_REMOVE_ZONE_TITLE",titleValues:{count:1},buttonMessage:"COMMON_ACTION_PROCEED",buttonVariant:"danger",body:r.createElement(T.sA,{id:"SETTINGS_SECURITY_REMOVE_ZONE_SINGLE_MESSAGE",values:{name:e}}),handleCancel:()=>i(!1),handleConfirm:async()=>{await o((0,_.Yx)(t)),o((0,_.MI)()),o((0,_.WO)()),o((0,u.fn)()),i(!1),o((0,d.K5)())},handleClose:()=>i(!1),rootClose:!0},r.createElement(D.Ay,{type:"button",variant:"link",size:"medium",onClick:()=>i(!0)},r.createElement(b.A,{variant:"inherit",color:"destructive"},r.createElement(T.sA,{id:"COMMON_ACTION_REMOVE"}))))},K=({existingRecord:e})=>{const{resetForm:t,handleSubmit:o,dirty:i,isSubmitting:l,submitForm:s,values:d}=(0,a.j7)(),m=(0,n.useSelector)(y.EL);return r.createElement("form",{onSubmit:o,style:{height:"100%"}},r.createElement(h.A,{flexDirection:"column",gap:A.Ln,width:"100%",minHeight:"100%"},r.createElement(N.A,{padding:"0",marginBottom:"0"},r.createElement(C.A,{background:void 0},r.createElement(T.sA,{id:"SETTINGS_SECURITY_ZONE_INFO"}))),r.createElement(N.A,{marginBottom:"0"},r.createElement(h.A,{flexDirection:"column",gap:A.Ln,width:"100%"},r.createElement($,{disabled:m,existingRecord:e}),r.createElement(W,{disabled:m,existingRecord:e}))),m||!e||e.attr_no_edit||e.default_zone?null:r.createElement(N.A,{type:N.I.BUTTON_LIST},r.createElement(S.R,null,r.createElement(V,{name:e.name,id:e._id}))),i?r.createElement(h.A,{flex:1,justifyContent:"flex-end",alignItems:"flex-end",paddingBottom:A.S2},r.createElement(p.A,{type:"button",variant:"tertiary",onClick:()=>t()},r.createElement(T.sA,{id:"COMMON_ACTION_CANCEL"})),r.createElement(M,{isDisabled:m,existingRecord:e,isLoading:l,submitForm:s,values:d},r.createElement(T.sA,{id:"COMMON_ACTION_APPLY_CHANGES"}))):null))},Y=({activeItem:e})=>{const t=(0,n.useDispatch)(),o=e?._id===E.R6?void 0:e,f=(0,r.useMemo)(()=>({name:o?.name||"",network_ids:o?.network_ids||[]}),[o?.name,o?.network_ids]),p=(0,r.useCallback)((e,{setSubmitting:n})=>(n(!0),t((0,_.jU)({_id:o?._id,name:e.name,network_ids:e.network_ids},void 0,{payloadTransform:e=>({...o,...e})})).then(e=>(t((0,_.MI)()),t((0,_.WO)()),t((0,c.g)()),t((0,u.fn)()),e)).then(({_id:e})=>{t((0,d.SQ)(!1)),t((0,d.XP)({type:s.H.FIREWALL_ZONE_FORM,id:e}))}).catch(()=>t((0,m.ox)({icon:i.C.danger,message:"SETTINGS_UNABLE_TO_APPLY_CHANGES"}))).finally(()=>n(!1))),[t,o]);return r.createElement(a.l1,{initialValues:f,onSubmit:p,enableReinitialize:!0,validationSchema:g},r.createElement(r.Fragment,null,r.createElement(l.A,null),r.createElement(K,{existingRecord:o})))}}}]);