orbitchat 2.2.10 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/assets/{_basePickBy-0t-1TdXj-DH4J1m8V.js → _basePickBy-lBvRrdD9-B-9MpFjW.js} +1 -1
  2. package/dist/assets/_baseUniq-BtBvqxlY-Dv5C3esR.js +1 -0
  3. package/dist/assets/{api-0NuHuopb.js → api-CV6_7nU6.js} +1 -1
  4. package/dist/assets/arc-CCBnZEkJ-DybyxfWt.js +1 -0
  5. package/dist/assets/{architectureDiagram-VXUJARFQ-5Jt_APG9-BoVNR4UV.js → architectureDiagram-VXUJARFQ-D6fnSZjh-dA25eufs.js} +1 -1
  6. package/dist/assets/{blockDiagram-VD42YOAC-DTiW7a-n-CSp1ALjf.js → blockDiagram-VD42YOAC-CVjY2HvJ-Bvs-2xFL.js} +5 -5
  7. package/dist/assets/{c4Diagram-YG6GDRKO-DfrzrMnC-CkCuHyrT.js → c4Diagram-YG6GDRKO-C-f-jRtb-CBj7d1Qp.js} +3 -3
  8. package/dist/assets/channel-BvgtnSqX-CiCpm-FK.js +1 -0
  9. package/dist/assets/{chunk-4BX2VUAB-DP6WsS5b-DmFzjHyq.js → chunk-4BX2VUAB-ecO_Iw3K-Dsg9QQ9e.js} +1 -1
  10. package/dist/assets/chunk-55IACEB6-BFlfi8hV-BGJXNzLC.js +1 -0
  11. package/dist/assets/{chunk-B4BG7PRW-BVaRFjbY-BdpIBFL7.js → chunk-B4BG7PRW-0M4wlQGy-BFIioH1f.js} +5 -5
  12. package/dist/assets/{chunk-DI55MBZ5-NwybRWU6-D93ibRgN.js → chunk-DI55MBZ5-DcwSH2gI-uNFBVBGw.js} +3 -3
  13. package/dist/assets/{chunk-FMBD7UC4-D0AjqgJd-BqUKvjQH.js → chunk-FMBD7UC4-CyW6Y4c1-Cvb-I-1S.js} +1 -1
  14. package/dist/assets/{chunk-QN33PNHL-cmS1bOzt-B1tGHIDu.js → chunk-QN33PNHL-DF3LkPOs-IyOxcAL-.js} +1 -1
  15. package/dist/assets/{chunk-QZHKN3VN-DehtyeGo-BsFo-AuY.js → chunk-QZHKN3VN-BnmCvaos-BhXhqQoN.js} +1 -1
  16. package/dist/assets/{chunk-TZMSLE5B-BILiPuwH-DOft2nRu.js → chunk-TZMSLE5B-C4Hy1m-m-DFftuvKT.js} +1 -1
  17. package/dist/assets/classDiagram-2ON5EDUG-C2K4H7s6-BqCqtggy.js +1 -0
  18. package/dist/assets/classDiagram-v2-WZHVMYZB-C2K4H7s6-BqCqtggy.js +1 -0
  19. package/dist/assets/clone-DlVqQknZ-BDJyp8y8.js +1 -0
  20. package/dist/assets/{cose-bilkent-S5V4N54A-CDJ5hD7Q-BcxkEWNp.js → cose-bilkent-S5V4N54A-mo6qcR8E-D_z6t4Tf.js} +1 -1
  21. package/dist/assets/dagre-6UL2VRFP-DH4t_gQU-UMN3n2-7.js +4 -0
  22. package/dist/assets/{diagram-PSM6KHXK-C0ItMhu6-BHHxSZE4.js → diagram-PSM6KHXK-xncR2khS-DE1fEkBR.js} +1 -1
  23. package/dist/assets/{diagram-QEK2KX5R-CEsgotfL-F-1j8qO7.js → diagram-QEK2KX5R-CSzZUVkA-tJcvFwfU.js} +1 -1
  24. package/dist/assets/{diagram-S2PKOQOG-B6d1S6_G-Zzv-O9xk.js → diagram-S2PKOQOG-CTsV2Ry--BQlcrrcr.js} +2 -2
  25. package/dist/assets/{erDiagram-Q2GNP2WA-B-w3sS7V-2nanwMJ6.js → erDiagram-Q2GNP2WA-C-DLmzQQ-B-jtk4eF.js} +5 -5
  26. package/dist/assets/{flowDiagram-NV44I4VS-DssRq_2c-BffMgd28.js → flowDiagram-NV44I4VS-9jalL_2N-DKuPtUeP.js} +1 -1
  27. package/dist/assets/{ganttDiagram-JELNMOA3-IIlGW_kJ-Dxu3SgAH.js → ganttDiagram-JELNMOA3-B5Q1jKOu-Ho5f5uzH.js} +3 -3
  28. package/dist/assets/gitGraphDiagram-NY62KEGX-ug9A7XoP-D9w06-2F.js +65 -0
  29. package/dist/assets/{graph-BZqzM_VI-BBLTPB3S.js → graph-C-LzaQKB-Cch5aJ-h.js} +1 -1
  30. package/dist/assets/{index-rkYlv_42-Bg0V1tPP.js → index-B04ueuvU-Cvw4_ymU.js} +1 -1
  31. package/dist/assets/{index-DodYl3VC.js → index-DiPXXjl1.js} +93 -90
  32. package/dist/assets/infoDiagram-WHAUD3N6-D3nyF9iF-BjcBjZOT.js +2 -0
  33. package/dist/assets/{journeyDiagram-XKPGCS4Q-D6S72Oe9-iYQx9Mof.js → journeyDiagram-XKPGCS4Q-DrGofxJ_-Zv8ktrVj.js} +4 -4
  34. package/dist/assets/{kanban-definition-3W4ZIXB7--JZpAUKg-C2LOftDm.js → kanban-definition-3W4ZIXB7-DPOqAG2O-DfLp3ebY.js} +6 -6
  35. package/dist/assets/{layout-DHdXRoe5-CY2O2SIL.js → layout-Cx9iE-zh-K_S5vGG7.js} +1 -1
  36. package/dist/assets/{mindmap-definition-VGOIOE7T-I33kejqp-b66KO8Rt.js → mindmap-definition-VGOIOE7T-CDbIuwaY-D4Ih9cyZ.js} +1 -1
  37. package/dist/assets/{pieDiagram-ADFJNKIX-69ywrIzx-ceXn0a9Q.js → pieDiagram-ADFJNKIX-DFk5HpTR-BSzTH4-Z.js} +3 -3
  38. package/dist/assets/{quadrantDiagram-AYHSOK5B-CySBol3o-CltGpVzM.js → quadrantDiagram-AYHSOK5B-B92wNx9A-Bpuj71wR.js} +5 -5
  39. package/dist/assets/{requirementDiagram-UZGBJVZJ-BL-LwQUQ-DM_SSY8F.js → requirementDiagram-UZGBJVZJ-DbcE1GOH-BSV5OUP4.js} +1 -1
  40. package/dist/assets/{sankeyDiagram-TZEHDZUN-D3rAZVzY-BAAQukCD.js → sankeyDiagram-TZEHDZUN-B0rVCfiD-kdmAtl5Z.js} +3 -3
  41. package/dist/assets/{sequenceDiagram-WL72ISMW-BfBBVBjh-C993xDQ0.js → sequenceDiagram-WL72ISMW-Ch4qd1_w-DeggnvKy.js} +8 -8
  42. package/dist/assets/{stateDiagram-FKZM4ZOC-CioTL1ci-eXs9ZVMI.js → stateDiagram-FKZM4ZOC-BXSNYh_4-BBInmGsn.js} +1 -1
  43. package/dist/assets/stateDiagram-v2-4FDKWEC3--JZPzZ-Q-C0r6gD51.js +1 -0
  44. package/dist/assets/{timeline-definition-IT6M3QCI-DJ1oTa68-Cp1nvAUx.js → timeline-definition-IT6M3QCI-BaU6yGwl-BdHCQ244.js} +4 -4
  45. package/dist/assets/{treemap-KMMF4GRG-BLuW6hva-CvNDnceM.js → treemap-KMMF4GRG-B8dtJA6c-C7398h3b.js} +38 -38
  46. package/dist/assets/{xychartDiagram-PRI3JC2R-BahWB4u4-B6_eZy6F.js → xychartDiagram-PRI3JC2R-CdE6529H-Bf_betHN.js} +3 -3
  47. package/dist/index.html +1 -1
  48. package/package.json +2 -2
  49. package/dist/assets/_baseUniq-DZ7Bpu3I-Co9egLVD.js +0 -1
  50. package/dist/assets/arc-CsV8WDj2-C9VadXC6.js +0 -1
  51. package/dist/assets/channel-C1GZ9yWj-DYugq-sa.js +0 -1
  52. package/dist/assets/chunk-55IACEB6-DcZAWW2t-DPyoMeFz.js +0 -1
  53. package/dist/assets/classDiagram-2ON5EDUG-_7dtGwsA-C3Nhy3w6.js +0 -1
  54. package/dist/assets/classDiagram-v2-WZHVMYZB-_7dtGwsA-C3Nhy3w6.js +0 -1
  55. package/dist/assets/clone-D8_vOzkg-D9aZREI4.js +0 -1
  56. package/dist/assets/dagre-6UL2VRFP-D6cOp6Da-xpk1mIcg.js +0 -4
  57. package/dist/assets/gitGraphDiagram-NY62KEGX-D9Tl4KHH--tnJGvul.js +0 -65
  58. package/dist/assets/infoDiagram-WHAUD3N6-CjmJiQNf-YInQHfWX.js +0 -2
  59. package/dist/assets/stateDiagram-v2-4FDKWEC3-CNXUSYFj-C88PWSf5.js +0 -1
