"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["node_modules_pnpm_mermaid_11_11_0_node_modules_mermaid_dist_chunks_mermaid_core_diagram-S2PKO-a0b21c"],{"./node_modules/.pnpm/mermaid@11.11.0/node_modules/mermaid/dist/chunks/mermaid.core/diagram-S2PKOQOG.mjs":(function(I,w,_){var b;_.d(w,{diagram:function(){return W}});var x=_("./node_modules/.pnpm/mermaid@11.11.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-EXTU4WIE.mjs"),P=_("./node_modules/.pnpm/mermaid@11.11.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs"),B=_("./node_modules/.pnpm/mermaid@11.11.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.mjs"),d=_("./node_modules/.pnpm/mermaid@11.11.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.mjs"),m=_("./node_modules/.pnpm/mermaid@11.11.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs"),y=_("./node_modules/.pnpm/@mermaid-js+parser@0.6.2/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs"),C=d.UI.packet,v=(b=class{constructor(){this.packet=[],this.setAccTitle=d.SV,this.getAccTitle=d.iN,this.setDiagramTitle=d.ke,this.getDiagramTitle=d.ab,this.getAccDescription=d.m7,this.setAccDescription=d.EI}getConfig(){const t=(0,B.$t)({...C,...(0,d.zj)().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){(0,d.IU)(),this.packet=[]}},(0,m.K2)(b,"PacketDB"),b),$=1e4,D=(0,m.K2)((e,t)=>{(0,P.S)(e,t);let r=-1,s=[],i=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:n,bits:p,label:c}of e.blocks){if(a!==void 0&&n!==void 0&&n<a)throw new Error(`Packet block ${a} - ${n} is invalid. End must be greater than start.`);if(a??(a=r+1),a!==r+1)throw new Error(`Packet block ${a} - ${n??a} is not contiguous. It should start from ${r+1}.`);if(p===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(n??(n=a+(p??1)-1),p??(p=n-a+1),r=n,m.Rm.debug(`Packet block ${a} - ${r} with label ${c}`);s.length<=l+1&&t.getPacket().length<$;){const[h,o]=S({start:a,end:n,bits:p,label:c},i,l);if(s.push(h),h.end+1===i*l&&(t.pushWord(s),s=[],i++),!o)break;({start:a,end:n,bits:p,label:c}=o)}}t.pushWord(s)},"populate"),S=(0,m.K2)((e,t,r)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*r)return[e,void 0];const s=t*r-1,i=t*r;return[{start:e.start,end:s,label:e.label,bits:s-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},"getNextFittingBlock"),E={parser:{yy:void 0},parse:(0,m.K2)(async e=>{const t=await(0,y.qg)("packet",e),r=E.parser?.yy;if(!(r instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.Rm.debug(t),D(t,r)},"parse")},O=(0,m.K2)((e,t,r,s)=>{const i=s.db,l=i.getConfig(),{rowHeight:a,paddingY:n,bitWidth:p,bitsPerRow:c}=l,h=i.getPacket(),o=i.getDiagramTitle(),k=a+n,u=k*(h.length+1)-(o?0:a),g=p*c+2,f=(0,x.D)(t);f.attr("viewbox",`0 0 ${g} ${u}`),(0,d.a$)(f,u,g,l.useMaxWidth);for(const[F,M]of h.entries())A(f,M,F,l);f.append("text").text(o).attr("x",g/2).attr("y",u-k/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),A=(0,m.K2)((e,t,r,{rowHeight:s,paddingX:i,paddingY:l,bitWidth:a,bitsPerRow:n,showBits:p})=>{const c=e.append("g"),h=r*(s+l)+l;for(const o of t){const k=o.start%n*a+1,u=(o.end-o.start+1)*a-i;if(c.append("rect").attr("x",k).attr("y",h).attr("width",u).attr("height",s).attr("class","packetBlock"),c.append("text").attr("x",k+u/2).attr("y",h+s/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(o.label),!p)continue;const g=o.end===o.start,f=h-2;c.append("text").attr("x",k+(g?u/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",g?"middle":"start").text(o.start),g||c.append("text").attr("x",k+u).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(o.end)}},"drawWord"),K={draw:O},T={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},j=(0,m.K2)(({packet:e}={})=>{const t=(0,B.$t)(T,e);return`
	.packetByte {
		font-size: ${t.byteFontSize};
	}
	.packetByte.start {
		fill: ${t.startByteColor};
	}
	.packetByte.end {
		fill: ${t.endByteColor};
	}
	.packetLabel {
		fill: ${t.labelColor};
		font-size: ${t.labelFontSize};
	}
	.packetTitle {
		fill: ${t.titleColor};
		font-size: ${t.titleFontSize};
	}
	.packetBlock {
		stroke: ${t.blockStrokeColor};
		stroke-width: ${t.blockStrokeWidth};
		fill: ${t.blockFillColor};
	}
	`},"styles"),W={parser:E,get db(){return new v},renderer:K,styles:j}})}]);
