"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[3569],{597750(e,o,a){a.d(o,{A:()=>s});var n=a(274934),i=a(486061),t=a(100978);const s=({maxWidth:e,label:o,children:a,...s})=>(0,n.jsxs)(t.A,{flexDirection:"column",width:"100%",maxWidth:"settingsGridContent"===e?i.ng:e,...s,children:[o,a]})},787481(e,o,a){a.d(o,{A:()=>c});var n=a(274934),i=a(833466),t=a(309130),s=a(100978);const c=e=>(0,n.jsx)(s.A,{paddingTop:t.YC,paddingBottom:t.YC,gap:t.Ln,rowGap:t.YC,flexWrap:"wrap",minHeight:i.b,alignItems:"center",...e})},803569(e,o,a){a.r(o),a.d(o,{default:()=>I});var n=a(274934),i=a(602086),t=a(843871),s=a(950804),c=a(470070),r=a(501558),d=a(814557),_=a(832162),l=a(831721),m=a(247816),p=a(409844),g=a(834700),h=a(754237),C=a(309130),A=a(787481),O=a(164487),u=a(597750),x=a(120197),b=a(100978),q=a(132952),N=a(195021);const E=(0,m.A)(b.A)`
  gap: ${C.kc};
  border-radius: ${C.kc};
  padding: ${C.kc};
  background-color: ${({theme:{themeName:e}})=>d.Ay[`desktop-color-neutral-01-${e}`]};
  align-items: start;
`,P=(0,m.A)(l.A)`
  margin-top: 2px;
`,T=p.AH`
  z-index: 100001 !important;
`,v=150,S=8*h.k,M=p.AH`
  max-width: 150px;
  width: 150px;
