"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[9599],{459599:(e,t,a)=>{a.r(t),a.d(t,{default:()=>R});var o=a(296540),n=a(951272),c=a(870443),r=a(204751),i=a(459449),l=a(847883),m=a(617147),s=a(71479),_=a(132196),d=a(709690),p=a(217439),E=a(388151),g=a(949330),A=a(294303),C=a(566723),O=a(189643),u=a(814680),h=a(766624),b=a(987588);const q=(0,s.A)(A.A)`
  gap: ${C.kc};
  border-radius: ${C.kc};
  padding: ${C.kc};
  background-color: ${({theme:{motifPalette:{neutral01:e}}})=>e};
  align-items: start;
`,N=(0,s.A)(d.A)`
  margin-top: 2px;
`,P=_.AH`
  z-index: 100001 !important;
`,T=130,M=8*u.k,k=Array.from({length:64},(e,t)=>t).map(e=>({label:g.iL.find(t=>t.value===e)?.label||e.toString(),value:e})),S=O.iK.filter(e=>![O.aS.TCP_UDP,O.aS.ICMPV6].includes(e)).map(e=>({label:(0,O.Wi)(e),value:e})),v=({isExistingItem:e})=>{const{values:t,resetForm:a,submitForm:c,isSubmitting:s,setFieldValue:_}=(0,n.j7)(),{formatMessage:d}=(0,i.tz)(),u=(0,o.useCallback)(()=>{c()},[c]),v=(0,o.useCallback)(e=>{e.value!==O.aS.NUMBER&&_("protocolNumber",0),e.value!==O.aS.TCP&&e.value!==O.aS.UDP&&(_("enableSourcePort",!1),_("enableDestinationPort",!1),_("qos_matching.src_port",void 0),_("qos_matching.dst_port",void 0)),_("qos_matching.protocol",e.value)},[_]);return o.createElement(m.A,{onRequestClose:()=>a(),isOpen:!0,title:o.createElement(i.sA,{id:e?"PORTS_EDIT_QOS_PROFILE":"PORTS_CREATE_NEW_QOS_PROFILE"}),size:"small",actions:[{disabled:s,text:o.createElement(i.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",variant:"default",onClick:()=>a()},{disabled:s,text:o.createElement(i.sA,{id:"COMMON_ACTION_SAVE"}),type:"button",variant:"primary",onClick:u}]},o.createElement(A.A,{flexDirection:"column",gap:C.kc},o.createElement(q,{gap:C.kc},o.createElement(N,{isActive:!0,variant:"fill"}),o.createElement(p.A,null,o.createElement(i.sA,{id:"PORTS_QOS_POLICY_INFO"}))),o.createElement(l.A,{marginBottom:0},o.createElement(E.A,{label:"COMMON_PROTOCOL",name:"qos_matching.protocol",options:S,translateLabel:!0,translateOptions:!0,type:"dropdown",isOpen:!0,portal:!0,optionContainerClassName:P,variant:"secondary",maxHeight:M,onChange:v})),t.qos_matching?.protocol===O.aS.NUMBER?o.createElement(l.A,{marginBottom:0},o.createElement(E.A,{className:b.rH,max:255,min:0,name:"protocolNumber",width:80,type:"number",variant:"secondary",label:"COMMON_NUMBER",translateLabel:!0})):null,"number"!=typeof t.qos_matching?.protocol&&[O.aS.TCP,O.aS.UDP,O.aS.TCP_UDP].includes(t.qos_matching?.protocol)?o.createElement(o.Fragment,null,o.createElement(A.A,{gap:C.YC,alignItems:"center"},o.createElement(p.A,{size:"small",color:"text-3"},o.createElement(i.sA,{id:"PORTS_QOS_POLICY_MATCH_PORT"})),o.createElement(h.A,{description:o.createElement(i.sA,{id:"PORTS_QOS_POLICY_MATCH_PORT_DESC"}),width:250})),o.createElement(l.A,{marginBottom:0},o.createElement(b.l2,null,o.createElement(E.A,{name:"enableSourcePort",type:"realCheckbox"})),o.createElement(b.K_,{className:b.tk,htmlFor:"enableSourcePort",label:o.createElement(i.sA,{id:"COMMON_SOURCE_PORT"})}),t.enableSourcePort&&o.createElement(E.A,{className:b.rH,full:!0,max:65535,min:1,name:"qos_matching.src_port",type:"number",variant:"secondary",width:80,placeholderValues:{value:10},placeholder:"COMMON_PLACEHOLDER_EG"})),o.createElement(l.A,{marginBottom:0},o.createElement(b.l2,null,o.createElement(E.A,{name:"enableDestinationPort",type:"realCheckbox"})),o.createElement(b.K_,{className:b.tk,htmlFor:"enableDestinationPort",label:o.createElement(i.sA,{id:"COMMON_DESTINATION_PORT"})}),t.enableDestinationPort&&o.createElement(E.A,{className:b.rH,full:!0,max:65535,min:1,name:"qos_matching.dst_port",type:"number",variant:"secondary",width:80,placeholderValues:{value:10},placeholder:"COMMON_PLACEHOLDER_EG"}))):null,o.createElement(l.A,{marginBottom:0},o.createElement(A.A,{flexDirection:"column",gap:C.YC},o.createElement(A.A,{gap:C.YC,alignItems:"center"},o.createElement(p.A,{size:"small",color:"text-3"},o.createElement(i.sA,{id:"PORTS_FORM_FIELD_QOS_MATCHING"})),o.createElement(h.A,{description:o.createElement(i.sA,{id:"PORTS_FORM_FIELD_QOS_MATCHING_DESC"})})),o.createElement(A.A,{gap:C.Ln},o.createElement(E.A,{value:r.ev.DSCP,type:"radio",name:"matchingTrafficType"},o.createElement(i.sA,{id:g.kB[r.ev.DSCP]})),o.createElement(E.A,{value:r.ev.IP_PRECEDENCE,type:"radio",name:"matchingTrafficType"},o.createElement(i.sA,{id:g.kB[r.ev.IP_PRECEDENCE]})),o.createElement(E.A,{value:r.AC,type:"radio",name:"matchingTrafficType"},o.createElement(i.sA,{id:"COMMON_NONE"}))),t.matchingTrafficType===r.ev.DSCP?o.createElement(E.A,{name:"qos_matching.dscp_code",type:"dropdown",portal:!0,optionContainerClassName:P,variant:"secondary",options:k,label:"COMMON_CODE",translateLabel:!0,width:T,maxHeight:M}):null,t.matchingTrafficType===r.ev.IP_PRECEDENCE?o.createElement(E.A,{name:"qos_matching.ip_precedence_code",type:"dropdown",portal:!0,optionContainerClassName:P,variant:"secondary",options:g.Y$,label:"COMMON_CODE",translateLabel:!0,width:T,maxHeight:M}):null)),o.createElement(l.A,{marginBottom:0},o.createElement(b.l2,null,o.createElement(E.A,{name:"enableQosMarking",type:"realCheckbox"})),o.createElement(b.K_,{className:b.tk,htmlFor:"enableQosMarking",label:o.createElement(i.sA,{id:"PORTS_FORM_FIELD_QOS_MARKING"}),tooltip:o.createElement(i.sA,{id:"PORTS_FORM_FIELD_QOS_MARKING_DESC"})})),t.enableQosMarking?o.createElement(l.A,{marginBottom:0},o.createElement(A.A,{flexDirection:"column",gap:C.kc},o.createElement(p.A,{size:"small",color:"text-3"},o.createElement(i.sA,{id:"COMMON_TYPE"})),o.createElement(A.A,{gap:C.Ln},o.createElement(E.A,{value:r.ev.DSCP,type:"radio",name:"markingTrafficType"},o.createElement(i.sA,{id:g.kB[r.ev.DSCP]})),o.createElement(E.A,{value:r.ev.COS,type:"radio",name:"markingTrafficType"},o.createElement(i.sA,{id:g.kB[r.ev.COS]}))),t.markingTrafficType===r.ev.DSCP?o.createElement(E.A,{name:"qos_marking.dscp_code",type:"dropdown",portal:!0,optionContainerClassName:P,variant:"secondary",options:g.iL,label:"COMMON_CODE",translateLabel:!0,width:T,maxHeight:M}):null,t.markingTrafficType===r.ev.COS?o.createElement(E.A,{name:"qos_marking.cos_code",type:"dropdown",portal:!0,optionContainerClassName:P,variant:"secondary",options:g.TH,label:"COMMON_CODE",translateLabel:!0,width:T,maxHeight:M}):null)):null,o.createElement(l.A,{marginBottom:0},o.createElement(E.A,{className:b.rH,max:7,min:0,name:"qos_marking.queue",type:"number",variant:"secondary",label:"COMMON_QUEUE",labelTooltip:d({id:"PORTS_QOS_POLICY_QUEUE_DESC"}),translateLabel:!0,width:80}))))};var D=a(877995),L=a(205975);const f=65535,I=e=>{const t=o.createElement(i.sA,{id:"COMMON_VALIDATION_INVALID_RANGE_WITH_FIELD_NAME",values:{min:0,max:7,name:e({id:"COMMON_QUEUE"}).toLocaleLowerCase()}}),a=o.createElement(i.sA,{id:"COMMON_VALIDATION_INVALID_RANGE_WITH_FIELD_NAME",values:{min:1,max:f,name:e({id:"COMMON_PORT"}).toLocaleLowerCase()}}),n=o.createElement(i.sA,{id:"COMMON_VALIDATION_INVALID_RANGE",values:{min:0,max:255}});return c.A.object().shape({qos_marking:c.A.object().shape({cos_code:c.A.number().min(0).max(7).integer(),dscp_code:c.A.number().min(0).max(63),ip_precedence_code:c.A.number().min(0).max(7),queue:c.A.number().integer().required(t).label("COMMON_QUEUE").min(0,t).max(7,t)}),qos_matching:c.A.object().shape({cos_code:c.A.number().min(0).max(7),dscp_code:c.A.number().min(0).max(63),dst_port:c.A.number().integer().label("COMMON_DESTINATION_PORT").min(1,a).max(f,a).test({name:"dstPortRequired",test:(e,t)=>void 0!==e||!t.options.context.enableDestinationPort||t.createError({message:a})}),ip_precedence_code:c.A.number().min(0).max(7),protocol:c.A.string().label("COMMON_PROTOCOL"),src_port:c.A.number().integer().label("COMMON_SOURCE_PORT").min(1,a).max(f,a).test({name:"srcPortRequired",test:(e,t)=>void 0!==e||!t.options.context.enableSourcePort||t.createError({message:a})})}),enableDestinationPort:c.A.boolean(),enableSourcePort:c.A.boolean(),enableQosMarking:c.A.boolean(),matchingTrafficType:c.A.string().oneOf([r.ev.DSCP,r.ev.IP_PRECEDENCE,r.AC]),markingTrafficType:c.A.string().oneOf([r.ev.DSCP,r.ev.COS]),protocolNumber:c.A.number().label("COMMON_NUMBER").integer().min(0,n).max(255,n).required(n)})},R=({addCallback:e,hideModal:t,existingItem:a,existingItemIndex:c})=>{const{formatMessage:r}=(0,i.tz)(),l=(0,o.useCallback)(a=>{e(a,c),t()},[e,t,c]),m=(0,o.useMemo)(()=>a?(0,L.zN)(a):D.L,[a]);return o.createElement(n.l1,{initialValues:m,validationSchema:I(r),onSubmit:l,onReset:()=>{t()}},o.createElement(v,{isExistingItem:Boolean(a)}))}},877995:(e,t,a)=>{a.d(t,{L:()=>c});var o=a(204751),n=a(189643);const c={qos_marking:{cos_code:o.hQ.BACKGROUND,dscp_code:o.ee.DEFAULT,ip_precedence_code:o.lF.ROUTINE,queue:0},qos_matching:{cos_code:o.hQ.BACKGROUND,dscp_code:o.ee.DEFAULT,ip_precedence_code:o.lF.ROUTINE,protocol:n.aS.ALL},enableDestinationPort:!1,enableSourcePort:!1,enableQosMarking:!1,matchingTrafficType:o.ev.DSCP,markingTrafficType:o.ev.DSCP,protocolNumber:0}},205975:(e,t,a)=>{a.d(t,{Dz:()=>s,JS:()=>m,zN:()=>_});var o=a(949330),n=a(204751),c=a(573531),r=a(189643),i=a(877995);const l=e=>void 0!==e.cos_code?`CoS ${e.cos_code} (${o.e8[e.cos_code]})`:void 0!==e.dscp_code?`DSCP ${e.dscp_code}${o.HH[e.dscp_code]?` (${o.HH[e.dscp_code]})`:""}`:void 0!==e.ip_precedence_code?`IPP ${e.ip_precedence_code} (${o.Dc[e.ip_precedence_code]})`:c.L,m=e=>e.map((e,t)=>({matchProtocol:e.qos_matching.protocol??r.aS.ALL,matchType:l(e.qos_matching),remark:l(e.qos_marking),queue:e.qos_marking.queue,id:t})),s=e=>{const t={qos_marking:{...e.qos_marking},qos_matching:{...e.qos_matching}};switch(e.qos_matching.protocol===r.aS.ALL&&(delete t.qos_matching.src_port,delete t.qos_matching.dst_port,delete t.qos_matching.protocol),e.qos_matching.protocol===r.aS.NUMBER&&(t.qos_matching.protocol=e.protocolNumber),e.enableDestinationPort||delete t.qos_matching.dst_port,e.enableSourcePort||delete t.qos_matching.src_port,e.markingTrafficType){case n.ev.DSCP:delete t.qos_marking.cos_code,delete t.qos_marking.ip_precedence_code;break;case n.ev.COS:delete t.qos_marking.dscp_code,delete t.qos_marking.ip_precedence_code}switch(e.matchingTrafficType){case n.ev.DSCP:delete t.qos_matching.cos_code,delete t.qos_matching.ip_precedence_code;break;case n.ev.IP_PRECEDENCE:delete t.qos_matching.dscp_code,delete t.qos_matching.cos_code;break;case n.AC:delete t.qos_matching.dscp_code,delete t.qos_matching.cos_code,delete t.qos_matching.ip_precedence_code}return e.enableQosMarking||(delete t.qos_marking.cos_code,delete t.qos_marking.dscp_code,delete t.qos_marking.ip_precedence_code),t},_=e=>{const t={qos_marking:{cos_code:e.qos_marking.cos_code||i.L.qos_marking.cos_code,dscp_code:e.qos_marking.dscp_code||i.L.qos_marking.dscp_code,ip_precedence_code:e.qos_marking.ip_precedence_code||i.L.qos_marking.ip_precedence_code,queue:e.qos_marking.queue||i.L.qos_marking.queue},qos_matching:{protocol:"number"==typeof e?.qos_matching?.protocol?r.aS.NUMBER:e.qos_matching.protocol||i.L.qos_matching.protocol,cos_code:e.qos_matching.cos_code||i.L.qos_matching.cos_code,dscp_code:e.qos_matching.dscp_code||i.L.qos_matching.dscp_code,ip_precedence_code:e.qos_matching.ip_precedence_code||i.L.qos_matching.ip_precedence_code,dst_port:e.qos_matching.dst_port||i.L.qos_matching.dst_port,src_port:e.qos_matching.src_port||i.L.qos_matching.src_port}};return t.enableDestinationPort=void 0!==e.qos_matching.dst_port,t.enableSourcePort=void 0!==e.qos_matching.src_port,t.enableQosMarking=void 0!==e.qos_marking.cos_code||void 0!==e.qos_marking.dscp_code||void 0!==e.qos_marking.ip_precedence_code,t.markingTrafficType=void 0!==e.qos_marking.cos_code?n.ev.COS:n.ev.DSCP,t.matchingTrafficType=void 0!==e.qos_matching.dscp_code?n.ev.DSCP:void 0!==e.qos_matching.ip_precedence_code?n.ev.IP_PRECEDENCE:n.AC,t.protocolNumber="number"==typeof e.qos_matching.protocol?e.qos_matching.protocol:0,t}},814680:(e,t,a)=>{a.d(t,{W:()=>n,k:()=>o});const o=34,n=12*o}}]);