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.

140 lines (124 loc) 24.3 kB
const a=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),Z=require("./src-D8aDujwE.cjs"),v=require("./chunk-I66GZJ75-BzqGKy7F.cjs"),rt=require("./arc-bOapWCJu.cjs"),gt=require("./chunk-5VM5RSS4-DudUFQ_Z.cjs"),q=require("./chunk-2GRJ4B5K-DpsV4HbN.cjs");var H=(function(){var e=a.__name(function(r,n,s,o){for(s=s||{},o=r.length;o--;s[r[o]]=n);return s},"o"),t=[6,8,10,11,12,14,16,17,18],l=[1,9],y=[1,10],i=[1,11],c=[1,12],h=[1,13],d=[1,14],_={trace:a.__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:a.__name(function(n,s,o,f,p,u,k){var m=u.length-1;switch(p){case 1:return u[m-1];case 2:this.$=[];break;case 3:u[m-1].push(u[m]),this.$=u[m-1];break;case 4:case 5:this.$=u[m];break;case 6:case 7:this.$=[];break;case 8:f.setDiagramTitle(u[m].substr(6)),this.$=u[m].substr(6);break;case 9:this.$=u[m].trim(),f.setAccTitle(this.$);break;case 10:case 11:this.$=u[m].trim(),f.setAccDescription(this.$);break;case 12:f.addSection(u[m].substr(8)),this.$=u[m].substr(8);break;case 13:f.addTask(u[m-1],u[m]),this.$="task"}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:l,12:y,14:i,16:c,17:h,18:d},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:15,11:l,12:y,14:i,16:c,17:h,18:d},e(t,[2,5]),e(t,[2,6]),e(t,[2,8]),{13:[1,16]},{15:[1,17]},e(t,[2,11]),e(t,[2,12]),{19:[1,18]},e(t,[2,4]),e(t,[2,9]),e(t,[2,10]),e(t,[2,13])],defaultActions:{},parseError:a.__name(function(n,s){if(s.recoverable)this.trace(n);else{var o=new Error(n);throw o.hash=s,o}},"parseError"),parse:a.__name(function(n){var s=this,o=[0],f=[],p=[null],u=[],k=this.table,m="",P=0,R=0,tt=0,yt=2,et=1,ft=u.slice.call(arguments,1),x=Object.create(this.lexer),A={yy:{}};for(var W in this.yy)Object.prototype.hasOwnProperty.call(this.yy,W)&&(A.yy[W]=this.yy[W]);x.setInput(n,A.yy),A.yy.lexer=x,A.yy.parser=this,typeof x.yylloc>"u"&&(x.yylloc={});var O=x.yylloc;u.push(O);var pt=x.options&&x.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _t(T){o.length=o.length-2*T,p.length=p.length-T,u.length=u.length-T}a.__name(_t,"popStack");function nt(){var T=f.pop()||x.lex()||et;return typeof T!="number"&&(T instanceof Array&&(f=T,T=f.pop()),T=s.symbols_[T]||T),T}a.__name(nt,"lex");for(var b,G,I,w,X,F={},N,M,it,z;;){if(I=o[o.length-1],this.defaultActions[I]?w=this.defaultActions[I]:((b===null||typeof b>"u")&&(b=nt()),w=k[I]&&k[I][b]),typeof w>"u"||!w.length||!w[0]){var J="";z=[];for(N in k[I])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");x.showPosition?J="Parse error on line "+(P+1)+`: `+x.showPosition()+` Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":J="Parse error on line "+(P+1)+": Unexpected "+(b==et?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(J,{text:x.match,token:this.terminals_[b]||b,line:x.yylineno,loc:O,expected:z})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+b);switch(w[0]){case 1:o.push(b),p.push(x.yytext),u.push(x.yylloc),o.push(w[1]),b=null,G?(b=G,G=null):(R=x.yyleng,m=x.yytext,P=x.yylineno,O=x.yylloc,tt>0&&tt--);break;case 2:if(M=this.productions_[w[1]][1],F.$=p[p.length-M],F._$={first_line:u[u.length-(M||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(M||1)].first_column,last_column:u[u.length-1].last_column},pt&&(F._$.range=[u[u.length-(M||1)].range[0],u[u.length-1].range[1]]),X=this.performAction.apply(F,[m,R,P,A.yy,w[1],p,u].concat(ft)),typeof X<"u")return X;M&&(o=o.slice(0,-1*M*2),p=p.slice(0,-1*M),u=u.slice(0,-1*M)),o.push(this.productions_[w[1]][0]),p.push(F.$),u.push(F._$),it=k[o[o.length-2]][o[o.length-1]],o.push(it);break;case 3:return!0}}return!0},"parse")};_.lexer=(function(){return{EOF:1,parseError:a.__name(function(n,s){if(this.yy.parser)this.yy.parser.parseError(n,s);else throw new Error(n)},"parseError"),setInput:a.__name(function(r,n){return this.yy=n||this.yy||{},this._input=r,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.__name(function(){var r=this._input[0];return this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r,r.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),r},"input"),unput:a.__name(function(r){var n=r.length,s=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=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),s.length-1&&(this.yylineno-=s.length-1);var f=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:s?(s.length===o.length?this.yylloc.first_column:0)+o[o.length-s.length].length-s[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:a.__name(function(){return this._more=!0,this},"more"),reject:a.__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:a.__name(function(r){this.unput(this.match.slice(r))},"less"),pastInput:a.__name(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a.__name(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a.__name(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+` `+n+"^"},"showPosition"),test_match:a.__name(function(r,n){var s,o,f;if(this.options.backtrack_lexer&&(f={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&&(f.yylloc.range=this.yylloc.range.slice(0))),o=r[0].match(/(?:\r\n?|\n).*/g),o&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,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(r[0].length),this.matched+=r[0],s=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var p in f)this[p]=f[p];return!1}return!1},"test_match"),next:a.__name(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,n,s,o;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),p=0;p<f.length;p++)if(s=this._input.match(this.rules[f[p]]),s&&(!n||s[0].length>n[0].length)){if(n=s,o=p,this.options.backtrack_lexer){if(r=this.test_match(s,f[p]),r!==!1)return r;if(this._backtrack){n=!1;continue}else return!1}else if(!this.options.flex)break}return n?(r=this.test_match(n,f[o]),r!==!1?r:!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.__name(function(){var n=this.next();return n||this.lex()},"lex"),begin:a.__name(function(n){this.conditionStack.push(n)},"begin"),popState:a.__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a.__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:a.__name(function(n){return n=this.conditionStack.length-1-Math.abs(n||0),n>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:a.__name(function(n){this.begin(n)},"pushState"),stateStackSize:a.__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a.__name(function(n,s,o,f){switch(o){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\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,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}}})();function g(){this.yy={}}return a.__name(g,"Parser"),g.prototype=_,_.Parser=g,new g})();H.parser=H;var mt=H,V="",Q=[],L=[],B=[],xt=a.__name(function(){Q.length=0,L.length=0,V="",B.length=0,v.clear()},"clear"),kt=a.__name(function(e){V=e,Q.push(e)},"addSection"),bt=a.__name(function(){return Q},"getSections"),vt=a.__name(function(){let e=at();const t=100;let l=0;for(;!e&&l<t;)e=at(),l++;return L.push(...B),L},"getTasks"),wt=a.__name(function(){const e=[];return L.forEach(t=>{t.people&&e.push(...t.people)}),[...new Set(e)].sort()},"updateActors"),Tt=a.__name(function(e,t){const l=t.substr(1).split(":");let y=0,i=[];l.length===1?(y=Number(l[0]),i=[]):(y=Number(l[0]),i=l[1].split(","));const c=i.map(d=>d.trim()),h={section:V,type:V,people:c,task:e,score:y};B.push(h)},"addTask"),St=a.__name(function(e){const t={section:V,type:V,description:e,task:e,classes:[]};L.push(t)},"addTaskOrg"),at=a.__name(function(){const e=a.__name(function(l){return B[l].processed},"compileTask");let t=!0;for(const[l,y]of B.entries())e(l),t=t&&y.processed;return t},"compileTasks"),st={getConfig:a.__name(()=>v.getConfig2().journey,"getConfig"),clear:xt,setDiagramTitle:v.setDiagramTitle,getDiagramTitle:v.getDiagramTitle,setAccTitle:v.setAccTitle,getAccTitle:v.getAccTitle,setAccDescription:v.setAccDescription,getAccDescription:v.getAccDescription,addSection:kt,getSections:bt,getTasks:vt,addTask:Tt,addTaskOrg:St,getActors:a.__name(function(){return wt()},"getActors")},$t=a.__name(e=>`.label { font-family: ${e.fontFamily}; color: ${e.textColor}; } .mouth { stroke: #666; } line { stroke: ${e.textColor} } .legend { fill: ${e.textColor}; font-family: ${e.fontFamily}; } .label text { fill: #333; } .label { color: ${e.textColor} } .face { ${e.faceColor?`fill: ${e.faceColor}`:"fill: #FFF8DC"}; stroke: #999; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: 1px; } .node .label { text-align: center; } .node.clickable { cursor: pointer; } .arrowheadPath { fill: ${e.arrowheadColor}; } .edgePath .path { stroke: ${e.lineColor}; stroke-width: 1.5px; } .flowchart-link { stroke: ${e.lineColor}; fill: none; } .edgeLabel { background-color: ${e.edgeLabelBackground}; rect { opacity: 0.5; } text-align: center; } .cluster rect { } .cluster text { fill: ${e.titleColor}; } div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: ${e.fontFamily}; font-size: 12px; background: ${e.tertiaryColor}; border: 1px solid ${e.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .task-type-0, .section-type-0 { ${e.fillType0?`fill: ${e.fillType0}`:""}; } .task-type-1, .section-type-1 { ${e.fillType0?`fill: ${e.fillType1}`:""}; } .task-type-2, .section-type-2 { ${e.fillType0?`fill: ${e.fillType2}`:""}; } .task-type-3, .section-type-3 { ${e.fillType0?`fill: ${e.fillType3}`:""}; } .task-type-4, .section-type-4 { ${e.fillType0?`fill: ${e.fillType4}`:""}; } .task-type-5, .section-type-5 { ${e.fillType0?`fill: ${e.fillType5}`:""}; } .task-type-6, .section-type-6 { ${e.fillType0?`fill: ${e.fillType6}`:""}; } .task-type-7, .section-type-7 { ${e.fillType0?`fill: ${e.fillType7}`:""}; } .actor-0 { ${e.actor0?`fill: ${e.actor0}`:""}; } .actor-1 { ${e.actor1?`fill: ${e.actor1}`:""}; } .actor-2 { ${e.actor2?`fill: ${e.actor2}`:""}; } .actor-3 { ${e.actor3?`fill: ${e.actor3}`:""}; } .actor-4 { ${e.actor4?`fill: ${e.actor4}`:""}; } .actor-5 { ${e.actor5?`fill: ${e.actor5}`:""}; } ${gt.getIconStyles()} `,"getStyles"),D=a.__name(function(e,t){return q.drawRect(e,t)},"drawRect"),Mt=a.__name(function(e,t){const y=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=e.append("g");i.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"),i.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(_){const g=rt.arc_default().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);_.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}a.__name(c,"smile");function h(_){const g=rt.arc_default().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);_.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}a.__name(h,"sad");function d(_){_.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 a.__name(d,"ambivalent"),t.score>3?c(i):t.score<3?h(i):d(i),y},"drawFace"),ct=a.__name(function(e,t){const l=e.append("circle");return l.attr("cx",t.cx),l.attr("cy",t.cy),l.attr("class","actor-"+t.pos),l.attr("fill",t.fill),l.attr("stroke",t.stroke),l.attr("r",t.r),l.class!==void 0&&l.attr("class",l.class),t.title!==void 0&&l.append("title").text(t.title),l},"drawCircle"),ht=a.__name(function(e,t){return q.drawText(e,t)},"drawText"),Ct=a.__name(function(e,t){function l(i,c,h,d,_){return i+","+c+" "+(i+h)+","+c+" "+(i+h)+","+(c+d-_)+" "+(i+h-_*1.2)+","+(c+d)+" "+i+","+(c+d)}a.__name(l,"genPoints");const y=e.append("polygon");y.attr("points",l(t.x,t.y,50,20,7)),y.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,ht(e,t)},"drawLabel"),Et=a.__name(function(e,t,l){const y=e.append("g"),i=q.getNoteRect();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=l.width*t.taskCount+l.diagramMarginX*(t.taskCount-1),i.height=l.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,D(y,i),ut(l)(t.text,y,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},l,t.colour)},"drawSection"),K=-1,Pt=a.__name(function(e,t,l,y){const i=t.x+l.width/2,c=e.append("g");K++,c.append("line").attr("id",y+"-task"+K).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Mt(c,{cx:i,cy:300+(5-t.score)*30,score:t.score});const h=q.getNoteRect();h.x=t.x,h.y=t.y,h.fill=t.fill,h.width=l.width,h.height=l.height,h.class="task task-type-"+t.num,h.rx=3,h.ry=3,D(c,h);let d=t.x+14;t.people.forEach(_=>{const g=t.actors[_].color,r={cx:d,cy:t.y,r:7,fill:g,stroke:"#000",title:_,pos:t.actors[_].position};ct(c,r),d+=10}),ut(l)(t.task,c,h.x,h.y,h.width,h.height,{class:"task"},l,t.colour)},"drawTask"),At=a.__name(function(e,t){q.drawBackgroundRect(e,t)},"drawBackgroundRect"),ut=(function(){function e(i,c,h,d,_,g,r,n){y(c.append("text").attr("x",h+_/2).attr("y",d+g/2+5).style("font-color",n).style("text-anchor","middle").text(i),r)}a.__name(e,"byText");function t(i,c,h,d,_,g,r,n,s){const{taskFontSize:o,taskFontFamily:f}=n,p=i.split(/<br\s*\/?>/gi);for(let u=0;u<p.length;u++){const k=u*o-o*(p.length-1)/2,m=c.append("text").attr("x",h+_/2).attr("y",d).attr("fill",s).style("text-anchor","middle").style("font-size",o).style("font-family",f);m.append("tspan").attr("x",h+_/2).attr("dy",k).text(p[u]),m.attr("y",d+g/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),y(m,r)}}a.__name(t,"byTspan");function l(i,c,h,d,_,g,r,n){const s=c.append("switch"),o=s.append("foreignObject").attr("x",h).attr("y",d).attr("width",_).attr("height",g).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");o.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),t(i,s,h,d,_,g,r,n),y(o,r)}a.__name(l,"byFo");function y(i,c){for(const h in c)h in c&&i.attr(h,c[h])}return a.__name(y,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?l:i.textPlacement==="old"?e:t}})(),j={drawRect:D,drawCircle:ct,drawSection:Et,drawText:ht,drawLabel:Ct,drawTask:Pt,drawBackgroundRect:At,initGraphics:a.__name(function(e,t){K=-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")},It=a.__name(function(e){Object.keys(e).forEach(function(t){$[t]=e[t]})},"setConf"),C={},Y=0;function dt(e){const t=v.getConfig2().journey,l=t.maxLabelWidth;Y=0;let y=60;Object.keys(C).forEach(i=>{const c=C[i].color,h={cx:20,cy:y,r:7,fill:c,stroke:"#000",pos:C[i].position};j.drawCircle(e,h);let d=e.append("text").attr("visibility","hidden").text(i);const _=d.node().getBoundingClientRect().width;d.remove();let g=[];if(_<=l)g=[i];else{const r=i.split(" ");let n="";d=e.append("text").attr("visibility","hidden"),r.forEach(s=>{const o=n?`${n} ${s}`:s;if(d.text(o),d.node().getBoundingClientRect().width>l){if(n&&g.push(n),n=s,d.text(s),d.node().getBoundingClientRect().width>l){let f="";for(const p of s)f+=p,d.text(f+"-"),d.node().getBoundingClientRect().width>l&&(g.push(f.slice(0,-1)+"-"),f=p);n=f}}else n=o}),n&&g.push(n),d.remove()}g.forEach((r,n)=>{const s={x:40,y:y+7+n*20,fill:"#666",text:r,textMargin:t.boxTextMargin??5},o=j.drawText(e,s).node().getBoundingClientRect().width;o>Y&&o>t.leftMargin-o&&(Y=o)}),y+=Math.max(20,g.length*20)})}a.__name(dt,"drawActorLegend");var $=v.getConfig2().journey,E=0,Rt=a.__name(function(e,t,l,y){const i=v.getConfig2(),c=i.journey.titleColor,h=i.journey.titleFontSize,d=i.journey.titleFontFamily,_=i.securityLevel;let g;_==="sandbox"&&(g=Z.select_default("#i"+t));const r=_==="sandbox"?Z.select_default(g.nodes()[0].contentDocument.body):Z.select_default("body");S.init();const n=r.select("#"+t);j.initGraphics(n,t);const s=y.db.getTasks(),o=y.db.getDiagramTitle(),f=y.db.getActors();for(const R in C)delete C[R];let p=0;f.forEach(R=>{C[R]={color:$.actorColours[p%$.actorColours.length],position:p},p++}),dt(n),E=$.leftMargin+Y,S.insert(0,0,E,Object.keys(C).length*50),Ft(n,s,0,t);const u=S.getBounds();o&&n.append("text").text(o).attr("x",E).attr("font-size",h).attr("font-weight","bold").attr("y",25).attr("fill",c).attr("font-family",d);const k=u.stopy-u.starty+2*$.diagramMarginY,m=E+u.stopx+2*$.diagramMarginX;v.configureSvgSize(n,k,m,$.useMaxWidth),n.append("line").attr("x1",E).attr("y1",$.height*4).attr("x2",m-E-4).attr("y2",$.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#"+t+"-arrowhead)");const P=o?70:0;n.attr("viewBox",`${u.startx} -25 ${m} ${k+P}`),n.attr("preserveAspectRatio","xMinYMin meet"),n.attr("height",k+P+25)},"draw"),S={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:a.__name(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:a.__name(function(e,t,l,y){e[t]===void 0?e[t]=l:e[t]=y(l,e[t])},"updateVal"),updateBounds:a.__name(function(e,t,l,y){const i=v.getConfig2().journey,c=this;let h=0;function d(_){return a.__name(function(r){h++;const n=c.sequenceItems.length-h+1;c.updateVal(r,"starty",t-n*i.boxMargin,Math.min),c.updateVal(r,"stopy",y+n*i.boxMargin,Math.max),c.updateVal(S.data,"startx",e-n*i.boxMargin,Math.min),c.updateVal(S.data,"stopx",l+n*i.boxMargin,Math.max),_!=="activation"&&(c.updateVal(r,"startx",e-n*i.boxMargin,Math.min),c.updateVal(r,"stopx",l+n*i.boxMargin,Math.max),c.updateVal(S.data,"starty",t-n*i.boxMargin,Math.min),c.updateVal(S.data,"stopy",y+n*i.boxMargin,Math.max))},"updateItemBounds")}a.__name(d,"updateFn"),this.sequenceItems.forEach(d())},"updateBounds"),insert:a.__name(function(e,t,l,y){const i=Math.min(e,l),c=Math.max(e,l),h=Math.min(t,y),d=Math.max(t,y);this.updateVal(S.data,"startx",i,Math.min),this.updateVal(S.data,"starty",h,Math.min),this.updateVal(S.data,"stopx",c,Math.max),this.updateVal(S.data,"stopy",d,Math.max),this.updateBounds(i,h,c,d)},"insert"),bumpVerticalPos:a.__name(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:a.__name(function(){return this.verticalPos},"getVerticalPos"),getBounds:a.__name(function(){return this.data},"getBounds")},U=$.sectionFills,lt=$.sectionColours,Ft=a.__name(function(e,t,l,y){const i=v.getConfig2().journey;let c="";const h=l+(i.height*2+i.diagramMarginY);let d=0,_="#CCC",g="black",r=0;for(const[n,s]of t.entries()){if(c!==s.section){_=U[d%U.length],r=d%U.length,g=lt[d%lt.length];let f=0;const p=s.section;for(let k=n;k<t.length&&t[k].section==p;k++)f=f+1;const u={x:n*i.taskMargin+n*i.width+E,y:50,text:s.section,fill:_,num:r,colour:g,taskCount:f};j.drawSection(e,u,i),c=s.section,d++}const o=s.people.reduce((f,p)=>(C[p]&&(f[p]=C[p]),f),{});s.x=n*i.taskMargin+n*i.width+E,s.y=h,s.width=i.diagramMarginX,s.height=i.diagramMarginY,s.colour=g,s.fill=_,s.num=r,s.actors=o,j.drawTask(e,s,i,y),S.insert(s.x,s.y,s.x+s.width+i.taskMargin,450)}},"drawTasks"),ot={setConf:It,draw:Rt},Vt={parser:mt,db:st,renderer:ot,styles:$t,init:a.__name(e=>{ot.setConf(e.journey),st.clear()},"init")};exports.diagram=Vt;