"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[86383],{62170:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(349785),l=n(296540),r=n(566723),o=n(662297),i=n(699784),_=n(263963),s=n(284428);const E=[];const c=function({control:e,name:t,tooltip:n,options:c,triggerButtonText:m,truncateLabels:A=!0,isWindowed:d,searchOptions:N,maxSelections:u,narrowTrigger:p,chipClassName:T,label:I}){const S=(0,s.mQ)(),O=(0,_.L_)();return l.createElement(a.xI,{control:e,name:t,render:({field:e,fieldState:_,formState:s})=>l.createElement(o.A,{name:e.name,onChange:t=>e.onChange(t),disabled:S,value:e.value||E,tooltipDescription:n,options:c,truncateLabels:A,invalid:_.invalid?O((0,a.Jt)(s.errors,t)?.message)||!0:void 0,translateTriggerButtonText:!1,triggerButtonText:m??l.createElement(i.sA,{id:"COMMON_EDIT_SELECTIONS"}),isWindowed:d,searchOptions:N,maxSelections:u,isFullWidth:!0,triggerButtonHeight:p?r.S2:void 0,chipClassName:T,label:I})})}},177651:(e,t,n)=>{n.d(t,{E:()=>_});var a=n(801081),l=n(25553),r=n(87485),o=n(934474);const i=(0,l.uh)((0,o.$O)()),_=(0,a.Mz)(i,r.kh)},242366:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(296540),l=n(566723),r=n(294303);const o=(0,a.forwardRef)((e,t)=>a.createElement(r.A,{ref:t,flexDirection:"column",gap:l.kc,width:"100%",...e}))},278138:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(296540),l=n(132196),r=n(897502),o=n(147606);const i=function({form:e,name:t,confirmationTitle:n,confirmationMessage:i,skipConfirmation:_,...s}){return a.createElement(r.A,{control:e.control,name:t,inputClassName:l.AH`
        background: transparent;
      `,renderCheckbox:(e,t)=>t.value||_?e:a.createElement(o.A,{trigger:e,title:n,message:i,onConfirm:()=>t.onChange(!0)}),...s})}},320336:(e,t,n)=>{var a,l;n.d(t,{E:()=>a,Z:()=>l}),function(e){e.WAN="wan",e.WAN2="wan2",e.WAN3="wan3",e.WAN4="wan4",e.WAN5="wan5",e.WAN6="wan6",e.WAN7="wan7",e.WAN8="wan8",e.WAN9="wan9",e.WAN10="wan10",e.WAN11="wan11"}(a||(a={})),function(e){e.AFRAID="afraid",e.CHANGEIP="changeip",e.DNSPARK="dnspark",e.DSLREPORTS="dslreports",e.DYNDNS="dyndns",e.EASYDNS="easydns",e.GOOGLE="googledomains",e.NAMECHEAP="namecheap",e.NOIP="noip",e.SITELUTIONS="sitelutions",e.ZONEEDIT="zoneedit",e.CLOUDXNS="cloudxns",e.DDNSS="ddnss",e.DHIS="dhis",e.DNSEXIT="dnsexit",e.DNSOMATIC="dnsomatic",e.DNSPOD="dnspod",e.DTDNS="dtdns",e.DUCKDNS="duckdns",e.DUIADNS="duiadns",e.DYN="dyn",e.DYNV6="dynv6",e.FREEMYIP="freemyip",e.LOOPIA="loopia",e.NSUPDATE="nsupdate",e.OVH="ovh",e.SPDYN="spdyn",e.STRATO="strato",e.TUNNELBROKER="tunnelbroker",e.CLOUDFLARE="cloudflare",e.CUSTOM="custom"}(l||(l={}))},329109:(e,t,n)=>{n.d(t,{A:()=>E});var a=n(296540),l=n(691441),r=n(71479),o=n(132196),i=n(373229);const _=(0,r.A)("div")`
  height: 66px;
`,s=o.AH`
  padding: 0px !important;
`,E=({isDirty:e,onFormSubmit:t,onFormCancel:n,isInvalid:r,...o})=>e?a.createElement(l.A,null,a.createElement(i.A,{isDirty:e,onFormCancel:n,onFormSubmit:t,isInvalid:r,className:s,...o})):a.createElement(_,null)},349665:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(296540),l=n(705228),r=n(294303);const o=({maxWidth:e,...t})=>a.createElement(r.A,{flexDirection:"column",width:"100%",maxWidth:"settingsGridContent"===e?l.ng:e,...t})},369596:(e,t,n)=>{n.d(t,{A:()=>V});var a=n(469733),l=n(296540),r=n(165126),o=n(566401),i=n(951272),_=n(429252),s=n.n(_),E=n(271856),c=n(56016),m=n(963070),A=n(758649),d=n(86838),N=n(718073),u=n(71479),p=n(132196),T=n(79760),I=n(596441),S=n(454195),O=n(566723),C=n(766624),D=n(143811),M=n(294303),v=n(955161),g=n(699784),f=n(602021),w=n(968906),b=n(586371),L=n(333422);const R=D.A,P=(0,u.A)(d.A)`
  padding-top: 0;
  padding-bottom: 0;
`,h=p.AH`
  opacity: ${O.xN};
`;const V=function({fieldName:e,newFields:t,fieldLabels:n={},onAddItem:_,onRemoveItem:d,validationSchema:u,initialValues:p,onEditSubmit:V,fieldVariant:y="secondary",max:G,isWindowTable:W=!1,addButtonText:U="COMMON_ACTION_ADD",validateOnChange:F=!0,validateOnBlur:x=!0,invalid:k,children:H,editColumns:B,tableMaxHeight:Y=I.I.getHeight(6,6,I.I.ROW_HEIGHT),onEditActiveChange:j,editable:K=!0,columns:Q,maxTooltipTranslationId:$,editMaxHeight:X,allowSubmitInitial:z,renderHoverContent:Z,manageActions:q,onRowClick:J,isDisabledOverride:ee}){const te=(0,a.useSelector)(f.EL),ne=ee||te,ae=(0,l.useCallback)(t=>{const n=async()=>d?.(t);return Z?Z(t,n):ne?null:l.createElement(M.A,{alignItems:"center",marginRight:O.kc},l.createElement(A.A,{name:`remove-${e}-${"id"in t?t.id:""}`,size:"inherit",type:"button",variant:"inline",color:"danger",onClick:n},l.createElement(g.sA,{id:"COMMON_ACTION_REMOVE"})))},[Z,ne,e,d]),le=W?c.A:m.A,re=(0,l.useCallback)(e=>"function"==typeof t?t(e):t,[t]);return l.createElement(i.l1,{enableReinitialize:!0,onSubmit:t=>V?.(t[e]),initialValues:p,validationSchema:u,validateOnChange:F,validateOnBlur:x},({values:t,errors:a,setFieldValue:i,handleSubmit:c,handleReset:m,setTouched:u,dirty:I,touched:f,submitCount:V,resetForm:F})=>{const x=!(0,o.A)(a)||!Object.keys(t).some(e=>(0,T.If)(e,a,f,V)),Z=re(t);return l.createElement(M.A,{flexDirection:"column",width:"100%"},t[b.Vf]?null:l.createElement(E.A,{portal:!0,description:$&&void 0!==G&&t[e].length>=G?l.createElement(g.sA,{id:$}):void 0,noWrap:!0},l.createElement(M.A,{width:"100%",flexWrap:"wrap",gap:O.kc},Z.map((n,r)=>{const{name:o,inline:s,placeholder:E,type:c,label:m,tooltip:d,tooltipProps:p,parser:O,validated:D,hideMainFormInvalidState:P=!1,translateOptions:h,options:W,autoComplete:H,containerFlexProps:B,editable:Y=!0,wrap:j=!1,propFunc:K,...Q}=n,$={};if(!Y)return null;O&&($.onChange=(...e)=>i(o,O(e)));const{valueInputTooltip:X,...q}=K?.(t)||{},J=(0,T.t$)(o,a,f,V);return l.createElement(l.Fragment,{key:o},l.createElement(L.Op,{inline:s,wrap:j,...w.A.addDataTestId(n.id),...B},l.createElement(v.A,{condition:!!d,wrapper:e=>"string"==typeof m?((e,t,n,a)=>l.createElement(M.A,{flexDirection:"column",width:"100%"},l.createElement(M.A,{alignItems:"center"},l.createElement(L.D7,{color:"inherit"},l.createElement(g.sA,{id:e})),l.createElement(C.A,{description:l.createElement(g.sA,{id:t}),...a})),n))(m,d,e,p):e},l.createElement(N.A,{description:X?l.createElement(g.sA,{id:X}):void 0},l.createElement(M.A,{flex:"1"},l.createElement(R,{full:!0,name:o,placeholder:E,type:c,label:d?null:m,variant:y,invalid:I&&J||!P&&!!k&&x,..."dropdown"!==c?{autoComplete:H}:{options:W,translateLabel:"string"==typeof m,translateOptions:h,translatePlaceholder:!0,validated:D},disabled:t[b.Vf]||t[e].length>=G||ne,...$,...Q,...q})))),r===Z.length-1&&!ne&&_?l.createElement(M.A,{alignSelf:"flex-start",height:S.b,marginTop:m?b.EE:0},l.createElement(A.A,{...w.A.addDataTestId(`add-new-table-record-${e}`),name:`add-${e}`,size:"medium",type:I?"submit":"button",variant:"inline",onClick:async e=>{e.preventDefault();const n=Z.reduce((e,t)=>(e[t.name]=!0,e),{}),a=await u(n,!0);Z.find(e=>a[e.name])||(_(t),F())},disabled:t[b.Vf]||t[e].length>=G||!I&&!z&&!q?.disabled},l.createElement(g.sA,{id:U}))):null))}))),k&&x?l.createElement(M.A,{width:"80%",marginBottom:t[e]?.length?O.Er:void 0},l.createElement(P,{label:k,isInvalid:!0})):null,t[b.Vf]?null:H,t[b.Vf]?l.createElement(l.Fragment,null,l.createElement(L.O2,{editMaxHeight:X},t[e].map((a,r)=>l.createElement(M.A,{key:a.id||`${e}-${r}`,width:"100%",gap:O.kc},(B||Q).map((o,_)=>{const s=B&&o.getNewFieldIndex?Z[o.getNewFieldIndex()]:B?{}:Z[_];if(!s)return null;const{type:E,parser:c,validated:m,translateOptions:A,options:d,containerFlexProps:u,inline:p,editable:T=!0,wrap:I,propFunc:S,...O}=s;if(!T)return null;const C={},v=B&&o.getFieldName?.(a)||String(o.id),f=B&&o.getFieldLabel?.(a)||n[o.id];c&&(C.onChange=(...t)=>i(`${e}.${r}.${String(o.id)}`,c(t)));const{valueInputTooltip:w,...b}=S?.(a,t[e])||{};return l.createElement(M.A,{key:`${a.id}-${o.id}`,flexDirection:"column",flex:"1 1 50%",inline:p,...u},l.createElement(N.A,{description:w?l.createElement(g.sA,{id:w}):void 0},l.createElement(M.A,{flex:"1"},l.createElement(D.A,{...C,...O,full:!0,label:f,name:`${e}.${r}.${v}`,type:E||o.getFieldType?.(a),variant:y,fast:!0,..."dropdown"!==E?{}:{options:d,translateLabel:"string"==typeof f,translateOptions:A,translatePlaceholder:!0,type:E,validated:m,portal:!0},...b}))))})))),l.createElement(M.A,{justifyContent:"flex-end",width:"100%",marginTop:O.Ln,gap:O.Ln},l.createElement(A.A,{name:`edit-cancel-${e}`,type:"button",variant:"default",onClick:()=>{m(),i(b.Vf,!1),j?.(!1)}},l.createElement(g.sA,{id:"COMMON_ACTION_CANCEL"})),l.createElement(A.A,{name:`edit-submit-${e}`,type:t[b.Vf]?"submit":"button",variant:"primary",onClick:c,disabled:s()((0,r.A)(t,b.Vf),(0,r.A)(p,b.Vf))},l.createElement(g.sA,{id:"COMMON_ACTION_SAVE_CHANGES"})))):t[e].length>0?l.createElement(M.A,{position:"relative"},t[e].length?l.createElement(L.AC,{tableMaxHeight:Y,rows:t[e].length,isWindowsTable:W,marginTop:O.kc,className:ne?h:void 0,...w.A.addDataTestId(`editable-grid-table-wrapper-${e}`)},l.createElement(le,{columns:Q,disableColumnFilters:!0,disableSelection:!0,disableTextPointer:!0,items:t[e],renderHoverContent:!ne&&d?ae:void 0,cellClassName:L.KY,onRowClick:J})):null,l.createElement(M.A,{position:"absolute",top:O.xO,right:0},q,!ne&&K?l.createElement(A.A,{name:`edit-${e}`,size:"medium",type:"button",variant:"inline",onClick:()=>{m(),i(b.Vf,!0),j?.(!0)}},l.createElement(g.sA,{id:"COMMON_ACTION_EDIT"})):null)):null)})}},373229:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(296540),l=n(758649),r=n(71479),o=n(566723),i=n(699784);const _=(0,r.A)("footer",{shouldForwardProp:e=>"hasFormResetButton"!==e})`
  display: flex;
  justify-content: ${({hasFormResetButton:e})=>e?"space-between":"flex-end"};
  padding: ${o.S2} ${o.fS};
  gap: ${o.kc};
