"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[4807],{430329:(e,t,n)=>{n.d(t,{DP:()=>o,XD:()=>a,kY:()=>s,mH:()=>l,vt:()=>A});var i=n(524936),r=n(233187),_=n(348466);const s=(e,t)=>!(!(0,i.jp)(e)&&!(0,i._L)(e))||(!(!t.isOpenVpnTrafficRoutesSupported||!(0,i.MY)(e))||(!(!t.isSiteToSiteOpenVpnTrafficRoutesSupported||!(0,i.qf)(e))||(!(!t.isSiteToSiteWireguardTrafficRoutesSupported||!(0,i.$p)(e))||(!!(t.isSiteToSiteIpsecTrafficRoutesSupported&&(0,i.Mc)(e)&&e.ipsec_dynamic_routing&&e.ipsec_tunnel_ip_enabled)||!(!(0,i.ok)(e)||!(0,i.o1)(e)||(0,i.sp)(e)))))),a=(e,t)=>t.isSiteToSiteIpsecTrafficRoutesSupported&&(0,i.Mc)(e)&&e.ipsec_dynamic_routing&&!e.ipsec_tunnel_ip_enabled?"SETTINGS_TRAFFIC_ROUTES_INTERFACE_DISABLED_TUNNEL_IP":t.isSiteToSiteIpsecTrafficRoutesSupported&&(0,i.Mc)(e)&&!e.ipsec_dynamic_routing?"SETTINGS_TRAFFIC_ROUTES_INTERFACE_DISABLED_POLICY_BASED":e.routing_table_id||(0,i.JJ)(t.networks).size?null:"SETTINGS_ROUTING_TABLES_EXCEEDED_POLICY_BASED_ROUTES",l=e=>(0,i.ok)(e)&&(0,i.o1)(e)&&e.purpose!==r.rR.VLAN_ONLY,o=e=>{const[t,n=""]=e.split(_.oH),i=n.split(_.KE).filter(Boolean),r=i.filter(e=>!e.includes(_.jr)),s=i.filter(e=>e.includes(_.jr));return{domain:t,ports:r.map(Number),port_ranges:s.map(e=>{const[t,n]=e.split(_.jr).map(Number);return{port_start:t,port_stop:n}})}},A=e=>{const t=e.port_ranges.map(({port_start:e,port_stop:t})=>`${e}${_.jr}${t}`),n=[...e.ports,...t].join(_.KE);return[e.domain,n].filter(Boolean).join(_.oH)}},837867:(e,t,n)=>{n.d(t,{A:()=>O});var i=n(296540),r=n(951272),_=n(469733),s=n(725508),a=n(71479),l=n(588915),o=n(23835),A=n(12207),E=n(459449),d=n(705426),p=n(294303),c=n(742920),I=n(675359),T=n(566723);const S=(0,a.A)(p.A)`
  padding: ${T.fS} 0;
  margin: 0 ${T.kc};

  textarea {
    line-height: 20px;
    padding: 10px ${T.Ln} 18px ${T.Ln};
    resize: none;
  }
`,R=(0,a.A)(l.A)`
  margin-top: ${T.S2};
  svg {
    margin-right: 6px;
  }
`,m=(0,a.A)(d.A)`
  width: 431px;
  header {
    height: ${T.nf};
    align-items: center;
    display: flex;

    > div {
      font-size: 16px;
      line-height: 20px;
    }
  }
  footer {
    padding: ${T.fS} ${T.Yc};
    button {
      height: ${T.fS};
    }
    > div {
      div:last-child button {
        width: 137px;
      }
    }
  }
