"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[30129],{684780(e,t,n){n.d(t,{c:()=>r});const i=/^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw480]=$/;function r(e){return!!e&&i.test(e)}},60143(e,t,n){n.d(t,{U:()=>l});var i=n(222102),r=n(656466),s=n(401042),o=n(360278);const a=(0,r.uh)((0,o.G)()),l=(0,i.Mz)(a,s.kh)},547967(e,t,n){n.d(t,{AC:()=>p,D7:()=>E,Ie:()=>h,JL:()=>u,JX:()=>S,KY:()=>I,O2:()=>A,Op:()=>c,Rm:()=>N,e$:()=>T,t7:()=>m,yr:()=>O});var i=n(938984),r=n(814557),s=n(247816),o=n(409844),a=n(291508),l=n(61322),d=n(309130),_=n(100978);const c=(0,s.A)(_.A,(0,a.A)("inline","wrap"))`
  position: relative;
  flex: ${({inline:e})=>e?"1 1 0":"0 0 100%"};
  align-items: flex-start;
  flex-flow: ${({wrap:e})=>"row "+(e?"wrap":"nowrap")};
  gap: ${d.kc};
`,A=(0,s.A)(_.A,(0,a.A)("editMaxHeight","editFieldWrap"))`
  flex-direction: column;
  max-height: ${({editMaxHeight:e})=>`${e||300}px`};
  overflow-y: auto;
  overflow-x: hidden;
  gap: ${d.YC};

  ${({editFieldWrap:e,theme:{themeName:t}})=>e?`\n    gap: 0;\n\n    > * {\n      border-bottom: ${r.Ay[`desktop-border-divider-${t}`]};\n      padding-bottom: ${d.kc};\n      padding-top: ${d.kc};\n    }\n\n    > *:first-child {\n      padding-top: 0;\n    }\n\n    > *:last-child {\n      border-bottom: none;\n      padding-bottom: 0;\n    }\n  `:""}
