cc-viewer 1.6.255 → 1.6.256

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 (65) hide show
  1. package/dist/assets/App-BxUDsD3t.js +1 -0
  2. package/dist/assets/{MdxEditorPanel-CfwOM0KR.js → MdxEditorPanel-DHU0Ardx.js} +1 -1
  3. package/dist/assets/Mobile-Cqm4xH5j.js +1 -0
  4. package/dist/assets/ProxyModal-83mKKqyB.js +2 -0
  5. package/dist/assets/{ProxyModal-CNPuwcCz.css → ProxyModal-DzTu4uGE.css} +1 -1
  6. package/dist/assets/{_baseUniq-Ck0avQQW.js → _baseUniq-DXjKWfhk.js} +1 -1
  7. package/dist/assets/{arc-DoPSafE-.js → arc-DsQxkW5T.js} +1 -1
  8. package/dist/assets/{architectureDiagram-Q4EWVU46-CXwNDWVJ.js → architectureDiagram-Q4EWVU46-D24v83bq.js} +1 -1
  9. package/dist/assets/{blockDiagram-DXYQGD6D-DqcTnX5B.js → blockDiagram-DXYQGD6D-D5ezdfnY.js} +1 -1
  10. package/dist/assets/{c4Diagram-AHTNJAMY-CzZqJcRw.js → c4Diagram-AHTNJAMY-g5VhpI4X.js} +1 -1
  11. package/dist/assets/{channel-BPHggAg1.js → channel-Bohj9Wcp.js} +1 -1
  12. package/dist/assets/{chunk-4BX2VUAB-_j7urp68.js → chunk-4BX2VUAB-5LFKrDPS.js} +1 -1
  13. package/dist/assets/{chunk-4TB4RGXK-DSm-83N3.js → chunk-4TB4RGXK-B7I8vecx.js} +1 -1
  14. package/dist/assets/{chunk-55IACEB6-vMas_Dfs.js → chunk-55IACEB6-BBIiUctL.js} +1 -1
  15. package/dist/assets/{chunk-EDXVE4YY-DJmHQIxZ.js → chunk-EDXVE4YY-BYpcDSKa.js} +1 -1
  16. package/dist/assets/{chunk-FMBD7UC4-C6U6noME.js → chunk-FMBD7UC4-Dpw6TUJP.js} +1 -1
  17. package/dist/assets/{chunk-OYMX7WX6-DV09n2XA.js → chunk-OYMX7WX6-1R1GcGjy.js} +1 -1
  18. package/dist/assets/{chunk-QZHKN3VN-Bwa__aOF.js → chunk-QZHKN3VN-B43hQ2vS.js} +1 -1
  19. package/dist/assets/{chunk-YZCP3GAM-CBRCt3K4.js → chunk-YZCP3GAM-1IZth8n2.js} +1 -1
  20. package/dist/assets/{classDiagram-6PBFFD2Q-DKCDn4jL.js → classDiagram-6PBFFD2Q-BBoAxatM.js} +1 -1
  21. package/dist/assets/{classDiagram-v2-HSJHXN6E-DKCDn4jL.js → classDiagram-v2-HSJHXN6E-BBoAxatM.js} +1 -1
  22. package/dist/assets/clone-Cc7ofJ6W.js +1 -0
  23. package/dist/assets/{cose-bilkent-S5V4N54A-BwOVr318.js → cose-bilkent-S5V4N54A-D05nug0R.js} +1 -1
  24. package/dist/assets/{dagre-KV5264BT-BrIcbm5i.js → dagre-KV5264BT-DZ9d_ZUE.js} +1 -1
  25. package/dist/assets/{diagram-5BDNPKRD-C5qxQhGg.js → diagram-5BDNPKRD-DdyX_gXl.js} +1 -1
  26. package/dist/assets/{diagram-G4DWMVQ6-DsH7kdR2.js → diagram-G4DWMVQ6-cjq8tNSZ.js} +1 -1
  27. package/dist/assets/{diagram-MMDJMWI5-RE-fR3Cz.js → diagram-MMDJMWI5-NiKFms6e.js} +1 -1
  28. package/dist/assets/{diagram-TYMM5635-voZ1zyYa.js → diagram-TYMM5635-Dpig5X9-.js} +1 -1
  29. package/dist/assets/{erDiagram-SMLLAGMA-PrA2wCsY.js → erDiagram-SMLLAGMA-D2sWo3Zv.js} +1 -1
  30. package/dist/assets/{flowDiagram-DWJPFMVM-Ce7hKuco.js → flowDiagram-DWJPFMVM-D85Dj_yq.js} +1 -1
  31. package/dist/assets/{ganttDiagram-T4ZO3ILL-CDVZdk1O.js → ganttDiagram-T4ZO3ILL-DxAjpfgn.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-UUTBAWPF-ud920O99.js → gitGraphDiagram-UUTBAWPF-BO9g8cL0.js} +1 -1
  33. package/dist/assets/{graph-S7ZyOMd5.js → graph-BfcDIvNk.js} +1 -1
  34. package/dist/assets/index-aBYCRImE.js +2 -0
  35. package/dist/assets/{infoDiagram-42DDH7IO-DqmBGCgd.js → infoDiagram-42DDH7IO-BnOW3PpN.js} +1 -1
  36. package/dist/assets/{ishikawaDiagram-UXIWVN3A-TF8Q_01t.js → ishikawaDiagram-UXIWVN3A-BdRWHTx5.js} +1 -1
  37. package/dist/assets/{journeyDiagram-VCZTEJTY-y5GmBD-h.js → journeyDiagram-VCZTEJTY-6-pOxb-c.js} +1 -1
  38. package/dist/assets/{kanban-definition-6JOO6SKY-B-VIbcAu.js → kanban-definition-6JOO6SKY-BBX4NlcN.js} +1 -1
  39. package/dist/assets/{layout-Ye8iwdjE.js → layout-DtQNOuH0.js} +1 -1
  40. package/dist/assets/{linear-B6rvw7LC.js → linear-6Y3OZ7u2.js} +1 -1
  41. package/dist/assets/{mermaid.core-BeZMQR0-.js → mermaid.core-CAsnLdlL.js} +2 -2
  42. package/dist/assets/{min-Ckbo1P6U.js → min-BRPZJLHh.js} +1 -1
  43. package/dist/assets/{mindmap-definition-QFDTVHPH-CnCiGofR.js → mindmap-definition-QFDTVHPH-BkmfcnFE.js} +1 -1
  44. package/dist/assets/{pieDiagram-DEJITSTG-BqIhPE7F.js → pieDiagram-DEJITSTG-D4a_1EvH.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-34T5L4WZ-BUUOld6m.js → quadrantDiagram-34T5L4WZ-kKniISLU.js} +1 -1
  46. package/dist/assets/{requirementDiagram-MS252O5E-nXIfCEms.js → requirementDiagram-MS252O5E-DPikXO53.js} +1 -1
  47. package/dist/assets/{sankeyDiagram-XADWPNL6-DJThfilj.js → sankeyDiagram-XADWPNL6--rY8uDK7.js} +1 -1
  48. package/dist/assets/{sequenceDiagram-FGHM5R23-CQiVWsC6.js → sequenceDiagram-FGHM5R23-C57z6bd_.js} +1 -1
  49. package/dist/assets/{stateDiagram-FHFEXIEX-CxsMHyky.js → stateDiagram-FHFEXIEX-D7q_cBTL.js} +1 -1
  50. package/dist/assets/{stateDiagram-v2-QKLJ7IA2-Byzz6ymQ.js → stateDiagram-v2-QKLJ7IA2-Co3EU6Nf.js} +1 -1
  51. package/dist/assets/{timeline-definition-GMOUNBTQ-CkQgIeyQ.js → timeline-definition-GMOUNBTQ-DBV-lv69.js} +1 -1
  52. package/dist/assets/vendor-markdown-BFrYfpb0.js +1 -0
  53. package/dist/assets/{vennDiagram-DHZGUBPP-CPS3ODG3.js → vennDiagram-DHZGUBPP-ngWDn_ip.js} +1 -1
  54. package/dist/assets/{wardley-RL74JXVD-D6zaNgzM.js → wardley-RL74JXVD-BhMXVlU_.js} +1 -1
  55. package/dist/assets/{wardleyDiagram-NUSXRM2D-Bzaw757Q.js → wardleyDiagram-NUSXRM2D-lpdygHK-.js} +1 -1
  56. package/dist/assets/{xychartDiagram-5P7HB3ND-DCZ9r4uS.js → xychartDiagram-5P7HB3ND-DVafENtB.js} +1 -1
  57. package/dist/index.html +1 -1
  58. package/package.json +3 -3
  59. package/server.js +22 -4
  60. package/dist/assets/App-BhRbMy4X.js +0 -1
  61. package/dist/assets/Mobile-COrr8adp.js +0 -1
  62. package/dist/assets/ProxyModal-C-2vWlT8.js +0 -2
  63. package/dist/assets/clone-BbE0e7rU.js +0 -1
  64. package/dist/assets/index-mBNBJDft.js +0 -2
  65. package/dist/assets/vendor-markdown-Bpu4AByL.js +0 -1