@@ -1 +1 @@
1
- import{U as A,B as G,M}from"./chunk-DI55MBZ5-NwybRWU6-D93ibRgN.js";import{R as y,g as t,d as v,O as E,B as O,x as H,aw as U,aD as R,aA as P,v as I}from"./index-DodYl3VC.js";import{L as C}from"./graph-BZqzM_VI-BBLTPB3S.js";import{o as $}from"./layout-DHdXRoe5-CY2O2SIL.js";import"./chunk-55IACEB6-DcZAWW2t-DPyoMeFz.js";import"./chunk-QN33PNHL-cmS1bOzt-B1tGHIDu.js";import"./_baseUniq-DZ7Bpu3I-Co9egLVD.js";import"./_basePickBy-0t-1TdXj-DH4J1m8V.js";var W=y(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),q=y(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),F=y((e,n)=>{const g=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(n.id),s=g.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",s.width+2*t().state.padding).attr("height",s.height+2*t().state.padding).attr("rx",t().state.radius),g},"drawSimpleState"),J=y((e,n)=>{const g=y(function(o,u,b){const m=o.append("tspan").attr("x",2*t().state.padding).text(u);b||m.attr("dy",t().state.textHeight)},"addTspan"),s=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(n.descriptions[0]).node().getBBox(),r=s.height,c=e.append("text").attr("x",t().state.padding).attr("y",r+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let l=!0,a=!0;n.descriptions.forEach(function(o){l||(g(c,o,a),a=!1),l=!1});const d=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+r+t().state.dividerMargin/2).attr("y2",t().state.padding+r+t().state.dividerMargin/2).attr("class","descr-divider"),x=c.node().getBBox(),h=Math.max(x.width,s.width);return d.attr("x2",h+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",h+2*t().state.padding).attr("height",x.height+r+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),Y=y((e,n,g)=>{const s=t().state.padding,r=2*t().state.padding,c=e.node().getBBox(),l=c.width,a=c.x,d=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(n.id),x=d.node().getBBox().width+r;let h=Math.max(x,l);h===l&&(h=h+r);let o;const u=e.node().getBBox();n.doc,o=a-s,x>l&&(o=(l-h)/2+s),Math.abs(a-u.x)<s&&x>l&&(o=a-(x-l)/2);const b=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",b).attr("class",g?"alt-composit":"composit").attr("width",h).attr("height",u.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),d.attr("x",o+s),x<=l&&d.attr("x",a+(h-r)/2-x/2+s),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",h).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",h).attr("height",u.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),j=y(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),X=y((e,n)=>{let g=t().state.forkWidth,s=t().state.forkHeight;if(n.parentId){let r=g;g=s,s=r}return e.append("rect").style("stroke","black").style("fill","black").attr("width",g).attr("height",s).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),K=y((e,n,g,s)=>{let r=0;const c=s.append("text");c.style("text-anchor","start"),c.attr("class","noteText");let l=e.replace(/\r\n/g,"<br/>");l=l.replace(/\n/g,"<br/>");const a=l.split(H.lineBreakRegex);let d=1.25*t().state.noteMargin;for(const x of a){const h=x.trim();if(h.length>0){const o=c.append("tspan");if(o.text(h),d===0){const u=o.node().getBBox();d+=u.height}r+=d,o.attr("x",n+t().state.noteMargin),o.attr("y",g+r+1.25*t().state.noteMargin)}}return{textWidth:c.node().getBBox().width,textHeight:r}},"_drawLongText"),Z=y((e,n)=>{n.attr("class","state-note");const g=n.append("rect").attr("x",0).attr("y",t().state.padding),s=n.append("g"),{textWidth:r,textHeight:c}=K(e,0,0,s);return g.attr("height",c+2*t().state.noteMargin),g.attr("width",r+t().state.noteMargin*2),g},"drawNote"),T=y(function(e,n){const g=n.id,s={id:g,label:n.id,width:0,height:0},r=e.append("g").attr("id",g).attr("class","stateGroup");n.type==="start"&&W(r),n.type==="end"&&j(r),(n.type==="fork"||n.type==="join")&&X(r,n),n.type==="note"&&Z(n.note.text,r),n.type==="divider"&&q(r),n.type==="default"&&n.descriptions.length===0&&F(r,n),n.type==="default"&&n.descriptions.length>0&&J(r,n);const c=r.node().getBBox();return s.width=c.width+2*t().state.padding,s.height=c.height+2*t().state.padding,s},"drawState"),L=0,Q=y(function(e,n,g){const s=y(function(d){switch(d){case M.relationType.AGGREGATION:return"aggregation";case M.relationType.EXTENSION:return"extension";case M.relationType.COMPOSITION:return"composition";case M.relationType.DEPENDENCY:return"dependency"}},"getRelationType");n.points=n.points.filter(d=>!Number.isNaN(d.y));const r=n.points,c=U().x(function(d){return d.x}).y(function(d){return d.y}).curve(R),l=e.append("path").attr("d",c(r)).attr("id","edge"+L).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=P(!0)),l.attr("marker-end","url("+a+"#"+s(M.relationType.DEPENDENCY)+"End)"),g.title!==void 0){const d=e.append("g").attr("class","stateLabel"),{x,y:h}=I.calcLabelPosition(n.points),o=H.getRows(g.title);let u=0;const b=[];let m=0,N=0;for(let f=0;f<=o.length;f++){const p=d.append("text").attr("text-anchor","middle").text(o[f]).attr("x",x).attr("y",h+u),w=p.node().getBBox();m=Math.max(m,w.width),N=Math.min(N,w.x),E.info(w.x,x,h+u),u===0&&(u=p.node().getBBox().height,E.info("Title height",u,h)),b.push(p)}let S=u*o.length;if(o.length>1){const f=(o.length-1)*u*.5;b.forEach((p,w)=>p.attr("y",h+w*u-f)),S=u*o.length}const i=d.node().getBBox();d.insert("rect",":first-child").attr("class","box").attr("x",x-m/2-t().state.padding/2).attr("y",h-S/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",S+t().state.padding),E.info(i)}L++},"drawEdge"),B,z={},V=y(function(){},"setConf"),_=y(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),tt=y(function(e,n,g,s){B=t().state;const r=t().securityLevel;let c;r==="sandbox"&&(c=v("#i"+n));const l=r==="sandbox"?v(c.nodes()[0].contentDocument.body):v("body"),a=r==="sandbox"?c.nodes()[0].contentDocument:document;E.debug("Rendering diagram "+e);const d=l.select(`[id='${n}']`);_(d);const x=s.db.getRootDoc();D(x,d,void 0,!1,l,a,s);const h=B.padding,o=d.node().getBBox(),u=o.width+h*2,b=o.height+h*2,m=u*1.75;O(d,b,m,B.useMaxWidth),d.attr("viewBox",`${o.x-B.padding} ${o.y-B.padding} `+u+" "+b)},"draw"),et=y(e=>e?e.length*B.fontSizeFactor:1,"getLabelWidth"),D=y((e,n,g,s,r,c,l)=>{const a=new C({compound:!0,multigraph:!0});let d,x=!0;for(d=0;d<e.length;d++)if(e[d].stmt==="relation"){x=!1;break}g?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:x?1:B.edgeLengthFactor,nodeSep:x?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:x?1:B.edgeLengthFactor,nodeSep:x?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const h=l.db.getStates(),o=l.db.getRelations(),u=Object.keys(h);for(const i of u){const f=h[i];g&&(f.parentId=g);let p;if(f.doc){let w=n.append("g").attr("id",f.id).attr("class","stateGroup");p=D(f.doc,w,f.id,!s,r,c,l);{w=Y(w,f,s);let k=w.node().getBBox();p.width=k.width,p.height=k.height+B.padding/2,z[f.id]={y:B.compositTitleSize}}}else p=T(n,f,a);if(f.note){const w={descriptions:[],id:f.id+"-note",note:f.note,type:"note"},k=T(n,w,a);f.note.position==="left of"?(a.setNode(p.id+"-note",k),a.setNode(p.id,p)):(a.setNode(p.id,p),a.setNode(p.id+"-note",k)),a.setParent(p.id,p.id+"-group"),a.setParent(p.id+"-note",p.id+"-group")}else a.setNode(p.id,p)}E.debug("Count=",a.nodeCount(),a);let b=0;o.forEach(function(i){b++,E.debug("Setting edge",i),a.setEdge(i.id1,i.id2,{relation:i,width:et(i.title),height:B.labelHeight*H.getRows(i.title).length,labelpos:"c"},"id"+b)}),$(a),E.debug("Graph after layout",a.nodes());const m=n.node();a.nodes().forEach(function(i){i!==void 0&&a.node(i)!==void 0?(E.warn("Node "+i+": "+JSON.stringify(a.node(i))),r.select("#"+m.id+" #"+i).attr("transform","translate("+(a.node(i).x-a.node(i).width/2)+","+(a.node(i).y+(z[i]?z[i].y:0)-a.node(i).height/2)+" )"),r.select("#"+m.id+" #"+i).attr("data-x-shift",a.node(i).x-a.node(i).width/2),c.querySelectorAll("#"+m.id+" #"+i+" .divider").forEach(f=>{const p=f.parentElement;let w=0,k=0;p&&(p.parentElement&&(w=p.parentElement.getBBox().width),k=parseInt(p.getAttribute("data-x-shift"),10),Number.isNaN(k)&&(k=0)),f.setAttribute("x1",0-k+8),f.setAttribute("x2",w-k-8)})):E.debug("No Node "+i+": "+JSON.stringify(a.node(i)))});let N=m.getBBox();a.edges().forEach(function(i){i!==void 0&&a.edge(i)!==void 0&&(E.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(a.edge(i))),Q(n,a.edge(i),a.edge(i).relation))}),N=m.getBBox();const S={id:g||"root",label:g||"root",width:0,height:0};return S.width=N.width+2*B.padding,S.height=N.height+2*B.padding,E.debug("Doc rendered",S,a),S},"renderDoc"),at={setConf:V,draw:tt},ht={parser:G,get db(){return new M(1)},renderer:at,styles:A,init:y(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ht as diagram};
1
+ import{U as A,B as G,M}from"./chunk-DI55MBZ5-DcwSH2gI-uNFBVBGw.js";import{I as y,g as t,t as v,O as E,B as O,k as H,aw as U,aD as I,aA as P,z as R}from"./index-DiPXXjl1.js";import{L as $}from"./graph-C-LzaQKB-Cch5aJ-h.js";import{o as C}from"./layout-Cx9iE-zh-K_S5vGG7.js";import"./chunk-55IACEB6-BFlfi8hV-BGJXNzLC.js";import"./chunk-QN33PNHL-DF3LkPOs-IyOxcAL-.js";import"./_baseUniq-BtBvqxlY-Dv5C3esR.js";import"./_basePickBy-lBvRrdD9-B-9MpFjW.js";var W=y(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),q=y(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),F=y((e,n)=>{const g=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(n.id),s=g.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",s.width+2*t().state.padding).attr("height",s.height+2*t().state.padding).attr("rx",t().state.radius),g},"drawSimpleState"),J=y((e,n)=>{const g=y(function(o,u,b){const m=o.append("tspan").attr("x",2*t().state.padding).text(u);b||m.attr("dy",t().state.textHeight)},"addTspan"),s=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(n.descriptions[0]).node().getBBox(),r=s.height,c=e.append("text").attr("x",t().state.padding).attr("y",r+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let l=!0,a=!0;n.descriptions.forEach(function(o){l||(g(c,o,a),a=!1),l=!1});const d=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+r+t().state.dividerMargin/2).attr("y2",t().state.padding+r+t().state.dividerMargin/2).attr("class","descr-divider"),x=c.node().getBBox(),h=Math.max(x.width,s.width);return d.attr("x2",h+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",h+2*t().state.padding).attr("height",x.height+r+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),Y=y((e,n,g)=>{const s=t().state.padding,r=2*t().state.padding,c=e.node().getBBox(),l=c.width,a=c.x,d=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(n.id),x=d.node().getBBox().width+r;let h=Math.max(x,l);h===l&&(h=h+r);let o;const u=e.node().getBBox();n.doc,o=a-s,x>l&&(o=(l-h)/2+s),Math.abs(a-u.x)<s&&x>l&&(o=a-(x-l)/2);const b=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",b).attr("class",g?"alt-composit":"composit").attr("width",h).attr("height",u.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),d.attr("x",o+s),x<=l&&d.attr("x",a+(h-r)/2-x/2+s),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",h).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",h).attr("height",u.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),j=y(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),X=y((e,n)=>{let g=t().state.forkWidth,s=t().state.forkHeight;if(n.parentId){let r=g;g=s,s=r}return e.append("rect").style("stroke","black").style("fill","black").attr("width",g).attr("height",s).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Z=y((e,n,g,s)=>{let r=0;const c=s.append("text");c.style("text-anchor","start"),c.attr("class","noteText");let l=e.replace(/\r\n/g,"<br/>");l=l.replace(/\n/g,"<br/>");const a=l.split(H.lineBreakRegex);let d=1.25*t().state.noteMargin;for(const x of a){const h=x.trim();if(h.length>0){const o=c.append("tspan");if(o.text(h),d===0){const u=o.node().getBBox();d+=u.height}r+=d,o.attr("x",n+t().state.noteMargin),o.attr("y",g+r+1.25*t().state.noteMargin)}}return{textWidth:c.node().getBBox().width,textHeight:r}},"_drawLongText"),K=y((e,n)=>{n.attr("class","state-note");const g=n.append("rect").attr("x",0).attr("y",t().state.padding),s=n.append("g"),{textWidth:r,textHeight:c}=Z(e,0,0,s);return g.attr("height",c+2*t().state.noteMargin),g.attr("width",r+t().state.noteMargin*2),g},"drawNote"),T=y(function(e,n){const g=n.id,s={id:g,label:n.id,width:0,height:0},r=e.append("g").attr("id",g).attr("class","stateGroup");n.type==="start"&&W(r),n.type==="end"&&j(r),(n.type==="fork"||n.type==="join")&&X(r,n),n.type==="note"&&K(n.note.text,r),n.type==="divider"&&q(r),n.type==="default"&&n.descriptions.length===0&&F(r,n),n.type==="default"&&n.descriptions.length>0&&J(r,n);const c=r.node().getBBox();return s.width=c.width+2*t().state.padding,s.height=c.height+2*t().state.padding,s},"drawState"),L=0,Q=y(function(e,n,g){const s=y(function(d){switch(d){case M.relationType.AGGREGATION:return"aggregation";case M.relationType.EXTENSION:return"extension";case M.relationType.COMPOSITION:return"composition";case M.relationType.DEPENDENCY:return"dependency"}},"getRelationType");n.points=n.points.filter(d=>!Number.isNaN(d.y));const r=n.points,c=U().x(function(d){return d.x}).y(function(d){return d.y}).curve(I),l=e.append("path").attr("d",c(r)).attr("id","edge"+L).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=P(!0)),l.attr("marker-end","url("+a+"#"+s(M.relationType.DEPENDENCY)+"End)"),g.title!==void 0){const d=e.append("g").attr("class","stateLabel"),{x,y:h}=R.calcLabelPosition(n.points),o=H.getRows(g.title);let u=0;const b=[];let m=0,N=0;for(let f=0;f<=o.length;f++){const p=d.append("text").attr("text-anchor","middle").text(o[f]).attr("x",x).attr("y",h+u),w=p.node().getBBox();m=Math.max(m,w.width),N=Math.min(N,w.x),E.info(w.x,x,h+u),u===0&&(u=p.node().getBBox().height,E.info("Title height",u,h)),b.push(p)}let S=u*o.length;if(o.length>1){const f=(o.length-1)*u*.5;b.forEach((p,w)=>p.attr("y",h+w*u-f)),S=u*o.length}const i=d.node().getBBox();d.insert("rect",":first-child").attr("class","box").attr("x",x-m/2-t().state.padding/2).attr("y",h-S/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",S+t().state.padding),E.info(i)}L++},"drawEdge"),B,z={},V=y(function(){},"setConf"),_=y(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),tt=y(function(e,n,g,s){B=t().state;const r=t().securityLevel;let c;r==="sandbox"&&(c=v("#i"+n));const l=r==="sandbox"?v(c.nodes()[0].contentDocument.body):v("body"),a=r==="sandbox"?c.nodes()[0].contentDocument:document;E.debug("Rendering diagram "+e);const d=l.select(`[id='${n}']`);_(d);const x=s.db.getRootDoc();D(x,d,void 0,!1,l,a,s);const h=B.padding,o=d.node().getBBox(),u=o.width+h*2,b=o.height+h*2,m=u*1.75;O(d,b,m,B.useMaxWidth),d.attr("viewBox",`${o.x-B.padding} ${o.y-B.padding} `+u+" "+b)},"draw"),et=y(e=>e?e.length*B.fontSizeFactor:1,"getLabelWidth"),D=y((e,n,g,s,r,c,l)=>{const a=new $({compound:!0,multigraph:!0});let d,x=!0;for(d=0;d<e.length;d++)if(e[d].stmt==="relation"){x=!1;break}g?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:x?1:B.edgeLengthFactor,nodeSep:x?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:x?1:B.edgeLengthFactor,nodeSep:x?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const h=l.db.getStates(),o=l.db.getRelations(),u=Object.keys(h);for(const i of u){const f=h[i];g&&(f.parentId=g);let p;if(f.doc){let w=n.append("g").attr("id",f.id).attr("class","stateGroup");p=D(f.doc,w,f.id,!s,r,c,l);{w=Y(w,f,s);let k=w.node().getBBox();p.width=k.width,p.height=k.height+B.padding/2,z[f.id]={y:B.compositTitleSize}}}else p=T(n,f,a);if(f.note){const w={descriptions:[],id:f.id+"-note",note:f.note,type:"note"},k=T(n,w,a);f.note.position==="left of"?(a.setNode(p.id+"-note",k),a.setNode(p.id,p)):(a.setNode(p.id,p),a.setNode(p.id+"-note",k)),a.setParent(p.id,p.id+"-group"),a.setParent(p.id+"-note",p.id+"-group")}else a.setNode(p.id,p)}E.debug("Count=",a.nodeCount(),a);let b=0;o.forEach(function(i){b++,E.debug("Setting edge",i),a.setEdge(i.id1,i.id2,{relation:i,width:et(i.title),height:B.labelHeight*H.getRows(i.title).length,labelpos:"c"},"id"+b)}),C(a),E.debug("Graph after layout",a.nodes());const m=n.node();a.nodes().forEach(function(i){i!==void 0&&a.node(i)!==void 0?(E.warn("Node "+i+": "+JSON.stringify(a.node(i))),r.select("#"+m.id+" #"+i).attr("transform","translate("+(a.node(i).x-a.node(i).width/2)+","+(a.node(i).y+(z[i]?z[i].y:0)-a.node(i).height/2)+" )"),r.select("#"+m.id+" #"+i).attr("data-x-shift",a.node(i).x-a.node(i).width/2),c.querySelectorAll("#"+m.id+" #"+i+" .divider").forEach(f=>{const p=f.parentElement;let w=0,k=0;p&&(p.parentElement&&(w=p.parentElement.getBBox().width),k=parseInt(p.getAttribute("data-x-shift"),10),Number.isNaN(k)&&(k=0)),f.setAttribute("x1",0-k+8),f.setAttribute("x2",w-k-8)})):E.debug("No Node "+i+": "+JSON.stringify(a.node(i)))});let N=m.getBBox();a.edges().forEach(function(i){i!==void 0&&a.edge(i)!==void 0&&(E.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(a.edge(i))),Q(n,a.edge(i),a.edge(i).relation))}),N=m.getBBox();const S={id:g||"root",label:g||"root",width:0,height:0};return S.width=N.width+2*B.padding,S.height=N.height+2*B.padding,E.debug("Doc rendered",S,a),S},"renderDoc"),at={setConf:V,draw:tt},ht={parser:G,get db(){return new M(1)},renderer:at,styles:A,init:y(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ht as diagram};
@@ -0,0 +1 @@
1
+ import{U as t,V as e,B as a,M as s}from"./chunk-DI55MBZ5-DcwSH2gI-uNFBVBGw.js";import{I as o}from"./index-DiPXXjl1.js";import"./chunk-55IACEB6-BFlfi8hV-BGJXNzLC.js";import"./chunk-QN33PNHL-DF3LkPOs-IyOxcAL-.js";var M={parser:a,get db(){return new s(2)},renderer:e,styles:t,init:o(r=>{r.state||(r.state={}),r.state.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{M as diagram};
@@ -1,9 +1,9 @@
1
- import{R as r,g as mt,O as $,d as Y,aT as xt,aU as bt,aV as kt,aW as _t,Y as vt,aX as wt,F as St}from"./index-DodYl3VC.js";import{h as et}from"./arc-CsV8WDj2-C9VadXC6.js";var J=function(){var n=r(function(f,s,l,h){for(l=l||{},h=f.length;h--;l[f[h]]=s);return l},"o"),t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],a=[1,10],i=[1,11],o=[1,12],u=[1,13],p=[1,16],y=[1,17],m={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline: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,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",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",20:"period",21:"event"},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,1],[9,1],[18,1],[19,1]],performAction:r(function(f,s,l,h,d,c,k){var x=c.length-1;switch(d){case 1:return c[x-1];case 2:this.$=[];break;case 3:c[x-1].push(c[x]),this.$=c[x-1];break;case 4:case 5:this.$=c[x];break;case 6:case 7:this.$=[];break;case 8:h.getCommonDb().setDiagramTitle(c[x].substr(6)),this.$=c[x].substr(6);break;case 9:this.$=c[x].trim(),h.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=c[x].trim(),h.getCommonDb().setAccDescription(this.$);break;case 12:h.addSection(c[x].substr(8)),this.$=c[x].substr(8);break;case 15:h.addTask(c[x],0,""),this.$=c[x];break;case 16:h.addEvent(c[x].substr(2)),this.$=c[x];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:a,14:i,16:o,17:u,18:14,19:15,20:p,21:y},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:a,14:i,16:o,17:u,18:14,19:15,20:p,21:y},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:r(function(f,s){if(s.recoverable)this.trace(f);else{var l=new Error(f);throw l.hash=s,l}},"parseError"),parse:r(function(f){var s=this,l=[0],h=[],d=[null],c=[],k=this.table,x="",N=0,M=0,W=2,I=1,D=c.slice.call(arguments,1),_=Object.create(this.lexer),S={yy:{}};for(var v in this.yy)Object.prototype.hasOwnProperty.call(this.yy,v)&&(S.yy[v]=this.yy[v]);_.setInput(f,S.yy),S.yy.lexer=_,S.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var A=_.yylloc;c.push(A);var O=_.options&&_.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function L(E){l.length=l.length-2*E,d.length=d.length-E,c.length=c.length-E}r(L,"popStack");function F(){var E;return E=h.pop()||_.lex()||I,typeof E!="number"&&(E instanceof Array&&(h=E,E=h.pop()),E=s.symbols_[E]||E),E}r(F,"lex");for(var w,R,T,X,P={},V,C,tt,z;;){if(R=l[l.length-1],this.defaultActions[R]?T=this.defaultActions[R]:((w===null||typeof w>"u")&&(w=F()),T=k[R]&&k[R][w]),typeof T>"u"||!T.length||!T[0]){var Z="";z=[];for(V in k[R])this.terminals_[V]&&V>W&&z.push("'"+this.terminals_[V]+"'");_.showPosition?Z="Parse error on line "+(N+1)+`:
1
+ import{I as r,g as mt,O as $,t as q,aT as xt,aU as bt,aV as kt,aW as _t,J as vt,aX as wt,G as St}from"./index-DiPXXjl1.js";import{h as et}from"./arc-CCBnZEkJ-DybyxfWt.js";var Z=function(){var n=r(function(f,s,l,h){for(l=l||{},h=f.length;h--;l[f[h]]=s);return l},"o"),t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],a=[1,10],i=[1,11],o=[1,12],u=[1,13],p=[1,16],y=[1,17],m={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline: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,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",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",20:"period",21:"event"},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,1],[9,1],[18,1],[19,1]],performAction:r(function(f,s,l,h,d,c,k){var x=c.length-1;switch(d){case 1:return c[x-1];case 2:this.$=[];break;case 3:c[x-1].push(c[x]),this.$=c[x-1];break;case 4:case 5:this.$=c[x];break;case 6:case 7:this.$=[];break;case 8:h.getCommonDb().setDiagramTitle(c[x].substr(6)),this.$=c[x].substr(6);break;case 9:this.$=c[x].trim(),h.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=c[x].trim(),h.getCommonDb().setAccDescription(this.$);break;case 12:h.addSection(c[x].substr(8)),this.$=c[x].substr(8);break;case 15:h.addTask(c[x],0,""),this.$=c[x];break;case 16:h.addEvent(c[x].substr(2)),this.$=c[x];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:a,14:i,16:o,17:u,18:14,19:15,20:p,21:y},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:a,14:i,16:o,17:u,18:14,19:15,20:p,21:y},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:r(function(f,s){if(s.recoverable)this.trace(f);else{var l=new Error(f);throw l.hash=s,l}},"parseError"),parse:r(function(f){var s=this,l=[0],h=[],d=[null],c=[],k=this.table,x="",N=0,M=0,W=2,I=1,D=c.slice.call(arguments,1),_=Object.create(this.lexer),S={yy:{}};for(var v in this.yy)Object.prototype.hasOwnProperty.call(this.yy,v)&&(S.yy[v]=this.yy[v]);_.setInput(f,S.yy),S.yy.lexer=_,S.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var A=_.yylloc;c.push(A);var O=_.options&&_.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function L(E){l.length=l.length-2*E,d.length=d.length-E,c.length=c.length-E}r(L,"popStack");function P(){var E;return E=h.pop()||_.lex()||I,typeof E!="number"&&(E instanceof Array&&(h=E,E=h.pop()),E=s.symbols_[E]||E),E}r(P,"lex");for(var w,R,T,J,j={},V,C,tt,z;;){if(R=l[l.length-1],this.defaultActions[R]?T=this.defaultActions[R]:((w===null||typeof w>"u")&&(w=P()),T=k[R]&&k[R][w]),typeof T>"u"||!T.length||!T[0]){var Y="";z=[];for(V in k[R])this.terminals_[V]&&V>W&&z.push("'"+this.terminals_[V]+"'");_.showPosition?Y="Parse error on line "+(N+1)+`:
2
2
  `+_.showPosition()+`
3
- Expecting `+z.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Z="Parse error on line "+(N+1)+": Unexpected "+(w==I?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(Z,{text:_.match,token:this.terminals_[w]||w,line:_.yylineno,loc:A,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+w);switch(T[0]){case 1:l.push(w),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),w=null,M=_.yyleng,x=_.yytext,N=_.yylineno,A=_.yylloc;break;case 2:if(C=this.productions_[T[1]][1],P.$=d[d.length-C],P._$={first_line:c[c.length-(C||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(C||1)].first_column,last_column:c[c.length-1].last_column},O&&(P._$.range=[c[c.length-(C||1)].range[0],c[c.length-1].range[1]]),X=this.performAction.apply(P,[x,M,N,S.yy,T[1],d,c].concat(D)),typeof X<"u")return X;C&&(l=l.slice(0,-1*C*2),d=d.slice(0,-1*C),c=c.slice(0,-1*C)),l.push(this.productions_[T[1]][0]),d.push(P.$),c.push(P._$),tt=k[l[l.length-2]][l[l.length-1]],l.push(tt);break;case 3:return!0}}return!0},"parse")},b=function(){var f={EOF:1,parseError:r(function(s,l){if(this.yy.parser)this.yy.parser.parseError(s,l);else throw new Error(s)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,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:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+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),h.length-1&&(this.yylineno-=h.length-1);var c=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===d.length?this.yylloc.first_column:0)+d[d.length-h.length].length-h[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[c[0],c[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(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).
3
+ Expecting `+z.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Y="Parse error on line "+(N+1)+": Unexpected "+(w==I?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(Y,{text:_.match,token:this.terminals_[w]||w,line:_.yylineno,loc:A,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+w);switch(T[0]){case 1:l.push(w),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),w=null,M=_.yyleng,x=_.yytext,N=_.yylineno,A=_.yylloc;break;case 2:if(C=this.productions_[T[1]][1],j.$=d[d.length-C],j._$={first_line:c[c.length-(C||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(C||1)].first_column,last_column:c[c.length-1].last_column},O&&(j._$.range=[c[c.length-(C||1)].range[0],c[c.length-1].range[1]]),J=this.performAction.apply(j,[x,M,N,S.yy,T[1],d,c].concat(D)),typeof J<"u")return J;C&&(l=l.slice(0,-1*C*2),d=d.slice(0,-1*C),c=c.slice(0,-1*C)),l.push(this.productions_[T[1]][0]),d.push(j.$),c.push(j._$),tt=k[l[l.length-2]][l[l.length-1]],l.push(tt);break;case 3:return!0}}return!0},"parse")},b=function(){var f={EOF:1,parseError:r(function(s,l){if(this.yy.parser)this.yy.parser.parseError(s,l);else throw new Error(s)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,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:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+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),h.length-1&&(this.yylineno-=h.length-1);var c=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===d.length?this.yylloc.first_column:0)+d[d.length-h.length].length-h[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[c[0],c[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(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).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
5
5
  `+l+"^"},"showPosition"),test_match:r(function(s,l){var h,d,c;if(this.options.backtrack_lexer&&(c={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(c.yylloc.range=this.yylloc.range.slice(0))),d=s[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+s[0].length},this.yytext+=s[0],this.match+=s[0],this.matches=s,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(s[0].length),this.matched+=s[0],h=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),h)return h;if(this._backtrack){for(var k in c)this[k]=c[k];return!1}return!1},"test_match"),next:r(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,l,h,d;this._more||(this.yytext="",this.match="");for(var c=this._currentRules(),k=0;k<c.length;k++)if(h=this._input.match(this.rules[c[k]]),h&&(!l||h[0].length>l[0].length)){if(l=h,d=k,this.options.backtrack_lexer){if(s=this.test_match(h,c[k]),s!==!1)return s;if(this._backtrack){l=!1;continue}else return!1}else if(!this.options.flex)break}return l?(s=this.test_match(l,c[d]),s!==!1?s:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:r(function(){var s=this.next();return s||this.lex()},"lex"),begin:r(function(s){this.conditionStack.push(s)},"begin"),popState:r(function(){var s=this.conditionStack.length-1;return s>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:r(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:r(function(s){return s=this.conditionStack.length-1-Math.abs(s||0),s>=0?this.conditionStack[s]:"INITIAL"},"topState"),pushState:r(function(s){this.begin(s)},"pushState"),stateStackSize:r(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:r(function(s,l,h,d){switch(h){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 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/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:[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],inclusive:!0}}};return f}();m.lexer=b;function g(){this.yy={}}return r(g,"Parser"),g.prototype=m,m.Parser=g,new g}();J.parser=J;var $t=J,rt={};vt(rt,{addEvent:()=>pt,addSection:()=>lt,addTask:()=>ut,addTaskOrg:()=>yt,clear:()=>ct,default:()=>Et,getCommonDb:()=>ot,getSections:()=>ht,getTasks:()=>dt});var j="",at=0,G=[],q=[],B=[],ot=r(()=>wt,"getCommonDb"),ct=r(function(){G.length=0,q.length=0,j="",B.length=0,St()},"clear"),lt=r(function(n){j=n,G.push(n)},"addSection"),ht=r(function(){return G},"getSections"),dt=r(function(){let n=nt();const t=100;let e=0;for(;!n&&e<t;)n=nt(),e++;return q.push(...B),q},"getTasks"),ut=r(function(n,t,e){const a={id:at++,section:j,type:j,task:n,score:t||0,events:e?[e]:[]};B.push(a)},"addTask"),pt=r(function(n){B.find(t=>t.id===at-1).events.push(n)},"addEvent"),yt=r(function(n){const t={section:j,type:j,description:n,task:n,classes:[]};q.push(t)},"addTaskOrg"),nt=r(function(){const n=r(function(e){return B[e].processed},"compileTask");let t=!0;for(const[e,a]of B.entries())n(e),t=t&&a.processed;return t},"compileTasks"),Et={clear:ct,getCommonDb:ot,addSection:lt,getSections:ht,getTasks:dt,addTask:ut,addTaskOrg:yt,addEvent:pt},Tt=12,U=r(function(n,t){const e=n.append("rect");return e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),e.attr("rx",t.rx),e.attr("ry",t.ry),t.class!==void 0&&e.attr("class",t.class),e},"drawRect"),Mt=r(function(n,t){const e=n.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),a=n.append("g");a.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"),a.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 i(p){const y=et().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}r(i,"smile");function o(p){const y=et().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}r(o,"sad");function u(p){p.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 r(u,"ambivalent"),t.score>3?i(a):t.score<3?o(a):u(a),e},"drawFace"),At=r(function(n,t){const e=n.append("circle");return e.attr("cx",t.cx),e.attr("cy",t.cy),e.attr("class","actor-"+t.pos),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("r",t.r),e.class!==void 0&&e.attr("class",e.class),t.title!==void 0&&e.append("title").text(t.title),e},"drawCircle"),gt=r(function(n,t){const e=t.text.replace(/<br\s*\/?>/gi," "),a=n.append("text");a.attr("x",t.x),a.attr("y",t.y),a.attr("class","legend"),a.style("text-anchor",t.anchor),t.class!==void 0&&a.attr("class",t.class);const i=a.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(e),a},"drawText"),Nt=r(function(n,t){function e(i,o,u,p,y){return i+","+o+" "+(i+u)+","+o+" "+(i+u)+","+(o+p-y)+" "+(i+u-y*1.2)+","+(o+p)+" "+i+","+(o+p)}r(e,"genPoints");const a=n.append("polygon");a.attr("points",e(t.x,t.y,50,20,7)),a.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,gt(n,t)},"drawLabel"),Ct=r(function(n,t,e){const a=n.append("g"),i=K();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=e.width,i.height=e.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,U(a,i),ft(e)(t.text,a,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},e,t.colour)},"drawSection"),it=-1,It=r(function(n,t,e){const a=t.x+e.width/2,i=n.append("g");it++,i.append("line").attr("id","task"+it).attr("x1",a).attr("y1",t.y).attr("x2",a).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Mt(i,{cx:a,cy:300+(5-t.score)*30,score:t.score});const o=K();o.x=t.x,o.y=t.y,o.fill=t.fill,o.width=e.width,o.height=e.height,o.class="task task-type-"+t.num,o.rx=3,o.ry=3,U(i,o),ft(e)(t.task,i,o.x,o.y,o.width,o.height,{class:"task"},e,t.colour)},"drawTask"),Ot=r(function(n,t){U(n,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),Lt=r(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),K=r(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),ft=function(){function n(i,o,u,p,y,m,b,g){const f=o.append("text").attr("x",u+y/2).attr("y",p+m/2+5).style("font-color",g).style("text-anchor","middle").text(i);a(f,b)}r(n,"byText");function t(i,o,u,p,y,m,b,g,f){const{taskFontSize:s,taskFontFamily:l}=g,h=i.split(/<br\s*\/?>/gi);for(let d=0;d<h.length;d++){const c=d*s-s*(h.length-1)/2,k=o.append("text").attr("x",u+y/2).attr("y",p).attr("fill",f).style("text-anchor","middle").style("font-size",s).style("font-family",l);k.append("tspan").attr("x",u+y/2).attr("dy",c).text(h[d]),k.attr("y",p+m/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),a(k,b)}}r(t,"byTspan");function e(i,o,u,p,y,m,b,g){const f=o.append("switch"),s=f.append("foreignObject").attr("x",u).attr("y",p).attr("width",y).attr("height",m).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");s.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),t(i,f,u,p,y,m,b,g),a(s,b)}r(e,"byFo");function a(i,o){for(const u in o)u in o&&i.attr(u,o[u])}return r(a,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?e:i.textPlacement==="old"?n:t}}(),Rt=r(function(n){n.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")},"initGraphics");function Q(n,t){n.each(function(){var e=Y(this),a=e.text().split(/(\s+|<br>)/).reverse(),i,o=[],u=1.1,p=e.attr("y"),y=parseFloat(e.attr("dy")),m=e.text(null).append("tspan").attr("x",0).attr("y",p).attr("dy",y+"em");for(let b=0;b<a.length;b++)i=a[a.length-1-b],o.push(i),m.text(o.join(" ").trim()),(m.node().getComputedTextLength()>t||i==="<br>")&&(o.pop(),m.text(o.join(" ").trim()),i==="<br>"?o=[""]:o=[i],m=e.append("tspan").attr("x",0).attr("y",p).attr("dy",u+"em").text(i))})}r(Q,"wrap");var Ht=r(function(n,t,e,a){var i;const o=e%Tt-1,u=n.append("g");t.section=o,u.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+o));const p=u.append("g"),y=u.append("g"),m=y.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(Q,t.width).node().getBBox(),b=(i=a.fontSize)!=null&&i.replace?a.fontSize.replace("px",""):a.fontSize;return t.height=m.height+b*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,y.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),Ft(p,t,o,a),t},"drawNode"),Dt=r(function(n,t,e){var a;const i=n.append("g"),o=i.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(Q,t.width).node().getBBox(),u=(a=e.fontSize)!=null&&a.replace?e.fontSize.replace("px",""):e.fontSize;return i.remove(),o.height+u*1.1*.5+t.padding},"getVirtualNodeHeight"),Ft=r(function(n,t,e){n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("d",`M0 ${t.height-5} v${-t.height+10} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),n.append("line").attr("class","node-line-"+e).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),H={drawRect:U,drawCircle:At,drawSection:Ct,drawText:gt,drawLabel:Nt,drawTask:It,drawBackgroundRect:Ot,getTextObj:Lt,getNoteRect:K,initGraphics:Rt,drawNode:Ht,getVirtualNodeHeight:Dt},Pt=r(function(n,t,e,a){var i,o,u;const p=mt(),y=((i=p.timeline)==null?void 0:i.leftMargin)??50;$.debug("timeline",a.db);const m=p.securityLevel;let b;m==="sandbox"&&(b=Y("#i"+t));const g=(m==="sandbox"?Y(b.nodes()[0].contentDocument.body):Y("body")).select("#"+t);g.append("g");const f=a.db.getTasks(),s=a.db.getCommonDb().getDiagramTitle();$.debug("task",f),H.initGraphics(g);const l=a.db.getSections();$.debug("sections",l);let h=0,d=0,c=0,k=0,x=50+y,N=50;k=50;let M=0,W=!0;l.forEach(function(S){const v={number:M,descr:S,section:M,width:150,padding:20,maxHeight:h},A=H.getVirtualNodeHeight(g,v,p);$.debug("sectionHeight before draw",A),h=Math.max(h,A+20)});let I=0,D=0;$.debug("tasks.length",f.length);for(const[S,v]of f.entries()){const A={number:S,descr:v,section:v.section,width:150,padding:20,maxHeight:d},O=H.getVirtualNodeHeight(g,A,p);$.debug("taskHeight before draw",O),d=Math.max(d,O+20),I=Math.max(I,v.events.length);let L=0;for(const F of v.events){const w={descr:F,section:v.section,number:v.section,width:150,padding:20,maxHeight:50};L+=H.getVirtualNodeHeight(g,w,p)}v.events.length>0&&(L+=(v.events.length-1)*10),D=Math.max(D,L)}$.debug("maxSectionHeight before draw",h),$.debug("maxTaskHeight before draw",d),l&&l.length>0?l.forEach(S=>{const v=f.filter(F=>F.section===S),A={number:M,descr:S,section:M,width:200*Math.max(v.length,1)-50,padding:20,maxHeight:h};$.debug("sectionNode",A);const O=g.append("g"),L=H.drawNode(O,A,M,p);$.debug("sectionNode output",L),O.attr("transform",`translate(${x}, ${k})`),N+=h+50,v.length>0&&st(g,v,M,x,N,d,p,I,D,h,!1),x+=200*Math.max(v.length,1),N=k,M++}):(W=!1,st(g,f,M,x,N,d,p,I,D,h,!0));const _=g.node().getBBox();$.debug("bounds",_),s&&g.append("text").text(s).attr("x",_.width/2-y).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),c=W?h+d+150:d+100,g.append("g").attr("class","lineWrapper").append("line").attr("x1",y).attr("y1",c).attr("x2",_.width+3*y).attr("y2",c).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),xt(void 0,g,((o=p.timeline)==null?void 0:o.padding)??50,((u=p.timeline)==null?void 0:u.useMaxWidth)??!1)},"draw"),st=r(function(n,t,e,a,i,o,u,p,y,m,b){var g;for(const f of t){const s={descr:f.task,section:e,number:e,width:150,padding:20,maxHeight:o};$.debug("taskNode",s);const l=n.append("g").attr("class","taskWrapper"),h=H.drawNode(l,s,e,u).height;if($.debug("taskHeight after draw",h),l.attr("transform",`translate(${a}, ${i})`),o=Math.max(o,h),f.events){const d=n.append("g").attr("class","lineWrapper");let c=o;i+=100,c=c+jt(n,f.events,e,a,i,u),i-=100,d.append("line").attr("x1",a+190/2).attr("y1",i+o).attr("x2",a+190/2).attr("y2",i+o+100+y+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}a=a+200,b&&!((g=u.timeline)!=null&&g.disableMulticolor)&&e++}i=i-10},"drawTasks"),jt=r(function(n,t,e,a,i,o){let u=0;const p=i;i=i+100;for(const y of t){const m={descr:y,section:e,number:e,width:150,padding:20,maxHeight:50};$.debug("eventNode",m);const b=n.append("g").attr("class","eventWrapper"),g=H.drawNode(b,m,e,o).height;u=u+g,b.attr("transform",`translate(${a}, ${i})`),i=i+10+g}return i=p,u},"drawEvents"),Bt={setConf:r(()=>{},"setConf"),draw:Pt},Wt=r(n=>{let t="";for(let e=0;e<n.THEME_COLOR_LIMIT;e++)n["lineColor"+e]=n["lineColor"+e]||n["cScaleInv"+e],bt(n["lineColor"+e])?n["lineColor"+e]=kt(n["lineColor"+e],20):n["lineColor"+e]=_t(n["lineColor"+e],20);for(let e=0;e<n.THEME_COLOR_LIMIT;e++){const a=""+(17-3*e);t+=`
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:r(function(){var s=this.next();return s||this.lex()},"lex"),begin:r(function(s){this.conditionStack.push(s)},"begin"),popState:r(function(){var s=this.conditionStack.length-1;return s>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:r(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:r(function(s){return s=this.conditionStack.length-1-Math.abs(s||0),s>=0?this.conditionStack[s]:"INITIAL"},"topState"),pushState:r(function(s){this.begin(s)},"pushState"),stateStackSize:r(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:r(function(s,l,h,d){switch(h){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 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/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:[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],inclusive:!0}}};return f}();m.lexer=b;function g(){this.yy={}}return r(g,"Parser"),g.prototype=m,m.Parser=g,new g}();Z.parser=Z;var $t=Z,rt={};vt(rt,{addEvent:()=>pt,addSection:()=>lt,addTask:()=>ut,addTaskOrg:()=>yt,clear:()=>ct,default:()=>Et,getCommonDb:()=>ot,getSections:()=>ht,getTasks:()=>dt});var B="",at=0,G=[],U=[],F=[],ot=r(()=>wt,"getCommonDb"),ct=r(function(){G.length=0,U.length=0,B="",F.length=0,St()},"clear"),lt=r(function(n){B=n,G.push(n)},"addSection"),ht=r(function(){return G},"getSections"),dt=r(function(){let n=nt();const t=100;let e=0;for(;!n&&e<t;)n=nt(),e++;return U.push(...F),U},"getTasks"),ut=r(function(n,t,e){const a={id:at++,section:B,type:B,task:n,score:t||0,events:e?[e]:[]};F.push(a)},"addTask"),pt=r(function(n){F.find(t=>t.id===at-1).events.push(n)},"addEvent"),yt=r(function(n){const t={section:B,type:B,description:n,task:n,classes:[]};U.push(t)},"addTaskOrg"),nt=r(function(){const n=r(function(e){return F[e].processed},"compileTask");let t=!0;for(const[e,a]of F.entries())n(e),t=t&&a.processed;return t},"compileTasks"),Et={clear:ct,getCommonDb:ot,addSection:lt,getSections:ht,getTasks:dt,addTask:ut,addTaskOrg:yt,addEvent:pt},Tt=12,X=r(function(n,t){const e=n.append("rect");return e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),e.attr("rx",t.rx),e.attr("ry",t.ry),t.class!==void 0&&e.attr("class",t.class),e},"drawRect"),Mt=r(function(n,t){const e=n.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),a=n.append("g");a.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"),a.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 i(p){const y=et().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}r(i,"smile");function o(p){const y=et().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}r(o,"sad");function u(p){p.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 r(u,"ambivalent"),t.score>3?i(a):t.score<3?o(a):u(a),e},"drawFace"),At=r(function(n,t){const e=n.append("circle");return e.attr("cx",t.cx),e.attr("cy",t.cy),e.attr("class","actor-"+t.pos),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("r",t.r),e.class!==void 0&&e.attr("class",e.class),t.title!==void 0&&e.append("title").text(t.title),e},"drawCircle"),gt=r(function(n,t){const e=t.text.replace(/<br\s*\/?>/gi," "),a=n.append("text");a.attr("x",t.x),a.attr("y",t.y),a.attr("class","legend"),a.style("text-anchor",t.anchor),t.class!==void 0&&a.attr("class",t.class);const i=a.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(e),a},"drawText"),Nt=r(function(n,t){function e(i,o,u,p,y){return i+","+o+" "+(i+u)+","+o+" "+(i+u)+","+(o+p-y)+" "+(i+u-y*1.2)+","+(o+p)+" "+i+","+(o+p)}r(e,"genPoints");const a=n.append("polygon");a.attr("points",e(t.x,t.y,50,20,7)),a.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,gt(n,t)},"drawLabel"),Ct=r(function(n,t,e){const a=n.append("g"),i=K();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=e.width,i.height=e.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,X(a,i),ft(e)(t.text,a,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},e,t.colour)},"drawSection"),it=-1,It=r(function(n,t,e){const a=t.x+e.width/2,i=n.append("g");it++,i.append("line").attr("id","task"+it).attr("x1",a).attr("y1",t.y).attr("x2",a).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Mt(i,{cx:a,cy:300+(5-t.score)*30,score:t.score});const o=K();o.x=t.x,o.y=t.y,o.fill=t.fill,o.width=e.width,o.height=e.height,o.class="task task-type-"+t.num,o.rx=3,o.ry=3,X(i,o),ft(e)(t.task,i,o.x,o.y,o.width,o.height,{class:"task"},e,t.colour)},"drawTask"),Ot=r(function(n,t){X(n,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),Lt=r(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),K=r(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),ft=function(){function n(i,o,u,p,y,m,b,g){const f=o.append("text").attr("x",u+y/2).attr("y",p+m/2+5).style("font-color",g).style("text-anchor","middle").text(i);a(f,b)}r(n,"byText");function t(i,o,u,p,y,m,b,g,f){const{taskFontSize:s,taskFontFamily:l}=g,h=i.split(/<br\s*\/?>/gi);for(let d=0;d<h.length;d++){const c=d*s-s*(h.length-1)/2,k=o.append("text").attr("x",u+y/2).attr("y",p).attr("fill",f).style("text-anchor","middle").style("font-size",s).style("font-family",l);k.append("tspan").attr("x",u+y/2).attr("dy",c).text(h[d]),k.attr("y",p+m/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),a(k,b)}}r(t,"byTspan");function e(i,o,u,p,y,m,b,g){const f=o.append("switch"),s=f.append("foreignObject").attr("x",u).attr("y",p).attr("width",y).attr("height",m).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");s.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),t(i,f,u,p,y,m,b,g),a(s,b)}r(e,"byFo");function a(i,o){for(const u in o)u in o&&i.attr(u,o[u])}return r(a,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?e:i.textPlacement==="old"?n:t}}(),Rt=r(function(n){n.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")},"initGraphics");function Q(n,t){n.each(function(){var e=q(this),a=e.text().split(/(\s+|<br>)/).reverse(),i,o=[],u=1.1,p=e.attr("y"),y=parseFloat(e.attr("dy")),m=e.text(null).append("tspan").attr("x",0).attr("y",p).attr("dy",y+"em");for(let b=0;b<a.length;b++)i=a[a.length-1-b],o.push(i),m.text(o.join(" ").trim()),(m.node().getComputedTextLength()>t||i==="<br>")&&(o.pop(),m.text(o.join(" ").trim()),i==="<br>"?o=[""]:o=[i],m=e.append("tspan").attr("x",0).attr("y",p).attr("dy",u+"em").text(i))})}r(Q,"wrap");var Ht=r(function(n,t,e,a){var i;const o=e%Tt-1,u=n.append("g");t.section=o,u.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+o));const p=u.append("g"),y=u.append("g"),m=y.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(Q,t.width).node().getBBox(),b=(i=a.fontSize)!=null&&i.replace?a.fontSize.replace("px",""):a.fontSize;return t.height=m.height+b*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,y.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),Pt(p,t,o,a),t},"drawNode"),Dt=r(function(n,t,e){var a;const i=n.append("g"),o=i.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(Q,t.width).node().getBBox(),u=(a=e.fontSize)!=null&&a.replace?e.fontSize.replace("px",""):e.fontSize;return i.remove(),o.height+u*1.1*.5+t.padding},"getVirtualNodeHeight"),Pt=r(function(n,t,e){n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("d",`M0 ${t.height-5} v${-t.height+10} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),n.append("line").attr("class","node-line-"+e).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),H={drawRect:X,drawCircle:At,drawSection:Ct,drawText:gt,drawLabel:Nt,drawTask:It,drawBackgroundRect:Ot,getTextObj:Lt,getNoteRect:K,initGraphics:Rt,drawNode:Ht,getVirtualNodeHeight:Dt},jt=r(function(n,t,e,a){var i,o,u;const p=mt(),y=((i=p.timeline)==null?void 0:i.leftMargin)??50;$.debug("timeline",a.db);const m=p.securityLevel;let b;m==="sandbox"&&(b=q("#i"+t));const g=(m==="sandbox"?q(b.nodes()[0].contentDocument.body):q("body")).select("#"+t);g.append("g");const f=a.db.getTasks(),s=a.db.getCommonDb().getDiagramTitle();$.debug("task",f),H.initGraphics(g);const l=a.db.getSections();$.debug("sections",l);let h=0,d=0,c=0,k=0,x=50+y,N=50;k=50;let M=0,W=!0;l.forEach(function(S){const v={number:M,descr:S,section:M,width:150,padding:20,maxHeight:h},A=H.getVirtualNodeHeight(g,v,p);$.debug("sectionHeight before draw",A),h=Math.max(h,A+20)});let I=0,D=0;$.debug("tasks.length",f.length);for(const[S,v]of f.entries()){const A={number:S,descr:v,section:v.section,width:150,padding:20,maxHeight:d},O=H.getVirtualNodeHeight(g,A,p);$.debug("taskHeight before draw",O),d=Math.max(d,O+20),I=Math.max(I,v.events.length);let L=0;for(const P of v.events){const w={descr:P,section:v.section,number:v.section,width:150,padding:20,maxHeight:50};L+=H.getVirtualNodeHeight(g,w,p)}v.events.length>0&&(L+=(v.events.length-1)*10),D=Math.max(D,L)}$.debug("maxSectionHeight before draw",h),$.debug("maxTaskHeight before draw",d),l&&l.length>0?l.forEach(S=>{const v=f.filter(P=>P.section===S),A={number:M,descr:S,section:M,width:200*Math.max(v.length,1)-50,padding:20,maxHeight:h};$.debug("sectionNode",A);const O=g.append("g"),L=H.drawNode(O,A,M,p);$.debug("sectionNode output",L),O.attr("transform",`translate(${x}, ${k})`),N+=h+50,v.length>0&&st(g,v,M,x,N,d,p,I,D,h,!1),x+=200*Math.max(v.length,1),N=k,M++}):(W=!1,st(g,f,M,x,N,d,p,I,D,h,!0));const _=g.node().getBBox();$.debug("bounds",_),s&&g.append("text").text(s).attr("x",_.width/2-y).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),c=W?h+d+150:d+100,g.append("g").attr("class","lineWrapper").append("line").attr("x1",y).attr("y1",c).attr("x2",_.width+3*y).attr("y2",c).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),xt(void 0,g,((o=p.timeline)==null?void 0:o.padding)??50,((u=p.timeline)==null?void 0:u.useMaxWidth)??!1)},"draw"),st=r(function(n,t,e,a,i,o,u,p,y,m,b){var g;for(const f of t){const s={descr:f.task,section:e,number:e,width:150,padding:20,maxHeight:o};$.debug("taskNode",s);const l=n.append("g").attr("class","taskWrapper"),h=H.drawNode(l,s,e,u).height;if($.debug("taskHeight after draw",h),l.attr("transform",`translate(${a}, ${i})`),o=Math.max(o,h),f.events){const d=n.append("g").attr("class","lineWrapper");let c=o;i+=100,c=c+Bt(n,f.events,e,a,i,u),i-=100,d.append("line").attr("x1",a+190/2).attr("y1",i+o).attr("x2",a+190/2).attr("y2",i+o+100+y+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}a=a+200,b&&!((g=u.timeline)!=null&&g.disableMulticolor)&&e++}i=i-10},"drawTasks"),Bt=r(function(n,t,e,a,i,o){let u=0;const p=i;i=i+100;for(const y of t){const m={descr:y,section:e,number:e,width:150,padding:20,maxHeight:50};$.debug("eventNode",m);const b=n.append("g").attr("class","eventWrapper"),g=H.drawNode(b,m,e,o).height;u=u+g,b.attr("transform",`translate(${a}, ${i})`),i=i+10+g}return i=p,u},"drawEvents"),Ft={setConf:r(()=>{},"setConf"),draw:jt},Wt=r(n=>{let t="";for(let e=0;e<n.THEME_COLOR_LIMIT;e++)n["lineColor"+e]=n["lineColor"+e]||n["cScaleInv"+e],bt(n["lineColor"+e])?n["lineColor"+e]=kt(n["lineColor"+e],20):n["lineColor"+e]=_t(n["lineColor"+e],20);for(let e=0;e<n.THEME_COLOR_LIMIT;e++){const a=""+(17-3*e);t+=`
7
7
  .section-${e-1} rect, .section-${e-1} path, .section-${e-1} circle, .section-${e-1} path {
8
8
  fill: ${n["cScale"+e]};
9
9
  }
@@ -58,4 +58,4 @@ Expecting `+z.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Z="Parse error on
58
58
  .eventWrapper {
59
59
  filter: brightness(120%);
60
60
  }
61
- `,"getStyles"),zt=Vt,Ut={db:rt,renderer:Bt,parser:$t,styles:zt};export{Ut as diagram};
61
+ `,"getStyles"),zt=Vt,Xt={db:rt,renderer:Ft,parser:$t,styles:zt};export{Xt as diagram};