"use strict";(self.webpackChunksolace_agenitc_mesh_docs=self.webpackChunksolace_agenitc_mesh_docs||[]).push([[375],{487:(t,e,a)=>{function r(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}a.d(e,{S:()=>r}),(0,a(1750).K2)(r,"populateCommonDb")},375:(t,e,a)=>{a.d(e,{diagram:()=>m});var r=a(487),o=a(6792),n=a(4505),l=a(1750),i=a(8731),s={packet:[]},c=structuredClone(s),d=l.UI.packet,b=(0,l.K2)((()=>{const t=(0,o.$t)({...d,...(0,l.zj)().packet});return t.showBits&&(t.paddingY+=10),t}),"getConfig"),k=(0,l.K2)((()=>c.packet),"getPacket"),p={pushWord:(0,l.K2)((t=>{t.length>0&&c.packet.push(t)}),"pushWord"),getPacket:k,getConfig:b,clear:(0,l.K2)((()=>{(0,l.IU)(),c=structuredClone(s)}),"clear"),setAccTitle:l.SV,getAccTitle:l.iN,setDiagramTitle:l.ke,getDiagramTitle:l.ab,getAccDescription:l.m7,setAccDescription:l.EI},h=(0,l.K2)((t=>{(0,r.S)(t,p);let e=-1,a=[],o=1;const{bitsPerRow:n}=p.getConfig();for(let{start:r,end:i,bits:s,label:c}of t.blocks){if(void 0!==r&&void 0!==i&&i<r)throw new Error(`Packet block ${r} - ${i} is invalid. End must be greater than start.`);if(r??=e+1,r!==e+1)throw new Error(`Packet block ${r} - ${i??r} is not contiguous. It should start from ${e+1}.`);if(0===s)throw new Error(`Packet block ${r} is invalid. Cannot have a zero bit field.`);for(i??=r+(s??1)-1,s??=i-r+1,e=i,l.Rm.debug(`Packet block ${r} - ${e} with label ${c}`);a.length<=n+1&&p.getPacket().length<1e4;){const[t,e]=g({start:r,end:i,bits:s,label:c},o,n);if(a.push(t),t.end+1===o*n&&(p.pushWord(a),a=[],o++),!e)break;({start:r,end:i,bits:s,label:c}=e)}}p.pushWord(a)}),"populate"),g=(0,l.K2)(((t,e,a)=>{if(void 0===t.start)throw new Error("start should have been set during first phase");if(void 0===t.end)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*a)return[t,void 0];const r=e*a-1,o=e*a;return[{start:t.start,end:r,label:t.label,bits:r-t.start},{start:o,end:t.end,label:t.label,bits:t.end-o}]}),"getNextFittingBlock"),f={parse:(0,l.K2)((async t=>{const e=await(0,i.qg)("packet",t);l.Rm.debug(e),h(e)}),"parse")},u=(0,l.K2)(((t,e,a,r)=>{const o=r.db,i=o.getConfig(),{rowHeight:s,paddingY:c,bitWidth:d,bitsPerRow:b}=i,k=o.getPacket(),p=o.getDiagramTitle(),h=s+c,g=h*(k.length+1)-(p?0:s),f=d*b+2,u=(0,n.D)(e);u.attr("viewbox",`0 0 ${f} ${g}`),(0,l.a$)(u,g,f,i.useMaxWidth);for(const[n,l]of k.entries())w(u,l,n,i);u.append("text").text(p).attr("x",f/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")}),"draw"),w=(0,l.K2)(((t,e,a,{rowHeight:r,paddingX:o,paddingY:n,bitWidth:l,bitsPerRow:i,showBits:s})=>{const c=t.append("g"),d=a*(r+n)+n;for(const b of e){const t=b.start%i*l+1,e=(b.end-b.start+1)*l-o;if(c.append("rect").attr("x",t).attr("y",d).attr("width",e).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",t+e/2).attr("y",d+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(b.label),!s)continue;const a=b.end===b.start,n=d-2;c.append("text").attr("x",t+(a?e/2:0)).attr("y",n).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",a?"middle":"start").text(b.start),a||c.append("text").attr("x",t+e).attr("y",n).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(b.end)}}),"drawWord"),$={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},m={parser:f,db:p,renderer:{draw:u},styles:(0,l.K2)((({packet:t}={})=>{const e=(0,o.$t)($,t);return`\n\t.packetByte {\n\t\tfont-size: ${e.byteFontSize};\n\t}\n\t.packetByte.start {\n\t\tfill: ${e.startByteColor};\n\t}\n\t.packetByte.end {\n\t\tfill: ${e.endByteColor};\n\t}\n\t.packetLabel {\n\t\tfill: ${e.labelColor};\n\t\tfont-size: ${e.labelFontSize};\n\t}\n\t.packetTitle {\n\t\tfill: ${e.titleColor};\n\t\tfont-size: ${e.titleFontSize};\n\t}\n\t.packetBlock {\n\t\tstroke: ${e.blockStrokeColor};\n\t\tstroke-width: ${e.blockStrokeWidth};\n\t\tfill: ${e.blockFillColor};\n\t}\n\t`}),"styles")}}}]);