2026-06-16 05:58:18 +00:00
import { _ as a , s as gi , g as xi , t as Xt , q as di , a as fi , b as pi , l as Yt , L as mi , e as yi , A as bi , F as _t , H as Nt , I as Ai , a1 as wi , i as Ci , am as Si , a9 as Wt } from "./mermaid.core.BrszyIat.js" ; import { i as _i } from "./init.Gi6I4Gst.js" ; import { o as ki } from "./ordinal.BYWQX77i.js" ; import { l as zt } from "./linear.CUU6x3v2.js" ; import "./framework.C2AwuPrQ.js" ; import "./defaultLocale.DX6XiGOO.js" ; function Ri ( e , t , i ) { e = + e , t = + t , i = ( n = arguments . length ) < 2 ? ( t = e , e = 0 , 1 ) : n < 3 ? 1 : + i ; for ( var s = - 1 , n = Math . max ( 0 , Math . ceil ( ( t - e ) / i ) ) | 0 , o = new Array ( n ) ; ++ s < n ; ) o [ s ] = e + s * i ; return o } function bt ( ) { var e = ki ( ) . unknown ( void 0 ) , t = e . domain , i = e . range , s = 0 , n = 1 , o , u , p = ! 1 , f = 0 , T = 0 , P = . 5 ; delete e . unknown ; function _ ( ) { var y = t ( ) . length , E = n < s , v = E ? n : s , L = E ? s : n ; o = ( L - v ) / Math . max ( 1 , y - f + T * 2 ) , p && ( o = Math . floor ( o ) ) , v += ( L - v - o * ( y - f ) ) * P , u = o * ( 1 - f ) , p && ( v = Math . round ( v ) , u = Math . round ( u ) ) ; var I = Ri ( y ) . map ( function ( m ) { return v + o * m } ) ; return i ( E ? I . reverse ( ) : I ) } return e . domain = function ( y ) { return arguments . length ? ( t ( y ) , _ ( ) ) : t ( ) } , e . range = function ( y ) { return arguments . length ? ( [ s , n ] = y , s = + s , n = + n , _ ( ) ) : [ s , n ] } , e . rangeRound = function ( y ) { return [ s , n ] = y , s = + s , n = + n , p = ! 0 , _ ( ) } , e . bandwidth = function ( ) { return u } , e . step = function ( ) { return o } , e . round = function ( y ) { return arguments . length ? ( p = ! ! y , _ ( ) ) : p } , e . padding = function ( y ) { return arguments . length ? ( f = Math . min ( 1 , T = + y ) , _ ( ) ) : f } , e . paddingInner = function ( y ) { return arguments . length ? ( f = Math . min ( 1 , y ) , _ ( ) ) : f } , e . paddingOuter = function ( y ) { return arguments . length ? ( T = + y , _ ( ) ) : T } , e . align = function ( y ) { return arguments . length ? ( P = Math . max ( 0 , Math . min ( 1 , y ) ) , _ ( ) ) : P } , e . copy = function ( ) { return bt ( t ( ) , [ s , n ] ) . round ( p ) . paddingInner ( f ) . paddingOuter ( T ) . align ( P ) } , _i . apply ( _ ( ) , arguments ) } var At = ( function ( ) { var e = a ( function ( F , h , c , g ) { for ( c = c || { } , g = F . length ; g -- ; c [ F [ g ] ] = h ) ; return c } , "o" ) , t = [ 1 , 10 , 12 , 14 , 16 , 18 , 19 , 21 , 23 ] , i = [ 2 , 6 ] , s = [ 1 , 3 ] , n = [ 1 , 5 ] , o = [ 1 , 6 ] , u = [ 1 , 7 ] , p = [ 1 , 5 , 10 , 12 , 14 , 16 , 18 , 19 , 21 , 23 , 34 , 35 , 36 ] , f = [ 1 , 25 ] , T = [ 1 , 26 ] , P = [ 1 , 28 ] , _ = [ 1 , 29 ] , y = [ 1 , 30 ] , E = [ 1 , 31 ] , v = [ 1 , 32 ] , L = [ 1 , 33 ] , I = [ 1 , 34 ] , m = [ 1 , 35 ] , R = [ 1 , 36 ] , l = [ 1 , 37 ] , W = [ 1 , 43 ] , O = [ 1 , 42 ] , X = [ 1 , 47 ] , Y = [ 1 , 50 ] , S = [ 1 , 10 , 12 , 14 , 16 , 18 , 19 , 21 , 23 , 34 , 35 , 36 ] , U = [ 1 , 10 , 12 , 14 , 16 , 18 , 19 , 21 , 23 , 24 , 26 , 27 , 28 , 34 , 35 , 36 ] , b = [ 1 , 10 , 12 , 14 , 16 , 18 , 19 , 21 , 23 , 24 , 26 , 27 , 28 , 34 , 35 , 36 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 ] , w = [ 1 , 64 ] , V = { trace : a ( function ( ) { } , "trace" ) , yy : { } , symbols _ : { error : 2 , start : 3 , eol : 4 , XYCHART : 5 , chartConfig : 6 , document : 7 , CHART _ORIENTATION : 8 , statement : 9 , title : 10 , text : 11 , X _AXIS : 12 , parseXAxis : 13 , Y _AXIS : 14 , parseYAxis : 15 , LINE : 16 , plotData : 17 , BAR : 18 , acc _title : 19 , acc _title _value : 20 , acc _descr : 21 , acc _descr _value : 22 , acc _descr _multiline _value : 23 , SQUARE _BRACES _START : 24 , commaSeparatedNumbers : 25 , SQUARE _BRACES _END : 26 , NUMBER _WITH _DECIMAL : 27 , COMMA : 28 , xAxisData : 29 , bandData : 30 , ARROW _DELIMITER : 31 , commaSeparatedTexts : 32 , yAxisData : 33 , NEWLINE : 34 , SEMI : 35 , EOF : 36 , alphaNum : 37 , STR : 38 , MD _STR : 39 , alphaNumToken : 40 , AMP : 41 , NUM : 42 , ALPHA : 43 , PLUS : 44 , EQUALS : 45 , MULT : 46 , DOT : 47 , BRKT : 48 , MINUS : 49 , UNDERSCORE : 50 , $accept : 0 , $end : 1 } , terminals _ : { 2 : "error" , 5 : "XYCHART" , 8 : "CHART_ORIENTATION" , 10 : "title" , 12 : "X_AXIS" , 14 : "Y_AXIS" , 16 : "LINE" , 18 : "BAR" , 19 : "acc_title" , 20 : "acc_title_value" , 21 : "acc_descr" , 22 : "acc_descr_value" , 23 : "acc_descr_multiline_value" , 24 : "SQUARE_BRACES_START" , 26 : "SQUARE_BRACES_END" , 27 : "NUMBER_WITH_DECIMAL" , 28 : "COMMA" , 31 : "ARROW_DELIMITER" , 34 : "NEWLINE" , 35 : "SEMI" , 36 : "EOF" , 38 : "STR" , 39 : "MD_STR" , 41 : "AMP" , 42 : "NUM" , 43 : "ALPHA" , 44 : "PLUS" , 45 : "EQUALS" , 46 : "MULT" , 47 : "DOT" , 48 : "BRKT" , 49 : "MINUS" , 50 : "UNDERSCORE" } , productions _ : [ 0 , [ 3 , 2 ] , [ 3 , 3 ] , [ 3 , 2 ] , [ 3 , 1 ] , [ 6 , 1 ] , [ 7 , 0 ] , [ 7 , 2 ] , [ 9 , 2 ] , [ 9 , 2 ] , [ 9 , 2 ] , [ 9 , 2 ] , [ 9 , 2 ] , [ 9 , 3 ] , [ 9 , 2 ] , [ 9 , 3 ] , [ 9 , 2 ] , [ 9 , 2 ] , [ 9 , 1 ] , [ 17 , 3 ] , [ 25 , 3 ] , [ 25 , 1 ] , [ 13 , 1 ] , [ 13 , 2 ] , [ 13 , 1 ] , [ 29 , 1 ] , [ 29 , 3 ] , [ 30 , 3 ] , [ 32 , 3 ] , [ 32 , 1 ] , [ 15 , 1 ] , [ 15 , 2 ] , [ 15 , 1 ] , [ 33 , 3 ] , [ 4 , 1 ] , [ 4 , 1 ] , [ 4 , 1 ] , [ 11 , 1 ] , [ 11 , 1 ] , [ 11 , 1 ] , [ 37 , 1 ] , [ 37 , 2 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] , [ 40 , 1 ] ] , performAction : a ( function ( h , c , g , x , C , r , rt ) { var d = r . length - 1 ; switch ( C ) { case 5 : x . setOrientation ( r [ d ] ) ; break ; case 9 : x . setDiagramTitle ( r [ d ] . text . trim ( ) ) ; break ; case 12 : x . setLineData ( { text : "" , type : "text" } , r [ d ] ) ; break ; case 13 : x . setLineData ( r [ d - 1 ] , r [ d ] ) ; break ; case 14 : x . setBarData ( { text : "" , type : "text" } , r [ d ] ) ; break ; case 15 : x . setBarData ( r [ d - 1 ] , r [ d ] ) ; break ; case 16 : this . $ = r [ d ] . trim ( ) , x . setAccTitle ( this . $ ) ; break ; case 17 : case 18 : this . $ = r [ d ] .
2026-05-11 05:18:54 +00:00
` +D.showPosition()+ `
Expecting ` +gt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":yt="Parse error on line "+(ct+1)+": Unexpected "+(M==Mt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(yt,{text:D.match,token:this.terminals_[M]||M,line:D.yylineno,loc:pt,expected:gt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+M);switch(z[0]){case 1:g.push(M),C.push(D.yytext),r.push(D.yylloc),g.push(z[1]),M=null,It=D.yyleng,d=D.yytext,ct=D.yylineno,pt=D.yylloc;break;case 2:if(N=this.productions_[z[1]][1],G. $ =C[C.length-N],G._ $ ={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ci&&(G._ $ .range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(G,[d,It,ct, $ .yy,z[1],C,r].concat(li)),typeof mt<"u")return mt;N&&(g=g.slice(0,-1*N*2),C=C.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[z[1]][0]),C.push(G. $ ),r.push(G._ $ ),Bt=rt[g[g.length-2]][g[g.length-1]],g.push(Bt);break;case 3:return!0}}return!0},"parse")},k=(function(){var F={EOF:1,parseError:a(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:a(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?: \r \n ?| \n ).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var c=h.length,g=h.split(/(?: \r \n ?| \n )/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?: \r \n ?| \n )/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+ ` . You can only invoke reject ( ) in the lexer when the lexer is of the backtracking persuasion ( options . backtrack _lexer = true ) .
` +this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/ \n /g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/ \n /g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+ `
` +c+"^"},"showPosition"),test_match:a(function(h,c){var g,x,C;if(this.options.backtrack_lexer&&(C={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(C.yylloc.range=this.yylloc.range.slice(0))),x=h[0].match(/(?: \r \n ?| \n ).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/ \r ? \n ?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(h[0].length),this.matched+=h[0],g=this.performAction.call(this,this.yy,this,c,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g)return g;if(this._backtrack){for(var r in C)this[r]=C[r];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var h,c,g,x;this._more||(this.yytext="",this.match="");for(var C=this._currentRules(),r=0;r<C.length;r++)if(g=this._input.match(this.rules[C[r]]),g&&(!c||g[0].length>c[0].length)){if(c=g,x=r,this.options.backtrack_lexer){if(h=this.test_match(g,C[r]),h!==!1)return h;if(this._backtrack){c=!1;continue}else return!1}else if(!this.options.flex)break}return c?(h=this.test_match(c,C[x]),h!==!1?h:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+ ` . Unrecognized text .
` +this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var c=this.next();return c||this.lex()},"lex"),begin:a(function(c){this.conditionStack.push(c)},"begin"),popState:a(function(){var c=this.conditionStack.length-1;return c>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(c){return c=this.conditionStack.length-1-Math.abs(c||0),c>=0?this.conditionStack[c]:"INITIAL"},"topState"),pushState:a(function(c){this.begin(c)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(function(c,g,x,C){switch(x){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 31;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 27;case 25:return this.popState(),26;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 43;case 33:return"COLON";case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 44:break;case 45:return 35;case 46:return 36}},"anonymous"),rules:[/^(?:%%(?! \{ )[^ \n ]*)/i,/^(?:[^ \} ]%%[^ \n ]*)/i,/^(?:( \r ? \n ))/i,/^(?:( \r ? \n ))/i,/^(?:[ \n \r ]+)/i,/^(?:%%[^ \n ]*)/i,/^(?:title \b )/i,/^(?:accTitle \s *: \s *)/i,/^(?:(?! \n ||)*[^ \n ]*)/i,/^(?:accDescr \s *: \s *)/i,/^(?:(?! \n ||)*[^ \n ]*)/i,/^(?:accDescr \s * \{ \s *)/i,/^(?: \} )/i,/^(?:[^ \} ]*)/i,/^(?:xychart-beta \b )/i,/^(?:xychart \b )/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis \b )/i,/^(?:y-axis \b )/i,/^(?: \[ )/i,/^(?:-->)/i,/^(?:line \b )/i,/^(?:bar \b )/i,/^(?: \[ )/i,/^(?:[+-]?(?: \d +(?: \. \d +)?| \. \d +))/i,/^(?: \] )/i,/^(?:(?: ` \ ) \ { this \ . pushState \ ( md _string \ ) ; \ } \ n < md _string > \ ( \ ? : \ ( \ ? ! ` " \) \. \) \+ \{ return MD_STR; \} \n <md_string> \( \? : ` ) ) / i , /^(?:["])/i , /^(?:["])/i , /^(?:[^"]*)/i , /^(?:\[)/i , /^(?:\])/i , /^(?:[A-Za-z]+)/i , /^(?::)/i , /^(?:\+)/i , /^(?:,)/i , /^(?:=)/i , /^(?:\*)/i , /^(?:#)/i , /^(?:[\_])/i , /^(?:\.)/i , /^(?:&)/i , /^(?:-)/i , /^(?:[0-9]+)/i , /^(?:\s+)/i , /^(?:;)/i , /^(?:$)/i ] , conditions : { data _inner : { rules : [ 0 , 1 , 4 , 5 , 6 , 7 , 9 , 11 , 14 , 15 , 16 , 17 , 18 , 21 , 22 , 24 , 25 , 26 , 27 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 ] , inclusive : ! 0 } , data : { rules : [ 0 , 1 , 3 , 4 , 5 , 6 , 7 , 9 , 11 , 14 , 15 , 16 , 17 , 18 , 21 , 22 , 23 , 26 , 27 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 ] , inclusive : ! 0 } , axis _band _data : { rules : [ 0 , 1 , 4 , 5 , 6 , 7 , 9 , 11 , 14 , 15 , 16 , 17 , 18 , 21 , 22 , 25 , 26 , 27 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 ] , inclusive : ! 0 } , axis _data : { rules : [ 0 , 1 , 2 , 4 , 5 , 6 , 7 , 9 , 11 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 24 , 26 , 27 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 ] , inclusive : ! 0 } , acc _descr _multiline : { rules : [ 12 , 13 ] , inclusive : ! 1 } , acc _descr : { rules : [ 10 ] , inclusive : ! 1 } , acc _title : { rules : [ 8 ] , inclusive : ! 1 } , title : { rules : [ ] , inclusive : ! 1 } , md _string : { rules : [ ] , inclusive : ! 1 } , string : { rules : [ 28 , 29 ] , inclusive : ! 1 } , INITIAL : { rules : [ 0 , 1 , 4 , 5 , 6 , 7 , 9 , 11 , 14 , 15 , 16 , 17 , 18 , 21 , 22 , 26 , 27 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 ] , inclusive : ! 0 } } } ; return F } ) ( ) ; V . lexer = k ; function H ( ) { this . yy = { } } return a ( H , "Parser" ) , H . prototype = V , V . Parser = H , new H } ) ( )
` +e);const _=mi(t),y=_.append("g").attr("class","main"),E=y.append("rect").attr("width",u.width).attr("height",u.height).attr("class","background");yi(_,u.height,u.width,!0),_.attr("viewBox", ` 0 0 $ { u . width } $ { u . height } ` ),E.attr("fill",o.backgroundColor),n.setTmpSVGG(_.append("g").attr("class","mermaid-tmp-group"));const v=n.getDrawableElem(),L={};function I(m){let R=y,l="";for(const[W]of m.entries()){let O=y;W>0&&L[l]&&(O=L[l]),l+=m[W],R=L[l],R||(R=L[l]=O.append("g").attr("class",m[W]))}return R}a(I,"getGroup");for(const m of v){if(m.data.length===0)continue;const R=I(m.groupTexts);switch(m.type){case"rect":if(R.selectAll("rect").data(m.data).enter().append("rect").attr("x",l=>l.x).attr("y",l=>l.y).attr("width",l=>l.width).attr("height",l=>l.height).attr("fill",l=>l.fill).attr("stroke",l=>l.strokeFill).attr("stroke-width",l=>l.strokeWidth),u.showDataLabel){const l=u.showDataLabelOutsideBar;if(u.chartOrientation==="horizontal"){let W=function(w,V){const{data:k,label:H}=w;return V*H.length*O<=k.width-X};a(W,"fitsHorizontally");const O=.7,X=10,Y=m.data.map((w,V)=>({data:w,label:p[V].toString()})).filter(w=>w.data.width>0&&w.data.height>0),S=Y.map(w=>{const{data:V}=w;let k=V.height*.7;for(;!W(w,k)&&k>0;)k-=1;return k}),U=Math.floor(Math.min(...S)),b=a(w=>l?w.data.x+w.data.width+X:w.data.x+w.data.width-X,"determineLabelXPosition");R.selectAll("text").data(Y).enter().append("text").attr("x",b).attr("y",w=>w.data.y+w.data.height/2).attr("text-anchor",l?"start":"end").attr("dominant-baseline","middle").attr("fill",o.dataLabelColor).attr("font-size", ` $ { U } px ` ).text(w=>w.label)}else{let W=function(b,w,V){const{data:k,label:H}=b,h=w*H.length*.7,c=k.x+k.width/2,g=c-h/2,x=c+h/2,C=g>=k.x&&x<=k.x+k.width,r=k.y+V+w<=k.y+k.height;return C&&r};a(W,"fitsInBar");const O=10,X=m.data.map((b,w)=>({data:b,label:p[w].toString()})).filter(b=>b.data.width>0&&b.data.height>0),Y=X.map(b=>{const{data:w,label:V}=b;let k=w.width/(V.length*.7);for(;!W(b,k,O)&&k>0;)k-=1;return k}),S=Math.floor(Math.min(...Y)),U=a(b=>l?b.data.y-O:b.data.y+O,"determineLabelYPosition");R.selectAll("text").data(X).enter().append("text").attr("x",b=>b.data.x+b.data.width/2).attr("y",U).attr("text-anchor","middle").attr("dominant-baseline",l?"auto":"hanging").attr("fill",o.dataLabelColor).attr("font-size", ` $ { S } px ` ).text(b=>b.label)}}break;case"text":R.selectAll("text").data(m.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",l=>l.fill).attr("font-size",l=>l.fontSize).attr("dominant-baseline",l=>f(l.verticalPos)).attr("text-anchor",l=>T(l.horizontalPos)).attr("transform",l=>P(l)).text(l=>l.text);break;case"path":R.selectAll("path").data(m.data).enter().append("path").attr("d",l=>l.path).attr("fill",l=>l.fill?l.fill:"none").attr("stroke",l=>l.strokeFill).attr("stroke-width",l=>l.strokeWidth);break}}},"draw"),Oi={draw:zi}, $ i={parser:Ti,db:Wi,renderer:Oi};export{ $ i as diagram};