`,p=(0,s.A)("div",(0,a.A)("isWindowsTable","rows","tableMaxHeight","marginTop"))`
  width: 100%;
  // windows table inherits height from parent container
  height: ${({rows:e,isWindowsTable:t})=>t&&`${l.I.ROW_HEIGHT*e+l.I.HEADER_HEIGHT}`}px;
  max-height: ${({tableMaxHeight:e})=>e?`${e}px`:"auto"};
  margin-top: ${({marginTop:e})=>e||d.Ln};

  table {
    td {
      max-width: 170px;

      span {
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
`,E=(0,s.A)(i.A)`
  margin-right: ${d.YC};
`,I=o.AH`
  :first-of-type {
    padding: 0 ${d.fS} 0 0px;
  }
`,N="drag-and-drop-table-row-placeholder",m=(0,s.A)(_.A)`
  flex-direction: column;

  /* Adjust weird padding on the right side for the ID column when right aligned (drag & drop table) */
  table > thead > tr > th:last-of-type {
    padding-right: ${d.kc};
  }

  /* Add missing border between drag and drop groups (tbody elements) */
  table > tbody {
    border-bottom: ${({theme:{themeName:e}})=>r.Ay[`desktop-border-divider-${e}`]};
  }
  /* Last cell in table is hover content which is not used in this table */
  table > tbody[data-rbd-droppable-context-id] td:not(:last-of-type),
  table > thead > tr > th {
    /* Align drag & drop table cell padding to regular table padding */
    padding-right: ${d.kc} !important;
  }
  /* Align drop zone placeholder row when a row is dragged to matched the CSS overrides for drag and drop table we use */
  table .${N} {
    display: flex;
  }
`,u=o.AH`
  /* This is default for the table rows, so we need it for the header. */
  display: flex;
  width: 100%;

  > th:first-child {
    /* Since we flex the header, we must specify this to align with the table rows. */
    width: 24px;
  }
  > th:not(:first-child) {
    /* Something inside UIC sets the padding to 8px for table header and 5px for table rows. This aligns it to make flex work. */
    padding-right: ${d.kc} !important;
  }
`,T=o.AH`
  /* Override the padding-right of the first column to align with manage + drop modes. */
  > th:first-child {
    padding-right: ${d.kc} !important;
  }
  > th:first-child:has(> label) {
    padding-right: 1px !important;
    width: 36px;
  }
`,O=o.AH`
  /* UIC already does this for some table states, like drag and drop and when in manage mode. If we just use this ALWAYS, we're avoiding many issues related to using different alignment techniques in different places. */
  display: flex;
`,S=o.AH`
  tbody {
    display: flex;
    flex-direction: column;
  }
`;function h(e,t){return o.AH`
    width: ${t.width?`${t.width}px`:"auto"};
    min-width: ${t.minWidth?`${t.minWidth}px`:"0px"};
    flex: ${t.growthFactor||0} !important;
    padding-left: ${d.kc} !important;
    padding-right: ${d.kc} !important;
  `}},256468(e,t,n){var i;n.d(t,{EE:()=>s,Uh:()=>i,Vf:()=>r}),function(e){e.SINGLE="single",e.PLURAL="plural"}(i||(i={}));const r="editActive",s=20},469057(e,t,n){n.d(t,{$L:()=>O,$e:()=>o,Bw:()=>E,IS:()=>A,Mr:()=>a,O1:()=>I,SU:()=>i,Wx:()=>u,_h:()=>h,bF:()=>l,do:()=>S,eI:()=>r,fI:()=>d,g9:()=>N,ir:()=>p,oM:()=>s,ow:()=>m,vY:()=>c,wO:()=>_,x1:()=>T});const i=40,r=60,s=24,o=20,a=29,l=14,d=64,_=1419,c=1420,A=1500,p=68,E=540,I=1280,N=65536,m=c-i,u=1360,T=500,O=1220,S=8960,h=190},531984(e,t,n){n.d(t,{w:()=>o});var i=n(602086),r=n(977872),s=n(205521);const o=e=>{const t=(0,r.wA)();(0,i.useEffect)(()=>{t((0,s.SQ)(e))},[t,e])}},762542(e,t,n){n.d(t,{y:()=>r});var i=n(531984);const r=e=>(0,i.w)(e.formState.isDirty)},612389(e,t,n){n.d(t,{A:()=>c});var i=n(274934),r=n(814557),s=n(938984),o=n(247816),a=n(263705),l=n(309130),d=n(100978);const _=(0,o.A)(s.A)`
  line-height: 20px;
`,c=({icon:e,description:t,action:n,footer:s,background:o,...c})=>{const{themeName:A}=(0,a.u)();return(0,i.jsxs)(d.A,{flexGrow:1,borderRadius:l.YC,padding:l.kc,background:o||r.Ay[`desktop-color-neutral-01-${A}`],gap:l.kc,flexDirection:"column",...c,children:[(0,i.jsxs)(d.A,{flexGrow:1,gap:l.kc,children:[e,t?(0,i.jsx)(_,{size:"medium",children:t}):null,n?(0,i.jsx)(d.A,{marginLeft:"auto",children:(0,i.jsx)(_,{size:"medium",children:n})}):null]}),s]})}},330973(e,t,n){n.d(t,{A:()=>d});var i=n(274934),r=n(853777),s=n(470070),o=n(726831),a=n(793442),l=n(612389);const d=({feature:e,isAlternativeTranslation:t})=>(0,i.jsx)(l.A,{icon:(0,i.jsx)(r.A,{size:"original",isActive:!0,variant:"fill"}),description:(0,i.jsx)(s.sA,{id:t?"SETTINGS_LOW_PERFORMANCE_GATEWAY_WARNING_ALTERNATIVE_TEXT":"SETTINGS_LOW_PERFORMANCE_GATEWAY_WARNING",values:{feature:(0,s.tz)().formatMessage({id:e}),link:(0,i.jsx)(a.A,{href:o.A.storeCloudGateways,id:"SETTINGS_CLOUD_GATEWAY"})}})})},753959(e,t,n){n.d(t,{A:()=>l});var i=n(274934),r=n(814557),s=n(853777),o=n(263705),a=n(612389);const l=({children:e,icon:t,background:n,...l})=>{const{themeName:d}=(0,o.u)();return(0,i.jsx)(a.A,{icon:t||(0,i.jsx)(s.A,{variant:"fill",size:"original",color:r.Ay[`desktop-color-ublue-06-${d}`]}),description:e,background:n,...l})}},901389(e,t,n){n.d(t,{A:()=>l});var i=n(274934),r=n(814557),s=n(600191),o=n(263705),a=n(612389);const l=({children:e,...t})=>{const{themeName:n}=(0,o.u)();return(0,i.jsx)(a.A,{icon:(0,i.jsx)(s.A,{variant:"fill",size:"original",color:r.Ay[`desktop-color-orange-06-${n}`]}),description:e,...t})}},465615(e,t,n){n.d(t,{A:()=>s});var i=n(247816),r=n(529720);const s=(0,i.A)(r.A)`
  width: 48px;
  background: none;
  padding: 0;
  > div:first-child {
    display: none;
  }
  span {
    display: none;
  }
`},535322(e,t,n){n.d(t,{A:()=>E,I:()=>i});var i,r=n(274934),s=n(814557),o=n(158885),a=n(247816),l=n(565527),d=n(309130),_=n(100978),c=n(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(i||(i={}));const A=(0,a.A)(_.A,(0,c.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||s.Ay[n===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  padding: ${({isButtonList:e,padding:t})=>t||(e?`0 ${d.Ln}`:d.Ln)};
  margin-bottom: ${({marginBottom:e})=>e||d.Ln};
  ${({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}})=>s.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,p=(0,a.A)(o.A,(0,c.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||s.Ay[n===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.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||s.Ay[t===l.S.DARK?`desktop-color-neutral-01-${l.S.DARK}`:`desktop-color-neutral-00-${l.S.LIGHT}`]};
      height: 48px;
      padding: 0 ${d.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0;
      > div {
        padding: 0 ${d.Ln} ${d.Ln};
      }
    }
  }
`,E=({type:e,marginBottom:t,margin:n,padding:s,flex:o,width:a,nested:l,...d})=>"items"in d?(0,r.jsx)(p,{marginBottom:t,margin:n,padding:s,flex:o,nested:l,...d}):(0,r.jsx)(A,{nested:l,width:a,marginBottom:t,margin:n,padding:s,flex:o,isButtonList:e===i.BUTTON_LIST,...d,children:d.children})},883748(e,t,n){n.d(t,{A:()=>A});var i=n(274934),r=n(977872),s=n(812450),o=n(309130),a=n(421314),l=n(100978),d=n(650632),_=n(831433),c=n(34118);const A=({mac:e,enabled:t})=>{const n=(0,r.d4)(c.GB).find(t=>"mac"in t&&t.mac===e)||{};return(0,i.jsx)(s.A,{symbol:(0,i.jsx)(l.A,{maxWidth:20,maxHeight:20,opacity:t?void 0:o.xN,children:(0,i.jsx)(d.A,{client:{mac:e,...n}})}),children:(0,i.jsx)(a.A,{enabled:t,children:(0,_.tn)(n)||e})})}},583821(e,t,n){n.d(t,{A:()=>o});var i=n(274934),r=n(897688),s=n(421314);const o=({domain:e,enabled:t})=>(0,i.jsx)(r.A,{children:(0,i.jsx)(s.A,{color:t?void 0:"disabled",children:e})})},603542(e,t,n){n.d(t,{A:()=>o});var i=n(274934),r=n(897688),s=n(421314);const o=({ip:e,enabled:t})=>(0,i.jsx)(r.A,{children:(0,i.jsx)(s.A,{color:t?void 0:"disabled",children:e})})},185669(e,t,n){n.d(t,{A:()=>_});var i=n(274934),r=n(602086),s=n(897688),o=n(309130),a=n(625796),l=n(421314),d=n(100978);const _=({region:e,enabled:t})=>{const n=(0,r.useMemo)(()=>a.Ay.find(t=>t.value===e),[e]);return n?(0,i.jsx)(s.A,{symbol:(0,i.jsx)(d.A,{width:20,height:20,padding:"2px",opacity:t?1:o.xN,children:n.image()}),children:(0,i.jsx)(l.A,{color:t?void 0:"disabled",children:n.label})}):null}},297640(e,t,n){n.d(t,{A:()=>c});var i=n(274934),r=n(977872),s=n(95032),o=n(309130),a=n(100978),l=n(650632),d=n(831433),_=n(34118);const c=({mac:e})=>{const t=(0,r.d4)(_.GB).find(t=>"mac"in t&&t.mac===e)||{};return(0,i.jsxs)(a.A,{gap:o.kc,alignItems:"center",children:[(0,i.jsx)(a.A,{maxWidth:16,maxHeight:16,children:(0,i.jsx)(l.A,{client:{mac:e,...t}})}),(0,i.jsx)(s.A,{variant:"inherit",isTruncated:!0,children:(0,d.tn)(t||{})||e})]})}},32437(e,t,n){n.d(t,{A:()=>s});var i=n(274934),r=n(95032);const s=({domain:e})=>(0,i.jsx)(r.A,{variant:"inherit",isTruncated:!0,children:e})},968058(e,t,n){n.d(t,{A:()=>s});var i=n(274934),r=n(95032);const s=({ip:e})=>(0,i.jsx)(r.A,{variant:"inherit",isTruncated:!0,children:e})},361693(e,t,n){n.d(t,{A:()=>d});var i=n(274934),r=n(602086),s=n(95032),o=n(309130),a=n(625796),l=n(100978);const d=({region:e})=>{const t=(0,r.useMemo)(()=>a.Ay.find(t=>t.value===e),[e]);return t?(0,i.jsxs)(l.A,{alignItems:"center",gap:o.kc,children:[(0,i.jsx)(l.A,{width:16,height:16,padding:"2px",children:t.image()}),(0,i.jsx)(s.A,{variant:"inherit",isTruncated:!0,children:t.label})]}):null}},880080(e,t,n){n.d(t,{QK:()=>A,_O:()=>c,f9:()=>p,qj:()=>_});var i=n(860209),r=n(369670),s=n(430624),o=n(615428),a=n(76392),l=n(480010),d=n(551173);const _=20,c=[24,8,0,1,6,3,4,5,13,11,7,17],A={0:"COMMON_DPI_CATEGORIES_INSTANT_MESSAGING",1:"COMMON_DPI_CATEGORIES_P2P",3:"COMMON_DPI_CATEGORIES_FILE_TRANSFER",4:"COMMON_DPI_CATEGORIES_STREAMING_MEDIA",5:"COMMON_DPI_CATEGORIES_MAIL_AND_COLLABORATION",6:"COMMON_DPI_CATEGORIES_VOICE_OVER_IP",7:"COMMON_DPI_CATEGORIES_DATABASE",8:"COMMON_DPI_CATEGORIES_GAMES",9:"COMMON_DPI_CATEGORIES_NETWORK_MANAGEMENT",10:"COMMON_DPI_CATEGORIES_REMOTE_ACCESS_TERMINALS",11:"COMMON_DPI_CATEGORIES_BYPASS_PROXIES_AND_TUNNELS",12:"COMMON_DPI_CATEGORIES_STOCK_MARKET",13:"COMMON_DPI_CATEGORIES_WEB",14:"COMMON_DPI_CATEGORIES_SECURITY_UPDATE",15:"COMMON_DPI_CATEGORIES_WEB_IM",17:"COMMON_DPI_CATEGORIES_BUSINESS",23:"COMMON_DPI_CATEGORIES_PRIVATE_PROTOCOL",24:"COMMON_DPI_CATEGORIES_SOCIAL_NETWORK",255:"COMMON_DPI_CATEGORIES_UNKNOWN"},p=(e,t=!1)=>[{label:"COMMON_APP",value:d.Kl.APP,image:o.A},{label:"COMMON_APP_GROUP",value:d.Kl.APP_CATEGORY,image:l.A},{label:"COMMON_DOMAIN_NAME",value:d.Kl.DOMAIN,image:s.A},{label:"COMMON_IP_ADDRESS",value:d.Kl.IP,image:r.A},...e?[{label:"COMMON_REGION",value:d.Kl.REGION,image:a.A}]:[],{label:"COMMON_INTERNET",value:d.Kl.INTERNET,image:s.A},...t?[]:[{label:"COMMON_LOCAL_NETWORK",value:d.Kl.LOCAL_NETWORK,image:i.A}]]},737364(e,t,n){n.d(t,{A:()=>A});var i=n(274934),r=n(599110),s=n(309130),o=n(580988),a=n(100978),l=n(470070),d=n(421314),_=n(300626),c=n(174710);const A=({enabled:e,label:t,tooltipItems:n,neverShowListMarkers:A,limit:p=20,seeMoreCallback:E,isInteractive:I,title:N,showMatchOppositeIcon:m,listGap:u,iconProps:T})=>(0,i.jsxs)(a.A,{flex:1,overflow:"hidden",gap:s.YC,children:[m?(0,i.jsx)(o.A,{enabled:e}):null,(0,i.jsx)(_.A,{tooltip:(0,i.jsx)(c.A,{title:N,position:"top",isInteractive:Boolean(E)||I,items:n,showListMarkers:!A,maxItemCount:p,getItemKey:(e,t)=>t,renderItem:e=>e,listGap:u,renderShowMore:E?()=>(0,i.jsx)(r.A,{variant:"inline",onClick:E,children:(0,i.jsx)(l.sA,{id:"COMMON_SEE_MORE"})}):void 0,iconProps:T}),children:t?(0,i.jsx)(d.A,{color:e?"inherit":"disabled",children:t}):null})]})},174710(e,t,n){n.d(t,{A:()=>o});var i=n(274934),r=n(304151),s=n(158498);const o=function({items:e,getItemKey:t,renderItem:n,maxItemCount:o,renderShowMore:a,showListMarkers:l,title:d,position:_,isInteractive:c,cursorType:A,listGap:p,iconProps:E}){return(0,i.jsx)(r.A,{title:d,position:_,isInteractive:c,cursorType:A,description:(0,i.jsx)(s.A,{items:e,getItemKey:t,renderItem:n,maxItemCount:o,listGap:p,renderShowMore:a,showListMarkers:l}),iconProps:E})}},580988(e,t,n){n.d(t,{A:()=>d});var i=n(274934),r=n(125799),s=n(815879),o=n(309130),a=n(100978),l=n(470070);const d=({enabled:e})=>(0,i.jsx)(a.A,{opacity:e?void 0:o.xN,children:(0,i.jsx)(r.A,{description:(0,i.jsx)(l.sA,{id:"COMMON_MATCH_OPPOSITE"}),portal:!0,children:(0,i.jsx)(s.A,{size:"original"})})})},300626(e,t,n){n.d(t,{A:()=>o});var i=n(274934),r=n(309130),s=n(100978);const o=({children:e,tooltip:t})=>(0,i.jsxs)(s.A,{maxWidth:"100%",overflow:"hidden",gap:r.YC,alignItems:"center",children:[e?(0,i.jsx)(s.A,{flex:1,overflow:"hidden",children:e}):null,t]})},384783(e,t,n){n.d(t,{A:()=>o});var i=n(274934),r=n(832162),s=n(826600);const o=({children:e=null,hideModal:t,onRequestClose:n,portalSelector:o=s.J,forwardedRef:a=null,...l})=>(0,i.jsx)(r.A,{isOpen:!0,shouldCloseOnEsc:!0,onRequestClose:n||t,parentSelector:o,ref:a,...l,children:e})},826600(e,t,n){n.d(t,{J:()=>i,g:()=>r});const i=()=>document.getElementById("modal-container"),r=()=>document.getElementById("modal-settings-container")},419582(e,t,n){n.r(t),n.d(t,{default:()=>Nn});var i,r,s=n(274934),o=n(602086),a=n(977872),l=n(42220),d=n(436417),_=n(756782),c=n(100978),A=n(581814),p=n(794721),E=n(969288),I=n(762542),N=n(877840),m=n(897166),u=n(553732),T=n(205521),O=n(449339),S=n(309130),h=n(470070),x=n(871808),g=n(95857),C=n(197571),R=n(754924),v=n(330973),M=n(936069),f=n(258978);!function(e){e.OFF="off",e.IP="ip",e.DOMAIN="domain",e.REGION="region"}(i||(i={})),function(e){e.OFF="off",e.DEVICE="device",e.NETWORK="network"}(r||(r={}));var j=n(753959);const y=()=>(0,s.jsx)(j.A,{children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_WIZARD_INFO",values:{policyBasedRouteLink:(0,s.jsx)(h.sA,{id:"COMMON_POLICY_BASED_ROUTE"})}})});var D=n(360278),b=n(623568),L=n(556059),P=n(464920),w=n(700444),V=n(159469),G=n(164398),F=n(423564),U=n(742220),K=n(469057),k=n(115114),W=n(635891);const Y=({form:e})=>(0,s.jsx)(W.A,{label:(0,s.jsx)(h.sA,{id:"COMMON_NAME"}),control:e.control,name:"name"});var H,$,B,z,Q=n(325461),X=n(260334),J=n(59564),Z=n(149450),q=n(684780),ee=n(570866);!function(e){e[e.MIN=1]="MIN",e[e.MAX=65535]="MAX"}(H||(H={})),function(e){e.NEUTRAL="neutral06",e.SUCCESS="green06",e.WARNING="red06",e.REQUEST="orange06"}($||($={})),function(e){e.CONNECTING_LONGER_THAN_USUAL="CONNECTING_LONGER_THAN_USUAL",e.ROUTE_CONFLICT="ROUTE_CONFLICT",e.ADDRESS_CONFLICT="ADDRESS_CONFLICT",e.AUTHENTICATION_FAILURE="AUTHENTICATION_FAILURE",e.SERVER_REJECT="SERVER_REJECT",e.CONNECTION_FAILURE="CONNECTION_FAILURE",e.BAD_CONFIGURATION="BAD_CONFIGURATION",e.UNEXPECTED_DISCONNECT="UNEXPECTED_DISCONNECT",e.UNKNOWN="UNKNOWN"}(B||(B={})),function(e){e.CONFIGURATION_IS_EMPTY="CONFIGURATION_IS_EMPTY",e.MISSING_INTERFACE_SECTION="MISSING_INTERFACE_SECTION",e.MISSING_INTERFACE_PRIVATE_KEY="MISSING_PRIVATE_KEY",e.MISSING_INTERFACE_ADDRESS="MISSING_INTERFACE_ADDRESS",e.INVALID_INTERFACE_ADDRESS_COUNT="INVALID_INTERFACE_ADDRESS_COUNT",e.MISSING_PEER_SECTION="MISSING_PEER_SECTION",e.MISSING_PEER_ENDPOINT="MISSING_PEER_ENDPOINT",e.MISSING_PEER_PUBLIC_KEY="MISSING_PEER_PUBLIC_KEY",e.INVALID_PEER_ENDPOINT="INVALID_PEER_ENDPOINT",e.INVALID_PEER_ENDPOINT_IP_FQDN="INVALID_PEER_ENDPOINT_IP_FQDN",e.INVALID_PEER_ENDPOINT_PORT="INVALID_PEER_ENDPOINT_PORT",e.INVALID_INTERFACE_PRIVATE_KEY="INVALID_PRIVATE_KEY",e.INVALID_PEER_PUBLIC_KEY="INVALID_PUBLIC_KEY",e.INVALID_PEER_PRE_SHARED_KEY="INVALID_PRE_SHARED_KEY",e.INVALID_INTERFACE_DNS="INVALID_DNS",e.INVALID_INTERFACE_ADDRESS="INVALID_ADDRESS",e.NO_ERRORS="NO_ERRORS"}(z||(z={}));var te=n(199220);const ne=Q.Ay.object({name:Q.Ay.string(),content:Q.Ay.string()},{message:(0,X.rn)("SETTINGS_VALIDATION_CONFIGURATION_FILE")}),ie=Q.Ay.object({ip:Z.B,subnet:Q.Ay.coerce.number().min(0).max(32)}),re=Q.Ay.object({ip:te.XK,subnet:Q.Ay.coerce.number().min(0).max(128)}),se=Q.Ay.object({ip:Q.Ay.literal("").optional(),subnet:Q.Ay.any()}).optional().transform(()=>{}),oe=Q.Ay.object({ip:Q.Ay.literal("").optional(),subnet:Q.Ay.any()}).optional().transform(()=>{}),ae=e=>Q.Ay.object({name:Q.Ay.string().min(1).max(64),device_wizard:Q.Ay.union([Q.Ay.object({type:Q.Ay.literal(r.OFF)}),Q.Ay.object({type:Q.Ay.literal(r.NETWORK),networks:Q.Ay.array(Q.Ay.string(),{message:(0,X.rn)("COMMON_VALIDATION_NETWORK")}).min(1,(0,X.rn)("COMMON_VALIDATION_NETWORK"))}),Q.Ay.object({type:Q.Ay.literal(r.DEVICE),devices:Q.Ay.array(Q.Ay.string(),{message:(0,X.rn)("SETTINGS_COMMON_DEVICE_REQUIRED")}).min(1,(0,X.rn)("SETTINGS_COMMON_DEVICE_REQUIRED"))})]),content_wizard:Q.Ay.union([Q.Ay.object({type:Q.Ay.literal(i.OFF)}),Q.Ay.object({type:Q.Ay.literal(i.IP),ips:Q.Ay.array(Q.Ay.custom(),{message:(0,X.rn)("SETTINGS_VALIDATION_ADD_AT_LEAST_ONE",{target:(0,X.rn)("COMMON_IP")})}).min(1,(0,X.rn)("SETTINGS_VALIDATION_ADD_AT_LEAST_ONE",{target:(0,X.rn)("COMMON_IP")}))}),Q.Ay.object({type:Q.Ay.literal(i.DOMAIN),domains:Q.Ay.array(Q.Ay.string(),{message:(0,X.rn)("SETTINGS_ROUTING_QOS_DOMAINS_VALIDATION")}).min(1,(0,X.rn)("SETTINGS_ROUTING_QOS_DOMAINS_VALIDATION"))}),Q.Ay.object({type:Q.Ay.literal(i.REGION),regions:Q.Ay.array(Q.Ay.string(),{message:(0,X.rn)("SETTINGS_COMMON_REGION_REQUIRED")}).min(1,(0,X.rn)("SETTINGS_COMMON_REGION_REQUIRED"))})]),wizard_kill_switch_enabled:Q.Ay.boolean().optional(),mtu:Q.Ay.union([Q.Ay.object({type:Q.Ay.literal("auto")}),Q.Ay.object({type:Q.Ay.literal("custom"),value:Q.Ay.number().int().min(K.ir).max(K.g9)})]),mss_clamp:Q.Ay.union([Q.Ay.object({type:Q.Ay.literal(A.dY.AUTO)}),Q.Ay.object({type:Q.Ay.literal(A.dY.OFF)}),Q.Ay.object({type:Q.Ay.literal(A.dY.CUSTOM),value:Q.Ay.number().int().min(K.x1).max(K.do)})]),mss_clamp_ipv6:Q.Ay.union([Q.Ay.object({type:Q.Ay.literal(A.dY.AUTO)}),Q.Ay.object({type:Q.Ay.literal(A.dY.OFF)}),Q.Ay.object({type:Q.Ay.literal(A.dY.CUSTOM),value:Q.Ay.number().int().min(K.$L).max(K.do)})])}).and(Q.Ay.union([Q.Ay.object({vpn_type:Q.Ay.literal(p.E.OPENVPN_CLIENT),openvpn_configuration_file:ne,openvpn_username:Q.Ay.string().min(1,(0,X.rn)("COMMON_VALIDATION_REQUIRED",{name:(0,X.rn)("COMMON_LABEL_USERNAME")})),openvpn_password:Q.Ay.string().min(1,(0,X.rn)("COMMON_VALIDATION_REQUIRED",{name:(0,X.rn)("COMMON_PASSWORD")}))}),Q.Ay.intersection(Q.Ay.object({vpn_type:Q.Ay.literal(p.E.WIREGUARD_CLIENT)}),Q.Ay.union([Q.Ay.object({setup_mode:Q.Ay.literal(A.hS.FILE),wireguard_configuration_file:ne}),Q.Ay.object({setup_mode:Q.Ay.literal(A.hS.MANUAL),dhcpd_dns_1:e?J.Z:Z.B,dhcpd_dns_2:(e?J.Z:Z.B).or(Q.Ay.literal("")).optional().transform(e=>e||void 0),wireguard_private_key:Q.Ay.string({message:(0,X.rn)("SETTINGS_NETWORKS_FORM_VPN_CLIENT_PRIVATE_PUBLIC_KEYS_VALIDATION")}).refine(q.c,{message:(0,X.rn)("SETTINGS_NETWORKS_FORM_VPN_CLIENT_PRIVATE_PUBLIC_KEYS_VALIDATION")}),wireguard_public_key:Q.Ay.string(),wireguard_client_peer_ip:Q.Ay.string({message:(0,X.rn)(e?"SETTINGS_NETWORKS_FORM_VPN_CLIENT_SERVER_ADDRESS_VALIDATION_IPV6":"SETTINGS_NETWORKS_FORM_VPN_CLIENT_SERVER_ADDRESS_VALIDATION")}).regex(e?ee.L3:ee.vz,{message:(0,X.rn)(e?"SETTINGS_NETWORKS_FORM_VPN_CLIENT_SERVER_ADDRESS_VALIDATION_IPV6":"SETTINGS_NETWORKS_FORM_VPN_CLIENT_SERVER_ADDRESS_VALIDATION")}),wireguard_client_peer_port:Q.Ay.coerce.number({message:(0,X.rn)("SETTINGS_COMMON_PORT_VALIDATION")}).min(H.MIN,{message:(0,X.rn)("SETTINGS_COMMON_PORT_VALIDATION")}).max(H.MAX,{message:(0,X.rn)("SETTINGS_COMMON_PORT_VALIDATION")}),wireguard_client_peer_public_key:Q.Ay.string({message:(0,X.rn)("SETTINGS_NETWORKS_FORM_VPN_CLIENT_KEY_VALIDATION")}).refine(q.c,{message:(0,X.rn)("SETTINGS_NETWORKS_FORM_VPN_CLIENT_KEY_VALIDATION")}),wireguard_client_preshared_key:Q.Ay.union([Q.Ay.object({enabled:Q.Ay.literal(!1)}),Q.Ay.object({enabled:Q.Ay.literal(!0),value:Q.Ay.string({message:(0,X.rn)("SETTINGS_NETWORKS_FORM_VPN_CLIENT_KEY_VALIDATION")}).refine(q.c,{message:(0,X.rn)("SETTINGS_NETWORKS_FORM_VPN_CLIENT_KEY_VALIDATION")})})])}).and(e?Q.Ay.object({ip_subnet:ie.or(se),ipv6_subnet:re.or(oe)}).refine(e=>e.ip_subnet||e.ipv6_subnet,{path:["ip_subnet","ip"],message:(0,X.rn)("COMMON_VALIDATION_VALID_IPV4")}):Q.Ay.object({ip_subnet:ie}))]))])).superRefine((e,t)=>{"custom"===e.mtu.type&&(e.mtu.value<K.Bw&&(e.mss_clamp.type===A.dY.CUSTOM||e.mss_clamp.type===A.dY.AUTO)&&t.addIssue({code:Q.Ay.ZodIssueCode.custom,message:(0,X.rn)("SETTINGS_NETWORKS_FORM_FIELD_MTU_MIN_MSS_VALIDATION",{minMtu:K.Bw}),path:["mtu","value"]}),e.mss_clamp.type===A.dY.CUSTOM&&e.mss_clamp.value>e.mtu.value-K.SU&&t.addIssue({code:Q.Ay.ZodIssueCode.custom,message:(0,X.rn)("SETTINGS_NETWORKS_FORM_FIELD_MTU_MSS_VALIDATION_MAX",{maxMss:e.mtu.value-K.SU}),path:["mss_clamp","value"]}))}).superRefine((e,t)=>{"custom"===e.mtu.type&&e.mss_clamp_ipv6.type===A.dY.CUSTOM&&e.mss_clamp_ipv6.value>e.mtu.value-K.eI&&t.addIssue({code:Q.Ay.ZodIssueCode.custom,message:(0,X.rn)("SETTINGS_NETWORKS_FORM_FIELD_MTU_MSS_VALIDATION_MAX",{maxMss:e.mtu.value-K.eI}),path:["mss_clamp_ipv6","value"]})});var le=n(213981);const de=(e,t,n)=>{switch(e){case p.E.WIREGUARD_CLIENT:{const e=t.filter(({vpn_type:e})=>e===p.E.WIREGUARD_CLIENT).length;return n({id:"SETTINGS_NETWORKS_VPN_CLIENT_NAME"},{vpnClient:A.PG.WIREGUARD,clientsCount:e>0?e+1:1})}case p.E.OPENVPN_CLIENT:{const e=t.filter(({vpn_type:e})=>e===p.E.OPENVPN_CLIENT).length;return n({id:"SETTINGS_NETWORKS_VPN_CLIENT_NAME"},{vpnClient:A.PG.OPENVPN,clientsCount:e>0?e+1:1})}default:return n({id:"SETTINGS_NETWORKS_VPN_CLIENT_NAME"},{vpnClient:"",clientsCount:null})}},_e=(e,t,n,s,o)=>{const a=e?.vpn_type===p.E.WIREGUARD_CLIENT||e?.vpn_type===p.E.OPENVPN_CLIENT?e.vpn_type:t?p.E.WIREGUARD_CLIENT:p.E.OPENVPN_CLIENT,l=(0,le.yi)(e?.x_wireguard_private_key);return{vpn_type:a,name:e?.name||(e?"":de(a,s,o)),ip_subnet:{ip:e?.ip_subnet?e.ip_subnet.split("/")[0]:"",subnet:Number(e?.ip_subnet?.split("/")[1]||U.NS)},ipv6_subnet:{ip:e?.ipv6_subnet?e.ipv6_subnet.split("/")[0]:"",subnet:Number(e?.ipv6_subnet?.split("/")[1]||U.Vd)},dhcpd_dns_1:e?.dhcpd_dns_1||"",dhcpd_dns_2:e?.dhcpd_dns_2||"",openvpn_configuration_file:e?.openvpn_configuration?{content:e.openvpn_configuration,name:e?.openvpn_configuration_filename||"config.ovpn"}:void 0,openvpn_password:e?.x_openvpn_password||"",openvpn_username:e?.openvpn_username||"",setup_mode:e?.wireguard_client_mode??A.hS.FILE,wireguard_configuration_file:e?.wireguard_client_configuration_file?{content:e.wireguard_client_configuration_file,name:e?.wireguard_client_configuration_filename||"config.conf"}:void 0,wireguard_private_key:e?.x_wireguard_private_key||l.privateKey,wireguard_public_key:e?.wireguard_public_key||l.publicKey,wireguard_client_preshared_key:{enabled:!!e?.wireguard_client_preshared_key_enabled,value:e?.wireguard_client_preshared_key||""},wireguard_client_peer_ip:e?.wireguard_client_peer_ip||"",wireguard_client_peer_port:e?.wireguard_client_peer_port||51821,wireguard_client_peer_public_key:e?.wireguard_client_peer_public_key||"",device_wizard:{type:r.OFF,networks:[],devices:[]},content_wizard:{type:i.OFF,regions:[],domains:[],ips:[]},wizard_kill_switch_enabled:n,mtu:{type:e?.interface_mtu_enabled?"custom":"auto",value:e?.interface_mtu??K.vY},mss_clamp:{type:e?.mss_clamp??A.dY.AUTO,value:e?.mss_clamp_mss??K.ow},mss_clamp_ipv6:{type:e?.mss_clamp_ipv6??A.dY.AUTO,value:e?.mss_clamp_mss_ipv6??K.Wx}}};var ce=n(597750),Ae=n(164487),pe=n(787481),Ee=n(482609),Ie=n(846294);const Ne={[p.E.OPENVPN_CLIENT]:"COMMON_OPEN_VPN",[p.E.WIREGUARD_CLIENT]:"COMMON_WIREGUARD"},me=({form:e,existingRecord:t})=>{const{formatMessage:n}=(0,h.tz)(),i=(0,a.d4)(C.Ct),r=(0,x.A)(g.Xj.WIREGUARD_VPN_CLIENT),d=(0,o.useMemo)(()=>[...r?[p.E.WIREGUARD_CLIENT]:[],p.E.OPENVPN_CLIENT],[r]),_=(0,l.FH)({control:e.control,name:"vpn_type"});return(0,s.jsx)(ce.A,{label:(0,s.jsx)(Ae.A,{children:(0,s.jsx)(h.sA,{id:"COMMON_TYPE"})}),children:(0,s.jsx)(pe.A,{children:d.map(r=>(0,s.jsx)(Ie.A,{reason:t&&_!==r?(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_CANNOT_CHANGE_TYPE"}):void 0,children:(0,s.jsx)(Ee.A,{control:e.control,name:"vpn_type",value:r,onCheck:()=>{t||e.getFieldState("name")?.isDirty||e.setValue("name",de(r,i,n))},children:(0,s.jsx)(h.sA,{id:Ne[r]})})},r))})})},ue=({form:e})=>(0,s.jsx)(ce.A,{label:(0,s.jsx)(Ae.A,{children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_SETUP"})}),children:(0,s.jsxs)(pe.A,{children:[(0,s.jsx)(Ee.A,{name:"setup_mode",control:e.control,value:A.hS.FILE,children:(0,s.jsx)(h.sA,{id:"COMMON_FILE"})}),(0,s.jsx)(Ee.A,{name:"setup_mode",control:e.control,value:A.hS.MANUAL,children:(0,s.jsx)(h.sA,{id:"COMMON_MANUAL"})})]})});var Te=n(954702),Oe=n(938984),Se=n(95032),he=n(765414),xe=n(247816),ge=n(471567),Ce=n(135640),Re=n(104669),ve=n(833466),Me=n(304151),fe=n(296261),je=n(901389),ye=n(793442),De=n(726831),be=n(565545),Le=n(875762);const Pe=e=>ee.fg.test(e),we=e=>ee.vS.test(e),Ve=e=>ee.zF.test(e),Ge=e=>ee.BY.test(e),Fe=e=>ee.wK.test(e),Ue=e=>ee.U_.test(e),Ke=e=>{const t=Number(e);return t>=H.MIN&&t<=H.MAX};var ke=n(927728),We=n(541496),Ye=n(204832);const He=e=>e.length>0,$e=({form:e})=>{const t=(0,x.A)(g.Xj.WIREGUARD_IPV6_SUPPORT),n=(0,l.FH)({control:e.control,name:"wireguard_configuration_file"}),i=(0,l.FH)({control:e.control,name:"openvpn_configuration_file"}),r=(0,l.FH)({control:e.control,name:"vpn_type"}),a=(0,l.FH)({control:e.control,name:"setup_mode"}),d=(0,o.useMemo)(()=>r===p.E.WIREGUARD_CLIENT&&a===A.hS.FILE?((e,t,n)=>{const i=(0,Le.G)(e),r=(0,q.c)(i.interface.privateKey),s=(0,q.c)(i.peer.publicKey),o=(0,q.c)(i.peer.preSharedKey),a=(n?Ge:Ve)(i.interface.dns[0]),l=i.peer.endpoint,d=l&&(n?we:Pe)(l.address),_=l&&Ke(l.port),c=n?Ue:Fe,A=i.interface.address.map(e=>`${e.ip}/${e.subnet}`),p=n?A.length&&A.length<=2&&A.every(c):1===A.length&&c(A[0]),E=!n||A.filter(e=>ee.QD.test(e)).length<=1&&A.filter(e=>ee.wK.test(e)).length<=1;return t?e?i.interface.address.length||""!==i.interface.privateKey?i.interface.address.length?p?E?i.interface.privateKey?r?a?i.peer.endpoint?.address||i.peer.publicKey?i.peer.endpoint?.address?d||_?d?_?i.peer.publicKey?s?i.peer.preSharedKey&&!o?z.INVALID_PEER_PRE_SHARED_KEY:z.NO_ERRORS:z.INVALID_PEER_PUBLIC_KEY:z.MISSING_PEER_PUBLIC_KEY:z.INVALID_PEER_ENDPOINT_PORT:z.INVALID_PEER_ENDPOINT_IP_FQDN:z.INVALID_PEER_ENDPOINT:z.MISSING_PEER_ENDPOINT:z.MISSING_PEER_SECTION:z.INVALID_INTERFACE_DNS:z.INVALID_INTERFACE_PRIVATE_KEY:z.MISSING_INTERFACE_PRIVATE_KEY:z.INVALID_INTERFACE_ADDRESS_COUNT:z.INVALID_INTERFACE_ADDRESS:z.MISSING_INTERFACE_ADDRESS:z.MISSING_INTERFACE_SECTION:z.CONFIGURATION_IS_EMPTY:z.NO_ERRORS})(n?.content,n?.name,t):z.NO_ERRORS,[t,a,r,n]),_=(0,o.useMemo)(()=>r===p.E.OPENVPN_CLIENT?((e,t)=>{const{certificate_ca:n,certificate_cert:i,vpnKey:r,privateKey:s,encryptedPrivateKey:o}=(0,Ye.y)(e),a=He(n),l=He(i)&&a,d=U.tZ.test(s),_=(e=>U.cU.test(e))(r);return t?e?n||r?o?We.T7.HAS_ENCRYPTED_PRIVATE_KEY:!n||r||s||i?r&&n&&!s&&!i?a?_?We.T7.NO_ERRORS:We.T7.INVALID_STATIC_KEY:We.T7.INVALID_CERTFICATE:s&&n&&i&&!r?l?d?We.T7.NO_ERRORS:We.T7.INVALID_PRIVATE_KEY:We.T7.INVALID_CERTFICATE:n&&i&&r&&s?l?_?d?We.T7.NO_ERRORS:We.T7.INVALID_PRIVATE_KEY:We.T7.INVALID_STATIC_KEY:We.T7.INVALID_CERTFICATE:l?d?We.T7.NO_ERRORS:We.T7.INVALID_PRIVATE_KEY:We.T7.INVALID_CERTFICATE:a?We.T7.NO_ERRORS:We.T7.INVALID_CERTFICATE:We.T7.MISSING_KEYS:We.T7.CONFIGURATION_IS_EMPTY:We.T7.NO_ERRORS})(i?.content,i?.name):We.T7.NO_ERRORS,[i,r]);return(0,s.jsx)(s.Fragment,{children:_!==We.T7.NO_ERRORS?(0,s.jsx)(je.A,{children:(0,s.jsx)(h.sA,{id:U.xH[_],values:{link:(0,s.jsx)(ye.A,{href:De.A.openVpnClientSetupGuide,id:"COMMON_LEARN_MORE",noWrap:!0})}})}):d!==z.NO_ERRORS?(0,s.jsxs)(je.A,{children:[(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_WG_CONFIG_IS_INVALID",values:{link:(0,s.jsx)(ye.A,{href:De.A.wireGuardClientSetupGuide,id:"COMMON_LEARN_MORE",noWrap:!0})}}),(0,s.jsx)(ke.A,{children:(0,s.jsx)("li",{children:(0,s.jsx)(h.sA,{id:(t?U.H9:U.xy)[d],values:{b:h.b}})})})]}):null})},Be=(0,xe.A)(he.A)`
  max-width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
`,ze=/^MTU\s*=\s*(\d+)/m,Qe=({form:e})=>{const t=(0,l.FH)({control:e.control,name:"vpn_type"}),n=(0,X.L_)(),i=(0,l.as)({control:e.control,name:t===p.E.WIREGUARD_CLIENT?"wireguard_configuration_file":"openvpn_configuration_file"}),r=(0,o.useCallback)(async(t,n)=>{const r=n&&"current"in n?n.current?.files?.[0]:void 0;if(r){const t=await(0,fe.Gu)(r),n=(e=>{try{if(!e)return;const t=e.toString().match(ze);if(t&&t.length>=2){const e=Number(t[1]);if(Number.isFinite(e))return e}return}catch{return}})(t);i.field.onChange({name:r.name,content:t}),n&&e.setValue("mtu",{type:"custom",value:n})}},[i.field,e]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ce.A,{children:[(0,s.jsxs)(c.A,{height:ve.b,alignItems:"center",maxWidth:"100%",overflow:"hidden",gap:S.YC,children:[(0,s.jsx)(c.A,{overflow:"hidden",children:(0,s.jsx)(Be,{accept:t===p.E.WIREGUARD_CLIENT?U.MG:U.Ex,onClick:e=>e.currentTarget.value="",onChange:r,children:(0,s.jsx)(Te.A,{fontSize:"medium",style:{maxWidth:"100%"},onClick:e=>e.currentTarget.parentNode?.parentNode?.childNodes[0]?.click(),children:(0,s.jsxs)(c.A,{alignItems:"center",gap:S.YC,maxWidth:"100%",overflow:"hidden",children:[(0,s.jsx)(i.field.value?ge.A:Ce.A,{size:"original",isActive:!0}),(0,s.jsx)(Se.A,{isTruncated:!0,variant:"inherit",children:i.field.value?i.field.value.name:(0,s.jsx)(h.sA,{id:"SETTINGS_UPLOAD_CONFIGURATION_FILE"})})]})})})}),(0,s.jsx)(Me.A,{description:(0,s.jsx)(c.A,{flexDirection:"column",gap:S.kc,children:(0,s.jsxs)(s.Fragment,t===p.E.OPENVPN_CLIENT?{children:[(0,s.jsx)(Oe.A,{variant:"inherit",children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_OPENVPN_CONFIGURATION_FILE_DESC"})}),(0,s.jsx)(Oe.A,{variant:"inherit",children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_OPENVPN_CONFIGURATION_FILE_DESC_PART_TWO"})})]}:{children:[(0,s.jsx)(Oe.A,{variant:"inherit",children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_WIREGUARD_CONFIGURATION_FILE_DESC"})}),(0,s.jsx)(Oe.A,{variant:"inherit",children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_WIREGUARD_CONFIGURATION_FILE_DESC_PART_TWO"})})]})})})]}),i.fieldState.error?.message?(0,s.jsx)(Re.A,{isInvalid:!0,label:n(i.fieldState.error.message)}):void 0]}),(0,s.jsx)($e,{form:e})]})};var Xe=n(831433),Je=n(34118),Ze=n(656647),qe=n(650632);const et={[r.OFF]:"COMMON_OFF",[r.DEVICE]:"COMMON_DEVICE",[r.NETWORK]:"COMMON_NETWORK"},tt=[r.OFF,r.DEVICE,r.NETWORK],nt=({form:e})=>{const t=(0,a.d4)(C.Ct),n=(0,a.d4)(Je.GB),i=(0,o.useMemo)(()=>t.filter(G.mH).map(e=>({type:"CHECKBOX",id:e._id,title:e.name,children:[],checkboxProps:{data:(0,F.mC)(e)}})),[t]),d=(0,o.useMemo)(()=>n.flatMap(e=>"mac"in e?[{type:"CHECKBOX",id:e.mac,title:(0,Xe.tn)(e)||e.mac,children:[],checkboxProps:{data:e.mac,symbol:(0,s.jsx)(c.A,{maxWidth:20,maxHeight:20,children:(0,s.jsx)(qe.A,{client:e})})}}]:[]),[n]),_=(0,l.FH)({control:e.control,name:"device_wizard.type"});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ce.A,{label:(0,s.jsx)(Ae.A,{tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_DEVICE_WIZARD_TOOLTIP"}),children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_DEVICE_WIZARD"})}),children:(0,s.jsx)(pe.A,{children:tt.map(t=>(0,s.jsx)(Ee.A,{control:e.control,name:"device_wizard.type",value:t,children:(0,s.jsx)(h.sA,{id:et[t]})},t))})}),_===r.DEVICE?(0,s.jsx)(Ze.A,{control:e.control,name:"device_wizard.devices",options:d,isVirtualized:!0}):null,_===r.NETWORK?(0,s.jsx)(Ze.A,{control:e.control,name:"device_wizard.networks",options:i}):null]})};var it=n(858098),rt=n(198301),st=n(598890);const ot={[i.OFF]:"COMMON_OFF",[i.IP]:"COMMON_IP",[i.DOMAIN]:"COMMON_DOMAIN",[i.REGION]:"COMMON_REGION"},at=[i.OFF,i.DOMAIN,i.IP,i.REGION],lt=({form:e})=>{const{formatMessage:t}=(0,h.tz)(),n=(0,l.FH)({control:e.control,name:"content_wizard.type"}),r=(0,X.L_)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ce.A,{label:(0,s.jsx)(Ae.A,{tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CONTENT_WIZARD_TOOLTIP"}),children:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CONTENT_WIZARD"})}),children:(0,s.jsx)(pe.A,{children:at.map(t=>(0,s.jsx)(Ee.A,{control:e.control,name:"content_wizard.type",value:t,children:(0,s.jsx)(h.sA,{id:ot[t]})},t))})}),n===i.DOMAIN?(0,s.jsx)(it.A,{form:e,name:"content_wizard.domains",fieldLabel:"COMMON_DOMAIN_NAME",modalTitle:(0,s.jsx)(h.sA,{id:"SETTINGS_ADD_MULTIPLE_DOMAINS"}),modalFieldPlaceholder:t({id:"SETTINGS_ADD_MULTIPLE_DOMAINS_PLACEHOLDER"}),itemSchema:Q.Ay.string().regex(ee.Eg,t({id:"COMMON_DOMAIN_VALIDATION"})),placeholder:t({id:"SETTINGS_SECURITY_DOMAINS_PLACEHOLDER"}),getDuplicationMessage:()=>t({id:"SETTINGS_SECURITY_DOMAINS_VALIDATION"})}):null,n===i.IP?(0,s.jsx)(l.xI,{control:e.control,name:"content_wizard.ips",render:({field:e,fieldState:t,formState:n})=>(0,s.jsx)(rt.f,{value:e.value||[],onChange:t=>e.onChange(t),invalid:t.invalid?r((0,l.Jt)(n.errors,e.name)?.message)||!0:void 0})}):null,n===i.REGION?(0,s.jsx)(st.A,{form:e,name:"content_wizard.regions"}):null]})};var dt=n(796091),_t=n(625133);const ct=({form:e})=>(0,s.jsx)(dt.A,{children:(0,s.jsx)(_t.A,{control:e.control,name:"wizard_kill_switch_enabled",tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_KILL_SWITCH_TOOLTIP"}),children:(0,s.jsx)(h.sA,{id:"COMMON_KILL_SWITCH"})})});var At=n(581659),pt=n(421314),Et=n(547967),It=n(897688),Nt=n(895983),mt=n(297640),ut=n(811138),Tt=n(668663),Ot=n(883748);const St=({item:e})=>e.target_devices?.[0]?.type===L.Q.ALL_CLIENTS?(0,s.jsx)(It.A,{isDisabled:!e.enabled,children:(0,s.jsx)(h.sA,{id:"COMMON_ANY"})}):(0,s.jsxs)(c.A,{gap:S.YC,maxWidth:"100%",children:[e.target_devices.slice(0,1).map(({type:t,network_id:n,client_mac:i})=>{switch(t){case L.Q.NETWORK:return(0,s.jsx)(Tt.A,{enabled:e.enabled,id:n},n);case L.Q.CLIENT:return(0,s.jsx)(Ot.A,{enabled:e.enabled,mac:i},i);default:return null}}),e.target_devices.length>1?(0,s.jsx)(ut.A,{enabled:e.enabled,items:e.target_devices.slice(1),getItemKey:e=>`${e.network_id}${e.client_mac}`,renderItem:e=>{switch(e.type){case L.Q.NETWORK:return(0,s.jsx)(Nt.A,{id:e.network_id},e.network_id);case L.Q.CLIENT:return(0,s.jsx)(mt.A,{mac:e.client_mac},e.client_mac);default:return null}}}):null]});var ht=n(998948),xt=n(361693),gt=n(968058),Ct=n(32437),Rt=n(185669),vt=n(603542),Mt=n(583821),ft=n(635187);const jt=e=>[...(e.ports||[]).map(e=>String(e)),...(e.port_ranges||[]).map(({port_start:e,port_stop:t})=>`${e}${ft.jr}${t}`)].filter(Boolean).join(ft.KE),yt=({item:e})=>{if(e.matching_target===f.d.INTERNET)return(0,s.jsx)(Oe.A,{color:e.enabled?"inherit":"disabled",children:(0,s.jsx)(h.sA,{id:"COMMON_ANY"})});if(e.matching_target===f.d.REGION){const t=e.regions.flatMap(e=>ht.A.find(t=>t.countryCode===e));return(0,s.jsxs)(c.A,{gap:S.YC,maxWidth:"100%",children:[t?.slice(0,1).map(t=>(0,s.jsx)(Rt.A,{enabled:e.enabled,region:t.countryCode,children:(0,s.jsx)(pt.A,{children:t.countryName})},t.countryCode)),t.length>1?(0,s.jsx)(ut.A,{enabled:e.enabled,items:t.slice(1),getItemKey:({countryCode:e})=>e,renderItem:({countryCode:e})=>(0,s.jsx)(xt.A,{region:e})}):null]})}if(e.matching_target===f.d.DOMAIN){const t=[...(e.domains||[]).map(({domain:e,port_ranges:t,ports:n})=>[e,jt({ports:n,port_ranges:t})].filter(Boolean).join(ft.oH))];return(0,s.jsxs)(c.A,{gap:S.YC,maxWidth:"100%",children:[t?.slice(0,1).map(t=>(0,s.jsx)(Mt.A,{domain:t,enabled:e.enabled},t)),t.length>1?(0,s.jsx)(ut.A,{enabled:e.enabled,items:t.slice(1),getItemKey:e=>e,renderItem:e=>(0,s.jsx)(Ct.A,{domain:e})}):null]})}if(e.matching_target===f.d.IP){const t=[...(e.ip_addresses||[]).map(e=>[e.ip_or_subnet,jt(e)].filter(Boolean).join(ft.oH)),...(e.ip_ranges||[]).map(e=>[e.ip_start,e.ip_stop].filter(Boolean).join(ft.jr))];return(0,s.jsxs)(c.A,{gap:S.YC,maxWidth:"100%",children:[t.slice(0,1).map(t=>(0,s.jsx)(vt.A,{ip:t,enabled:e.enabled},t)),t.length>1?(0,s.jsx)(ut.A,{items:t.slice(1),getItemKey:e=>e,renderItem:e=>(0,s.jsx)(gt.A,{ip:e})}):null]})}return(0,s.jsx)(Oe.A,{color:e.enabled?"inherit":"disabled",children:(0,s.jsx)(h.sA,{id:"COMMON_FALLBACK"})})},Dt=[{id:"description",label:(0,s.jsx)(h.sA,{id:"COMMON_NAME"}),renderCell:e=>(0,s.jsx)(pt.A,{color:e.enabled?"inherit":"disabled",children:e.description})},{id:"target_devices",label:(0,s.jsx)(h.sA,{id:"COMMON_SOURCE"}),renderCell:e=>(0,s.jsx)(St,{item:e})},{id:"matching_target",label:(0,s.jsx)(h.sA,{id:"COMMON_DESTINATION"}),renderCell:e=>(0,s.jsx)(yt,{item:e})}],bt=({associatedTrafficRoutes:e})=>{const t=(0,a.wA)();return(0,s.jsx)(_.A,{title:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_ASSOCIATED_POLICIES"}),children:(0,s.jsx)(Et.AC,{isWindowsTable:!0,rows:e.length,marginTop:"none",children:(0,s.jsx)(At.A,{rowHeight:ve.b,idField:"_id",hideCellOverflow:!0,disableColumnFilters:!0,onRowClick:({_id:e})=>t((0,T.XP)({type:O.H.POLICY_BASED_ROUTE,id:e})),columns:Dt,items:e})})})},Lt=({form:e})=>(0,s.jsx)(W.A,{control:e.control,name:"openvpn_username",label:(0,s.jsx)(h.sA,{id:"COMMON_LABEL_USERNAME"}),tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_VPN_CLIENT_USERNAME_PASSWORD_DESC"})}),Pt=({form:e})=>(0,s.jsx)(W.A,{control:e.control,name:"openvpn_password",label:(0,s.jsx)(h.sA,{id:"COMMON_PASSWORD"}),tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_VPN_CLIENT_USERNAME_PASSWORD_DESC"}),type:"password",passwordToggle:!0}),wt=({form:e})=>(0,s.jsx)(W.A,{control:e.control,name:"wireguard_private_key",autoComplete:"new-password",type:"password",passwordToggle:!0,label:(0,s.jsx)(h.sA,{id:"COMMON_PRIVATE_KEY"}),tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_PRIVATE_KEY_CLIENT_DESC"}),onAfterChange:()=>{e.setValue("wireguard_public_key",(0,le.yi)(e.getValues("wireguard_private_key")).publicKey||e.getValues("wireguard_public_key"),{shouldTouch:!0,shouldDirty:!0,shouldValidate:!0})}});var Vt=n(465615);const Gt=({form:e})=>{const t=(0,l.FH)({control:e.control,name:"wireguard_public_key"});return(0,s.jsx)(N.A,{isDisabled:!0,children:(0,s.jsx)(W.A,{control:e.control,name:"wireguard_public_key",autoComplete:"new-password",type:"password",passwordToggle:!0,contentAfter:t?(0,s.jsx)(Vt.A,{link:t,variant:"secondary"}):null,label:(0,s.jsx)(h.sA,{id:"COMMON_PUBLIC_KEY"}),tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_PUBLIC_KEY_CLIENT_DESC"})})})};var Ft=n(477909),Ut=n(89469),Kt=n(689941);const kt=(0,Ft.A)(U.pY,U.Jn+1).reverse().map(e=>({label:e.toString(),value:e})),Wt=(0,Ft.A)(U.Rd,U.rn+1).reverse().map(e=>({label:e.toString(),value:e})),Yt=({form:e})=>{const t=(0,x.A)(g.Xj.WIREGUARD_IPV6_SUPPORT),{formatMessage:n}=(0,h.tz)();return(0,s.jsx)(ce.A,{gap:S.kc,label:(0,s.jsxs)(c.A,{gap:S.YC,paddingTop:S.YC,children:[(0,s.jsx)(Se.A,{variant:"heading-medium",children:(0,s.jsx)(h.sA,{id:"COMMON_TUNNEL_IP"})}),(0,s.jsx)(Me.A,{description:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_TUNNEL_IP_DESC"}),portal:!0})]}),children:(0,s.jsxs)(Ut.A,{children:[(0,s.jsxs)(c.A,{gap:S.kc,alignItems:"flex-start",children:[(0,s.jsx)(c.A,{flex:2,children:(0,s.jsx)(W.A,{control:e.control,name:"ip_subnet.ip",placeholder:n({id:"COMMON_IPV4_ADDRESS"}),label:(0,s.jsx)(h.sA,{id:"COMMON_IPV4_ADDRESS"}),onBlur:()=>e.trigger("ipv6_subnet")})}),(0,s.jsx)(c.A,{flex:1,children:(0,s.jsx)(Kt.A,{label:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_NETMASK"}),control:e.control,name:"ip_subnet.subnet",options:kt,searchable:!0,onAfterChange:()=>e.trigger("ipv6_subnet")})})]}),t?(0,s.jsxs)(c.A,{gap:S.kc,alignItems:"flex-start",children:[(0,s.jsx)(c.A,{flex:2,children:(0,s.jsx)(W.A,{control:e.control,name:"ipv6_subnet.ip",placeholder:n({id:"COMMON_IPV6_ADDRESS"}),label:(0,s.jsx)(h.sA,{id:"COMMON_IPV6_ADDRESS"}),onBlur:()=>e.trigger("ip_subnet")})}),(0,s.jsx)(c.A,{flex:1,children:(0,s.jsx)(Kt.A,{label:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_NETMASK"}),control:e.control,name:"ipv6_subnet.subnet",options:Wt,searchable:!0,onAfterChange:()=>e.trigger("ip_subnet")})})]}):null]})})};var Ht=n(16805);const $t=({form:e})=>{const{formatMessage:t}=(0,h.tz)(),n=(0,x.A)(g.Xj.WIREGUARD_IPV6_SUPPORT);return(0,s.jsx)(ce.A,{gap:S.kc,label:(0,s.jsxs)(c.A,{gap:S.YC,children:[(0,s.jsx)(Se.A,{variant:"heading-medium",children:(0,s.jsx)(h.sA,{id:"COMMON_SERVER_ADDRESS"})}),(0,s.jsx)(Me.A,{description:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_VPN_PUBLIC_IP_CLIENT_DESC"}),portal:!0})]}),children:(0,s.jsxs)(c.A,{gap:S.kc,alignItems:"flex-start",children:[(0,s.jsx)(c.A,{flex:2,children:(0,s.jsx)(W.A,{control:e.control,name:"wireguard_client_peer_ip",placeholder:t({id:n?"COMMON_IPV4_IPV6_ADDRESS_HOSTNAME":"COMMON_IPV4_ADDRESS_HOSTNAME"}),label:(0,s.jsx)(h.sA,{id:"COMMON_IP_HOSTNAME"})})}),(0,s.jsx)(c.A,{flex:1,children:(0,s.jsx)(Ht.A,{label:(0,s.jsx)(h.sA,{id:"COMMON_PORT"}),control:e.control,name:"wireguard_client_peer_port",min:H.MIN,max:H.MAX})})]})})},Bt=({form:e})=>{const t=(0,l.FH)({control:e.control,name:"wireguard_client_peer_public_key"});return(0,s.jsx)(W.A,{control:e.control,name:"wireguard_client_peer_public_key",autoComplete:"new-password",type:"password",passwordToggle:!0,contentAfter:t?(0,s.jsx)(Vt.A,{link:t,variant:"secondary"}):null,label:(0,s.jsx)(h.sA,{id:"COMMON_PUBLIC_SERVER_KEY"}),tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_PUBLIC_SERVER_KEY_DESC"})})},zt=({form:e})=>{const t=(0,l.FH)({control:e.control,name:"wireguard_client_preshared_key.enabled"});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(dt.A,{children:(0,s.jsx)(_t.A,{tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_PUBLIC_PRE_SHARED_KEY_DESC"}),control:e.control,name:"wireguard_client_preshared_key.enabled",onToggle:t=>{t&&!e.getValues("wireguard_client_preshared_key.value")&&e.setValue("wireguard_client_preshared_key.value",(0,le.$g)(),{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),t||e.setValue("wireguard_client_preshared_key.value","")},children:(0,s.jsx)(h.sA,{id:"COMMON_PRE_SHARED_KEY"})})}),t?(0,s.jsx)(W.A,{control:e.control,name:"wireguard_client_preshared_key.value"}):null]})},Qt=({form:e})=>{const t=(0,x.A)(g.Xj.WIREGUARD_IPV6_SUPPORT),{formatMessage:n}=(0,h.tz)();return(0,s.jsx)(W.A,{control:e.control,name:"dhcpd_dns_1",label:(0,s.jsx)(h.sA,{id:"COMMON_PRIMARY_DNS_SERVER"}),tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_VPN_DNS_CLIENT_DESC"}),placeholder:n({id:t?"COMMON_IPV4_IPV6_ADDRESS":"COMMON_IPV4_ADDRESS"})})},Xt=({form:e})=>{const t=(0,x.A)(g.Xj.WIREGUARD_IPV6_SUPPORT),{formatMessage:n}=(0,h.tz)();return(0,s.jsx)(W.A,{control:e.control,name:"dhcpd_dns_2",label:(0,s.jsx)(h.sA,{id:"COMMON_SECONDARY_DNS_SERVER"}),placeholder:n({id:t?"COMMON_IPV4_IPV6_ADDRESS":"COMMON_IPV4_ADDRESS"})})};var Jt=n(918071);const Zt=({form:e})=>{const t="auto"===(0,l.FH)({control:e.control,name:"mtu.type"});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ce.A,{children:[(0,s.jsx)(Ae.A,{htmlFor:"interface_mtu_enabled",tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MTU_DESC"}),children:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MTU"})}),(0,s.jsxs)(pe.A,{children:[(0,s.jsx)(Ee.A,{control:e.control,name:"mtu.type",value:"auto",children:(0,s.jsx)(h.sA,{id:"COMMON_AUTO"})}),(0,s.jsx)(Ee.A,{control:e.control,name:"mtu.type",value:"custom",children:(0,s.jsx)(h.sA,{id:"COMMON_CUSTOM"})})]})]}),t?null:(0,s.jsx)(c.A,{width:Jt.G,children:(0,s.jsx)(Ht.A,{control:e.control,name:"mtu.value",label:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MTU_VALUE_LABEL"}),contentAfter:(0,s.jsx)(h.sA,{id:"COMMON_BYTES"}),min:K.ir,max:K.g9})})]})},qt=({form:e})=>{const t=(0,l.FH)({control:e.control,name:"mss_clamp_ipv6.type"});return(0,s.jsxs)(Ut.A,{children:[(0,s.jsx)(ce.A,{label:(0,s.jsx)(Ae.A,{tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MSS_IPV6_DESC"}),children:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MSS_IPV6"})}),children:(0,s.jsxs)(pe.A,{children:[(0,s.jsx)(Ee.A,{control:e.control,name:"mss_clamp_ipv6.type",value:A.dY.AUTO,children:(0,s.jsx)(h.sA,{id:"COMMON_AUTO"})}),(0,s.jsx)(Ee.A,{control:e.control,name:"mss_clamp_ipv6.type",value:A.dY.CUSTOM,children:(0,s.jsx)(h.sA,{id:"COMMON_CUSTOM"})}),(0,s.jsx)(Ee.A,{control:e.control,name:"mss_clamp_ipv6.type",value:A.dY.OFF,children:(0,s.jsx)(h.sA,{id:"COMMON_OFF"})})]})}),t===A.dY.CUSTOM?(0,s.jsx)(c.A,{width:Jt.G,children:(0,s.jsx)(Ht.A,{control:e.control,name:"mss_clamp_ipv6.value",label:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MSS_IPV6_VALUE_LABEL"}),contentAfter:(0,s.jsx)(h.sA,{id:"COMMON_BYTES"}),min:K.$L,max:K.do,onAfterChange:({target:t})=>{Number(t.value)&&e.setValue("mss_clamp_ipv6.value",Number(t.value),{shouldValidate:!0})}})}):null]})},en=({form:e})=>{const t=(0,l.FH)({control:e.control,name:"mss_clamp.type"})===A.dY.CUSTOM;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ce.A,{children:[(0,s.jsx)(Ae.A,{htmlFor:"interface_mtu_enabled",tooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MSS_DESC"}),children:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MSS"})}),(0,s.jsxs)(pe.A,{children:[(0,s.jsx)(Ee.A,{control:e.control,name:"mss_clamp.type",value:A.dY.AUTO,children:(0,s.jsx)(h.sA,{id:"COMMON_AUTO"})}),(0,s.jsx)(Ee.A,{control:e.control,name:"mss_clamp.type",value:A.dY.CUSTOM,children:(0,s.jsx)(h.sA,{id:"COMMON_CUSTOM"})}),(0,s.jsx)(Ee.A,{control:e.control,name:"mss_clamp.type",value:A.dY.OFF,children:(0,s.jsx)(h.sA,{id:"COMMON_OFF"})})]})]}),t?(0,s.jsx)(c.A,{width:Jt.G,children:(0,s.jsx)(Ht.A,{control:e.control,name:"mss_clamp.value",label:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MSS_VALUE_LABEL"}),contentAfter:(0,s.jsx)(h.sA,{id:"COMMON_BYTES"}),min:K.x1,max:K.do})}):null]})};var tn=n(486061),nn=n(47604),rn=n(60143);const sn=({existingRecord:e,form:t})=>{const n=(0,a.d4)(rn.U).find(({network_id:t})=>t===e?._id),i=(0,l.FH)({control:t.control,name:"vpn_type"}),r=(0,l.FH)({control:t.control,name:"mss_clamp"}),o=(0,l.FH)({control:t.control,name:"mtu"}),d=i===p.E.OPENVPN_CLIENT?K.IS:K.vY,_=(r?.type===A.dY.CUSTOM?r.value:K.ow)||K.ow;return"auto"!==o?.type||r?.type!==A.dY.CUSTOM||_<=d-K.SU||n?.status!==nn.T.CONNECTED?null:(0,s.jsx)(j.A,{maxWidth:tn.ng,children:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_MTU_MSS_WARNING",values:{maxMss:d-K.SU}})})};var on=n(184931);const an=({form:e})=>{const t=(0,on.mQ)(),n=(0,o.useCallback)(()=>{const{privateKey:t,publicKey:n}=(0,le.yi)();e.setValue("wireguard_private_key",t,{shouldTouch:!0,shouldDirty:!0,shouldValidate:!0}),e.setValue("wireguard_public_key",n,{shouldTouch:!0,shouldDirty:!0,shouldValidate:!0})},[e]);return(0,s.jsx)(c.A,{alignItems:"center",justifyContent:"flex-start",width:"100%",children:(0,s.jsx)(Te.A,{isDisabled:t,type:"button",onClick:n,fontSize:"medium",children:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_GENERATE_KEY_PAIR"})})})};var ln=n(263705),dn=n(814557);const _n=({existingRecord:e})=>{const t=(0,ln.u)(),n=(0,a.d4)(rn.U).find(({network_id:t})=>t===e._id),i=n?.status||nn.T.UNKNOWN;return(0,s.jsxs)(c.A,{alignItems:"center",height:S.Er,background:dn.Ay["desktop-color-neutral-01-"+t.themeName],borderRadius:S.YC,padding:`0 ${S.kc} 0 0`,children:[(0,s.jsx)(c.A,{width:S.Er,height:S.Er,alignItems:"center",justifyContent:"center",children:(0,s.jsx)(c.A,{width:6,height:6,borderRadius:"50%",background:t.motifPalette[U.a2[i]]})}),(0,s.jsx)(pt.A,{size:"medium",color:"text-2",children:(0,s.jsx)(h.sA,{id:U.iH[i]})})]})},cn=({existingRecord:e})=>{const t=(0,a.d4)(rn.U).find(({network_id:t})=>t===e._id),n=t?.notes?.[0],i=(0,o.useMemo)(()=>e.vpn_type!==p.E.WIREGUARD_CLIENT?null:e.wireguard_client_configuration_file?(0,Le.G)(e.wireguard_client_configuration_file):null,[e]);return(0,s.jsxs)(s.Fragment,{children:[n===B.CONNECTING_LONGER_THAN_USUAL&&e.vpn_type===p.E.WIREGUARD_CLIENT?(0,s.jsx)(je.A,{children:(0,s.jsx)(h.sA,{id:U.C8[B.CONNECTING_LONGER_THAN_USUAL],values:{server:i?i.peer.endpoint?.address:e.wireguard_client_peer_ip}})}):n===B.ROUTE_CONFLICT?(0,s.jsx)(je.A,{children:(0,s.jsx)(h.sA,{id:U.C8[B.ROUTE_CONFLICT]})}):null,t?.error_reason?(0,s.jsx)(je.A,{children:(0,s.jsx)(h.sA,{id:U.C8[t.error_reason]||U.C8[B.UNKNOWN]})}):null]})};var An=n(843615),pn=n(762705),En=n(237887);const In=({form:e})=>{const t=(0,x.A)(g.Xj.WIREGUARD_IPV6_SUPPORT),n=(0,l.FH)({control:e.control,name:"wireguard_configuration_file"}),i=(0,o.useMemo)(()=>n?.content?(0,Le.G)(n.content):null,[n?.content]),r=i?.interface.privateKey,a=(0,o.useMemo)(()=>(0,le.yi)(r)?.publicKey,[r]),d=(0,o.useMemo)(()=>((e,t,n)=>{const i=(0,Le.G)(e),r=(0,q.c)(i.interface.privateKey),s=(0,q.c)(i.peer.publicKey),o=(0,q.c)(i.peer.preSharedKey),a=(n?Ge:Ve)(i.interface.dns[0]),l=i.peer.endpoint,d=l&&(n?we:Pe)(l?.address),_=l&&Ke(l?.port),c=n?Ue:Fe,p=i.interface.address.filter(e=>n||e.version===be.k.v4),E=n?p.length&&p.length<=2&&p.map(e=>`${e.ip}/${e.subnet}`).every(c):1===p.length&&c(`${p[0].ip}/${p[0].subnet}`),I=!n||p.filter(e=>ee.QD.test(e.ip+"/"+e.subnet)).length<=1&&p.filter(e=>ee.wK.test(e.ip+"/"+e.subnet)).length<=1,N=E&&I&&r&&s&&d&&_&&a;return t?""===e?A.mo.CONNECTION_FAILED:i.peer.preSharedKey?N&&o?A.mo.VALID:A.mo.CONNECTION_FAILED:N?A.mo.VALID:A.mo.CONNECTION_FAILED:A.mo.NEW})(n?.content,n?.name,t),[n?.content,n?.name,t]),{ipv4Address:_,ipv6Address:p}=(0,o.useMemo)(()=>{const e=i?.interface.address.filter(e=>t||e.version===be.k.v4)||[];return{ipv4Address:e.find(e=>e.version===be.k.v4),ipv6Address:e.find(e=>e.version===be.k.v6)}},[t,i]),E=(0,o.useMemo)(()=>t||i?.peer?.endpoint?.ipVersion===be.k.v4?i?.peer.endpoint:void 0,[t,i?.peer?.endpoint]);return d!==A.mo.VALID?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(An.A,{width:"100%",variant:"secondary",passwordToggle:!0,type:"password",autoComplete:"new-password",label:(0,s.jsx)(h.sA,{id:"COMMON_PRIVATE_KEY"}),labelTooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_PRIVATE_KEY_CLIENT_DESC"}),labelTooltipProps:{portal:!0},disabled:!0,value:r||""}),(0,s.jsx)(An.A,{width:"100%",variant:"secondary",passwordToggle:!0,type:"password",autoComplete:"new-password",contentAfter:a?(0,s.jsx)(Vt.A,{link:a,variant:"secondary"}):null,label:(0,s.jsx)(h.sA,{id:"COMMON_PUBLIC_KEY"}),labelTooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_PUBLIC_KEY_CLIENT_DESC"}),labelTooltipProps:{portal:!0},disabled:!0,value:a||""}),(0,s.jsx)(ce.A,{gap:S.kc,label:(0,s.jsxs)(c.A,{gap:S.YC,paddingTop:S.YC,children:[(0,s.jsx)(Se.A,{variant:"heading-medium",children:(0,s.jsx)(h.sA,{id:"COMMON_TUNNEL_IP"})}),(0,s.jsx)(Me.A,{description:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_TUNNEL_IP_DESC"}),portal:!0})]}),children:(0,s.jsxs)(Ut.A,{children:[(0,s.jsxs)(c.A,{gap:S.kc,alignItems:"flex-start",children:[(0,s.jsx)(c.A,{flex:2,children:(0,s.jsx)(An.A,{width:"100%",type:"text",disabled:!0,variant:"secondary",label:(0,s.jsx)(h.sA,{id:"COMMON_IPV4_ADDRESS"}),value:_?.ip||""})}),(0,s.jsx)(c.A,{flex:1,children:(0,s.jsx)(En.A,{width:"100%",variant:"secondary",disabled:!0,label:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_NETMASK"}),options:[{value:_?.subnet||"",label:_?.subnet||""}],searchable:!0,value:_?.subnet||""})})]}),t?(0,s.jsxs)(c.A,{gap:S.kc,alignItems:"flex-start",children:[(0,s.jsx)(c.A,{flex:2,children:(0,s.jsx)(An.A,{width:"100%",type:"text",disabled:!0,variant:"secondary",label:(0,s.jsx)(h.sA,{id:"COMMON_IPV6_ADDRESS"}),value:p?.ip||""})}),(0,s.jsx)(c.A,{flex:1,children:(0,s.jsx)(En.A,{width:"100%",variant:"secondary",disabled:!0,label:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_NETMASK"}),options:[{value:p?.subnet||"",label:p?.subnet||""}],searchable:!0,value:p?.subnet||""})})]}):null]})}),(0,s.jsx)(ce.A,{gap:S.kc,label:(0,s.jsxs)(c.A,{gap:S.YC,children:[(0,s.jsx)(Se.A,{variant:"heading-medium",children:(0,s.jsx)(h.sA,{id:"COMMON_SERVER_ADDRESS"})}),(0,s.jsx)(Me.A,{description:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_VPN_PUBLIC_IP_CLIENT_DESC"}),portal:!0})]}),children:(0,s.jsxs)(c.A,{gap:S.kc,alignItems:"flex-start",children:[(0,s.jsx)(c.A,{flex:2,children:(0,s.jsx)(An.A,{width:"100%",type:"text",variant:"secondary",label:(0,s.jsx)(h.sA,{id:"COMMON_IP_HOSTNAME"}),value:E?.address||"",disabled:!0})}),(0,s.jsx)(c.A,{flex:1,children:(0,s.jsx)(An.A,{width:"100%",type:"number",variant:"secondary",label:(0,s.jsx)(h.sA,{id:"COMMON_PORT"}),value:E?.port||"",disabled:!0})})]})}),(0,s.jsx)(An.A,{width:"100%",variant:"secondary",type:"password",autoComplete:"new-password",passwordToggle:!0,contentAfter:i?.peer.publicKey?(0,s.jsx)(Vt.A,{link:i.peer.publicKey,variant:"secondary"}):null,label:(0,s.jsx)(h.sA,{id:"COMMON_PUBLIC_SERVER_KEY"}),labelTooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_PUBLIC_SERVER_KEY_DESC"}),labelTooltipProps:{portal:!0},disabled:!0,value:i?.peer.publicKey||""}),(0,s.jsxs)(c.A,{children:[(0,s.jsx)(dt.A,{children:(0,s.jsx)(pn.A,{variant:"primary",disabled:!0,id:"wireguard_preshared_key",checked:!!i?.peer.preSharedKey,children:(0,s.jsx)(h.sA,{id:"COMMON_PRE_SHARED_KEY"})})}),(0,s.jsx)(Me.A,{description:(0,s.jsx)(h.sA,{id:"SETTINGS_VPN_CLIENT_PUBLIC_PRE_SHARED_KEY_DESC"}),portal:!0})]}),i?.peer.preSharedKey?(0,s.jsx)(An.A,{type:"text",variant:"secondary",width:"100%",value:i.peer.preSharedKey,disabled:!0}):null,(0,s.jsx)(An.A,{variant:"secondary",label:(0,s.jsx)(h.sA,{id:"COMMON_PRIMARY_DNS_SERVER"}),labelTooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_VPN_DNS_CLIENT_DESC"}),labelTooltipProps:{portal:!0},value:i?.interface.dns[0]||"",disabled:!0,width:"100%"}),(0,s.jsx)(An.A,{variant:"secondary",label:(0,s.jsx)(h.sA,{id:"COMMON_SECONDARY_DNS_SERVER"}),labelTooltip:(0,s.jsx)(h.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_VPN_DNS_CLIENT_DESC"}),labelTooltipProps:{portal:!0},value:i?.interface.dns[1]||"",disabled:!0,width:"100%"})]})},Nn=({activeItem:e})=>{const t=e&&e._id!==E.R6?e:void 0,{formatMessage:n}=(0,h.tz)(),j=(0,a.wA)(),W=(0,a.d4)(m.EL),H=(0,a.d4)(C.Ct),$=(0,a.d4)(M.iE),B=(0,a.d4)(R.Lt),z=(0,x.A)(g.Xj.WIREGUARD_VPN_CLIENT),Q=(0,x.A)(g.Xj.TRAFFIC_ROUTE_KILL_SWITCH),X=(0,x.A)(g.Xj.VPN_MSS_CLAMPING),J=(0,x.A)(g.Xj.WIREGUARD_IPV6_SUPPORT),Z=(0,o.useMemo)(()=>t?._id?$.filter(({network_id:e})=>e===t._id):[],[t?._id,$]),q=(0,d.m)({defaultValues:_e(t,z,Q,H,n),schema:ae(J)});(0,I.y)(q);const{isDirty:ee,isSubmitting:te}=(0,l.lN)(q),ne=(0,l.FH)({control:q.control,name:"vpn_type"}),ie=(0,l.FH)({control:q.control,name:"content_wizard.type"}),re=(0,l.FH)({control:q.control,name:"device_wizard.type"}),se=(0,l.FH)({control:q.control,name:"setup_mode"}),oe=(0,l.FH)({control:q.control,name:"wireguard_configuration_file"}),le=q.handleSubmit(async e=>{try{const n=((e,t,n)=>({...e,enabled:e?.enabled??n.filter(t=>t._id!==e?._id&&t.enabled&&(0,F.MY)(t)).length<U.Ch,purpose:e?.purpose??A.rR.VPN_CLIENT,vpn_type:t.vpn_type,name:t.name,ip_subnet:"ip_subnet"in t&&t.ip_subnet?`${t.ip_subnet.ip}/${t.ip_subnet.subnet}`:void 0,ipv6_subnet:"ipv6_subnet"in t&&t.ipv6_subnet?`${t.ipv6_subnet.ip}/${t.ipv6_subnet.subnet}`:void 0,dhcpd_dns_1:"dhcpd_dns_1"in t?t.dhcpd_dns_1:void 0,dhcpd_dns_2:"dhcpd_dns_2"in t&&t.dhcpd_dns_2||void 0,openvpn_configuration_filename:t.vpn_type===p.E.OPENVPN_CLIENT?t.openvpn_configuration_file.name:void 0,openvpn_configuration:t.vpn_type===p.E.OPENVPN_CLIENT?t.openvpn_configuration_file.content:void 0,openvpn_username:t.vpn_type===p.E.OPENVPN_CLIENT?t.openvpn_username:void 0,x_openvpn_password:t.vpn_type===p.E.OPENVPN_CLIENT?t.openvpn_password:void 0,wireguard_client_configuration_file:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.FILE?t.wireguard_configuration_file.content:void 0,wireguard_client_configuration_filename:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.FILE?t.wireguard_configuration_file.name:void 0,wireguard_client_mode:t.vpn_type===p.E.WIREGUARD_CLIENT?t.setup_mode:void 0,x_wireguard_private_key:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.MANUAL?t.wireguard_private_key:void 0,wireguard_public_key:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.MANUAL?t.wireguard_public_key:void 0,wireguard_client_preshared_key_enabled:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.MANUAL?t.wireguard_client_preshared_key.enabled:void 0,wireguard_client_preshared_key:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.MANUAL&&t.wireguard_client_preshared_key?.enabled?t.wireguard_client_preshared_key.value:void 0,wireguard_client_peer_ip:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.MANUAL?t.wireguard_client_peer_ip:void 0,wireguard_client_peer_port:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.MANUAL?t.wireguard_client_peer_port:void 0,wireguard_client_peer_public_key:t.vpn_type===p.E.WIREGUARD_CLIENT&&t.setup_mode===A.hS.MANUAL?t.wireguard_client_peer_public_key:void 0,interface_mtu_enabled:"custom"===t.mtu.type,interface_mtu:"custom"===t.mtu.type?t.mtu.value:void 0,mss_clamp_mss:t.mss_clamp.type===A.dY.CUSTOM?t.mss_clamp.value:K.ow,mss_clamp:t.mss_clamp.type,mss_clamp_ipv6:t.vpn_type===p.E.WIREGUARD_CLIENT?t.mss_clamp_ipv6.type:void 0,mss_clamp_mss_ipv6:t.vpn_type===p.E.WIREGUARD_CLIENT&&"value"in t.mss_clamp_ipv6?t.mss_clamp_ipv6.value:void 0}))(t,e,H),s=t?u.ux:u.VS,o=await j(s(n,{},{resolveWithExisting:!1})),a=o?.data?.[0]?._id||o?._id;e.device_wizard.type===r.OFF&&e.content_wizard.type===i.OFF||await j((0,b.kk)({description:e.name,enabled:!0,network_id:a,domains:"domains"in e.content_wizard?e.content_wizard.domains.map(G.DP):[],ip_addresses:"ips"in e.content_wizard?e.content_wizard.ips.filter(e=>"ip_or_subnet"in e):[],target_devices:e.device_wizard.type===r.NETWORK?e.device_wizard.networks.map(e=>({type:L.Q.NETWORK,network_id:e})):e.device_wizard.type===r.DEVICE?e.device_wizard.devices.map(e=>({type:L.Q.CLIENT,client_mac:e})):[{type:L.Q.ALL_CLIENTS}],ip_ranges:"ips"in e.content_wizard?e.content_wizard.ips.filter(e=>"ip_start"in e):[],matching_target:e.content_wizard.type===i.REGION?f.d.REGION:e.content_wizard.type===i.IP?f.d.IP:e.content_wizard.type===i.DOMAIN?f.d.DOMAIN:f.d.INTERNET,next_hop:"",kill_switch_enabled:!!e.wizard_kill_switch_enabled,regions:"regions"in e.content_wizard?e.content_wizard.regions:[],_id:void 0})),await j((0,D.G)()),j((0,T.SQ)(!1)),a&&j((0,T.XP)({type:O.H.VPN_CLIENT,id:a})),q.reset()}catch(t){const n=(0,P.F)(t)?t:void 0;j((0,w.ox)({type:V.C.danger,message:"SETTINGS_VPN_CLIENT_CREATE_FORM_SAVE_ERROR",errorMessage:n?.msg,errorValues:{...n,name:e.name,overlappedNetwork:n?.name}}))}});return(0,s.jsx)("form",{onSubmit:le,children:(0,s.jsxs)(N.A,{isDisabled:W,children:[(0,s.jsxs)(c.A,{flexDirection:"column",width:"100%",gap:S.kc,children:[(0,s.jsxs)(_.A,{title:(0,s.jsx)(h.sA,{id:"COMMON_CONFIGURATION"}),children:[B?(0,s.jsx)(v.A,{feature:"COMMON_VPN_CLIENT"}):null,(0,s.jsx)(me,{form:q,existingRecord:t}),(0,s.jsx)(Y,{form:q}),ne!==p.E.WIREGUARD_CLIENT||t?null:(0,s.jsx)(ue,{form:q}),ne===p.E.OPENVPN_CLIENT||se===A.hS.FILE?(0,s.jsx)(Qe,{form:q}):null,Z.length?null:(0,s.jsx)(nt,{form:q}),Z.length?null:(0,s.jsx)(lt,{form:q}),Z.length||ie===i.OFF&&re===r.OFF?null:(0,s.jsx)(y,{}),Z.length||!Q||ie===i.OFF&&re===r.OFF?null:(0,s.jsx)(ct,{form:q})]}),Z.length?(0,s.jsx)(bt,{associatedTrafficRoutes:Z}):null,ne!==p.E.WIREGUARD_CLIENT||se!==A.hS.FILE||oe?.content?(0,s.jsxs)(_.A,{title:(0,s.jsxs)(c.A,{gap:S.YC,alignItems:"center",children:[(0,s.jsx)(h.sA,{id:"COMMON_CONNECTION"}),t?(0,s.jsx)(_n,{existingRecord:t}):null]}),children:[t?(0,s.jsx)(cn,{existingRecord:t}):null,ne===p.E.WIREGUARD_CLIENT&&se===A.hS.MANUAL?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(wt,{form:q}),(0,s.jsx)(Gt,{form:q}),(0,s.jsx)(an,{form:q}),(0,s.jsx)(Yt,{form:q}),(0,s.jsx)($t,{form:q}),(0,s.jsx)(Bt,{form:q}),(0,s.jsx)(zt,{form:q}),(0,s.jsx)(Qt,{form:q}),(0,s.jsx)(Xt,{form:q})]}):null,ne===p.E.WIREGUARD_CLIENT&&se!==A.hS.MANUAL?(0,s.jsx)(In,{form:q}):null,ne===p.E.OPENVPN_CLIENT?(0,s.jsx)(Lt,{form:q}):null,ne===p.E.OPENVPN_CLIENT?(0,s.jsx)(Pt,{form:q}):null]}):null,(0,s.jsxs)(_.A,{title:(0,s.jsx)(h.sA,{id:"COMMON_ADVANCED"}),children:[(0,s.jsx)(Zt,{form:q}),X?(0,s.jsx)(en,{form:q}):null,(0,s.jsx)(sn,{existingRecord:t,form:q}),X&&J&&ne===p.E.WIREGUARD_CLIENT?(0,s.jsx)(qt,{form:q}):null]})]}),(0,s.jsx)(k.A,{onFormSubmit:le,onFormCancel:()=>q.reset(),isDirty:ee||!t,hideCancelButton:!ee,submitButtonText:t?void 0:"COMMON_ACTION_CREATE",isSubmitting:te})]})})}},213981(e,t,n){n.d(t,{$g:()=>I,yi:()=>E});var i=n(684780);n(794721),n(283713);const r=e=>{const t=new Float64Array(16);if(e)for(let n=0;n<e.length;n++)t[n]=e[n];return t},s=e=>{for(let t=0;t<16;t++)e[(t+1)%16]+=(t<15?1:38)*Math.floor(e[t]/65536),e[t]&=65535},o=(e,t,n)=>{let i;const r=~(n-1);for(let n=0;n<16;++n)i=r&(e[n]^t[n]),e[n]^=i,t[n]^=i},a=(e,t,n)=>{for(let i=0;i<16;++i)e[i]=t[i]+n[i]|0},l=(e,t,n)=>{for(let i=0;i<16;++i)e[i]=t[i]-n[i]|0},d=(e,t,n)=>{var i=new Float64Array(31);for(let e=0;e<16;++e)for(let r=0;r<16;++r)i[e+r]+=t[e]*n[r];for(let e=0;e<15;++e)i[e]+=38*i[e+16];for(let t=0;t<16;++t)e[t]=i[t];s(e),s(e)},_=e=>{e[31]=127&e[31]|64,e[0]&=248},c=()=>{const e=new Uint8Array(32);return window.crypto.getRandomValues(e),e},A=(e,t)=>{const n=Uint8Array.from([t[0]>>2&63,63&(t[0]<<4|t[1]>>4),63&(t[1]<<2|t[2]>>6),63&t[2]]);for(let t=0;t<4;++t)e[t]=n[t]+65+(25-n[t]>>8&6)-(51-n[t]>>8&75)-(61-n[t]>>8&15)+(62-n[t]>>8&3)},p=e=>{let t;const n=new Uint8Array(44);for(t=0;t<32/3;++t)A(n.subarray(4*t),e.subarray(3*t));return A(n.subarray(4*t),Uint8Array.from([e[3*t+0],e[3*t+1],0])),n[43]=61,String.fromCharCode.apply(null,n)};function E(e){const t=e&&(0,i.c)(e)?function(e){return Uint8Array.from(window.atob(e),e=>e.charCodeAt(0))}(e):(()=>{const e=c();return _(e),e})(),n=(e=>{let t;const n=new Uint8Array(32),i=r([1]),c=r([9]),A=r(),p=r([1]),E=r(),I=r(),N=r([56129,1]),m=r([9]);for(let t=0;t<32;++t)n[t]=e[t];_(n);for(let e=254;e>=0;--e)t=n[e>>>3]>>>(7&e)&1,o(i,c,t),o(A,p,t),a(E,i,A),l(i,i,A),a(A,c,p),l(c,c,p),d(p,E,E),d(I,i,i),d(i,A,i),d(A,c,E),a(E,i,A),l(i,i,A),d(c,i,i),l(A,p,I),d(i,A,N),a(i,i,p),d(A,A,i),d(i,p,I),d(p,c,m),d(c,E,E),o(i,c,t),o(A,p,t);return((e,t)=>{const n=r();for(let e=0;e<16;++e)n[e]=t[e];for(let e=253;e>=0;--e)d(n,n,n),2!==e&&4!==e&&d(n,n,t);for(let t=0;t<16;++t)e[t]=n[t]})(A,A),d(i,i,A),((e,t)=>{let n;const i=r(),a=r();for(let e=0;e<16;e++)a[e]=t[e];s(a),s(a),s(a);for(let e=0;e<2;++e){i[0]=a[0]-65517;for(let e=1;e<15;++e)i[e]=a[e]-65535-(i[e-1]>>16&1),i[e-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),n=i[15]>>16&1,i[14]&=65535,o(a,i,1-n)}for(let t=0;t<16;++t)e[2*t]=255&a[t],e[2*t+1]=a[t]>>8})(n,i),n})(t);return{publicKey:p(n),privateKey:p(t)}}const I=()=>{const e=c();return _(e),p(e)}},16944(e,t,n){n.d(t,{A:()=>A});var i=n(274934),r=n(602086),s=n(977872),o=n(890932),a=n(726831);const l={};var d=n(247816),_=n(291508);const c=(0,d.A)("img",(0,_.A)("dimension"))`
  ${({dimension:e=22})=>`\n    height: ${e}px;\n    width: ${e}px;\n  `}
`,A=(0,r.memo)(({iconFileName:e,dimension:t,style:n={}})=>{const r=(0,s.d4)(o.p);return(0,i.jsx)(c,{src:l[e]||encodeURI(`${a.A.dpiPath}${e}`),dimension:t,onLoad:({target:t})=>{l[e]=t.src},onError:({currentTarget:e})=>{e.src=`${r}/dpiFallback.svg`},style:n})})},464849(e,t,n){n.d(t,{_:()=>r});var i=n(794721);const r=({vpn_type:e})=>e===i.E.OPENVPN_CLIENT},204832(e,t,n){n.d(t,{j:()=>o,y:()=>s});const i=/^remote\s+(\S+)(?:\s+(\d+))?/m,r=/^ifconfig\s+(\S+)\s+(\S+)/m,s=e=>{let t="",n="",s="",o="",a="";const l=/<ca>(.*?)<\/ca>/gs,d=/<cert>(.*?)<\/cert>/gs,_=/<tls-auth>(.*?)<\/tls-auth>/gs,c=/-----BEGIN ENCRYPTED PRIVATE KEY-----(.*?)-----END ENCRYPTED PRIVATE KEY-----/gs,A=/<key>(.*?)<\/key>/gs;let p,E,I,N,m;for(;e&&(p=l.exec(e));)t=p[1];for(;e&&(E=d.exec(e));)n=E[1];for(;e&&(I=A.exec(e));)s=I[1];for(;e&&(N=c.exec(e));)a=N[1];for(;e&&(m=_.exec(e));)o=m[1];const u=e?i.exec(e):null,T=u?.[1],O=u?.[2]?Number(u[2]):void 0,S=e?r.exec(e):null,h=S?.[1];return{certificate_ca:t,certificate_cert:n,privateKey:s,vpnKey:o,encryptedPrivateKey:a,remoteAddress:T,remotePort:O,tunnelIp:h}},o=e=>e?.openvpn_configuration?s(e.openvpn_configuration):void 0},875762(e,t,n){n.d(t,{G:()=>_,d:()=>c});var i=n(635187),r=n(565545),s=n(570866),o=n(471195),a=n(464849);const l=/^\[([^\]]+)\]:(\d+)$/,d=e=>{if(!e)return;const t=e.match(l);if(t)return{address:t[1],port:Number(t[2]),ipVersion:r.k.v6};const[n,s]=e.split(i.oH);return{address:n,port:Number(s),ipVersion:r.k.v4}},_=e=>{const t=(e=>(e?.split("\n").map(e=>e.trim())||[]).filter(Boolean).flatMap(e=>{if(e.startsWith("[")&&e.endsWith("]"))return[{type:"title",value:e.slice(1,-1)}];if(e.includes("=")){const[t,...n]=e.split("=");if(t.trim()&&n.length)return[{type:"keyValue",key:t.trim().toLowerCase(),value:n.join("=").trim()}]}return[]}))(e),n=(e=>{const t=[],n=[];let i=null;for(const r of e)"title"!==r.type?"keyValue"===r.type&&("interface"===i?t.push({key:r.key,value:r.value}):"peer"===i&&n.push({key:r.key,value:r.value})):i=r.value.toLowerCase();return{interface:Object.fromEntries(t.map(e=>[e.key.toLowerCase(),e.value])),peer:Object.fromEntries(n.map(e=>[e.key.toLowerCase(),e.value]))}})(t);return{interface:{address:(a=n.interface.address,a?a.split(i.KE).map(e=>e.trim()).filter(Boolean).map(e=>{const[t,n]=e.split(i.Ed);return{ip:t,subnet:n,version:s.zF.test(t)?r.k.v4:s.nI.test(t)?r.k.v6:void 0}}).filter(function(e){return void 0!==e.version}):[]),dns:(o=n.interface.dns,o?o.split(i.KE).map(e=>e.trim()).filter(Boolean):[]),privateKey:n.interface.privatekey},peer:{allowedIps:n.peer.allowedips?.split(i.KE).map(e=>e.trim())||[],endpoint:d(n.peer.endpoint),publicKey:n.peer.publickey,preSharedKey:n.peer.presharedkey}};var o,a},c=e=>{const t=(0,a._)(e),n=(0,o.b)(e);return t||n?void 0:_(e.wireguard_client_configuration_file||"")}},471195(e,t,n){n.d(t,{b:()=>r});var i=n(581814);const r=e=>e.wireguard_client_mode===i.hS.MANUAL},625796(e,t,n){n.d(t,{Ay:()=>l,PN:()=>o,xn:()=>a});var i=n(274934),r=n(86635),s=n(998948);const o=15,a=150,l=s.A.map(({countryCode:e,countryName:t})=>({image:()=>(0,i.jsx)(r.A,{countryCode:e,width:"auto",height:"100%",style:{borderRadius:"50%",objectFit:"cover",aspectRatio:"1 / 1"}}),label:t,value:e}))},61322(e,t,n){n.d(t,{I:()=>i});const i={HEADER_HEIGHT:32,ROW_HEIGHT:32,EDIT_FIELD_HEIGHT:36,getHeight(e,t,n,i){return Math.min((i||this.ROW_HEIGHT)*e+(n??this.HEADER_HEIGHT),(i||this.ROW_HEIGHT)*t+(n??this.HEADER_HEIGHT))},getEditContainerHeight(e,t,n){return Math.min((n||this.EDIT_FIELD_HEIGHT)*e,(n||this.EDIT_FIELD_HEIGHT)*t)}}},598890(e,t,n){n.d(t,{A:()=>l});var i=n(274934),r=n(602086),s=n(625796),o=n(656647),a=n(609553);const l=function({form:e,name:t,...n}){const l=(0,r.useMemo)(()=>s.Ay.map(({label:e,value:t,image:n})=>({type:"CHECKBOX",title:e,id:t.toString(),checkboxProps:{symbol:n()},children:[]})),[]);return(0,i.jsx)(o.A,{options:l,name:t,control:e.control,maxSelections:a.KW,...n})}},858098(e,t,n){n.d(t,{A:()=>c});var i=n(274934),r=n(602086),s=n(42220),o=n(260334),a=n(184931),l=n(100978),d=n(470070),_=n(680163);const c=function({form:e,name:t,fieldLabel:n,modalTitle:c,modalFieldPlaceholder:A,placeholder:p,itemSchema:E,transformValue:I,getDuplicationMessage:N,extraDisplayColumns:m,actions:u,max:T,disableMultiEdit:O=!1,splitBy:S,validateInArray:h,sortValue:x}){const g=(0,a.mQ)(),C=(0,o.L_)(),{formatMessage:R}=(0,d.tz)(),v=(0,r.useMemo)(()=>({fieldLabel:n,modalTitle:c,modalFieldPlaceholder:A}),[n,A,c]),M=(0,r.useMemo)(()=>({getDuplicationMessage:N??(()=>R({id:"SETTINGS_VALUE_UNIQUE"})),validateInArray:h,validate:e=>{if(S&&"string"==typeof e){const t=e.split(S).map(e=>e.trim()).filter(Boolean);for(const n of t.length>0?t:[e]){const e=E.safeParse(n);if(!e.success)return C(e.error.issues[0]?.message)}return!0}const t=E.safeParse(e);return!!t.success||C(t.error.issues[0]?.message)}}),[R,C,N,E,S,h]),f=(0,r.useMemo)(()=>({placeholder:p,translatePlaceholder:!1,parser:I?e=>I(e?.[0]?.target?.value):void 0}),[p,I]);return(0,i.jsx)(s.xI,{control:e.control,name:t,render:({field:e,fieldState:t,formState:n})=>(0,i.jsx)(l.A,{flexDirection:"column",width:"100%",children:(0,i.jsx)(_.A,{disabled:g,labels:v,fieldValidation:M,extraFieldConfig:f,value:x?x(e.value||[]):e.value||[],onChange:t=>e.onChange(t),invalid:t.invalid?C((0,s.Jt)(n.errors,e.name)?.message)||!0:void 0,extraDisplayColumns:m,actions:u,disableMultiEdit:O,max:T,splitBy:S,transformValue:I})})})}},918071(e,t,n){n.d(t,{G:()=>i});const i=165},846294(e,t,n){n.d(t,{A:()=>d});var i=n(274934),r=n(125799),s=n(409844),o=n(184931),a=n(877840);const l=s.AH`
  width: fit-content;
`,d=({reasons:e,reason:t,children:n,isInteractive:s,noWrap:d,position:_,fitContent:c})=>{const A=(0,o.pv)(),p=[t,...e||[]].filter(Boolean)[0]||null,E=!!p;return(0,i.jsx)(a.A,{isDisabled:{fields:E,labels:E,tooltipIcons:E,tooltipPopovers:!A.fields&&E},children:(0,i.jsx)(r.A,{description:A.fields?null:p,portal:!0,isInteractive:s,noWrap:d,position:_,className:c?l:void 0,children:n})})}},877840(e,t,n){n.d(t,{A:()=>a});var i=n(274934),r=n(602086),s=n(184931),o=n(712642);const a=({isDisabled:e,isAdditive:t=!0,children:n})=>{const a=(0,s.pv)(),l=(0,r.useMemo)(()=>"boolean"==typeof e?{fields:e,labels:e,tooltipIcons:e,tooltipPopovers:!1}:e,[e]),d=(0,r.useMemo)(()=>({fields:t?l.fields||a.fields:l.fields,labels:t?l.labels||a.labels:l.labels,tooltipIcons:t?l.tooltipIcons||a.tooltipIcons:l.tooltipIcons,tooltipPopovers:t?l.tooltipPopovers||a.tooltipPopovers:l.tooltipPopovers}),[t,l.fields,l.labels,l.tooltipIcons,l.tooltipPopovers,a.fields,a.labels,a.tooltipIcons,a.tooltipPopovers]);return(0,i.jsx)(o.I.Provider,{value:d,children:n})}},16805(e,t,n){n.d(t,{A:()=>d});var i=n(274934),r=n(42220),s=n(843615),o=n(309130),a=n(260334),l=n(184931);const d=function({control:e,name:t,label:n,placeholder:d,tooltip:_,tooltipProps:c,contentAfter:A,arrowSize:p,min:E,max:I,step:N,value:m,iconBefore:u,onAfterChange:T,onChange:O}){const S=(0,l.mQ)(),h=(0,a.L_)();return(0,i.jsx)(r.xI,{control:e,name:t,render:({field:{ref:e,...a},fieldState:l,formState:x})=>(0,i.jsx)(s.A,{type:"number",variant:"secondary",width:"100%",...a,value:m??a.value??"",onChange:e=>{O?O(e,x):a.onChange(e.target.value?.length?+e.target.value:null),T?.(e)},disabled:S,invalid:l.invalid?h((0,r.Jt)(x.errors,t)?.message)||!0:void 0,labelTooltip:_,labelTooltipProps:{style:{opacity:S?o.xN:void 0,...c?.style},...c},label:n,placeholder:d,arrowSize:p,contentAfter:A,iconBefore:u,step:N,min:E,max:I})})}},656647(e,t,n){n.d(t,{A:()=>E});var i=n(274934),r=n(602086),s=n(42220),o=n(104669),a=n(111727),l=n(164487),d=n(597750),_=n(309130),c=n(260334),A=n(184931);const p=()=>{},E=function({control:e,name:t,tooltip:n,label:E,options:I,isVirtualized:N,isAllSelected:m,onSelectAll:u,disabledKeys:T,maxSelections:O}){const S=(0,A.mQ)(),h=(0,c.L_)(),{field:x,fieldState:g,formState:C}=(0,s.as)({control:e,name:t}),R=(0,r.useMemo)(()=>new Set(x.value),[x.value]),v=(0,r.useMemo)(()=>S?I.map(e=>e.id):T||I.flatMap(e=>"CHECKBOX"===e.type&&(e.checkboxProps?.isDisabled||O&&R.size>=O&&!R.has(e.id))?[e.id]:[]),[S,I,T,O,R]),M=(0,r.useCallback)(()=>x.onChange(I.map(e=>e.id)),[I,x]),f=(0,r.useMemo)(()=>m||(()=>!!I.length&&I.every(e=>R.has(e.id))),[m,I,R]),j=(0,r.useCallback)(()=>x.onChange([]),[x]),y=(0,r.useMemo)(()=>({disabledKeys:v}),[v]),D=(0,r.useCallback)(e=>{x.onChange("all"!==e?[...e]:I.map(e=>e.id))},[x,I]);return(0,i.jsxs)(d.A,{style:{opacity:S?_.xN:void 0},children:[E?(0,i.jsx)(l.A,{tooltip:n,children:E}):null,(0,i.jsx)(a.A,{onSelectionChange:D,"aria-disabled":S,selectedKeys:R,treeProps:y,items:I,isVirtualized:N,setSelectedKeys:p,onSelectAll:u??M,onDeselectAll:j,isAllSelected:f,hasSelectAllControl:!O}),g.invalid?(0,i.jsx)(o.A,{isInvalid:!0,label:h((0,s.Jt)(C.errors,t)?.message)}):void 0]})}},482609(e,t,n){n.d(t,{A:()=>c});var i=n(274934),r=n(602086),s=n(42220),o=n(956976),a=n(309130),l=n(304151),d=n(100978),_=n(184931);const c=(0,r.forwardRef)(function({control:e,name:t,children:n,tooltip:r,tooltipProps:c,value:A,onCheck:p,...E},I){const N=(0,_.mQ)();return(0,i.jsx)(s.xI,{control:e,name:t,render:({field:e})=>(0,i.jsxs)(d.A,{gap:a.YC,alignItems:"center",ref:I,...E,children:[(0,i.jsx)(o.A,{id:e.name,onChange:({target:{checked:t}})=>{t&&(e.onChange(A),p?.())},checked:e.value===A,disabled:N,value:e.value,children:n}),r?(0,i.jsx)(l.A,{description:r,...c}):null]})})})},635891(e,t,n){n.d(t,{A:()=>_});var i=n(274934),r=n(42220),s=n(843615),o=n(95032),a=n(309130),l=n(260334),d=n(184931);const _=function({control:e,name:t,label:n,placeholder:_,tooltip:c,tooltipProps:A,autoFocus:p,motif:E,onChange:I,onBlur:N,onAfterChange:m,onPaste:u,onKeyDown:T,passwordToggle:O,type:S,helperMessage:h,autoComplete:x,contentBefore:g,contentAfter:C,onFocus:R,value:v,invalid:M}){const f=(0,d.mQ)(),j=(0,d.Im)(),y=(0,d.q)(),D=(0,l.L_)();return(0,i.jsx)(r.xI,{control:e,name:t,render:({field:e,fieldState:l,formState:d})=>(0,i.jsx)(s.A,{type:S||(O?"password":"text"),variant:"secondary",width:"100%",autoFocus:p,...e,onChange:t=>{I?I(t,e,d):e.onChange(t),m?.(t)},onBlur:t=>{N?N(t,e,d):e.onBlur()},onFocus:R,onPaste:u,disabled:f,value:v??e.value?.toString(),invalid:M||(l.invalid?(0,i.jsxs)(o.A,{variant:"inherit",style:{overflowWrap:"break-word"},children:[D((0,r.Jt)(d.errors,t)?.message)||!0," "]}):void 0),label:n,placeholder:_,labelTooltip:c,labelTooltipProps:{style:{opacity:j?a.xN:void 0,pointerEvents:y?"none":void 0,...A?.style},...A},motif:E,passwordToggle:O,helperMessage:h,autoComplete:x,onKeyDown:T,contentBefore:g,contentAfter:C})})}},59564(e,t,n){n.d(t,{Z:()=>a});var i=n(241792),r=n(745454),s=n(640708),o=n(260334);const a=i.Yj({message:(0,o.rn)("COMMON_VALIDATION_VALID_IPV4_IPV6")}).refine(e=>(0,r.isValidIpv6)(e)||(0,r.isValidIpv4)(e),{message:(0,o.rn)("COMMON_VALIDATION_VALID_IPV4_IPV6")}).refine(e=>!(0,s.m0)(e),{message:(0,o.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_IPV4_MAPPED_IPV6_INVALID")}).refine(e=>!(0,s.aN)(e),{message:(0,o.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_MULTICAST_INVALID")})},149450(e,t,n){n.d(t,{B:()=>a,b:()=>o});var i=n(241792),r=n(745454),s=n(260334);const o=i.Yj({message:(0,s.rn)("COMMON_VALIDATION_VALID_IPV4")}).refine(e=>!e||(0,r.isValidIpv4)(e),{message:(0,s.rn)("COMMON_VALIDATION_VALID_IPV4")}),a=i.Yj({message:(0,s.rn)("COMMON_VALIDATION_VALID_IPV4")}).refine(e=>(0,r.isValidIpv4)(e),{message:(0,s.rn)("COMMON_VALIDATION_VALID_IPV4")})},199220(e,t,n){n.d(t,{Jh:()=>a,XK:()=>o,m9:()=>l});var i=n(241792),r=n(640708),s=n(260334);const o=i.Yj().ip({version:"v6",message:(0,s.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}).refine(e=>!e||!e.includes("%"),{message:(0,s.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}),a=i.KC([i.Yj().ip({version:"v6",message:(0,s.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}),i.eu("")]).optional().refine(e=>!e||!e.includes("%"),{message:(0,s.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}),l=o.refine(e=>!(0,r.m0)(e),{message:(0,s.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_IPV4_MAPPED_IPV6_INVALID")}).refine(e=>!(0,r.aN)(e),{message:(0,s.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_MULTICAST_INVALID")})},871808(e,t,n){n.d(t,{A:()=>o});var i=n(602086),r=n(977872),s=n(167933);const o=e=>(0,r.d4)((0,i.useMemo)(()=>(0,s.jN)(e),[e]))}}]);