`,u=({onClose:e,title:t,placeholder:n})=>{const{formatMessage:a}=(0,E.tz)(),l=(0,_.useDispatch)(),{values:d,errors:p,setFieldValue:T,submitCount:u,handleSubmit:N}=(0,r.j7)(),O=(0,i.useMemo)(()=>[{text:i.createElement(E.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",variant:"default",onClick:e},{text:i.createElement(E.sA,{id:"COMMON_ACTION_ADD"}),type:"button",variant:"primary",onClick:()=>N()}],[e,N]);return i.createElement(m,{size:"small",isOpen:!0,title:i.createElement(E.sA,{id:t}),actions:O},i.createElement(S,{flexDirection:"column"},i.createElement(o.A,{rows:7,name:"text",value:d.text,onChange:(e,t)=>T("text",t),placeholder:n&&a({id:n}),full:!0}),p?.text&&u>0?i.createElement(A.A,null,p?.text):null,i.createElement(R,{accept:"text/plain",variant:"inline",Icon:s.A,onChange:async(e,t)=>{const n=!!t&&"current"in t&&t.current?.files?.[0],i=await((e,t)=>new Promise((n,i)=>{const r=new FileReader;r.onerror=function(){i(),t((0,I.ox)({icon:c.C.warning,message:"COMMON_NOTICE_UPLOAD_ERROR"}))},r.onload=function(){n(r.result)},r.readAsText(e)}))(n,l);T("text",i)}},i.createElement(E.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_BATCH_ADD_MODAL_IMPORT_BUTTON"}))))},N={text:""},O=({onClose:e,onSubmit:t,validationSchema:n,title:_,placeholder:s})=>{const a=(0,i.useCallback)(n=>{t(n.text),e()},[e,t]);return i.createElement(r.l1,{enableReinitialize:!0,initialValues:N,validationSchema:n,onSubmit:a},i.createElement(u,{onClose:e,title:_,placeholder:s}))}},65755:(e,t,n)=>{n.d(t,{f:()=>F,A:()=>f});var i,r=n(296540),_=n(54227),s=n(951272),a=n(758649),l=n(369596),o=n(459449),A=n(294303),E=n(333080),d=n(657781),p=n(566723),c=n(870443),I=n(553432),T=n(242366),S=n(573531),R=n(383653),m=n(837867),u=n(620637),N=n(546391),O=n(901371),C=n(68783),M=n(149133);!function(e){e.SINGLE="single",e.RANGE="range"}(i||(i={}));const g=(0,O.jp)(!1),b=e=>e?.split(N.Mi)?.map(e=>e.trim()).filter(Boolean).map(e=>(e=>{let t,n=e;return e.includes("[")&&e.includes("]")&&(n=e.split("]")[0].replace("[",""),[,t]=e.split("]")),(0,C.or)([N.zF,N.wK]).test(e.split(":")[0])&&([n,t]=e.split(":")),{ip:n,port:t||""}})(e)),D=()=>c.A.string().label("COMMON_IP_ADDRESS").test("isValidIpOrSubnet",r.createElement(o.sA,{id:"COMMON_VALIDATION_VALID_IP"}),e=>!e||[u.isValidIpv4,M.N7,(0,R.es)()].some(t=>t(e))).test("isValidSubnetV4",r.createElement(o.sA,{id:"COMMON_VALIDATION_VALID_IP_SUBNET_FORMAT"}),e=>!e||!N.wK.test(e)||(0,M.nX)(e)===e).test("isValidSubnetV6",r.createElement(o.sA,{id:"COMMON_VALIDATION_VALID_IPV6_SUBNET_FORMAT"}),e=>!e||!N.QD.test(e)||(0,R.dS)(e)).test("isNotIpv4MappedIpv6Address",r.createElement(o.sA,{id:"SETTINGS_NETWORKS_IPV6_ADDRESS_IPV4_MAPPED_IPV6_INVALID"}),e=>!(0,R.m0)(e)).test("isNotIPv6MulticastAddress",r.createElement(o.sA,{id:"SETTINGS_NETWORKS_IPV6_ADDRESS_MULTICAST_INVALID"}),e=>!(0,R.aN)(e)),L=()=>c.A.string().label("COMMON_IP_ADDRESS").test("isValidIp",r.createElement(o.sA,{id:"COMMON_VALIDATION_VALID_IP"}),e=>!e||[u.isValidIpv4,u.isValidIpv6].some(t=>t(e))).test("isNotIpv4MappedIpv6Address",r.createElement(o.sA,{id:"SETTINGS_NETWORKS_IPV6_ADDRESS_IPV4_MAPPED_IPV6_INVALID"}),e=>!(0,R.m0)(e)).test("isNotIPv6MulticastAddress",r.createElement(o.sA,{id:"SETTINGS_NETWORKS_IPV6_ADDRESS_MULTICAST_INVALID"}),e=>!(0,R.aN)(e)),G=[{id:"id",label:r.createElement(o.sA,{id:"COMMON_IP_ADDRESS"}),sortable:!1,renderCell:e=>(0,d.ef)(e),minWidth:160},{id:"all_ports",label:r.createElement(o.sA,{id:"COMMON_PORT"}),sortable:!1,renderCell:e=>e.type===i.SINGLE&&(0,d.J)(e)||S.L,minWidth:120}],h=[{id:i.SINGLE,label:r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_IP_TAB"})},{id:i.RANGE,label:r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_IP_RANGE_TAB"})}],P=[{id:"first",getFieldType:()=>"text",getFieldName:e=>e.type===i.SINGLE?"ip_or_subnet":"ip_start",getFieldLabel:e=>e.type===i.SINGLE?"COMMON_IP_ADDRESS":"COMMON_START"},{id:"second",getFieldType:()=>"text",getFieldName:e=>e.type===i.SINGLE?"all_ports":"ip_stop",getFieldLabel:e=>e.type===i.SINGLE?"COMMON_PORT":"COMMON_STOP"}],F=({value:e,onChange:t,invalid:n})=>{const[s,E]=(0,r.useState)(i.SINGLE),[S,N]=(0,r.useState)(!1),O=(0,r.useMemo)(()=>({editActive:!1,combinedIpAddresses:e.map(e=>"ip_or_subnet"in e?{...e,id:(0,d.rK)(e),type:i.SINGLE,all_ports:(0,d.J)(e)}:{...e,id:(0,d.rK)(e),type:i.RANGE,all_ports:""}),new_ip_or_subnet_address:"",new_ports:"",new_ip_or_subnet_address_start:"",new_ip_or_subnet_address_stop:""}),[e]),C=(0,r.useMemo)(()=>s===i.SINGLE?[{name:"new_ip_or_subnet_address",label:"COMMON_IP_ADDRESS",inline:!0},{name:"new_ports",label:"COMMON_PORT",inline:!0,hideMainFormInvalidState:!0}]:[{name:"new_ip_or_subnet_address_start",label:"COMMON_START",placeholder:"COMMON_IP_ADDRESS",inline:!0},{name:"new_ip_or_subnet_address_stop",label:"COMMON_STOP",placeholder:"COMMON_IP_ADDRESS",inline:!0}],[s]),F=(0,r.useCallback)(e=>t(e),[t]),f=(0,r.useCallback)(t=>{const{new_ip_or_subnet_address:n,new_ports:r,new_ip_or_subnet_address_start:_,new_ip_or_subnet_address_stop:a}=t;if(s===i.SINGLE){const t=r.split(",").filter(Boolean),i=t.filter(e=>!e.includes("-")),_=t.filter(e=>e.includes("-"));F([...e,{ip_or_subnet:n,ports:i.length?i.map(Number):[],port_ranges:_.map(e=>({port_start:Number(e.split("-")[0]),port_stop:Number(e.split("-")[1])})),ip_version:[(0,R.wt)(),(0,R.vS)()].some(e=>e(n))?"v6":"v4"}])}else F([...e,{ip_start:_,ip_stop:a,ip_version:[(0,R.wt)(),(0,R.vS)()].some(e=>e(_))?"v6":"v4"}])},[s,e,F]),v=(0,r.useCallback)(e=>{F(e.map(e=>{if(e.type===i.SINGLE){const t=e.all_ports?.split(",").filter(Boolean),n=t?.filter(e=>!e.includes("-"))||[],i=t?.filter(e=>e.includes("-"))||[];return{ip_or_subnet:e.ip_or_subnet,ports:n.length?n.map(Number):[],port_ranges:i.map(e=>({port_start:Number(e.split("-")[0]),port_stop:Number(e.split("-")[1])})),ip_version:e.ip_version}}return{ip_start:e.ip_start,ip_stop:e.ip_stop,ip_version:e.ip_version}}))},[F]),U=(0,r.useCallback)(({id:t})=>F(e.filter(e=>(0,d.rK)(e)!==t)),[F,e]);return r.createElement(T.A,null,S?r.createElement(m.A,{onClose:()=>N(!1),onSubmit:n=>{const i=b(n);t([...e,...i.map(e=>{const t=e.port?.split(",").filter(Boolean)||[],n=t.filter(e=>!e.includes("-")),i=t.filter(e=>e.includes("-"));return{ip_or_subnet:e.ip,ports:n.map(Number),port_ranges:i.map(e=>({port_start:Number(e.split("-")[0]),port_stop:Number(e.split("-")[1])}))}})])},validationSchema:(V=e.map(e=>"ip_or_subnet"in e?e.ip_or_subnet:""),c.A.object().shape({text:c.A.string().label("SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_BATCH_ADD_MODAL_THIS_FIELD").required().test("isValidIpv6-NotIpv4Mapped",r.createElement(o.sA,{id:"SETTINGS_NETWORKS_IPV6_ADDRESS_IPV4_MAPPED_IPV6_INVALID"}),e=>{if(!e)return!0;const t=b(e).filter(e=>(0,R.es)()(e.ip));return t?.every(e=>(0,R.es)({excludeIpv4Mapped:!0})(e.ip))}).test("isValidIpv6-NotMulticast",r.createElement(o.sA,{id:"SETTINGS_NETWORKS_IPV6_ADDRESS_MULTICAST_INVALID"}),e=>{if(!e)return!0;const t=b(e).filter(e=>(0,R.es)()(e.ip));return t?.every(e=>(0,R.es)({excludeMulticast:!0})(e.ip))}).test("isValidList",r.createElement(o.sA,{id:"COMMON_VALIDATION_VALID_PORT_RANGE"}),e=>{if(!e)return!0;const t=b(e);return t?.every(e=>(!e.port||g(e.port))&&[u.isValidIpv4,M.N7,(0,R.es)()].some(t=>t(e.ip)))}).test("hasDuplicates",r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_UNIQUE_ERROR"}),e=>{if(!e)return!0;const t=b(e),n=[...V,...(t||[])?.map(e=>e.ip)||[]];return n.length===new Set(n).size}).isNotWildcardIP(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).isNotPrefixLengthZero(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"}))})),title:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_BATCH_ADD_MODAL_HEADER",placeholder:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_BATCH_ADD_MODAL_PLACEHOLDER"}):null,r.createElement(I.A,null,h.map(({id:e,label:t})=>r.createElement(_.A,{key:e,id:e,onChange:()=>E(e),checked:s===e},t))),r.createElement(A.A,{width:"100%",flexDirection:"column",gap:p.YC},r.createElement(l.A,{fieldName:"combinedIpAddresses",columns:G,newFields:C,onAddItem:f,onRemoveItem:U,onEditSubmit:v,initialValues:O,invalid:n,validationSchema:c.A.lazy(e=>((e,t)=>{const n={arrayFieldName:"combinedIpAddresses",stringFieldName:"ip_or_subnet",errorMessage:r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_UNIQUE_ERROR"})};return c.A.object().shape({...t===i.RANGE?{new_ip_or_subnet_address_start:e.editActive?c.A.string():L().isIPUnique({formValues:null,...n}).isNotWildcardIP(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).isNotPrefixLengthZero(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).required(),new_ip_or_subnet_address_stop:e.editActive?c.A.string():L().isIPUnique({formValues:null,...n}).isNotWildcardIP(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).isNotPrefixLengthZero(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).test("isGreaterThanStart",r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_STOP_AFTER_START"}),t=>!t||!e.new_ip_or_subnet_address_start||((0,u.isValidIpv4)(t)&&(0,u.isValidIpv4)(e.new_ip_or_subnet_address_start)?(0,M.GQ)(t)>(0,M.GQ)(e.new_ip_or_subnet_address_start):!(0,u.isValidIpv6)(t)||!(0,u.isValidIpv6)(e.new_ip_or_subnet_address_start)||(0,R.zt)(e.new_ip_or_subnet_address_start,t))).required()}:{new_ip_or_subnet_address:e.editActive?c.A.string():D().isIPUnique({formValues:null,...n}).isNotWildcardIP(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).isNotPrefixLengthZero(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).required(),new_ports:e.editActive?c.A.string():c.A.string().label("COMMON_PORT").unifiPortRange(r.createElement(o.sA,{id:"COMMON_VALIDATION_VALID_PORT_RANGE"}))},combinedIpAddresses:c.A.array().of(c.A.object().shape({type:c.A.string().oneOf([i.SINGLE,i.RANGE]),ip_or_subnet:c.A.string().when("type",{is:i.SINGLE,then:D().isIPUnique({formValues:null,...n}).isNotWildcardIP(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).isNotPrefixLengthZero(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).required()}),all_ports:c.A.string().when("type",{is:i.SINGLE,then:c.A.string().label("COMMON_PORT").unifiPortRange(r.createElement(o.sA,{id:"COMMON_VALIDATION_VALID_PORT_RANGE"}))}),ip_start:c.A.string().when("type",{is:i.RANGE,then:L().isIPUnique({formValues:null,...n}).isNotWildcardIP(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).isNotPrefixLengthZero(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).required()}),ip_stop:c.A.string().when("type",{is:i.RANGE,then:L().isIPUnique({formValues:null,...n}).isNotWildcardIP(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).isNotPrefixLengthZero(r.createElement(o.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_IP_ADDRESS_COMMON_ERROR"})).required()})})),editActive:c.A.bool()})})(e,s)),editColumns:P,isWindowTable:!0}),s===i.SINGLE?r.createElement(A.A,null,r.createElement(a.A,{type:"button",variant:"inline",size:"medium",onClick:()=>N(!0)},r.createElement(o.sA,{id:"COMMON_ADD_MULTIPLE"}))):null));var V},f=({name:e})=>{const{values:t,setFieldValue:n,errors:i,submitCount:_,touched:a}=(0,s.j7)();return r.createElement(F,{value:(0,s.O6)(t,e),onChange:t=>n(e,t),invalid:(0,E.t$)(e,i,a,_)})}},579979:(e,t,n)=>{n.d(t,{s:()=>r});var i=n(948177);const r=(0,n(71479).A)(i.A)`
  color: ${({theme:{motifPalette:{neutral08:e}}})=>e};