`,s=({allowCancel:e,isDirty:t,isInvalid:n,isSubmitting:r,onFormSubmit:o,onFormReset:s,onFormCancel:E,className:c,submitButtonText:m,customButton:A,applyButton:d,applyButtonFirst:N,hideCancelButton:u,form:p})=>{const T=(0,a.useMemo)(()=>d||a.createElement(l.A,{name:"submit",variant:"primary",type:"submit",onClick:o,disabled:!t||n||r,form:p},a.createElement(i.sA,{id:m||"COMMON_ACTION_APPLY_CHANGES"})),[d,p,t,n,r,o,m]);return a.createElement(_,{className:c,hasFormResetButton:!!s},N?T:A,u?null:a.createElement(l.A,{name:"cancel",variant:"default",type:"button",onClick:E,disabled:!e&&!t},a.createElement(i.sA,{id:"COMMON_ACTION_CANCEL"})),s?a.createElement(l.A,{name:"reset",variant:"default",type:"button",onClick:s,disabled:!t},a.createElement(i.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULTS"})):null,N?A:T)}},547868:(e,t,n)=>{n.d(t,{d:()=>o});var a=n(513180),l=n(320336);const r={[a.C.WAN]:l.E.WAN,[a.C.WAN2]:l.E.WAN2,[a.C.WAN3]:l.E.WAN3,[a.C.WAN4]:l.E.WAN4,[a.C.WAN5]:l.E.WAN5,[a.C.WAN6]:l.E.WAN6,[a.C.WAN7]:l.E.WAN7,[a.C.WAN8]:l.E.WAN8,[a.C.WAN9]:l.E.WAN9,[a.C.WAN10]:l.E.WAN10,[a.C.WAN11]:l.E.WAN11},o=e=>r[e]},553432:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(296540),l=n(454195),r=n(566723),o=n(294303);const i=e=>a.createElement(o.A,{paddingTop:r.YC,paddingBottom:r.YC,gap:r.Ln,rowGap:r.YC,flexWrap:"wrap",minHeight:l.b,alignItems:"center",...e})},637364:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(28060);const l=(0,n(503767).A)(function(e,t,n){(0,a.A)(e,t,n)})},669868:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Xa});var a=n(296540),l=n(469733),r=n(349785),o=n(720903),i=n(804388),_=n(739354),s=n(839332),E=n(853801),c=n(883840),m=n(464265),A=n(641777),d=n(79786),N=n(860631),u=n(398300),p=n(566723),T=n(48925),I=n(294303),S=n(845030),O=n(699784),C=n(209782),D=n(936297),M=n(559639),v=n(540883),g=n(322326),f=n(186976),w=n(846236),b=n(339879),L=n(745667),R=n(302167),P=n(457311),h=n(233187),V=n(817068),y=n(366188),G=n(512746),W=n(634229),U=n(236103),F=n(602021),x=n(896291),k=n(598796),H=n(780811),B=n(532419),Y=n(171073),j=n(959341),K=n(134786),Q=n(74750),$=n(823858),X=n(71479),z=n(594827),Z=n(513180),q=n(147606),J=n(273640),ee=n(460176);const te=(0,X.A)($.A)`
  color: #ffffff;
`,ne=(0,X.A)(Q.A)`
  min-height: 36px;
