UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

121 lines (110 loc) 31.7 kB
const o=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),k=require("./src-C9EhKhbk.cjs"),V=require("./chunk-WYO6CB5R-u4mJNOcO.cjs"),lt=require("./arc-D25LhgTs.cjs"),Mt=require("./chunk-ICXQ74PX-BbT9JaEW.cjs"),At=require("./chunk-VAUOI2AC-DfQf5L2_.cjs");var tt=(function(){var e=o.__name(function(a,l,u,d){for(u=u||{},d=a.length;d--;u[a[d]]=l);return u},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],s=[1,13],r=[1,14],c=[1,15],i=[1,16],h=[1,19],m=[1,20],f={trace:o.__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o.__name(function(l,u,d,p,_,g,S){var x=g.length-1;switch(_){case 1:return g[x-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:g[x-1].push(g[x]),this.$=g[x-1];break;case 7:case 8:this.$=g[x];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(g[x].substr(6)),this.$=g[x].substr(6);break;case 12:this.$=g[x].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=g[x].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(g[x].substr(8)),this.$=g[x].substr(8);break;case 18:p.addTask(g[x],0,""),this.$=g[x];break;case 19:p.addEvent(g[x].substr(2)),this.$=g[x];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:s,17:r,19:c,20:i,21:17,22:18,23:h,24:m},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:s,17:r,19:c,20:i,21:17,22:18,23:h,24:m},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o.__name(function(l,u){if(u.recoverable)this.trace(l);else{var d=new Error(l);throw d.hash=u,d}},"parseError"),parse:o.__name(function(l){var u=this,d=[0],p=[],_=[null],g=[],S=this.table,x="",P=0,R=0,B=0,F=2,N=1,A=g.slice.call(arguments,1),w=Object.create(this.lexer),L={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(L.yy[O]=this.yy[O]);w.setInput(l,L.yy),L.yy.lexer=w,L.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var T=w.yylloc;g.push(T);var b=w.options&&w.options.ranges;typeof L.yy.parseError=="function"?this.parseError=L.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function E(W){d.length=d.length-2*W,_.length=_.length-W,g.length=g.length-W}o.__name(E,"popStack");function $(){var W=p.pop()||w.lex()||N;return typeof W!="number"&&(W instanceof Array&&(p=W,W=p.pop()),W=u.symbols_[W]||W),W}o.__name($,"lex");for(var v,H,C,I,D,q={},X,z,ot,K;;){if(C=d[d.length-1],this.defaultActions[C]?I=this.defaultActions[C]:((v===null||typeof v>"u")&&(v=$()),I=S[C]&&S[C][v]),typeof I>"u"||!I.length||!I[0]){var Y="";K=[];for(X in S[C])this.terminals_[X]&&X>F&&K.push("'"+this.terminals_[X]+"'");w.showPosition?Y="Parse error on line "+(P+1)+`: `+w.showPosition()+` Expecting `+K.join(", ")+", got '"+(this.terminals_[v]||v)+"'":Y="Parse error on line "+(P+1)+": Unexpected "+(v==N?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(Y,{text:w.match,token:this.terminals_[v]||v,line:w.yylineno,loc:T,expected:K})}if(I[0]instanceof Array&&I.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+v);switch(I[0]){case 1:d.push(v),_.push(w.yytext),g.push(w.yylloc),d.push(I[1]),v=null,H?(v=H,H=null):(R=w.yyleng,x=w.yytext,P=w.yylineno,T=w.yylloc,B>0&&B--);break;case 2:if(z=this.productions_[I[1]][1],q.$=_[_.length-z],q._$={first_line:g[g.length-(z||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(z||1)].first_column,last_column:g[g.length-1].last_column},b&&(q._$.range=[g[g.length-(z||1)].range[0],g[g.length-1].range[1]]),D=this.performAction.apply(q,[x,R,P,L.yy,I[1],_,g].concat(A)),typeof D<"u")return D;z&&(d=d.slice(0,-1*z*2),_=_.slice(0,-1*z),g=g.slice(0,-1*z)),d.push(this.productions_[I[1]][0]),_.push(q.$),g.push(q._$),ot=S[d[d.length-2]][d[d.length-1]],d.push(ot);break;case 3:return!0}}return!0},"parse")};f.lexer=(function(){return{EOF:1,parseError:o.__name(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:o.__name(function(a,l){return this.yy=l||this.yy||{},this._input=a,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:o.__name(function(){var a=this._input[0];return this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a,a.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:o.__name(function(a){var l=a.length,u=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=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),u.length-1&&(this.yylineno-=u.length-1);var p=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:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:o.__name(function(){return this._more=!0,this},"more"),reject:o.__name(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:o.__name(function(a){this.unput(this.match.slice(a))},"less"),pastInput:o.__name(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o.__name(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o.__name(function(){var a=this.pastInput(),l=new Array(a.length+1).join("-");return a+this.upcomingInput()+` `+l+"^"},"showPosition"),test_match:o.__name(function(a,l){var u,d,p;if(this.options.backtrack_lexer&&(p={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&&(p.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,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(a[0].length),this.matched+=a[0],u=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var _ in p)this[_]=p[_];return!1}return!1},"test_match"),next:o.__name(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,l,u,d;this._more||(this.yytext="",this.match="");for(var p=this._currentRules(),_=0;_<p.length;_++)if(u=this._input.match(this.rules[p[_]]),u&&(!l||u[0].length>l[0].length)){if(l=u,d=_,this.options.backtrack_lexer){if(a=this.test_match(u,p[_]),a!==!1)return a;if(this._backtrack){l=!1;continue}else return!1}else if(!this.options.flex)break}return l?(a=this.test_match(l,p[d]),a!==!1?a:!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:o.__name(function(){var l=this.next();return l||this.lex()},"lex"),begin:o.__name(function(l){this.conditionStack.push(l)},"begin"),popState:o.__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o.__name(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:o.__name(function(l){return l=this.conditionStack.length-1-Math.abs(l||0),l>=0?this.conditionStack[l]:"INITIAL"},"topState"),pushState:o.__name(function(l){this.begin(l)},"pushState"),stateStackSize:o.__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o.__name(function(l,u,d,p){switch(d){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}})();function y(){this.yy={}}return o.__name(y,"Parser"),y.prototype=f,f.Parser=y,new y})();tt.parser=tt;var Ct=tt,pt={};o.__export(pt,{addEvent:()=>St,addSection:()=>kt,addTask:()=>wt,addTaskOrg:()=>Et,clear:()=>mt,default:()=>Rt,getCommonDb:()=>_t,getDirection:()=>xt,getSections:()=>bt,getTasks:()=>vt,setDirection:()=>yt});var U="",ft=0,nt="LR",rt=[],j=[],Z=[],_t=o.__name(()=>V.commonDb_exports,"getCommonDb"),mt=o.__name(function(){rt.length=0,j.length=0,U="",Z.length=0,nt="LR",V.clear()},"clear"),yt=o.__name(function(e){nt=e},"setDirection"),xt=o.__name(function(){return nt},"getDirection"),kt=o.__name(function(e){U=e,rt.push(e)},"addSection"),bt=o.__name(function(){return rt},"getSections"),vt=o.__name(function(){let e=ct();const t=100;let n=0;for(;!e&&n<t;)e=ct(),n++;return j.push(...Z),j},"getTasks"),wt=o.__name(function(e,t,n){const s={id:ft++,section:U,type:U,task:e,score:t||0,events:n?[n]:[]};Z.push(s)},"addTask"),St=o.__name(function(e){Z.find(t=>t.id===ft-1).events.push(e)},"addEvent"),Et=o.__name(function(e){const t={section:U,type:U,description:e,task:e,classes:[]};j.push(t)},"addTaskOrg"),ct=o.__name(function(){const e=o.__name(function(n){return Z[n].processed},"compileTask");let t=!0;for(const[n,s]of Z.entries())e(n),t=t&&s.processed;return t},"compileTasks"),Rt={clear:mt,getCommonDb:_t,getDirection:xt,setDirection:yt,addSection:kt,getSections:bt,getTasks:vt,addTask:wt,addTaskOrg:Et,addEvent:St},Tt=0,J=o.__name(function(e,t){const n=e.append("rect");return n.attr("x",t.x),n.attr("y",t.y),n.attr("fill",t.fill),n.attr("stroke",t.stroke),n.attr("width",t.width),n.attr("height",t.height),n.attr("rx",t.rx),n.attr("ry",t.ry),t.class!==void 0&&n.attr("class",t.class),n},"drawRect"),Wt=o.__name(function(e,t){const s=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),r=e.append("g");r.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function c(m){const f=lt.arc_default().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);m.append("path").attr("class","mouth").attr("d",f).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}o.__name(c,"smile");function i(m){const f=lt.arc_default().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);m.append("path").attr("class","mouth").attr("d",f).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}o.__name(i,"sad");function h(m){m.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return o.__name(h,"ambivalent"),t.score>3?c(r):t.score<3?i(r):h(r),s},"drawFace"),Pt=o.__name(function(e,t){const n=e.append("circle");return n.attr("cx",t.cx),n.attr("cy",t.cy),n.attr("class","actor-"+t.pos),n.attr("fill",t.fill),n.attr("stroke",t.stroke),n.attr("r",t.r),n.class!==void 0&&n.attr("class",n.class),t.title!==void 0&&n.append("title").text(t.title),n},"drawCircle"),$t=o.__name(function(e,t){const n=t.text.replace(/<br\s*\/?>/gi," "),s=e.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class!==void 0&&s.attr("class",t.class);const r=s.append("tspan");return r.attr("x",t.x+t.textMargin*2),r.text(n),s},"drawText"),Vt=o.__name(function(e,t){function n(r,c,i,h,m){return r+","+c+" "+(r+i)+","+c+" "+(r+i)+","+(c+h-m)+" "+(r+i-m*1.2)+","+(c+h)+" "+r+","+(c+h)}o.__name(n,"genPoints");const s=e.append("polygon");s.attr("points",n(t.x,t.y,50,20,7)),s.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,$t(e,t)},"drawLabel"),Bt=o.__name(function(e,t,n){const s=e.append("g"),r=at();r.x=t.x,r.y=t.y,r.fill=t.fill,r.width=n.width,r.height=n.height,r.class="journey-section section-type-"+t.num,r.rx=3,r.ry=3,J(s,r),It(n)(t.text,s,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+t.num},n,t.colour)},"drawSection"),et=-1,Ft=o.__name(function(e,t,n,s){const r=t.x+n.width/2,c=e.append("g");et++,c.append("line").attr("id",s+"-task"+et).attr("x1",r).attr("y1",t.y).attr("x2",r).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Wt(c,{cx:r,cy:300+(5-t.score)*30,score:t.score});const i=at();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=n.width,i.height=n.height,i.class="task task-type-"+t.num,i.rx=3,i.ry=3,J(c,i),It(n)(t.task,c,i.x,i.y,i.width,i.height,{class:"task"},n,t.colour)},"drawTask"),Ot=o.__name(function(e,t){J(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),zt=o.__name(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),at=o.__name(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),It=(function(){function e(r,c,i,h,m,f,y,a){s(c.append("text").attr("x",i+m/2).attr("y",h+f/2+5).style("font-color",a).style("text-anchor","middle").text(r),y)}o.__name(e,"byText");function t(r,c,i,h,m,f,y,a,l){const{taskFontSize:u,taskFontFamily:d}=a,p=r.split(/<br\s*\/?>/gi);for(let _=0;_<p.length;_++){const g=_*u-u*(p.length-1)/2,S=c.append("text").attr("x",i+m/2).attr("y",h).attr("fill",l).style("text-anchor","middle").style("font-size",u).style("font-family",d);S.append("tspan").attr("x",i+m/2).attr("dy",g).text(p[_]),S.attr("y",h+f/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),s(S,y)}}o.__name(t,"byTspan");function n(r,c,i,h,m,f,y,a){const l=c.append("switch"),u=l.append("foreignObject").attr("x",i).attr("y",h).attr("width",m).attr("height",f).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");u.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(r),t(r,l,i,h,m,f,y,a),s(u,y)}o.__name(n,"byFo");function s(r,c){for(const i in c)i in c&&r.attr(i,c[i])}return o.__name(s,"_setTextAttrs"),function(r){return r.textPlacement==="fo"?n:r.textPlacement==="old"?e:t}})(),Gt=o.__name(function(e,t){Tt=0,et=-1,e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function it(e,t){e.each(function(){var n=k.select_default(this),s=n.text().split(/(\s+|<br>)/).reverse(),r,c=[],i=1.1,h=n.attr("y"),m=parseFloat(n.attr("dy")),f=n.text(null).append("tspan").attr("x",0).attr("y",h).attr("dy",m+"em");for(let y=0;y<s.length;y++)r=s[s.length-1-y],c.push(r),f.text(c.join(" ").trim()),(f.node().getComputedTextLength()>t||r==="<br>")&&(c.pop(),f.text(c.join(" ").trim()),r==="<br>"?c=[""]:c=[r],f=n.append("tspan").attr("x",0).attr("y",h).attr("dy",i+"em").text(r))})}o.__name(it,"wrap");var qt=o.__name(function(e,t,n,s,r,c=!1){const{theme:i,look:h}=s,m=i?.includes("redux"),f=n%(s?.themeVariables?.THEME_COLOR_LIMIT??12)-1,y=e.append("g");t.section=f,y.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+f));const a=y.append("g"),l=y.append("g"),u=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(it,t.width).node().getBBox(),d=s.fontSize?.replace?s.fontSize.replace("px",""):s.fontSize;if(t.height=u.height+d*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,l.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),m&&l.attr("transform",`translate(${t.width/2}, ${c?t.padding/2+3:t.padding})`),Xt(a,t,f,r,s),h==="neo"&&(y.attr("data-look","neo"),m)){const p=i.includes("dark"),_=k.select_default(e.node()?.ownerSVGElement??e.node()),g=_.attr("id")??"",S=g?`${g}-drop-shadow`:"drop-shadow";if(_.select(`#${S}`).empty()){const x=_.select("defs");(x.empty()?_.append("defs"):x).append("filter").attr("id",S).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",p?"0.2":"0.06").attr("flood-color",p?"#FFFFFF":"#000000")}}return t},"drawNode"),Dt=o.__name(function(e,t,n){const s=e.append("g"),r=s.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(it,t.width).node().getBBox(),c=n.fontSize?.replace?n.fontSize.replace("px",""):n.fontSize;return s.remove(),r.height+c*1.1*.5+t.padding},"getVirtualNodeHeight"),Xt=o.__name(function(e,t,n,s,r){const{theme:c}=r,i=c?.includes("redux")?0:5,h=5,m=i>0?`M0 ${t.height-h} v${-t.height+2*h} q0,-${i},${i},-${i} h${t.width-2*h} q${i},0,${i},${i} v${t.height-h} H0 Z`:`M0 ${t.height-h} v${-(t.height-h)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",s+"-node-"+Tt++).attr("class","node-bkg node-"+t.type).attr("d",m),c?.includes("redux")||e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),M={drawRect:J,drawCircle:Pt,drawSection:Bt,drawText:$t,drawLabel:Vt,drawTask:Ft,drawBackgroundRect:Ot,getTextObj:zt,getNoteRect:at,initGraphics:Gt,drawNode:qt,getVirtualNodeHeight:Dt},Ut=o.__name(function(e,t,n,s){const r=V.getConfig2(),{look:c,theme:i,themeVariables:h}=r,{useGradient:m,gradientStart:f,gradientStop:y}=h,a=r.timeline?.leftMargin??50;k.log.debug("timeline",s.db);const l=r.securityLevel;let u;l==="sandbox"&&(u=k.select_default("#i"+t));const d=(l==="sandbox"?k.select_default(u.nodes()[0].contentDocument.body):k.select_default("body")).select("#"+t);d.append("g");const p=s.db.getTasks(),_=s.db.getCommonDb().getDiagramTitle();k.log.debug("task",p),M.initGraphics(d,t);const g=s.db.getSections();k.log.debug("sections",g);let S=0,x=0,P=0,R=0,B=50+a,F=50;R=50;let N=0,A=!0;g.forEach(function(T){const b={number:N,descr:T,section:N,width:150,padding:20,maxHeight:S},E=M.getVirtualNodeHeight(d,b,r);k.log.debug("sectionHeight before draw",E),S=Math.max(S,E+20)});let w=0,L=0;k.log.debug("tasks.length",p.length);for(const[T,b]of p.entries()){const E={number:T,descr:b,section:b.section,width:150,padding:20,maxHeight:x},$=M.getVirtualNodeHeight(d,E,r);k.log.debug("taskHeight before draw",$),x=Math.max(x,$+20),w=Math.max(w,b.events.length);let v=0;for(const H of b.events){const C={descr:H,section:b.section,number:b.section,width:150,padding:20,maxHeight:50};v+=M.getVirtualNodeHeight(d,C,r)}b.events.length>0&&(v+=(b.events.length-1)*10),L=Math.max(L,v)}k.log.debug("maxSectionHeight before draw",S),k.log.debug("maxTaskHeight before draw",x),g&&g.length>0?g.forEach(T=>{const b=p.filter(H=>H.section===T),E={number:N,descr:T,section:N,width:200*Math.max(b.length,1)-50,padding:20,maxHeight:S};k.log.debug("sectionNode",E);const $=d.append("g"),v=M.drawNode($,E,N,r,t);k.log.debug("sectionNode output",v),$.attr("transform",`translate(${B}, ${R})`),F+=S+50,b.length>0&&ht(d,b,N,B,F,x,r,w,L,S,!1,t),B+=200*Math.max(b.length,1),F=R,N++}):(A=!1,ht(d,p,N,B,F,x,r,w,L,S,!0,t));const O=d.node().getBBox();if(k.log.debug("bounds",O),_&&d.append("text").text(_).attr("x",c==="neo"?O.x*2+a:O.width/2-a).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),P=A?S+x+150:x+100,d.append("g").attr("class","lineWrapper").append("line").attr("x1",a).attr("y1",P).attr("x2",O.width+3*a).attr("y2",P).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),c==="neo"&&m&&i!=="neutral"){const T=d.select("defs"),b=(T.empty()?d.append("defs"):T).append("linearGradient").attr("id",d.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");b.append("stop").attr("offset","0%").attr("stop-color",f).attr("stop-opacity",1),b.append("stop").attr("offset","100%").attr("stop-color",y).attr("stop-opacity",1)}V.setupGraphViewbox(void 0,d,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),ht=o.__name(function(e,t,n,s,r,c,i,h,m,f,y,a){for(const l of t){const u={descr:l.task,section:n,number:n,width:150,padding:20,maxHeight:c};k.log.debug("taskNode",u);const d=e.append("g").attr("class","taskWrapper"),p=M.drawNode(d,u,n,i,a).height;if(k.log.debug("taskHeight after draw",p),d.attr("transform",`translate(${s}, ${r})`),c=Math.max(c,p),l.events){const _=e.append("g").attr("class","lineWrapper");let g=c;r+=100,g=g+Zt(e,l.events,n,s,r,i,a),r-=100,_.append("line").attr("x1",s+190/2).attr("y1",r+c).attr("x2",s+190/2).attr("y2",r+c+100+m+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${a}-arrowhead)`).attr("stroke-dasharray","5,5")}s=s+200,y&&!i.timeline?.disableMulticolor&&n++}r=r-10},"drawTasks"),Zt=o.__name(function(e,t,n,s,r,c,i){let h=0;const m=r;r=r+100;for(const f of t){const y={descr:f,section:n,number:n,width:150,padding:20,maxHeight:50};k.log.debug("eventNode",y);const a=e.append("g").attr("class","eventWrapper"),l=M.drawNode(a,y,n,c,i,!0).height;h=h+l,a.attr("transform",`translate(${s}, ${r})`),r=r+10+l}return r=m,h},"drawEvents"),Kt={setConf:o.__name(()=>{},"setConf"),draw:Ut},Q=200,G=5,jt=Q+G*2,st=Q+100,Jt=st+G*2,Nt=10,Qt=0,dt=20,Ht=20,ut=30,Lt=50,Yt=o.__name(function(e,t,n,s){const r=V.getConfig2(),c=r.timeline?.leftMargin??50;k.log.debug("timeline",s.db);const i=At.selectSvgElement(t);i.append("g");const h=s.db.getTasks(),m=s.db.getCommonDb().getDiagramTitle();k.log.debug("task",h),M.initGraphics(i);const f=s.db.getSections();k.log.debug("sections",f);let y=0,a=0;const l=50+c;let u=50;const d=u,p=l,_=jt+Ht,g=Jt+Lt,S=p+_;let x=0;const P=f&&f.length>0,R=P?S:l+_,B=Math.max(50,_+g-G*2);f.forEach(function(b){const E={number:x,descr:b,section:x,width:B,padding:G,maxHeight:y},$=M.getVirtualNodeHeight(i,E,r);k.log.debug("sectionHeight before draw",$),y=Math.max(y,$)});let F=0;k.log.debug("tasks.length",h.length);for(const[b,E]of h.entries()){const $={number:b,descr:E,section:E.section,width:Q,padding:G,maxHeight:a},v=M.getVirtualNodeHeight(i,$,r);k.log.debug("taskHeight before draw",v),a=Math.max(a,v);let H=0;for(const C of E.events){const I={descr:C,section:E.section,number:E.section,width:st,padding:G,maxHeight:50};H+=M.getVirtualNodeHeight(i,I,r)}E.events.length>0&&(H+=(E.events.length-1)*Nt),F=Math.max(F,H)+Qt}k.log.debug("maxSectionHeight before draw",y),k.log.debug("maxTaskHeight before draw",a);const N=Math.max(a,F)+ut;P?f.forEach(b=>{const E=h.filter(X=>X.section===b),$={number:x,descr:b,section:x,width:B,padding:G,maxHeight:y};k.log.debug("sectionNode",$);const v=i.append("g"),H=M.drawNode(v,$,x,r);k.log.debug("sectionNode output",H);const C=R-_;v.attr("transform",`translate(${C}, ${u})`);const I=u+H.height+dt;E.length>0&&gt(i,E,x,R,I,a,r,N,!1);const D=E.length,q=H.height+dt+N*Math.max(D,1)-(D>0?ut*2:0);u+=q,x++}):gt(i,h,x,R,u,a,r,N,!0);let A=i.node()?.getBBox();if(!A)throw new Error("bbox not found");if(k.log.debug("bounds",A),m){if(i.append("text").text(m).attr("x",A.width/2-c).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),A=i.node()?.getBBox(),!A)throw new Error("bbox not found");k.log.debug("bounds after title",A)}const[w]=Mt.parseFontSize(r.fontSize),L=(w??16)*2,O=(w??16)*.5+20,T=i.append("g").attr("class","lineWrapper");T.append("line").attr("x1",R).attr("y1",d-L).attr("x2",R).attr("y2",A.y+A.height+O).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),T.lower(),V.setupGraphViewbox(void 0,i,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),gt=o.__name(function(e,t,n,s,r,c,i,h,m){for(const f of t){const y={descr:f.task,section:n,number:n,width:Q,padding:G,maxHeight:c};k.log.debug("taskNode",y);const a=e.append("g").attr("class","taskWrapper"),l=M.drawNode(a,y,n,i),u=l.height;k.log.debug("taskHeight after draw",u);const d=s-Ht-l.width;if(a.attr("transform",`translate(${d}, ${r})`),c=Math.max(c,u),f.events&&f.events.length>0){const p=r,_=s+Lt;te(e,f.events,n,s,_,p,i)}r=r+h,m&&!i.timeline?.disableMulticolor&&n++}},"drawTasks"),te=o.__name(function(e,t,n,s,r,c,i){let h=c;for(const m of t){const f={descr:m,section:n,number:n,width:st,padding:G,maxHeight:0};k.log.debug("eventNode",f);const y=e.append("g").attr("class","eventWrapper"),a=M.drawNode(y,f,n,i).height;y.attr("transform",`translate(${r}, ${h})`);const l=e.append("g").attr("class","lineWrapper"),u=h+a/2;l.append("line").attr("x1",s).attr("y1",u).attr("x2",r).attr("y2",u).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),h=h+a+Nt}return h-c},"drawEvents"),ee={setConf:o.__name(()=>{},"setConf"),draw:Yt},ne=o.__name(e=>{const{theme:t}=V.getConfig(),n=t?.includes("dark"),s=t?.includes("color"),r=e.svgId?.replace(/^#/,"")??"",c=r?`url(#${r}-drop-shadow)`:e.dropShadow??"none";let i="";for(let h=0;h<e.THEME_COLOR_LIMIT;h++){const m=`${17-3*h}`,f=s?e.borderColorArray[h]:e.mainBkg,y=s?e.borderColorArray[h]:e.nodeBorder;i+=` .section-${h-1} rect, .section-${h-1} path, .section-${h-1} circle { fill: ${n&&s?e.mainBkg:f}; stroke: ${y}; stroke-width: ${e.strokeWidth}; filter: ${c}; } .section-${h-1} text { fill: ${e.nodeBorder}; font-weight: ${e.fontWeight} } .node-icon-${h-1} { font-size: 40px; color: ${e["cScaleLabel"+h]}; } .section-edge-${h-1} { stroke: ${e["cScale"+h]}; } .edge-depth-${h-1} { stroke-width: ${m}; } .section-${h-1} line { stroke: ${e["cScaleInv"+h]}; stroke-width: 3; } .lineWrapper line { stroke: ${e.nodeBorder}; stroke-width:${e.strokeWidth} } .disabled, .disabled circle, .disabled text { fill: ${e.tertiaryColor??"lightgray"}; } .disabled text { fill: ${e.clusterBorder??"#efefef"}; } `}return i},"genReduxSections"),re=o.__name(e=>{let t="";for(let n=0;n<e.THEME_COLOR_LIMIT;n++)e["lineColor"+n]=e["lineColor"+n]||e["cScaleInv"+n],V.isDark(e["lineColor"+n])?e["lineColor"+n]=V.lighten(e["lineColor"+n],20):e["lineColor"+n]=V.darken(e["lineColor"+n],20);for(let n=0;n<e.THEME_COLOR_LIMIT;n++){const s=""+(17-3*n);t+=` .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} path { fill: ${e["cScale"+n]}; } .section-${n-1} text { fill: ${e["cScaleLabel"+n]}; } .node-icon-${n-1} { font-size: 40px; color: ${e["cScaleLabel"+n]}; } .section-edge-${n-1}{ stroke: ${e["cScale"+n]}; } .edge-depth-${n-1}{ stroke-width: ${s}; } .section-${n-1} line { stroke: ${e["cScaleInv"+n]} ; stroke-width: 3; } .lineWrapper line{ stroke: ${e["cScaleLabel"+n]} ; } .disabled, .disabled circle, .disabled text { fill: ${e.tertiaryColor??"lightgray"}; } .disabled text { fill: ${e.clusterBorder??"#efefef"}; } `}return t},"genSections"),ae={db:pt,renderer:{setConf:o.__name(()=>{},"setConf"),draw:o.__name((e,t,n,s)=>(s?.db?.getDirection?.()??"LR")==="TD"?ee.draw(e,t,n,s):Kt.draw(e,t,n,s),"draw")},parser:Ct,styles:o.__name(e=>{const{theme:t}=V.getConfig(),n=t?.includes("redux"),s=t==="neutral",r=e.svgId?.replace(/^#/,"")??"";let c="";if(e.useGradient&&r&&e.THEME_COLOR_LIMIT&&!s)for(let i=0;i<e.THEME_COLOR_LIMIT;i++)c+=` .section-${i-1}[data-look="neo"] rect, .section-${i-1}[data-look="neo"] path, .section-${i-1}[data-look="neo"] circle { fill: ${e.mainBkg}; stroke: url(#${r}-gradient); stroke-width: 2; } .section-${i-1}[data-look="neo"] line { stroke: url(#${r}-gradient); stroke-width: 2; }`;return` .edge { stroke-width: 3; } ${n?ne(e):re(e)} ${c} .section-root rect, .section-root path, .section-root circle { fill: ${e.git0}; } .section-root text { fill: ${e.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } .eventWrapper { filter: brightness(120%); } `},"getStyles")};exports.diagram=ae;