`,k=Array.from({length:64},(e,o)=>o).map(e=>({label:q.iL.find(o=>o.value===e)?.label||e.toString(),value:e})),D=g.iK.filter(e=>![g.aS.TCP_UDP,g.aS.ICMPV6].includes(e)).map(e=>({label:(0,g.Wi)(e),value:e})),j=({isExistingItem:e})=>{const{values:o,resetForm:a,submitForm:s,isSubmitting:d,setFieldValue:l}=(0,t.j7)(),{formatMessage:m}=(0,c.tz)(),p=(0,i.useCallback)(()=>{s()},[s]),h=(0,i.useCallback)(e=>{e.value!==g.aS.NUMBER&&l("protocolNumber",0),e.value!==g.aS.TCP&&e.value!==g.aS.UDP&&(l("enableSourcePort",!1),l("enableDestinationPort",!1),l("qos_matching.src_port",void 0),l("qos_matching.dst_port",void 0)),l("qos_matching.protocol",e.value)},[l]),j=o.qos_matching?.protocol,L="number"!=typeof j&&[g.aS.TCP,g.aS.UDP,g.aS.TCP_UDP].includes(j);return(0,n.jsx)(_.A,{onRequestClose:()=>a(),isOpen:!0,title:(0,n.jsx)(c.sA,{id:e?"PORTS_EDIT_QOS_PROFILE":"PORTS_CREATE_NEW_QOS_PROFILE"}),size:"small",actions:[{disabled:d,text:(0,n.jsx)(c.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",variant:"default",onClick:()=>a()},{disabled:d,text:(0,n.jsx)(c.sA,{id:"COMMON_ACTION_SAVE"}),type:"button",variant:"primary",onClick:p}],children:(0,n.jsxs)(b.A,{flexDirection:"column",gap:C.kc,children:[(0,n.jsxs)(E,{children:[(0,n.jsx)(P,{isActive:!0,variant:"fill"}),(0,n.jsx)(c.sA,{id:"PORTS_QOS_POLICY_INFO"})]}),(0,n.jsx)(x.A,{label:"COMMON_PROTOCOL",name:"qos_matching.protocol",options:D,translateLabel:!0,translateOptions:!0,type:"dropdown",isOpen:!0,portal:!0,optionContainerClassName:T,variant:"secondary",maxHeight:S,onChange:h}),j===g.aS.NUMBER?(0,n.jsx)(x.A,{className:M,max:255,min:0,name:"protocolNumber",width:80,type:"number",variant:"secondary",label:"COMMON_NUMBER",translateLabel:!0}):null,L?(0,n.jsxs)(u.A,{gap:C.kc,children:[(0,n.jsx)(O.A,{tooltip:(0,n.jsx)(c.sA,{id:"PORTS_QOS_POLICY_MATCH_PORT_DESC"}),children:(0,n.jsx)(c.sA,{id:"PORTS_QOS_POLICY_MATCH_PORT"})}),(0,n.jsxs)(b.A,{gap:C.Ln,justifyContent:"space-between",children:[(0,n.jsx)(N.l2,{children:(0,n.jsx)(x.A,{name:"enableSourcePort",type:"realCheckbox",children:(0,n.jsx)(c.sA,{id:"COMMON_SOURCE_PORT"})})}),o.enableSourcePort?(0,n.jsx)(x.A,{className:M,full:!0,max:65535,min:1,name:"qos_matching.src_port",type:"number",variant:"secondary",width:80,placeholderValues:{value:10},placeholder:"COMMON_PLACEHOLDER_EG"}):null]}),(0,n.jsxs)(b.A,{gap:C.Ln,justifyContent:"space-between",children:[(0,n.jsx)(N.l2,{children:(0,n.jsx)(x.A,{name:"enableDestinationPort",type:"realCheckbox",children:(0,n.jsx)(c.sA,{id:"COMMON_DESTINATION_PORT"})})}),o.enableDestinationPort?(0,n.jsx)(x.A,{className:M,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]})]}):null,(0,n.jsxs)(u.A,{children:[(0,n.jsx)(O.A,{tooltip:(0,n.jsx)(c.sA,{id:"PORTS_FORM_FIELD_QOS_MATCHING_DESC"}),children:(0,n.jsx)(c.sA,{id:"PORTS_FORM_FIELD_QOS_MATCHING"})}),(0,n.jsxs)(A.A,{children:[(0,n.jsx)(x.A,{value:r.ev.DSCP,type:"radio",name:"matchingTrafficType",children:(0,n.jsx)(c.sA,{id:q.kB[r.ev.DSCP]})}),(0,n.jsx)(x.A,{value:r.ev.IP_PRECEDENCE,type:"radio",name:"matchingTrafficType",children:(0,n.jsx)(c.sA,{id:q.kB[r.ev.IP_PRECEDENCE]})}),(0,n.jsx)(x.A,{value:r.AC,type:"radio",name:"matchingTrafficType",children:(0,n.jsx)(c.sA,{id:"COMMON_NONE"})})]}),o.matchingTrafficType===r.ev.DSCP?(0,n.jsx)(x.A,{name:"qos_matching.dscp_code",type:"dropdown",portal:!0,optionContainerClassName:T,variant:"secondary",options:k,label:"COMMON_CODE",translateLabel:!0,width:v,maxHeight:S}):null,o.matchingTrafficType===r.ev.IP_PRECEDENCE?(0,n.jsx)(x.A,{name:"qos_matching.ip_precedence_code",type:"dropdown",portal:!0,optionContainerClassName:T,variant:"secondary",options:q.Y$,label:"COMMON_CODE",translateLabel:!0,width:v,maxHeight:S}):null]}),(0,n.jsx)(N.l2,{children:(0,n.jsx)(x.A,{name:"enableQosMarking",type:"realCheckbox",tooltipMessage:(0,n.jsx)(c.sA,{id:"PORTS_FORM_FIELD_QOS_MARKING_DESC"}),children:(0,n.jsx)(c.sA,{id:"PORTS_FORM_FIELD_QOS_MARKING"})})}),o.enableQosMarking?(0,n.jsxs)(u.A,{children:[(0,n.jsx)(O.A,{children:(0,n.jsx)(c.sA,{id:"COMMON_TYPE"})}),(0,n.jsxs)(A.A,{children:[(0,n.jsx)(x.A,{value:r.ev.DSCP,type:"radio",name:"markingTrafficType",children:(0,n.jsx)(c.sA,{id:q.kB[r.ev.DSCP]})}),(0,n.jsx)(x.A,{value:r.ev.COS,type:"radio",name:"markingTrafficType",children:(0,n.jsx)(c.sA,{id:q.kB[r.ev.COS]})})]}),o.markingTrafficType===r.ev.DSCP?(0,n.jsx)(x.A,{name:"qos_marking.dscp_code",type:"dropdown",portal:!0,optionContainerClassName:T,variant:"secondary",options:q.iL,label:"COMMON_CODE",translateLabel:!0,width:v,maxHeight:S}):null,o.markingTrafficType===r.ev.COS?(0,n.jsx)(x.A,{name:"qos_marking.cos_code",type:"dropdown",portal:!0,optionContainerClassName:T,variant:"secondary",options:q.TH,label:"COMMON_CODE",translateLabel:!0,width:v,maxHeight:S}):null]}):null,(0,n.jsx)(x.A,{className:M,max:7,min:0,name:"qos_marking.queue",type:"number",variant:"secondary",label:"COMMON_QUEUE",labelTooltip:m({id:"PORTS_QOS_POLICY_QUEUE_DESC"}),translateLabel:!0})]})})};var L=a(334160),f=a(816648);const R=65535,y=e=>{const o=(0,n.jsx)(c.sA,{id:"COMMON_VALIDATION_INVALID_RANGE_WITH_FIELD_NAME",values:{min:0,max:7,name:e({id:"COMMON_QUEUES"}).toLocaleLowerCase()}}),a=(0,n.jsx)(c.sA,{id:"COMMON_VALIDATION_INVALID_RANGE_WITH_FIELD_NAME",values:{min:1,max:R,name:e({id:"COMMON_PORTS"}).toLocaleLowerCase()}}),i=(0,n.jsx)(c.sA,{id:"COMMON_VALIDATION_INVALID_RANGE",values:{min:0,max:255}});return s.A.object().shape({qos_marking:s.A.object().shape({cos_code:s.A.number().min(0).max(7).integer(),dscp_code:s.A.number().min(0).max(63),ip_precedence_code:s.A.number().min(0).max(7),queue:s.A.number().integer().required(o).label("COMMON_QUEUE").min(0,o).max(7,o)}),qos_matching:s.A.object().shape({cos_code:s.A.number().min(0).max(7),dscp_code:s.A.number().min(0).max(63),dst_port:s.A.number().integer().label("COMMON_DESTINATION_PORT").min(1,a).max(R,a).test({name:"dstPortRequired",test:(e,o)=>void 0!==e||!o.options.context.enableDestinationPort||o.createError({message:a})}),ip_precedence_code:s.A.number().min(0).max(7),protocol:s.A.string().label("COMMON_PROTOCOL"),src_port:s.A.number().integer().label("COMMON_SOURCE_PORT").min(1,a).max(R,a).test({name:"srcPortRequired",test:(e,o)=>void 0!==e||!o.options.context.enableSourcePort||o.createError({message:a})})}),enableDestinationPort:s.A.boolean(),enableSourcePort:s.A.boolean(),enableQosMarking:s.A.boolean(),matchingTrafficType:s.A.string().oneOf([r.ev.DSCP,r.ev.IP_PRECEDENCE,r.AC]),markingTrafficType:s.A.string().oneOf([r.ev.DSCP,r.ev.COS]),protocolNumber:s.A.number().label("COMMON_NUMBER").integer().min(0,i).max(255,i).required(i)})},I=({addCallback:e,hideModal:o,existingItem:a,existingItemIndex:s})=>{const{formatMessage:r}=(0,c.tz)(),d=(0,i.useCallback)(a=>{e(a,s),o()},[e,o,s]),_=(0,i.useMemo)(()=>a?(0,L.zN)(a):f.L,[a]);return(0,n.jsx)(t.l1,{initialValues:_,validationSchema:y(r),onSubmit:d,onReset:()=>{o()},children:(0,n.jsx)(j,{isExistingItem:Boolean(a)})})}},816648(e,o,a){a.d(o,{L:()=>t});var n=a(834700),i=a(501558);const t={qos_marking:{cos_code:i.hQ.BACKGROUND,dscp_code:i.ee.DEFAULT,ip_precedence_code:i.lF.ROUTINE,queue:0},qos_matching:{cos_code:i.hQ.BACKGROUND,dscp_code:i.ee.DEFAULT,ip_precedence_code:i.lF.ROUTINE,protocol:n.aS.ALL},enableDestinationPort:!1,enableSourcePort:!1,enableQosMarking:!1,matchingTrafficType:i.ev.DSCP,markingTrafficType:i.ev.DSCP,protocolNumber:0}},334160(e,o,a){a.d(o,{Dz:()=>_,JS:()=>d,zN:()=>l});var n=a(834700),i=a(254590),t=a(501558),s=a(132952),c=a(816648);const r=e=>void 0!==e.cos_code?`CoS ${e.cos_code} (${s.e8[e.cos_code]})`:void 0!==e.dscp_code?`DSCP ${e.dscp_code}${s.HH[e.dscp_code]?` (${s.HH[e.dscp_code]})`:""}`:void 0!==e.ip_precedence_code?`IPP ${e.ip_precedence_code} (${s.Dc[e.ip_precedence_code]})`:i.L,d=e=>e.map((e,o)=>({matchProtocol:e.qos_matching.protocol??n.aS.ALL,matchType:r(e.qos_matching),remark:r(e.qos_marking),queue:e.qos_marking.queue,id:o})),_=e=>{const o={qos_marking:{...e.qos_marking},qos_matching:{...e.qos_matching}};switch(e.qos_matching.protocol===n.aS.ALL&&(delete o.qos_matching.src_port,delete o.qos_matching.dst_port,delete o.qos_matching.protocol),e.qos_matching.protocol===n.aS.NUMBER&&(o.qos_matching.protocol=e.protocolNumber),e.enableDestinationPort||delete o.qos_matching.dst_port,e.enableSourcePort||delete o.qos_matching.src_port,e.markingTrafficType){case t.ev.DSCP:delete o.qos_marking.cos_code,delete o.qos_marking.ip_precedence_code;break;case t.ev.COS:delete o.qos_marking.dscp_code,delete o.qos_marking.ip_precedence_code}switch(e.matchingTrafficType){case t.ev.DSCP:delete o.qos_matching.cos_code,delete o.qos_matching.ip_precedence_code;break;case t.ev.IP_PRECEDENCE:delete o.qos_matching.dscp_code,delete o.qos_matching.cos_code;break;case t.AC:delete o.qos_matching.dscp_code,delete o.qos_matching.cos_code,delete o.qos_matching.ip_precedence_code}return e.enableQosMarking||(delete o.qos_marking.cos_code,delete o.qos_marking.dscp_code,delete o.qos_marking.ip_precedence_code),o},l=e=>{const o={qos_marking:{cos_code:e.qos_marking.cos_code||c.L.qos_marking.cos_code,dscp_code:e.qos_marking.dscp_code||c.L.qos_marking.dscp_code,ip_precedence_code:e.qos_marking.ip_precedence_code||c.L.qos_marking.ip_precedence_code,queue:e.qos_marking.queue||c.L.qos_marking.queue},qos_matching:{protocol:"number"==typeof e?.qos_matching?.protocol?n.aS.NUMBER:e.qos_matching.protocol||c.L.qos_matching.protocol,cos_code:e.qos_matching.cos_code||c.L.qos_matching.cos_code,dscp_code:e.qos_matching.dscp_code||c.L.qos_matching.dscp_code,ip_precedence_code:e.qos_matching.ip_precedence_code||c.L.qos_matching.ip_precedence_code,dst_port:e.qos_matching.dst_port||c.L.qos_matching.dst_port,src_port:e.qos_matching.src_port||c.L.qos_matching.src_port}};return o.enableDestinationPort=void 0!==e.qos_matching.dst_port,o.enableSourcePort=void 0!==e.qos_matching.src_port,o.enableQosMarking=void 0!==e.qos_marking.cos_code||void 0!==e.qos_marking.dscp_code||void 0!==e.qos_marking.ip_precedence_code,o.markingTrafficType=void 0!==e.qos_marking.cos_code?t.ev.COS:t.ev.DSCP,o.matchingTrafficType=void 0!==e.qos_matching.dscp_code?t.ev.DSCP:void 0!==e.qos_matching.ip_precedence_code?t.ev.IP_PRECEDENCE:t.AC,o.protocolNumber="number"==typeof e.qos_matching.protocol?e.qos_matching.protocol:0,o}},195021(e,o,a){a.d(o,{EV:()=>d,l2:()=>c,rH:()=>r});var n=a(247816),i=a(409844),t=a(309130),s=a(100978);const c=(0,n.A)(s.A)`
  min-height: ${t.fS};
  align-items: center;
  align-self: flex-start;
`,r=i.AH`
  max-width: 130px;
  width: 130px;
`,d=i.AH`
  > div {
    margin: 0 !important;
  }
`},754237(e,o,a){a.d(o,{W:()=>i,k:()=>n});const n=34,i=12*n}}]);