`,ae=({form:e,wanNetworkGroup:t,handleSubmit:n})=>{const o=(0,l.useSelector)(J.Jn),i=(0,l.useSelector)(J.tB),_=(0,r.lN)(e),{formatMessage:s}=(0,O.tz)(),E=(0,r.FH)({control:e.control,name:"port"}),c=_.defaultValues?.port,m=i[E],A=(0,a.useMemo)(()=>o.find(({network_name:e})=>e===(0,ee.X)(t)),[t,o]),d=(0,a.useMemo)(()=>o.find(({port_idx:e})=>e===E),[E,o]),N=(0,a.useMemo)(()=>Boolean(A&&A?.up&&A?.network_name?.includes("wan")&&c!==E),[c,A,E]),u=(0,a.useMemo)(()=>Boolean(d&&d?.up&&t!==Z.C.WAN_LTE_FAILOVER&&c!==E),[c,E,d,t]),p=(0,a.useMemo)(()=>({portIdx:d?.port_idx||null,originalPortIdx:c,networkGroup:!d?.port_idx||u&&N?s({id:"SETTINGS_LAN"}):s({id:"COMMON_NETWORK_PURPOSE_WANX"},{number:(0,z.si)(t)})}),[s,c,u,N,t,d?.port_idx]),T=(0,a.useMemo)(()=>u&&N?{title:"SETTINGS_INTERNET_WAN_PORT_BOTH_CONFIRMATION_TITLE",message:m?"SETTINGS_INTERNET_WAN_PORT_BOTH_DISABLED_CONFIRMATION_MESSAGE":"SETTINGS_INTERNET_WAN_PORT_BOTH_CONFIRMATION_MESSAGE"}:N?{title:"SETTINGS_INTERNET_WAN_PORT_WAN_TO_LAN_CONFIRMATION_TITLE",message:"SETTINGS_INTERNET_WAN_PORT_WAN_TO_LAN_CONFIRMATION_MESSAGE"}:{title:"SETTINGS_INTERNET_WAN_PORT_LAN_TO_WAN_CONFIRMATION_TITLE",message:m?"SETTINGS_INTERNET_WAN_PORT_LAN_TO_WAN_DISABLED_CONFIRMATION_MESSAGE":"SETTINGS_INTERNET_WAN_PORT_LAN_TO_WAN_CONFIRMATION_MESSAGE"},[m,u,N]);return N||u||m?a.createElement(q.A,{title:a.createElement(O.sA,{id:T.title,values:p}),message:a.createElement(O.sA,{id:T.message,values:p}),trigger:a.createElement(ne,{type:"submit",isPending:_.isSubmitting},a.createElement(te,{variant:"fill"}),a.createElement(O.sA,{id:"COMMON_ACTION_APPLY_CHANGES"})),onConfirm:n}):a.createElement(ne,{type:"submit",isPending:_.isSubmitting,onClick:n},a.createElement(O.sA,{id:"COMMON_ACTION_APPLY_CHANGES"}))};var le=n(367828),re=n(232415),oe=n(407814),ie=n(383653),_e=n(149133),se=n(734265),Ee=n(475863),ce=n(263963),me=n(382803),Ae=n(333483),de=n(843375),Ne=n(257801),ue=n(817518),pe=n(517940),Te=n(546391),Ie=n(94076);const Se=({allowMulticast:e,allow4to6:t,allowZones:n}={allowMulticast:!1,allow4to6:!1,allowZones:!1})=>{let a=re.Ay.string().ip({version:"v6",message:(0,ce.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")});return n||(a=a.refine(e=>!(e&&e.includes("%")),{message:(0,ce.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")})),e&&(a=a.refine(e=>!(0,ie.m0)(e),{message:(0,ce.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_IPV4_MAPPED_IPV6_INVALID")})),t&&(a=a.refine(e=>!(0,ie.aN)(e),{message:(0,ce.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_MULTICAST_INVALID")})),a},Oe=(0,Ee.q)({networks:re.Ay.array(re.Ay.string()).min(1,{message:(0,ce.rn)("SETTINGS_VALIDATION_AT_LEAST_ONE_NETWORK")}),upnp_nat_pmp_enabled:re.Ay.boolean(),upnp_secure_mode:re.Ay.boolean()}),Ce=(0,Ee.q)({networkIds:re.Ay.array(re.Ay.string()).min(1,{message:(0,ce.rn)("SETTINGS_VALIDATION_AT_LEAST_ONE_NETWORK")})}),De=(e,t)=>(0,Ee.q)({wan_smartq_up_rate:re.Ay.number({required_error:(0,ce.rn)("SETTINGS_INTERNET_WAN_LABEL_SMART_QUEUES_UP_RATE_REQUIRED")}).min(0).max(de.F_,(0,ce.rn)("SETTINGS_VALIDATION_MAX_MBPS",{limit:new Intl.NumberFormat(e).format(de.F_),name:t({id:"SETTINGS_INTERNET_WAN_LABEL_SMART_QUEUES_UP_RATE_LABEL"})})),wan_smartq_down_rate:re.Ay.number({required_error:(0,ce.rn)("SETTINGS_INTERNET_WAN_LABEL_SMART_QUEUES_DOWN_RATE_REQUIRED")}).min(0).max(de.F_,(0,ce.rn)("SETTINGS_VALIDATION_MAX_MBPS",{limit:new Intl.NumberFormat(e).format(de.F_),name:t({id:"SETTINGS_INTERNET_WAN_LABEL_SMART_QUEUES_UP_RATE_LABEL"})}))}),Me=re.Ay.discriminatedUnion("hasAtleastOneDefined",[re.Ay.object({hasAtleastOneDefined:re.Ay.literal(!0),downloadKbps:re.Ay.number().min(Ie.k.DOWNLOAD.MIN).max(Ie.k.DOWNLOAD.MAX),uploadKbps:re.Ay.number().min(Ie.k.DOWNLOAD.MIN).max(Ie.k.DOWNLOAD.MAX)}),re.Ay.object({hasAtleastOneDefined:re.Ay.literal(!1),downloadKbps:re.Ay.number().min(Ie.k.DOWNLOAD.MIN).max(Ie.k.DOWNLOAD.MAX).or(re.Ay.null()).default(null),uploadKbps:re.Ay.number().min(Ie.k.DOWNLOAD.MIN).max(Ie.k.DOWNLOAD.MAX).or(re.Ay.null()).default(null)})]),ve=(0,Ee.q)({value:re.Ay.string().regex(Te.b8,{message:(0,ce.rn)("COMMON_VALIDATION_VALID_MAC")}).refine(e=>!e||(0,se.d)(e),{message:(0,ce.rn)("COMMON_VALIDATION_UNICAST_MAC")})}),ge=(0,Ee.q)({value:re.Ay.number()}),fe=(0,Ee.q)({id:re.Ay.number().min(Ne.C.MIN_VLAN_WAN).max(Ne.C.MAX_WAN_VLAN),qos:ge}).refine(e=>!e.enabled||0!==e.id||e.qos.enabled,{path:["qos.enabled"],message:(0,ce.rn)("SETTINGS_INTERNET_WAN_LABEL_EGRESS_QOS_VALIDATION_VLAN0")}),we={wan_ip_aliases:re.Ay.array(re.Ay.string())},be={wan_username:(0,Ee.q)({value:re.Ay.string().min(1,{message:(0,ce.rn)("SETTINGS_INTERNET_WAN_LABEL_USERNAME_PPPOE_REQUIRED")}).regex(Te.wE,{message:(0,ce.rn)("SETTINGS_INTERNET_WAN_LABEL_USERNAME_VALIDATION")})}),x_wan_password:(0,Ee.q)({value:re.Ay.string().min(1,{message:(0,ce.rn)("SETTINGS_INTERNET_WAN_LABEL_PASSWORD_PPPOE_REQUIRED")}).regex(Te.ll,{message:(0,ce.rn)("SETTINGS_INTERNET_WAN_LABEL_PASSWORD_VALIDATION")})})},Le={wan_dslite_remote_host:(0,Ee.e)({value:re.Ay.string().regex(Te.pJ,{message:(0,ce.rn)("COMMON_VALIDATION_HOSTNAME_OR_IPV6")}).min(1,{message:(0,ce.rn)("COMMON_VALIDATION_HOSTNAME_OR_IPV6")})})},Re={service:re.Ay.nativeEnum(pe.Rt)},Pe=re.Ay.discriminatedUnion("type",[re.Ay.object({type:re.Ay.literal(pe.Zk.DS_LITE),...Le}),re.Ay.object({type:re.Ay.literal(pe.Zk.MAP_E),...Re}),re.Ay.object({type:re.Ay.literal(pe.Zk.DS_LITE_PPPOE),...Le,...be})]),he={wan_ip:re.Ay.string().ip({version:"v4",message:(0,ce.rn)("SETTINGS_NETWORKS_IPV4_ADDRESS_INVALID")}),wan_netmask:re.Ay.string().ip({version:"v4",message:(0,ce.rn)("COMMON_VALIDATION_VALID_SUBNET")}).regex(Te.Q0,{message:(0,ce.rn)("COMMON_VALIDATION_VALID_SUBNET")}).regex(Te.KX,{message:(0,ce.rn)("COMMON_VALIDATION_VALID_SUBNET_LIMIT")}),wan_gateway:re.Ay.string().ip({version:"v4",message:(0,ce.rn)("SETTINGS_NETWORKS_IPV4_ADDRESS_INVALID")}).optional(),...we},Ve=(0,Ee.e)({wan_dns1:re.Ay.string().ip({version:"v4",message:(0,ce.rn)("SETTINGS_NETWORKS_IPV4_ADDRESS_INVALID")}),wan_dns2:re.Ay.string().ip({version:"v4",message:(0,ce.rn)("SETTINGS_NETWORKS_IPV4_ADDRESS_INVALID")}).optional().or(re.Ay.literal(""))}),ye=re.Ay.array(re.Ay.object({optionNumber:re.Ay.number(),value:re.Ay.string().optional()})),Ge={wan_dhcp_options:ye,wan_dhcp_cos:(0,Ee.q)({value:re.Ay.number().min(Ie.i$).max(Ie.Si)})},We=re.Ay.intersection(re.Ay.object({dns:Ve}),re.Ay.discriminatedUnion("type",[re.Ay.object({type:re.Ay.literal(pe.M5.DISABLED)}),re.Ay.object({type:re.Ay.literal(pe.M5.DHCP),...Ge}),re.Ay.object({type:re.Ay.literal(pe.M5.STATIC),...he}),re.Ay.object({type:re.Ay.literal(pe.M5.PPPOE),...be,...we}),re.Ay.object({type:re.Ay.literal(pe.M5.IPV4_OVER_IPV6),type4over6:Pe})]).superRefine((e,{addIssue:t})=>{if(e.type===pe.M5.STATIC&&(e.wan_gateway&&e.wan_ip&&e.wan_gateway===e.wan_ip&&t({code:re.Ay.ZodIssueCode.custom,message:(0,ce.rn)("SETTINGS_NETWORKS_FORM_FIELD_WAN_IP_GATEWAY_IP"),path:["wan_gateway"]}),e.wan_netmask&&e.wan_ip&&e.wan_gateway)){const n=(0,_e.AO)(e.wan_ip,e.wan_netmask);(0,_e.xc)(n,e.wan_gateway)||t({code:re.Ay.ZodIssueCode.custom,message:(0,ce.rn)("SETTINGS_NETWORKS_FORM_FIELD_GATEWAY_IP_NOT_WITHIN_SUBNET"),path:["wan_gateway"]})}})),Ue=(0,Ee.e)({wan_ipv6_dns1:Se(),wan_ipv6_dns2:Se().optional().or(re.Ay.literal(""))}),Fe=(0,Ee.e)({value:re.Ay.number().min(Ie.S3,{message:(0,ce.rn)("COMMON_VALIDATION_SIZE_RANGE",{min:Ie.S3,max:Ie.mk})}).max(Ie.mk,{message:(0,ce.rn)("COMMON_VALIDATION_SIZE_RANGE",{min:Ie.S3,max:Ie.mk})})}),xe=re.Ay.discriminatedUnion("ipv6_wan_delegation_type",[re.Ay.object({ipv6_wan_delegation_type:re.Ay.literal(w.S.NONE)}),re.Ay.object({ipv6_wan_delegation_type:re.Ay.literal(w.S.SINGLE_NETWORK),single_network_lan:re.Ay.string()}),re.Ay.object({ipv6_wan_delegation_type:re.Ay.literal(w.S.PD)})]),ke={wan_ipv6:Se(),wan_gateway_v6:Se(),wan_prefixlen:re.Ay.number().min(Ie.QP,{message:(0,ce.rn)("SETTINGS_INTERNET_WAN_PREFIX_LENGTH_VALIDATION")}).max(Ie.u3,{message:(0,ce.rn)("SETTINGS_INTERNET_WAN_PREFIX_LENGTH_VALIDATION")})},He=re.Ay.discriminatedUnion("type",[re.Ay.object({type:re.Ay.literal(ue.c.DISABLED)}),re.Ay.object({type:re.Ay.literal(ue.c.DHCPV6),wan_dhcpv6_options:ye,wan_dhcpv6_cos:(0,Ee.q)({value:re.Ay.number().min(Ie.i$).max(Ie.Si)}),wan_dhcpv6_pd_size:Fe,dns:Ue}),re.Ay.object({type:re.Ay.literal(ue.c.SLAAC),slaac:xe,wan_dhcpv6_pd_size:Fe.optional(),dns:Ue}),re.Ay.object({type:re.Ay.literal(ue.c.STATIC),dns:Ue,...ke})]).superRefine((e,{addIssue:t})=>{e.type===ue.c.SLAAC&&e.slaac.ipv6_wan_delegation_type===w.S.PD&&e.wan_dhcpv6_pd_size&&(!1!==e.wan_dhcpv6_pd_size.auto||e.wan_dhcpv6_pd_size.value||t({code:re.Ay.ZodIssueCode.custom,message:(0,ce.rn)("COMMON_VALIDATION_VALUE_REQUIRED"),path:["wan_dhcpv6_pd_size"]})),e.type===ue.c.STATIC&&e.wan_gateway_v6&&e.wan_ipv6&&e.wan_gateway_v6===e.wan_ipv6&&t({code:re.Ay.ZodIssueCode.custom,message:(0,ce.rn)("SETTINGS_NETWORKS_FORM_FIELD_WAN_IPV6_GATEWAY_IP"),path:["wan_gateway_v6"]})}),Be=re.Ay.string().min(2,{message:(0,ce.rn)("COMMON_VALIDATION_MIN_CHARS",{min:2,name:(0,ce.rn)("COMMON_NAME")})}).max(32,{message:(0,ce.rn)("COMMON_VALIDATION_MAX_CHARS",{max:32,name:(0,ce.rn)("COMMON_NAME")})}),Ye=(0,oe.gM)("wan_load_balance_type",[re.Ay.object({wan_load_balance_type:re.Ay.literal(w.z.FAILOVER_ONLY),wan_load_balance_weight:re.Ay.number().min(Ie.z3).max(Ie.Vf).optional()}),re.Ay.object({wan_load_balance_type:re.Ay.literal(w.z.WEIGHTED),wan_load_balance_weight:re.Ay.number().min(Ie.z3).max(Ie.Vf)})]);var je=n(768195);var Ke,Qe=n(325898),$e=n(822336),Xe=n(961390),ze=n(275737),Ze=n(222190);!function(e){e[e.DOWNLOAD=0]="DOWNLOAD",e[e.UPLOAD=1]="UPLOAD"}(Ke||(Ke={}));const qe=({form:e})=>{const{motif:t}=(0,Qe.A)(),n=$e.Ay[`desktop-color-aqua-06-${t}`],l=$e.Ay[`desktop-color-purple-06-${t}`],o=e.formState.defaultValues?.ispCapabilities?.hasAtleastOneDefined,i=(0,r.FH)({name:"ispCapabilities.uploadKbps",control:e.control}),_=(0,r.FH)({name:"ispCapabilities.downloadKbps",control:e.control}),s=(0,r.FH)({name:"ispCapabilities.hasAtleastOneDefined",control:e.control}),E=(0,a.useCallback)(async(t,n)=>{const a=Number(n);if(n&&Number.isNaN(a))return;const l=t===Ke.DOWNLOAD?i||void 0:_||void 0,r=o||Boolean(l||a);s!==r&&e.setValue("ispCapabilities.hasAtleastOneDefined",r)},[i,_,o,s,e]);return a.createElement(I.A,{alignItems:"flex-start",gap:p.kc},a.createElement(Ze.A,{control:e.control,name:"ispCapabilities.downloadKbps",label:a.createElement(O.sA,{id:"COMMON_EXPECTED_ISP_SPEEDS"}),contentAfter:"Mbps",iconBefore:a.createElement(ze.A,{color:n,size:"large"}),min:Ie.k.DOWNLOAD.MIN,max:Ie.k.DOWNLOAD.MAX,onAfterChange:({target:e})=>E(Ke.DOWNLOAD,null===e.value?void 0:e.value)}),a.createElement(Ze.A,{control:e.control,name:"ispCapabilities.uploadKbps",label:a.createElement(O.sA,{id:"COMMON_EXPECTED_ISP_SPEEDS"}),contentAfter:"Mbps",iconBefore:a.createElement(Xe.A,{color:l,size:"large"}),min:Ie.k.DOWNLOAD.MIN,max:Ie.k.DOWNLOAD.MAX,onAfterChange:({target:e})=>E(Ke.UPLOAD,null===e.value?void 0:e.value)}))};var Je=n(71265),et=n(332431),tt=n(188738),nt=n(897502),at=n(454195),lt=n(821580);const rt=(0,Je.R)(1,7),ot=({form:e})=>{const t=(0,r.FH)({control:e.control,name:"vlan.enabled"}),n=(0,r.FH)({control:e.control,name:"vlan.qos.enabled"}),l=(0,r.FH)({control:e.control,name:"vlan.qos.value"});return a.createElement(a.Fragment,null,a.createElement(I.A,{gap:p.YC,minHeight:at.b,justifyContent:"space-between",alignItems:"flex-start"},a.createElement(lt.A,{flex:"1"},a.createElement(nt.A,{control:e.control,name:"vlan.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_WIFI_ADVANCED_SPECIFY_VLAN_DESCRIPTION"}),onToggle:t=>{t||(e.setValue("ipv4Configuration.wan_dhcp_cos.enabled",!1),e.setValue("ipv6Configuration.wan_dhcpv6_cos.enabled",!1))}},a.createElement(O.sA,{id:"COMMON_VLAN_ID"}))),t?a.createElement(I.A,{minHeight:at.b,flexDirection:"column",flex:"1"},a.createElement(Ze.A,{control:e.control,name:"vlan.id",placeholder:Ne.C.MIN_VLAN_WAN.toString(),min:Ne.C.MIN_VLAN_WAN,max:Ne.C.MAX_WAN_VLAN,onAfterChange:()=>{e.trigger("vlan.qos.enabled")}})):null),t?a.createElement(I.A,{flexDirection:"column"},a.createElement(I.A,{alignItems:"center",gap:p.YC,height:at.b},a.createElement(I.A,{flex:"1"},a.createElement(nt.A,{control:e.control,name:"vlan.qos.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_LABEL_EGRESS_QOS_DESCRIPTION"}),onToggle:t=>{l||e.setValue("vlan.qos.value",1,{shouldValidate:!0,shouldTouch:!0})}},a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_LABEL_EGRESS_QOS"}))),n?a.createElement(I.A,{flex:"1"},a.createElement(tt.A,{control:e.control,name:"vlan.qos.value",options:rt})):null),a.createElement(et.Ay,{noMargin:!0,form:e,name:"vlan.qos.enabled"})):null)};var it=n(278138),_t=n(334188);const st=({form:e})=>{const{motif:t}=(0,Qe.A)(),n=$e.Ay[`desktop-color-aqua-06-${t}`],o=$e.Ay[`desktop-color-purple-06-${t}`],i=(0,l.useSelector)(_t.lp),_=(0,l.useSelector)(_t.Fw),s=i&&!_,E=(0,r.FH)({control:e.control,name:"smartQueues.enabled"});return a.createElement(a.Fragment,null,a.createElement(it.A,{form:e,name:"smartQueues.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_DESCRIPTION_SMART_QUEUES"}),confirmationTitle:a.createElement(O.sA,{id:"SETTINGS_ENABLE_SMART_QUEUES_TITLE"}),confirmationMessage:a.createElement(O.sA,{id:"SETTINGS_ENABLE_SMART_QUEUES_DESCRIPTION"}),skipConfirmation:!s},a.createElement(O.sA,{id:"COMMON_SMART_QUEUES"})),E?a.createElement(I.A,{alignItems:"flex-start",gap:p.kc},a.createElement(Ze.A,{control:e.control,name:"smartQueues.wan_smartq_down_rate",label:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_LABEL_SMART_QUEUES_DOWN_RATE_LABEL"}),contentAfter:"Mbps",iconBefore:a.createElement(ze.A,{color:n,size:"large"}),min:Ie.k.DOWNLOAD.MIN,max:Ie.k.DOWNLOAD.MAX}),a.createElement(Ze.A,{control:e.control,name:"smartQueues.wan_smartq_up_rate",label:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_LABEL_SMART_QUEUES_UP_RATE_LABEL"}),contentAfter:"Mbps",iconBefore:a.createElement(Xe.A,{color:o,size:"large"}),min:Ie.k.UPLOAD.MIN,max:Ie.k.UPLOAD.MAX})):null)};var Et=n(277184),ct=n(718073),mt=n(814680),At=n(115829),dt=n(460680),Nt=n(962669);const ut=8*mt.k,pt=(0,X.A)(Et.p)`
  div[class*='additionalInfo'] {
    padding-left: 8px;
    flex: 1;
    flex-grow: 1;
    min-width: 0;
    justify-items: flex-end;
  }
  p[class*='textBlock'] {
    width: 100%;
  }