@@ -1 +1 @@
1
- import{s as styles_default,a as stateDiagram_default,S as StateDB}from"./chunk-OYMX7WX6-DV09n2XA.js";import{_ as __name,c as getConfig2,d as select,l as log,e as configureSvgSize,k as common_default,Q as line,R as curveBasis,N as getUrl,u as utils_default}from"./mermaid.core-BeZMQR0-.js";import{G as Graph}from"./graph-S7ZyOMd5.js";import{l as layout}from"./layout-Ye8iwdjE.js";import"./chunk-55IACEB6-vMas_Dfs.js";import"./chunk-EDXVE4YY-DJmHQIxZ.js";import"./vendor-mdxeditor-C7DYEBoH.js";import"./vendor-antd-BeN8xqGk.js";import"./vendor-codemirror-2nbmPewy.js";import"./vendor-markdown-Bpu4AByL.js";import"./_baseUniq-Ck0avQQW.js";import"./min-Ckbo1P6U.js";var conf,drawStartState=__name(g=>g.append("circle").attr("class","start-state").attr("r",getConfig2().state.sizeUnit).attr("cx",getConfig2().state.padding+getConfig2().state.sizeUnit).attr("cy",getConfig2().state.padding+getConfig2().state.sizeUnit),"drawStartState"),drawDivider=__name(g=>g.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",getConfig2().state.textHeight).attr("class","divider").attr("x2",2*getConfig2().state.textHeight).attr("y1",0).attr("y2",0),"drawDivider"),drawSimpleState=__name((g,stateDef)=>{const state=g.append("text").attr("x",2*getConfig2().state.padding).attr("y",getConfig2().state.textHeight+2*getConfig2().state.padding).attr("font-size",getConfig2().state.fontSize).attr("class","state-title").text(stateDef.id),classBox=state.node().getBBox();return g.insert("rect",":first-child").attr("x",getConfig2().state.padding).attr("y",getConfig2().state.padding).attr("width",classBox.width+2*getConfig2().state.padding).attr("height",classBox.height+2*getConfig2().state.padding).attr("rx",getConfig2().state.radius),state},"drawSimpleState"),drawDescrState=__name((g,stateDef)=>{const addTspan=__name(function(textEl,txt,isFirst2){const tSpan=textEl.append("tspan").attr("x",2*getConfig2().state.padding).text(txt);isFirst2||tSpan.attr("dy",getConfig2().state.textHeight)},"addTspan"),titleBox=g.append("text").attr("x",2*getConfig2().state.padding).attr("y",getConfig2().state.textHeight+1.3*getConfig2().state.padding).attr("font-size",getConfig2().state.fontSize).attr("class","state-title").text(stateDef.descriptions[0]).node().getBBox(),titleHeight=titleBox.height,description=g.append("text").attr("x",getConfig2().state.padding).attr("y",titleHeight+.4*getConfig2().state.padding+getConfig2().state.dividerMargin+getConfig2().state.textHeight).attr("class","state-description");let isFirst=!0,isSecond=!0;stateDef.descriptions.forEach(function(descr){isFirst||(addTspan(description,descr,isSecond),isSecond=!1),isFirst=!1});const descrLine=g.append("line").attr("x1",getConfig2().state.padding).attr("y1",getConfig2().state.padding+titleHeight+getConfig2().state.dividerMargin/2).attr("y2",getConfig2().state.padding+titleHeight+getConfig2().state.dividerMargin/2).attr("class","descr-divider"),descrBox=description.node().getBBox(),width=Math.max(descrBox.width,titleBox.width);return descrLine.attr("x2",width+3*getConfig2().state.padding),g.insert("rect",":first-child").attr("x",getConfig2().state.padding).attr("y",getConfig2().state.padding).attr("width",width+2*getConfig2().state.padding).attr("height",descrBox.height+titleHeight+2*getConfig2().state.padding).attr("rx",getConfig2().state.radius),g},"drawDescrState"),addTitleAndBox=__name((g,stateDef,altBkg)=>{const pad=getConfig2().state.padding,dblPad=2*getConfig2().state.padding,orgBox=g.node().getBBox(),orgWidth=orgBox.width,orgX=orgBox.x,title=g.append("text").attr("x",0).attr("y",getConfig2().state.titleShift).attr("font-size",getConfig2().state.fontSize).attr("class","state-title").text(stateDef.id),titleWidth=title.node().getBBox().width+dblPad;let startX,width=Math.max(titleWidth,orgWidth);width===orgWidth&&(width+=dblPad);const graphBox=g.node().getBBox();stateDef.doc,startX=orgX-pad,titleWidth>orgWidth&&(startX=(orgWidth-width)/2+pad),Math.abs(orgX-graphBox.x)<pad&&titleWidth>orgWidth&&(startX=orgX-(titleWidth-orgWidth)/2);const lineY=1-getConfig2().state.textHeight;return g.insert("rect",":first-child").attr("x",startX).attr("y",lineY).attr("class",altBkg?"alt-composit":"composit").attr("width",width).attr("height",graphBox.height+getConfig2().state.textHeight+getConfig2().state.titleShift+1).attr("rx","0"),title.attr("x",startX+pad),titleWidth<=orgWidth&&title.attr("x",orgX+(width-dblPad)/2-titleWidth/2+pad),g.insert("rect",":first-child").attr("x",startX).attr("y",getConfig2().state.titleShift-getConfig2().state.textHeight-getConfig2().state.padding).attr("width",width).attr("height",3*getConfig2().state.textHeight).attr("rx",getConfig2().state.radius),g.insert("rect",":first-child").attr("x",startX).attr("y",getConfig2().state.titleShift-getConfig2().state.textHeight-getConfig2().state.padding).attr("width",width).attr("height",graphBox.height+3+2*getConfig2().state.textHeight).attr("rx",getConfig2().state.radius),g},"addTitleAndBox"),drawEndState=__name(g=>(g.append("circle").attr("class","end-state-outer").attr("r",getConfig2().state.sizeUnit+getConfig2().state.miniPadding).attr("cx",getConfig2().state.padding+getConfig2().state.sizeUnit+getConfig2().state.miniPadding).attr("cy",getConfig2().state.padding+getConfig2().state.sizeUnit+getConfig2().state.miniPadding),g.append("circle").attr("class","end-state-inner").attr("r",getConfig2().state.sizeUnit).attr("cx",getConfig2().state.padding+getConfig2().state.sizeUnit+2).attr("cy",getConfig2().state.padding+getConfig2().state.sizeUnit+2)),"drawEndState"),drawForkJoinState=__name((g,stateDef)=>{let width=getConfig2().state.forkWidth,height=getConfig2().state.forkHeight;if(stateDef.parentId){let tmp=width;width=height,height=tmp}return g.append("rect").style("stroke","black").style("fill","black").attr("width",width).attr("height",height).attr("x",getConfig2().state.padding).attr("y",getConfig2().state.padding)},"drawForkJoinState"),_drawLongText=__name((_text,x,y,g)=>{let textHeight=0;const textElem=g.append("text");textElem.style("text-anchor","start"),textElem.attr("class","noteText");let text=_text.replace(/\r\n/g,"<br/>");text=text.replace(/\n/g,"<br/>");const lines=text.split(common_default.lineBreakRegex);let tHeight=1.25*getConfig2().state.noteMargin;for(const line2 of lines){const txt=line2.trim();if(txt.length>0){const span=textElem.append("tspan");if(span.text(txt),0===tHeight){tHeight+=span.node().getBBox().height}textHeight+=tHeight,span.attr("x",x+getConfig2().state.noteMargin),span.attr("y",y+textHeight+1.25*getConfig2().state.noteMargin)}}return{textWidth:textElem.node().getBBox().width,textHeight:textHeight}},"_drawLongText"),drawNote=__name((text,g)=>{g.attr("class","state-note");const note=g.append("rect").attr("x",0).attr("y",getConfig2().state.padding),rectElem=g.append("g"),{textWidth:textWidth,textHeight:textHeight}=_drawLongText(text,0,0,rectElem);return note.attr("height",textHeight+2*getConfig2().state.noteMargin),note.attr("width",textWidth+2*getConfig2().state.noteMargin),note},"drawNote"),drawState=__name(function(elem,stateDef){const id=stateDef.id,stateInfo={id:id,label:stateDef.id,width:0,height:0},g=elem.append("g").attr("id",id).attr("class","stateGroup");"start"===stateDef.type&&drawStartState(g),"end"===stateDef.type&&drawEndState(g),"fork"!==stateDef.type&&"join"!==stateDef.type||drawForkJoinState(g,stateDef),"note"===stateDef.type&&drawNote(stateDef.note.text,g),"divider"===stateDef.type&&drawDivider(g),"default"===stateDef.type&&0===stateDef.descriptions.length&&drawSimpleState(g,stateDef),"default"===stateDef.type&&stateDef.descriptions.length>0&&drawDescrState(g,stateDef);const stateBox=g.node().getBBox();return stateInfo.width=stateBox.width+2*getConfig2().state.padding,stateInfo.height=stateBox.height+2*getConfig2().state.padding,stateInfo},"drawState"),edgeCount=0,drawEdge=__name(function(elem,path,relation){const getRelationType=__name(function(type){switch(type){case StateDB.relationType.AGGREGATION:return"aggregation";case StateDB.relationType.EXTENSION:return"extension";case StateDB.relationType.COMPOSITION:return"composition";case StateDB.relationType.DEPENDENCY:return"dependency"}},"getRelationType");path.points=path.points.filter(p=>!Number.isNaN(p.y));const lineData=path.points,lineFunction=line().x(function(d){return d.x}).y(function(d){return d.y}).curve(curveBasis),svgPath=elem.append("path").attr("d",lineFunction(lineData)).attr("id","edge"+edgeCount).attr("class","transition");let url="";if(getConfig2().state.arrowMarkerAbsolute&&(url=getUrl(!0)),svgPath.attr("marker-end","url("+url+"#"+getRelationType(StateDB.relationType.DEPENDENCY)+"End)"),void 0!==relation.title){const label=elem.append("g").attr("class","stateLabel"),{x:x,y:y}=utils_default.calcLabelPosition(path.points),rows=common_default.getRows(relation.title);let titleHeight=0;const titleRows=[];let maxWidth=0,minX=0;for(let i=0;i<=rows.length;i++){const title=label.append("text").attr("text-anchor","middle").text(rows[i]).attr("x",x).attr("y",y+titleHeight),boundsTmp=title.node().getBBox();if(maxWidth=Math.max(maxWidth,boundsTmp.width),minX=Math.min(minX,boundsTmp.x),log.info(boundsTmp.x,x,y+titleHeight),0===titleHeight){const titleBox=title.node().getBBox();titleHeight=titleBox.height,log.info("Title height",titleHeight,y)}titleRows.push(title)}let boxHeight=titleHeight*rows.length;if(rows.length>1){const heightAdj=(rows.length-1)*titleHeight*.5;titleRows.forEach((title,i)=>title.attr("y",y+i*titleHeight-heightAdj)),boxHeight=titleHeight*rows.length}const bounds=label.node().getBBox();label.insert("rect",":first-child").attr("class","box").attr("x",x-maxWidth/2-getConfig2().state.padding/2).attr("y",y-boxHeight/2-getConfig2().state.padding/2-3.5).attr("width",maxWidth+getConfig2().state.padding).attr("height",boxHeight+getConfig2().state.padding),log.info(bounds)}edgeCount++},"drawEdge"),transformationLog={},setConf=__name(function(){},"setConf"),insertMarkers=__name(function(elem){elem.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"),draw=__name(function(text,id,_version,diagObj){conf=getConfig2().state;const securityLevel=getConfig2().securityLevel;let sandboxElement;"sandbox"===securityLevel&&(sandboxElement=select("#i"+id));const root=select("sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument.body:"body"),doc="sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument:document;log.debug("Rendering diagram "+text);const diagram2=root.select(`[id='${id}']`);insertMarkers(diagram2);const rootDoc=diagObj.db.getRootDoc(),rootG=diagram2.append("g").attr("id",id+"-root");renderDoc(rootDoc,rootG,void 0,!1,root,doc,diagObj);const padding=conf.padding,bounds=diagram2.node().getBBox(),width=bounds.width+2*padding,height=bounds.height+2*padding;configureSvgSize(diagram2,height,1.75*width,conf.useMaxWidth),diagram2.attr("viewBox",`${bounds.x-conf.padding} ${bounds.y-conf.padding} `+width+" "+height)},"draw"),getLabelWidth=__name(text=>text?text.length*conf.fontSizeFactor:1,"getLabelWidth"),renderDoc=__name((doc,diagram2,parentId,altBkg,root,domDocument,diagObj)=>{const graph=new Graph({compound:!0,multigraph:!0});let i,edgeFreeDoc=!0;for(i=0;i<doc.length;i++)if("relation"===doc[i].stmt){edgeFreeDoc=!1;break}parentId?graph.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:edgeFreeDoc?1:conf.edgeLengthFactor,nodeSep:edgeFreeDoc?1:50,isMultiGraph:!0}):graph.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:edgeFreeDoc?1:conf.edgeLengthFactor,nodeSep:edgeFreeDoc?1:50,ranker:"tight-tree",isMultiGraph:!0}),graph.setDefaultEdgeLabel(function(){return{}});const states=diagObj.db.getStates(),relations=diagObj.db.getRelations(),keys=Object.keys(states);for(const key of keys){const stateDef=states[key];let node;if(parentId&&(stateDef.parentId=parentId),stateDef.doc){let sub=diagram2.append("g").attr("id",stateDef.id).attr("class","stateGroup");node=renderDoc(stateDef.doc,sub,stateDef.id,!altBkg,root,domDocument,diagObj);{sub=addTitleAndBox(sub,stateDef,altBkg);let boxBounds=sub.node().getBBox();node.width=boxBounds.width,node.height=boxBounds.height+conf.padding/2,transformationLog[stateDef.id]={y:conf.compositTitleSize}}}else node=drawState(diagram2,stateDef,graph);if(stateDef.note){const noteDef={descriptions:[],id:stateDef.id+"-note",note:stateDef.note,type:"note"},note=drawState(diagram2,noteDef,graph);"left of"===stateDef.note.position?(graph.setNode(node.id+"-note",note),graph.setNode(node.id,node)):(graph.setNode(node.id,node),graph.setNode(node.id+"-note",note)),graph.setParent(node.id,node.id+"-group"),graph.setParent(node.id+"-note",node.id+"-group")}else graph.setNode(node.id,node)}log.debug("Count=",graph.nodeCount(),graph);let cnt=0;relations.forEach(function(relation){cnt++,log.debug("Setting edge",relation),graph.setEdge(relation.id1,relation.id2,{relation:relation,width:getLabelWidth(relation.title),height:conf.labelHeight*common_default.getRows(relation.title).length,labelpos:"c"},"id"+cnt)}),layout(graph),log.debug("Graph after layout",graph.nodes());const svgElem=diagram2.node();graph.nodes().forEach(function(v){if(void 0!==v&&void 0!==graph.node(v)){log.warn("Node "+v+": "+JSON.stringify(graph.node(v))),root.select("#"+svgElem.id+" #"+v).attr("transform","translate("+(graph.node(v).x-graph.node(v).width/2)+","+(graph.node(v).y+(transformationLog[v]?transformationLog[v].y:0)-graph.node(v).height/2)+" )"),root.select("#"+svgElem.id+" #"+v).attr("data-x-shift",graph.node(v).x-graph.node(v).width/2);domDocument.querySelectorAll("#"+svgElem.id+" #"+v+" .divider").forEach(divider=>{const parent=divider.parentElement;let pWidth=0,pShift=0;parent&&(parent.parentElement&&(pWidth=parent.parentElement.getBBox().width),pShift=parseInt(parent.getAttribute("data-x-shift"),10),Number.isNaN(pShift)&&(pShift=0)),divider.setAttribute("x1",0-pShift+8),divider.setAttribute("x2",pWidth-pShift-8)})}else log.debug("No Node "+v+": "+JSON.stringify(graph.node(v)))});let stateBox=svgElem.getBBox();graph.edges().forEach(function(e){void 0!==e&&void 0!==graph.edge(e)&&(log.debug("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(graph.edge(e))),drawEdge(diagram2,graph.edge(e),graph.edge(e).relation))}),stateBox=svgElem.getBBox();const stateInfo={id:parentId||"root",label:parentId||"root",width:0,height:0};return stateInfo.width=stateBox.width+2*conf.padding,stateInfo.height=stateBox.height+2*conf.padding,log.debug("Doc rendered",stateInfo,graph),stateInfo},"renderDoc"),stateRenderer_default={setConf:setConf,draw:draw},diagram={parser:stateDiagram_default,get db(){return new StateDB(1)},renderer:stateRenderer_default,styles:styles_default,init:__name(cnf=>{cnf.state||(cnf.state={}),cnf.state.arrowMarkerAbsolute=cnf.arrowMarkerAbsolute},"init")};export{diagram};
1
+ import{s as styles_default,a as stateDiagram_default,S as StateDB}from"./chunk-OYMX7WX6-1R1GcGjy.js";import{_ as __name,c as getConfig2,d as select,l as log,e as configureSvgSize,k as common_default,Q as line,R as curveBasis,N as getUrl,u as utils_default}from"./mermaid.core-CAsnLdlL.js";import{G as Graph}from"./graph-BfcDIvNk.js";import{l as layout}from"./layout-DtQNOuH0.js";import"./chunk-55IACEB6-BBIiUctL.js";import"./chunk-EDXVE4YY-BYpcDSKa.js";import"./vendor-mdxeditor-C7DYEBoH.js";import"./vendor-antd-BeN8xqGk.js";import"./vendor-codemirror-2nbmPewy.js";import"./vendor-markdown-BFrYfpb0.js";import"./_baseUniq-DXjKWfhk.js";import"./min-BRPZJLHh.js";var conf,drawStartState=__name(g=>g.append("circle").attr("class","start-state").attr("r",getConfig2().state.sizeUnit).attr("cx",getConfig2().state.padding+getConfig2().state.sizeUnit).attr("cy",getConfig2().state.padding+getConfig2().state.sizeUnit),"drawStartState"),drawDivider=__name(g=>g.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",getConfig2().state.textHeight).attr("class","divider").attr("x2",2*getConfig2().state.textHeight).attr("y1",0).attr("y2",0),"drawDivider"),drawSimpleState=__name((g,stateDef)=>{const state=g.append("text").attr("x",2*getConfig2().state.padding).attr("y",getConfig2().state.textHeight+2*getConfig2().state.padding).attr("font-size",getConfig2().state.fontSize).attr("class","state-title").text(stateDef.id),classBox=state.node().getBBox();return g.insert("rect",":first-child").attr("x",getConfig2().state.padding).attr("y",getConfig2().state.padding).attr("width",classBox.width+2*getConfig2().state.padding).attr("height",classBox.height+2*getConfig2().state.padding).attr("rx",getConfig2().state.radius),state},"drawSimpleState"),drawDescrState=__name((g,stateDef)=>{const addTspan=__name(function(textEl,txt,isFirst2){const tSpan=textEl.append("tspan").attr("x",2*getConfig2().state.padding).text(txt);isFirst2||tSpan.attr("dy",getConfig2().state.textHeight)},"addTspan"),titleBox=g.append("text").attr("x",2*getConfig2().state.padding).attr("y",getConfig2().state.textHeight+1.3*getConfig2().state.padding).attr("font-size",getConfig2().state.fontSize).attr("class","state-title").text(stateDef.descriptions[0]).node().getBBox(),titleHeight=titleBox.height,description=g.append("text").attr("x",getConfig2().state.padding).attr("y",titleHeight+.4*getConfig2().state.padding+getConfig2().state.dividerMargin+getConfig2().state.textHeight).attr("class","state-description");let isFirst=!0,isSecond=!0;stateDef.descriptions.forEach(function(descr){isFirst||(addTspan(description,descr,isSecond),isSecond=!1),isFirst=!1});const descrLine=g.append("line").attr("x1",getConfig2().state.padding).attr("y1",getConfig2().state.padding+titleHeight+getConfig2().state.dividerMargin/2).attr("y2",getConfig2().state.padding+titleHeight+getConfig2().state.dividerMargin/2).attr("class","descr-divider"),descrBox=description.node().getBBox(),width=Math.max(descrBox.width,titleBox.width);return descrLine.attr("x2",width+3*getConfig2().state.padding),g.insert("rect",":first-child").attr("x",getConfig2().state.padding).attr("y",getConfig2().state.padding).attr("width",width+2*getConfig2().state.padding).attr("height",descrBox.height+titleHeight+2*getConfig2().state.padding).attr("rx",getConfig2().state.radius),g},"drawDescrState"),addTitleAndBox=__name((g,stateDef,altBkg)=>{const pad=getConfig2().state.padding,dblPad=2*getConfig2().state.padding,orgBox=g.node().getBBox(),orgWidth=orgBox.width,orgX=orgBox.x,title=g.append("text").attr("x",0).attr("y",getConfig2().state.titleShift).attr("font-size",getConfig2().state.fontSize).attr("class","state-title").text(stateDef.id),titleWidth=title.node().getBBox().width+dblPad;let startX,width=Math.max(titleWidth,orgWidth);width===orgWidth&&(width+=dblPad);const graphBox=g.node().getBBox();stateDef.doc,startX=orgX-pad,titleWidth>orgWidth&&(startX=(orgWidth-width)/2+pad),Math.abs(orgX-graphBox.x)<pad&&titleWidth>orgWidth&&(startX=orgX-(titleWidth-orgWidth)/2);const lineY=1-getConfig2().state.textHeight;return g.insert("rect",":first-child").attr("x",startX).attr("y",lineY).attr("class",altBkg?"alt-composit":"composit").attr("width",width).attr("height",graphBox.height+getConfig2().state.textHeight+getConfig2().state.titleShift+1).attr("rx","0"),title.attr("x",startX+pad),titleWidth<=orgWidth&&title.attr("x",orgX+(width-dblPad)/2-titleWidth/2+pad),g.insert("rect",":first-child").attr("x",startX).attr("y",getConfig2().state.titleShift-getConfig2().state.textHeight-getConfig2().state.padding).attr("width",width).attr("height",3*getConfig2().state.textHeight).attr("rx",getConfig2().state.radius),g.insert("rect",":first-child").attr("x",startX).attr("y",getConfig2().state.titleShift-getConfig2().state.textHeight-getConfig2().state.padding).attr("width",width).attr("height",graphBox.height+3+2*getConfig2().state.textHeight).attr("rx",getConfig2().state.radius),g},"addTitleAndBox"),drawEndState=__name(g=>(g.append("circle").attr("class","end-state-outer").attr("r",getConfig2().state.sizeUnit+getConfig2().state.miniPadding).attr("cx",getConfig2().state.padding+getConfig2().state.sizeUnit+getConfig2().state.miniPadding).attr("cy",getConfig2().state.padding+getConfig2().state.sizeUnit+getConfig2().state.miniPadding),g.append("circle").attr("class","end-state-inner").attr("r",getConfig2().state.sizeUnit).attr("cx",getConfig2().state.padding+getConfig2().state.sizeUnit+2).attr("cy",getConfig2().state.padding+getConfig2().state.sizeUnit+2)),"drawEndState"),drawForkJoinState=__name((g,stateDef)=>{let width=getConfig2().state.forkWidth,height=getConfig2().state.forkHeight;if(stateDef.parentId){let tmp=width;width=height,height=tmp}return g.append("rect").style("stroke","black").style("fill","black").attr("width",width).attr("height",height).attr("x",getConfig2().state.padding).attr("y",getConfig2().state.padding)},"drawForkJoinState"),_drawLongText=__name((_text,x,y,g)=>{let textHeight=0;const textElem=g.append("text");textElem.style("text-anchor","start"),textElem.attr("class","noteText");let text=_text.replace(/\r\n/g,"<br/>");text=text.replace(/\n/g,"<br/>");const lines=text.split(common_default.lineBreakRegex);let tHeight=1.25*getConfig2().state.noteMargin;for(const line2 of lines){const txt=line2.trim();if(txt.length>0){const span=textElem.append("tspan");if(span.text(txt),0===tHeight){tHeight+=span.node().getBBox().height}textHeight+=tHeight,span.attr("x",x+getConfig2().state.noteMargin),span.attr("y",y+textHeight+1.25*getConfig2().state.noteMargin)}}return{textWidth:textElem.node().getBBox().width,textHeight:textHeight}},"_drawLongText"),drawNote=__name((text,g)=>{g.attr("class","state-note");const note=g.append("rect").attr("x",0).attr("y",getConfig2().state.padding),rectElem=g.append("g"),{textWidth:textWidth,textHeight:textHeight}=_drawLongText(text,0,0,rectElem);return note.attr("height",textHeight+2*getConfig2().state.noteMargin),note.attr("width",textWidth+2*getConfig2().state.noteMargin),note},"drawNote"),drawState=__name(function(elem,stateDef){const id=stateDef.id,stateInfo={id:id,label:stateDef.id,width:0,height:0},g=elem.append("g").attr("id",id).attr("class","stateGroup");"start"===stateDef.type&&drawStartState(g),"end"===stateDef.type&&drawEndState(g),"fork"!==stateDef.type&&"join"!==stateDef.type||drawForkJoinState(g,stateDef),"note"===stateDef.type&&drawNote(stateDef.note.text,g),"divider"===stateDef.type&&drawDivider(g),"default"===stateDef.type&&0===stateDef.descriptions.length&&drawSimpleState(g,stateDef),"default"===stateDef.type&&stateDef.descriptions.length>0&&drawDescrState(g,stateDef);const stateBox=g.node().getBBox();return stateInfo.width=stateBox.width+2*getConfig2().state.padding,stateInfo.height=stateBox.height+2*getConfig2().state.padding,stateInfo},"drawState"),edgeCount=0,drawEdge=__name(function(elem,path,relation){const getRelationType=__name(function(type){switch(type){case StateDB.relationType.AGGREGATION:return"aggregation";case StateDB.relationType.EXTENSION:return"extension";case StateDB.relationType.COMPOSITION:return"composition";case StateDB.relationType.DEPENDENCY:return"dependency"}},"getRelationType");path.points=path.points.filter(p=>!Number.isNaN(p.y));const lineData=path.points,lineFunction=line().x(function(d){return d.x}).y(function(d){return d.y}).curve(curveBasis),svgPath=elem.append("path").attr("d",lineFunction(lineData)).attr("id","edge"+edgeCount).attr("class","transition");let url="";if(getConfig2().state.arrowMarkerAbsolute&&(url=getUrl(!0)),svgPath.attr("marker-end","url("+url+"#"+getRelationType(StateDB.relationType.DEPENDENCY)+"End)"),void 0!==relation.title){const label=elem.append("g").attr("class","stateLabel"),{x:x,y:y}=utils_default.calcLabelPosition(path.points),rows=common_default.getRows(relation.title);let titleHeight=0;const titleRows=[];let maxWidth=0,minX=0;for(let i=0;i<=rows.length;i++){const title=label.append("text").attr("text-anchor","middle").text(rows[i]).attr("x",x).attr("y",y+titleHeight),boundsTmp=title.node().getBBox();if(maxWidth=Math.max(maxWidth,boundsTmp.width),minX=Math.min(minX,boundsTmp.x),log.info(boundsTmp.x,x,y+titleHeight),0===titleHeight){const titleBox=title.node().getBBox();titleHeight=titleBox.height,log.info("Title height",titleHeight,y)}titleRows.push(title)}let boxHeight=titleHeight*rows.length;if(rows.length>1){const heightAdj=(rows.length-1)*titleHeight*.5;titleRows.forEach((title,i)=>title.attr("y",y+i*titleHeight-heightAdj)),boxHeight=titleHeight*rows.length}const bounds=label.node().getBBox();label.insert("rect",":first-child").attr("class","box").attr("x",x-maxWidth/2-getConfig2().state.padding/2).attr("y",y-boxHeight/2-getConfig2().state.padding/2-3.5).attr("width",maxWidth+getConfig2().state.padding).attr("height",boxHeight+getConfig2().state.padding),log.info(bounds)}edgeCount++},"drawEdge"),transformationLog={},setConf=__name(function(){},"setConf"),insertMarkers=__name(function(elem){elem.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"),draw=__name(function(text,id,_version,diagObj){conf=getConfig2().state;const securityLevel=getConfig2().securityLevel;let sandboxElement;"sandbox"===securityLevel&&(sandboxElement=select("#i"+id));const root=select("sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument.body:"body"),doc="sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument:document;log.debug("Rendering diagram "+text);const diagram2=root.select(`[id='${id}']`);insertMarkers(diagram2);const rootDoc=diagObj.db.getRootDoc(),rootG=diagram2.append("g").attr("id",id+"-root");renderDoc(rootDoc,rootG,void 0,!1,root,doc,diagObj);const padding=conf.padding,bounds=diagram2.node().getBBox(),width=bounds.width+2*padding,height=bounds.height+2*padding;configureSvgSize(diagram2,height,1.75*width,conf.useMaxWidth),diagram2.attr("viewBox",`${bounds.x-conf.padding} ${bounds.y-conf.padding} `+width+" "+height)},"draw"),getLabelWidth=__name(text=>text?text.length*conf.fontSizeFactor:1,"getLabelWidth"),renderDoc=__name((doc,diagram2,parentId,altBkg,root,domDocument,diagObj)=>{const graph=new Graph({compound:!0,multigraph:!0});let i,edgeFreeDoc=!0;for(i=0;i<doc.length;i++)if("relation"===doc[i].stmt){edgeFreeDoc=!1;break}parentId?graph.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:edgeFreeDoc?1:conf.edgeLengthFactor,nodeSep:edgeFreeDoc?1:50,isMultiGraph:!0}):graph.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:edgeFreeDoc?1:conf.edgeLengthFactor,nodeSep:edgeFreeDoc?1:50,ranker:"tight-tree",isMultiGraph:!0}),graph.setDefaultEdgeLabel(function(){return{}});const states=diagObj.db.getStates(),relations=diagObj.db.getRelations(),keys=Object.keys(states);for(const key of keys){const stateDef=states[key];let node;if(parentId&&(stateDef.parentId=parentId),stateDef.doc){let sub=diagram2.append("g").attr("id",stateDef.id).attr("class","stateGroup");node=renderDoc(stateDef.doc,sub,stateDef.id,!altBkg,root,domDocument,diagObj);{sub=addTitleAndBox(sub,stateDef,altBkg);let boxBounds=sub.node().getBBox();node.width=boxBounds.width,node.height=boxBounds.height+conf.padding/2,transformationLog[stateDef.id]={y:conf.compositTitleSize}}}else node=drawState(diagram2,stateDef,graph);if(stateDef.note){const noteDef={descriptions:[],id:stateDef.id+"-note",note:stateDef.note,type:"note"},note=drawState(diagram2,noteDef,graph);"left of"===stateDef.note.position?(graph.setNode(node.id+"-note",note),graph.setNode(node.id,node)):(graph.setNode(node.id,node),graph.setNode(node.id+"-note",note)),graph.setParent(node.id,node.id+"-group"),graph.setParent(node.id+"-note",node.id+"-group")}else graph.setNode(node.id,node)}log.debug("Count=",graph.nodeCount(),graph);let cnt=0;relations.forEach(function(relation){cnt++,log.debug("Setting edge",relation),graph.setEdge(relation.id1,relation.id2,{relation:relation,width:getLabelWidth(relation.title),height:conf.labelHeight*common_default.getRows(relation.title).length,labelpos:"c"},"id"+cnt)}),layout(graph),log.debug("Graph after layout",graph.nodes());const svgElem=diagram2.node();graph.nodes().forEach(function(v){if(void 0!==v&&void 0!==graph.node(v)){log.warn("Node "+v+": "+JSON.stringify(graph.node(v))),root.select("#"+svgElem.id+" #"+v).attr("transform","translate("+(graph.node(v).x-graph.node(v).width/2)+","+(graph.node(v).y+(transformationLog[v]?transformationLog[v].y:0)-graph.node(v).height/2)+" )"),root.select("#"+svgElem.id+" #"+v).attr("data-x-shift",graph.node(v).x-graph.node(v).width/2);domDocument.querySelectorAll("#"+svgElem.id+" #"+v+" .divider").forEach(divider=>{const parent=divider.parentElement;let pWidth=0,pShift=0;parent&&(parent.parentElement&&(pWidth=parent.parentElement.getBBox().width),pShift=parseInt(parent.getAttribute("data-x-shift"),10),Number.isNaN(pShift)&&(pShift=0)),divider.setAttribute("x1",0-pShift+8),divider.setAttribute("x2",pWidth-pShift-8)})}else log.debug("No Node "+v+": "+JSON.stringify(graph.node(v)))});let stateBox=svgElem.getBBox();graph.edges().forEach(function(e){void 0!==e&&void 0!==graph.edge(e)&&(log.debug("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(graph.edge(e))),drawEdge(diagram2,graph.edge(e),graph.edge(e).relation))}),stateBox=svgElem.getBBox();const stateInfo={id:parentId||"root",label:parentId||"root",width:0,height:0};return stateInfo.width=stateBox.width+2*conf.padding,stateInfo.height=stateBox.height+2*conf.padding,log.debug("Doc rendered",stateInfo,graph),stateInfo},"renderDoc"),stateRenderer_default={setConf:setConf,draw:draw},diagram={parser:stateDiagram_default,get db(){return new StateDB(1)},renderer:stateRenderer_default,styles:styles_default,init:__name(cnf=>{cnf.state||(cnf.state={}),cnf.state.arrowMarkerAbsolute=cnf.arrowMarkerAbsolute},"init")};export{diagram};
@@ -1 +1 @@
1
- import{s as styles_default,b as stateRenderer_v3_unified_default,a as stateDiagram_default,S as StateDB}from"./chunk-OYMX7WX6-DV09n2XA.js";import{_ as __name}from"./mermaid.core-BeZMQR0-.js";import"./chunk-55IACEB6-vMas_Dfs.js";import"./chunk-EDXVE4YY-DJmHQIxZ.js";import"./vendor-mdxeditor-C7DYEBoH.js";import"./vendor-antd-BeN8xqGk.js";import"./vendor-codemirror-2nbmPewy.js";import"./vendor-markdown-Bpu4AByL.js";var diagram={parser:stateDiagram_default,get db(){return new StateDB(2)},renderer:stateRenderer_v3_unified_default,styles:styles_default,init:__name(cnf=>{cnf.state||(cnf.state={}),cnf.state.arrowMarkerAbsolute=cnf.arrowMarkerAbsolute},"init")};export{diagram};
1
+ import{s as styles_default,b as stateRenderer_v3_unified_default,a as stateDiagram_default,S as StateDB}from"./chunk-OYMX7WX6-1R1GcGjy.js";import{_ as __name}from"./mermaid.core-CAsnLdlL.js";import"./chunk-55IACEB6-BBIiUctL.js";import"./chunk-EDXVE4YY-BYpcDSKa.js";import"./vendor-mdxeditor-C7DYEBoH.js";import"./vendor-antd-BeN8xqGk.js";import"./vendor-codemirror-2nbmPewy.js";import"./vendor-markdown-BFrYfpb0.js";var diagram={parser:stateDiagram_default,get db(){return new StateDB(2)},renderer:stateRenderer_v3_unified_default,styles:styles_default,init:__name(cnf=>{cnf.state||(cnf.state={}),cnf.state.arrowMarkerAbsolute=cnf.arrowMarkerAbsolute},"init")};export{diagram};
@@ -1 +1 @@
1
- import{_ as __name,C as getConfig,U as isDark,V as lighten,W as darken,c as getConfig2,l as log,H as selectSvgElement,M as parseFontSize,X as setupGraphViewbox,d as select,B as __export,Y as commonDb_exports,y as clear}from"./mermaid.core-BeZMQR0-.js";import{d as d3arc}from"./arc-DoPSafE-.js";import"./vendor-mdxeditor-C7DYEBoH.js";import"./vendor-antd-BeN8xqGk.js";import"./vendor-codemirror-2nbmPewy.js";import"./vendor-markdown-Bpu4AByL.js";var parser=function(){var o=__name(function(k,v,o2,l){for(o2=o2||{},l=k.length;l--;o2[k[l]]=v);return o2},"o"),$V0=[6,11,13,14,15,17,19,20,23,24],$V1=[1,12],$V2=[1,13],$V3=[1,14],$V4=[1,15],$V5=[1,16],$V6=[1,19],$V7=[1,20],parser2={trace:__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:__name(function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 3:yy.setDirection("LR");break;case 4:yy.setDirection("TD");break;case 5:case 9:case 10:this.$=[];break;case 6:$$[$0-1].push($$[$0]),this.$=$$[$0-1];break;case 7:case 8:this.$=$$[$0];break;case 11:yy.getCommonDb().setDiagramTitle($$[$0].substr(6)),this.$=$$[$0].substr(6);break;case 12:this.$=$$[$0].trim(),yy.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=$$[$0].trim(),yy.getCommonDb().setAccDescription(this.$);break;case 15:yy.addSection($$[$0].substr(8)),this.$=$$[$0].substr(8);break;case 18:yy.addTask($$[$0],0,""),this.$=$$[$0];break;case 19:yy.addEvent($$[$0].substr(2)),this.$=$$[$0]}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},o($V0,[2,5],{5:6}),o($V0,[2,2]),o($V0,[2,3]),o($V0,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,10],{1:[2,1]}),o($V0,[2,6]),{12:21,14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,8]),o($V0,[2,9]),o($V0,[2,11]),{16:[1,22]},{18:[1,23]},o($V0,[2,14]),o($V0,[2,15]),o($V0,[2,16]),o($V0,[2,17]),o($V0,[2,18]),o($V0,[2,19]),o($V0,[2,7]),o($V0,[2,12]),o($V0,[2,13])],defaultActions:{},parseError:__name(function(str,hash){if(!hash.recoverable){var error=new Error(str);throw error.hash=hash,error}this.trace(str)},"parseError"),parse:__name(function(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,args=lstack.slice.call(arguments,1),lexer2=Object.create(this.lexer),sharedState={yy:{}};for(var k in this.yy)Object.prototype.hasOwnProperty.call(this.yy,k)&&(sharedState.yy[k]=this.yy[k]);lexer2.setInput(input,sharedState.yy),sharedState.yy.lexer=lexer2,sharedState.yy.parser=this,void 0===lexer2.yylloc&&(lexer2.yylloc={});var yyloc=lexer2.yylloc;lstack.push(yyloc);var ranges=lexer2.options&&lexer2.options.ranges;function lex(){var token;return"number"!=typeof(token=tstack.pop()||lexer2.lex()||1)&&(token instanceof Array&&(token=(tstack=token).pop()),token=self.symbols_[token]||token),token}"function"==typeof sharedState.yy.parseError?this.parseError=sharedState.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,__name(function(n){stack.length=stack.length-2*n,vstack.length=vstack.length-n,lstack.length=lstack.length-n},"popStack"),__name(lex,"lex");for(var symbol,state,action,r,p,len,newState,expected,yyval={};;){if(state=stack[stack.length-1],this.defaultActions[state]?action=this.defaultActions[state]:(null==symbol&&(symbol=lex()),action=table[state]&&table[state][symbol]),void 0===action||!action.length||!action[0]){var errStr="";for(p in expected=[],table[state])this.terminals_[p]&&p>2&&expected.push("'"+this.terminals_[p]+"'");errStr=lexer2.showPosition?"Parse error on line "+(yylineno+1)+":\n"+lexer2.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(1==symbol?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:lexer2.match,token:this.terminals_[symbol]||symbol,line:lexer2.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(lexer2.yytext),lstack.push(lexer2.yylloc),stack.push(action[1]),symbol=null,yyleng=lexer2.yyleng,yytext=lexer2.yytext,yylineno=lexer2.yylineno,yyloc=lexer2.yylloc;break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),void 0!==(r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args))))return r;len&&(stack=stack.slice(0,-1*len*2),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0},"parse")},lexer=function(){return{EOF:1,parseError:__name(function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},"parseError"),setInput:__name(function(input,yy){return this.yy=yy||this.yy||{},this._input=input,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:__name(function(){var ch=this._input[0];return this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch,ch.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},"input"),unput:__name(function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len),this.offset-=len;var oldLines=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),lines.length-1&&(this.yylineno-=lines.length-1);var r=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:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this.yyleng=this.yytext.length,this},"unput"),more:__name(function(){return this._more=!0,this},"more"),reject:__name(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:__name(function(n){this.unput(this.match.slice(n))},"less"),pastInput:__name(function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:__name(function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:__name(function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},"showPosition"),test_match:__name(function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer&&(backup={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&&(backup.yylloc.range=this.yylloc.range.slice(0))),(lines=match[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,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(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token)return token;if(this._backtrack){for(var k in backup)this[k]=backup[k];return!1}return!1},"test_match"),next:__name(function(){if(this.done)return this.EOF;var token,match,tempMatch,index;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;i<rules.length;i++)if((tempMatch=this._input.match(this.rules[rules[i]]))&&(!match||tempMatch[0].length>match[0].length)){if(match=tempMatch,index=i,this.options.backtrack_lexer){if(!1!==(token=this.test_match(tempMatch,rules[i])))return token;if(this._backtrack){match=!1;continue}return!1}if(!this.options.flex)break}return match?!1!==(token=this.test_match(match,rules[index]))&&token:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:__name(function(){var r=this.next();return r||this.lex()},"lex"),begin:__name(function(condition){this.conditionStack.push(condition)},"begin"),popState:__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:__name(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:__name(function(n){return(n=this.conditionStack.length-1-Math.abs(n||0))>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:__name(function(condition){this.begin(condition)},"pushState"),stateStackSize:__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:__name(function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:case 1:case 3:case 4:break;case 2:return 13;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}}();function Parser(){this.yy={}}return parser2.lexer=lexer,__name(Parser,"Parser"),Parser.prototype=parser2,parser2.Parser=Parser,new Parser}();parser.parser=parser;var timeline_default=parser,timelineDb_exports={};__export(timelineDb_exports,{addEvent:()=>addEvent,addSection:()=>addSection,addTask:()=>addTask,addTaskOrg:()=>addTaskOrg,clear:()=>clear2,default:()=>timelineDb_default,getCommonDb:()=>getCommonDb,getDirection:()=>getDirection,getSections:()=>getSections,getTasks:()=>getTasks,setDirection:()=>setDirection});var currentSection="",currentTaskId=0,direction="LR",sections=[],tasks=[],rawTasks=[],getCommonDb=__name(()=>commonDb_exports,"getCommonDb"),clear2=__name(function(){sections.length=0,tasks.length=0,currentSection="",rawTasks.length=0,direction="LR",clear()},"clear"),setDirection=__name(function(dir){direction=dir},"setDirection"),getDirection=__name(function(){return direction},"getDirection"),addSection=__name(function(txt){currentSection=txt,sections.push(txt)},"addSection"),getSections=__name(function(){return sections},"getSections"),getTasks=__name(function(){let allItemsProcessed=compileTasks();let iterationCount=0;for(;!allItemsProcessed&&iterationCount<100;)allItemsProcessed=compileTasks(),iterationCount++;return tasks.push(...rawTasks),tasks},"getTasks"),addTask=__name(function(period,length,event){const rawTask={id:currentTaskId++,section:currentSection,type:currentSection,task:period,score:length||0,events:event?[event]:[]};rawTasks.push(rawTask)},"addTask"),addEvent=__name(function(event){rawTasks.find(task=>task.id===currentTaskId-1).events.push(event)},"addEvent"),addTaskOrg=__name(function(descr){const newTask={section:currentSection,type:currentSection,description:descr,task:descr,classes:[]};tasks.push(newTask)},"addTaskOrg"),compileTasks=__name(function(){const compileTask=__name(function(pos){return rawTasks[pos].processed},"compileTask");let allProcessed=!0;for(const[i,rawTask]of rawTasks.entries())compileTask(i),allProcessed=allProcessed&&rawTask.processed;return allProcessed},"compileTasks"),timelineDb_default={clear:clear2,getCommonDb:getCommonDb,getDirection:getDirection,setDirection:setDirection,addSection:addSection,getSections:getSections,getTasks:getTasks,addTask:addTask,addTaskOrg:addTaskOrg,addEvent:addEvent},nodeCount=0,drawRect=__name(function(elem,rectData){const rectElem=elem.append("rect");return rectElem.attr("x",rectData.x),rectElem.attr("y",rectData.y),rectElem.attr("fill",rectData.fill),rectElem.attr("stroke",rectData.stroke),rectElem.attr("width",rectData.width),rectElem.attr("height",rectData.height),rectElem.attr("rx",rectData.rx),rectElem.attr("ry",rectData.ry),void 0!==rectData.class&&rectElem.attr("class",rectData.class),rectElem},"drawRect"),drawFace=__name(function(element,faceData){const circleElement=element.append("circle").attr("cx",faceData.cx).attr("cy",faceData.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),face=element.append("g");function smile(face2){const arc=d3arc().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+2)+")")}function sad(face2){const arc=d3arc().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+7)+")")}function ambivalent(face2){face2.append("line").attr("class","mouth").attr("stroke",2).attr("x1",faceData.cx-5).attr("y1",faceData.cy+7).attr("x2",faceData.cx+5).attr("y2",faceData.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return face.append("circle").attr("cx",faceData.cx-5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),face.append("circle").attr("cx",faceData.cx+5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),__name(smile,"smile"),__name(sad,"sad"),__name(ambivalent,"ambivalent"),faceData.score>3?smile(face):faceData.score<3?sad(face):ambivalent(face),circleElement},"drawFace"),drawCircle=__name(function(element,circleData){const circleElement=element.append("circle");return circleElement.attr("cx",circleData.cx),circleElement.attr("cy",circleData.cy),circleElement.attr("class","actor-"+circleData.pos),circleElement.attr("fill",circleData.fill),circleElement.attr("stroke",circleData.stroke),circleElement.attr("r",circleData.r),void 0!==circleElement.class&&circleElement.attr("class",circleElement.class),void 0!==circleData.title&&circleElement.append("title").text(circleData.title),circleElement},"drawCircle"),drawText=__name(function(elem,textData){const nText=textData.text.replace(/<br\s*\/?>/gi," "),textElem=elem.append("text");textElem.attr("x",textData.x),textElem.attr("y",textData.y),textElem.attr("class","legend"),textElem.style("text-anchor",textData.anchor),void 0!==textData.class&&textElem.attr("class",textData.class);const span=textElem.append("tspan");return span.attr("x",textData.x+2*textData.textMargin),span.text(nText),textElem},"drawText"),drawLabel=__name(function(elem,txtObject){function genPoints(x,y,width,height,cut){return x+","+y+" "+(x+width)+","+y+" "+(x+width)+","+(y+height-cut)+" "+(x+width-1.2*cut)+","+(y+height)+" "+x+","+(y+height)}__name(genPoints,"genPoints");const polygon=elem.append("polygon");polygon.attr("points",genPoints(txtObject.x,txtObject.y,50,20,7)),polygon.attr("class","labelBox"),txtObject.y=txtObject.y+txtObject.labelMargin,txtObject.x=txtObject.x+.5*txtObject.labelMargin,drawText(elem,txtObject)},"drawLabel"),drawSection=__name(function(elem,section,conf){const g=elem.append("g"),rect=getNoteRect();rect.x=section.x,rect.y=section.y,rect.fill=section.fill,rect.width=conf.width,rect.height=conf.height,rect.class="journey-section section-type-"+section.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(section.text,g,rect.x,rect.y,rect.width,rect.height,{class:"journey-section section-type-"+section.num},conf,section.colour)},"drawSection"),taskCount=-1,drawTask=__name(function(elem,task,conf,diagramId){const center=task.x+conf.width/2,g=elem.append("g");taskCount++;g.append("line").attr("id",diagramId+"-task"+taskCount).attr("x1",center).attr("y1",task.y).attr("x2",center).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),drawFace(g,{cx:center,cy:300+30*(5-task.score),score:task.score});const rect=getNoteRect();rect.x=task.x,rect.y=task.y,rect.fill=task.fill,rect.width=conf.width,rect.height=conf.height,rect.class="task task-type-"+task.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(task.task,g,rect.x,rect.y,rect.width,rect.height,{class:"task"},conf,task.colour)},"drawTask"),drawBackgroundRect=__name(function(elem,bounds){drawRect(elem,{x:bounds.startx,y:bounds.starty,width:bounds.stopx-bounds.startx,height:bounds.stopy-bounds.starty,fill:bounds.fill,class:"rect"}).lower()},"drawBackgroundRect"),getTextObj=__name(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),getNoteRect=__name(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),_drawTextCandidateFunc=function(){function byText(content,g,x,y,width,height,textAttrs,colour){_setTextAttrs(g.append("text").attr("x",x+width/2).attr("y",y+height/2+5).style("font-color",colour).style("text-anchor","middle").text(content),textAttrs)}function byTspan(content,g,x,y,width,height,textAttrs,conf,colour){const{taskFontSize:taskFontSize,taskFontFamily:taskFontFamily}=conf,lines=content.split(/<br\s*\/?>/gi);for(let i=0;i<lines.length;i++){const dy=i*taskFontSize-taskFontSize*(lines.length-1)/2,text=g.append("text").attr("x",x+width/2).attr("y",y).attr("fill",colour).style("text-anchor","middle").style("font-size",taskFontSize).style("font-family",taskFontFamily);text.append("tspan").attr("x",x+width/2).attr("dy",dy).text(lines[i]),text.attr("y",y+height/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),_setTextAttrs(text,textAttrs)}}function byFo(content,g,x,y,width,height,textAttrs,conf){const body=g.append("switch"),text=body.append("foreignObject").attr("x",x).attr("y",y).attr("width",width).attr("height",height).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");text.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(content),byTspan(content,body,x,y,width,height,textAttrs,conf),_setTextAttrs(text,textAttrs)}function _setTextAttrs(toText,fromTextAttrsDict){for(const key in fromTextAttrsDict)key in fromTextAttrsDict&&toText.attr(key,fromTextAttrsDict[key])}return __name(byText,"byText"),__name(byTspan,"byTspan"),__name(byFo,"byFo"),__name(_setTextAttrs,"_setTextAttrs"),function(conf){return"fo"===conf.textPlacement?byFo:"old"===conf.textPlacement?byText:byTspan}}(),initGraphics=__name(function(graphics,id){nodeCount=0,taskCount=-1,graphics.append("defs").append("marker").attr("id",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 wrap(text,width){text.each(function(){var word,text2=select(this),words=text2.text().split(/(\s+|<br>)/).reverse(),line=[],y=text2.attr("y"),dy=parseFloat(text2.attr("dy")),tspan=text2.text(null).append("tspan").attr("x",0).attr("y",y).attr("dy",dy+"em");for(let j=0;j<words.length;j++)word=words[words.length-1-j],line.push(word),tspan.text(line.join(" ").trim()),(tspan.node().getComputedTextLength()>width||"<br>"===word)&&(line.pop(),tspan.text(line.join(" ").trim()),line="<br>"===word?[""]:[word],tspan=text2.append("tspan").attr("x",0).attr("y",y).attr("dy","1.1em").text(word))})}__name(wrap,"wrap");var drawNode=__name(function(elem,node,fullSection,conf,diagramId,isEvent=!1){var _a,_b,_c;const{theme:theme,look:look}=conf,isReduxTheme=null==theme?void 0:theme.includes("redux"),section=fullSection%((null==(_a=null==conf?void 0:conf.themeVariables)?void 0:_a.THEME_COLOR_LIMIT)??12)-1,nodeElem=elem.append("g");node.section=section,nodeElem.attr("class",(node.class?node.class+" ":"")+"timeline-node section-"+section);const bkgElem=nodeElem.append("g"),textElem=nodeElem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_b=conf.fontSize)?void 0:_b.replace)?conf.fontSize.replace("px",""):conf.fontSize;if(node.height=bbox.height+1.1*fontSize*.5+node.padding,node.height=Math.max(node.height,node.maxHeight),node.width=node.width+2*node.padding,textElem.attr("transform","translate("+node.width/2+", "+node.padding/2+")"),isReduxTheme&&textElem.attr("transform",`translate(${node.width/2}, ${isEvent?node.padding/2+3:node.padding})`),defaultBkg(bkgElem,node,section,diagramId,conf),"neo"===look&&(nodeElem.attr("data-look","neo"),isReduxTheme)){const isDark2=theme.includes("dark"),rootSvgNode=(null==(_c=elem.node())?void 0:_c.ownerSVGElement)??elem.node(),rootSvg=select(rootSvgNode),svgId=rootSvg.attr("id")??"",dropShadowId=svgId?`${svgId}-drop-shadow`:"drop-shadow";if(rootSvg.select(`#${dropShadowId}`).empty()){const existingDefs=rootSvg.select("defs");(existingDefs.empty()?rootSvg.append("defs"):existingDefs).append("filter").attr("id",dropShadowId).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",isDark2?"0.2":"0.06").attr("flood-color",isDark2?"#FFFFFF":"#000000")}}return node},"drawNode"),getVirtualNodeHeight=__name(function(elem,node,conf){var _a;const textElem=elem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_a=conf.fontSize)?void 0:_a.replace)?conf.fontSize.replace("px",""):conf.fontSize;return textElem.remove(),bbox.height+1.1*fontSize*.5+node.padding},"getVirtualNodeHeight"),defaultBkg=__name(function(elem,node,section,diagramId,config){const{theme:theme}=config,r=(null==theme?void 0:theme.includes("redux"))?0:5,d=r>0?`M0 ${node.height-5} v${10-node.height} q0,-${r},${r},-${r} h${node.width-10} q${r},0,${r},${r} v${node.height-5} H0 Z`:`M0 ${node.height-5} v${-(node.height-5)} h${node.width} v${node.height} H0 Z`;elem.append("path").attr("id",diagramId+"-node-"+nodeCount++).attr("class","node-bkg node-"+node.type).attr("d",d),(null==theme?void 0:theme.includes("redux"))||elem.append("line").attr("class","node-line-"+section).attr("x1",0).attr("y1",node.height).attr("x2",node.width).attr("y2",node.height)},"defaultBkg"),svgDraw_default={drawRect:drawRect,drawCircle:drawCircle,drawSection:drawSection,drawText:drawText,drawLabel:drawLabel,drawTask:drawTask,drawBackgroundRect:drawBackgroundRect,getTextObj:getTextObj,getNoteRect:getNoteRect,initGraphics:initGraphics,drawNode:drawNode,getVirtualNodeHeight:getVirtualNodeHeight},draw=__name(function(text,id,version,diagObj){var _a,_b,_c;const conf=getConfig2(),{look:look,theme:theme,themeVariables:themeVariables}=conf,{useGradient:useGradient,gradientStart:gradientStart,gradientStop:gradientStop}=themeVariables,LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const securityLevel=conf.securityLevel;let sandboxElement;"sandbox"===securityLevel&&(sandboxElement=select("#i"+id));const svg=select("sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument.body:"body").select("#"+id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg,id);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0,depthY=0,sectionBeginY=0,masterX=50+LEFT_MARGIN,masterY=50;sectionBeginY=50;let sectionNumber=0,hasSections=!0;sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:150,padding:20,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight+20)});let maxEventCount=0,maxEventLineLength=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:150,padding:20,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight+20),maxEventCount=Math.max(maxEventCount,task.events.length);let maxEventLineLengthTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:150,padding:20,maxHeight:50};maxEventLineLengthTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventLineLengthTemp+=10*(task.events.length-1)),maxEventLineLength=Math.max(maxEventLineLength,maxEventLineLengthTemp)}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight),sections2&&sections2.length>0?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:200*Math.max(tasksForSection.length,1)-50,padding:20,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf,id);log.debug("sectionNode output",node),sectionNodeWrapper.attr("transform",`translate(${masterX}, 50)`),masterY+=maxSectionHeight+50,tasksForSection.length>0&&drawTasks(svg,tasksForSection,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!1,id),masterX+=200*Math.max(tasksForSection.length,1),masterY=50,sectionNumber++}):(hasSections=!1,drawTasks(svg,tasks2,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!0,id));const box=svg.node().getBBox();log.debug("bounds",box),title&&svg.append("text").text(title).attr("x","neo"===look?2*box.x+LEFT_MARGIN:box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),depthY=hasSections?maxSectionHeight+maxTaskHeight+150:maxTaskHeight+100;if(svg.append("g").attr("class","lineWrapper").append("line").attr("x1",LEFT_MARGIN).attr("y1",depthY).attr("x2",box.width+3*LEFT_MARGIN).attr("y2",depthY).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${id}-arrowhead)`),"neo"===look&&useGradient&&"neutral"!==theme){const existingDefs=svg.select("defs"),gradient=(existingDefs.empty()?svg.append("defs"):existingDefs).append("linearGradient").attr("id",svg.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");gradient.append("stop").attr("offset","0%").attr("stop-color",gradientStart).attr("stop-opacity",1),gradient.append("stop").attr("offset","100%").attr("stop-color",gradientStop).attr("stop-opacity",1)}setupGraphViewbox(void 0,svg,(null==(_b=conf.timeline)?void 0:_b.padding)??50,(null==(_c=conf.timeline)?void 0:_c.useMaxWidth)??!1)},"draw"),drawTasks=__name(function(diagram2,tasks2,sectionColor,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,isWithoutSections,diagramId){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),taskHeight=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf,diagramId).height;if(log.debug("taskHeight after draw",taskHeight),taskWrapper.attr("transform",`translate(${masterX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events){const lineWrapper=diagram2.append("g").attr("class","lineWrapper");let lineLength=maxTaskHeight;masterY+=100,lineLength+=drawEvents(diagram2,task.events,sectionColor,masterX,masterY,conf,diagramId),masterY-=100,lineWrapper.append("line").attr("x1",masterX+95).attr("y1",masterY+maxTaskHeight).attr("x2",masterX+95).attr("y2",masterY+maxTaskHeight+100+maxEventLineLength+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${diagramId}-arrowhead)`).attr("stroke-dasharray","5,5")}masterX+=200,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}masterY-=10},"drawTasks"),drawEvents=__name(function(diagram2,events,sectionColor,masterX,masterY,conf,diagramId){let maxEventHeight=0;const eventBeginY=masterY;masterY+=100;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:50};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf,diagramId,!0).height;maxEventHeight+=eventHeight,eventWrapper.attr("transform",`translate(${masterX}, ${masterY})`),masterY=masterY+10+eventHeight}return masterY=eventBeginY,maxEventHeight},"drawEvents"),timelineRenderer_default={setConf:__name(()=>{},"setConf"),draw:draw},draw2=__name(function(text,id,version,diagObj){var _a,_b,_c,_d,_e;const conf=getConfig2(),LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const svg=selectSvgElement(id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0;const masterX=50+LEFT_MARGIN;let masterY=50;const contentTopY=masterY,axisX=masterX+230;let sectionNumber=0;const hasSections=sections2&&sections2.length>0,timelineX=hasSections?axisX:masterX+230,sectionWidth=Math.max(50,580);sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight)});let maxEventStackHeight=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:200,padding:5,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight);let maxEventStackHeightTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:300,padding:5,maxHeight:50};maxEventStackHeightTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventStackHeightTemp+=10*(task.events.length-1)),maxEventStackHeight=Math.max(maxEventStackHeight,maxEventStackHeightTemp)+0}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight);const taskSpacing=Math.max(maxTaskHeight,maxEventStackHeight)+30;hasSections?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf);log.debug("sectionNode output",node);const sectionX=timelineX-230;sectionNodeWrapper.attr("transform",`translate(${sectionX}, ${masterY})`);const taskStartY=masterY+node.height+20;tasksForSection.length>0&&drawTasks2(svg,tasksForSection,sectionNumber,timelineX,taskStartY,maxTaskHeight,conf,taskSpacing,!1);const taskCount2=tasksForSection.length,sectionHeight=node.height+20+taskSpacing*Math.max(taskCount2,1)-(taskCount2>0?60:0);masterY+=sectionHeight,sectionNumber++}):drawTasks2(svg,tasks2,sectionNumber,timelineX,masterY,maxTaskHeight,conf,taskSpacing,!0);let box=null==(_b=svg.node())?void 0:_b.getBBox();if(!box)throw new Error("bbox not found");if(log.debug("bounds",box),title){if(svg.append("text").text(title).attr("x",box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),box=null==(_c=svg.node())?void 0:_c.getBBox(),!box)throw new Error("bbox not found");log.debug("bounds after title",box)}const[fontSize]=parseFontSize(conf.fontSize),arrowTopOffset=2*(fontSize??16),arrowBottomPadding=.5*(fontSize??16)+20,lineWrapper=svg.append("g").attr("class","lineWrapper");lineWrapper.append("line").attr("x1",timelineX).attr("y1",contentTopY-arrowTopOffset).attr("x2",timelineX).attr("y2",box.y+box.height+arrowBottomPadding).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),lineWrapper.lower(),setupGraphViewbox(void 0,svg,(null==(_d=conf.timeline)?void 0:_d.padding)??50,(null==(_e=conf.timeline)?void 0:_e.useMaxWidth)??!1)},"draw"),drawTasks2=__name(function(diagram2,tasks2,sectionColor,timelineX,masterY,maxTaskHeight,conf,taskSpacing,isWithoutSections){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:200,padding:5,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),node=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf),taskHeight=node.height;log.debug("taskHeight after draw",taskHeight);const taskX=timelineX-20-node.width;if(taskWrapper.attr("transform",`translate(${taskX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events&&task.events.length>0){const eventsStartY=masterY,eventsX=timelineX+50;drawEvents2(diagram2,task.events,sectionColor,timelineX,eventsX,eventsStartY,conf)}masterY+=taskSpacing,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}},"drawTasks"),drawEvents2=__name(function(diagram2,events,sectionColor,axisX,eventsX,startY,conf){let currentY=startY;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:300,padding:5,maxHeight:0};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf).height;eventWrapper.attr("transform",`translate(${eventsX}, ${currentY})`);const lineY=currentY+eventHeight/2;diagram2.append("g").attr("class","lineWrapper").append("line").attr("x1",axisX).attr("y1",lineY).attr("x2",eventsX).attr("y2",lineY).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),currentY=currentY+eventHeight+10}return currentY-startY},"drawEvents"),timelineRendererVertical_default={setConf:__name(()=>{},"setConf"),draw:draw2},genReduxSections=__name(options=>{var _a;const{theme:theme}=getConfig(),isDarkTheme=null==theme?void 0:theme.includes("dark"),isColorTheme=null==theme?void 0:theme.includes("color"),rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"",scopedDropShadow=rawSvgId?`url(#${rawSvgId}-drop-shadow)`:options.dropShadow??"none";let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i),color=isColorTheme?options.borderColorArray[i]:options.mainBkg,stroke=isColorTheme?options.borderColorArray[i]:options.nodeBorder;sections2+=`\n .section-${i-1} rect,\n .section-${i-1} path,\n .section-${i-1} circle {\n fill: ${isDarkTheme&&isColorTheme?options.mainBkg:color};\n stroke: ${stroke};\n stroke-width: ${options.strokeWidth};\n filter: ${scopedDropShadow};\n }\n\n .section-${i-1} text {\n fill: ${options.nodeBorder};\n font-weight: ${options.fontWeight}\n }\n\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n\n .section-edge-${i-1} {\n stroke: ${options["cScale"+i]};\n }\n\n .edge-depth-${i-1} {\n stroke-width: ${sw};\n }\n\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]};\n stroke-width: 3;\n }\n\n .lineWrapper line {\n stroke: ${options.nodeBorder};\n stroke-width:${options.strokeWidth}\n }\n\n .disabled,\n .disabled circle,\n .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genReduxSections"),genSections=__name(options=>{let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++)options["lineColor"+i]=options["lineColor"+i]||options["cScaleInv"+i],isDark(options["lineColor"+i])?options["lineColor"+i]=lighten(options["lineColor"+i],20):options["lineColor"+i]=darken(options["lineColor"+i],20);for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i);sections2+=`\n .section-${i-1} rect, .section-${i-1} path, .section-${i-1} circle, .section-${i-1} path {\n fill: ${options["cScale"+i]};\n }\n .section-${i-1} text {\n fill: ${options["cScaleLabel"+i]};\n }\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n .section-edge-${i-1}{\n stroke: ${options["cScale"+i]};\n }\n .edge-depth-${i-1}{\n stroke-width: ${sw};\n }\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${options["cScaleLabel"+i]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genSections"),styles_default=__name(options=>{var _a;const{theme:theme}=getConfig(),isReduxTheme=null==theme?void 0:theme.includes("redux"),isNeutralTheme="neutral"===theme,rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"";let gradientSections="";if(options.useGradient&&rawSvgId&&options.THEME_COLOR_LIMIT&&!isNeutralTheme)for(let i=0;i<options.THEME_COLOR_LIMIT;i++)gradientSections+=`\n .section-${i-1}[data-look="neo"] rect,\n .section-${i-1}[data-look="neo"] path,\n .section-${i-1}[data-look="neo"] circle {\n fill: ${options.mainBkg};\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }\n .section-${i-1}[data-look="neo"] line {\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }`;return`\n .edge {\n stroke-width: 3;\n }\n ${isReduxTheme?genReduxSections(options):genSections(options)}\n ${gradientSections}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${options.git0};\n }\n .section-root text {\n fill: ${options.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`},"getStyles"),diagram={db:timelineDb_exports,renderer:{setConf:__name(()=>{},"setConf"),draw:__name((text,id,version,diagObj)=>{var _a,_b;return"TD"===((null==(_b=null==(_a=null==diagObj?void 0:diagObj.db)?void 0:_a.getDirection)?void 0:_b.call(_a))??"LR")?timelineRendererVertical_default.draw(text,id,version,diagObj):timelineRenderer_default.draw(text,id,version,diagObj)},"draw")},parser:timeline_default,styles:styles_default};export{diagram};
1
+ import{_ as __name,C as getConfig,U as isDark,V as lighten,W as darken,c as getConfig2,l as log,H as selectSvgElement,M as parseFontSize,X as setupGraphViewbox,d as select,B as __export,Y as commonDb_exports,y as clear}from"./mermaid.core-CAsnLdlL.js";import{d as d3arc}from"./arc-DsQxkW5T.js";import"./vendor-mdxeditor-C7DYEBoH.js";import"./vendor-antd-BeN8xqGk.js";import"./vendor-codemirror-2nbmPewy.js";import"./vendor-markdown-BFrYfpb0.js";var parser=function(){var o=__name(function(k,v,o2,l){for(o2=o2||{},l=k.length;l--;o2[k[l]]=v);return o2},"o"),$V0=[6,11,13,14,15,17,19,20,23,24],$V1=[1,12],$V2=[1,13],$V3=[1,14],$V4=[1,15],$V5=[1,16],$V6=[1,19],$V7=[1,20],parser2={trace:__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:__name(function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 3:yy.setDirection("LR");break;case 4:yy.setDirection("TD");break;case 5:case 9:case 10:this.$=[];break;case 6:$$[$0-1].push($$[$0]),this.$=$$[$0-1];break;case 7:case 8:this.$=$$[$0];break;case 11:yy.getCommonDb().setDiagramTitle($$[$0].substr(6)),this.$=$$[$0].substr(6);break;case 12:this.$=$$[$0].trim(),yy.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=$$[$0].trim(),yy.getCommonDb().setAccDescription(this.$);break;case 15:yy.addSection($$[$0].substr(8)),this.$=$$[$0].substr(8);break;case 18:yy.addTask($$[$0],0,""),this.$=$$[$0];break;case 19:yy.addEvent($$[$0].substr(2)),this.$=$$[$0]}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},o($V0,[2,5],{5:6}),o($V0,[2,2]),o($V0,[2,3]),o($V0,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,10],{1:[2,1]}),o($V0,[2,6]),{12:21,14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,8]),o($V0,[2,9]),o($V0,[2,11]),{16:[1,22]},{18:[1,23]},o($V0,[2,14]),o($V0,[2,15]),o($V0,[2,16]),o($V0,[2,17]),o($V0,[2,18]),o($V0,[2,19]),o($V0,[2,7]),o($V0,[2,12]),o($V0,[2,13])],defaultActions:{},parseError:__name(function(str,hash){if(!hash.recoverable){var error=new Error(str);throw error.hash=hash,error}this.trace(str)},"parseError"),parse:__name(function(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,args=lstack.slice.call(arguments,1),lexer2=Object.create(this.lexer),sharedState={yy:{}};for(var k in this.yy)Object.prototype.hasOwnProperty.call(this.yy,k)&&(sharedState.yy[k]=this.yy[k]);lexer2.setInput(input,sharedState.yy),sharedState.yy.lexer=lexer2,sharedState.yy.parser=this,void 0===lexer2.yylloc&&(lexer2.yylloc={});var yyloc=lexer2.yylloc;lstack.push(yyloc);var ranges=lexer2.options&&lexer2.options.ranges;function lex(){var token;return"number"!=typeof(token=tstack.pop()||lexer2.lex()||1)&&(token instanceof Array&&(token=(tstack=token).pop()),token=self.symbols_[token]||token),token}"function"==typeof sharedState.yy.parseError?this.parseError=sharedState.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,__name(function(n){stack.length=stack.length-2*n,vstack.length=vstack.length-n,lstack.length=lstack.length-n},"popStack"),__name(lex,"lex");for(var symbol,state,action,r,p,len,newState,expected,yyval={};;){if(state=stack[stack.length-1],this.defaultActions[state]?action=this.defaultActions[state]:(null==symbol&&(symbol=lex()),action=table[state]&&table[state][symbol]),void 0===action||!action.length||!action[0]){var errStr="";for(p in expected=[],table[state])this.terminals_[p]&&p>2&&expected.push("'"+this.terminals_[p]+"'");errStr=lexer2.showPosition?"Parse error on line "+(yylineno+1)+":\n"+lexer2.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(1==symbol?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:lexer2.match,token:this.terminals_[symbol]||symbol,line:lexer2.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(lexer2.yytext),lstack.push(lexer2.yylloc),stack.push(action[1]),symbol=null,yyleng=lexer2.yyleng,yytext=lexer2.yytext,yylineno=lexer2.yylineno,yyloc=lexer2.yylloc;break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),void 0!==(r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args))))return r;len&&(stack=stack.slice(0,-1*len*2),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0},"parse")},lexer=function(){return{EOF:1,parseError:__name(function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},"parseError"),setInput:__name(function(input,yy){return this.yy=yy||this.yy||{},this._input=input,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:__name(function(){var ch=this._input[0];return this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch,ch.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},"input"),unput:__name(function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len),this.offset-=len;var oldLines=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),lines.length-1&&(this.yylineno-=lines.length-1);var r=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:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this.yyleng=this.yytext.length,this},"unput"),more:__name(function(){return this._more=!0,this},"more"),reject:__name(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:__name(function(n){this.unput(this.match.slice(n))},"less"),pastInput:__name(function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:__name(function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:__name(function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},"showPosition"),test_match:__name(function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer&&(backup={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&&(backup.yylloc.range=this.yylloc.range.slice(0))),(lines=match[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,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(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token)return token;if(this._backtrack){for(var k in backup)this[k]=backup[k];return!1}return!1},"test_match"),next:__name(function(){if(this.done)return this.EOF;var token,match,tempMatch,index;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;i<rules.length;i++)if((tempMatch=this._input.match(this.rules[rules[i]]))&&(!match||tempMatch[0].length>match[0].length)){if(match=tempMatch,index=i,this.options.backtrack_lexer){if(!1!==(token=this.test_match(tempMatch,rules[i])))return token;if(this._backtrack){match=!1;continue}return!1}if(!this.options.flex)break}return match?!1!==(token=this.test_match(match,rules[index]))&&token:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:__name(function(){var r=this.next();return r||this.lex()},"lex"),begin:__name(function(condition){this.conditionStack.push(condition)},"begin"),popState:__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:__name(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:__name(function(n){return(n=this.conditionStack.length-1-Math.abs(n||0))>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:__name(function(condition){this.begin(condition)},"pushState"),stateStackSize:__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:__name(function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:case 1:case 3:case 4:break;case 2:return 13;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}}();function Parser(){this.yy={}}return parser2.lexer=lexer,__name(Parser,"Parser"),Parser.prototype=parser2,parser2.Parser=Parser,new Parser}();parser.parser=parser;var timeline_default=parser,timelineDb_exports={};__export(timelineDb_exports,{addEvent:()=>addEvent,addSection:()=>addSection,addTask:()=>addTask,addTaskOrg:()=>addTaskOrg,clear:()=>clear2,default:()=>timelineDb_default,getCommonDb:()=>getCommonDb,getDirection:()=>getDirection,getSections:()=>getSections,getTasks:()=>getTasks,setDirection:()=>setDirection});var currentSection="",currentTaskId=0,direction="LR",sections=[],tasks=[],rawTasks=[],getCommonDb=__name(()=>commonDb_exports,"getCommonDb"),clear2=__name(function(){sections.length=0,tasks.length=0,currentSection="",rawTasks.length=0,direction="LR",clear()},"clear"),setDirection=__name(function(dir){direction=dir},"setDirection"),getDirection=__name(function(){return direction},"getDirection"),addSection=__name(function(txt){currentSection=txt,sections.push(txt)},"addSection"),getSections=__name(function(){return sections},"getSections"),getTasks=__name(function(){let allItemsProcessed=compileTasks();let iterationCount=0;for(;!allItemsProcessed&&iterationCount<100;)allItemsProcessed=compileTasks(),iterationCount++;return tasks.push(...rawTasks),tasks},"getTasks"),addTask=__name(function(period,length,event){const rawTask={id:currentTaskId++,section:currentSection,type:currentSection,task:period,score:length||0,events:event?[event]:[]};rawTasks.push(rawTask)},"addTask"),addEvent=__name(function(event){rawTasks.find(task=>task.id===currentTaskId-1).events.push(event)},"addEvent"),addTaskOrg=__name(function(descr){const newTask={section:currentSection,type:currentSection,description:descr,task:descr,classes:[]};tasks.push(newTask)},"addTaskOrg"),compileTasks=__name(function(){const compileTask=__name(function(pos){return rawTasks[pos].processed},"compileTask");let allProcessed=!0;for(const[i,rawTask]of rawTasks.entries())compileTask(i),allProcessed=allProcessed&&rawTask.processed;return allProcessed},"compileTasks"),timelineDb_default={clear:clear2,getCommonDb:getCommonDb,getDirection:getDirection,setDirection:setDirection,addSection:addSection,getSections:getSections,getTasks:getTasks,addTask:addTask,addTaskOrg:addTaskOrg,addEvent:addEvent},nodeCount=0,drawRect=__name(function(elem,rectData){const rectElem=elem.append("rect");return rectElem.attr("x",rectData.x),rectElem.attr("y",rectData.y),rectElem.attr("fill",rectData.fill),rectElem.attr("stroke",rectData.stroke),rectElem.attr("width",rectData.width),rectElem.attr("height",rectData.height),rectElem.attr("rx",rectData.rx),rectElem.attr("ry",rectData.ry),void 0!==rectData.class&&rectElem.attr("class",rectData.class),rectElem},"drawRect"),drawFace=__name(function(element,faceData){const circleElement=element.append("circle").attr("cx",faceData.cx).attr("cy",faceData.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),face=element.append("g");function smile(face2){const arc=d3arc().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+2)+")")}function sad(face2){const arc=d3arc().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+7)+")")}function ambivalent(face2){face2.append("line").attr("class","mouth").attr("stroke",2).attr("x1",faceData.cx-5).attr("y1",faceData.cy+7).attr("x2",faceData.cx+5).attr("y2",faceData.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return face.append("circle").attr("cx",faceData.cx-5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),face.append("circle").attr("cx",faceData.cx+5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),__name(smile,"smile"),__name(sad,"sad"),__name(ambivalent,"ambivalent"),faceData.score>3?smile(face):faceData.score<3?sad(face):ambivalent(face),circleElement},"drawFace"),drawCircle=__name(function(element,circleData){const circleElement=element.append("circle");return circleElement.attr("cx",circleData.cx),circleElement.attr("cy",circleData.cy),circleElement.attr("class","actor-"+circleData.pos),circleElement.attr("fill",circleData.fill),circleElement.attr("stroke",circleData.stroke),circleElement.attr("r",circleData.r),void 0!==circleElement.class&&circleElement.attr("class",circleElement.class),void 0!==circleData.title&&circleElement.append("title").text(circleData.title),circleElement},"drawCircle"),drawText=__name(function(elem,textData){const nText=textData.text.replace(/<br\s*\/?>/gi," "),textElem=elem.append("text");textElem.attr("x",textData.x),textElem.attr("y",textData.y),textElem.attr("class","legend"),textElem.style("text-anchor",textData.anchor),void 0!==textData.class&&textElem.attr("class",textData.class);const span=textElem.append("tspan");return span.attr("x",textData.x+2*textData.textMargin),span.text(nText),textElem},"drawText"),drawLabel=__name(function(elem,txtObject){function genPoints(x,y,width,height,cut){return x+","+y+" "+(x+width)+","+y+" "+(x+width)+","+(y+height-cut)+" "+(x+width-1.2*cut)+","+(y+height)+" "+x+","+(y+height)}__name(genPoints,"genPoints");const polygon=elem.append("polygon");polygon.attr("points",genPoints(txtObject.x,txtObject.y,50,20,7)),polygon.attr("class","labelBox"),txtObject.y=txtObject.y+txtObject.labelMargin,txtObject.x=txtObject.x+.5*txtObject.labelMargin,drawText(elem,txtObject)},"drawLabel"),drawSection=__name(function(elem,section,conf){const g=elem.append("g"),rect=getNoteRect();rect.x=section.x,rect.y=section.y,rect.fill=section.fill,rect.width=conf.width,rect.height=conf.height,rect.class="journey-section section-type-"+section.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(section.text,g,rect.x,rect.y,rect.width,rect.height,{class:"journey-section section-type-"+section.num},conf,section.colour)},"drawSection"),taskCount=-1,drawTask=__name(function(elem,task,conf,diagramId){const center=task.x+conf.width/2,g=elem.append("g");taskCount++;g.append("line").attr("id",diagramId+"-task"+taskCount).attr("x1",center).attr("y1",task.y).attr("x2",center).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),drawFace(g,{cx:center,cy:300+30*(5-task.score),score:task.score});const rect=getNoteRect();rect.x=task.x,rect.y=task.y,rect.fill=task.fill,rect.width=conf.width,rect.height=conf.height,rect.class="task task-type-"+task.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(task.task,g,rect.x,rect.y,rect.width,rect.height,{class:"task"},conf,task.colour)},"drawTask"),drawBackgroundRect=__name(function(elem,bounds){drawRect(elem,{x:bounds.startx,y:bounds.starty,width:bounds.stopx-bounds.startx,height:bounds.stopy-bounds.starty,fill:bounds.fill,class:"rect"}).lower()},"drawBackgroundRect"),getTextObj=__name(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),getNoteRect=__name(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),_drawTextCandidateFunc=function(){function byText(content,g,x,y,width,height,textAttrs,colour){_setTextAttrs(g.append("text").attr("x",x+width/2).attr("y",y+height/2+5).style("font-color",colour).style("text-anchor","middle").text(content),textAttrs)}function byTspan(content,g,x,y,width,height,textAttrs,conf,colour){const{taskFontSize:taskFontSize,taskFontFamily:taskFontFamily}=conf,lines=content.split(/<br\s*\/?>/gi);for(let i=0;i<lines.length;i++){const dy=i*taskFontSize-taskFontSize*(lines.length-1)/2,text=g.append("text").attr("x",x+width/2).attr("y",y).attr("fill",colour).style("text-anchor","middle").style("font-size",taskFontSize).style("font-family",taskFontFamily);text.append("tspan").attr("x",x+width/2).attr("dy",dy).text(lines[i]),text.attr("y",y+height/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),_setTextAttrs(text,textAttrs)}}function byFo(content,g,x,y,width,height,textAttrs,conf){const body=g.append("switch"),text=body.append("foreignObject").attr("x",x).attr("y",y).attr("width",width).attr("height",height).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");text.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(content),byTspan(content,body,x,y,width,height,textAttrs,conf),_setTextAttrs(text,textAttrs)}function _setTextAttrs(toText,fromTextAttrsDict){for(const key in fromTextAttrsDict)key in fromTextAttrsDict&&toText.attr(key,fromTextAttrsDict[key])}return __name(byText,"byText"),__name(byTspan,"byTspan"),__name(byFo,"byFo"),__name(_setTextAttrs,"_setTextAttrs"),function(conf){return"fo"===conf.textPlacement?byFo:"old"===conf.textPlacement?byText:byTspan}}(),initGraphics=__name(function(graphics,id){nodeCount=0,taskCount=-1,graphics.append("defs").append("marker").attr("id",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 wrap(text,width){text.each(function(){var word,text2=select(this),words=text2.text().split(/(\s+|<br>)/).reverse(),line=[],y=text2.attr("y"),dy=parseFloat(text2.attr("dy")),tspan=text2.text(null).append("tspan").attr("x",0).attr("y",y).attr("dy",dy+"em");for(let j=0;j<words.length;j++)word=words[words.length-1-j],line.push(word),tspan.text(line.join(" ").trim()),(tspan.node().getComputedTextLength()>width||"<br>"===word)&&(line.pop(),tspan.text(line.join(" ").trim()),line="<br>"===word?[""]:[word],tspan=text2.append("tspan").attr("x",0).attr("y",y).attr("dy","1.1em").text(word))})}__name(wrap,"wrap");var drawNode=__name(function(elem,node,fullSection,conf,diagramId,isEvent=!1){var _a,_b,_c;const{theme:theme,look:look}=conf,isReduxTheme=null==theme?void 0:theme.includes("redux"),section=fullSection%((null==(_a=null==conf?void 0:conf.themeVariables)?void 0:_a.THEME_COLOR_LIMIT)??12)-1,nodeElem=elem.append("g");node.section=section,nodeElem.attr("class",(node.class?node.class+" ":"")+"timeline-node section-"+section);const bkgElem=nodeElem.append("g"),textElem=nodeElem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_b=conf.fontSize)?void 0:_b.replace)?conf.fontSize.replace("px",""):conf.fontSize;if(node.height=bbox.height+1.1*fontSize*.5+node.padding,node.height=Math.max(node.height,node.maxHeight),node.width=node.width+2*node.padding,textElem.attr("transform","translate("+node.width/2+", "+node.padding/2+")"),isReduxTheme&&textElem.attr("transform",`translate(${node.width/2}, ${isEvent?node.padding/2+3:node.padding})`),defaultBkg(bkgElem,node,section,diagramId,conf),"neo"===look&&(nodeElem.attr("data-look","neo"),isReduxTheme)){const isDark2=theme.includes("dark"),rootSvgNode=(null==(_c=elem.node())?void 0:_c.ownerSVGElement)??elem.node(),rootSvg=select(rootSvgNode),svgId=rootSvg.attr("id")??"",dropShadowId=svgId?`${svgId}-drop-shadow`:"drop-shadow";if(rootSvg.select(`#${dropShadowId}`).empty()){const existingDefs=rootSvg.select("defs");(existingDefs.empty()?rootSvg.append("defs"):existingDefs).append("filter").attr("id",dropShadowId).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",isDark2?"0.2":"0.06").attr("flood-color",isDark2?"#FFFFFF":"#000000")}}return node},"drawNode"),getVirtualNodeHeight=__name(function(elem,node,conf){var _a;const textElem=elem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_a=conf.fontSize)?void 0:_a.replace)?conf.fontSize.replace("px",""):conf.fontSize;return textElem.remove(),bbox.height+1.1*fontSize*.5+node.padding},"getVirtualNodeHeight"),defaultBkg=__name(function(elem,node,section,diagramId,config){const{theme:theme}=config,r=(null==theme?void 0:theme.includes("redux"))?0:5,d=r>0?`M0 ${node.height-5} v${10-node.height} q0,-${r},${r},-${r} h${node.width-10} q${r},0,${r},${r} v${node.height-5} H0 Z`:`M0 ${node.height-5} v${-(node.height-5)} h${node.width} v${node.height} H0 Z`;elem.append("path").attr("id",diagramId+"-node-"+nodeCount++).attr("class","node-bkg node-"+node.type).attr("d",d),(null==theme?void 0:theme.includes("redux"))||elem.append("line").attr("class","node-line-"+section).attr("x1",0).attr("y1",node.height).attr("x2",node.width).attr("y2",node.height)},"defaultBkg"),svgDraw_default={drawRect:drawRect,drawCircle:drawCircle,drawSection:drawSection,drawText:drawText,drawLabel:drawLabel,drawTask:drawTask,drawBackgroundRect:drawBackgroundRect,getTextObj:getTextObj,getNoteRect:getNoteRect,initGraphics:initGraphics,drawNode:drawNode,getVirtualNodeHeight:getVirtualNodeHeight},draw=__name(function(text,id,version,diagObj){var _a,_b,_c;const conf=getConfig2(),{look:look,theme:theme,themeVariables:themeVariables}=conf,{useGradient:useGradient,gradientStart:gradientStart,gradientStop:gradientStop}=themeVariables,LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const securityLevel=conf.securityLevel;let sandboxElement;"sandbox"===securityLevel&&(sandboxElement=select("#i"+id));const svg=select("sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument.body:"body").select("#"+id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg,id);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0,depthY=0,sectionBeginY=0,masterX=50+LEFT_MARGIN,masterY=50;sectionBeginY=50;let sectionNumber=0,hasSections=!0;sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:150,padding:20,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight+20)});let maxEventCount=0,maxEventLineLength=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:150,padding:20,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight+20),maxEventCount=Math.max(maxEventCount,task.events.length);let maxEventLineLengthTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:150,padding:20,maxHeight:50};maxEventLineLengthTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventLineLengthTemp+=10*(task.events.length-1)),maxEventLineLength=Math.max(maxEventLineLength,maxEventLineLengthTemp)}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight),sections2&&sections2.length>0?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:200*Math.max(tasksForSection.length,1)-50,padding:20,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf,id);log.debug("sectionNode output",node),sectionNodeWrapper.attr("transform",`translate(${masterX}, 50)`),masterY+=maxSectionHeight+50,tasksForSection.length>0&&drawTasks(svg,tasksForSection,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!1,id),masterX+=200*Math.max(tasksForSection.length,1),masterY=50,sectionNumber++}):(hasSections=!1,drawTasks(svg,tasks2,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!0,id));const box=svg.node().getBBox();log.debug("bounds",box),title&&svg.append("text").text(title).attr("x","neo"===look?2*box.x+LEFT_MARGIN:box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),depthY=hasSections?maxSectionHeight+maxTaskHeight+150:maxTaskHeight+100;if(svg.append("g").attr("class","lineWrapper").append("line").attr("x1",LEFT_MARGIN).attr("y1",depthY).attr("x2",box.width+3*LEFT_MARGIN).attr("y2",depthY).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${id}-arrowhead)`),"neo"===look&&useGradient&&"neutral"!==theme){const existingDefs=svg.select("defs"),gradient=(existingDefs.empty()?svg.append("defs"):existingDefs).append("linearGradient").attr("id",svg.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");gradient.append("stop").attr("offset","0%").attr("stop-color",gradientStart).attr("stop-opacity",1),gradient.append("stop").attr("offset","100%").attr("stop-color",gradientStop).attr("stop-opacity",1)}setupGraphViewbox(void 0,svg,(null==(_b=conf.timeline)?void 0:_b.padding)??50,(null==(_c=conf.timeline)?void 0:_c.useMaxWidth)??!1)},"draw"),drawTasks=__name(function(diagram2,tasks2,sectionColor,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,isWithoutSections,diagramId){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),taskHeight=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf,diagramId).height;if(log.debug("taskHeight after draw",taskHeight),taskWrapper.attr("transform",`translate(${masterX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events){const lineWrapper=diagram2.append("g").attr("class","lineWrapper");let lineLength=maxTaskHeight;masterY+=100,lineLength+=drawEvents(diagram2,task.events,sectionColor,masterX,masterY,conf,diagramId),masterY-=100,lineWrapper.append("line").attr("x1",masterX+95).attr("y1",masterY+maxTaskHeight).attr("x2",masterX+95).attr("y2",masterY+maxTaskHeight+100+maxEventLineLength+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${diagramId}-arrowhead)`).attr("stroke-dasharray","5,5")}masterX+=200,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}masterY-=10},"drawTasks"),drawEvents=__name(function(diagram2,events,sectionColor,masterX,masterY,conf,diagramId){let maxEventHeight=0;const eventBeginY=masterY;masterY+=100;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:50};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf,diagramId,!0).height;maxEventHeight+=eventHeight,eventWrapper.attr("transform",`translate(${masterX}, ${masterY})`),masterY=masterY+10+eventHeight}return masterY=eventBeginY,maxEventHeight},"drawEvents"),timelineRenderer_default={setConf:__name(()=>{},"setConf"),draw:draw},draw2=__name(function(text,id,version,diagObj){var _a,_b,_c,_d,_e;const conf=getConfig2(),LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const svg=selectSvgElement(id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0;const masterX=50+LEFT_MARGIN;let masterY=50;const contentTopY=masterY,axisX=masterX+230;let sectionNumber=0;const hasSections=sections2&&sections2.length>0,timelineX=hasSections?axisX:masterX+230,sectionWidth=Math.max(50,580);sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight)});let maxEventStackHeight=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:200,padding:5,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight);let maxEventStackHeightTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:300,padding:5,maxHeight:50};maxEventStackHeightTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventStackHeightTemp+=10*(task.events.length-1)),maxEventStackHeight=Math.max(maxEventStackHeight,maxEventStackHeightTemp)+0}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight);const taskSpacing=Math.max(maxTaskHeight,maxEventStackHeight)+30;hasSections?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf);log.debug("sectionNode output",node);const sectionX=timelineX-230;sectionNodeWrapper.attr("transform",`translate(${sectionX}, ${masterY})`);const taskStartY=masterY+node.height+20;tasksForSection.length>0&&drawTasks2(svg,tasksForSection,sectionNumber,timelineX,taskStartY,maxTaskHeight,conf,taskSpacing,!1);const taskCount2=tasksForSection.length,sectionHeight=node.height+20+taskSpacing*Math.max(taskCount2,1)-(taskCount2>0?60:0);masterY+=sectionHeight,sectionNumber++}):drawTasks2(svg,tasks2,sectionNumber,timelineX,masterY,maxTaskHeight,conf,taskSpacing,!0);let box=null==(_b=svg.node())?void 0:_b.getBBox();if(!box)throw new Error("bbox not found");if(log.debug("bounds",box),title){if(svg.append("text").text(title).attr("x",box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),box=null==(_c=svg.node())?void 0:_c.getBBox(),!box)throw new Error("bbox not found");log.debug("bounds after title",box)}const[fontSize]=parseFontSize(conf.fontSize),arrowTopOffset=2*(fontSize??16),arrowBottomPadding=.5*(fontSize??16)+20,lineWrapper=svg.append("g").attr("class","lineWrapper");lineWrapper.append("line").attr("x1",timelineX).attr("y1",contentTopY-arrowTopOffset).attr("x2",timelineX).attr("y2",box.y+box.height+arrowBottomPadding).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),lineWrapper.lower(),setupGraphViewbox(void 0,svg,(null==(_d=conf.timeline)?void 0:_d.padding)??50,(null==(_e=conf.timeline)?void 0:_e.useMaxWidth)??!1)},"draw"),drawTasks2=__name(function(diagram2,tasks2,sectionColor,timelineX,masterY,maxTaskHeight,conf,taskSpacing,isWithoutSections){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:200,padding:5,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),node=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf),taskHeight=node.height;log.debug("taskHeight after draw",taskHeight);const taskX=timelineX-20-node.width;if(taskWrapper.attr("transform",`translate(${taskX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events&&task.events.length>0){const eventsStartY=masterY,eventsX=timelineX+50;drawEvents2(diagram2,task.events,sectionColor,timelineX,eventsX,eventsStartY,conf)}masterY+=taskSpacing,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}},"drawTasks"),drawEvents2=__name(function(diagram2,events,sectionColor,axisX,eventsX,startY,conf){let currentY=startY;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:300,padding:5,maxHeight:0};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf).height;eventWrapper.attr("transform",`translate(${eventsX}, ${currentY})`);const lineY=currentY+eventHeight/2;diagram2.append("g").attr("class","lineWrapper").append("line").attr("x1",axisX).attr("y1",lineY).attr("x2",eventsX).attr("y2",lineY).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),currentY=currentY+eventHeight+10}return currentY-startY},"drawEvents"),timelineRendererVertical_default={setConf:__name(()=>{},"setConf"),draw:draw2},genReduxSections=__name(options=>{var _a;const{theme:theme}=getConfig(),isDarkTheme=null==theme?void 0:theme.includes("dark"),isColorTheme=null==theme?void 0:theme.includes("color"),rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"",scopedDropShadow=rawSvgId?`url(#${rawSvgId}-drop-shadow)`:options.dropShadow??"none";let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i),color=isColorTheme?options.borderColorArray[i]:options.mainBkg,stroke=isColorTheme?options.borderColorArray[i]:options.nodeBorder;sections2+=`\n .section-${i-1} rect,\n .section-${i-1} path,\n .section-${i-1} circle {\n fill: ${isDarkTheme&&isColorTheme?options.mainBkg:color};\n stroke: ${stroke};\n stroke-width: ${options.strokeWidth};\n filter: ${scopedDropShadow};\n }\n\n .section-${i-1} text {\n fill: ${options.nodeBorder};\n font-weight: ${options.fontWeight}\n }\n\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n\n .section-edge-${i-1} {\n stroke: ${options["cScale"+i]};\n }\n\n .edge-depth-${i-1} {\n stroke-width: ${sw};\n }\n\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]};\n stroke-width: 3;\n }\n\n .lineWrapper line {\n stroke: ${options.nodeBorder};\n stroke-width:${options.strokeWidth}\n }\n\n .disabled,\n .disabled circle,\n .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genReduxSections"),genSections=__name(options=>{let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++)options["lineColor"+i]=options["lineColor"+i]||options["cScaleInv"+i],isDark(options["lineColor"+i])?options["lineColor"+i]=lighten(options["lineColor"+i],20):options["lineColor"+i]=darken(options["lineColor"+i],20);for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i);sections2+=`\n .section-${i-1} rect, .section-${i-1} path, .section-${i-1} circle, .section-${i-1} path {\n fill: ${options["cScale"+i]};\n }\n .section-${i-1} text {\n fill: ${options["cScaleLabel"+i]};\n }\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n .section-edge-${i-1}{\n stroke: ${options["cScale"+i]};\n }\n .edge-depth-${i-1}{\n stroke-width: ${sw};\n }\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${options["cScaleLabel"+i]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genSections"),styles_default=__name(options=>{var _a;const{theme:theme}=getConfig(),isReduxTheme=null==theme?void 0:theme.includes("redux"),isNeutralTheme="neutral"===theme,rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"";let gradientSections="";if(options.useGradient&&rawSvgId&&options.THEME_COLOR_LIMIT&&!isNeutralTheme)for(let i=0;i<options.THEME_COLOR_LIMIT;i++)gradientSections+=`\n .section-${i-1}[data-look="neo"] rect,\n .section-${i-1}[data-look="neo"] path,\n .section-${i-1}[data-look="neo"] circle {\n fill: ${options.mainBkg};\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }\n .section-${i-1}[data-look="neo"] line {\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }`;return`\n .edge {\n stroke-width: 3;\n }\n ${isReduxTheme?genReduxSections(options):genSections(options)}\n ${gradientSections}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${options.git0};\n }\n .section-root text {\n fill: ${options.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`},"getStyles"),diagram={db:timelineDb_exports,renderer:{setConf:__name(()=>{},"setConf"),draw:__name((text,id,version,diagObj)=>{var _a,_b;return"TD"===((null==(_b=null==(_a=null==diagObj?void 0:diagObj.db)?void 0:_a.getDirection)?void 0:_b.call(_a))??"LR")?timelineRendererVertical_default.draw(text,id,version,diagObj):timelineRenderer_default.draw(text,id,version,diagObj)},"draw")},parser:timeline_default,styles:styles_default};export{diagram};
@@ -0,0 +1 @@
1
+ var _a,__defProp=Object.defineProperty,__publicField=(obj,key,value)=>((obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value)(obj,"symbol"!=typeof key?key+"":key,value);const{entries:entries,setPrototypeOf:setPrototypeOf,isFrozen:isFrozen,getPrototypeOf:getPrototypeOf,getOwnPropertyDescriptor:getOwnPropertyDescriptor}=Object;let{freeze:freeze,seal:seal,create:create}=Object,{apply:apply,construct:construct}="undefined"!=typeof Reflect&&Reflect;freeze||(freeze=function(x2){return x2}),seal||(seal=function(x2){return x2}),apply||(apply=function(func,thisArg){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++)args[_key-2]=arguments[_key];return func.apply(thisArg,args)}),construct||(construct=function(Func){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return new Func(...args)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),arrayIsArray=Array.isArray,stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),numberToString=unapply(Number.prototype.toString),booleanToString=unapply(Boolean.prototype.toString),bigintToString="undefined"==typeof BigInt?null:unapply(BigInt.prototype.toString),symbolToString="undefined"==typeof Symbol?null:unapply(Symbol.prototype.toString),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),objectToString=unapply(Object.prototype.toString),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=(Func=TypeError,function(){for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++)args[_key4]=arguments[_key4];return construct(Func,args)});var Func;function unapply(func){return function(thisArg){thisArg instanceof RegExp&&(thisArg.lastIndex=0);for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++)args[_key3-1]=arguments[_key3];return apply(func,thisArg,args)}}function addToSet(set,array){let transformCaseFunc=arguments.length>2&&void 0!==arguments[2]?arguments[2]:stringToLowerCase;if(setPrototypeOf&&setPrototypeOf(set,null),!arrayIsArray(array))return set;let l=array.length;for(;l--;){let element=array[l];if("string"==typeof element){const lcElement=transformCaseFunc(element);lcElement!==element&&(isFrozen(array)||(array[l]=lcElement),element=lcElement)}set[element]=!0}return set}function cleanArray(array){for(let index=0;index<array.length;index++){objectHasOwnProperty(array,index)||(array[index]=null)}return array}function clone(object){const newObject=create(null);for(const[property,value]of entries(object)){objectHasOwnProperty(object,property)&&(arrayIsArray(value)?newObject[property]=cleanArray(value):value&&"object"==typeof value&&value.constructor===Object?newObject[property]=clone(value):newObject[property]=value)}return newObject}function lookupGetter(object,prop){for(;null!==object;){const desc=getOwnPropertyDescriptor(object,prop);if(desc){if(desc.get)return unapply(desc.get);if("function"==typeof desc.value)return unapply(desc.value)}object=getPrototypeOf(object)}return function(){return null}}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR:ARIA_ATTR,ATTR_WHITESPACE:ATTR_WHITESPACE,CUSTOM_ELEMENT:CUSTOM_ELEMENT,DATA_ATTR:DATA_ATTR,DOCTYPE_NAME:DOCTYPE_NAME,ERB_EXPR:ERB_EXPR,IS_ALLOWED_URI:IS_ALLOWED_URI,IS_SCRIPT_OR_DATA:IS_SCRIPT_OR_DATA,MUSTACHE_EXPR:MUSTACHE_EXPR,TMPLIT_EXPR:TMPLIT_EXPR});const NODE_TYPE_element=1,NODE_TYPE_text=3,NODE_TYPE_progressingInstruction=7,NODE_TYPE_comment=8,NODE_TYPE_document=9;var purify=function createDOMPurify(){let window2=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const DOMPurify=root=>createDOMPurify(root);if(DOMPurify.version="3.4.2",DOMPurify.removed=[],!window2||!window2.document||window2.document.nodeType!==NODE_TYPE_document||!window2.Element)return DOMPurify.isSupported=!1,DOMPurify;let{document:document}=window2;const originalDocument=document,currentScript=originalDocument.currentScript,{DocumentFragment:DocumentFragment,HTMLTemplateElement:HTMLTemplateElement,Node:Node,Element:Element,NodeFilter:NodeFilter,NamedNodeMap:NamedNodeMap=window2.NamedNodeMap||window2.MozNamedAttrMap,HTMLFormElement:HTMLFormElement,DOMParser:DOMParser,trustedTypes:trustedTypes}=window2,ElementPrototype=Element.prototype,cloneNode=lookupGetter(ElementPrototype,"cloneNode"),remove=lookupGetter(ElementPrototype,"remove"),getNextSibling=lookupGetter(ElementPrototype,"nextSibling"),getChildNodes=lookupGetter(ElementPrototype,"childNodes"),getParentNode=lookupGetter(ElementPrototype,"parentNode");if("function"==typeof HTMLTemplateElement){const template=document.createElement("template");template.content&&template.content.ownerDocument&&(document=template.content.ownerDocument)}let trustedTypesPolicy,emptyHTML="";const{implementation:implementation,createNodeIterator:createNodeIterator,createDocumentFragment:createDocumentFragment,getElementsByTagName:getElementsByTagName}=document,{importNode:importNode}=originalDocument;let hooks={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};DOMPurify.isSupported="function"==typeof entries&&"function"==typeof getParentNode&&implementation&&void 0!==implementation.createHTMLDocument;const{MUSTACHE_EXPR:MUSTACHE_EXPR2,ERB_EXPR:ERB_EXPR2,TMPLIT_EXPR:TMPLIT_EXPR2,DATA_ATTR:DATA_ATTR2,ARIA_ATTR:ARIA_ATTR2,IS_SCRIPT_OR_DATA:IS_SCRIPT_OR_DATA2,ATTR_WHITESPACE:ATTR_WHITESPACE2,CUSTOM_ELEMENT:CUSTOM_ELEMENT2}=EXPRESSIONS;let{IS_ALLOWED_URI:IS_ALLOWED_URI$1}=EXPRESSIONS,ALLOWED_TAGS=null;const DEFAULT_ALLOWED_TAGS=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let ALLOWED_ATTR=null;const DEFAULT_ALLOWED_ATTR=addToSet({},[...html,...svg,...mathMl,...xml]);let CUSTOM_ELEMENT_HANDLING=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),FORBID_TAGS=null,FORBID_ATTR=null;const EXTRA_ELEMENT_HANDLING=Object.seal(create(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ALLOW_ARIA_ATTR=!0,ALLOW_DATA_ATTR=!0,ALLOW_UNKNOWN_PROTOCOLS=!1,ALLOW_SELF_CLOSE_IN_ATTR=!0,SAFE_FOR_TEMPLATES=!1,SAFE_FOR_XML=!0,WHOLE_DOCUMENT=!1,SET_CONFIG=!1,FORCE_BODY=!1,RETURN_DOM=!1,RETURN_DOM_FRAGMENT=!1,RETURN_TRUSTED_TYPE=!1,SANITIZE_DOM=!0,SANITIZE_NAMED_PROPS=!1,KEEP_CONTENT=!0,IN_PLACE=!1,USE_PROFILES={},FORBID_CONTENTS=null;const DEFAULT_FORBID_CONTENTS=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let DATA_URI_TAGS=null;const DEFAULT_DATA_URI_TAGS=addToSet({},["audio","video","img","source","image","track"]);let URI_SAFE_ATTRIBUTES=null;const DEFAULT_URI_SAFE_ATTRIBUTES=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),MATHML_NAMESPACE="http://www.w3.org/1998/Math/MathML",SVG_NAMESPACE="http://www.w3.org/2000/svg",HTML_NAMESPACE="http://www.w3.org/1999/xhtml";let NAMESPACE=HTML_NAMESPACE,IS_EMPTY_INPUT=!1,ALLOWED_NAMESPACES=null;const DEFAULT_ALLOWED_NAMESPACES=addToSet({},[MATHML_NAMESPACE,SVG_NAMESPACE,HTML_NAMESPACE],stringToString);let MATHML_TEXT_INTEGRATION_POINTS=addToSet({},["mi","mo","mn","ms","mtext"]),HTML_INTEGRATION_POINTS=addToSet({},["annotation-xml"]);const COMMON_SVG_AND_HTML_ELEMENTS=addToSet({},["title","style","font","a","script"]);let PARSER_MEDIA_TYPE=null;const SUPPORTED_PARSER_MEDIA_TYPES=["application/xhtml+xml","text/html"];let transformCaseFunc=null,CONFIG=null;const formElement=document.createElement("form"),isRegexOrFunction=function(testValue){return testValue instanceof RegExp||testValue instanceof Function},_parseConfig=function(){let cfg=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(CONFIG&&CONFIG===cfg)return;cfg&&"object"==typeof cfg||(cfg={}),cfg=clone(cfg),PARSER_MEDIA_TYPE=-1===SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE)?"text/html":cfg.PARSER_MEDIA_TYPE,transformCaseFunc="application/xhtml+xml"===PARSER_MEDIA_TYPE?stringToString:stringToLowerCase,ALLOWED_TAGS=objectHasOwnProperty(cfg,"ALLOWED_TAGS")&&arrayIsArray(cfg.ALLOWED_TAGS)?addToSet({},cfg.ALLOWED_TAGS,transformCaseFunc):DEFAULT_ALLOWED_TAGS,ALLOWED_ATTR=objectHasOwnProperty(cfg,"ALLOWED_ATTR")&&arrayIsArray(cfg.ALLOWED_ATTR)?addToSet({},cfg.ALLOWED_ATTR,transformCaseFunc):DEFAULT_ALLOWED_ATTR,ALLOWED_NAMESPACES=objectHasOwnProperty(cfg,"ALLOWED_NAMESPACES")&&arrayIsArray(cfg.ALLOWED_NAMESPACES)?addToSet({},cfg.ALLOWED_NAMESPACES,stringToString):DEFAULT_ALLOWED_NAMESPACES,URI_SAFE_ATTRIBUTES=objectHasOwnProperty(cfg,"ADD_URI_SAFE_ATTR")&&arrayIsArray(cfg.ADD_URI_SAFE_ATTR)?addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),cfg.ADD_URI_SAFE_ATTR,transformCaseFunc):DEFAULT_URI_SAFE_ATTRIBUTES,DATA_URI_TAGS=objectHasOwnProperty(cfg,"ADD_DATA_URI_TAGS")&&arrayIsArray(cfg.ADD_DATA_URI_TAGS)?addToSet(clone(DEFAULT_DATA_URI_TAGS),cfg.ADD_DATA_URI_TAGS,transformCaseFunc):DEFAULT_DATA_URI_TAGS,FORBID_CONTENTS=objectHasOwnProperty(cfg,"FORBID_CONTENTS")&&arrayIsArray(cfg.FORBID_CONTENTS)?addToSet({},cfg.FORBID_CONTENTS,transformCaseFunc):DEFAULT_FORBID_CONTENTS,FORBID_TAGS=objectHasOwnProperty(cfg,"FORBID_TAGS")&&arrayIsArray(cfg.FORBID_TAGS)?addToSet({},cfg.FORBID_TAGS,transformCaseFunc):clone({}),FORBID_ATTR=objectHasOwnProperty(cfg,"FORBID_ATTR")&&arrayIsArray(cfg.FORBID_ATTR)?addToSet({},cfg.FORBID_ATTR,transformCaseFunc):clone({}),USE_PROFILES=!!objectHasOwnProperty(cfg,"USE_PROFILES")&&(cfg.USE_PROFILES&&"object"==typeof cfg.USE_PROFILES?clone(cfg.USE_PROFILES):cfg.USE_PROFILES),ALLOW_ARIA_ATTR=!1!==cfg.ALLOW_ARIA_ATTR,ALLOW_DATA_ATTR=!1!==cfg.ALLOW_DATA_ATTR,ALLOW_UNKNOWN_PROTOCOLS=cfg.ALLOW_UNKNOWN_PROTOCOLS||!1,ALLOW_SELF_CLOSE_IN_ATTR=!1!==cfg.ALLOW_SELF_CLOSE_IN_ATTR,SAFE_FOR_TEMPLATES=cfg.SAFE_FOR_TEMPLATES||!1,SAFE_FOR_XML=!1!==cfg.SAFE_FOR_XML,WHOLE_DOCUMENT=cfg.WHOLE_DOCUMENT||!1,RETURN_DOM=cfg.RETURN_DOM||!1,RETURN_DOM_FRAGMENT=cfg.RETURN_DOM_FRAGMENT||!1,RETURN_TRUSTED_TYPE=cfg.RETURN_TRUSTED_TYPE||!1,FORCE_BODY=cfg.FORCE_BODY||!1,SANITIZE_DOM=!1!==cfg.SANITIZE_DOM,SANITIZE_NAMED_PROPS=cfg.SANITIZE_NAMED_PROPS||!1,KEEP_CONTENT=!1!==cfg.KEEP_CONTENT,IN_PLACE=cfg.IN_PLACE||!1,IS_ALLOWED_URI$1=function(value){try{return regExpTest(value,""),!0}catch(_unused){return!1}}(cfg.ALLOWED_URI_REGEXP)?cfg.ALLOWED_URI_REGEXP:IS_ALLOWED_URI,NAMESPACE="string"==typeof cfg.NAMESPACE?cfg.NAMESPACE:HTML_NAMESPACE,MATHML_TEXT_INTEGRATION_POINTS=objectHasOwnProperty(cfg,"MATHML_TEXT_INTEGRATION_POINTS")&&cfg.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof cfg.MATHML_TEXT_INTEGRATION_POINTS?clone(cfg.MATHML_TEXT_INTEGRATION_POINTS):addToSet({},["mi","mo","mn","ms","mtext"]),HTML_INTEGRATION_POINTS=objectHasOwnProperty(cfg,"HTML_INTEGRATION_POINTS")&&cfg.HTML_INTEGRATION_POINTS&&"object"==typeof cfg.HTML_INTEGRATION_POINTS?clone(cfg.HTML_INTEGRATION_POINTS):addToSet({},["annotation-xml"]);const customElementHandling=objectHasOwnProperty(cfg,"CUSTOM_ELEMENT_HANDLING")&&cfg.CUSTOM_ELEMENT_HANDLING&&"object"==typeof cfg.CUSTOM_ELEMENT_HANDLING?clone(cfg.CUSTOM_ELEMENT_HANDLING):create(null);if(CUSTOM_ELEMENT_HANDLING=create(null),objectHasOwnProperty(customElementHandling,"tagNameCheck")&&isRegexOrFunction(customElementHandling.tagNameCheck)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck=customElementHandling.tagNameCheck),objectHasOwnProperty(customElementHandling,"attributeNameCheck")&&isRegexOrFunction(customElementHandling.attributeNameCheck)&&(CUSTOM_ELEMENT_HANDLING.attributeNameCheck=customElementHandling.attributeNameCheck),objectHasOwnProperty(customElementHandling,"allowCustomizedBuiltInElements")&&"boolean"==typeof customElementHandling.allowCustomizedBuiltInElements&&(CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=customElementHandling.allowCustomizedBuiltInElements),SAFE_FOR_TEMPLATES&&(ALLOW_DATA_ATTR=!1),RETURN_DOM_FRAGMENT&&(RETURN_DOM=!0),USE_PROFILES&&(ALLOWED_TAGS=addToSet({},text),ALLOWED_ATTR=create(null),!0===USE_PROFILES.html&&(addToSet(ALLOWED_TAGS,html$1),addToSet(ALLOWED_ATTR,html)),!0===USE_PROFILES.svg&&(addToSet(ALLOWED_TAGS,svg$1),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),!0===USE_PROFILES.svgFilters&&(addToSet(ALLOWED_TAGS,svgFilters),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),!0===USE_PROFILES.mathMl&&(addToSet(ALLOWED_TAGS,mathMl$1),addToSet(ALLOWED_ATTR,mathMl),addToSet(ALLOWED_ATTR,xml))),EXTRA_ELEMENT_HANDLING.tagCheck=null,EXTRA_ELEMENT_HANDLING.attributeCheck=null,objectHasOwnProperty(cfg,"ADD_TAGS")&&("function"==typeof cfg.ADD_TAGS?EXTRA_ELEMENT_HANDLING.tagCheck=cfg.ADD_TAGS:arrayIsArray(cfg.ADD_TAGS)&&(ALLOWED_TAGS===DEFAULT_ALLOWED_TAGS&&(ALLOWED_TAGS=clone(ALLOWED_TAGS)),addToSet(ALLOWED_TAGS,cfg.ADD_TAGS,transformCaseFunc))),objectHasOwnProperty(cfg,"ADD_ATTR")&&("function"==typeof cfg.ADD_ATTR?EXTRA_ELEMENT_HANDLING.attributeCheck=cfg.ADD_ATTR:arrayIsArray(cfg.ADD_ATTR)&&(ALLOWED_ATTR===DEFAULT_ALLOWED_ATTR&&(ALLOWED_ATTR=clone(ALLOWED_ATTR)),addToSet(ALLOWED_ATTR,cfg.ADD_ATTR,transformCaseFunc))),objectHasOwnProperty(cfg,"ADD_URI_SAFE_ATTR")&&arrayIsArray(cfg.ADD_URI_SAFE_ATTR)&&addToSet(URI_SAFE_ATTRIBUTES,cfg.ADD_URI_SAFE_ATTR,transformCaseFunc),objectHasOwnProperty(cfg,"FORBID_CONTENTS")&&arrayIsArray(cfg.FORBID_CONTENTS)&&(FORBID_CONTENTS===DEFAULT_FORBID_CONTENTS&&(FORBID_CONTENTS=clone(FORBID_CONTENTS)),addToSet(FORBID_CONTENTS,cfg.FORBID_CONTENTS,transformCaseFunc)),objectHasOwnProperty(cfg,"ADD_FORBID_CONTENTS")&&arrayIsArray(cfg.ADD_FORBID_CONTENTS)&&(FORBID_CONTENTS===DEFAULT_FORBID_CONTENTS&&(FORBID_CONTENTS=clone(FORBID_CONTENTS)),addToSet(FORBID_CONTENTS,cfg.ADD_FORBID_CONTENTS,transformCaseFunc)),KEEP_CONTENT&&(ALLOWED_TAGS["#text"]=!0),WHOLE_DOCUMENT&&addToSet(ALLOWED_TAGS,["html","head","body"]),ALLOWED_TAGS.table&&(addToSet(ALLOWED_TAGS,["tbody"]),delete FORBID_TAGS.tbody),cfg.TRUSTED_TYPES_POLICY){if("function"!=typeof cfg.TRUSTED_TYPES_POLICY.createHTML)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');trustedTypesPolicy=cfg.TRUSTED_TYPES_POLICY,emptyHTML=trustedTypesPolicy.createHTML("")}else void 0===trustedTypesPolicy&&(trustedTypesPolicy=function(trustedTypes,purifyHostElement){if("object"!=typeof trustedTypes||"function"!=typeof trustedTypes.createPolicy)return null;let suffix=null;purifyHostElement&&purifyHostElement.hasAttribute("data-tt-policy-suffix")&&(suffix=purifyHostElement.getAttribute("data-tt-policy-suffix"));const policyName="dompurify"+(suffix?"#"+suffix:"");try{return trustedTypes.createPolicy(policyName,{createHTML:html2=>html2,createScriptURL:scriptUrl=>scriptUrl})}catch(_2){return console.warn("TrustedTypes policy "+policyName+" could not be created."),null}}(trustedTypes,currentScript)),null!==trustedTypesPolicy&&"string"==typeof emptyHTML&&(emptyHTML=trustedTypesPolicy.createHTML(""));freeze&&freeze(cfg),CONFIG=cfg},ALL_SVG_TAGS=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),ALL_MATHML_TAGS=addToSet({},[...mathMl$1,...mathMlDisallowed]),_forceRemove=function(node){arrayPush(DOMPurify.removed,{element:node});try{getParentNode(node).removeChild(node)}catch(_2){remove(node)}},_removeAttribute=function(name,element){try{arrayPush(DOMPurify.removed,{attribute:element.getAttributeNode(name),from:element})}catch(_2){arrayPush(DOMPurify.removed,{attribute:null,from:element})}if(element.removeAttribute(name),"is"===name)if(RETURN_DOM||RETURN_DOM_FRAGMENT)try{_forceRemove(element)}catch(_2){}else try{element.setAttribute(name,"")}catch(_2){}},_initDocument=function(dirty){let doc=null,leadingWhitespace=null;if(FORCE_BODY)dirty="<remove></remove>"+dirty;else{const matches=stringMatch(dirty,/^[\r\n\t ]+/);leadingWhitespace=matches&&matches[0]}"application/xhtml+xml"===PARSER_MEDIA_TYPE&&NAMESPACE===HTML_NAMESPACE&&(dirty='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+dirty+"</body></html>");const dirtyPayload=trustedTypesPolicy?trustedTypesPolicy.createHTML(dirty):dirty;if(NAMESPACE===HTML_NAMESPACE)try{doc=(new DOMParser).parseFromString(dirtyPayload,PARSER_MEDIA_TYPE)}catch(_2){}if(!doc||!doc.documentElement){doc=implementation.createDocument(NAMESPACE,"template",null);try{doc.documentElement.innerHTML=IS_EMPTY_INPUT?emptyHTML:dirtyPayload}catch(_2){}}const body=doc.body||doc.documentElement;return dirty&&leadingWhitespace&&body.insertBefore(document.createTextNode(leadingWhitespace),body.childNodes[0]||null),NAMESPACE===HTML_NAMESPACE?getElementsByTagName.call(doc,WHOLE_DOCUMENT?"html":"body")[0]:WHOLE_DOCUMENT?doc.documentElement:body},_createNodeIterator=function(root){return createNodeIterator.call(root.ownerDocument||root,root,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_PROCESSING_INSTRUCTION|NodeFilter.SHOW_CDATA_SECTION,null)},_isClobbered=function(element){return element instanceof HTMLFormElement&&("string"!=typeof element.nodeName||"string"!=typeof element.textContent||"function"!=typeof element.removeChild||!(element.attributes instanceof NamedNodeMap)||"function"!=typeof element.removeAttribute||"function"!=typeof element.setAttribute||"string"!=typeof element.namespaceURI||"function"!=typeof element.insertBefore||"function"!=typeof element.hasChildNodes)},_isNode=function(value){return"function"==typeof Node&&value instanceof Node};function _executeHooks(hooks2,currentNode,data){arrayForEach(hooks2,hook=>{hook.call(DOMPurify,currentNode,data,CONFIG)})}const _sanitizeElements=function(currentNode){let content=null;if(_executeHooks(hooks.beforeSanitizeElements,currentNode,null),_isClobbered(currentNode))return _forceRemove(currentNode),!0;const tagName=transformCaseFunc(currentNode.nodeName);if(_executeHooks(hooks.uponSanitizeElement,currentNode,{tagName:tagName,allowedTags:ALLOWED_TAGS}),SAFE_FOR_XML&&currentNode.hasChildNodes()&&!_isNode(currentNode.firstElementChild)&&regExpTest(/<[/\w!]/g,currentNode.innerHTML)&&regExpTest(/<[/\w!]/g,currentNode.textContent))return _forceRemove(currentNode),!0;if(SAFE_FOR_XML&&currentNode.namespaceURI===HTML_NAMESPACE&&"style"===tagName&&_isNode(currentNode.firstElementChild))return _forceRemove(currentNode),!0;if(currentNode.nodeType===NODE_TYPE_progressingInstruction)return _forceRemove(currentNode),!0;if(SAFE_FOR_XML&&currentNode.nodeType===NODE_TYPE_comment&&regExpTest(/<[/\w]/g,currentNode.data))return _forceRemove(currentNode),!0;if(FORBID_TAGS[tagName]||!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function&&EXTRA_ELEMENT_HANDLING.tagCheck(tagName))&&!ALLOWED_TAGS[tagName]){if(!FORBID_TAGS[tagName]&&_isBasicCustomElement(tagName)){if(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,tagName))return!1;if(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName))return!1}if(KEEP_CONTENT&&!FORBID_CONTENTS[tagName]){const parentNode=getParentNode(currentNode)||currentNode.parentNode,childNodes=getChildNodes(currentNode)||currentNode.childNodes;if(childNodes&&parentNode){for(let i=childNodes.length-1;i>=0;--i){const childClone=cloneNode(childNodes[i],!0);parentNode.insertBefore(childClone,getNextSibling(currentNode))}}}return _forceRemove(currentNode),!0}return currentNode instanceof Element&&!function(element){let parent=getParentNode(element);parent&&parent.tagName||(parent={namespaceURI:NAMESPACE,tagName:"template"});const tagName=stringToLowerCase(element.tagName),parentTagName=stringToLowerCase(parent.tagName);return!!ALLOWED_NAMESPACES[element.namespaceURI]&&(element.namespaceURI===SVG_NAMESPACE?parent.namespaceURI===HTML_NAMESPACE?"svg"===tagName:parent.namespaceURI===MATHML_NAMESPACE?"svg"===tagName&&("annotation-xml"===parentTagName||MATHML_TEXT_INTEGRATION_POINTS[parentTagName]):Boolean(ALL_SVG_TAGS[tagName]):element.namespaceURI===MATHML_NAMESPACE?parent.namespaceURI===HTML_NAMESPACE?"math"===tagName:parent.namespaceURI===SVG_NAMESPACE?"math"===tagName&&HTML_INTEGRATION_POINTS[parentTagName]:Boolean(ALL_MATHML_TAGS[tagName]):element.namespaceURI===HTML_NAMESPACE?!(parent.namespaceURI===SVG_NAMESPACE&&!HTML_INTEGRATION_POINTS[parentTagName])&&!(parent.namespaceURI===MATHML_NAMESPACE&&!MATHML_TEXT_INTEGRATION_POINTS[parentTagName])&&!ALL_MATHML_TAGS[tagName]&&(COMMON_SVG_AND_HTML_ELEMENTS[tagName]||!ALL_SVG_TAGS[tagName]):!("application/xhtml+xml"!==PARSER_MEDIA_TYPE||!ALLOWED_NAMESPACES[element.namespaceURI]))}(currentNode)?(_forceRemove(currentNode),!0):"noscript"!==tagName&&"noembed"!==tagName&&"noframes"!==tagName||!regExpTest(/<\/no(script|embed|frames)/i,currentNode.innerHTML)?(SAFE_FOR_TEMPLATES&&currentNode.nodeType===NODE_TYPE_text&&(content=currentNode.textContent,arrayForEach([MUSTACHE_EXPR2,ERB_EXPR2,TMPLIT_EXPR2],expr=>{content=stringReplace(content,expr," ")}),currentNode.textContent!==content&&(arrayPush(DOMPurify.removed,{element:currentNode.cloneNode()}),currentNode.textContent=content)),_executeHooks(hooks.afterSanitizeElements,currentNode,null),!1):(_forceRemove(currentNode),!0)},_isValidAttribute=function(lcTag,lcName,value){if(FORBID_ATTR[lcName])return!1;if(SANITIZE_DOM&&("id"===lcName||"name"===lcName)&&(value in document||value in formElement))return!1;const nameIsPermitted=ALLOWED_ATTR[lcName]||EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function&&EXTRA_ELEMENT_HANDLING.attributeCheck(lcName,lcTag);if(ALLOW_DATA_ATTR&&!FORBID_ATTR[lcName]&&regExpTest(DATA_ATTR2,lcName));else if(ALLOW_ARIA_ATTR&&regExpTest(ARIA_ATTR2,lcName));else if(!nameIsPermitted||FORBID_ATTR[lcName]){if(!(_isBasicCustomElement(lcTag)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,lcTag)||CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag))&&(CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck,lcName)||CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName,lcTag))||"is"===lcName&&CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,value)||CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))))return!1}else if(URI_SAFE_ATTRIBUTES[lcName]);else if(regExpTest(IS_ALLOWED_URI$1,stringReplace(value,ATTR_WHITESPACE2,"")));else if("src"!==lcName&&"xlink:href"!==lcName&&"href"!==lcName||"script"===lcTag||0!==stringIndexOf(value,"data:")||!DATA_URI_TAGS[lcTag]){if(ALLOW_UNKNOWN_PROTOCOLS&&!regExpTest(IS_SCRIPT_OR_DATA2,stringReplace(value,ATTR_WHITESPACE2,"")));else if(value)return!1}else;return!0},RESERVED_CUSTOM_ELEMENT_NAMES=addToSet({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),_isBasicCustomElement=function(tagName){return!RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)]&&regExpTest(CUSTOM_ELEMENT2,tagName)},_sanitizeAttributes=function(currentNode){_executeHooks(hooks.beforeSanitizeAttributes,currentNode,null);const{attributes:attributes}=currentNode;if(!attributes||_isClobbered(currentNode))return;const hookEvent={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ALLOWED_ATTR,forceKeepAttr:void 0};let l=attributes.length;for(;l--;){const attr=attributes[l],{name:name,namespaceURI:namespaceURI,value:attrValue}=attr,lcName=transformCaseFunc(name),initValue=attrValue;let value="value"===name?initValue:stringTrim(initValue);if(hookEvent.attrName=lcName,hookEvent.attrValue=value,hookEvent.keepAttr=!0,hookEvent.forceKeepAttr=void 0,_executeHooks(hooks.uponSanitizeAttribute,currentNode,hookEvent),value=hookEvent.attrValue,!SANITIZE_NAMED_PROPS||"id"!==lcName&&"name"!==lcName||0===stringIndexOf(value,"user-content-")||(_removeAttribute(name,currentNode),value="user-content-"+value),SAFE_FOR_XML&&regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,value)){_removeAttribute(name,currentNode);continue}if("attributename"===lcName&&stringMatch(value,"href")){_removeAttribute(name,currentNode);continue}if(hookEvent.forceKeepAttr)continue;if(!hookEvent.keepAttr){_removeAttribute(name,currentNode);continue}if(!ALLOW_SELF_CLOSE_IN_ATTR&&regExpTest(/\/>/i,value)){_removeAttribute(name,currentNode);continue}SAFE_FOR_TEMPLATES&&arrayForEach([MUSTACHE_EXPR2,ERB_EXPR2,TMPLIT_EXPR2],expr=>{value=stringReplace(value,expr," ")});const lcTag=transformCaseFunc(currentNode.nodeName);if(_isValidAttribute(lcTag,lcName,value)){if(trustedTypesPolicy&&"object"==typeof trustedTypes&&"function"==typeof trustedTypes.getAttributeType)if(namespaceURI);else switch(trustedTypes.getAttributeType(lcTag,lcName)){case"TrustedHTML":value=trustedTypesPolicy.createHTML(value);break;case"TrustedScriptURL":value=trustedTypesPolicy.createScriptURL(value)}if(value!==initValue)try{namespaceURI?currentNode.setAttributeNS(namespaceURI,name,value):currentNode.setAttribute(name,value),_isClobbered(currentNode)?_forceRemove(currentNode):arrayPop(DOMPurify.removed)}catch(_2){_removeAttribute(name,currentNode)}}else _removeAttribute(name,currentNode)}_executeHooks(hooks.afterSanitizeAttributes,currentNode,null)},_sanitizeShadowDOM2=function(fragment){let shadowNode=null;const shadowIterator=_createNodeIterator(fragment);for(_executeHooks(hooks.beforeSanitizeShadowDOM,fragment,null);shadowNode=shadowIterator.nextNode();)_executeHooks(hooks.uponSanitizeShadowNode,shadowNode,null),_sanitizeElements(shadowNode),_sanitizeAttributes(shadowNode),shadowNode.content instanceof DocumentFragment&&_sanitizeShadowDOM2(shadowNode.content);_executeHooks(hooks.afterSanitizeShadowDOM,fragment,null)};return DOMPurify.sanitize=function(dirty){let cfg=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},body=null,importedNode=null,currentNode=null,returnNode=null;if(IS_EMPTY_INPUT=!dirty,IS_EMPTY_INPUT&&(dirty="\x3c!--\x3e"),"string"!=typeof dirty&&!_isNode(dirty)&&"string"!=typeof(dirty=function(value){switch(typeof value){case"string":return value;case"number":return numberToString(value);case"boolean":return booleanToString(value);case"bigint":return bigintToString?bigintToString(value):"0";case"symbol":return symbolToString?symbolToString(value):"Symbol()";case"undefined":default:return objectToString(value);case"function":case"object":{if(null===value)return objectToString(value);const valueAsRecord=value,valueToString=lookupGetter(valueAsRecord,"toString");if("function"==typeof valueToString){const stringified=valueToString(valueAsRecord);return"string"==typeof stringified?stringified:objectToString(stringified)}return objectToString(value)}}}(dirty)))throw typeErrorCreate("dirty is not a string, aborting");if(!DOMPurify.isSupported)return dirty;if(SET_CONFIG||_parseConfig(cfg),DOMPurify.removed=[],"string"==typeof dirty&&(IN_PLACE=!1),IN_PLACE){const nn=dirty.nodeName;if("string"==typeof nn){const tagName=transformCaseFunc(nn);if(!ALLOWED_TAGS[tagName]||FORBID_TAGS[tagName])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(dirty instanceof Node)body=_initDocument("\x3c!----\x3e"),importedNode=body.ownerDocument.importNode(dirty,!0),importedNode.nodeType===NODE_TYPE_element&&"BODY"===importedNode.nodeName||"HTML"===importedNode.nodeName?body=importedNode:body.appendChild(importedNode);else{if(!RETURN_DOM&&!SAFE_FOR_TEMPLATES&&!WHOLE_DOCUMENT&&-1===dirty.indexOf("<"))return trustedTypesPolicy&&RETURN_TRUSTED_TYPE?trustedTypesPolicy.createHTML(dirty):dirty;if(body=_initDocument(dirty),!body)return RETURN_DOM?null:RETURN_TRUSTED_TYPE?emptyHTML:""}body&&FORCE_BODY&&_forceRemove(body.firstChild);const nodeIterator=_createNodeIterator(IN_PLACE?dirty:body);for(;currentNode=nodeIterator.nextNode();)_sanitizeElements(currentNode),_sanitizeAttributes(currentNode),currentNode.content instanceof DocumentFragment&&_sanitizeShadowDOM2(currentNode.content);if(IN_PLACE)return dirty;if(RETURN_DOM){if(SAFE_FOR_TEMPLATES){body.normalize();let html2=body.innerHTML;arrayForEach([MUSTACHE_EXPR2,ERB_EXPR2,TMPLIT_EXPR2],expr=>{html2=stringReplace(html2,expr," ")}),body.innerHTML=html2}if(RETURN_DOM_FRAGMENT)for(returnNode=createDocumentFragment.call(body.ownerDocument);body.firstChild;)returnNode.appendChild(body.firstChild);else returnNode=body;return(ALLOWED_ATTR.shadowroot||ALLOWED_ATTR.shadowrootmode)&&(returnNode=importNode.call(originalDocument,returnNode,!0)),returnNode}let serializedHTML=WHOLE_DOCUMENT?body.outerHTML:body.innerHTML;return WHOLE_DOCUMENT&&ALLOWED_TAGS["!doctype"]&&body.ownerDocument&&body.ownerDocument.doctype&&body.ownerDocument.doctype.name&&regExpTest(DOCTYPE_NAME,body.ownerDocument.doctype.name)&&(serializedHTML="<!DOCTYPE "+body.ownerDocument.doctype.name+">\n"+serializedHTML),SAFE_FOR_TEMPLATES&&arrayForEach([MUSTACHE_EXPR2,ERB_EXPR2,TMPLIT_EXPR2],expr=>{serializedHTML=stringReplace(serializedHTML,expr," ")}),trustedTypesPolicy&&RETURN_TRUSTED_TYPE?trustedTypesPolicy.createHTML(serializedHTML):serializedHTML},DOMPurify.setConfig=function(){_parseConfig(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),SET_CONFIG=!0},DOMPurify.clearConfig=function(){CONFIG=null,SET_CONFIG=!1},DOMPurify.isValidAttribute=function(tag,attr,value){CONFIG||_parseConfig({});const lcTag=transformCaseFunc(tag),lcName=transformCaseFunc(attr);return _isValidAttribute(lcTag,lcName,value)},DOMPurify.addHook=function(entryPoint,hookFunction){"function"==typeof hookFunction&&arrayPush(hooks[entryPoint],hookFunction)},DOMPurify.removeHook=function(entryPoint,hookFunction){if(void 0!==hookFunction){const index=arrayLastIndexOf(hooks[entryPoint],hookFunction);return-1===index?void 0:arraySplice(hooks[entryPoint],index,1)[0]}return arrayPop(hooks[entryPoint])},DOMPurify.removeHooks=function(entryPoint){hooks[entryPoint]=[]},DOMPurify.removeAllHooks=function(){hooks={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},DOMPurify}();function M(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var O={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function G(u3){O=u3}var _={exec:()=>null};function k(u3,e=""){let t="string"==typeof u3?u3:u3.source,n={replace:(r,i)=>{let s="string"==typeof i?i:i.source;return s=s.replace(m.caret,"$1"),t=t.replace(r,s),n},getRegex:()=>new RegExp(t,e)};return n}var be=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:u3=>new RegExp(`^( {0,3}${u3})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:u3=>new RegExp(`^ {0,${Math.min(3,u3-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:u3=>new RegExp(`^ {0,${Math.min(3,u3-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:u3=>new RegExp(`^ {0,${Math.min(3,u3-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:u3=>new RegExp(`^ {0,${Math.min(3,u3-1)}}#`),htmlBeginRegex:u3=>new RegExp(`^ {0,${Math.min(3,u3-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:u3=>new RegExp(`^ {0,${Math.min(3,u3-1)}}>`)},C=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Q=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,se=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ie=k(se).replace(/bull/g,Q).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ye=k(se).replace(/bull/g,Q).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),j=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,F=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Se=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",F).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$e=k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Q).getRegex(),v="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",U=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_e=k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",U).replace("tag",v).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe=k(j).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),K={blockquote:k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",oe).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Se,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:C,html:_e,lheading:ie,list:$e,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:oe,table:_,text:/^[^\n]+/},ne=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),Me={...K,lheading:ye,table:ne,paragraph:k(j).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ne).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex()},ze={...K,html:k("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",U).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(j).replace("hr",C).replace("heading"," *#{1,6} *[^\n]").replace("lheading",ie).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ae=/^( {2,}|\\)\n(?!\s*$)/,z=/[\p{P}\p{S}]/u,H=/[\s\p{P}\p{S}]/u,W=/[^\s\p{P}\p{S}]/u,Ce=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,H).getRegex(),le=/(?!~)[\p{P}\p{S}]/u,qe=k(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",be?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ue=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ve=k(ue,"u").replace(/punct/g,z).getRegex(),He=k(ue,"u").replace(/punct/g,le).getRegex(),pe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ze=k(pe,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,H).replace(/punct/g,z).getRegex(),Ge=k(pe,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,le).getRegex(),Ne=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,H).replace(/punct/g,z).getRegex(),Qe=k(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,z).getRegex(),Fe=k("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,H).replace(/punct/g,z).getRegex(),Ue=k(/\\(punct)/,"gu").replace(/punct/g,z).getRegex(),Ke=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),We=k(U).replace("(?:--\x3e|$)","--\x3e").getRegex(),Xe=k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",We).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Je=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ce=k(/^!?\[(label)\]\[(ref)\]/).replace("label",q).replace("ref",F).getRegex(),he=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",F).getRegex(),re=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X={_backpedal:_,anyPunctuation:Ue,autolink:Ke,blockSkip:qe,br:ae,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:_,delLDelim:_,delRDelim:_,emStrongLDelim:ve,emStrongRDelimAst:Ze,emStrongRDelimUnd:Ne,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Je,nolink:he,punctuation:Ce,reflink:ce,reflinkSearch:k("reflink|nolink(?!\\()","g").replace("reflink",ce).replace("nolink",he).getRegex(),tag:Xe,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:_},Ye={...X,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",q).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q).getRegex()},N={...X,emStrongRDelimAst:Ge,emStrongLDelim:He,delLDelim:Qe,delRDelim:Fe,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",re).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",re).getRegex()},et={...N,br:k(ae).replace("{2,}","*").getRegex(),text:k(N.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},B={normal:K,gfm:Me,pedantic:ze},E={normal:X,gfm:N,breaks:et,pedantic:Ye},tt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ke=u3=>tt[u3];function T(u3,e){if(e){if(m.escapeTest.test(u3))return u3.replace(m.escapeReplace,ke)}else if(m.escapeTestNoEncode.test(u3))return u3.replace(m.escapeReplaceNoEncode,ke);return u3}function J(u3){try{u3=encodeURI(u3).replace(m.percentDecode,"%")}catch{return null}return u3}function V(u3,e){var _a2;let n=u3.replace(m.findPipe,(i,s,a)=>{let o=!1,l=s;for(;--l>=0&&"\\"===a[l];)o=!o;return o?"|":" |"}).split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!(null==(_a2=n.at(-1))?void 0:_a2.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(m.slashPipe,"|");return n}function I(u3,e,t){let n=u3.length;if(0===n)return"";let r=0;for(;r<n;){if(u3.charAt(n-r-1)!==e)break;r++}return u3.slice(0,n-r)}function ge(u3,e=0){let t=e,n="";for(let r of u3)if("\t"===r){let i=4-t%4;n+=" ".repeat(i),t+=i}else n+=r,t++;return n}function fe(u3,e,t,n,r){let i=e.href,s=e.title||null,a=u3[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let o={type:"!"===u3[0].charAt(0)?"image":"link",raw:t,href:i,title:s,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,o}var w=class{constructor(e){__publicField(this,"options"),__publicField(this,"rules"),__publicField(this,"lexer"),this.options=e||O}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:I(n,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=function(u3,e,t){let n=u3.match(t.other.indentCodeCompensation);if(null===n)return e;let r=n[1];return e.split("\n").map(i=>{let s=i.match(t.other.beginningSpace);if(null===s)return i;let[a]=s;return a.length>=r.length?i.slice(r.length):i}).join("\n")}(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=I(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:I(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=I(t[0],"\n").split("\n"),r="",i="",s=[];for(;n.length>0;){let l,a=!1,o=[];for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))o.push(n[l]),a=!0;else{if(a)break;o.push(n[l])}n=n.slice(l);let p=o.join("\n"),c=p.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}\n${p}`:p,i=i?`${i}\n${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,s,!0),this.lexer.state.top=d,0===n.length)break;let h=s.at(-1);if("code"===(null==h?void 0:h.type))break;if("blockquote"===(null==h?void 0:h.type)){let R=h,f=R.raw+"\n"+n.join("\n"),S=this.blockquote(f);s[s.length-1]=S,r=r.substring(0,r.length-R.raw.length)+S.raw,i=i.substring(0,i.length-R.text.length)+S.text;break}if("list"===(null==h?void 0:h.type)){let R=h,f=R.raw+"\n"+n.join("\n"),S=this.list(f);s[s.length-1]=S,r=r.substring(0,r.length-h.raw.length)+S.raw,i=i.substring(0,i.length-R.raw.length)+S.raw,n=f.substring(s.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(e){var _a2,_b;let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=!1;for(;e;){let l=!1,p="",c="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let d=ge(t[2].split("\n",1)[0],t[1].length),h=e.split("\n",1)[0],R=!d.trim(),f=0;if(this.options.pedantic?(f=2,c=d.trimStart()):R?f=t[1].length+1:(f=d.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=d.slice(f),f+=t[1].length),R&&this.rules.other.blankLine.test(h)&&(p+=h+"\n",e=e.substring(h.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(f),Y=this.rules.other.hrRegex(f),ee=this.rules.other.fencesBeginRegex(f),te=this.rules.other.headingBeginRegex(f),me=this.rules.other.htmlBeginRegex(f),xe=this.rules.other.blockquoteBeginRegex(f);for(;e;){let A,Z=e.split("\n",1)[0];if(h=Z,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),A=h):A=h.replace(this.rules.other.tabCharGlobal," "),ee.test(h)||te.test(h)||me.test(h)||xe.test(h)||S.test(h)||Y.test(h))break;if(A.search(this.rules.other.nonSpaceChar)>=f||!h.trim())c+="\n"+A.slice(f);else{if(R||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ee.test(d)||te.test(d)||Y.test(d))break;c+="\n"+h}R=!h.trim(),p+=Z+"\n",e=e.substring(Z.length+1),d=A.slice(f)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),i.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),i.raw+=p}let o=i.items.at(-1);if(!o)return;o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd(),i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),"text"===(null==(_a2=l.tokens[0])?void 0:_a2.type)||"paragraph"===(null==(_b=l.tokens[0])?void 0:_b.type)){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let c={type:"checkbox",raw:p[0]+" ",checked:"[ ]"!==p[0]};l.checked=c.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=c.raw+l.tokens[0].raw,l.tokens[0].text=c.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(c)):l.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):l.tokens.unshift(c)}}if(!i.loose){let p=l.tokens.filter(d=>"space"===d.type),c=p.length>0&&p.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=c}}if(i.loose)for(let l of i.items){l.loose=!0;for(let p of l.tokens)"text"===p.type&&(p.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:i}}}table(e){var _a2;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=V(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(null==(_a2=t[3])?void 0:_a2.trim())?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(V(a,s.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=I(n.slice(0,-1),"\\");if((n.length-s.length)%2==0)return}else{let s=function(u3,e){if(-1===u3.indexOf(e[1]))return-1;let t=0;for(let n=0;n<u3.length;n++)if("\\"===u3[n])n++;else if(u3[n]===e[0])t++;else if(u3[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}(t[2],"()");if(-2===s)return;if(s>-1){let o=(0===t[0].indexOf("!")?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(r=this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r.slice(1):r.slice(1,-1)),fe(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return fe(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&(r[1]||r[2]||r[3]||r[4])&&(!r[4]||!n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[3]||!n||this.rules.inline.punctuation.exec(n))){let a,o,s=[...r[0]].length-1,l=s,p=0,c="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);null!==(r=c.exec(t));){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){l+=o;continue}if((r[5]||r[6])&&s%3&&!((s+o)%3)){p+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+p);let d=[...r[0]][0].length,h=e.slice(0,s+r.index+d+o);if(Math.min(s,o)%2){let f=h.slice(1,-1);return{type:"em",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}let R=h.slice(2,-2);return{type:"strong",raw:h,text:R,tokens:this.lexer.inlineTokens(R)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let a,o,s=[...r[0]].length-1,l=s,p=this.rules.inline.delRDelim;for(p.lastIndex=0,t=t.slice(-1*e.length+s);null!==(r=p.exec(t));){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a||(o=[...a].length,o!==s))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let c=[...r[0]][0].length,d=e.slice(0,s+r.index+c+o),h=d.slice(s,-s);return{type:"del",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return"@"===t[2]?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var _a2;let t;if(t=this.rules.inline.url.exec(e)){let n,r;if("@"===t[2])n=t[0],r="mailto:"+n;else{let i;do{i=t[0],t[0]=(null==(_a2=this.rules.inline._backpedal.exec(t[0]))?void 0:_a2[0])??""}while(i!==t[0]);n=t[0],r="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},x=class u{constructor(e){__publicField(this,"tokens"),__publicField(this,"options"),__publicField(this,"state"),__publicField(this,"inlineQueue"),__publicField(this,"tokenizer"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||O,this.options.tokenizer=this.options.tokenizer||new w,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:m,block:B.normal,inline:E.normal};this.options.pedantic?(t.block=B.pedantic,t.inline=E.pedantic):this.options.gfm&&(t.block=B.gfm,this.options.breaks?t.inline=E.breaks:t.inline=E.gfm),this.tokenizer.rules=t}static get rules(){return{block:B,inline:E}}static lex(e,t){return new u(t).lex(e)}static lexInline(e,t){return new u(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var _a2,_b,_c;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let r;if(null==(_b=null==(_a2=this.options.extensions)?void 0:_a2.block)?void 0:_b.some(s=>!!(r=s.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let s=t.at(-1);1===r.raw.length&&void 0!==s?s.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);"paragraph"===(null==s?void 0:s.type)||"text"===(null==s?void 0:s.type)?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let s=t.at(-1);"paragraph"===(null==s?void 0:s.type)||"text"===(null==s?void 0:s.type)?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(null==(_c=this.options.extensions)?void 0:_c.startBlock){let o,s=1/0,a=e.slice(1);this.options.extensions.startBlock.forEach(l=>{o=l.call({lexer:this},a),"number"==typeof o&&o>=0&&(s=Math.min(s,o))}),s<1/0&&s>=0&&(i=e.substring(0,s+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&"paragraph"===(null==s?void 0:s.type)?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);"text"===(null==s?void 0:s.type)?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}throw new Error(s)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var _a2,_b,_c,_d,_e2;this.tokenizer.lexer=this;let i,n=e,r=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;null!==(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)o.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!==(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!==(r=this.tokenizer.rules.inline.blockSkip.exec(n));)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=(null==(_b=null==(_a2=this.options.hooks)?void 0:_a2.emStrongMask)?void 0:_b.call({lexer:this},n))??n;let s=!1,a="";for(;e;){let o;if(s||(a=""),s=!1,null==(_d=null==(_c=this.options.extensions)?void 0:_c.inline)?void 0:_d.some(p=>!!(o=p.call({lexer:this},e,t))&&(e=e.substring(o.raw.length),t.push(o),!0)))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let p=t.at(-1);"text"===o.type&&"text"===(null==p?void 0:p.type)?(p.raw+=o.raw,p.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,a)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,a)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let l=e;if(null==(_e2=this.options.extensions)?void 0:_e2.startInline){let d,p=1/0,c=e.slice(1);this.options.extensions.startInline.forEach(h=>{d=h.call({lexer:this},c),"number"==typeof d&&d>=0&&(p=Math.min(p,d))}),p<1/0&&p>=0&&(l=e.substring(0,p+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),"_"!==o.raw.slice(-1)&&(a=o.raw.slice(-1)),s=!0;let p=t.at(-1);"text"===(null==p?void 0:p.type)?(p.raw+=o.raw,p.text+=o.text):t.push(o);continue}if(e){let p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}throw new Error(p)}}return t}},y=class{constructor(e){__publicField(this,"options"),__publicField(this,"parser"),this.options=e||O}space(e){return""}code({text:e,lang:t,escaped:n}){var _a2;let r=null==(_a2=(t||"").match(m.notSpaceStart))?void 0:_a2[0],i=e.replace(m.endingNewline,"")+"\n";return r?'<pre><code class="language-'+T(r)+'">'+(n?i:T(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:T(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let a=0;a<e.items.length;a++){let o=e.items[a];r+=this.listitem(o)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){let s=e.rows[i];n="";for(let a=0;a<s.length;a++)n+=this.tablecell(s[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${T(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=J(e);if(null===i)return r;let s='<a href="'+(e=i)+'"';return t&&(s+=' title="'+T(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=J(e);if(null===i)return T(n);let s=`<img src="${e=i}" alt="${T(n)}"`;return t&&(s+=` title="${T(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:T(e.text)}},$=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},b=class u2{constructor(e){__publicField(this,"options"),__publicField(this,"renderer"),__publicField(this,"textRenderer"),this.options=e||O,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $}static parse(e,t){return new u2(t).parse(e)}static parseInline(e,t){return new u2(t).parseInline(e)}parse(e){var _a2,_b;this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let r=e[n];if(null==(_b=null==(_a2=this.options.extensions)?void 0:_a2.renderers)?void 0:_b[r.type]){let s=r,a=this.options.extensions.renderers[s.type].call({parser:this},s);if(!1!==a||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){t+=a||"";continue}}let i=r;switch(i.type){case"space":t+=this.renderer.space(i);break;case"hr":t+=this.renderer.hr(i);break;case"heading":t+=this.renderer.heading(i);break;case"code":t+=this.renderer.code(i);break;case"table":t+=this.renderer.table(i);break;case"blockquote":t+=this.renderer.blockquote(i);break;case"list":t+=this.renderer.list(i);break;case"checkbox":t+=this.renderer.checkbox(i);break;case"html":t+=this.renderer.html(i);break;case"def":t+=this.renderer.def(i);break;case"paragraph":t+=this.renderer.paragraph(i);break;case"text":t+=this.renderer.text(i);break;default:{let s='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(e,t=this.renderer){var _a2,_b;this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let i=e[r];if(null==(_b=null==(_a2=this.options.extensions)?void 0:_a2.renderers)?void 0:_b[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==a||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=a||"";continue}}let s=i;switch(s.type){case"escape":case"text":n+=t.text(s);break;case"html":n+=t.html(s);break;case"link":n+=t.link(s);break;case"image":n+=t.image(s);break;case"checkbox":n+=t.checkbox(s);break;case"strong":n+=t.strong(s);break;case"em":n+=t.em(s);break;case"codespan":n+=t.codespan(s);break;case"br":n+=t.br(s);break;case"del":n+=t.del(s);break;default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},P=(_a=class{constructor(e){__publicField(this,"options"),__publicField(this,"block"),this.options=e||O}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?x.lex:x.lexInline}provideParser(e=this.block){return e?b.parse:b.parseInline}},__publicField(_a,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),__publicField(_a,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),_a),L=new class{constructor(...e){__publicField(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),__publicField(this,"options",this.setOptions),__publicField(this,"parse",this.parseMarkdown(!0)),__publicField(this,"parseInline",this.parseMarkdown(!1)),__publicField(this,"Parser",b),__publicField(this,"Renderer",y),__publicField(this,"TextRenderer",$),__publicField(this,"Lexer",x),__publicField(this,"Tokenizer",w),__publicField(this,"Hooks",P),this.use(...e)}walkTokens(e,t){var _a2,_b;let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,t));for(let s of i.rows)for(let a of s)n=n.concat(this.walkTokens(a.tokens,t));break}case"list":{let i=r;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=r;(null==(_b=null==(_a2=this.defaults.extensions)?void 0:_a2.childTokens)?void 0:_b[i.type])?this.defaults.extensions.childTokens[i.type].forEach(s=>{let a=i[s].flat(1/0);n=n.concat(this.walkTokens(a,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];t.renderers[i.name]=s?function(...a){let o=i.renderer.apply(this,a);return!1===o&&(o=s.apply(this,a)),o}:i.renderer}if("tokenizer"in i){if(!i.level||"block"!==i.level&&"inline"!==i.level)throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&("block"===i.level?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:"inline"===i.level&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new y(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=n.renderer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return!1===c&&(c=l.apply(i,p)),c||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new w(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=n.tokenizer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return!1===c&&(c=l.apply(i,p)),c}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new P;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=n.hooks[a],l=i[a];P.passThroughHooks.has(s)?i[a]=p=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await o.call(i,p);return l.call(i,d)})();let c=o.call(i,p);return l.call(i,c)}:i[a]=(...p)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(i,p);return!1===d&&(d=await l.apply(i,p)),d})();let c=o.apply(i,p);return!1===c&&(c=l.apply(i,p)),c}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),i&&(o=o.concat(i.call(this,a))),o}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return(n,r)=>{let i={...r},s={...this.defaults,...i},a=this.onError(!!s.silent,!!s.async);if(!0===this.defaults.async&&!1===i.async)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||null===n)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(n):n,p=await(s.hooks?await s.hooks.provideLexer(e):e?x.lex:x.lexInline)(o,s),c=s.hooks?await s.hooks.processAllTokens(p):p;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let h=await(s.hooks?await s.hooks.provideParser(e):e?b.parse:b.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(h):h})().catch(a);try{s.hooks&&(n=s.hooks.preprocess(n));let l=(s.hooks?s.hooks.provideLexer(e):e?x.lex:x.lexInline)(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=(s.hooks?s.hooks.provideParser(e):e?b.parse:b.parseInline)(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let r="<p>An error occurred:</p><pre>"+T(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};function g(u3,e){return L.parse(u3,e)}g.options=g.setOptions=function(u3){return L.setOptions(u3),g.defaults=L.defaults,G(g.defaults),g},g.getDefaults=M,g.defaults=O,g.use=function(...u3){return L.use(...u3),g.defaults=L.defaults,G(g.defaults),g},g.walkTokens=function(u3,e){return L.walkTokens(u3,e)},g.parseInline=L.parseInline,g.Parser=b,g.parser=b.parse,g.Renderer=y,g.TextRenderer=$,g.Lexer=x,g.lexer=x.lex,g.Tokenizer=w,g.Hooks=P,g.parse=g,g.options,g.setOptions,g.use,g.walkTokens,g.parseInline,b.parse,x.lex;export{g,purify as p};