"use strict";(self.webpackChunkforgejo=self.webpackChunkforgejo||[]).push([["node_modules_mermaid_dist_chunks_mermaid_core_diagram-P4PSJMXO_mjs"],{"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs":(function(C,v,d){d.d(v,{S:function(){return E}});var D=d("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs");function E(h,s){h.accDescr&&s.setAccDescription?.(h.accDescr),h.accTitle&&s.setAccTitle?.(h.accTitle),h.title&&s.setDiagramTitle?.(h.title)}(0,D.K2)(E,"populateCommonDb")}),"./node_modules/mermaid/dist/chunks/mermaid.core/diagram-P4PSJMXO.mjs":(function(C,v,d){var B;d.d(v,{diagram:function(){return M}});var D=d("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-HHEYEP7N.mjs"),E=d("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs"),h=d("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-GEFDOKGD.mjs"),s=d("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-7R4GIKGN.mjs"),u=d("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs"),x=d("./node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs"),y=s.UI.packet,P=(B=class{constructor(){this.packet=[],this.setAccTitle=s.SV,this.getAccTitle=s.iN,this.setDiagramTitle=s.ke,this.getDiagramTitle=s.ab,this.getAccDescription=s.m7,this.setAccDescription=s.EI}getConfig(){const t=(0,h.$t)({...y,...(0,s.zj)().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){(0,s.IU)(),this.packet=[]}},(0,u.K2)(B,"PacketDB"),B),$=1e4,j=(0,u.K2)((e,t)=>{(0,E.S)(e,t);let r=-1,o=[],c=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:n,bits:k,label:m}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(k===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(n??(n=a+(k??1)-1),k??(k=n-a+1),r=n,u.Rm.debug(`Packet block ${a} - ${r} with label ${m}`);o.length<=l+1&&t.getPacket().length<$;){const[_,i]=A({start:a,end:n,bits:k,label:m},c,l);if(o.push(_),_.end+1===c*l&&(t.pushWord(o),o=[],c++),!i)break;({start:a,end:n,bits:k,label:m}=i)}}t.pushWord(o)},"populate"),A=(0,u.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 o=t*r-1,c=t*r;return[{start:e.start,end:o,label:e.label,bits:o-e.start},{start:c,end:e.end,label:e.label,bits:e.end-c}]},"getNextFittingBlock"),w={parser:{yy:void 0},parse:(0,u.K2)(async e=>{const t=await(0,x.qg)("packet",e),r=w.parser?.yy;if(!(r instanceof P))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.");u.Rm.debug(t),j(t,r)},"parse")},T=(0,u.K2)((e,t,r,o)=>{const c=o.db,l=c.getConfig(),{rowHeight:a,paddingY:n,bitWidth:k,bitsPerRow:m}=l,_=c.getPacket(),i=c.getDiagramTitle(),f=a+n,p=f*(_.length+1)-(i?0:a),g=k*m+2,b=(0,D.D)(t);b.attr("viewBox",`0 0 ${g} ${p}`),(0,s.a$)(b,p,g,l.useMaxWidth);for(const[R,W]of _.entries())K(b,W,R,l);b.append("text").text(i).attr("x",g/2).attr("y",p-f/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),K=(0,u.K2)((e,t,r,{rowHeight:o,paddingX:c,paddingY:l,bitWidth:a,bitsPerRow:n,showBits:k})=>{const m=e.append("g"),_=r*(o+l)+l;for(const i of t){const f=i.start%n*a+1,p=(i.end-i.start+1)*a-c;if(m.append("rect").attr("x",f).attr("y",_).attr("width",p).attr("height",o).attr("class","packetBlock"),m.append("text").attr("x",f+p/2).attr("y",_+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(i.label),!k)continue;const g=i.end===i.start,b=_-2;m.append("text").attr("x",f+(g?p/2:0)).attr("y",b).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",g?"middle":"start").text(i.start),g||m.append("text").attr("x",f+p).attr("y",b).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(i.end)}},"drawWord"),O={draw:T},S={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},F=(0,u.K2)(({packet:e}={})=>{const t=(0,h.$t)(S,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"),M={parser:w,get db(){return new P},renderer:O,styles:F}})}]);