`,Tt=e=>a.createElement(ct.A,{description:e.option.tooltipDescription,placement:"left"},a.createElement(pt,{...e})),It=({form:e,wanNetworkGroup:t})=>{const{formatMessage:n}=(0,O.tz)(),r=(0,m.A)(k.Xj.MULTIPLE_WAN_NETWORKS),o=(0,l.useSelector)(B.XU),i=(0,l.useSelector)(B.$x),_=(0,l.useSelector)(J.Jn),s=(0,l.useSelector)(dt.qS),E=(0,a.useMemo)(()=>{const e=_.map(e=>{const{port_idx:l=0,nameOverride:r,lag_idx:o,aggregated_by:_,ifname:E,network_name:c=""}=e,m=(0,z.pg)(c),A=(0,ee.X)(t)===c,d=m&&!A,N=Boolean(o)||Boolean(_),u=E===s,p=d||N||u,T=(0,D.JR)(c,d,N,u),I=(0,le.O6)(e),S=(0,Nt.LS)(e,i),O=I?`${n({id:"COMMON_PORT"})} ${S} (${I})`:`${n({id:"COMMON_PORT"})} ${S}`,C=r&&!O.includes(r)?a.createElement(At.A,{color:"inherit",size:"inherit"},r):void 0;return{value:l,label:O,additionalInfo:C,disabled:p,tooltipDescription:T}}).sort((e,t)=>(e.value||0)-(t.value||0));return t===Z.C.WAN?e:e.concat([{value:D.k5,label:n({id:"COMMON_UNASSIGNED"}),disabled:!1,additionalInfo:void 0,tooltipDescription:null}])},[_,t,n,s]);return r?a.createElement(A.A,{isDisabled:o},a.createElement(tt.A,{control:e.control,name:"port",label:a.createElement(O.sA,{id:"COMMON_PORT"}),renderOption:Tt,options:E,maxHeight:ut})):null};var St=n(895424);const Ot=({form:e})=>a.createElement(St.A,{control:e.control,name:"name",label:a.createElement(O.sA,{id:"COMMON_NAME"})});var Ct=n(400261);const Dt=({form:e})=>{const t=(0,l.useSelector)(B.jY),{formatMessage:n}=(0,O.tz)(),o=(0,r.FH)({control:e.control,name:"macOverride.enabled"});return t?a.createElement(I.A,{gap:p.kc,flexDirection:"column"},a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:"macOverride.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_DESCRIPTION_MAC_ADDRESS_CLONE"})},a.createElement(O.sA,{id:"COMMON_MAC_ADDRESS_CLONE"}))),o?a.createElement(I.A,{minHeight:at.b},a.createElement(St.A,{control:e.control,name:"macOverride.value",placeholder:n({id:"COMMON_MAC_ADDRESS"}),onChange:({target:{value:t}})=>e.setValue("macOverride.value",(0,Ct.Z)(t),{shouldValidate:!1,shouldDirty:!0,shouldTouch:!0})})):null):null};var Mt=n(242366),vt=n(317672),gt=n(792072);const ft=({form:e,wanNetworkGroup:t})=>{const n=(0,l.useSelector)(gt.Q3),{formatMessage:o}=(0,O.tz)(),i=(0,r.FH)({control:e.control,name:"loadBalancing.wan_load_balance_type"}),_=(0,a.useMemo)(()=>(n?Ie.ni:Ie.ni.filter(({value:e})=>e!==w.z.WEIGHTED)).map(e=>({...e,label:o({id:e.label})})),[o,n]);return n?a.createElement(a.Fragment,null,t===Z.C.WAN2?a.createElement(Mt.A,null,a.createElement(I.A,{flex:"1"},a.createElement(vt.A,null,a.createElement(O.sA,{id:"COMMON_LOAD_BALANCING"}))),a.createElement(I.A,{flex:"1"},a.createElement(tt.A,{control:e.control,name:"loadBalancing.wan_load_balance_type",options:_}))):null,i===w.z.WEIGHTED&&t===Z.C.WAN2?a.createElement(Mt.A,null,a.createElement(I.A,{flex:"1"},a.createElement(vt.A,null,a.createElement(O.sA,{id:"COMMON_LOAD_BALANCING_WEIGHT"}))),a.createElement(I.A,{flex:"1"},a.createElement(Ze.A,{control:e.control,name:"loadBalancing.wan_load_balance_weight",min:Ie.z3,max:Ie.Vf}))):null):null};var wt=n(217439),bt=n(284428),Lt=n(621690);const Rt=({form:e})=>{const{formatMessage:t}=(0,O.tz)(),n=(0,a.useMemo)(()=>(0,Lt.A)(Ie.QP,Ie.u3+1).map(e=>({label:e.toString(),value:e})),[]);return a.createElement(a.Fragment,null,a.createElement(I.A,{gap:p.kc,alignItems:"flex-start"},a.createElement(St.A,{control:e.control,name:"ipv6Configuration.wan_ipv6",label:a.createElement(O.sA,{id:"COMMON_IPV6_ADDRESS"})}),a.createElement(I.A,{width:140},a.createElement(tt.A,{control:e.control,name:"ipv6Configuration.wan_prefixlen",label:a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_NETMASK"}),options:n,placeholder:t({id:"COMMON_SELECT"})}))),a.createElement(St.A,{control:e.control,name:"ipv6Configuration.wan_gateway_v6",label:a.createElement(O.sA,{id:"COMMON_GATEWAY_IP"}),tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_LABEL_GW_IP_DESC"})}))};var Pt=n(610356),ht=n(553432);const Vt=({form:e})=>{const t=(0,r.FH)({control:e.control,name:"ipv6Configuration.wan_dhcpv6_pd_size.auto"});return a.createElement(I.A,{flexDirection:"column"},a.createElement(vt.A,{htmlFor:"wan_dhcpv6_pd_size",tooltip:a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_FIELDS_IPV6_PD_PREFIX_SIZE_DESC"})},a.createElement(O.sA,{id:"COMMON_PREFIX_DELEGATION_SIZE"})),a.createElement(I.A,{minHeight:at.b,alignItems:"flex-start",justifyContent:"space-between",gap:p.kc},a.createElement(lt.A,{flex:"1"},a.createElement(nt.A,{control:e.control,name:"ipv6Configuration.wan_dhcpv6_pd_size.auto"},a.createElement(O.sA,{id:"COMMON_VALUE_AUTO"}))),t?null:a.createElement(I.A,{flex:"1"},a.createElement(Ze.A,{control:e.control,name:"ipv6Configuration.wan_dhcpv6_pd_size.value",min:Ie.S3,max:Ie.mk}))))},yt=[w.S.PD,w.S.SINGLE_NETWORK],Gt={[w.S.SINGLE_NETWORK]:"COMMON_SINGLE_NETWORK",[w.S.PD]:"COMMON_PREFIX_DELEGATION"},Wt=({form:e,wanNetworkGroup:t,hideUdr5GOptions:n})=>{const o=(0,r.FH)({control:e.control,name:"ipv6Configuration.slaac.ipv6_wan_delegation_type"}),i=(0,l.useSelector)((0,a.useMemo)(()=>(0,C.bF)(t),[t]));return a.createElement(a.Fragment,null,a.createElement(ht.A,null,yt.filter(e=>!n||e!==w.S.PD).map(t=>a.createElement(Pt.A,{control:e.control,name:"ipv6Configuration.slaac.ipv6_wan_delegation_type",value:t},a.createElement(O.sA,{id:Gt[t]})))),o===w.S.PD?a.createElement(Vt,{form:e}):null,o===w.S.SINGLE_NETWORK?a.createElement(tt.A,{control:e.control,name:"ipv6Configuration.slaac.single_network_lan",options:i,label:a.createElement(O.sA,{id:"COMMON_NETWORK"})}):null)};var Ut=n(413089),Ft=n(349665);const xt={[ue.c.DISABLED]:"COMMON_DISABLED",[ue.c.SLAAC]:"COMMON_SLAAC",[ue.c.DHCPV6]:"COMMON_DHCPV6",[ue.c.STATIC]:"COMMON_STATIC"},kt=[ue.c.SLAAC,ue.c.STATIC],Ht=[ue.c.SLAAC,ue.c.STATIC],Bt=({form:e,hideUdr5GOptions:t,isU5GLan:n,isU5GWan:l})=>{const o=(0,m.A)(k.Xj.WAN_DHCPV6_STATELESS),i=(0,a.useMemo)(()=>[ue.c.DISABLED,o?ue.c.SLAAC:void 0,t?void 0:ue.c.DHCPV6,t?void 0:ue.c.STATIC].filter(Ut.z),[t,o]),_=(0,r.FH)({control:e.control,name:"ipv4Configuration.type"}),s=(0,a.useCallback)(t=>async()=>{t===ue.c.DISABLED&&_===pe.M5.IPV4_OVER_IPV6&&e.setValue("ipv4Configuration.type",pe.M5.DHCP),await e.setValue("ipv6Configuration.type",t),t===ue.c.DISABLED&&await e.setValue("ipv6Configuration.dns.auto",!0)},[e,_]),E=(0,a.useCallback)(e=>!!e&&(!(!n||!kt.includes(e))||!(!l||!Ht.includes(e))),[n,l]);return a.createElement(Ft.A,null,a.createElement(vt.A,null,a.createElement(O.sA,{id:"COMMON_CONNECTION"})),a.createElement(ht.A,{gap:p.kc},i.map(t=>a.createElement(A.A,{isDisabled:E(t)},a.createElement(Pt.A,{control:e.control,name:"ipv6Configuration.type",value:t,onCheck:s(t)},a.createElement(O.sA,{id:xt[t]}))))))};var Yt=n(823084);const jt=({form:e})=>{const{formatMessage:t}=(0,O.tz)(),n=(0,r.FH)({control:e.control,name:"ipv6Configuration.dns.auto"}),l=(0,r.FH)({control:e.control,name:"ipv4Configuration.dns.auto"});return a.createElement(I.A,{gap:p.kc,minHeight:at.b,justifyContent:"space-between",alignItems:"flex-start",flexDirection:"column"},a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:"ipv6Configuration.dns.auto",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_LABEL_DNS_SERVER_DESCRIPTION"})},a.createElement(O.sA,{id:"COMMON_AUTO_DNS_SERVERS"}))),n?null:a.createElement(a.Fragment,null,a.createElement(St.A,{control:e.control,name:"ipv6Configuration.dns.wan_ipv6_dns1",label:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_DNS_SERVER_PRIMARY_SERVER"}),placeholder:t({id:"COMMON_IPV6_ADDRESS_NORMAL_CASE"})}),a.createElement(St.A,{control:e.control,name:"ipv6Configuration.dns.wan_ipv6_dns2",label:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_DNS_SERVER_SECONDARY_SERVER"}),placeholder:t({id:"COMMON_IPV6_ADDRESS_NORMAL_CASE"})}),l?a.createElement(Yt.A,null,a.createElement(O.sA,{id:"SETTINGS_CUSTOM_DNSV6_USED_BEFORE_DYNAMIC_DNSV4"})):null))};var Kt=n(369596),Qt=n(870443);const $t=[1,11,16],Xt=[15],zt=[17],Zt=[11,16],qt=[{id:"optionNumber",label:a.createElement(O.sA,{id:"COMMON_OPTION"}),sortable:!1},{id:"value",label:a.createElement(O.sA,{id:"COMMON_VALUE"}),sortable:!1,width:50}],Jt={optionNumber:"COMMON_OPTION",value:"COMMON_VALUE"},en=[...$t,...Xt,...zt].sort(),tn=en.map(e=>({label:`${e}`,value:e})),nn=[{name:"new_option_number",placeholder:"COMMON_SELECT",type:"dropdown",options:tn,label:a.createElement(vt.A,{tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCPV6_OPTIONS_TOOLTIP"}),tooltipProps:{portal:!0}},a.createElement(At.A,null,a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCPV6_OPTIONS"}))),inline:!0,validated:!0,propFunc:(e,t)=>{if(e.wan_dhcpv6_options){const t=tn.map(t=>({...t,disabled:!!e.wan_dhcpv6_options.find(e=>e.optionNumber===t.value)})),n=t.every(e=>e.disabled);return{options:t,disabled:n}}return t?{options:tn.map(n=>({...n,disabled:!!t.find(t=>t.optionNumber!==e.optionNumber&&t.optionNumber===n.value)}))}:{}}},{name:"new_value",placeholder:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS_FIELD_LABEL_VALUE",type:"text",label:"COMMON_VALUE",inline:!0,propFunc:e=>{const t=e?.new_option_number||e?.optionNumber;return t&&zt.includes(Number(t))?{disabled:!0,valueInputTooltip:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTION_17_VALUE_TOOLTIP",value:void 0}:{disabled:e?.wan_dhcpv6_options?.length===tn.length}},containerFlexProps:{minWidth:"184px"}}],an=Qt.A.number().required(a.createElement(O.sA,{id:"COMMON_VALIDATION_VALUE_REQUIRED"})),ln=Qt.A.string().required(a.createElement(O.sA,{id:"COMMON_VALIDATION_VALUE_REQUIRED"})),rn=Qt.A.string().required(a.createElement(O.sA,{id:"SETTINGS_VALIDATION_VALUE_OR_MULTIPLE_REQUIRED"})),on=Qt.A.object().shape({editActive:Qt.A.bool(),new_option_number:Qt.A.number().when("editActive",{is:!1,then:an}),new_value:Qt.A.string().when(["editActive","new_option_number"],{is:(e,t)=>!1===e&&$t.includes(Number(t)),then:ln}).when(["editActive","new_option_number"],{is:(e,t)=>!1===e&&Xt.includes(Number(t)),then:rn}).test("isDuid",a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS_DUID_VALIDATION"}),(e,t)=>!1!==t.parent.editActive||1!==t.parent?.new_option_number||(0,ie.i_)(e?.trim())).test("isHex",a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS_HEX_VALIDATION"}),(e,t)=>!1!==t.parent.editActive||!Zt.includes(t.parent?.new_option_number)||Te.UG.test(e?.trim())).test("isOption11OverMinLength",a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTION_11_LENGTH_VALIDATION"}),(e,t)=>!1!==t.parent.editActive||!e||11!==t.parent?.new_option_number||e.trim().length%2==0&&e.trim()?.length>=22),wan_dhcpv6_options:Qt.A.array().when("editActive",{is:!0,then:Qt.A.array().of(Qt.A.object().shape({optionNumber:an,value:Qt.A.string().when("optionNumber",{is:e=>$t.includes(Number(e)),then:ln}).when("optionNumber",{is:e=>Xt.includes(Number(e)),then:rn}).test("isDuid",a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS_DUID_VALIDATION"}),(e,t)=>!e||1!==t.parent?.optionNumber||(0,ie.i_)(e?.trim())).test("isHex",a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS_HEX_VALIDATION"}),(e,t)=>!e||!Zt.includes(t.parent?.optionNumber)||Te.UG.test(e?.trim())).test("isOption11OverMinLength",a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTION_11_LENGTH_VALIDATION"}),(e,t)=>!e||11!==t.parent?.optionNumber||e.trim().length%2==0&&e.trim().length>=22)}))})}),_n=({form:e})=>{const t=(0,r.FH)({control:e.control,name:"ipv6Configuration.wan_dhcpv6_options"}),n=(0,a.useMemo)(()=>{const e=new Set((t||[]).map(e=>e.optionNumber)),n=en.find(t=>!e.has(t));return{editActive:!1,wan_dhcpv6_options:(t||[]).map((e,t)=>({id:`wan_dhcp_option-${t}`,optionNumber:e.optionNumber,value:e.value})),new_option_number:n||en[0],new_value:""}},[t]),l=(0,a.useCallback)((t=[])=>e.setValue("ipv6Configuration.wan_dhcpv6_options",t.map(({optionNumber:e,value:t})=>({optionNumber:e,value:t})),{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0}),[e]),o=(0,a.useCallback)(({wan_dhcpv6_options:e,new_option_number:t,new_value:n})=>{const a=zt.includes(Number(t));l([...e,{optionNumber:t,value:a?void 0:n}])},[l]),i=(0,a.useCallback)(({id:e})=>{l(n.wan_dhcpv6_options.filter(t=>e!==t.id))},[l,n.wan_dhcpv6_options]),_=(0,a.useCallback)(e=>{l(e.map(e=>({...e,value:zt.includes(Number(e.optionNumber))?void 0:e.value})))},[l]);return a.createElement(Kt.A,{fieldName:"wan_dhcpv6_options",columns:qt,fieldLabels:Jt,newFields:nn,onAddItem:o,onRemoveItem:i,onEditSubmit:_,initialValues:n,validationSchema:on,isWindowTable:!0,max:en.length})},sn=({form:e})=>a.createElement(_n,{form:e});var En=n(504779);const cn=({form:e})=>{const t=(0,r.FH)({control:e.control,name:"vlan.enabled"}),n=(0,r.FH)({control:e.control,name:"ipv6Configuration.wan_dhcpv6_cos.value"}),l=(0,r.FH)({control:e.control,name:"ipv6Configuration.wan_dhcpv6_cos.enabled"});return a.createElement(I.A,{gap:p.kc,alignItems:"flex-start"},a.createElement(lt.A,{flex:"1"},a.createElement(En.A,{noWrap:!0,reason:t?null:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_COS_DISABLED_TOOLTIP"})},a.createElement(I.A,null,a.createElement(nt.A,{control:e.control,name:"ipv6Configuration.wan_dhcpv6_cos.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_DHCPV6_COS_DESCRIPTION"}),onToggle:()=>{n||e.setValue("ipv6Configuration.wan_dhcpv6_cos.value",1,{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0})}},a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_IPV6_COS"}))))),l?a.createElement(I.A,{flex:"1"},a.createElement(tt.A,{control:e.control,name:"ipv6Configuration.wan_dhcpv6_cos.value",options:Ie.VE})):null)},mn=({form:e,isU5GWan:t,isU5GLan:n})=>{const r=(0,l.useSelector)(B.jY);return t||n?null:a.createElement(a.Fragment,null,r?a.createElement(sn,{form:e}):null,a.createElement(cn,{form:e}),a.createElement(Vt,{form:e}))},An=({form:e,wanNetworkGroup:t,hideUdr5GOptions:n,isU5GLan:l,isU5GWan:o})=>{const i=(0,r.FH)({control:e.control,name:"ipv6Configuration.type"}),_=(0,bt.mQ)();return a.createElement(a.Fragment,null,a.createElement(I.A,{minHeight:at.b,alignItems:"center"},a.createElement(wt.A,{weight:"bold",color:_?"disabled":void 0},a.createElement(O.sA,{id:"COMMON_IPV6_CONFIGURATION"}))),a.createElement(Bt,{form:e,hideUdr5GOptions:n,isU5GLan:l,isU5GWan:o}),i===ue.c.DHCPV6?a.createElement(mn,{form:e,isU5GWan:o,isU5GLan:l}):null,i===ue.c.SLAAC?a.createElement(Wt,{form:e,wanNetworkGroup:t,hideUdr5GOptions:n}):null,i===ue.c.STATIC?a.createElement(Rt,{form:e}):null,i!==ue.c.DISABLED?a.createElement(jt,{form:e}):null)};var dn=n(592563),Nn=n(62170),un=n(152408),pn=n(721084);const Tn=({form:e,id:t})=>{const n=(0,l.useSelector)(V.nI),o=(0,l.useSelector)(b.$D),i=(0,l.useSelector)(B.Lt),_=(0,m.A)(k.Xj.IGMP_PROXY),s=(0,l.useDispatch)(),E=(0,r.FH)({control:e.control,name:"igmpProxy.enabled"}),c=(0,a.useMemo)(()=>o.find(e=>e.configuration.igmp_proxy_upstream&&e.configuration.igmp_proxy_for!==pn.w.NONE),[o]),A=!!c&&c.configuration._id!==t,d=c?.configuration.name;return _?a.createElement(I.A,{gap:p.kc,minHeight:at.b,justifyContent:"space-between",alignItems:"flex-start",flexDirection:"column"},a.createElement(lt.A,null,a.createElement(En.A,{isInteractive:!0,reason:A?a.createElement(O.sA,{id:"SETTINGS_INTERNET_IPTV_STREAMING_DISABLED_TOOLTIP",values:{wan:a.createElement(dn.A,{onClick:()=>{s((0,S.XP)({type:u.H.WAN,id:c?.configuration._id||"new"}))}},d)}}):null},a.createElement(nt.A,{control:e.control,name:"igmpProxy.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_IPTV_STREAMING_TOOLTIP"})},a.createElement(O.sA,{id:"COMMON_IGMP_PROXY"})))),E?a.createElement(Nn.A,{truncateLabels:!0,control:e.control,options:n,name:"igmpProxy.networkIds"}):null,E&&i?a.createElement(un.A,{feature:"SETTINGS_INTERNET_IPTV_STREAMING"}):null):null};var In,Sn=n(963070),On=n(547868),Cn=n(177651),Dn=n(396660),Mn=n(273299),vn=n(320336);!function(e){e.HOST_NAME="host_name",e.SERVER="server"}(In||(In={}));const gn={[vn.Z.CLOUDFLARE]:"SETTINGS_DYNAMIC_DNS_CLOUDFLARE",[vn.Z.CUSTOM]:"COMMON_CUSTOM"},fn={[vn.Z.CLOUDFLARE]:{[In.SERVER]:!1}},wn=[{compare:(0,Dn.l0)(({service:e})=>e),id:"dynamic-dns-service",label:a.createElement(O.sA,{id:"COMMON_SERVICE"}),renderCell:({service:e})=>gn[e]?a.createElement(O.sA,{id:gn[e]}):(0,Mn.Z)(e)||a.createElement(O.sA,{id:"COMMON_FALLBACK"}),sortable:!0,minWidth:100,maxWidth:150},{compare:(0,Dn.l0)(({host_name:e})=>e),id:"dynamic-dns-hostname",label:a.createElement(O.sA,{id:"COMMON_HOSTNAME"}),renderCell:({host_name:e})=>e||a.createElement(O.sA,{id:"COMMON_FALLBACK"}),sortable:!0,minWidth:100,maxWidth:150},{compare:(0,Dn.l0)(({server:e})=>e),id:"dynamic-dns-server",label:a.createElement(O.sA,{id:"COMMON_SERVER"}),renderCell:({server:e})=>e||a.createElement(O.sA,{id:"COMMON_FALLBACK"}),sortable:!0,minWidth:100}];var bn=n(951272),Ln=n(742920),Rn=n(675359),Pn=n(86392),hn=n(934474);const Vn=(e,t)=>(e||void 0)===(t||void 0);var yn=n(784045),Gn=n(927099),Wn=n(874734),Un=n(705426),Fn=n(704025),xn=n(143811),kn=n(801081),Hn=n(25553),Bn=n(87485),Yn=n(261687);const jn=(0,Hn.uh)((0,Yn.T)()),Kn=(0,kn.Mz)(jn,Bn.i6),Qn=(0,kn.Mz)(Kn,e=>e.ddns||[]),$n=(0,X.A)(Un.A)`
  & > footer > div {
    width: 100%;
    & > div:first-child {
      margin-right: auto;
    }
  }