`},657781:(e,t,n)=>{n.d(t,{GJ:()=>g,J:()=>C,PI:()=>O,Q$:()=>N,ef:()=>M,rK:()=>b});var i=n(296540),r=n(927099),_=n(948177),s=n(412933),a=n(884740),l=n(459449),o=n(848576),A=n(318686),E=n(566723),d=n(814356),p=(n(28694),n(348466)),c=n(269889),I=n(294303),T=n(455155),S=n(802123),R=n(323030),m=n(757639),u=n(524803);const N=(e=[],t=!1)=>(t?e.length===m._O.length:e.length===A.hS.length)?[s.n_]:e,O=e=>{const{domain:t,ports:n=[],port_ranges:i=[]}=e,r=[...n,...i.map(({port_start:e,port_stop:t})=>`${e}${p.jr}${t}`)].join(",");return r.length?`${t}:${r}`:t},C=e=>{const{ports:t=[],port_ranges:n=[]}=e;return[t.length>0?`${t.map((e,n)=>`${e}${n===t.length?",":""}`)}`:"",n.length>0?`${n.map((e,t)=>`${e.port_start}-${e.port_stop}${t===n.length?",":""}`)}`:""].filter(Boolean).join(",")},M=(e,t)=>e.ip_or_subnet?`${e.ip_or_subnet}${t&&C(e)?`:${C(e)}`:""}`:`${e.ip_start}-${e.ip_stop}`,g=({matching_target:e,app_ids:t=[],enabled:n,app_category_ids:s=[],domains:p=[],ip_addresses:C=[],ip_ranges:g=[],regions:b=[],network_ids:D=[]},L)=>{switch(e){case o.Kl.APP:if(t.length>1){const e=(G=t.map(e=>A.Z6[e]),G.sort(({name:e=""},{name:t=""})=>e.localeCompare(t))).map(e=>i.createElement(r.A,{key:e.name,inheritAll:!0},i.createElement(I.A,{alignItems:"center",gap:E.kc},i.createElement(T.A,{iconFileName:e.iconFileName}),i.createElement("span",null,e.name))));return i.createElement(S.A,{enabled:n,label:i.createElement(l.sA,{id:"COMMON_APP_COUNT",values:{count:t.length}}),tooltipItems:e,neverShowListMarkers:!0})}if(1===t.length){const{name:e,iconFileName:r}=A.Z6[t[0]];return i.createElement(I.A,{alignItems:"center",gap:E.kc},i.createElement(T.A,{iconFileName:r}),i.createElement(c.A,{enabled:n,size:"body"},e))}return i.createElement(c.A,{enabled:n},i.createElement(l.sA,{id:"COMMON_FALLBACK"}));case o.Kl.APP_CATEGORY:{const e=N(s,!0);if("string"==typeof e[0])return i.createElement(l.sA,{id:"SETTINGS_SECURITY_TRAFFIC_RULES_FORM_MATCHING_TARGET_APP_CATEGORY_OPTION_ALL"});const t=e.map(e=>i.createElement(l.sA,{key:e,id:m.QK[e]||m.QK[255]}));if(s.length>1)return i.createElement(S.A,{enabled:n,label:i.createElement(l.sA,{id:"COMMON_CATEGORY_COUNT",values:{count:s.length}}),tooltipItems:t});if(1===s.length){const e=i.createElement(l.sA,{id:m.QK[s[0]]||m.QK[255]});return(0,u.Po)(e,n,"pointer")}return i.createElement(c.A,{enabled:n},i.createElement(l.sA,{id:"COMMON_FALLBACK"}))}case o.Kl.DOMAIN:if(p.length>1){const e=p.map(e=>O(e));return i.createElement(S.A,{enabled:n,label:i.createElement(l.sA,{id:"COMMON_DOMAIN_COUNT",values:{count:p.length}}),tooltipItems:e})}return 1===p.length?(0,u.Po)(O(p[0]),n,"pointer"):i.createElement(c.A,{enabled:n},i.createElement(l.sA,{id:"COMMON_FALLBACK"}));case o.Kl.IP:{const e=[...C,...g];if(e.length>1){const t=e.map(e=>M(e,!0));return i.createElement(S.A,{enabled:n,label:i.createElement(l.sA,{id:"COMMON_IP_COUNT",values:{count:e.length}}),tooltipItems:t})}return 1===e.length?i.createElement(c.A,{size:"body",enabled:n},M(e[0],!0)):i.createElement(c.A,{enabled:n},i.createElement(l.sA,{id:"COMMON_FALLBACK"}))}case o.Kl.REGION:if(b.length>1){const e=b.map(e=>i.createElement(I.A,{key:e,gap:E.kc,alignItems:"center"},i.createElement(R.A,{countryCode:e,width:16,height:16,style:{borderRadius:2,objectFit:"cover"}}),(0,d.q)(e.toUpperCase())));return i.createElement(S.A,{enabled:n,label:i.createElement(l.sA,{id:"COMMON_REGION_COUNT",values:{count:b.length}}),tooltipItems:e,neverShowListMarkers:!0})}if(1===b.length){const e=b[0];return(0,u.Po)(i.createElement(i.Fragment,null,i.createElement(R.A,{countryCode:e,width:16,height:16,style:{borderRadius:2,objectFit:"cover"}}),i.createElement("span",{style:{marginLeft:E.kc}},(0,d.q)(e.toUpperCase()))),n,"pointer")}return i.createElement(c.A,{enabled:n},i.createElement(l.sA,{id:"COMMON_FALLBACK"}));case o.Kl.INTERNET:return i.createElement(c.A,{size:"body",enabled:n},i.createElement(l.sA,{id:"COMMON_ANY"}));case o.Kl.LOCAL_NETWORK:{const e=D.filter(e=>L.find(t=>t._id===e));if(e.length>1){const t=e.map(e=>{const t=L.find(t=>t._id===e);return i.createElement(I.A,{key:e,alignItems:"center",gap:E.kc},i.createElement(_.A,{size:"original"})," ",t?.name||e)});return i.createElement(S.A,{enabled:n,label:i.createElement(l.sA,{id:"COMMON_NETWORK_COUNT",values:{count:e.length}}),tooltipItems:t,neverShowListMarkers:!0})}if(1===e.length){const t=L.find(t=>t._id===e[0]);return(0,u.Po)(i.createElement(i.Fragment,null,i.createElement(_.A,{width:m.qj,height:m.qj}),i.createElement("span",{style:{marginLeft:E.kc}},t?.name||e[0])),n,"pointer")}return i.createElement(c.A,{enabled:n},i.createElement(a.A,null))}default:return i.createElement(c.A,{enabled:n},i.createElement(l.sA,{id:"COMMON_FALLBACK"}))}var G},b=e=>e.ip_or_subnet||`${e.ip_start}-${e.ip_stop}`},884740:(e,t,n)=>{n.d(t,{A:()=>l});var i=n(296540),r=n(998837),_=n(823858),s=n(271856),a=n(459449);const l=(0,i.memo)(()=>i.createElement(s.A,{portal:!0,description:i.createElement(a.sA,{id:"SETTINGS_FIREWALL_RULES_MISSING_NETWORK_TOOLTIP"})},i.createElement(_.A,{color:(0,r.u)().motifPalette.warning,size:"original"})))},527726:(e,t,n)=>{n.d(t,{gb:()=>s,om:()=>_,tY:()=>a});var i,r=n(346070);!function(e){e.DEVICE="device",e.NETWORK="network"}(i||(i={}));const _=(e,t)=>[i.DEVICE,e].join(t),s=(e,t)=>[i.NETWORK,e].join(t),a=(e,t)=>{const[n,_]=e.split(t);return n===i.DEVICE?{type:r.Q.CLIENT,client_mac:_}:{type:r.Q.NETWORK,network_id:_}}},62170:(e,t,n)=>{n.d(t,{A:()=>E});var i=n(296540),r=n(349785),_=n(662297),s=n(459449),a=n(566723),l=n(994133),o=n(263963);const A=[];const E=function({control:e,name:t,tooltip:n,options:E,disabled:d,triggerButtonText:p,truncateLabels:c=!0,isWindowed:I,searchOptions:T,maxSelections:S,narrowTrigger:R}){const m=(0,l.e)(),u=(0,o.L_)();return i.createElement(r.xI,{control:e,name:t,render:({field:e,fieldState:l,formState:o})=>i.createElement(_.A,{name:e.name,onChange:t=>e.onChange(t),disabled:d??m??e.disabled,value:e.value||A,tooltipDescription:n,options:E,truncateLabels:c,invalid:l.invalid?u((0,r.Jt)(o.errors,t)?.message)||!0:void 0,translateTriggerButtonText:!1,triggerButtonText:p??i.createElement(s.sA,{id:"COMMON_EDIT_SELECTIONS"}),isWindowed:I,searchOptions:T,maxSelections:S,isFullWidth:!0,triggerButtonHeight:R?a.S2:void 0})})}},68783:(e,t,n)=>{n.d(t,{or:()=>i});const i=(e,t)=>{if(!Array.isArray(e)||e.length<2)throw new Error("Unable to combine - missing source regexes");const n=e.map(e=>`(${(e=>e.toString().substring(1).split(/\/([^/]*)$/))(e)[0]})`).join("|");return new RegExp(n,t)}}}]);