import{a as ut,s as yt,b as pt,c as ft,n as dt,o as gt,g as I,d as z,e as mt,q as xt}from"./layers.BfHNcLbu-DYQJ5yWQ.js";import{d as kt,y as nt,h as _t,l as bt}from"./layers.BaVoV2Mc-C0FNA5tx.js";import"./layers.B6AgvWr7-CmrKHMSF.js";import{v as J}from"./layers.DxRkHDxc-oRaqTALl.js";import"./index-n-59FgrC.js";import"./TaskPanel-FSBo9x0f.js";import"./useTaskTypesData-CgG6u01U.js";import"./IconUser-BvK8eLe8.js";import"./tasks-CZQGFm5u.js";import"./get-env-uyVen0u2.js";import"./IconChevronLeft-CyT72r93.js";import"./use-resize-observer-Bh8oaK16.js";import"./SegmentedControl-D05EYfFd.js";import"./SimpleGrid-DzebcIbT.js";import"./get-base-value-JqT_q0U7.js";import"./TypographyStylesProvider-D2Jq4B6Y.js";import"./clamp--03mf-JJ.js";import"./IconSortDescending-DCVZ-bvF.js";import"./IconGripVertical-Ce_4nROx.js";import"./Accordion-DVbX6gPb.js";import"./layers.DLwuMfdd-B0oSrkCJ.js";var X=(function(){var t=function(d,i,r,c){for(r=r||{},c=d.length;c--;r[d[c]]=i);return r},e=[6,8,10,11,12,14,16,17,18],s=[1,9],o=[1,10],n=[1,11],l=[1,12],u=[1,13],y=[1,14],p={trace:function(){},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:function(d,i,r,c,h,a,g){var x=a.length-1;switch(h){case 1:return a[x-1];case 2:this.$=[];break;case 3:a[x-1].push(a[x]),this.$=a[x-1];break;case 4:case 5:this.$=a[x];break;case 6:case 7:this.$=[];break;case 8:c.setDiagramTitle(a[x].substr(6)),this.$=a[x].substr(6);break;case 9:this.$=a[x].trim(),c.setAccTitle(this.$);break;case 10:case 11:this.$=a[x].trim(),c.setAccDescription(this.$);break;case 12:c.addSection(a[x].substr(8)),this.$=a[x].substr(8);break;case 13:c.addTask(a[x-1],a[x]),this.$="task";break}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:o,14:n,16:l,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:o,14:n,16:l,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:function(d,i){if(i.recoverable)this.trace(d);else{var r=new Error(d);throw r.hash=i,r}},parse:function(d){var i=this,r=[0],c=[],h=[null],a=[],g=this.table,x="",L=0,G=0,ot=2,Z=1,lt=a.slice.call(arguments,1),k=Object.create(this.lexer),T={yy:{}};for(var N in this.yy)Object.prototype.hasOwnProperty.call(this.yy,N)&&(T.yy[N]=this.yy[N]);k.setInput(d,T.yy),T.yy.lexer=k,T.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var R=k.yylloc;a.push(R);var ct=k.options&&k.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ht(){var $;return $=c.pop()||k.lex()||Z,typeof $!="number"&&($ instanceof Array&&(c=$,$=c.pop()),$=i.symbols_[$]||$),$}for(var _,C,b,B,P={},D,w,H,F;;){if(C=r[r.length-1],this.defaultActions[C]?b=this.defaultActions[C]:((_===null||typeof _>"u")&&(_=ht()),b=g[C]&&g[C][_]),typeof b>"u"||!b.length||!b[0]){var Y="";F=[];for(D in g[C])this.terminals_[D]&&D>ot&&F.push("'"+this.terminals_[D]+"'");k.showPosition?Y="Parse error on line "+(L+1)+`:
`+k.showPosition()+`
Expecting `+F.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Y="Parse error on line "+(L+1)+": Unexpected "+(_==Z?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Y,{text:k.match,token:this.terminals_[_]||_,line:k.yylineno,loc:R,expected:F})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+_);switch(b[0]){case 1:r.push(_),h.push(k.yytext),a.push(k.yylloc),r.push(b[1]),_=null,G=k.yyleng,x=k.yytext,L=k.yylineno,R=k.yylloc;break;case 2:if(w=this.productions_[b[1]][1],P.$=h[h.length-w],P._$={first_line:a[a.length-(w||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(w||1)].first_column,last_column:a[a.length-1].last_column},ct&&(P._$.range=[a[a.length-(w||1)].range[0],a[a.length-1].range[1]]),B=this.performAction.apply(P,[x,G,L,T.yy,b[1],h,a].concat(lt)),typeof B<"u")return B;w&&(r=r.slice(0,-1*w*2),h=h.slice(0,-1*w),a=a.slice(0,-1*w)),r.push(this.productions_[b[1]][0]),h.push(P.$),a.push(P._$),H=g[r[r.length-2]][r[r.length-1]],r.push(H);break;case 3:return!0}}return!0}},m=(function(){var d={EOF:1,parseError:function(i,r){if(this.yy.parser)this.yy.parser.parseError(i,r);else throw new Error(i)},setInput:function(i,r){return this.yy=r||this.yy||{},this._input=i,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},input:function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var r=i.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},unput:function(i){var r=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;var h=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 a=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===h.length?this.yylloc.first_column:0)+h[h.length-c.length].length-c[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject: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},less:function(i){this.unput(this.match.slice(i))},pastInput:function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var i=this.pastInput(),r=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
`+r+"^"},test_match:function(i,r){var c,h,a;if(this.options.backtrack_lexer&&(a={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&&(a.yylloc.range=this.yylloc.range.slice(0))),h=i[0].match(/(?:\r\n?|\n).*/g),h&&(this.yylineno+=h.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:h?h[h.length-1].length-h[h.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,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(i[0].length),this.matched+=i[0],c=this.performAction.call(this,this.yy,this,r,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var g in a)this[g]=a[g];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,r,c,h;this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),g=0;g<a.length;g++)if(c=this._input.match(this.rules[a[g]]),c&&(!r||c[0].length>r[0].length)){if(r=c,h=g,this.options.backtrack_lexer){if(i=this.test_match(c,a[g]),i!==!1)return i;if(this._backtrack){r=!1;continue}else return!1}else if(!this.options.flex)break}return r?(i=this.test_match(r,a[h]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var i=this.next();return i||this.lex()},begin:function(i){this.conditionStack.push(i)},popState:function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},pushState:function(i){this.begin(i)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(i,r,c,h){switch(c){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"}},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}}};return d})();p.lexer=m;function f(){this.yy={}}return f.prototype=p,p.Parser=f,new f})();X.parser=X;const vt=X;let E="";const q=[],A=[],j=[],wt=function(){q.length=0,A.length=0,E="",j.length=0,xt()},$t=function(t){E=t,q.push(t)},Mt=function(){return q},Tt=function(){let t=Q();const e=100;let s=0;for(;!t&&s<e;)t=Q(),s++;return A.push(...j),A},Ct=function(){const t=[];return A.forEach(e=>{e.people&&t.push(...e.people)}),[...new Set(t)].sort()},St=function(t,e){const s=e.substr(1).split(":");let o=0,n=[];s.length===1?(o=Number(s[0]),n=[]):(o=Number(s[0]),n=s[1].split(","));const l=n.map(y=>y.trim()),u={section:E,type:E,people:l,task:t,score:o};j.push(u)},It=function(t){const e={section:E,type:E,description:t,task:t,classes:[]};A.push(e)},Q=function(){const t=function(s){return j[s].processed};let e=!0;for(const[s,o]of j.entries())t(s),e=e&&o.processed;return e},Pt=function(){return Ct()},K={getConfig:()=>I().journey,clear:wt,setDiagramTitle:gt,getDiagramTitle:dt,setAccTitle:ft,getAccTitle:pt,setAccDescription:yt,getAccDescription:ut,addSection:$t,getSections:Mt,getTasks:Tt,addTask:St,addTaskOrg:It,getActors:Pt},Et=t=>`.label {
    font-family: 'trebuchet ms', verdana, arial, sans-serif;
    font-family: var(--mermaid-font-family);
    color: ${t.textColor};
  }
  .mouth {
    stroke: #666;
  }

  line {
    stroke: ${t.textColor}
  }

  .legend {
    fill: ${t.textColor};
  }

  .label text {
    fill: #333;
  }
  .label {
    color: ${t.textColor}
  }

  .face {
    ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"};
    stroke: #999;
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
    stroke-width: 1px;
  }

  .node .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }

  .arrowheadPath {
    fill: ${t.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${t.lineColor};
    stroke-width: 1.5px;
  }

  .flowchart-link {
    stroke: ${t.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${t.edgeLabelBackground};
    rect {
      opacity: 0.5;
    }
    text-align: center;
  }

  .cluster rect {
  }

  .cluster text {
    fill: ${t.titleColor};
  }

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: 'trebuchet ms', verdana, arial, sans-serif;
    font-family: var(--mermaid-font-family);
    font-size: 12px;
    background: ${t.tertiaryColor};
    border: 1px solid ${t.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .task-type-0, .section-type-0  {
    ${t.fillType0?`fill: ${t.fillType0}`:""};
  }
  .task-type-1, .section-type-1  {
    ${t.fillType0?`fill: ${t.fillType1}`:""};
  }
  .task-type-2, .section-type-2  {
    ${t.fillType0?`fill: ${t.fillType2}`:""};
  }
  .task-type-3, .section-type-3  {
    ${t.fillType0?`fill: ${t.fillType3}`:""};
  }
  .task-type-4, .section-type-4  {
    ${t.fillType0?`fill: ${t.fillType4}`:""};
  }
  .task-type-5, .section-type-5  {
    ${t.fillType0?`fill: ${t.fillType5}`:""};
  }
  .task-type-6, .section-type-6  {
    ${t.fillType0?`fill: ${t.fillType6}`:""};
  }
  .task-type-7, .section-type-7  {
    ${t.fillType0?`fill: ${t.fillType7}`:""};
  }

  .actor-0 {
    ${t.actor0?`fill: ${t.actor0}`:""};
  }
  .actor-1 {
    ${t.actor1?`fill: ${t.actor1}`:""};
  }
  .actor-2 {
    ${t.actor2?`fill: ${t.actor2}`:""};
  }
  .actor-3 {
    ${t.actor3?`fill: ${t.actor3}`:""};
  }
  .actor-4 {
    ${t.actor4?`fill: ${t.actor4}`:""};
  }
  .actor-5 {
    ${t.actor5?`fill: ${t.actor5}`:""};
  }
`,At=Et,U=function(t,e){return bt(t,e)},jt=function(t,e){const s=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),o=t.append("g");o.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),o.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function n(y){const p=J().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",p).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}function l(y){const p=J().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",p).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}function u(y){y.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return e.score>3?n(o):e.score<3?l(o):u(o),s},st=function(t,e){const s=t.append("circle");return s.attr("cx",e.cx),s.attr("cy",e.cy),s.attr("class","actor-"+e.pos),s.attr("fill",e.fill),s.attr("stroke",e.stroke),s.attr("r",e.r),s.class!==void 0&&s.attr("class",s.class),e.title!==void 0&&s.append("title").text(e.title),s},rt=function(t,e){return _t(t,e)},Vt=function(t,e){function s(n,l,u,y,p){return n+","+l+" "+(n+u)+","+l+" "+(n+u)+","+(l+y-p)+" "+(n+u-p*1.2)+","+(l+y)+" "+n+","+(l+y)}const o=t.append("polygon");o.attr("points",s(e.x,e.y,50,20,7)),o.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,rt(t,e)},Lt=function(t,e,s){const o=t.append("g"),n=nt();n.x=e.x,n.y=e.y,n.fill=e.fill,n.width=s.width*e.taskCount+s.diagramMarginX*(e.taskCount-1),n.height=s.height,n.class="journey-section section-type-"+e.num,n.rx=3,n.ry=3,U(o,n),at(s)(e.text,o,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+e.num},s,e.colour)};let tt=-1;const Dt=function(t,e,s){const o=e.x+s.width/2,n=t.append("g");tt++,n.append("line").attr("id","task"+tt).attr("x1",o).attr("y1",e.y).attr("x2",o).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),jt(n,{cx:o,cy:300+(5-e.score)*30,score:e.score});const l=nt();l.x=e.x,l.y=e.y,l.fill=e.fill,l.width=s.width,l.height=s.height,l.class="task task-type-"+e.num,l.rx=3,l.ry=3,U(n,l);let u=e.x+14;e.people.forEach(y=>{const p=e.actors[y].color,m={cx:u,cy:e.y,r:7,fill:p,stroke:"#000",title:y,pos:e.actors[y].position};st(n,m),u+=10}),at(s)(e.task,n,l.x,l.y,l.width,l.height,{class:"task"},s,e.colour)},Ft=function(t,e){kt(t,e)},at=(function(){function t(n,l,u,y,p,m,f,d){const i=l.append("text").attr("x",u+p/2).attr("y",y+m/2+5).style("font-color",d).style("text-anchor","middle").text(n);o(i,f)}function e(n,l,u,y,p,m,f,d,i){const{taskFontSize:r,taskFontFamily:c}=d,h=n.split(/<br\s*\/?>/gi);for(let a=0;a<h.length;a++){const g=a*r-r*(h.length-1)/2,x=l.append("text").attr("x",u+p/2).attr("y",y).attr("fill",i).style("text-anchor","middle").style("font-size",r).style("font-family",c);x.append("tspan").attr("x",u+p/2).attr("dy",g).text(h[a]),x.attr("y",y+m/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),o(x,f)}}function s(n,l,u,y,p,m,f,d){const i=l.append("switch"),r=i.append("foreignObject").attr("x",u).attr("y",y).attr("width",p).attr("height",m).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");r.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(n),e(n,i,u,y,p,m,f,d),o(r,f)}function o(n,l){for(const u in l)u in l&&n.attr(u,l[u])}return function(n){return n.textPlacement==="fo"?s:n.textPlacement==="old"?t:e}})(),Ot=function(t){t.append("defs").append("marker").attr("id","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")},V={drawRect:U,drawCircle:st,drawSection:Lt,drawText:rt,drawLabel:Vt,drawTask:Dt,drawBackgroundRect:Ft,initGraphics:Ot},Nt=function(t){Object.keys(t).forEach(function(e){O[e]=t[e]})},M={};function Rt(t){const e=I().journey;let s=60;Object.keys(M).forEach(o=>{const n=M[o].color,l={cx:20,cy:s,r:7,fill:n,stroke:"#000",pos:M[o].position};V.drawCircle(t,l);const u={x:40,y:s+7,fill:"#666",text:o,textMargin:e.boxTextMargin|5};V.drawText(t,u),s+=20})}const O=I().journey,S=O.leftMargin,Bt=function(t,e,s,o){const n=I().journey,l=I().securityLevel;let u;l==="sandbox"&&(u=z("#i"+e));const y=l==="sandbox"?z(u.nodes()[0].contentDocument.body):z("body");v.init();const p=y.select("#"+e);V.initGraphics(p);const m=o.db.getTasks(),f=o.db.getDiagramTitle(),d=o.db.getActors();for(const g in M)delete M[g];let i=0;d.forEach(g=>{M[g]={color:n.actorColours[i%n.actorColours.length],position:i},i++}),Rt(p),v.insert(0,0,S,Object.keys(M).length*50),Yt(p,m,0);const r=v.getBounds();f&&p.append("text").text(f).attr("x",S).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const c=r.stopy-r.starty+2*n.diagramMarginY,h=S+r.stopx+2*n.diagramMarginX;mt(p,c,h,n.useMaxWidth),p.append("line").attr("x1",S).attr("y1",n.height*4).attr("x2",h-S-4).attr("y2",n.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const a=f?70:0;p.attr("viewBox",`${r.startx} -25 ${h} ${c+a}`),p.attr("preserveAspectRatio","xMinYMin meet"),p.attr("height",c+a+25)},v={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},updateVal:function(t,e,s,o){t[e]===void 0?t[e]=s:t[e]=o(s,t[e])},updateBounds:function(t,e,s,o){const n=I().journey,l=this;let u=0;function y(p){return function(m){u++;const f=l.sequenceItems.length-u+1;l.updateVal(m,"starty",e-f*n.boxMargin,Math.min),l.updateVal(m,"stopy",o+f*n.boxMargin,Math.max),l.updateVal(v.data,"startx",t-f*n.boxMargin,Math.min),l.updateVal(v.data,"stopx",s+f*n.boxMargin,Math.max),l.updateVal(m,"startx",t-f*n.boxMargin,Math.min),l.updateVal(m,"stopx",s+f*n.boxMargin,Math.max),l.updateVal(v.data,"starty",e-f*n.boxMargin,Math.min),l.updateVal(v.data,"stopy",o+f*n.boxMargin,Math.max)}}this.sequenceItems.forEach(y())},insert:function(t,e,s,o){const n=Math.min(t,s),l=Math.max(t,s),u=Math.min(e,o),y=Math.max(e,o);this.updateVal(v.data,"startx",n,Math.min),this.updateVal(v.data,"starty",u,Math.min),this.updateVal(v.data,"stopx",l,Math.max),this.updateVal(v.data,"stopy",y,Math.max),this.updateBounds(n,u,l,y)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return this.data}},W=O.sectionFills,et=O.sectionColours,Yt=function(t,e,s){const o=I().journey;let n="";const l=o.height*2+o.diagramMarginY,u=s+l;let y=0,p="#CCC",m="black",f=0;for(const[d,i]of e.entries()){if(n!==i.section){p=W[y%W.length],f=y%W.length,m=et[y%et.length];let c=0;const h=i.section;for(let g=d;g<e.length&&e[g].section==h;g++)c=c+1;const a={x:d*o.taskMargin+d*o.width+S,y:50,text:i.section,fill:p,num:f,colour:m,taskCount:c};V.drawSection(t,a,o),n=i.section,y++}const r=i.people.reduce((c,h)=>(M[h]&&(c[h]=M[h]),c),{});i.x=d*o.taskMargin+d*o.width+S,i.y=u,i.width=o.diagramMarginX,i.height=o.diagramMarginY,i.colour=m,i.fill=p,i.num=f,i.actors=r,V.drawTask(t,i,o),v.insert(i.x,i.y,i.x+i.width+o.taskMargin,450)}},it={setConf:Nt,draw:Bt},he={parser:vt,db:K,renderer:it,styles:At,init:t=>{it.setConf(t.journey),K.clear()}};export{he as diagram};
