mirror of
https://github.com/alexpasmantier/television.git
synced 2025-07-29 14:21:43 +00:00
1 line
4.2 KiB
JavaScript
1 line
4.2 KiB
JavaScript
"use strict";(self.webpackChunktelevision_website=self.webpackChunktelevision_website||[]).push([[2128],{160:(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(6632).K2)(r,"populateCommonDb")},2128:(t,e,a)=>{a.d(e,{diagram:()=>x});var r=a(160),n=a(8211),o=a(8466),i=a(6632),l=a(7076),s={packet:[]},c=structuredClone(s),d=i.UI.packet,b=(0,i.K2)((()=>{const t=(0,n.$t)({...d,...(0,i.zj)().packet});return t.showBits&&(t.paddingY+=10),t}),"getConfig"),k=(0,i.K2)((()=>c.packet),"getPacket"),p={pushWord:(0,i.K2)((t=>{t.length>0&&c.packet.push(t)}),"pushWord"),getPacket:k,getConfig:b,clear:(0,i.K2)((()=>{(0,i.IU)(),c=structuredClone(s)}),"clear"),setAccTitle:i.SV,getAccTitle:i.iN,setDiagramTitle:i.ke,getDiagramTitle:i.ab,getAccDescription:i.m7,setAccDescription:i.EI},h=(0,i.K2)((t=>{(0,r.S)(t,p);let e=-1,a=[],n=1;const{bitsPerRow:o}=p.getConfig();for(let{start:r,end:l,bits:s,label:c}of t.blocks){if(void 0!==r&&void 0!==l&&l<r)throw new Error(`Packet block ${r} - ${l} is invalid. End must be greater than start.`);if(r??=e+1,r!==e+1)throw new Error(`Packet block ${r} - ${l??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(l??=r+(s??1)-1,s??=l-r+1,e=l,i.Rm.debug(`Packet block ${r} - ${e} with label ${c}`);a.length<=o+1&&p.getPacket().length<1e4;){const[t,e]=g({start:r,end:l,bits:s,label:c},n,o);if(a.push(t),t.end+1===n*o&&(p.pushWord(a),a=[],n++),!e)break;({start:r,end:l,bits:s,label:c}=e)}}p.pushWord(a)}),"populate"),g=(0,i.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,n=e*a;return[{start:t.start,end:r,label:t.label,bits:r-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]}),"getNextFittingBlock"),f={parse:(0,i.K2)((async t=>{const e=await(0,l.qg)("packet",t);i.Rm.debug(e),h(e)}),"parse")},u=(0,i.K2)(((t,e,a,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:s,paddingY:c,bitWidth:d,bitsPerRow:b}=l,k=n.getPacket(),p=n.getDiagramTitle(),h=s+c,g=h*(k.length+1)-(p?0:s),f=d*b+2,u=(0,o.D)(e);u.attr("viewbox",`0 0 ${f} ${g}`),(0,i.a$)(u,g,f,l.useMaxWidth);for(const[o,i]of k.entries())w(u,i,o,l);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,i.K2)(((t,e,a,{rowHeight:r,paddingX:n,paddingY:o,bitWidth:i,bitsPerRow:l,showBits:s})=>{const c=t.append("g"),d=a*(r+o)+o;for(const b of e){const t=b.start%l*i+1,e=(b.end-b.start+1)*i-n;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,o=d-2;c.append("text").attr("x",t+(a?e/2:0)).attr("y",o).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",o).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"},x={parser:f,db:p,renderer:{draw:u},styles:(0,i.K2)((({packet:t}={})=>{const e=(0,n.$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")}}}]); |