UNPKG

code-server

Version:

Run VS Code on a remote server.

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