`,Xn="example.com",zn=`hostname.${Xn}`,Zn=({closeModal:e,isEdit:t,handleRemove:n})=>{const{formatMessage:r}=(0,O.tz)(),{isSubmitting:o,errors:i,handleSubmit:_,values:s}=(0,bn.j7)(),E=(0,l.useSelector)(Qn),c=(0,a.useMemo)(()=>(0,yn.A)(E.map(e=>({value:e,label:gn[e]?r({id:gn[e]}):(0,Mn.Z)(e)})),[e=>e.value===vn.Z.CUSTOM?-1:0,e=>e.label]),[E,r]),m=(0,a.useMemo)(()=>[...t?[{disabled:o,text:a.createElement(Gn.A,{color:"danger",size:"body"},a.createElement(O.sA,{id:"COMMON_ACTION_REMOVE"})),type:Wn.EY.BUTTON,variant:"default",onClick:n}]:[],{disabled:o,text:a.createElement(O.sA,{id:"COMMON_ACTION_CANCEL"}),type:Wn.EY.BUTTON,variant:"default",onClick:e},{disabled:o,text:a.createElement(O.sA,{id:t?"COMMON_ACTION_SAVE":"COMMON_ACTION_CREATE"}),type:Wn.EY.BUTTON,variant:"primary",onClick:()=>{_()}}],[t,o,n,e,_]);return a.createElement($n,{size:"small",title:a.createElement(O.sA,{id:"COMMON_DYNAMIC_DNS"}),isOpen:!0,actions:m,onRequestClose:e,allowOverflow:!0},a.createElement(Mt.A,null,a.createElement(I.A,{width:"100%",flexDirection:"column"},a.createElement(xn.A,{full:!0,type:"dropdown",name:"service",options:c,renderOption:Fn.i,variant:"secondary",label:a.createElement(O.sA,{id:"COMMON_SERVICE"}),validated:!0})),s.service?a.createElement(a.Fragment,null,a.createElement(xn.A,{full:!0,name:"host_name",variant:"secondary",label:"COMMON_HOSTNAME",placeholder:s.service===vn.Z.CLOUDFLARE?zn:void 0,translatePlaceholder:!1}),a.createElement(xn.A,{full:!0,name:"login",variant:"secondary",label:s.service===vn.Z.CLOUDFLARE?"SETTINGS_ZONE_NAME":"COMMON_LABEL_USERNAME",placeholder:s.service===vn.Z.CLOUDFLARE?Xn:void 0,translatePlaceholder:!1}),a.createElement(xn.A,{full:!0,passwordToggle:!0,type:"password",name:"x_password",variant:"secondary",label:s.service===vn.Z.CLOUDFLARE?"SETTINGS_API_TOKEN":"COMMON_PASSWORD",autoComplete:"new-password"}),!1!==fn[s.service]?.[In.SERVER]?a.createElement(xn.A,{full:!0,name:"server",variant:"secondary",label:"COMMON_SERVER"}):null):null))},qn=e=>({interface:vn.E.WAN,host_name:"",login:"",x_password:"",server:"",...e}),Jn=({initialValues:e,closeModal:t})=>{const n=(0,l.useDispatch)(),r=(0,l.useSelector)(Cn.E),o=(0,a.useCallback)((a,{setSubmitting:l})=>n((0,hn.SA)({_id:e?._id,service:a.service,host_name:a.host_name,interface:a.interface,login:a.login,x_password:a.x_password,server:!1!==fn[a.service]?.[In.HOST_NAME]?a.server:""})).then(()=>{t()}).catch(e=>{t(),n((0,Rn.ox)({errorMessage:e.msg,errorValues:e,icon:Ln.C.danger,message:"SETTINGS_GENERAL_SAVE_ERROR"})),l(!1)}),[t,n,e?._id]),i=!!e._id,_=(0,a.useCallback)(()=>{n((0,Pn.l)({name:e.service,onConfirm:()=>n((0,hn.lu)(e)).then(()=>t())}))},[t,n,e]),s=(0,a.useMemo)(()=>{return t=r.filter(({_id:t})=>t!==e?._id),Qt.A.object().shape({interface:Qt.A.string(),service:Qt.A.string().label("COMMON_SERVICES").required(),host_name:Qt.A.string().label("COMMON_HOSTNAME").required().test("isConfigurationUnique",a.createElement(O.sA,{id:"SETTINGS_DYNAMIC_CONFIG_ALREADY_EXISTS"}),(e,n)=>!t.some(t=>Vn(t.service,n?.parent?.service)&&Vn(t.interface,n?.parent?.interface)&&Vn(t.login,n?.parent?.login)&&Vn(t.server.toLowerCase(),n?.parent?.server?.toLowerCase())&&Vn(t.host_name?.toLowerCase(),e?.toLowerCase()))),login:Qt.A.string().when("service",{is:e=>e===vn.Z.CLOUDFLARE,then:Qt.A.string().label("SETTINGS_ZONE_NAME").required(),otherwise:Qt.A.string().label("COMMON_LABEL_USERNAME").required()}),x_password:Qt.A.string().when("service",{is:e=>e===vn.Z.CLOUDFLARE,then:Qt.A.string().label("SETTINGS_API_TOKEN").required(),otherwise:Qt.A.string().label("COMMON_PASSWORD").required()}),server:Qt.A.string()});var t},[r,e._id]);return a.createElement(bn.l1,{onSubmit:o,initialValues:qn(e),validationSchema:s},a.createElement(Zn,{closeModal:t,isEdit:i,handleRemove:_}))},ea=({closeModal:e,wanNetworkGroup:t,id:n})=>{const r=(0,l.useSelector)(Cn.E).find(e=>e._id===n),o={interface:(0,On.d)(t)||vn.E.WAN};return a.createElement(Jn,{initialValues:r||o,closeModal:e})},ta=({wanNetworkGroup:e})=>{const t=(0,l.useSelector)(Cn.E),n=(0,a.useMemo)(()=>t.filter(t=>t.interface===(0,On.d)(e)),[t,e]),[r,o]=(0,a.useState)(null),i=(0,bt.mQ)();return a.createElement(I.A,{flexDirection:"column"},a.createElement(vt.A,{htmlFor:"dynamic-dns",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DYNAMIC_DNS_TOOLTIP"}),tooltipProps:{portal:!0}},a.createElement(O.sA,{id:"COMMON_DYNAMIC_DNS"})),n.length>0?a.createElement(Sn.A,{idField:"_id",columns:wn,truncateHeaderCells:!0,items:n,onRowClick:({_id:e})=>{i||o(e)},disableColumnFilters:!0,disableTextPointer:!0,disableSelection:!0,className:i?Ie.MN:void 0}):null,a.createElement(I.A,{minHeight:at.b,alignItems:"center"},a.createElement(dn.A,{isDisabled:i,onClick:()=>o(j.R6),fontSize:"medium"},a.createElement(O.sA,{id:"COMMON_CREATE_NEW"}))),r?a.createElement(ea,{id:r,closeModal:()=>{o(null)},wanNetworkGroup:e}):null)};var na=n(649192);const aa=({form:e,resetValues:t})=>{const[n,l]=(0,a.useState)({});return a.createElement(I.A,{alignItems:"center",justifyContent:"space-between"},a.createElement(wt.A,{weight:"bold"},a.createElement(O.sA,{id:"COMMON_ADVANCED"})),a.createElement(I.A,{width:"fit-content"},a.createElement(na.A,{variant:"capsule",form:e,name:"setting_preference",onAfterChange:a=>{if(a===c.C.AUTO){const n=(0,o.A)((0,le.mR)(e.getValues()));l({...n,setting_preference:c.C.MANUAL}),Object.entries(t).forEach(([t,n])=>{e.setValue(t,n)})}a===c.C.MANUAL&&Object.entries(n).forEach(([t,n])=>{e.setValue(t,n)})},tabs:[{label:a.createElement(O.sA,{id:"COMMON_AUTO"}),id:c.C.AUTO},{label:a.createElement(O.sA,{id:"COMMON_MANUAL"}),id:c.C.MANUAL}]})))};var la=n(329109),ra=n(524936);const oa=({form:e,wanNetworkGroup:t})=>{const n=(0,r.FH)({control:e.control,name:"upnp.enabled"}),o=(0,l.useSelector)(R.oP),i=(0,l.useSelector)(y.L4),_=o||{},{formatMessage:s}=(0,O.tz)(),E=(0,a.useMemo)(()=>i.filter(e=>!(0,ra.uH)(e)).map(e=>({label:e.name,value:e._id,additionalInfo:(0,ra.mC)(e)})),[i]),c=!(!o.upnp_wan_interface||!_.upnp_enabled||o.upnp_wan_interface===t);return a.createElement(I.A,{gap:p.kc,minHeight:at.b,justifyContent:"space-between",alignItems:"flex-start",flexDirection:"column"},a.createElement(lt.A,null,a.createElement(En.A,{reason:c?a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_UPNP_CONDITIONAL_TOOLTIP",values:{wan:s({id:"COMMON_NETWORK_PURPOSE_WANX"},{number:(0,z.si)(o.upnp_wan_interface)})}}):null},a.createElement(nt.A,{control:e.control,name:"upnp.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_UPNP_DESCRIPTION"}),onToggle:t=>{t&&(e.setValue("upnp.upnp_nat_pmp_enabled",!0),e.setValue("upnp.upnp_secure_mode",!0))}},a.createElement(O.sA,{id:"COMMON_UPNP"})))),n?a.createElement(I.A,{paddingLeft:p.S2,gap:p.kc,flexDirection:"column",justifyContent:"space-between",alignItems:"flex-start",width:"100%"},a.createElement(Nn.A,{truncateLabels:!0,control:e.control,options:E,name:"upnp.networks",triggerButtonText:a.createElement(O.sA,{id:"COMMON_ACTION_SELECT_NETWORKS"})}),a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:"upnp.upnp_nat_pmp_enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_UPNP_NAT_PORT_MAPPING_PROTOCOL_TOOLTIP"})},a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_UPNP_NAT_PORT_MAPPING_PROTOCOL"}))),a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:"upnp.upnp_secure_mode",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_UPNP_SECURE_MODE_TOOLTIP"})},a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_UPNP_SECURE_MODE"})))):null)},ia=({form:e})=>{const{formatMessage:t}=(0,O.tz)(),n=(0,a.useMemo)(()=>{const e=[];for(let t=Ie.Ig;t>=Ie.OG;t-=1)e.push({label:t.toString(),value:(0,_e.Q2)(t.toString())});return e},[]);return a.createElement(a.Fragment,null,a.createElement(I.A,{gap:p.kc,alignItems:"flex-start"},a.createElement(St.A,{control:e.control,label:a.createElement(O.sA,{id:"COMMON_IPV4_ADDRESS"}),name:"ipv4Configuration.wan_ip"}),a.createElement(I.A,{width:140},a.createElement(tt.A,{control:e.control,name:"ipv4Configuration.wan_netmask",label:a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_NETMASK"}),options:n,placeholder:t({id:"COMMON_SELECT"})}))),a.createElement(St.A,{control:e.control,name:"ipv4Configuration.wan_gateway",label:a.createElement(O.sA,{id:"COMMON_GATEWAY_IP"})}))},_a=({form:e,isDsLiteOverPppoe:t})=>{const n=t?"ipv4Configuration.type4over6":"ipv4Configuration",l=(0,r.FH)({control:e.control,name:`${n}.wan_username.enabled`}),o=(0,r.FH)({control:e.control,name:`${n}.x_wan_password.enabled`});return a.createElement(a.Fragment,null,a.createElement(I.A,{gap:p.kc,alignItems:"flex-start"},a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:`${n}.wan_username.enabled`},a.createElement(O.sA,{id:"COMMON_LABEL_USERNAME"}))),l?a.createElement(St.A,{control:e.control,name:`${n}.wan_username.value`}):null),a.createElement(I.A,{gap:p.kc,alignItems:"flex-start"},a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:`${n}.x_wan_password.enabled`},a.createElement(O.sA,{id:"COMMON_PASSWORD"}))),o?a.createElement(St.A,{type:"password",control:e.control,name:`${n}.x_wan_password.value`}):null))},sa=({form:e})=>a.createElement(Ft.A,null,a.createElement(vt.A,{tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_MAP_E_SERVICE_TOOLTIP"})},a.createElement(O.sA,{id:"COMMON_SERVICE"})),a.createElement(ht.A,null,a.createElement(Pt.A,{control:e.control,name:"ipv4Configuration.type4over6.service",value:pe.Rt.V6_PLUS,tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_MAP_E_TYPE_V6_PLUS_TOOLTIP"})},a.createElement(O.sA,{id:"COMMON_MAP_E_TYPE_V6_PLUS"})),a.createElement(Pt.A,{control:e.control,name:"ipv4Configuration.type4over6.service",value:pe.Rt.OCN_V_C,tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_MAP_E_TYPE_V6_OCN_VIRTUAL_CONNECT_TOOLTIP"})},a.createElement(O.sA,{id:"COMMON_MAP_E_TYPE_V6_OCN_VIRTUAL_CONNECT"})))),Ea={[pe.M5.DHCP]:"COMMON_DHCP",[pe.M5.STATIC]:"COMMON_STATIC",[pe.M5.PPPOE]:"COMMON_IPV4_CONNECTION_TYPE_PPPOE",[pe.M5.IPV4_OVER_IPV6]:"SETTINGS_INTERNET_VALUES_IPV4_OVER_IPV6",[pe.M5.DISABLED]:"COMMON_DISABLED"},ca={[pe.Zk.DS_LITE]:"COMMON_IPV4_CONNECTION_TYPE_DS_LITE",[pe.Zk.MAP_E]:"COMMON_IPV4_CONNECTION_TYPE_MAP_E",[pe.Zk.DS_LITE_PPPOE]:"COMMON_IPV4_CONNECTION_TYPE_DS_LITE_OVER_PPPOE"};var ma=n(649594);const Aa=({form:e,id:t})=>{const n=(0,m.A)(k.Xj.DS_LITE),o=(0,m.A)(k.Xj.WAN_MAP_E),i=(0,l.useSelector)((0,a.useMemo)(()=>(0,ma.XI)(t),[t])),_=(0,a.useMemo)(()=>((e,t)=>[{label:Ea[pe.M5.DHCP],value:pe.M5.DHCP},{label:Ea[pe.M5.STATIC],value:pe.M5.STATIC},{label:Ea[pe.M5.PPPOE],value:pe.M5.PPPOE},...e||t?[{label:Ea[pe.M5.IPV4_OVER_IPV6],value:pe.M5.IPV4_OVER_IPV6}]:[]])(n,o),[n,o]),s=(0,r.FH)({control:e.control,name:"ipv4Configuration.type"}),E=(0,r.FH)({control:e.control,name:"ipv6Configuration.type"});return a.createElement(I.A,{flexDirection:"column"},a.createElement(vt.A,null,a.createElement(O.sA,{id:"COMMON_CONNECTION"})),a.createElement(ht.A,{gap:p.kc},_.map(t=>{const n=((e,t,n,a)=>e===pe.M5.STATIC&&n.value!==pe.M5.STATIC&&a?"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_OSPF_DISABLED":n.value===pe.M5.IPV4_OVER_IPV6&&t===ue.c.DISABLED?"SETTINGS_INTERNET_VALUES_IPV4_OVER_IPV6_DISABLED":void 0)(s,E,t,i);return a.createElement(I.A,{key:t.value},a.createElement(En.A,{reason:n?a.createElement(O.sA,{id:n}):null},a.createElement(Pt.A,{control:e.control,name:"ipv4Configuration.type",value:t.value},a.createElement(O.sA,{id:t.label}))))})))};var da=n(889740),Na=n(993341);const ua=({form:e,id:t})=>{const n=(0,m.A)(k.Xj.DS_LITE),o=(0,m.A)(k.Xj.WAN_MAP_E),i=(0,l.useSelector)(b.ht),_=(0,r.FH)({control:e.control,name:"ipv6Configuration.type"}),s=(0,a.useMemo)(()=>((e,t)=>[...e?[{label:ca[pe.Zk.DS_LITE],value:pe.Zk.DS_LITE}]:[],...t?[{label:ca[pe.Zk.DS_LITE_PPPOE],value:pe.Zk.DS_LITE_PPPOE},{label:ca[pe.Zk.MAP_E],value:pe.Zk.MAP_E}]:[]])(n,o),[n,o]),E=(0,a.useMemo)(()=>i.filter(e=>e.configuration.wan_type===pe.mR.DS_LITE&&e.configuration._id!==t).length,[t,i]);return a.createElement(I.A,{flexDirection:"column"},a.createElement(vt.A,{tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_VALUES_IPV4_OVER_IPV6_TYPE_TOOLTIP"})},a.createElement(O.sA,{id:"COMMON_TYPE"})),a.createElement(I.A,{gap:p.kc,width:"100%"},a.createElement(ht.A,null,s.map(t=>{const n=((e,t,n)=>{if([pe.Zk.DS_LITE,pe.Zk.DS_LITE_PPPOE].includes(t.value)){if(n>=Na.wr)return"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_DSLITE_MAX_COUNT_DISABLED";if(e===ue.c.DISABLED)return"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_DS_LITE_IPV6_DISABLED"}if((t.value===pe.Zk.MAP_E||t.value===pe.M5.IPV4_OVER_IPV6)&&e===ue.c.DISABLED)return"SETTINGS_INTERNET_VALUES_IPV4_OVER_IPV6_DISABLED"})(_,t,E);return a.createElement(I.A,{key:t.value,gap:p.YC},a.createElement(En.A,{reason:n?a.createElement(O.sA,{id:n}):null},a.createElement(Pt.A,{control:e.control,name:"ipv4Configuration.type4over6.type",value:t.value},a.createElement(I.A,{gap:p.kc},a.createElement(O.sA,{id:t.label}),t.value===pe.Zk.DS_LITE_PPPOE?a.createElement(da.A,null):void 0))))}))))},pa=({form:e})=>{const{formatMessage:t}=(0,O.tz)(),n=(0,r.FH)({control:e.control,name:"ipv4Configuration.type4over6.wan_dslite_remote_host.auto"}),l=(0,m.A)(k.Xj.DS_LITE_HB46PP);return a.createElement(I.A,{flexDirection:"column"},a.createElement(vt.A,{tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_DS_LITE_GATEWAY_ADDRESS_TOOLTIP"})},a.createElement(O.sA,{id:"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_DS_LITE_GATEWAY_ADDRESS"})),a.createElement(I.A,{alignItems:"flex-start",gap:p.kc,width:"100%"},l?a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:"ipv4Configuration.type4over6.wan_dslite_remote_host.auto"},a.createElement(O.sA,{id:"COMMON_AUTO"}))):null,n?null:a.createElement(St.A,{control:e.control,name:"ipv4Configuration.type4over6.wan_dslite_remote_host.value",placeholder:t({id:"SETTINGS_INTERNET_VALUES_IPV4_CONNECTION_TYPE_DS_LITE_PLACEHOLDER"})})))},Ta=({form:e})=>{const{formatMessage:t}=(0,O.tz)(),n=(0,r.FH)({control:e.control,name:"ipv4Configuration.dns.auto"}),l=(0,r.FH)({control:e.control,name:"ipv6Configuration.dns.auto"}),o=(0,r.FH)({control:e.control,name:"ipv6Configuration.type"});return a.createElement(I.A,{gap:p.kc,minHeight:at.b,justifyContent:"space-between",alignItems:"flex-start",flexDirection:"column"},a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:"ipv4Configuration.dns.auto",tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_LABEL_DNS_SERVER_DESCRIPTION"})},a.createElement(O.sA,{id:"COMMON_AUTO_DNS_SERVERS"}))),n?null:a.createElement(a.Fragment,null,a.createElement(St.A,{control:e.control,name:"ipv4Configuration.dns.wan_dns1",label:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_DNS_SERVER_PRIMARY_SERVER"}),placeholder:t({id:"COMMON_IPV4_ADDRESS"})}),a.createElement(St.A,{control:e.control,name:"ipv4Configuration.dns.wan_dns2",label:a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_DNS_SERVER_SECONDARY_SERVER"}),placeholder:t({id:"COMMON_IPV4_ADDRESS"})}),o!==ue.c.DISABLED&&l?a.createElement(Yt.A,null,a.createElement(O.sA,{id:"SETTINGS_CUSTOM_DNSV4_USED_BEFORE_DYNAMIC_DNSV6"})):null))},Ia=[{id:"optionNumber",label:a.createElement(O.sA,{id:"COMMON_OPTION"}),sortable:!1},{id:"value",label:a.createElement(O.sA,{id:"COMMON_VALUE"}),sortable:!1,width:50}],Sa={optionNumber:"COMMON_OPTION",value:"COMMON_VALUE"},Oa=[60,61,77,90],Ca=[77],Da=Oa.map(e=>({label:`${e}`,value:e})),Ma=[{name:"new_option_number",placeholder:"COMMON_SELECT",type:"dropdown",options:Da,label:a.createElement(vt.A,{tooltip:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS_TOOLTIP"}),tooltipProps:{portal:!0}},a.createElement(At.A,null,a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS"}))),inline:!0,validated:!0,propFunc:(e,t)=>{if(e.wan_dhcp_options){const t=Da.map(t=>({...t,disabled:!!e.wan_dhcp_options.find(e=>e.optionNumber===t.value)})),n=t.every(e=>e.disabled);return{options:t,disabled:n}}return t?{options:Da.map(n=>({...n,disabled:!!t.find(t=>t.optionNumber!==e.optionNumber&&t.optionNumber===n.value)}))}:{}}},{name:"new_value",placeholder:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_OPTIONS_FIELD_LABEL_VALUE",type:"text",label:"COMMON_VALUE",inline:!0,containerFlexProps:{minWidth:"184px"}}],va=Qt.A.object().shape({editActive:Qt.A.bool(),new_option_number:Qt.A.number().when("editActive",{is:!1,then:an}),new_value:Qt.A.string().when(["editActive","new_option_number"],{is:(e,t)=>!1===e&&Oa.includes(Number(t)),then:ln}).when(["editActive","new_option_number"],{is:(e,t)=>!1===e&&Ca.includes(Number(t)),then:rn}),wan_dhcp_options:Qt.A.array().when("editActive",{is:!0,then:Qt.A.array().of(Qt.A.object().shape({optionNumber:an,value:Qt.A.string().when("optionNumber",{is:e=>Oa.includes(Number(e)),then:ln}).when("optionNumber",{is:e=>Ca.includes(Number(e)),then:rn})}))})}),ga=({form:e})=>{const t=(0,r.FH)({control:e.control,name:"ipv4Configuration.wan_dhcp_options"}),n=(0,a.useMemo)(()=>{const e=new Set((t||[]).map(e=>e.optionNumber)),n=Oa.find(t=>!e.has(t));return{editActive:!1,wan_dhcp_options:(t||[]).map((e,t)=>({id:`wan_dhcp_option-${t}`,optionNumber:e.optionNumber,value:e.value})),new_option_number:n||Oa[0],new_value:""}},[t]),l=(0,a.useCallback)(t=>e.setValue("ipv4Configuration.wan_dhcp_options",(t||[]).map(({optionNumber:e,value:t})=>({optionNumber:e,value:t})),{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0}),[e]),o=(0,a.useCallback)(({wan_dhcp_options:e,new_option_number:t,new_value:n})=>{l([...e,{optionNumber:t,value:n}])},[l]),i=(0,a.useCallback)(({id:e})=>{l(n.wan_dhcp_options.filter(t=>e!==t.id))},[l,n.wan_dhcp_options]),_=(0,a.useCallback)(e=>l(e),[l]);return a.createElement(Kt.A,{fieldName:"wan_dhcp_options",columns:Ia,fieldLabels:Sa,newFields:Ma,onAddItem:o,onRemoveItem:i,onEditSubmit:_,initialValues:n,validationSchema:va,isWindowTable:!0,max:Oa.length})},fa=({form:e})=>{const t=(0,bt.mQ)();return a.createElement(I.A,{className:t?Ie.MN:void 0},a.createElement(ga,{form:e}))},wa=({form:e})=>{const t=(0,r.FH)({control:e.control,name:"vlan.enabled"}),n=(0,r.FH)({control:e.control,name:"ipv4Configuration.wan_dhcp_cos.value"}),l=(0,r.FH)({control:e.control,name:"ipv4Configuration.wan_dhcp_cos.enabled"});return a.createElement(I.A,{width:"100%"},a.createElement(I.A,{gap:p.kc,alignItems:"flex-start",width:"100%"},a.createElement(I.A,{flex:"1"},a.createElement(En.A,{reason:t?null:a.createElement(O.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_DHCP_COS_DISABLED_TOOLTIP"})},a.createElement(I.A,null,a.createElement(lt.A,null,a.createElement(nt.A,{control:e.control,name:"ipv4Configuration.wan_dhcp_cos.enabled",tooltip:a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_FIELD_DHCP_COS_DESCRIPTION"}),onToggle:()=>{n||e.setValue("ipv4Configuration.wan_dhcp_cos.value",1,{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0})}},a.createElement(O.sA,{id:"COMMON_DHCP_COS"})))))),l?a.createElement(I.A,{flex:"1"},a.createElement(tt.A,{control:e.control,name:"ipv4Configuration.wan_dhcp_cos.value",options:Ie.VE})):null))},ba=({form:e})=>{const t=(0,l.useSelector)(B.jY);return a.createElement(a.Fragment,null,t?a.createElement(fa,{form:e}):null,a.createElement(wa,{form:e}))};var La,Ra=n(54227);!function(e){e.ADD_IP="add_ip",e.ADD_IP_RANGE="add_ip_range"}(La||(La={}));var Pa=n(271856),ha=n(758649),Va=n(828901),ya=n(348466);const Ga=[{name:"new_wan_ip_alias_start",placeholder:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_FIELD_LABEL",type:"text",label:"COMMON_START",inline:!0},{name:"new_wan_ip_alias_stop",placeholder:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_FIELD_LABEL",type:"text",label:"COMMON_STOP",inline:!0}],Wa=[{name:"new_wan_ip_alias",placeholder:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_FIELD_LABEL",type:"text",inline:!0}],Ua=[{id:"wan_ip_alias",label:a.createElement(O.sA,{id:"COMMON_IPV4_ADDRESS"}),sortable:!1}],Fa={wan_ip_aliases:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_FIELD_LABEL"},xa=Qt.A.string().required().matches(Te.wK,{message:a.createElement(O.sA,{id:"COMMON_VALIDATION_VALID_IPV4_MASK"})}),ka=({ipOption:e,form:t})=>{const n=(0,l.useSelector)(Va.D),o=(0,r.FH)({control:t.control,name:"ipv4Configuration.wan_ip_aliases"}),i=(0,a.useMemo)(()=>e===La.ADD_IP_RANGE?Ga:Wa,[e]),_=(0,a.useMemo)(()=>({editActive:!1,wan_ip_aliases:(o||[]).map(e=>({id:e,wan_ip_alias:e})),new_wan_ip_alias:"",new_wan_ip_alias_start:"",new_wan_ip_alias_stop:""}),[o]),s=(0,a.useCallback)(e=>t.setValue("ipv4Configuration.wan_ip_aliases",e,{shouldDirty:!0,shouldValidate:!0,shouldTouch:!0}),[t]),E=(0,a.useCallback)(t=>{e===La.ADD_IP_RANGE?s([...new Set([...t.wan_ip_aliases.map(({wan_ip_alias:e})=>e),...(0,_e.JH)([t.new_wan_ip_alias_start,t.new_wan_ip_alias_stop])])].slice(0,64)):s([...t.wan_ip_aliases.map(({wan_ip_alias:e})=>e),t.new_wan_ip_alias])},[e,s]),c=(0,a.useMemo)(()=>{return t=e,Qt.A.lazy(e=>{const n=e.wan_ip_aliases.map(e=>e.wan_ip_alias);return Qt.A.object().shape({new_wan_ip_alias:Qt.A.string().when("editActive",{is:e=>!e&&t===La.ADD_IP,then:xa.label("COMMON_IP_ADDRESS").test("isSubnetUnique",a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_FIELDS_INTERNET_SOURCE_IP_POOL_VALIDATION_UNIQUE_IP"}),e=>{const t=e?.split("/")?.[0]||"";return!(0,_e.mr)(t)||n.every(e=>(0,_e.GQ)(e.split(ya.Ed)[0])!==(0,_e.GQ)(t))})}),new_wan_ip_alias_start:Qt.A.string().label("COMMON_START").when("editActive",{is:e=>!e&&t===La.ADD_IP_RANGE,then:xa}),new_wan_ip_alias_stop:Qt.A.string().label("COMMON_STOP").when("editActive",{is:e=>!e&&t===La.ADD_IP_RANGE,then:xa.test("hasSameNetmaskAsStart",a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_MASKS_SHOULD_MATCH"}),t=>!t||!e.new_wan_ip_alias_start||e.new_wan_ip_alias_start.split(ya.Ed)[1]===t.split(ya.Ed)[1]).test("isNotSameAsStart",a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_FIELDS_INTERNET_SOURCE_IP_POOL_VALIDATION_UNIQUE_IP"}),t=>e.new_wan_ip_alias_start!==t).test("isStopInStartSubnet",a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_END_WITHIN_SUBNET"}),t=>{if(!e.new_wan_ip_alias_start||!t)return!0;const{firstHostAddressLong:n,lastHostAddressLong:a}=(0,_e.DP)(e.new_wan_ip_alias_start),l=(0,_e.GQ)(t.split("/")[0]);return l>=n&&l<=a}).test("isStopGreaterThanStart",a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_END_AFTER_START"}),t=>{if(!e.new_wan_ip_alias_start||!t)return!0;const n=e.new_wan_ip_alias_start.split("/")[0],a=t.split("/")[0];return!(0,_e.mr)(n)||!(0,_e.mr)(a)||(0,_e.GQ)(n)<(0,_e.GQ)(a)}).test("isRangeUnique",a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_FIELDS_INTERNET_SOURCE_IP_POOL_VALIDATION_UNIQUE_IP"}),t=>{if(!e.new_wan_ip_alias_start||!t)return!0;const a=e.new_wan_ip_alias_start.split("/")[0],l=t.split("/")[0];return!(0,_e.mr)(a)||!(0,_e.mr)(l)||(0,_e.GQ)(a)>=(0,_e.GQ)(l)||(0,Lt.A)((0,_e.GQ)(a),(0,_e.GQ)(l)+1).every(e=>!n.some(t=>(0,_e.GQ)(t.split(ya.Ed)[0])===e))})}),wan_ip_aliases:Qt.A.array().when("editActive",{is:!0,then:Qt.A.array().of(Qt.A.object().shape({wan_ip_alias:xa.test("isAddressUnique",a.createElement(O.sA,{id:"SETTINGS_NETWORKS_FORM_FIELDS_INTERNET_SOURCE_IP_POOL_VALIDATION_UNIQUE_IP"}),e=>!e||n.filter(t=>(0,_e.GQ)(t.split(ya.Ed)[0])===(0,_e.GQ)(e.split(ya.Ed)[0])).length<=1).required()}))})})});var t},[e]);return a.createElement(Kt.A,{fieldName:"wan_ip_aliases",columns:Ua,fieldLabels:Fa,newFields:i,onAddItem:E,onRemoveItem:({wan_ip_alias:e})=>s(o.filter(t=>t!==e)),renderHoverContent:({wan_ip_alias:e},t)=>{const l=n.find(({destination_ip:t})=>e.includes(t));return a.createElement(I.A,{alignItems:"center",marginRight:p.kc},a.createElement(Pa.A,{description:l?a.createElement(O.sA,{id:"SETTINGS_INTERNET_WAN_ADDITIONAL_IP_ADDRESSES_USED_IN_PORT_FORWARDING",values:{name:l.name}}):null,portal:!0},a.createElement(ha.A,{size:"medium",type:"button",variant:"inline",color:"danger",onClick:t,disabled:!!l},a.createElement(O.sA,{id:"COMMON_ACTION_REMOVE"}))))},onEditSubmit:e=>s([...e.map(({wan_ip_alias:e})=>e)]),initialValues:_,validationSchema:c,max:64,isWindowTable:!0})},Ha=[La.ADD_IP,La.ADD_IP_RANGE],Ba={[La.ADD_IP]:"SETTINGS_INTERNET_WAN_TOGGLE_OPTION_ADD_IP",[La.ADD_IP_RANGE]:"SETTINGS_INTERNET_WAN_TOGGLE_OPTION_ADD_IP_RANGE"},Ya=({disabled:e,form:t})=>{const[n,l]=(0,a.useState)(La.ADD_IP);return a.createElement(a.Fragment,null,a.createElement(I.A,{flexDirection:"column"},a.createElement(vt.A,null,a.createElement(O.sA,{id:"COMMON_ADDITIONAL_IP_ADDRESSES"})),a.createElement(ht.A,null,Ha.map(t=>a.createElement(Ra.A,{key:t,id:t,value:t,checked:n===t,onChange:()=>{l(t)},disabled:e},a.createElement(O.sA,{id:Ba[t]}))))),a.createElement(ka,{ipOption:n,form:t}))},ja=({form:e,id:t})=>{const n=(0,m.A)(k.Xj.DS_LITE),o=(0,m.A)(k.Xj.WAN_MAP_E),i=(0,l.useSelector)(B.jY),_=(0,bt.mQ)(),s=(0,r.FH)({control:e.control,name:"ipv4Configuration.type"}),E=(0,r.FH)({control:e.control,name:"ipv4Configuration.type4over6.type"});return a.createElement(a.Fragment,null,a.createElement(I.A,{minHeight:at.b,alignItems:"center"},a.createElement(wt.A,{weight:"bold",color:_?"disabled":void 0},a.createElement(O.sA,{id:"COMMON_IPV4_CONFIGURATION"}))),a.createElement(Aa,{form:e,id:t}),s===pe.M5.PPPOE?a.createElement(_a,{form:e}):null,s===pe.M5.STATIC?a.createElement(ia,{form:e}):null,s===pe.M5.DHCP?a.createElement(ba,{form:e}):null,s===pe.M5.IPV4_OVER_IPV6?a.createElement(a.Fragment,null,a.createElement(ua,{form:e,id:t}),n&&E===pe.Zk.DS_LITE?a.createElement(pa,{form:e}):null,o&&E===pe.Zk.DS_LITE_PPPOE?a.createElement(a.Fragment,null,a.createElement(pa,{form:e}),a.createElement(_a,{form:e,isDsLiteOverPppoe:!0})):null,o&&E===pe.Zk.MAP_E?a.createElement(sa,{form:e}):null):null,[pe.M5.STATIC,pe.M5.PPPOE].includes(s)&&i?a.createElement(Ya,{form:e,disabled:!1}):null,a.createElement(Ta,{form:e}))},Ka=({wanNetworkGroup:e})=>{const t=(0,l.useSelector)(B.DN).find(({networkgroup:t})=>t===e);return a.createElement(a.Fragment,null,t?.portName?a.createElement(a.Fragment,null,a.createElement(vt.A,null,a.createElement(O.sA,{id:"COMMON_PORT"})),a.createElement(I.A,{minHeight:at.b,alignItems:"center"},a.createElement(wt.A,{size:"medium",color:"text-3"},`${t?.portName} - ${t?.networkgroup}`))):null)},Qa="wan-form",$a=({activeItem:e})=>{const t=e._id!==j.R6?e:void 0,n=(0,l.useSelector)(F.EL),{formatMessage:Q}=(0,O.tz)(),$=(0,l.useDispatch)(),[,X]=(0,K.R)(),z=(0,m.A)(k.Xj.MULTIPLE_WAN_NETWORKS),Z=(0,m.A)(k.Xj.DS_LITE_HB46PP),q=(0,l.useSelector)(B.Y9),J=(0,N.jP)(q),ee=(0,l.useSelector)(y.Ct),te=(0,a.useMemo)(()=>ee.find(t=>t._id===e._id),[ee,e._id]),ne=(0,l.useSelector)(B.jY),oe=(0,l.useSelector)(R.NR),se=(0,l.useSelector)(U.Kb),Ee=(0,l.useSelector)(B.U$),ce=(0,l.useSelector)(B.Y9),de=(0,l.useSelector)(M.CX),Ne=(0,l.useSelector)(g.M),Se=(0,l.useSelector)(b.Gv),ge=(0,l.useSelector)(V.nI),we=(0,l.useSelector)(R.oP),be=(0,l.useSelector)(y.Ye),Le=(0,l.useSelector)(y.L4),Re=(0,le.nY)(Ne?.wan_interfaces),Pe=t?t.wan_networkgroup:Re.wan,he=(0,l.useSelector)((0,a.useMemo)(()=>(0,C.bF)(Pe),[Pe])),Ve=(0,a.useMemo)(()=>!!te&&(0,_.It)(te),[te]),ye=(0,a.useMemo)(()=>Ve&&(0,H.ocB)(Ee),[Ve,Ee]),Ge=(0,a.useMemo)(()=>!!te&&(0,_.al)(te),[te]),Ue=(0,l.useSelector)((0,B.Ln)(te?.wan_networkgroup)),Fe=(0,a.useMemo)(()=>!!Ue&&(0,H.c_F)(Ue),[Ue]),xe=(e=>{const t=(0,l.useSelector)(B.U$),n=(0,l.useSelector)(y.Ct),r=(0,a.useMemo)(()=>n.find(t=>t._id===e),[n,e]),o=(0,l.useSelector)((0,B.Ln)(r?.wan_networkgroup)),i=(0,a.useMemo)(()=>!!r&&(0,_.It)(r),[r]),s=(0,a.useMemo)(()=>!!r&&(0,_.al)(r),[r]),E=(0,a.useMemo)(()=>!!o&&(0,H.c_F)(o),[o]);return(0,a.useMemo)(()=>i||E?E||s?Ie.Ud[je.W4.U5GMAX]:Ie.Ud[t.model]||Ie.fJ:Ie.fJ,[i,s,E,t.model])})(e._id),ke=(0,a.useMemo)(()=>ge.map(e=>e.value),[ge]),Ke=(0,a.useMemo)(()=>be.map(e=>e._id),[be]),Qe=(0,a.useMemo)(()=>({...(0,o.A)((0,G.Ay)(h.rR.WAN)),...Se,wan_dslite_remote_host_auto:!!Z||!!Se.wan_dslite_remote_host_auto,...ye?{ipv6_wan_delegation_type:w.S.SINGLE_NETWORK}:{}}),[ye,Z,Se]),$e=(0,a.useMemo)(()=>(0,o.A)((0,le.wY)(Qe,he,{})),[Qe,he]),Xe=(0,a.useMemo)(()=>{const e=(0,o.A)((0,G.Ay)(h.rR.WAN));return t?(0,le.wY)({...e,...t},he,we,ye?w.S.SINGLE_NETWORK:w.S.PD,ke,Ke,de):$e},[t,ye,he,we,ke,Ke,de,$e]),ze=(0,a.useMemo)(()=>(0,le.mR)($e),[$e]),Ze=(0,a.useMemo)(()=>((e,t,n,a,l,r,o,i)=>re.Ay.object({_id:re.Ay.string(),name:Be,enabled:re.Ay.boolean(),ispCapabilities:Me,setting_preference:re.Ay.nativeEnum(c.C),vlan:fe,smartQueues:De(e,t),igmpProxy:Ce,upnp:Oe,ipv4Configuration:We,ipv6Configuration:He,port:re.Ay.number(),macOverride:ve.optional(),loadBalancing:Ye}).superRefine((e,{addIssue:n})=>{if(e.ipv6Configuration.type===ue.c.STATIC){const{wan_prefixlen:a,wan_ipv6:r}=e.ipv6Configuration,o=`${r}/${a}`;if(r&&(0,ie.Bi)(o)){const e=(0,me.aP)(l,null,o,i,t);e&&n({code:re.Ay.ZodIssueCode.custom,message:e,path:["ipv6Configuration.wan_ipv6"]})}}if(e.ipv4Configuration.type===pe.M5.STATIC){const{wan_ip:a,wan_netmask:_}=e.ipv4Configuration;if(a&&_&&Te.Q0.test(_)){const e=(0,_e.AO)(a,_),s=(0,me.Qu)(l,e,Ae.Ql.SUBNET_OVERLAP,null,i,r,o,t);s&&n({code:re.Ay.ZodIssueCode.custom,message:s,path:["ipv4Configuration.wan_ip"]})}}}))(i.default.ENGLISH,Q,0,0,ee.filter(({_id:t})=>t!==e._id),oe?.subnet_cidr,se,Ee),[e._id,Q,z,ne,se,ee,Ee,oe?.subnet_cidr]),Je=(0,d.m)({schema:Ze,defaultValues:Xe}),et=(0,r.lN)(Je),tt=(0,r.FH)({control:Je.control,name:"setting_preference"}),nt=Je.handleSubmit(async n=>{const a=n;if((z||J)&&!Ve){const e=(0,D.Pw)(Object.values(de));e[Pe]=n.port;const t=(0,D.Lb)(e,ce);t?.length&&await $((0,Y.ex)({ethernet_overrides:t},ce._id,ce.mac,{mergeAndOverrideKeys:["ethernet_overrides"],extend:!0}))}const l=a.upnp.networks||[],r=Le.filter(({attr_no_edit:e})=>!e).flatMap(e=>{const t=l.includes(e._id);return!!e.upnp_lan_enabled!==t?[{...e,upnp_lan_enabled:t}]:[]});we.upnp_enabled&&we.upnp_wan_interface!==Pe||$((0,P.fU)({...we,upnp_enabled:n.upnp.enabled,upnp_wan_interface:Pe,upnp_nat_pmp_enabled:!!n.upnp.enabled&&n.upnp.upnp_nat_pmp_enabled,upnp_secure_mode:!!n.upnp.enabled&&n.upnp.upnp_secure_mode})),await Promise.all(r.map(e=>$((0,W.ux)(e))));const o=(0,le.T$)(n,t??Qe,Pe,Re.priority,ke);ne||(delete o.mac_override_enabled,delete o.mac_override);const i=await $((0,W.ax)((0,s.Iz)(o))),_=i?._id??e._id;Je.reset(Je.getValues());const E=[L.hh,W.Sk,x.N,v.F,f.Ss,f.AB];await Promise.all(E.map(e=>e(void 0,{resolveWithExisting:!1})).concat(Ee?.mac?[(0,Y.pI)(Ee?.mac)]:[]).map(e=>$(e))),n._id===j.R6&&X(!0),$((0,S.XP)({type:u.H.WAN,id:_}))}),at=e._id,lt=tt===c.C.AUTO||n;return(0,E.y)(Je),a.createElement("form",{onSubmit:nt,id:Qa},a.createElement(A.A,{isDisabled:n},a.createElement(I.A,{gap:p.Ln,flexDirection:"column",width:"100%"},a.createElement(T.A,null,a.createElement(Ot,{form:Je}),!z&&!J||Ve?a.createElement(Ka,{wanNetworkGroup:Pe}):a.createElement(It,{form:Je,wanNetworkGroup:Pe}),a.createElement(qe,{form:Je})),a.createElement(T.A,null,a.createElement(aa,{form:Je,resetValues:ze}),a.createElement(A.A,{isDisabled:lt},a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.VLAN_ID]},a.createElement(ot,{form:Je})),a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.MAC_ADDRESS_CLONE]},a.createElement(Dt,{form:Je})),a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.SMART_QUEUES]},a.createElement(st,{form:Je})),a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.IGMP_PROXY]},a.createElement(Tn,{form:Je,id:at})),a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.UPNP]},a.createElement(oa,{form:Je,wanNetworkGroup:Pe})),a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.DYNAMIC_DNS_FIELD]},a.createElement(ta,{wanNetworkGroup:Pe})),z?null:a.createElement(ft,{form:Je,wanNetworkGroup:Pe}),a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.IPV4_CONFIGURATION]},a.createElement(ja,{form:Je,id:at})),a.createElement(A.A,{isDisabled:!xe?.[Ie.Ew.IPV6_CONFIGURATION]},a.createElement(An,{form:Je,wanNetworkGroup:Pe,hideUdr5GOptions:ye,isU5GLan:Ge,isU5GWan:Fe}))))),a.createElement(la.A,{onFormCancel:()=>Je.reset(et.defaultValues),isDirty:et.isDirty||!e,hideCancelButton:!et.isDirty,form:Qa,isSubmitting:et.isSubmitting,applyButton:a.createElement(ae,{form:Je,wanNetworkGroup:Pe,handleSubmit:nt})})))},Xa=({activeItem:e})=>a.createElement($a,{activeItem:e,key:e?._id})},814680:(e,t,n)=>{n.d(t,{W:()=>l,k:()=>a});const a=34,l=12*a}}]);