orbitchat 2.2.0 → 2.2.2
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.
- package/bin/orbitchat.js +1 -1
- package/dist/assets/{api-iWGWe9XZ.js → api-BL5q6VW7.js} +1 -1
- package/dist/assets/{arc-m8RC5oDD-DxtXpPlf.js → arc-m8RC5oDD-D4A9YAA9.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-CZ2mpei3-B_3saIkQ.js → blockDiagram-c4efeb88-CZ2mpei3-CYL_iv2U.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-DL2EmCLj-Dv5sdkpm.js → c4Diagram-c83219d4-DL2EmCLj-B4gUHYtt.js} +1 -1
- package/dist/assets/channel-BKp1WYnX-C2kiKBzQ.js +1 -0
- package/dist/assets/{classDiagram-beda092f-vKbJ2bcD-CpzCwdb3.js → classDiagram-beda092f-vKbJ2bcD-BMXovIhZ.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-BHXpn1Du-ClzQ61Pm.js → classDiagram-v2-2358418a-BHXpn1Du-DwZenavg.js} +1 -1
- package/dist/assets/clone-B1V2003j-TxzpTD1c.js +1 -0
- package/dist/assets/{createText-1719965b-C2-AT0ab-CWg8fDWo.js → createText-1719965b-C2-AT0ab-DdeHG0fk.js} +1 -1
- package/dist/assets/{edges-96097737-Zk-qG_8u-HnJhTil4.js → edges-96097737-Zk-qG_8u-DK7AVtHJ.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-B94anMjz-ocfxI7NV.js → erDiagram-0228fc6a-B94anMjz-xRWCwRPA.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-CRRW-bQO-G1WHNmUV.js → flowDb-c6c81e3f-CRRW-bQO-HITLukvy.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-DPzQMhJv-DgwkjDqI.js → flowDiagram-50d868cf-DPzQMhJv-y9nG9CIA.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-Si9enBmB-BCb4fnW_.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-CULhtvD--GZ9ilB9C.js → flowchart-elk-definition-6af322e1-CULhtvD--CUVQv7kg.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-Bp8yOLEz-CqM7mRjt.js → ganttDiagram-a2739b55-Bp8yOLEz-YdeCiqmu.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-BYtOQJl0-C2naxeTp.js → gitGraphDiagram-82fe8481-BYtOQJl0-D4axJXqm.js} +1 -1
- package/dist/assets/{graph-BV6jB5rk-CELreG_k.js → graph-BV6jB5rk-CdEYXCfk.js} +1 -1
- package/dist/assets/{index-BaIhc-dj.js → index--DBVktm0.js} +6 -6
- package/dist/assets/{index-5325376f-DrY72DrM-CA0ZD5ej.js → index-5325376f-DrY72DrM-6JgEWzV-.js} +1 -1
- package/dist/assets/{index-DlFdZiHl-BkXTu13U.js → index-DlFdZiHl-DxtOvgee.js} +1 -1
- package/dist/assets/{infoDiagram-8eee0895-C6GFnrZ7-BhM7Tkvh.js → infoDiagram-8eee0895-C6GFnrZ7-BxKE5VSc.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-daS1W8qe-DipmPDM8.js → journeyDiagram-c64418c1-daS1W8qe-7OJNovrd.js} +1 -1
- package/dist/assets/{layout-LXMv3mSS-fzT-WsR4.js → layout-LXMv3mSS-DxzYqwJj.js} +1 -1
- package/dist/assets/{mindmap-definition-8da855dc-DmNQYVT1-BupnMO6G.js → mindmap-definition-8da855dc-DmNQYVT1-CgDdu9Gj.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-381urBY5-CJU6X8kv.js → pieDiagram-a8764435-381urBY5-CookJl9u.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-hgRmK2bX-fzcWnYUM.js → quadrantDiagram-1e28029f-hgRmK2bX-DR13UrvZ.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-BB0Q-cI9-CPFdXDhT.js → requirementDiagram-08caed73-BB0Q-cI9-1IJAPa7z.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-BpsipZNt-B3YPu4J8.js → sankeyDiagram-a04cb91d-BpsipZNt-DtHQcqU2.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-xoAvPcQJ-B9rDXSoA.js → sequenceDiagram-c5b8d532-xoAvPcQJ-DZK1k3_R.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-b721R49K-CWcqUIUo.js → stateDiagram-1ecb1508-b721R49K-LYtW3ekv.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-BmSbrbqZ-DlbnZV5y.js → stateDiagram-v2-c2b004d7-BmSbrbqZ-DeX2v3BR.js} +1 -1
- package/dist/assets/{styles-b4e223ce-TYmJC5IN-BHQXJFVt.js → styles-b4e223ce-TYmJC5IN-Ckb0uq_x.js} +1 -1
- package/dist/assets/{styles-ca3715f6-CfJZu0Yn-DtD2x1No.js → styles-ca3715f6-CfJZu0Yn-Didz8Z4A.js} +1 -1
- package/dist/assets/{styles-d45a18b0-DZ8oSYcV-CvugbGS9.js → styles-d45a18b0-DZ8oSYcV-CG6sdjTP.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-CXPkN8HW-DH97F0YX.js → svgDrawCommon-b86b1483-CXPkN8HW-C4vufBue.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-LDFf1jfb-DxM6VoSn.js → timeline-definition-faaaa080-LDFf1jfb-0t73iNVZ.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-DdhO5-Bp-CevMp6HN.js → xychartDiagram-f5964ef8-DdhO5-Bp-DFXTGgvd.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-BKp1WYnX-Cc6fwi-B.js +0 -1
- package/dist/assets/clone-B1V2003j-Cr3Uw-Zs.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-Si9enBmB-DYUBnRO1.js +0 -1
package/dist/assets/{index-5325376f-DrY72DrM-CA0ZD5ej.js → index-5325376f-DrY72DrM-6JgEWzV-.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as E,K as j}from"./graph-BV6jB5rk-CELreG_k.js";import{A,w as J}from"./layout-LXMv3mSS-fzT-WsR4.js";import{a as K}from"./clone-B1V2003j-Cr3Uw-Zs.js";import{c as z,m as H,o as W,h as q,x as Q,t as T,p as D,g as U,d as V,E as O,R,y as Y,f as Z}from"./edges-96097737-Zk-qG_8u-HnJhTil4.js";import{O as i,E as B,x as C,F as G}from"./index-BaIhc-dj.js";import{$ as _}from"./createText-1719965b-C2-AT0ab-CWg8fDWo.js";function y(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:ee(r),edges:te(r)};return E(r.graph())||(e.value=K(r.graph())),e}function ee(r){return J(r.nodes(),function(e){var t=r.node(e),a=r.parent(e),n={v:e};return E(t)||(n.value=t),E(a)||(n.parent=a),n})}function te(r){return J(r.edges(),function(e){var t=r.edge(e),a={v:e.v,w:e.w};return E(e.name)||(a.name=e.name),E(t)||(a.value=t),a})}let l={},u={},F={};const re=()=>{u={},F={},l={}},S=(r,e)=>(i.trace("In isDescendant",e," ",r," = ",u[e].includes(r)),!!u[e].includes(r)),ne=(r,e)=>(i.info("Descendants of ",e," is ",u[e]),i.info("Edge is ",r),r.v===e||r.w===e?!1:u[e]?u[e].includes(r.v)||S(r.v,e)||S(r.w,e)||u[e].includes(r.w):(i.debug("Tilt, ",e,",not in descendants"),!1)),$=(r,e,t,a)=>{i.warn("Copying children of ",r,"root",a,"data",e.node(r),a);const n=e.children(r)||[];r!==a&&n.push(r),i.warn("Copying (nodes) clusterId",r,"nodes",n),n.forEach(o=>{if(e.children(o).length>0)$(o,e,t,a);else{const c=e.node(o);i.info("cp ",o," to ",a," with parent ",r),t.setNode(o,c),a!==e.parent(o)&&(i.warn("Setting parent",o,e.parent(o)),t.setParent(o,e.parent(o))),r!==a&&o!==r?(i.debug("Setting parent",o,r),t.setParent(o,r)):(i.info("In copy ",r,"root",a,"data",e.node(r),a),i.debug("Not Setting parent for node=",o,"cluster!==rootId",r!==a,"node!==clusterId",o!==r));const g=e.edges(o);i.debug("Copying Edges",g),g.forEach(h=>{i.info("Edge",h);const f=e.edge(h.v,h.w,h.name);i.info("Edge data",f,a);try{ne(h,a)?(i.info("Copying as ",h.v,h.w,f,h.name),t.setEdge(h.v,h.w,f,h.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",h.v,"-->",h.w," rootId: ",a," clusterId:",r)}catch(w){i.error(w)}})}i.debug("Removing node",o),e.removeNode(o)})},I=(r,e)=>{const t=e.children(r);let a=[...t];for(const n of t)F[n]=r,a=[...a,...I(n,e)];return a},X=(r,e)=>{i.trace("Searching",r);const t=e.children(r);if(i.trace("Searching children of id ",r,t),t.length<1)return i.trace("This is a valid node",r),r;for(const a of t){const n=X(a,e);if(n)return i.trace("Found replacement for",r," => ",n),n}},N=r=>!l[r]||!l[r].externalConnections?r:l[r]?l[r].id:r,ie=(r,e)=>{if(!r||e>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");r.nodes().forEach(function(t){r.children(t).length>0&&(i.warn("Cluster identified",t," Replacement id in edges: ",X(t,r)),u[t]=I(t,r),l[t]={id:X(t,r),clusterData:r.node(t)})}),r.nodes().forEach(function(t){const a=r.children(t),n=r.edges();a.length>0?(i.debug("Cluster identified",t,u),n.forEach(o=>{if(o.v!==t&&o.w!==t){const c=S(o.v,t),g=S(o.w,t);c^g&&(i.warn("Edge: ",o," leaves cluster ",t),i.warn("Descendants of XXX ",t,": ",u[t]),l[t].externalConnections=!0)}})):i.debug("Not a cluster ",t,u)});for(let t of Object.keys(l)){const a=l[t].id,n=r.parent(a);n!==t&&l[n]&&!l[n].externalConnections&&(l[t].id=n)}r.edges().forEach(function(t){const a=r.edge(t);i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r.edge(t)));let n=t.v,o=t.w;if(i.warn("Fix XXX",l,"ids:",t.v,t.w,"Translating: ",l[t.v]," --- ",l[t.w]),l[t.v]&&l[t.w]&&l[t.v]===l[t.w]){i.warn("Fixing and trixing link to self - removing XXX",t.v,t.w,t.name),i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name);const c=t.w+"---"+t.v;r.setNode(c,{domId:c,id:c,labelStyle:"",labelText:a.label,padding:0,shape:"labelRect",style:""});const g=structuredClone(a),h=structuredClone(a);g.label="",g.arrowTypeEnd="none",h.label="",g.fromCluster=t.v,h.toCluster=t.v,r.setEdge(n,c,g,t.name+"-cyclic-special"),r.setEdge(c,o,h,t.name+"-cyclic-special")}else if(l[t.v]||l[t.w]){if(i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name),n!==t.v){const c=r.parent(n);l[c].externalConnections=!0,a.fromCluster=t.v}if(o!==t.w){const c=r.parent(o);l[c].externalConnections=!0,a.toCluster=t.w}i.warn("Fix Replacing with XXX",n,o,t.name),r.setEdge(n,o,a,t.name)}}),i.warn("Adjusted Graph",y(r)),P(r,0),i.trace(l)},P=(r,e)=>{if(i.warn("extractor - ",e,y(r),r.children("D")),e>10){i.error("Bailing out");return}let t=r.nodes(),a=!1;for(const n of t){const o=r.children(n);a=a||o.length>0}if(!a){i.debug("Done, no node has children",r.nodes());return}i.debug("Nodes = ",t,e);for(const n of t)if(i.debug("Extracting node",n,l,l[n]&&!l[n].externalConnections,!r.parent(n),r.node(n),r.children("D")," Depth ",e),!l[n])i.debug("Not a cluster",n,e);else if(!l[n].externalConnections&&r.children(n)&&r.children(n).length>0){i.warn("Cluster without external connections, without a parent and with children",n,e);let o=r.graph().rankdir==="TB"?"LR":"TB";l[n]&&l[n].clusterData&&l[n].clusterData.dir&&(o=l[n].clusterData.dir,i.warn("Fixing dir",l[n].clusterData.dir,o));const c=new j({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",y(r)),$(n,r,c,n),r.setNode(n,{clusterNode:!0,id:n,clusterData:l[n].clusterData,labelText:l[n].labelText,graph:c}),i.warn("New graph after copy node: (",n,")",y(c)),i.debug("Old graph after copy",y(r))}else i.warn("Cluster ** ",n," **not meeting the criteria !externalConnections:",!l[n].externalConnections," no parent: ",!r.parent(n)," children ",r.children(n)&&r.children(n).length>0,r.children("D"),e),i.debug(l);t=r.nodes(),i.warn("New list of nodes",t);for(const n of t){const o=r.node(n);i.warn(" Now next level",n,o),o.clusterNode&&P(o.graph,e+1)}},k=(r,e)=>{if(e.length===0)return[];let t=Object.assign(e);return e.forEach(a=>{const n=r.children(a),o=k(r,n);t=[...t,...o]}),t},ae=r=>k(r,r.children()),oe=(r,e)=>{i.info("Creating subgraph rect for ",e.id,e);const t=B(),a=r.insert("g").attr("class","cluster"+(e.class?" "+e.class:"")).attr("id",e.id),n=a.insert("rect",":first-child"),o=C(t.flowchart.htmlLabels),c=a.insert("g").attr("class","cluster-label"),g=e.labelType==="markdown"?_(c,e.labelText,{style:e.labelStyle,useHtmlLabels:o}):c.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}const f=0*e.padding,w=f/2,p=e.width<=h.width+f?h.width+f:e.width;e.width<=h.width+f?e.diff=(h.width-e.width)/2-e.padding/2:e.diff=-e.padding/2,i.trace("Data ",e,JSON.stringify(e)),n.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-p/2).attr("y",e.y-e.height/2-w).attr("width",p).attr("height",e.height+f);const{subGraphTitleTopMargin:x}=T(t);o?c.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2+x})`):c.attr("transform",`translate(${e.x}, ${e.y-e.height/2+x})`);const v=n.node().getBBox();return e.width=v.width,e.height=v.height,e.intersect=function(d){return O(e,d)},a},de=(r,e)=>{const t=r.insert("g").attr("class","note-cluster").attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2-o).attr("width",e.width+n).attr("height",e.height+n).attr("fill","none");const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.intersect=function(g){return O(e,g)},t},se=(r,e)=>{const t=B(),a=r.insert("g").attr("class",e.classes).attr("id",e.id),n=a.insert("rect",":first-child"),o=a.insert("g").attr("class","cluster-label"),c=a.append("rect"),g=o.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}h=g.getBBox();const f=0*e.padding,w=f/2,p=e.width<=h.width+e.padding?h.width+e.padding:e.width;e.width<=h.width+e.padding?e.diff=(h.width+e.padding*0-e.width)/2:e.diff=-e.padding/2,n.attr("class","outer").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w).attr("width",p+f).attr("height",e.height+f),c.attr("class","inner").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w+h.height-1).attr("width",p+f).attr("height",e.height+f-h.height-3);const{subGraphTitleTopMargin:x}=T(t);o.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2-e.padding/3+(C(t.flowchart.htmlLabels)?5:3)+x})`);const v=n.node().getBBox();return e.height=v.height,e.intersect=function(d){return O(e,d)},a},le=(r,e)=>{const t=r.insert("g").attr("class",e.classes).attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("class","divider").attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2).attr("width",e.width+n).attr("height",e.height+n);const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.diff=-e.padding/2,e.intersect=function(g){return O(e,g)},t},he={rect:oe,roundedWithTitle:se,noteGroup:de,divider:le};let L={};const ce=(r,e)=>{i.trace("Inserting cluster");const t=e.shape||"rect";L[e.id]=he[t](r,e)},ge=()=>{L={}},M=async(r,e,t,a,n,o)=>{i.info("Graph in recursive render: XXX",y(e),n);const c=e.graph().rankdir;i.trace("Dir in recursive render - dir:",c);const g=r.insert("g").attr("class","root");e.nodes()?i.info("Recursive render XXX",e.nodes()):i.info("No nodes found for",e),e.edges().length>0&&i.trace("Recursive edges",e.edge(e.edges()[0]));const h=g.insert("g").attr("class","clusters"),f=g.insert("g").attr("class","edgePaths"),w=g.insert("g").attr("class","edgeLabels"),p=g.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(d){const s=e.node(d);if(n!==void 0){const m=JSON.parse(JSON.stringify(n.clusterData));i.info("Setting data for cluster XXX (",d,") ",m,n),e.setNode(n.id,m),e.parent(d)||(i.trace("Setting parent",d,n.id),e.setParent(d,n.id,m))}if(i.info("(Insert) Node XXX"+d+": "+JSON.stringify(e.node(d))),s&&s.clusterNode){i.info("Cluster identified",d,s.width,e.node(d));const m=await M(p,s.graph,t,a,e.node(d),o),b=m.elem;H(s,b),s.diff=m.diff||0,i.info("Node bounds (abc123)",d,s,s.width,s.x,s.y),W(b,s),i.warn("Recursive render complete ",b,s)}else e.children(d).length>0?(i.info("Cluster - the non recursive path XXX",d,s.id,s,e),i.info(X(s.id,e)),l[s.id]={id:X(s.id,e),node:s}):(i.info("Node - the non recursive path",d,s.id,s),await q(p,e.node(d),c))})),e.edges().forEach(function(d){const s=e.edge(d.v,d.w,d.name);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d)),i.info("Edge "+d.v+" -> "+d.w+": ",d," ",JSON.stringify(e.edge(d))),i.info("Fix",l,"ids:",d.v,d.w,"Translating: ",l[d.v],l[d.w]),Q(w,s)}),e.edges().forEach(function(d){i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d))}),i.info("#############################################"),i.info("### Layout ###"),i.info("#############################################"),i.info(e),A(e),i.info("Graph after layout:",y(e));let x=0;const{subGraphTitleTotalMargin:v}=T(o);return ae(e).forEach(function(d){const s=e.node(d);i.info("Position "+d+": "+JSON.stringify(e.node(d))),i.info("Position "+d+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s&&s.clusterNode?(s.y+=v,D(s)):e.children(d).length>0?(s.height+=v,ce(h,s),l[s.id].node=s):(s.y+=v/2,D(s))}),e.edges().forEach(function(d){const s=e.edge(d);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(s),s),s.points.forEach(b=>b.y+=v/2);const m=U(f,d,s,l,t,e,a);V(s,m)}),e.nodes().forEach(function(d){const s=e.node(d);i.info(d,s.type,s.diff),s.type==="group"&&(x=s.diff)}),{elem:g,diff:x}},me=async(r,e,t,a,n)=>{z(r,t,a,n),Y(),Z(),ge(),re(),i.warn("Graph at first:",JSON.stringify(y(e))),ie(e),i.warn("Graph after:",JSON.stringify(y(e)));const o=B();await M(r,e,a,n,void 0,o)};export{me as b};
|
|
1
|
+
import{P as E,K as j}from"./graph-BV6jB5rk-CdEYXCfk.js";import{A,w as J}from"./layout-LXMv3mSS-DxzYqwJj.js";import{a as K}from"./clone-B1V2003j-TxzpTD1c.js";import{c as z,m as H,o as W,h as q,x as Q,t as T,p as D,g as U,d as V,E as O,R,y as Y,f as Z}from"./edges-96097737-Zk-qG_8u-DK7AVtHJ.js";import{O as i,E as B,x as C,F as G}from"./index--DBVktm0.js";import{$ as _}from"./createText-1719965b-C2-AT0ab-DdeHG0fk.js";function y(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:ee(r),edges:te(r)};return E(r.graph())||(e.value=K(r.graph())),e}function ee(r){return J(r.nodes(),function(e){var t=r.node(e),a=r.parent(e),n={v:e};return E(t)||(n.value=t),E(a)||(n.parent=a),n})}function te(r){return J(r.edges(),function(e){var t=r.edge(e),a={v:e.v,w:e.w};return E(e.name)||(a.name=e.name),E(t)||(a.value=t),a})}let l={},u={},F={};const re=()=>{u={},F={},l={}},S=(r,e)=>(i.trace("In isDescendant",e," ",r," = ",u[e].includes(r)),!!u[e].includes(r)),ne=(r,e)=>(i.info("Descendants of ",e," is ",u[e]),i.info("Edge is ",r),r.v===e||r.w===e?!1:u[e]?u[e].includes(r.v)||S(r.v,e)||S(r.w,e)||u[e].includes(r.w):(i.debug("Tilt, ",e,",not in descendants"),!1)),$=(r,e,t,a)=>{i.warn("Copying children of ",r,"root",a,"data",e.node(r),a);const n=e.children(r)||[];r!==a&&n.push(r),i.warn("Copying (nodes) clusterId",r,"nodes",n),n.forEach(o=>{if(e.children(o).length>0)$(o,e,t,a);else{const c=e.node(o);i.info("cp ",o," to ",a," with parent ",r),t.setNode(o,c),a!==e.parent(o)&&(i.warn("Setting parent",o,e.parent(o)),t.setParent(o,e.parent(o))),r!==a&&o!==r?(i.debug("Setting parent",o,r),t.setParent(o,r)):(i.info("In copy ",r,"root",a,"data",e.node(r),a),i.debug("Not Setting parent for node=",o,"cluster!==rootId",r!==a,"node!==clusterId",o!==r));const g=e.edges(o);i.debug("Copying Edges",g),g.forEach(h=>{i.info("Edge",h);const f=e.edge(h.v,h.w,h.name);i.info("Edge data",f,a);try{ne(h,a)?(i.info("Copying as ",h.v,h.w,f,h.name),t.setEdge(h.v,h.w,f,h.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",h.v,"-->",h.w," rootId: ",a," clusterId:",r)}catch(w){i.error(w)}})}i.debug("Removing node",o),e.removeNode(o)})},I=(r,e)=>{const t=e.children(r);let a=[...t];for(const n of t)F[n]=r,a=[...a,...I(n,e)];return a},X=(r,e)=>{i.trace("Searching",r);const t=e.children(r);if(i.trace("Searching children of id ",r,t),t.length<1)return i.trace("This is a valid node",r),r;for(const a of t){const n=X(a,e);if(n)return i.trace("Found replacement for",r," => ",n),n}},N=r=>!l[r]||!l[r].externalConnections?r:l[r]?l[r].id:r,ie=(r,e)=>{if(!r||e>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");r.nodes().forEach(function(t){r.children(t).length>0&&(i.warn("Cluster identified",t," Replacement id in edges: ",X(t,r)),u[t]=I(t,r),l[t]={id:X(t,r),clusterData:r.node(t)})}),r.nodes().forEach(function(t){const a=r.children(t),n=r.edges();a.length>0?(i.debug("Cluster identified",t,u),n.forEach(o=>{if(o.v!==t&&o.w!==t){const c=S(o.v,t),g=S(o.w,t);c^g&&(i.warn("Edge: ",o," leaves cluster ",t),i.warn("Descendants of XXX ",t,": ",u[t]),l[t].externalConnections=!0)}})):i.debug("Not a cluster ",t,u)});for(let t of Object.keys(l)){const a=l[t].id,n=r.parent(a);n!==t&&l[n]&&!l[n].externalConnections&&(l[t].id=n)}r.edges().forEach(function(t){const a=r.edge(t);i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r.edge(t)));let n=t.v,o=t.w;if(i.warn("Fix XXX",l,"ids:",t.v,t.w,"Translating: ",l[t.v]," --- ",l[t.w]),l[t.v]&&l[t.w]&&l[t.v]===l[t.w]){i.warn("Fixing and trixing link to self - removing XXX",t.v,t.w,t.name),i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name);const c=t.w+"---"+t.v;r.setNode(c,{domId:c,id:c,labelStyle:"",labelText:a.label,padding:0,shape:"labelRect",style:""});const g=structuredClone(a),h=structuredClone(a);g.label="",g.arrowTypeEnd="none",h.label="",g.fromCluster=t.v,h.toCluster=t.v,r.setEdge(n,c,g,t.name+"-cyclic-special"),r.setEdge(c,o,h,t.name+"-cyclic-special")}else if(l[t.v]||l[t.w]){if(i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name),n!==t.v){const c=r.parent(n);l[c].externalConnections=!0,a.fromCluster=t.v}if(o!==t.w){const c=r.parent(o);l[c].externalConnections=!0,a.toCluster=t.w}i.warn("Fix Replacing with XXX",n,o,t.name),r.setEdge(n,o,a,t.name)}}),i.warn("Adjusted Graph",y(r)),P(r,0),i.trace(l)},P=(r,e)=>{if(i.warn("extractor - ",e,y(r),r.children("D")),e>10){i.error("Bailing out");return}let t=r.nodes(),a=!1;for(const n of t){const o=r.children(n);a=a||o.length>0}if(!a){i.debug("Done, no node has children",r.nodes());return}i.debug("Nodes = ",t,e);for(const n of t)if(i.debug("Extracting node",n,l,l[n]&&!l[n].externalConnections,!r.parent(n),r.node(n),r.children("D")," Depth ",e),!l[n])i.debug("Not a cluster",n,e);else if(!l[n].externalConnections&&r.children(n)&&r.children(n).length>0){i.warn("Cluster without external connections, without a parent and with children",n,e);let o=r.graph().rankdir==="TB"?"LR":"TB";l[n]&&l[n].clusterData&&l[n].clusterData.dir&&(o=l[n].clusterData.dir,i.warn("Fixing dir",l[n].clusterData.dir,o));const c=new j({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",y(r)),$(n,r,c,n),r.setNode(n,{clusterNode:!0,id:n,clusterData:l[n].clusterData,labelText:l[n].labelText,graph:c}),i.warn("New graph after copy node: (",n,")",y(c)),i.debug("Old graph after copy",y(r))}else i.warn("Cluster ** ",n," **not meeting the criteria !externalConnections:",!l[n].externalConnections," no parent: ",!r.parent(n)," children ",r.children(n)&&r.children(n).length>0,r.children("D"),e),i.debug(l);t=r.nodes(),i.warn("New list of nodes",t);for(const n of t){const o=r.node(n);i.warn(" Now next level",n,o),o.clusterNode&&P(o.graph,e+1)}},k=(r,e)=>{if(e.length===0)return[];let t=Object.assign(e);return e.forEach(a=>{const n=r.children(a),o=k(r,n);t=[...t,...o]}),t},ae=r=>k(r,r.children()),oe=(r,e)=>{i.info("Creating subgraph rect for ",e.id,e);const t=B(),a=r.insert("g").attr("class","cluster"+(e.class?" "+e.class:"")).attr("id",e.id),n=a.insert("rect",":first-child"),o=C(t.flowchart.htmlLabels),c=a.insert("g").attr("class","cluster-label"),g=e.labelType==="markdown"?_(c,e.labelText,{style:e.labelStyle,useHtmlLabels:o}):c.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}const f=0*e.padding,w=f/2,p=e.width<=h.width+f?h.width+f:e.width;e.width<=h.width+f?e.diff=(h.width-e.width)/2-e.padding/2:e.diff=-e.padding/2,i.trace("Data ",e,JSON.stringify(e)),n.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-p/2).attr("y",e.y-e.height/2-w).attr("width",p).attr("height",e.height+f);const{subGraphTitleTopMargin:x}=T(t);o?c.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2+x})`):c.attr("transform",`translate(${e.x}, ${e.y-e.height/2+x})`);const v=n.node().getBBox();return e.width=v.width,e.height=v.height,e.intersect=function(d){return O(e,d)},a},de=(r,e)=>{const t=r.insert("g").attr("class","note-cluster").attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2-o).attr("width",e.width+n).attr("height",e.height+n).attr("fill","none");const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.intersect=function(g){return O(e,g)},t},se=(r,e)=>{const t=B(),a=r.insert("g").attr("class",e.classes).attr("id",e.id),n=a.insert("rect",":first-child"),o=a.insert("g").attr("class","cluster-label"),c=a.append("rect"),g=o.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}h=g.getBBox();const f=0*e.padding,w=f/2,p=e.width<=h.width+e.padding?h.width+e.padding:e.width;e.width<=h.width+e.padding?e.diff=(h.width+e.padding*0-e.width)/2:e.diff=-e.padding/2,n.attr("class","outer").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w).attr("width",p+f).attr("height",e.height+f),c.attr("class","inner").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w+h.height-1).attr("width",p+f).attr("height",e.height+f-h.height-3);const{subGraphTitleTopMargin:x}=T(t);o.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2-e.padding/3+(C(t.flowchart.htmlLabels)?5:3)+x})`);const v=n.node().getBBox();return e.height=v.height,e.intersect=function(d){return O(e,d)},a},le=(r,e)=>{const t=r.insert("g").attr("class",e.classes).attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("class","divider").attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2).attr("width",e.width+n).attr("height",e.height+n);const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.diff=-e.padding/2,e.intersect=function(g){return O(e,g)},t},he={rect:oe,roundedWithTitle:se,noteGroup:de,divider:le};let L={};const ce=(r,e)=>{i.trace("Inserting cluster");const t=e.shape||"rect";L[e.id]=he[t](r,e)},ge=()=>{L={}},M=async(r,e,t,a,n,o)=>{i.info("Graph in recursive render: XXX",y(e),n);const c=e.graph().rankdir;i.trace("Dir in recursive render - dir:",c);const g=r.insert("g").attr("class","root");e.nodes()?i.info("Recursive render XXX",e.nodes()):i.info("No nodes found for",e),e.edges().length>0&&i.trace("Recursive edges",e.edge(e.edges()[0]));const h=g.insert("g").attr("class","clusters"),f=g.insert("g").attr("class","edgePaths"),w=g.insert("g").attr("class","edgeLabels"),p=g.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(d){const s=e.node(d);if(n!==void 0){const m=JSON.parse(JSON.stringify(n.clusterData));i.info("Setting data for cluster XXX (",d,") ",m,n),e.setNode(n.id,m),e.parent(d)||(i.trace("Setting parent",d,n.id),e.setParent(d,n.id,m))}if(i.info("(Insert) Node XXX"+d+": "+JSON.stringify(e.node(d))),s&&s.clusterNode){i.info("Cluster identified",d,s.width,e.node(d));const m=await M(p,s.graph,t,a,e.node(d),o),b=m.elem;H(s,b),s.diff=m.diff||0,i.info("Node bounds (abc123)",d,s,s.width,s.x,s.y),W(b,s),i.warn("Recursive render complete ",b,s)}else e.children(d).length>0?(i.info("Cluster - the non recursive path XXX",d,s.id,s,e),i.info(X(s.id,e)),l[s.id]={id:X(s.id,e),node:s}):(i.info("Node - the non recursive path",d,s.id,s),await q(p,e.node(d),c))})),e.edges().forEach(function(d){const s=e.edge(d.v,d.w,d.name);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d)),i.info("Edge "+d.v+" -> "+d.w+": ",d," ",JSON.stringify(e.edge(d))),i.info("Fix",l,"ids:",d.v,d.w,"Translating: ",l[d.v],l[d.w]),Q(w,s)}),e.edges().forEach(function(d){i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d))}),i.info("#############################################"),i.info("### Layout ###"),i.info("#############################################"),i.info(e),A(e),i.info("Graph after layout:",y(e));let x=0;const{subGraphTitleTotalMargin:v}=T(o);return ae(e).forEach(function(d){const s=e.node(d);i.info("Position "+d+": "+JSON.stringify(e.node(d))),i.info("Position "+d+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s&&s.clusterNode?(s.y+=v,D(s)):e.children(d).length>0?(s.height+=v,ce(h,s),l[s.id].node=s):(s.y+=v/2,D(s))}),e.edges().forEach(function(d){const s=e.edge(d);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(s),s),s.points.forEach(b=>b.y+=v/2);const m=U(f,d,s,l,t,e,a);V(s,m)}),e.nodes().forEach(function(d){const s=e.node(d);i.info(d,s.type,s.diff),s.type==="group"&&(x=s.diff)}),{elem:g,diff:x}},me=async(r,e,t,a,n)=>{z(r,t,a,n),Y(),Z(),ge(),re(),i.warn("Graph at first:",JSON.stringify(y(e))),ie(e),i.warn("Graph after:",JSON.stringify(y(e)));const o=B();await M(r,e,a,n,void 0,o)};export{me as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aa as os}from"./index-BaIhc-dj.js";function cs(T,g){for(var p=0;p<g.length;p++){const o=g[p];if(typeof o!="string"&&!Array.isArray(o)){for(const r in o)if(r!=="default"&&!(r in T)){const n=Object.getOwnPropertyDescriptor(o,r);n&&Object.defineProperty(T,r,n.get?n:{enumerable:!0,get:()=>o[r]})}}}return Object.freeze(Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}))}var Xe,Yr;function ls(){if(Yr)return Xe;Yr=1;var T="6.5.2";return Xe=T,Xe}var Ke,Rr;function Br(){if(Rr)return Ke;Rr=1;var T=function(p,o){var r=this;if(o||(o={}),r.qpm=o.qpm?parseInt(o.qpm,10):null,!r.qpm){var n=p.metaText?p.metaText.tempo:null;r.qpm=p.getBpm(n)}r.extraMeasuresAtBeginning=o.extraMeasuresAtBeginning?parseInt(o.extraMeasuresAtBeginning,10):0,r.beatCallback=o.beatCallback,r.eventCallback=o.eventCallback,r.lineEndCallback=o.lineEndCallback,r.lineEndAnticipation=o.lineEndAnticipation?parseInt(o.lineEndAnticipation,10):0,r.beatSubdivisions=o.beatSubdivisions?parseInt(o.beatSubdivisions,10):1,r.joggerTimer=null,r.replaceTarget=function(s){r.noteTimings=s.setTiming(r.qpm,r.extraMeasuresAtBeginning),s.noteTimings.length===0&&(r.noteTimings=s.setTiming(0,0)),r.lineEndCallback&&(r.lineEndTimings=g(s.noteTimings,r.lineEndAnticipation)),r.startTime=null,r.currentBeat=0,r.currentEvent=0,r.currentLine=0,r.currentTime=0,r.isPaused=!1,r.isRunning=!1,r.pausedPercent=null,r.justUnpaused=!1,r.newSeekPercent=0,r.lastTimestamp=0,r.noteTimings.length!==0&&(r.millisecondsPerBeat=1e3/(r.qpm/60)/r.beatSubdivisions,r.lastMoment=r.noteTimings[r.noteTimings.length-1].milliseconds,r.totalBeats=Math.round(r.lastMoment/r.millisecondsPerBeat))},r.replaceTarget(p),r.doTiming=function(s){if(r.lastTimestamp!==s&&(r.lastTimestamp=s,r.startTime||(r.startTime=s),!r.isPaused&&r.isRunning)){for(r.currentTime=s-r.startTime,r.currentTime+=16;r.noteTimings.length>r.currentEvent&&r.noteTimings[r.currentEvent].milliseconds<r.currentTime;){if(r.eventCallback&&r.noteTimings[r.currentEvent].type==="event"){var l=r.startTime;r.eventCallback(r.noteTimings[r.currentEvent]),l!==r.startTime&&(r.currentTime=s-r.startTime)}r.currentEvent++}if(r.lineEndCallback&&r.lineEndTimings.length>r.currentLine&&r.lineEndTimings[r.currentLine].milliseconds<r.currentTime&&r.currentEvent<r.noteTimings.length){var d=r.noteTimings[r.currentEvent].milliseconds===r.currentTime?r.noteTimings[r.currentEvent]:r.noteTimings[r.currentEvent-1];r.lineEndCallback(r.lineEndTimings[r.currentLine],d,{line:r.currentLine,endTimings:r.lineEndTimings,currentTime:r.currentTime}),r.currentLine++}if(r.currentTime<r.lastMoment){if(requestAnimationFrame(r.doTiming),r.currentBeat*r.millisecondsPerBeat<r.currentTime){var f=r.doBeatCallback(s);f!==null&&(r.currentTime=f)}}else if(r.currentBeat<=r.totalBeats&&r.beatCallback){var u=r.doBeatCallback(s);u!==null&&(r.currentTime=u),requestAnimationFrame(r.doTiming)}if(r.currentTime>=r.lastMoment)if(r.eventCallback){var i=r.eventCallback(null);r.shouldStop(i).then(function(t){t&&r.stop()})}else r.stop()}},r.shouldStop=function(s){return new Promise(function(l){if(!s)return l(!0);if(s==="continue")return l(!1);s.then&&s.then(function(d){l(d!=="continue")})})},r.doBeatCallback=function(s){if(r.beatCallback){for(var l=r.currentEvent;l<r.noteTimings.length&&r.noteTimings[l].left===null;)l++;var d,f;if(l<r.noteTimings.length){for(d=r.noteTimings[l].milliseconds,l=Math.max(0,r.currentEvent-1);l>=0&&r.noteTimings[l].left===null;)l--;f=r.noteTimings[l]}var u={},i={};if(f){u.top=f.top,u.height=f.height;var t=Math.max(0,s-r.startTime-f.milliseconds),a=d-f.milliseconds,e=f.endX-f.left,h=a?t*e/a:0;u.left=f.left+h,r.currentEvent===0&&f.milliseconds>s-r.startTime&&(u.left=void 0),i={timestamp:s,startTime:r.startTime,ev:f,endMs:d,offMs:t,offPx:h,gapMs:a,gapPx:e}}else i={timestamp:s,startTime:r.startTime};var v=r.startTime;if(r.beatCallback(r.currentBeat/r.beatSubdivisions,r.totalBeats/r.beatSubdivisions,r.lastMoment,u,i),v!==r.startTime)return s-r.startTime;r.currentBeat++}return null};var c=60;r.animationJogger=function(){r.isRunning&&(r.doTiming(performance.now()),r.joggerTimer=setTimeout(r.animationJogger,c))},r.start=function(s,l){if(r.isRunning=!0,r.isPaused&&(r.isPaused=!1,s===void 0&&(r.justUnpaused=!0)),s)r.setProgress(s,l);else if(s===0)r.reset();else if(r.pausedPercent!==null){var d=performance.now();r.currentTime=r.lastMoment*r.pausedPercent,r.startTime=d-r.currentTime,r.pausedPercent=null,r.reportNext=!0}requestAnimationFrame(r.doTiming),r.joggerTimer=setTimeout(r.animationJogger,c)},r.pause=function(){r.isPaused=!0;var s=performance.now();r.pausedPercent=(s-r.startTime)/r.lastMoment,r.isRunning=!1,r.joggerTimer&&(clearTimeout(r.joggerTimer),r.joggerTimer=null)},r.currentMillisecond=function(){return r.currentTime},r.reset=function(){r.currentBeat=0,r.currentEvent=0,r.currentLine=0,r.startTime=null,r.pausedPercent=null},r.stop=function(){r.pause(),r.reset()},r.setProgress=function(s,l){var d;switch(l){case"seconds":r.currentTime=s*1e3,r.currentTime<0&&(r.currentTime=0),r.currentTime>r.lastMoment&&(r.currentTime=r.lastMoment),d=r.currentTime/r.lastMoment;break;case"beats":r.currentTime=s*r.millisecondsPerBeat*r.beatSubdivisions,r.currentTime<0&&(r.currentTime=0),r.currentTime>r.lastMoment&&(r.currentTime=r.lastMoment),d=r.currentTime/r.lastMoment;break;default:d=s,d<0&&(d=0),d>1&&(d=1),r.currentTime=r.lastMoment*d;break}r.isRunning||(r.pausedPercent=d);var f=performance.now();for(r.startTime=f-r.currentTime,r.currentEvent,r.currentEvent=0;r.noteTimings.length>r.currentEvent&&r.noteTimings[r.currentEvent].milliseconds<r.currentTime;)r.currentEvent++;if(r.lineEndCallback)for(r.currentLine=0;r.lineEndTimings.length>r.currentLine&&r.lineEndTimings[r.currentLine].milliseconds+r.lineEndAnticipation<r.currentTime;)r.currentLine++;var u=r.currentBeat;r.currentBeat=Math.floor(r.currentTime/r.millisecondsPerBeat),r.beatCallback&&u!==r.currentBeat&&r.doBeatCallback(r.startTime+r.currentTime),r.eventCallback&&r.currentEvent>=0&&r.noteTimings[r.currentEvent].type==="event"&&r.eventCallback(r.noteTimings[r.currentEvent]),r.lineEndCallback&&r.lineEndCallback(r.lineEndTimings[r.currentLine],r.noteTimings[r.currentEvent],{line:r.currentLine,endTimings:r.lineEndTimings}),r.joggerTimer=setTimeout(r.animationJogger,c)}};function g(p,o){for(var r=[],n=null,c=0;c<p.length;c++){var s=p[c];s.type!=="end"&&s.top!==n&&(r.push({measureNumber:s.measureNumber,milliseconds:s.milliseconds-o,top:s.top,bottom:s.top+s.height}),n=s.top)}return r}return Ke=T,Ke}var Ue,Wr;function hs(){if(Wr)return Ue;Wr=1;var T=Br(),g={};return function(){var p,o;g.startAnimation=function(r,n,c){p&&(p.stop(),p=void 0),c.showCursor&&(o=r.querySelector(".abcjs-cursor"),o||(o=document.createElement("DIV"),o.className="abcjs-cursor cursor",o.style.position="absolute",r.appendChild(o),r.style.position="relative"));function s(a){for(var e=0;e<a.length;e++){var h=a[e];h.classList.contains("abcjs-bar")||(h.style.display="none")}}var l;function d(a){if(l){var e=r.querySelectorAll(l);s(e)}l=a}function f(a){var e=r.querySelectorAll(a);s(e)}function u(a){c.hideCurrentMeasure?f(a):c.hideFinishedMeasures&&d(a)}function i(a){return".abcjs-l"+a.line+".abcjs-m"+a.measureNumber}function t(a){if(a){if(a.measureStart){var e=i(a);e&&u(e)}o&&(o.style.left=a.left+"px",o.style.top=a.top+"px",o.style.width=a.width+"px",o.style.height=a.height+"px")}else p.stop(),p=void 0}p=new T(n,{qpm:c.bpm,eventCallback:t}),p.start()},g.pauseAnimation=function(r){p&&(r?p.pause():p.start())},g.stopAnimation=function(){p&&(p.stop(),p=void 0)}}(),Ue=g,Ue}var $e,Gr;function Ne(){if(Gr)return $e;Gr=1;var T={};return T.cloneArray=function(g){for(var p=[],o=0;o<g.length;o++)p.push(Object.assign({},g[o]));return p},T.cloneHashOfHash=function(g){var p={};for(var o in g)g.hasOwnProperty(o)&&(p[o]=Object.assign({},g[o]));return p},T.cloneHashOfArrayOfHash=function(g){var p={};for(var o in g)g.hasOwnProperty(o)&&(p[o]=T.cloneArray(g[o]));return p},T.strip=function(g){return g.replace(/^\s+/,"").replace(/\s+$/,"")},T.startsWith=function(g,p){return g.indexOf(p)===0},T.endsWith=function(g,p){var o=g.length-p.length;return o>=0&&g.lastIndexOf(p)===o},T.last=function(g){return g.length===0?null:g[g.length-1]},$e=T,$e}var Qe,qr;function Pr(){if(qr)return Qe;qr=1;var T=Ne(),g={};return function(){var p,o,r,n,c;g.initialize=function(y,k,w,O,z){p=y,o=k,r=w,n=O,c=z,s()};function s(){r.annotationfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},r.gchordfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},r.historyfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},r.infofont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},r.measurefont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},r.partsfont={face:'"Times New Roman"',size:15,weight:"normal",style:"normal",decoration:"none"},r.repeatfont={face:'"Times New Roman"',size:13,weight:"normal",style:"normal",decoration:"none"},r.textfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},r.tripletfont={face:"Times",size:11,weight:"normal",style:"italic",decoration:"none"},r.vocalfont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},r.wordsfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},n.formatting.composerfont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},n.formatting.subtitlefont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},n.formatting.tempofont={face:'"Times New Roman"',size:15,weight:"bold",style:"normal",decoration:"none"},n.formatting.titlefont={face:'"Times New Roman"',size:20,weight:"normal",style:"normal",decoration:"none"},n.formatting.footerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},n.formatting.headerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},n.formatting.voicefont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},n.formatting.tablabelfont={face:'"Trebuchet MS"',size:16,weight:"normal",style:"normal",decoration:"none"},n.formatting.tabnumberfont={face:'"Arial"',size:11,weight:"normal",style:"normal",decoration:"none"},n.formatting.tabgracefont={face:'"Arial"',size:8,weight:"normal",style:"normal",decoration:"none"},n.formatting.annotationfont=r.annotationfont,n.formatting.gchordfont=r.gchordfont,n.formatting.historyfont=r.historyfont,n.formatting.infofont=r.infofont,n.formatting.measurefont=r.measurefont,n.formatting.partsfont=r.partsfont,n.formatting.repeatfont=r.repeatfont,n.formatting.textfont=r.textfont,n.formatting.tripletfont=r.tripletfont,n.formatting.vocalfont=r.vocalfont,n.formatting.wordsfont=r.wordsfont}var l={gchordfont:!0,measurefont:!0,partsfont:!0,annotationfont:!0,composerfont:!0,historyfont:!0,infofont:!0,subtitlefont:!0,textfont:!0,titlefont:!0,voicefont:!0},d=function(y){switch(y){case"Arial-Italic":return{face:"Arial",weight:"normal",style:"italic",decoration:"none"};case"Arial-Bold":return{face:"Arial",weight:"bold",style:"normal",decoration:"none"};case"Bookman-Demi":return{face:"Bookman,serif",weight:"bold",style:"normal",decoration:"none"};case"Bookman-DemiItalic":return{face:"Bookman,serif",weight:"bold",style:"italic",decoration:"none"};case"Bookman-Light":return{face:"Bookman,serif",weight:"normal",style:"normal",decoration:"none"};case"Bookman-LightItalic":return{face:"Bookman,serif",weight:"normal",style:"italic",decoration:"none"};case"Courier":return{face:'"Courier New"',weight:"normal",style:"normal",decoration:"none"};case"Courier-Oblique":return{face:'"Courier New"',weight:"normal",style:"italic",decoration:"none"};case"Courier-Bold":return{face:'"Courier New"',weight:"bold",style:"normal",decoration:"none"};case"Courier-BoldOblique":return{face:'"Courier New"',weight:"bold",style:"italic",decoration:"none"};case"AvantGarde-Book":return{face:"AvantGarde,Arial",weight:"normal",style:"normal",decoration:"none"};case"AvantGarde-BookOblique":return{face:"AvantGarde,Arial",weight:"normal",style:"italic",decoration:"none"};case"AvantGarde-Demi":case"Avant-Garde-Demi":return{face:"AvantGarde,Arial",weight:"bold",style:"normal",decoration:"none"};case"AvantGarde-DemiOblique":return{face:"AvantGarde,Arial",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Oblique":return{face:"Helvetica",weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Bold":return{face:"Helvetica",weight:"bold",style:"normal",decoration:"none"};case"Helvetica-BoldOblique":return{face:"Helvetica",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Narrow":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"normal",decoration:"none"};case"Helvetica-Narrow-Oblique":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Narrow-Bold":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"normal",decoration:"none"};case"Helvetica-Narrow-BoldOblique":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"italic",decoration:"none"};case"Palatino-Roman":return{face:"Palatino",weight:"normal",style:"normal",decoration:"none"};case"Palatino-Italic":return{face:"Palatino",weight:"normal",style:"italic",decoration:"none"};case"Palatino-Bold":return{face:"Palatino",weight:"bold",style:"normal",decoration:"none"};case"Palatino-BoldItalic":return{face:"Palatino",weight:"bold",style:"italic",decoration:"none"};case"NewCenturySchlbk-Roman":return{face:'"New Century",serif',weight:"normal",style:"normal",decoration:"none"};case"NewCenturySchlbk-Italic":return{face:'"New Century",serif',weight:"normal",style:"italic",decoration:"none"};case"NewCenturySchlbk-Bold":return{face:'"New Century",serif',weight:"bold",style:"normal",decoration:"none"};case"NewCenturySchlbk-BoldItalic":return{face:'"New Century",serif',weight:"bold",style:"italic",decoration:"none"};case"Times":case"Times-Roman":case"Times-Narrow":case"Times-Courier":case"Times-New-Roman":return{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none"};case"Times-Italic":case"Times-Italics":return{face:'"Times New Roman"',weight:"normal",style:"italic",decoration:"none"};case"Times-Bold":return{face:'"Times New Roman"',weight:"bold",style:"normal",decoration:"none"};case"Times-BoldItalic":return{face:'"Times New Roman"',weight:"bold",style:"italic",decoration:"none"};case"ZapfChancery-MediumItalic":return{face:'"Zapf Chancery",cursive,serif',weight:"normal",style:"normal",decoration:"none"};default:return null}},f=function(y,k,w,O,z){function V(){var fe=parseInt(y[0].token);return y.shift(),k?y.length===0?{face:k.face,weight:k.weight,style:k.style,decoration:k.decoration,size:fe}:y.length===1&&y[0].token==="box"&&l[z]?{face:k.face,weight:k.weight,style:k.style,decoration:k.decoration,size:fe,box:!0}:(o("Extra parameters in font definition.",w,O),{face:k.face,weight:k.weight,style:k.style,decoration:k.decoration,size:fe}):(o("Can't set just the size of the font since there is no default value.",w,O),{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none",size:fe})}if(y[0].token==="*"){if(y.shift(),y[0].type==="number")return V();o("Expected font size number after *.",w,O)}if(y[0].type==="number")return V();for(var I=[],K,Q="normal",G="normal",ee="none",te=!1,ne="face",X=!1;y.length;){var ae=y.shift(),$=ae.token.toLowerCase();switch(ne){case"face":X||$!=="utf"&&ae.type!=="number"&&$!=="bold"&&$!=="italic"&&$!=="underline"&&$!=="box"?I.length>0&&ae.token==="-"?(X=!0,I[I.length-1]=I[I.length-1]+ae.token):X?(X=!1,I[I.length-1]=I[I.length-1]+ae.token):I.push(ae.token):ae.type==="number"?(K?o("Font size specified twice in font definition.",w,O):K=ae.token,ne="modifier"):$==="bold"?Q="bold":$==="italic"?G="italic":$==="underline"?ee="underline":$==="box"?(l[z]?te=!0:o(`This font style doesn't support "box"`,w,O),ne="finished"):$==="utf"?(ae=y.shift(),ne="size"):o("Unknown parameter "+ae.token+" in font definition.",w,O);break;case"size":ae.type==="number"?K?o("Font size specified twice in font definition.",w,O):K=ae.token:o("Expected font size in font definition.",w,O),ne="modifier";break;case"modifier":$==="bold"?Q="bold":$==="italic"?G="italic":$==="underline"?ee="underline":$==="box"?(l[z]?te=!0:o(`This font style doesn't support "box"`,w,O),ne="finished"):o("Unknown parameter "+ae.token+" in font definition.",w,O);break;case"finished":o('Extra characters found after "box" in font definition.',w,O);break}}K===void 0?k?K=k.size:(o("Must specify the size of the font since there is no default value.",w,O),K=12):K=parseFloat(K),I=I.join(" "),I===""&&(k?I=k.face:(o("Must specify the name of the font since there is no default value.",w,O),I="sans-serif"));var se=d(I),ce={};return se?(ce.face=se.face,ce.weight=se.weight,ce.style=se.style,ce.decoration=se.decoration,ce.size=K,te&&(ce.box=!0),ce):(ce.face=I,ce.weight=Q,ce.style=G,ce.decoration=ee,ce.size=K,te&&(ce.box=!0),ce)},u=function(y,k,w){return k.length===0?'Directive "'+y+'" requires a font as a parameter.':(r[y]=f(k,r[y],w,0,y),r.is_in_header&&(n.formatting[y]=r[y]),null)},i=function(y,k,w){return k.length===0?'Directive "'+y+'" requires a font as a parameter.':(n.formatting[y]=f(k,n.formatting[y],w,0,y),null)},t=function(y,k){var w="";k.forEach(function(z){w+=z.token});var O=parseFloat(w);if(isNaN(O)||O===0)return'Directive "'+y+'" requires a number as a parameter.';n.formatting.scale=O},a=["acoustic-bass-drum","bass-drum-1","side-stick","acoustic-snare","hand-clap","electric-snare","low-floor-tom","closed-hi-hat","high-floor-tom","pedal-hi-hat","low-tom","open-hi-hat","low-mid-tom","hi-mid-tom","crash-cymbal-1","high-tom","ride-cymbal-1","chinese-cymbal","ride-bell","tambourine","splash-cymbal","cowbell","crash-cymbal-2","vibraslap","ride-cymbal-2","hi-bongo","low-bongo","mute-hi-conga","open-hi-conga","low-conga","high-timbale","low-timbale","high-agogo","low-agogo","cabasa","maracas","short-whistle","long-whistle","short-guiro","long-guiro","claves","hi-wood-block","low-wood-block","mute-cuica","open-cuica","mute-triangle","open-triangle"],e=function(y){var k=y.split(/\s+/);if(k.length!==2&&k.length!==3)return{error:'Expected parameters "abc-note", "drum-sound", and optionally "note-head"'};var w=k[0],O=parseInt(k[1],10);if((isNaN(O)||O<35||O>81)&&k[1]&&(O=a.indexOf(k[1].toLowerCase())+35),isNaN(O)||O<35||O>81)return{error:'Expected drum name, received "'+k[1]+'"'};var z={sound:O};return k.length===3&&(z.noteHead=k[2]),{key:w,value:z}},h=function(y,k){var w=p.getMeasurement(k);return w.used===0||k.length!==0?{error:'Directive "'+y+'" requires a measurement as a parameter.'}:w.value},v=function(y,k){var w=p.getMeasurement(k);return w.used===0||k.length!==0?'Directive "'+y+'" requires a measurement as a parameter.':(n.formatting[y]=w.value,null)},m=function(y,k,w,O,z){if(w.length!==1||w[0].type!=="number")return'Directive "'+k+'" requires a number as a parameter.';var V=w[0].intt;return O!==void 0&&V<O?'Directive "'+k+'" requires a number greater than or equal to '+O+" as a parameter.":z!==void 0&&V>z?'Directive "'+k+'" requires a number less than or equal to '+z+" as a parameter.":(r[y]=V,null)},x=function(y,k,w){if(w.length===1&&(w[0].token==="true"||w[0].token==="false"))return r[y]=w[0].token==="true",null;var O=m(y,k,w,0,1);return O!==null?O:(r[y]=r[y]===1,null)},C=function(y,k,w,O){if(w.length!==1)return'Directive "'+k+'" requires one of [ '+O.join(", ")+" ] as a parameter.";for(var z=w[0].token,V=!1,I=0;!V&&I<O.length;I++)O[I]===z&&(V=!0);return V?(r[y]=z,null):'Directive "'+k+'" requires one of [ '+O.join(", ")+" ] as a parameter."},S=["nobarlines","barlines","beataccents","nobeataccents","droneon","droneoff","drumon","drumoff","fermatafixed","fermataproportional","gchordon","gchordoff","controlcombo","temperamentnormal","noportamento"],j=["gchord","ptstress","beatstring"],F=["bassvol","chordvol","c","channel","beatmod","deltaloudness","drumbars","gracedivider","makechordchannels","randomchordattack","chordattack","stressmodel","transpose","rtranspose","vol","volinc","gchordbars"],b=["program"],M=["ratio","snt","bendvelocity","pitchbend","control","temperamentlinear"],B=["beat"],A=["drone"],P=["portamento"],N=["expand","grace","trim"],E=["drum","chordname"],_=["bassprog","chordprog"],L=function(y,k,w){var O=y.shift().token,z=[];if(S.indexOf(O)>=0)y.length!==0&&o("Unexpected parameter in MIDI "+O,w,0);else if(j.indexOf(O)>=0)y.length!==1?o("Expected one parameter in MIDI "+O,w,0):z.push(y[0].token);else if(F.indexOf(O)>=0)y.length!==1?o("Expected one parameter in MIDI "+O,w,0):y[0].type!=="number"?o("Expected one integer parameter in MIDI "+O,w,0):z.push(y[0].intt);else if(b.indexOf(O)>=0)y.length!==1&&y.length!==2?o("Expected one or two parameters in MIDI "+O,w,0):y[0].type!=="number"||y.length===2&&y[1].type!=="number"?o("Expected integer parameter in MIDI "+O,w,0):(z.push(y[0].intt),y.length===2&&z.push(y[1].intt));else if(M.indexOf(O)>=0)y.length!==2?o("Expected two parameters in MIDI "+O,w,0):y[0].type!=="number"||y[1].type!=="number"?o("Expected two integer parameters in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[1].intt));else if(P.indexOf(O)>=0)y.length!==2?o("Expected two parameters in MIDI "+O,w,0):y[0].type!=="alpha"||y[1].type!=="number"?o("Expected one string and one integer parameters in MIDI "+O,w,0):(z.push(y[0].token),z.push(y[1].intt));else if(O==="drummap")y.length===2&&y[0].type==="alpha"&&y[1].type==="number"?(k.formatting||(k.formatting={}),k.formatting.midi||(k.formatting.midi={}),k.formatting.midi.drummap||(k.formatting.midi.drummap={}),k.formatting.midi.drummap[y[0].token]=y[1].intt,z=k.formatting.midi.drummap):y.length===3&&y[0].type==="punct"&&y[1].type==="alpha"&&y[2].type==="number"?(k.formatting||(k.formatting={}),k.formatting.midi||(k.formatting.midi={}),k.formatting.midi.drummap||(k.formatting.midi.drummap={}),k.formatting.midi.drummap[y[0].token+y[1].token]=y[2].intt,z=k.formatting.midi.drummap):o("Expected one note name and one integer parameter in MIDI "+O,w,0);else if(N.indexOf(O)>=0)y.length!==3||y[0].type!=="number"||y[1].token!=="/"||y[2].type!=="number"?o("Expected fraction parameter in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[2].intt));else if(B.indexOf(O)>=0)y.length!==4?o("Expected four parameters in MIDI "+O,w,0):y[0].type!=="number"||y[1].type!=="number"||y[2].type!=="number"||y[3].type!=="number"?o("Expected four integer parameters in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[1].intt),z.push(y[2].intt),z.push(y[3].intt));else if(A.indexOf(O)>=0)y.length!==5?o("Expected five parameters in MIDI "+O,w,0):y[0].type!=="number"||y[1].type!=="number"||y[2].type!=="number"||y[3].type!=="number"||y[4].type!=="number"?o("Expected five integer parameters in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[1].intt),z.push(y[2].intt),z.push(y[3].intt),z.push(y[4].intt));else if(b.indexOf(O)>=0)y.length!==1||y.length!==4?o("Expected one or two parameters in MIDI "+O,w,0):y[0].type!=="number"?o("Expected integer parameter in MIDI "+O,w,0):y.length===4?(y[1].token!=="octave"&&o("Expected octave parameter in MIDI "+O,w,0),y[2].token!=="="&&o("Expected octave parameter in MIDI "+O,w,0),y[3].type!=="number"&&o("Expected integer parameter for octave in MIDI "+O,w,0)):(z.push(y[0].intt),y.length===4&&z.push(y[3].intt));else if(E.indexOf(O)>=0)if(y.length<2)o("Expected string parameter and at least one integer parameter in MIDI "+O,w,0);else if(y[0].type!=="alpha")o("Expected string parameter and at least one integer parameter in MIDI "+O,w,0);else{var V=y.shift();for(z.push(V.token);y.length>0;)V=y.shift(),V.type!=="number"&&o("Expected integer parameter in MIDI "+O,w,0),z.push(V.intt)}else if(_.indexOf(O)>=0){if(y.length!==1&&y.length!==2)o("Expected one or two parameters in MIDI "+O,w,0);else if(y[0].type!=="number")o("Expected integer parameter in MIDI "+O,w,0);else if(y.length===2&&y[1].type!=="alpha")o("Expected alpha parameter in MIDI "+O,w,0);else if(z.push(y[0].intt),y.length===2){var I=y[1].token;I.indexOf("octave=")!=-1?(I=I.replace("octave=",""),I=parseInt(I),isNaN(I)?o("Expected octave value in MIDI"+O):(I<-1&&(o("Expected octave= in MIDI "+O+" to be >= -1 (recv:"+I+")"),I=-1),I>3&&(o("Expected octave= in MIDI "+O+" to be <= 3 (recv:"+I+")"),I=3),z.push(I))):o("Expected octave= in MIDI"+O)}}c.hasBeginMusic()?c.appendElement("midi",-1,-1,{cmd:O,params:z}):(k.formatting.midi===void 0&&(k.formatting.midi={}),k.formatting.midi[O]=z)};g.parseFontChangeLine=function(y){y=y.replace(/\$\$/g,"");var k=y.split("$");if(k.length>1&&r.setfont){var w=[];k[0]!==""&&w.push({text:k[0]});for(var O=1;O<k.length;O++)if(k[O][0]==="0")w.push({text:k[O].substring(1).replace(/\x03/g,"$$")});else{var z=parseInt(k[O][0],10);r.setfont[z]?w.push({font:r.setfont[z],text:k[O].substring(1).replace(/\x03/g,"$$")}):w[w.length-1].text+="$"+k[O].replace(/\x03/g,"$$")}return w}return y.replace(/\x03/g,"$$")};var D=["auto","above","below","hidden"];g.addDirective=function(y){var k=p.tokenize(y,0,y.length);if(k.length===0||k[0].type!=="alpha")return null;var w=y.substring(y.indexOf(k[0].token)+k[0].token.length);w=p.stripComment(w);var O=k.shift().token.toLowerCase(),z="",V;switch(O){case"bagpipes":n.formatting.bagpipes=!0;break;case"flatbeams":n.formatting.flatbeams=!0;break;case"jazzchords":n.formatting.jazzchords=!0;break;case"accentAbove":n.formatting.accentAbove=!0;break;case"germanAlphabet":n.formatting.germanAlphabet=!0;break;case"landscape":r.landscape=!0;break;case"papersize":r.papersize=w;break;case"graceslurs":if(k.length!==1)return"Directive graceslurs requires one parameter: 0 or 1";if(k[0].token==="0"||k[0].token==="false")n.formatting.graceSlurs=!1;else if(k[0].token==="1"||k[0].token==="true")n.formatting.graceSlurs=!0;else return"Directive graceslurs requires one parameter: 0 or 1 (received "+k[0].token+")";break;case"lineThickness":var I=H(k);if(I.value!==void 0&&(n.formatting.lineThickness=I.value),I.error)return I.error;break;case"stretchlast":var K=H(k);if(K.value!==void 0&&(n.formatting.stretchlast=K.value),K.error)return K.error;break;case"titlecaps":r.titlecaps=!0;break;case"titleleft":n.formatting.titleleft=!0;break;case"measurebox":n.formatting.measurebox=!0;break;case"vocal":return C("vocalPosition",O,k,D);case"dynamic":return C("dynamicPosition",O,k,D);case"gchord":return C("chordPosition",O,k,D);case"ornament":return C("ornamentPosition",O,k,D);case"volume":return C("volumePosition",O,k,D);case"botmargin":case"botspace":case"composerspace":case"indent":case"leftmargin":case"linesep":case"musicspace":case"partsspace":case"pageheight":case"pagewidth":case"rightmargin":case"stafftopmargin":case"staffsep":case"staffwidth":case"subtitlespace":case"sysstaffsep":case"systemsep":case"textspace":case"titlespace":case"topmargin":case"topspace":case"vocalspace":case"wordsspace":return v(O,k);case"voicescale":if(k.length!==1||k[0].type!=="number")return"voicescale requires one float as a parameter";var Q=k.shift();return r.currentVoice&&(r.currentVoice.scale=Q.floatt,c.changeVoiceScale(r.currentVoice.scale)),null;case"voicecolor":if(k.length!==1)return"voicecolor requires one string as a parameter";var G=k.shift();return r.currentVoice&&(r.currentVoice.color=G.token,c.changeVoiceColor(r.currentVoice.color)),null;case"vskip":var ee=Math.round(h(O,k));return ee.error?ee.error:(c.addSpacing(ee),null);case"scale":t(O,k);break;case"sep":if(k.length===0)c.addSeparator(14,14,85,{startChar:r.iChar,endChar:r.iChar+5});else{var te=p.getMeasurement(k);if(te.used===0)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var ne=te.value;if(te=p.getMeasurement(k),te.used===0)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var X=te.value;if(te=p.getMeasurement(k),te.used===0||k.length!==0)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var ae=te.value;c.addSeparator(ne,X,ae,{startChar:r.iChar,endChar:r.iChar+w.length})}break;case"barsperstaff":if(z=m("barsperstaff",O,k),z!==null)return z;break;case"staffnonote":if(k.length!==1)return"Directive staffnonote requires one parameter: 0 or 1";if(k[0].token==="0")r.staffnonote=!0;else if(k[0].token==="1")r.staffnonote=!1;else return"Directive staffnonote requires one parameter: 0 or 1 (received "+k[0].token+")";break;case"printtempo":if(z=x("printTempo",O,k),z!==null)return z;break;case"partsbox":if(z=x("partsBox",O,k),z!==null)return z;r.partsfont.box=r.partsBox;break;case"freegchord":if(z=x("freegchord",O,k),z!==null)return z;break;case"measurenb":case"barnumbers":if(z=m("barNumbers",O,k),z!==null)return z;break;case"setbarnb":if(k.length!==1||k[0].type!=="number")return"Directive setbarnb requires a number as a parameter.";r.currBarNumber=c.setBarNumberImmediate(k[0].intt);break;case"keywarn":if(k.length!==1||k[0].type!=="number"||k[0].intt!==1&&k[0].intt!==0)return"Directive "+O+" requires 0 or 1 as a parameter.";r[O]=k[0].intt===1;break;case"begintext":var $="";for(V=p.nextLine();V&&V.indexOf("%%endtext")!==0;){if(T.startsWith(V,"%%")){var se=V.substring(2);se=se.trim()+`
|
|
1
|
+
import{aa as os}from"./index--DBVktm0.js";function cs(T,g){for(var p=0;p<g.length;p++){const o=g[p];if(typeof o!="string"&&!Array.isArray(o)){for(const r in o)if(r!=="default"&&!(r in T)){const n=Object.getOwnPropertyDescriptor(o,r);n&&Object.defineProperty(T,r,n.get?n:{enumerable:!0,get:()=>o[r]})}}}return Object.freeze(Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}))}var Xe,Yr;function ls(){if(Yr)return Xe;Yr=1;var T="6.5.2";return Xe=T,Xe}var Ke,Rr;function Br(){if(Rr)return Ke;Rr=1;var T=function(p,o){var r=this;if(o||(o={}),r.qpm=o.qpm?parseInt(o.qpm,10):null,!r.qpm){var n=p.metaText?p.metaText.tempo:null;r.qpm=p.getBpm(n)}r.extraMeasuresAtBeginning=o.extraMeasuresAtBeginning?parseInt(o.extraMeasuresAtBeginning,10):0,r.beatCallback=o.beatCallback,r.eventCallback=o.eventCallback,r.lineEndCallback=o.lineEndCallback,r.lineEndAnticipation=o.lineEndAnticipation?parseInt(o.lineEndAnticipation,10):0,r.beatSubdivisions=o.beatSubdivisions?parseInt(o.beatSubdivisions,10):1,r.joggerTimer=null,r.replaceTarget=function(s){r.noteTimings=s.setTiming(r.qpm,r.extraMeasuresAtBeginning),s.noteTimings.length===0&&(r.noteTimings=s.setTiming(0,0)),r.lineEndCallback&&(r.lineEndTimings=g(s.noteTimings,r.lineEndAnticipation)),r.startTime=null,r.currentBeat=0,r.currentEvent=0,r.currentLine=0,r.currentTime=0,r.isPaused=!1,r.isRunning=!1,r.pausedPercent=null,r.justUnpaused=!1,r.newSeekPercent=0,r.lastTimestamp=0,r.noteTimings.length!==0&&(r.millisecondsPerBeat=1e3/(r.qpm/60)/r.beatSubdivisions,r.lastMoment=r.noteTimings[r.noteTimings.length-1].milliseconds,r.totalBeats=Math.round(r.lastMoment/r.millisecondsPerBeat))},r.replaceTarget(p),r.doTiming=function(s){if(r.lastTimestamp!==s&&(r.lastTimestamp=s,r.startTime||(r.startTime=s),!r.isPaused&&r.isRunning)){for(r.currentTime=s-r.startTime,r.currentTime+=16;r.noteTimings.length>r.currentEvent&&r.noteTimings[r.currentEvent].milliseconds<r.currentTime;){if(r.eventCallback&&r.noteTimings[r.currentEvent].type==="event"){var l=r.startTime;r.eventCallback(r.noteTimings[r.currentEvent]),l!==r.startTime&&(r.currentTime=s-r.startTime)}r.currentEvent++}if(r.lineEndCallback&&r.lineEndTimings.length>r.currentLine&&r.lineEndTimings[r.currentLine].milliseconds<r.currentTime&&r.currentEvent<r.noteTimings.length){var d=r.noteTimings[r.currentEvent].milliseconds===r.currentTime?r.noteTimings[r.currentEvent]:r.noteTimings[r.currentEvent-1];r.lineEndCallback(r.lineEndTimings[r.currentLine],d,{line:r.currentLine,endTimings:r.lineEndTimings,currentTime:r.currentTime}),r.currentLine++}if(r.currentTime<r.lastMoment){if(requestAnimationFrame(r.doTiming),r.currentBeat*r.millisecondsPerBeat<r.currentTime){var f=r.doBeatCallback(s);f!==null&&(r.currentTime=f)}}else if(r.currentBeat<=r.totalBeats&&r.beatCallback){var u=r.doBeatCallback(s);u!==null&&(r.currentTime=u),requestAnimationFrame(r.doTiming)}if(r.currentTime>=r.lastMoment)if(r.eventCallback){var i=r.eventCallback(null);r.shouldStop(i).then(function(t){t&&r.stop()})}else r.stop()}},r.shouldStop=function(s){return new Promise(function(l){if(!s)return l(!0);if(s==="continue")return l(!1);s.then&&s.then(function(d){l(d!=="continue")})})},r.doBeatCallback=function(s){if(r.beatCallback){for(var l=r.currentEvent;l<r.noteTimings.length&&r.noteTimings[l].left===null;)l++;var d,f;if(l<r.noteTimings.length){for(d=r.noteTimings[l].milliseconds,l=Math.max(0,r.currentEvent-1);l>=0&&r.noteTimings[l].left===null;)l--;f=r.noteTimings[l]}var u={},i={};if(f){u.top=f.top,u.height=f.height;var t=Math.max(0,s-r.startTime-f.milliseconds),a=d-f.milliseconds,e=f.endX-f.left,h=a?t*e/a:0;u.left=f.left+h,r.currentEvent===0&&f.milliseconds>s-r.startTime&&(u.left=void 0),i={timestamp:s,startTime:r.startTime,ev:f,endMs:d,offMs:t,offPx:h,gapMs:a,gapPx:e}}else i={timestamp:s,startTime:r.startTime};var v=r.startTime;if(r.beatCallback(r.currentBeat/r.beatSubdivisions,r.totalBeats/r.beatSubdivisions,r.lastMoment,u,i),v!==r.startTime)return s-r.startTime;r.currentBeat++}return null};var c=60;r.animationJogger=function(){r.isRunning&&(r.doTiming(performance.now()),r.joggerTimer=setTimeout(r.animationJogger,c))},r.start=function(s,l){if(r.isRunning=!0,r.isPaused&&(r.isPaused=!1,s===void 0&&(r.justUnpaused=!0)),s)r.setProgress(s,l);else if(s===0)r.reset();else if(r.pausedPercent!==null){var d=performance.now();r.currentTime=r.lastMoment*r.pausedPercent,r.startTime=d-r.currentTime,r.pausedPercent=null,r.reportNext=!0}requestAnimationFrame(r.doTiming),r.joggerTimer=setTimeout(r.animationJogger,c)},r.pause=function(){r.isPaused=!0;var s=performance.now();r.pausedPercent=(s-r.startTime)/r.lastMoment,r.isRunning=!1,r.joggerTimer&&(clearTimeout(r.joggerTimer),r.joggerTimer=null)},r.currentMillisecond=function(){return r.currentTime},r.reset=function(){r.currentBeat=0,r.currentEvent=0,r.currentLine=0,r.startTime=null,r.pausedPercent=null},r.stop=function(){r.pause(),r.reset()},r.setProgress=function(s,l){var d;switch(l){case"seconds":r.currentTime=s*1e3,r.currentTime<0&&(r.currentTime=0),r.currentTime>r.lastMoment&&(r.currentTime=r.lastMoment),d=r.currentTime/r.lastMoment;break;case"beats":r.currentTime=s*r.millisecondsPerBeat*r.beatSubdivisions,r.currentTime<0&&(r.currentTime=0),r.currentTime>r.lastMoment&&(r.currentTime=r.lastMoment),d=r.currentTime/r.lastMoment;break;default:d=s,d<0&&(d=0),d>1&&(d=1),r.currentTime=r.lastMoment*d;break}r.isRunning||(r.pausedPercent=d);var f=performance.now();for(r.startTime=f-r.currentTime,r.currentEvent,r.currentEvent=0;r.noteTimings.length>r.currentEvent&&r.noteTimings[r.currentEvent].milliseconds<r.currentTime;)r.currentEvent++;if(r.lineEndCallback)for(r.currentLine=0;r.lineEndTimings.length>r.currentLine&&r.lineEndTimings[r.currentLine].milliseconds+r.lineEndAnticipation<r.currentTime;)r.currentLine++;var u=r.currentBeat;r.currentBeat=Math.floor(r.currentTime/r.millisecondsPerBeat),r.beatCallback&&u!==r.currentBeat&&r.doBeatCallback(r.startTime+r.currentTime),r.eventCallback&&r.currentEvent>=0&&r.noteTimings[r.currentEvent].type==="event"&&r.eventCallback(r.noteTimings[r.currentEvent]),r.lineEndCallback&&r.lineEndCallback(r.lineEndTimings[r.currentLine],r.noteTimings[r.currentEvent],{line:r.currentLine,endTimings:r.lineEndTimings}),r.joggerTimer=setTimeout(r.animationJogger,c)}};function g(p,o){for(var r=[],n=null,c=0;c<p.length;c++){var s=p[c];s.type!=="end"&&s.top!==n&&(r.push({measureNumber:s.measureNumber,milliseconds:s.milliseconds-o,top:s.top,bottom:s.top+s.height}),n=s.top)}return r}return Ke=T,Ke}var Ue,Wr;function hs(){if(Wr)return Ue;Wr=1;var T=Br(),g={};return function(){var p,o;g.startAnimation=function(r,n,c){p&&(p.stop(),p=void 0),c.showCursor&&(o=r.querySelector(".abcjs-cursor"),o||(o=document.createElement("DIV"),o.className="abcjs-cursor cursor",o.style.position="absolute",r.appendChild(o),r.style.position="relative"));function s(a){for(var e=0;e<a.length;e++){var h=a[e];h.classList.contains("abcjs-bar")||(h.style.display="none")}}var l;function d(a){if(l){var e=r.querySelectorAll(l);s(e)}l=a}function f(a){var e=r.querySelectorAll(a);s(e)}function u(a){c.hideCurrentMeasure?f(a):c.hideFinishedMeasures&&d(a)}function i(a){return".abcjs-l"+a.line+".abcjs-m"+a.measureNumber}function t(a){if(a){if(a.measureStart){var e=i(a);e&&u(e)}o&&(o.style.left=a.left+"px",o.style.top=a.top+"px",o.style.width=a.width+"px",o.style.height=a.height+"px")}else p.stop(),p=void 0}p=new T(n,{qpm:c.bpm,eventCallback:t}),p.start()},g.pauseAnimation=function(r){p&&(r?p.pause():p.start())},g.stopAnimation=function(){p&&(p.stop(),p=void 0)}}(),Ue=g,Ue}var $e,Gr;function Ne(){if(Gr)return $e;Gr=1;var T={};return T.cloneArray=function(g){for(var p=[],o=0;o<g.length;o++)p.push(Object.assign({},g[o]));return p},T.cloneHashOfHash=function(g){var p={};for(var o in g)g.hasOwnProperty(o)&&(p[o]=Object.assign({},g[o]));return p},T.cloneHashOfArrayOfHash=function(g){var p={};for(var o in g)g.hasOwnProperty(o)&&(p[o]=T.cloneArray(g[o]));return p},T.strip=function(g){return g.replace(/^\s+/,"").replace(/\s+$/,"")},T.startsWith=function(g,p){return g.indexOf(p)===0},T.endsWith=function(g,p){var o=g.length-p.length;return o>=0&&g.lastIndexOf(p)===o},T.last=function(g){return g.length===0?null:g[g.length-1]},$e=T,$e}var Qe,qr;function Pr(){if(qr)return Qe;qr=1;var T=Ne(),g={};return function(){var p,o,r,n,c;g.initialize=function(y,k,w,O,z){p=y,o=k,r=w,n=O,c=z,s()};function s(){r.annotationfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},r.gchordfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},r.historyfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},r.infofont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},r.measurefont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},r.partsfont={face:'"Times New Roman"',size:15,weight:"normal",style:"normal",decoration:"none"},r.repeatfont={face:'"Times New Roman"',size:13,weight:"normal",style:"normal",decoration:"none"},r.textfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},r.tripletfont={face:"Times",size:11,weight:"normal",style:"italic",decoration:"none"},r.vocalfont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},r.wordsfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},n.formatting.composerfont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},n.formatting.subtitlefont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},n.formatting.tempofont={face:'"Times New Roman"',size:15,weight:"bold",style:"normal",decoration:"none"},n.formatting.titlefont={face:'"Times New Roman"',size:20,weight:"normal",style:"normal",decoration:"none"},n.formatting.footerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},n.formatting.headerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},n.formatting.voicefont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},n.formatting.tablabelfont={face:'"Trebuchet MS"',size:16,weight:"normal",style:"normal",decoration:"none"},n.formatting.tabnumberfont={face:'"Arial"',size:11,weight:"normal",style:"normal",decoration:"none"},n.formatting.tabgracefont={face:'"Arial"',size:8,weight:"normal",style:"normal",decoration:"none"},n.formatting.annotationfont=r.annotationfont,n.formatting.gchordfont=r.gchordfont,n.formatting.historyfont=r.historyfont,n.formatting.infofont=r.infofont,n.formatting.measurefont=r.measurefont,n.formatting.partsfont=r.partsfont,n.formatting.repeatfont=r.repeatfont,n.formatting.textfont=r.textfont,n.formatting.tripletfont=r.tripletfont,n.formatting.vocalfont=r.vocalfont,n.formatting.wordsfont=r.wordsfont}var l={gchordfont:!0,measurefont:!0,partsfont:!0,annotationfont:!0,composerfont:!0,historyfont:!0,infofont:!0,subtitlefont:!0,textfont:!0,titlefont:!0,voicefont:!0},d=function(y){switch(y){case"Arial-Italic":return{face:"Arial",weight:"normal",style:"italic",decoration:"none"};case"Arial-Bold":return{face:"Arial",weight:"bold",style:"normal",decoration:"none"};case"Bookman-Demi":return{face:"Bookman,serif",weight:"bold",style:"normal",decoration:"none"};case"Bookman-DemiItalic":return{face:"Bookman,serif",weight:"bold",style:"italic",decoration:"none"};case"Bookman-Light":return{face:"Bookman,serif",weight:"normal",style:"normal",decoration:"none"};case"Bookman-LightItalic":return{face:"Bookman,serif",weight:"normal",style:"italic",decoration:"none"};case"Courier":return{face:'"Courier New"',weight:"normal",style:"normal",decoration:"none"};case"Courier-Oblique":return{face:'"Courier New"',weight:"normal",style:"italic",decoration:"none"};case"Courier-Bold":return{face:'"Courier New"',weight:"bold",style:"normal",decoration:"none"};case"Courier-BoldOblique":return{face:'"Courier New"',weight:"bold",style:"italic",decoration:"none"};case"AvantGarde-Book":return{face:"AvantGarde,Arial",weight:"normal",style:"normal",decoration:"none"};case"AvantGarde-BookOblique":return{face:"AvantGarde,Arial",weight:"normal",style:"italic",decoration:"none"};case"AvantGarde-Demi":case"Avant-Garde-Demi":return{face:"AvantGarde,Arial",weight:"bold",style:"normal",decoration:"none"};case"AvantGarde-DemiOblique":return{face:"AvantGarde,Arial",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Oblique":return{face:"Helvetica",weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Bold":return{face:"Helvetica",weight:"bold",style:"normal",decoration:"none"};case"Helvetica-BoldOblique":return{face:"Helvetica",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Narrow":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"normal",decoration:"none"};case"Helvetica-Narrow-Oblique":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Narrow-Bold":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"normal",decoration:"none"};case"Helvetica-Narrow-BoldOblique":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"italic",decoration:"none"};case"Palatino-Roman":return{face:"Palatino",weight:"normal",style:"normal",decoration:"none"};case"Palatino-Italic":return{face:"Palatino",weight:"normal",style:"italic",decoration:"none"};case"Palatino-Bold":return{face:"Palatino",weight:"bold",style:"normal",decoration:"none"};case"Palatino-BoldItalic":return{face:"Palatino",weight:"bold",style:"italic",decoration:"none"};case"NewCenturySchlbk-Roman":return{face:'"New Century",serif',weight:"normal",style:"normal",decoration:"none"};case"NewCenturySchlbk-Italic":return{face:'"New Century",serif',weight:"normal",style:"italic",decoration:"none"};case"NewCenturySchlbk-Bold":return{face:'"New Century",serif',weight:"bold",style:"normal",decoration:"none"};case"NewCenturySchlbk-BoldItalic":return{face:'"New Century",serif',weight:"bold",style:"italic",decoration:"none"};case"Times":case"Times-Roman":case"Times-Narrow":case"Times-Courier":case"Times-New-Roman":return{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none"};case"Times-Italic":case"Times-Italics":return{face:'"Times New Roman"',weight:"normal",style:"italic",decoration:"none"};case"Times-Bold":return{face:'"Times New Roman"',weight:"bold",style:"normal",decoration:"none"};case"Times-BoldItalic":return{face:'"Times New Roman"',weight:"bold",style:"italic",decoration:"none"};case"ZapfChancery-MediumItalic":return{face:'"Zapf Chancery",cursive,serif',weight:"normal",style:"normal",decoration:"none"};default:return null}},f=function(y,k,w,O,z){function V(){var fe=parseInt(y[0].token);return y.shift(),k?y.length===0?{face:k.face,weight:k.weight,style:k.style,decoration:k.decoration,size:fe}:y.length===1&&y[0].token==="box"&&l[z]?{face:k.face,weight:k.weight,style:k.style,decoration:k.decoration,size:fe,box:!0}:(o("Extra parameters in font definition.",w,O),{face:k.face,weight:k.weight,style:k.style,decoration:k.decoration,size:fe}):(o("Can't set just the size of the font since there is no default value.",w,O),{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none",size:fe})}if(y[0].token==="*"){if(y.shift(),y[0].type==="number")return V();o("Expected font size number after *.",w,O)}if(y[0].type==="number")return V();for(var I=[],K,Q="normal",G="normal",ee="none",te=!1,ne="face",X=!1;y.length;){var ae=y.shift(),$=ae.token.toLowerCase();switch(ne){case"face":X||$!=="utf"&&ae.type!=="number"&&$!=="bold"&&$!=="italic"&&$!=="underline"&&$!=="box"?I.length>0&&ae.token==="-"?(X=!0,I[I.length-1]=I[I.length-1]+ae.token):X?(X=!1,I[I.length-1]=I[I.length-1]+ae.token):I.push(ae.token):ae.type==="number"?(K?o("Font size specified twice in font definition.",w,O):K=ae.token,ne="modifier"):$==="bold"?Q="bold":$==="italic"?G="italic":$==="underline"?ee="underline":$==="box"?(l[z]?te=!0:o(`This font style doesn't support "box"`,w,O),ne="finished"):$==="utf"?(ae=y.shift(),ne="size"):o("Unknown parameter "+ae.token+" in font definition.",w,O);break;case"size":ae.type==="number"?K?o("Font size specified twice in font definition.",w,O):K=ae.token:o("Expected font size in font definition.",w,O),ne="modifier";break;case"modifier":$==="bold"?Q="bold":$==="italic"?G="italic":$==="underline"?ee="underline":$==="box"?(l[z]?te=!0:o(`This font style doesn't support "box"`,w,O),ne="finished"):o("Unknown parameter "+ae.token+" in font definition.",w,O);break;case"finished":o('Extra characters found after "box" in font definition.',w,O);break}}K===void 0?k?K=k.size:(o("Must specify the size of the font since there is no default value.",w,O),K=12):K=parseFloat(K),I=I.join(" "),I===""&&(k?I=k.face:(o("Must specify the name of the font since there is no default value.",w,O),I="sans-serif"));var se=d(I),ce={};return se?(ce.face=se.face,ce.weight=se.weight,ce.style=se.style,ce.decoration=se.decoration,ce.size=K,te&&(ce.box=!0),ce):(ce.face=I,ce.weight=Q,ce.style=G,ce.decoration=ee,ce.size=K,te&&(ce.box=!0),ce)},u=function(y,k,w){return k.length===0?'Directive "'+y+'" requires a font as a parameter.':(r[y]=f(k,r[y],w,0,y),r.is_in_header&&(n.formatting[y]=r[y]),null)},i=function(y,k,w){return k.length===0?'Directive "'+y+'" requires a font as a parameter.':(n.formatting[y]=f(k,n.formatting[y],w,0,y),null)},t=function(y,k){var w="";k.forEach(function(z){w+=z.token});var O=parseFloat(w);if(isNaN(O)||O===0)return'Directive "'+y+'" requires a number as a parameter.';n.formatting.scale=O},a=["acoustic-bass-drum","bass-drum-1","side-stick","acoustic-snare","hand-clap","electric-snare","low-floor-tom","closed-hi-hat","high-floor-tom","pedal-hi-hat","low-tom","open-hi-hat","low-mid-tom","hi-mid-tom","crash-cymbal-1","high-tom","ride-cymbal-1","chinese-cymbal","ride-bell","tambourine","splash-cymbal","cowbell","crash-cymbal-2","vibraslap","ride-cymbal-2","hi-bongo","low-bongo","mute-hi-conga","open-hi-conga","low-conga","high-timbale","low-timbale","high-agogo","low-agogo","cabasa","maracas","short-whistle","long-whistle","short-guiro","long-guiro","claves","hi-wood-block","low-wood-block","mute-cuica","open-cuica","mute-triangle","open-triangle"],e=function(y){var k=y.split(/\s+/);if(k.length!==2&&k.length!==3)return{error:'Expected parameters "abc-note", "drum-sound", and optionally "note-head"'};var w=k[0],O=parseInt(k[1],10);if((isNaN(O)||O<35||O>81)&&k[1]&&(O=a.indexOf(k[1].toLowerCase())+35),isNaN(O)||O<35||O>81)return{error:'Expected drum name, received "'+k[1]+'"'};var z={sound:O};return k.length===3&&(z.noteHead=k[2]),{key:w,value:z}},h=function(y,k){var w=p.getMeasurement(k);return w.used===0||k.length!==0?{error:'Directive "'+y+'" requires a measurement as a parameter.'}:w.value},v=function(y,k){var w=p.getMeasurement(k);return w.used===0||k.length!==0?'Directive "'+y+'" requires a measurement as a parameter.':(n.formatting[y]=w.value,null)},m=function(y,k,w,O,z){if(w.length!==1||w[0].type!=="number")return'Directive "'+k+'" requires a number as a parameter.';var V=w[0].intt;return O!==void 0&&V<O?'Directive "'+k+'" requires a number greater than or equal to '+O+" as a parameter.":z!==void 0&&V>z?'Directive "'+k+'" requires a number less than or equal to '+z+" as a parameter.":(r[y]=V,null)},x=function(y,k,w){if(w.length===1&&(w[0].token==="true"||w[0].token==="false"))return r[y]=w[0].token==="true",null;var O=m(y,k,w,0,1);return O!==null?O:(r[y]=r[y]===1,null)},C=function(y,k,w,O){if(w.length!==1)return'Directive "'+k+'" requires one of [ '+O.join(", ")+" ] as a parameter.";for(var z=w[0].token,V=!1,I=0;!V&&I<O.length;I++)O[I]===z&&(V=!0);return V?(r[y]=z,null):'Directive "'+k+'" requires one of [ '+O.join(", ")+" ] as a parameter."},S=["nobarlines","barlines","beataccents","nobeataccents","droneon","droneoff","drumon","drumoff","fermatafixed","fermataproportional","gchordon","gchordoff","controlcombo","temperamentnormal","noportamento"],j=["gchord","ptstress","beatstring"],F=["bassvol","chordvol","c","channel","beatmod","deltaloudness","drumbars","gracedivider","makechordchannels","randomchordattack","chordattack","stressmodel","transpose","rtranspose","vol","volinc","gchordbars"],b=["program"],M=["ratio","snt","bendvelocity","pitchbend","control","temperamentlinear"],B=["beat"],A=["drone"],P=["portamento"],N=["expand","grace","trim"],E=["drum","chordname"],_=["bassprog","chordprog"],L=function(y,k,w){var O=y.shift().token,z=[];if(S.indexOf(O)>=0)y.length!==0&&o("Unexpected parameter in MIDI "+O,w,0);else if(j.indexOf(O)>=0)y.length!==1?o("Expected one parameter in MIDI "+O,w,0):z.push(y[0].token);else if(F.indexOf(O)>=0)y.length!==1?o("Expected one parameter in MIDI "+O,w,0):y[0].type!=="number"?o("Expected one integer parameter in MIDI "+O,w,0):z.push(y[0].intt);else if(b.indexOf(O)>=0)y.length!==1&&y.length!==2?o("Expected one or two parameters in MIDI "+O,w,0):y[0].type!=="number"||y.length===2&&y[1].type!=="number"?o("Expected integer parameter in MIDI "+O,w,0):(z.push(y[0].intt),y.length===2&&z.push(y[1].intt));else if(M.indexOf(O)>=0)y.length!==2?o("Expected two parameters in MIDI "+O,w,0):y[0].type!=="number"||y[1].type!=="number"?o("Expected two integer parameters in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[1].intt));else if(P.indexOf(O)>=0)y.length!==2?o("Expected two parameters in MIDI "+O,w,0):y[0].type!=="alpha"||y[1].type!=="number"?o("Expected one string and one integer parameters in MIDI "+O,w,0):(z.push(y[0].token),z.push(y[1].intt));else if(O==="drummap")y.length===2&&y[0].type==="alpha"&&y[1].type==="number"?(k.formatting||(k.formatting={}),k.formatting.midi||(k.formatting.midi={}),k.formatting.midi.drummap||(k.formatting.midi.drummap={}),k.formatting.midi.drummap[y[0].token]=y[1].intt,z=k.formatting.midi.drummap):y.length===3&&y[0].type==="punct"&&y[1].type==="alpha"&&y[2].type==="number"?(k.formatting||(k.formatting={}),k.formatting.midi||(k.formatting.midi={}),k.formatting.midi.drummap||(k.formatting.midi.drummap={}),k.formatting.midi.drummap[y[0].token+y[1].token]=y[2].intt,z=k.formatting.midi.drummap):o("Expected one note name and one integer parameter in MIDI "+O,w,0);else if(N.indexOf(O)>=0)y.length!==3||y[0].type!=="number"||y[1].token!=="/"||y[2].type!=="number"?o("Expected fraction parameter in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[2].intt));else if(B.indexOf(O)>=0)y.length!==4?o("Expected four parameters in MIDI "+O,w,0):y[0].type!=="number"||y[1].type!=="number"||y[2].type!=="number"||y[3].type!=="number"?o("Expected four integer parameters in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[1].intt),z.push(y[2].intt),z.push(y[3].intt));else if(A.indexOf(O)>=0)y.length!==5?o("Expected five parameters in MIDI "+O,w,0):y[0].type!=="number"||y[1].type!=="number"||y[2].type!=="number"||y[3].type!=="number"||y[4].type!=="number"?o("Expected five integer parameters in MIDI "+O,w,0):(z.push(y[0].intt),z.push(y[1].intt),z.push(y[2].intt),z.push(y[3].intt),z.push(y[4].intt));else if(b.indexOf(O)>=0)y.length!==1||y.length!==4?o("Expected one or two parameters in MIDI "+O,w,0):y[0].type!=="number"?o("Expected integer parameter in MIDI "+O,w,0):y.length===4?(y[1].token!=="octave"&&o("Expected octave parameter in MIDI "+O,w,0),y[2].token!=="="&&o("Expected octave parameter in MIDI "+O,w,0),y[3].type!=="number"&&o("Expected integer parameter for octave in MIDI "+O,w,0)):(z.push(y[0].intt),y.length===4&&z.push(y[3].intt));else if(E.indexOf(O)>=0)if(y.length<2)o("Expected string parameter and at least one integer parameter in MIDI "+O,w,0);else if(y[0].type!=="alpha")o("Expected string parameter and at least one integer parameter in MIDI "+O,w,0);else{var V=y.shift();for(z.push(V.token);y.length>0;)V=y.shift(),V.type!=="number"&&o("Expected integer parameter in MIDI "+O,w,0),z.push(V.intt)}else if(_.indexOf(O)>=0){if(y.length!==1&&y.length!==2)o("Expected one or two parameters in MIDI "+O,w,0);else if(y[0].type!=="number")o("Expected integer parameter in MIDI "+O,w,0);else if(y.length===2&&y[1].type!=="alpha")o("Expected alpha parameter in MIDI "+O,w,0);else if(z.push(y[0].intt),y.length===2){var I=y[1].token;I.indexOf("octave=")!=-1?(I=I.replace("octave=",""),I=parseInt(I),isNaN(I)?o("Expected octave value in MIDI"+O):(I<-1&&(o("Expected octave= in MIDI "+O+" to be >= -1 (recv:"+I+")"),I=-1),I>3&&(o("Expected octave= in MIDI "+O+" to be <= 3 (recv:"+I+")"),I=3),z.push(I))):o("Expected octave= in MIDI"+O)}}c.hasBeginMusic()?c.appendElement("midi",-1,-1,{cmd:O,params:z}):(k.formatting.midi===void 0&&(k.formatting.midi={}),k.formatting.midi[O]=z)};g.parseFontChangeLine=function(y){y=y.replace(/\$\$/g,"");var k=y.split("$");if(k.length>1&&r.setfont){var w=[];k[0]!==""&&w.push({text:k[0]});for(var O=1;O<k.length;O++)if(k[O][0]==="0")w.push({text:k[O].substring(1).replace(/\x03/g,"$$")});else{var z=parseInt(k[O][0],10);r.setfont[z]?w.push({font:r.setfont[z],text:k[O].substring(1).replace(/\x03/g,"$$")}):w[w.length-1].text+="$"+k[O].replace(/\x03/g,"$$")}return w}return y.replace(/\x03/g,"$$")};var D=["auto","above","below","hidden"];g.addDirective=function(y){var k=p.tokenize(y,0,y.length);if(k.length===0||k[0].type!=="alpha")return null;var w=y.substring(y.indexOf(k[0].token)+k[0].token.length);w=p.stripComment(w);var O=k.shift().token.toLowerCase(),z="",V;switch(O){case"bagpipes":n.formatting.bagpipes=!0;break;case"flatbeams":n.formatting.flatbeams=!0;break;case"jazzchords":n.formatting.jazzchords=!0;break;case"accentAbove":n.formatting.accentAbove=!0;break;case"germanAlphabet":n.formatting.germanAlphabet=!0;break;case"landscape":r.landscape=!0;break;case"papersize":r.papersize=w;break;case"graceslurs":if(k.length!==1)return"Directive graceslurs requires one parameter: 0 or 1";if(k[0].token==="0"||k[0].token==="false")n.formatting.graceSlurs=!1;else if(k[0].token==="1"||k[0].token==="true")n.formatting.graceSlurs=!0;else return"Directive graceslurs requires one parameter: 0 or 1 (received "+k[0].token+")";break;case"lineThickness":var I=H(k);if(I.value!==void 0&&(n.formatting.lineThickness=I.value),I.error)return I.error;break;case"stretchlast":var K=H(k);if(K.value!==void 0&&(n.formatting.stretchlast=K.value),K.error)return K.error;break;case"titlecaps":r.titlecaps=!0;break;case"titleleft":n.formatting.titleleft=!0;break;case"measurebox":n.formatting.measurebox=!0;break;case"vocal":return C("vocalPosition",O,k,D);case"dynamic":return C("dynamicPosition",O,k,D);case"gchord":return C("chordPosition",O,k,D);case"ornament":return C("ornamentPosition",O,k,D);case"volume":return C("volumePosition",O,k,D);case"botmargin":case"botspace":case"composerspace":case"indent":case"leftmargin":case"linesep":case"musicspace":case"partsspace":case"pageheight":case"pagewidth":case"rightmargin":case"stafftopmargin":case"staffsep":case"staffwidth":case"subtitlespace":case"sysstaffsep":case"systemsep":case"textspace":case"titlespace":case"topmargin":case"topspace":case"vocalspace":case"wordsspace":return v(O,k);case"voicescale":if(k.length!==1||k[0].type!=="number")return"voicescale requires one float as a parameter";var Q=k.shift();return r.currentVoice&&(r.currentVoice.scale=Q.floatt,c.changeVoiceScale(r.currentVoice.scale)),null;case"voicecolor":if(k.length!==1)return"voicecolor requires one string as a parameter";var G=k.shift();return r.currentVoice&&(r.currentVoice.color=G.token,c.changeVoiceColor(r.currentVoice.color)),null;case"vskip":var ee=Math.round(h(O,k));return ee.error?ee.error:(c.addSpacing(ee),null);case"scale":t(O,k);break;case"sep":if(k.length===0)c.addSeparator(14,14,85,{startChar:r.iChar,endChar:r.iChar+5});else{var te=p.getMeasurement(k);if(te.used===0)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var ne=te.value;if(te=p.getMeasurement(k),te.used===0)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var X=te.value;if(te=p.getMeasurement(k),te.used===0||k.length!==0)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var ae=te.value;c.addSeparator(ne,X,ae,{startChar:r.iChar,endChar:r.iChar+w.length})}break;case"barsperstaff":if(z=m("barsperstaff",O,k),z!==null)return z;break;case"staffnonote":if(k.length!==1)return"Directive staffnonote requires one parameter: 0 or 1";if(k[0].token==="0")r.staffnonote=!0;else if(k[0].token==="1")r.staffnonote=!1;else return"Directive staffnonote requires one parameter: 0 or 1 (received "+k[0].token+")";break;case"printtempo":if(z=x("printTempo",O,k),z!==null)return z;break;case"partsbox":if(z=x("partsBox",O,k),z!==null)return z;r.partsfont.box=r.partsBox;break;case"freegchord":if(z=x("freegchord",O,k),z!==null)return z;break;case"measurenb":case"barnumbers":if(z=m("barNumbers",O,k),z!==null)return z;break;case"setbarnb":if(k.length!==1||k[0].type!=="number")return"Directive setbarnb requires a number as a parameter.";r.currBarNumber=c.setBarNumberImmediate(k[0].intt);break;case"keywarn":if(k.length!==1||k[0].type!=="number"||k[0].intt!==1&&k[0].intt!==0)return"Directive "+O+" requires 0 or 1 as a parameter.";r[O]=k[0].intt===1;break;case"begintext":var $="";for(V=p.nextLine();V&&V.indexOf("%%endtext")!==0;){if(T.startsWith(V,"%%")){var se=V.substring(2);se=se.trim()+`
|
|
2
2
|
`,$+=se}else $+=V.trim()+`
|
|
3
3
|
`;V=p.nextLine()}c.addText($,{startChar:r.iChar,endChar:r.iChar+$.length+7});break;case"continueall":r.continueall=!0;break;case"beginps":for(V=p.nextLine();V&&V.indexOf("%%endps")!==0;)p.nextLine();o("Postscript ignored",y,0);break;case"deco":w.length>0&&r.ignoredDecorations.push(w.substring(0,w.indexOf(" "))),o("Decoration redefinition ignored",y,0);break;case"text":var ce=p.translateString(w);c.addText(g.parseFontChangeLine(ce),{startChar:r.iChar,endChar:r.iChar+w.length+7});break;case"center":var fe=p.translateString(w);c.addCentered(g.parseFontChangeLine(fe));break;case"font":break;case"setfont":var le=p.tokenize(w,0,w.length);if(le.length>=4&&le[0].token==="-"&&le[1].type==="number"){var ve=parseInt(le[1].token);ve>=1&&ve<=9&&(r.setfont||(r.setfont=[]),le.shift(),le.shift(),r.setfont[ve]=f(le,r.setfont[ve],y,0,"setfont"))}break;case"gchordfont":case"partsfont":case"tripletfont":case"vocalfont":case"textfont":case"annotationfont":case"historyfont":case"infofont":case"measurefont":case"repeatfont":case"wordsfont":return u(O,k,y);case"composerfont":case"subtitlefont":case"tempofont":case"titlefont":case"voicefont":case"footerfont":case"headerfont":return i(O,k,y);case"barlabelfont":case"barnumberfont":case"barnumfont":return u("measurefont",k,y);case"staves":case"score":r.score_is_present=!0;for(var ge=function(Pe,ze,Ie,Ve,Ye){(ze||r.staves.length===0)&&r.staves.push({index:r.staves.length,numVoices:0});var Se=T.last(r.staves);Ie!==void 0&&Se.bracket===void 0&&(Se.bracket=Ie),Ve!==void 0&&Se.brace===void 0&&(Se.brace=Ve),Ye&&(Se.connectBarLines="end"),r.voices[Pe]===void 0&&(r.voices[Pe]={staffNum:Se.index,index:Se.numVoices},Se.numVoices++)},ye=!1,R=!1,q=!1,Y=!1,W=!1,U=!1,J=!1,re,he=function(){if(J=!0,re){var Pe="start";re.staffNum>0&&(r.staves[re.staffNum-1].connectBarLines==="start"||r.staves[re.staffNum-1].connectBarLines==="continue")&&(Pe="continue"),r.staves[re.staffNum].connectBarLines=Pe}};k.length;){var Z=k.shift();switch(Z.token){case"(":ye?o("Can't nest parenthesis in %%score",y,Z.start):(ye=!0,Y=!0);break;case")":!ye||Y?o("Unexpected close parenthesis in %%score",y,Z.start):ye=!1;break;case"[":R?o("Can't nest brackets in %%score",y,Z.start):(R=!0,W=!0);break;case"]":!R||W?o("Unexpected close bracket in %%score",y,Z.start):(R=!1,r.staves[re.staffNum].bracket="end");break;case"{":q?o("Can't nest braces in %%score",y,Z.start):(q=!0,U=!0);break;case"}":!q||U?o("Unexpected close brace in %%score",y,Z.start):(q=!1,r.staves[re.staffNum].brace="end");break;case"|":he();break;default:for(var ie="";(Z.type==="alpha"||Z.type==="number")&&(ie+=Z.token,Z.continueId);)Z=k.shift();var be=!ye||Y,pe=W?"start":R?"continue":void 0,oe=U?"start":q?"continue":void 0;ge(ie,be,pe,oe,J),Y=!1,W=!1,U=!1,J=!1,re=r.voices[ie],O==="staves"&&he();break}}break;case"maxstaves":var me=p.getInt(w);me.digits===0?o("Expected number of staves in maxstaves"):me.value>0&&(n.formatting.maxStaves=me.value);break;case"newpage":var Ee=p.getInt(w);c.addNewPage(Ee.digits===0?-1:Ee.value);break;case"abc":var ue=w.split(" ");switch(ue[0]){case"-copyright":case"-creator":case"-edited-by":case"-version":case"-charset":var xe=ue.shift();c.addMetaText(O+xe,ue.join(" "),{startChar:r.iChar,endChar:r.iChar+w.length+5});break;default:return"Unknown directive: "+O+ue[0]}break;case"header":case"footer":var we=p.getMeat(w,0,w.length);we=w.substring(we.start,we.end),we[0]==='"'&&we[we.length-1]==='"'&&(we=we.substring(1,we.length-1));var de=we.split(" "),Te={};de.length===1?Te={left:"",center:de[0],right:""}:de.length===2?Te={left:de[0],center:de[1],right:""}:Te={left:de[0],center:de[1],right:de[2]},de.length>3&&o("Too many tabs in "+O+": "+de.length+" found.",w,0),c.addMetaTextObj(O,Te,{startChar:r.iChar,endChar:r.iChar+y.length});break;case"midi":var ke=p.tokenize(w,0,w.length,!0);ke.length>0&&ke[0].token==="="&&ke.shift(),ke.length===0?o("Expected midi command",w,0):L(ke,n,w);break;case"percmap":var Be=e(w);Be.error?o(Be.error,y,8):(n.formatting.percmap||(n.formatting.percmap={}),n.formatting.percmap[Be.key]=Be.value);break;case"visualtranspose":var De=p.getInt(w);De.digits===0?o("Expected number of half steps in visualTranspose"):r.globalTranspose=De.value;break;case"map":case"playtempo":case"auquality":case"continuous":case"nobarcheck":n.formatting[O]=w;break;default:return"Unknown directive: "+O}return null},g.globalFormatting=function(y){for(var k in y)if(y.hasOwnProperty(k)){var w=""+y[k],O=p.tokenize(w,0,w.length),z;switch(k){case"titlefont":case"gchordfont":case"composerfont":case"footerfont":case"headerfont":case"historyfont":case"infofont":case"measurefont":case"partsfont":case"repeatfont":case"subtitlefont":case"tempofont":case"textfont":case"voicefont":case"tripletfont":case"vocalfont":case"wordsfont":case"annotationfont":case"tablabelfont":case"tabnumberfont":case"tabgracefont":u(k,O,w);break;case"scale":t(k,O);break;case"partsbox":z=x("partsBox",k,O),z!==null&&o(z),r.partsfont.box=r.partsBox;break;case"freegchord":z=x("freegchord",k,O),z!==null&&o(z);break;case"fontboxpadding":(O.length!==1||O[0].type!=="number")&&o('Directive "'+k+'" requires a number as a parameter.'),n.formatting.fontboxpadding=O[0].floatt;break;case"stafftopmargin":(O.length!==1||O[0].type!=="number")&&o('Directive "'+k+'" requires a number as a parameter.'),n.formatting.stafftopmargin=O[0].floatt;break;case"stretchlast":var V=H(O);if(V.value!==void 0&&(n.formatting.stretchlast=V.value),V.error)return V.error;break;default:o("Formatting directive unrecognized: ",k,0)}}};function H(y){if(y.length===0)return{value:1};if(y.length===1)if(y[0].type==="number"){if(y[0].floatt>=0||y[0].floatt<=1)return{value:y[0].floatt}}else{if(y[0].token==="false")return{value:0};if(y[0].token==="true")return{value:1}}return{error:"Directive stretchlast requires zero or one parameter: false, true, or number between 0 and 1 (received "+y[0].token+")"}}}(),Qe=g,Qe}var Je,Xr;function us(){if(Xr)return Je;Xr=1;var T={};const g=["C,,,","D,,,","E,,,","F,,,","G,,,","A,,,","B,,,","C,,","D,,","E,,","F,,","G,,","A,,","B,,","C,","D,","E,","F,","G,","A,","B,","C","D","E","F","G","A","B","c","d","e","f","g","a","b","c'","d'","e'","f'","g'","a'","b'","c''","d''","e''","f''","g''","a''","b''","c'''","d'''","e'''","f'''","g'''","a'''","b'''"];return T.pitchIndex=function(p){return g.indexOf(p)},T.noteName=function(p){return g[p]},Je=T,Je}var Ze,Kr;function Mi(){if(Kr)return Ze;Kr=1;var T=["C","C♯","D","D♯","E","F","F♯","G","G♯","A","A♯","B"],g=["C","D♭","D","E♭","E","F","G♭","G","A♭","A","B♭","B"],p=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],o=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"];function r(n,c,s,l){if(!c||c%12===0)return n;for(;c<0;)c+=12;c>11&&(c=c%12);var d=n.match(/^([A-G][b#♭♯]?)([^\/]+)?\/?([A-G][b#♭♯]?)?(.+)?/);if(!d)return n;var f=d[1],u=d[2],i=d[3],t=d[4],a=T.indexOf(f);if(a<0&&(a=g.indexOf(f)),a<0&&(a=p.indexOf(f)),a<0&&(a=o.indexOf(f)),a<0)return n;a+=c,a=a%12,s?l?n=o[a]:n=g[a]:l?n=p[a]:n=T[a];var e=u&&(u.indexOf("dim")>=0||u.indexOf("°")>=0);if(e&&n==="A#"&&(n="Bb"),e&&n==="D#"&&(n="Eb"),e&&n==="A♯"&&(n="B♭"),e&&n==="D♯"&&(n="E♭"),u&&(n+=u),i){var a=T.indexOf(i);a<0&&(a=g.indexOf(i)),a<0&&(a=p.indexOf(i)),a<0&&(a=o.indexOf(i)),n+="/",a>=0?(a+=c,a=a%12,s?l?n+=o[a]:n+=g[a]:l?n+=p[a]:n+=T[a]):n+=i}return t&&(n+=t),n}return Ze=r,Ze}var et,Ur;function Ai(){if(Ur)return et;Ur=1;var T={C:{modes:["CMaj","Amin","Am","GMix","DDor","EPhr","FLyd","BLoc"],stepsFromC:0},Db:{modes:["DbMaj","Bbmin","Bbm","AbMix","EbDor","FPhr","GbLyd","CLoc"],stepsFromC:1},D:{modes:["DMaj","Bmin","Bm","AMix","EDor","F#Phr","GLyd","C#Loc"],stepsFromC:2},Eb:{modes:["EbMaj","Cmin","Cm","BbMix","FDor","GPhr","AbLyd","DLoc"],stepsFromC:3},E:{modes:["EMaj","C#min","C#m","BMix","F#Dor","G#Phr","ALyd","D#Loc"],stepsFromC:4},F:{modes:["FMaj","Dmin","Dm","CMix","GDor","APhr","BbLyd","ELoc"],stepsFromC:5},Gb:{modes:["GbMaj","Ebmin","Ebm","DbMix","AbDor","BbPhr","CbLyd","FLoc"],stepsFromC:6},G:{modes:["GMaj","Emin","Em","DMix","ADor","BPhr","CLyd","F#Loc"],stepsFromC:7},Ab:{modes:["AbMaj","Fmin","Fm","EbMix","BbDor","CPhr","DbLyd","GLoc"],stepsFromC:8},A:{modes:["AMaj","F#min","F#m","EMix","BDor","C#Phr","DLyd","G#Loc"],stepsFromC:9},Bb:{modes:["BbMaj","Gmin","Gm","FMix","CDor","DPhr","EbLyd","ALoc"],stepsFromC:10},B:{modes:["BMaj","G#min","G#m","F#Mix","C#Dor","D#Phr","ELyd","A#Loc"],stepsFromC:11},"C#":{modes:["C#Maj","A#min","A#m","G#Mix","D#Dor","E#Phr","F#Lyd","B#Loc"],stepsFromC:1},"F#":{modes:["F#Maj","D#min","D#m","C#Mix","G#Dor","A#Phr","BLyd","E#Loc"],stepsFromC:6},Cb:{modes:["CbMaj","Abmin","Abm","GbMix","DbDor","EbPhr","FbLyd","BbLoc"],stepsFromC:11}},g=null;function p(){g={};for(var c=Object.keys(T),s=0;s<c.length;s++){var l=T[c[s]];g[c[s].toLowerCase()]=c[s];for(var d=0;d<l.modes.length;d++){var f=l.modes[d].toLowerCase();g[f]=c[s]}}}function o(c){g||p();var s=c.toLowerCase().match(/([a-g][b#]?)(maj|min|mix|dor|phr|lyd|loc|m)?/);if(!s||!s[2])return c;s=s[1]+s[2];var l=g[s];return l||c}function r(c,s){var l=T[c];if(!l||s==="")return c;var d=s.toLowerCase().match(/^(maj|min|mix|dor|phr|lyd|loc|m)/);if(!d)return c;for(var f=d[1],u=0;u<l.modes.length;u++){var i=l.modes[u],t=i.toLowerCase().indexOf(f);if(t!==-1&&t===i.length-f.length)return i.substring(0,i.length-f.length)}return c}function n(c,s){var l=T[c];if(!l)return c;for(;s<0;)s+=12;for(var d=(l.stepsFromC+s)%12,f=0;f<Object.keys(T).length;f++){var u=Object.keys(T)[f];if(T[u].stepsFromC===d)return u}return c}return et={relativeMajor:o,relativeMode:r,transposeKey:n},et}var tt,$r;function Ni(){if($r)return tt;$r=1;var{relativeMajor:T}=Ai(),g={acc:"sharp",note:"f"},p={acc:"sharp",note:"c"},o={acc:"sharp",note:"g"},r={acc:"sharp",note:"d"},n={acc:"sharp",note:"A"},c={acc:"sharp",note:"e"},s={acc:"sharp",note:"B"},l={acc:"flat",note:"B"},d={acc:"flat",note:"e"},f={acc:"flat",note:"A"},u={acc:"flat",note:"d"},i={acc:"flat",note:"G"},t={acc:"flat",note:"c"},a={acc:"flat",note:"F"},e={"C#":[g,p,o,r,n,c,s],"F#":[g,p,o,r,n,c],B:[g,p,o,r,n],E:[g,p,o,r],A:[g,p,o],D:[g,p],G:[g],C:[],F:[l],Bb:[l,d],Eb:[l,d,f],Cm:[l,d,f],Ab:[l,d,f,u],Db:[l,d,f,u,i],Gb:[l,d,f,u,i,t],Cb:[l,d,f,u,i,t,a],"A#":[l,d],"B#":[],"D#":[l,d,f],"E#":[l],"G#":[l,d,f,u],none:[]};function h(v){var m=e[T(v)];return m?JSON.parse(JSON.stringify(m)):null}return tt=h,tt}var rt,Qr;function Bi(){if(Qr)return rt;Qr=1;var T=us(),g=Mi(),p=Ni(),o={},r={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11},n=["C","Db","D","Eb","E","F","F#","G","Ab","A","Bb","B"],c=["C","C#","D","D#","E","F","F#","G","G#","A","Bb","B"];o.keySignature=function(i,t,a,e,h){if(i.clef.type==="perc"||i.clef.type==="none")return{accidentals:p(t),root:a,acc:e};h||(h=0),i.localTransposeVerticalMovement=0,i.localTransposePreferFlats=!1;var v=p(t);if(!v)return i.key;if(i.localTranspose=(i.globalTranspose?i.globalTranspose:0)+h,!i.localTranspose)return{accidentals:v,root:a,acc:e};if(i.globalTransposeOrigKeySig=v,i.localTranspose%12===0)return i.localTransposeVerticalMovement=i.localTranspose/12*7,{accidentals:v,root:a,acc:e};var m=t[0];t[1]==="b"||t[1]==="#"?(m+=t[1],t=t.substr(2)):t=t.substr(1);var x=r[m],C=x!==void 0;C||(x=0,m="C",t="");for(var S=x+i.localTranspose;S<0;)S+=12;S>11&&(S=S%12);var j=t[0]==="m"?c[S]:n[S],F=j+t,b=p(F);(b.length===0||b[0].acc==="flat")&&(i.localTransposePreferFlats=!0);var M=F.charCodeAt(0)-m.charCodeAt(0);return i.localTranspose>0?(M<0||M===0&&(m[1]==="#"||F[1]==="b"))&&(M+=7):i.localTranspose<0&&(M>0||M===0&&(m[1]==="b"||F[1]==="#"))&&(M-=7),i.localTranspose>0?i.localTransposeVerticalMovement=M+Math.floor(i.localTranspose/12)*7:i.localTransposeVerticalMovement=M+Math.ceil(i.localTranspose/12)*7,C?{accidentals:b,root:j[0],acc:j.length>1?j[1]:""}:{accidentals:[],root:a,acc:e}},o.chordName=function(i,t){return g(t,i.localTranspose,i.localTransposePreferFlats,i.freegchord)};var s=["c","d","e","f","g","a","b"];function l(i,t,a,e,h){for(var v=s[(i+49)%7],m=0,x=0;x<e.length;x++)e[x].note.toLowerCase()===v&&(m=d[e[x].acc]);for(var C=d[a],S=C-m,j=s[(t+49)%7],F=0,b=0;b<h.accidentals.length;b++)h.accidentals[b].note.toLowerCase()===j&&(F=d[h.accidentals[b].acc]);var M=S+F;return M<-2&&(t--,M+=j==="c"||j==="f"?1:2),M>2&&(t++,M-=j==="b"||j==="e"?1:2),[t,M]}var d={dblflat:-2,flat:-1,natural:0,sharp:1,dblsharp:2},f={"-2":"dblflat","-1":"flat",0:"natural",1:"sharp",2:"dblsharp"},u={"-2":"__","-1":"_",0:"=",1:"^",2:"^^"};return o.note=function(i,t){if(!(!i.localTranspose||i.clef.type==="perc")){var a=t.pitch;if(i.localTransposeVerticalMovement&&(t.pitch=t.pitch+i.localTransposeVerticalMovement,t.name)){var e=t.accidental?t.name.substring(1):t.name,h=t.accidental?t.name[0]:"",v=T.pitchIndex(e);t.name=h+T.noteName(v+i.localTransposeVerticalMovement)}if(t.accidental){var m=l(a,t.pitch,t.accidental,i.globalTransposeOrigKeySig,i.targetKey);t.pitch=m[0],t.accidental=f[m[1]],t.name&&(t.name=u[m[1]]+t.name.replace(/[_^=]/g,""))}}},rt=o,rt}var at,Jr;function Lr(){if(Jr)return at;Jr=1;var T=Pr(),g=Bi(),p={};return function(){var o,r,n,c;p.initialize=function(t,a,e,h,v){o=t,r=a,n=e,c=v},p.standardKey=function(t,a,e,h){return g.keySignature(n,t,a,e,h)};var s={treble:{clef:"treble",pitch:4,mid:0},"treble+8":{clef:"treble+8",pitch:4,mid:0},"treble-8":{clef:"treble-8",pitch:4,mid:0},"treble^8":{clef:"treble+8",pitch:4,mid:0},treble_8:{clef:"treble-8",pitch:4,mid:0},treble1:{clef:"treble",pitch:2,mid:2},treble2:{clef:"treble",pitch:4,mid:0},treble3:{clef:"treble",pitch:6,mid:-2},treble4:{clef:"treble",pitch:8,mid:-4},treble5:{clef:"treble",pitch:10,mid:-6},perc:{clef:"perc",pitch:6,mid:0},none:{clef:"none",mid:0},bass:{clef:"bass",pitch:8,mid:-12},"bass+8":{clef:"bass+8",pitch:8,mid:-12},"bass-8":{clef:"bass-8",pitch:8,mid:-12},"bass^8":{clef:"bass+8",pitch:8,mid:-12},bass_8:{clef:"bass-8",pitch:8,mid:-12},"bass+16":{clef:"bass",pitch:8,mid:-12},"bass-16":{clef:"bass",pitch:8,mid:-12},"bass^16":{clef:"bass",pitch:8,mid:-12},bass_16:{clef:"bass",pitch:8,mid:-12},bass1:{clef:"bass",pitch:2,mid:-6},bass2:{clef:"bass",pitch:4,mid:-8},bass3:{clef:"bass",pitch:6,mid:-10},bass4:{clef:"bass",pitch:8,mid:-12},bass5:{clef:"bass",pitch:10,mid:-14},tenor:{clef:"alto",pitch:8,mid:-8},tenor1:{clef:"alto",pitch:2,mid:-2},tenor2:{clef:"alto",pitch:4,mid:-4},tenor3:{clef:"alto",pitch:6,mid:-6},tenor4:{clef:"alto",pitch:8,mid:-8},tenor5:{clef:"alto",pitch:10,mid:-10},alto:{clef:"alto",pitch:6,mid:-6},alto1:{clef:"alto",pitch:2,mid:-2},alto2:{clef:"alto",pitch:4,mid:-4},alto3:{clef:"alto",pitch:6,mid:-6},alto4:{clef:"alto",pitch:8,mid:-8},alto5:{clef:"alto",pitch:10,mid:-10},"alto+8":{clef:"alto+8",pitch:6,mid:-6},"alto-8":{clef:"alto-8",pitch:6,mid:-6},"alto^8":{clef:"alto+8",pitch:6,mid:-6},alto_8:{clef:"alto-8",pitch:6,mid:-6}},l=function(t,a){var e=s[t],h=e?e.mid:0;return h+a};p.fixClef=function(t){var a=s[t.type];a&&(t.clefPos=a.pitch,t.type=a.clef)},p.deepCopyKey=function(t){var a={accidentals:[],root:t.root,acc:t.acc,mode:t.mode};return t.accidentals.forEach(function(e){a.accidentals.push(Object.assign({},e))}),a};var d={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11};p.addPosToKey=function(t,a){var e=t.verticalPos;a.accidentals.forEach(function(h){var v=d[h.note];v=v-e,h.verticalPos=v}),a.impliedNaturals&&a.impliedNaturals.forEach(function(h){var v=d[h.note];v=v-e,h.verticalPos=v}),e<-10?(a.accidentals.forEach(function(h){h.verticalPos-=7,(h.verticalPos>=11||h.verticalPos===10&&h.acc==="flat")&&(h.verticalPos-=7),h.note==="A"&&h.acc==="sharp"&&(h.verticalPos-=7),(h.note==="G"||h.note==="F")&&h.acc==="flat"&&(h.verticalPos-=7)}),a.impliedNaturals&&a.impliedNaturals.forEach(function(h){h.verticalPos-=7,(h.verticalPos>=11||h.verticalPos===10&&h.acc==="flat")&&(h.verticalPos-=7),h.note==="A"&&h.acc==="sharp"&&(h.verticalPos-=7),(h.note==="G"||h.note==="F")&&h.acc==="flat"&&(h.verticalPos-=7)})):e<-4?(a.accidentals.forEach(function(h){h.verticalPos-=7,e===-8&&(h.note==="f"||h.note==="g")&&h.acc==="sharp"&&(h.verticalPos-=7)}),a.impliedNaturals&&a.impliedNaturals.forEach(function(h){h.verticalPos-=7,e===-8&&(h.note==="f"||h.note==="g")&&h.acc==="sharp"&&(h.verticalPos-=7)})):e>=7&&(a.accidentals.forEach(function(h){h.verticalPos+=7}),a.impliedNaturals&&a.impliedNaturals.forEach(function(h){h.verticalPos+=7}))},p.fixKey=function(t,a){var e=Object.assign({},a);return p.addPosToKey(t,e),e};var f=function(t){var a=0,e=t[a++];(e==="^"||e==="_")&&(e=t[a++]);var h=d[e];for(h===void 0&&(h=6);a<t.length;a++)if(t[a]===",")h-=7;else if(t[a]==="'")h+=7;else break;return{mid:h-6,str:t.substring(a)}},u=function(t){for(var a=0;a<t.length;a++)t[a].note==="b"?t[a].note="B":t[a].note==="a"?t[a].note="A":t[a].note==="F"?t[a].note="f":t[a].note==="E"?t[a].note="e":t[a].note==="D"?t[a].note="d":t[a].note==="C"?t[a].note="c":t[a].note==="G"&&t[a].acc==="sharp"?t[a].note="g":t[a].note==="g"&&t[a].acc==="flat"&&(t[a].note="G")};p.parseKey=function(t,a){t.length===0&&(t="none");var e=o.tokenize(t,0,t.length),h={};if(e.length===0)return r("Must pass in key signature.",t,0),h;switch(e[0].token){case"HP":T.addDirective("bagpipes"),n.key={root:"HP",accidentals:[],acc:"",mode:""},h.foundKey=!0,e.shift();break;case"Hp":T.addDirective("bagpipes"),n.key={root:"Hp",accidentals:[{acc:"natural",note:"g"},{acc:"sharp",note:"f"},{acc:"sharp",note:"c"}],acc:"",mode:""},h.foundKey=!0,e.shift();break;case"none":n.key={root:"none",accidentals:[],acc:"",mode:""},h.foundKey=!0,e.shift();break;default:var v=o.getKeyPitch(e[0].token);if(v.len>0){h.foundKey=!0;var m="",x="";e[0].token.length>1?e[0].token=e[0].token.substring(1):e.shift();var C=v.token;if(e.length>0){var S=o.getSharpFlat(e[0].token);if(S.len>0&&(e[0].token.length>1?e[0].token=e[0].token.substring(1):e.shift(),C+=S.token,m=S.token),e.length>0){var j=o.getMode(e[0].token);j.len>0&&(e.shift(),C+=j.token,x=j.token)}if(p.standardKey(C,v.token,m,0)===void 0)return r("Unsupported key signature: "+C,t,0),h}var F=p.deepCopyKey(n.key),b=!a&&n.globalTranspose?-n.globalTranspose:0,M;if(a&&(M=n.globalTransposeOrigKeySig),n.key=p.deepCopyKey(p.standardKey(C,v.token,m,b)),a&&(n.globalTransposeOrigKeySig=M),n.key.mode=x,F&&n.keywarn!==!1){for(var B,A=0;A<n.key.accidentals.length;A++)for(B=0;B<F.accidentals.length;B++)F.accidentals[B].note&&n.key.accidentals[A].note.toLowerCase()===F.accidentals[B].note.toLowerCase()&&(F.accidentals[B].note=null);for(B=0;B<F.accidentals.length;B++)F.accidentals[B].note&&(n.key.impliedNaturals||(n.key.impliedNaturals=[]),n.key.impliedNaturals.push({acc:"natural",note:F.accidentals[B].note}))}}break}if(e.length===0||(e[0].token==="exp"&&e.shift(),e.length===0)||(e[0].token==="oct"&&e.shift(),e.length===0))return h;var P=o.getKeyAccidentals2(e);if(P.warn&&r(P.warn,t,0),P.accs){h.foundKey||(h.foundKey=!0,n.key={root:"none",acc:"",mode:"",accidentals:[]}),u(P.accs);for(var N=0;N<P.accs.length;N++){for(var E=!1,_=0;_<n.key.accidentals.length&&!E;_++)n.key.accidentals[_].note===P.accs[N].note&&(E=!0,n.key.accidentals[_].acc!==P.accs[N].acc&&(n.key.accidentals[_].acc=P.accs[N].acc,n.key.explicitAccidentals||(n.key.explicitAccidentals=[]),n.key.explicitAccidentals.push(P.accs[N])));if(!E&&(n.key.explicitAccidentals||(n.key.explicitAccidentals=[]),n.key.explicitAccidentals.push(P.accs[N]),n.key.accidentals.push(P.accs[N]),n.key.impliedNaturals))for(var L=0;L<n.key.impliedNaturals.length;L++)n.key.impliedNaturals[L].note===P.accs[N].note&&n.key.impliedNaturals.splice(L,1)}}for(var D;e.length>0;)switch(e[0].token){case"m":case"middle":if(e.shift(),e.length===0)return r("Expected = after middle",t,0),h;if(D=e.shift(),D.token!=="="){r("Expected = after middle",t,D.start);break}if(e.length===0)return r("Expected parameter after middle=",t,0),h;var H=o.getPitchFromTokens(e);H.warn&&r(H.warn,t,0),H.position&&(n.clef.verticalPos=H.position-6);break;case"transpose":if(e.shift(),e.length===0)return r("Expected = after transpose",t,0),h;if(D=e.shift(),D.token!=="="){r("Expected = after transpose",t,D.start);break}if(e.length===0)return r("Expected parameter after transpose=",t,0),h;if(e[0].type!=="number"){r("Expected number after transpose",t,e[0].start);break}n.clef.transpose=e[0].intt,e.shift();break;case"stafflines":if(e.shift(),e.length===0)return r("Expected = after stafflines",t,0),h;if(D=e.shift(),D.token!=="="){r("Expected = after stafflines",t,D.start);break}if(e.length===0)return r("Expected parameter after stafflines=",t,0),h;if(e[0].type!=="number"){r("Expected number after stafflines",t,e[0].start);break}n.clef.stafflines=e[0].intt,e.shift();break;case"staffscale":if(e.shift(),e.length===0)return r("Expected = after staffscale",t,0),h;if(D=e.shift(),D.token!=="="){r("Expected = after staffscale",t,D.start);break}if(e.length===0)return r("Expected parameter after staffscale=",t,0),h;if(e[0].type!=="number"){r("Expected number after staffscale",t,e[0].start);break}n.clef.staffscale=e[0].floatt,e.shift();break;case"octave":if(e.shift(),e.length===0)return r("Expected = after octave",t,0),h;if(D=e.shift(),D.token!=="="){r("Expected = after octave",t,D.start);break}if(e.length===0)return r("Expected parameter after octave=",t,0),h;if(e[0].type!=="number"){r("Expected number after octave",t,e[0].start);break}n.octave=e[0].intt,e.shift();break;case"style":if(e.shift(),e.length===0)return r("Expected = after style",t,0),h;if(D=e.shift(),D.token!=="="){r("Expected = after style",t,D.start);break}if(e.length===0)return r("Expected parameter after style=",t,0),h;switch(e[0].token){case"normal":case"harmonic":case"rhythm":case"x":case"triangle":n.style=e[0].token,e.shift();break;default:r("error parsing style element: "+e[0].token,t,e[0].start);break}break;case"clef":if(e.shift(),e.length===0)return r("Expected = after clef",t,0),h;if(D=e.shift(),D.token!=="="){r("Expected = after clef",t,D.start);break}if(e.length===0)return r("Expected parameter after clef=",t,0),h;case"treble":case"bass":case"alto":case"tenor":case"perc":case"none":var y=e.shift();switch(y.token){case"treble":case"tenor":case"alto":case"bass":case"perc":case"none":break;case"C":y.token="alto";break;case"F":y.token="bass";break;case"G":y.token="treble";break;case"c":y.token="alto";break;case"f":y.token="bass";break;case"g":y.token="treble";break;default:r("Expected clef name. Found "+y.token,t,y.start);break}e.length>0&&e[0].type==="number"&&(y.token+=e[0].token,e.shift()),e.length>1&&(e[0].token==="-"||e[0].token==="+"||e[0].token==="^"||e[0].token==="_")&&e[1].token==="8"&&(y.token+=e[0].token+e[1].token,e.shift(),e.shift()),n.clef={type:y.token,verticalPos:l(y.token,0)},n.currentVoice&&n.currentVoice.transpose!==void 0&&(n.clef.transpose=n.currentVoice.transpose),h.foundClef=!0;break;default:r("Unknown parameter: "+e[0].token,t,e[0].start),e.shift()}return h};var i=function(t){var a=n.voices[t];if(!(n.currentVoice&&n.currentVoice.index===a.index&&n.currentVoice.staffNum===a.staffNum))return n.currentVoice=a,c.setCurrentVoice(a.staffNum,a.index,t)};p.parseVoice=function(t,a,e){var h=o.getMeat(t,a,e),v=h.start,m=h.end,x=o.getToken(t,v,m);if(x.length===0){r("Expected a voice id",t,v);return}var C=!1;n.voices[x]===void 0&&(n.voices[x]={},C=!0,n.score_is_present&&r("Can't have an unknown V: id when the %score directive is present",t,v)),v+=x.length,v+=o.eatWhiteSpace(t,v);for(var S={startStaff:C},j=function(H){var y=o.getVoiceToken(t,v,m);y.warn!==void 0?r("Expected value for "+H+" in voice: "+y.warn,t,v):y.err!==void 0?r("Expected value for "+H+" in voice: "+y.err,t,v):y.token.length===0&&t[v]!=='"'?r("Expected value for "+H+" in voice",t,v):S[H]=y.token,v+=y.len},F=function(H,y,k){var w=o.getVoiceToken(t,v,m);w.warn!==void 0?r("Expected value for "+y+" in voice: "+w.warn,t,v):w.err!==void 0?r("Expected value for "+y+" in voice: "+w.err,t,v):w.token.length===0&&t[v]!=='"'?r("Expected value for "+y+" in voice",t,v):(w.token=parseFloat(w.token),n.voices[H][y]=w.token),v+=w.len},b=function(H,y){var k=o.getVoiceToken(t,v,m);if(k.warn!==void 0)r("Expected value for "+H+" in voice: "+k.warn,t,v);else if(k.err!==void 0)r("Expected value for "+H+" in voice: "+k.err,t,v);else if(k.token.length===0&&t[v]!=='"')r("Expected value for "+H+" in voice",t,v);else return k.token;v+=k.len},M=function(H,y){var k={_B:2,_E:9,_b:-10,_e:-3},w=o.getVoiceToken(t,v,m);if(w.warn!==void 0)r("Expected one of (_B, _E, _b, _e) for "+y+" in voice: "+w.warn,t,v);else if(w.token.length===0&&t[v]!=='"')r("Expected one of (_B, _E, _b, _e) for "+y+" in voice",t,v);else{var O=k[w.token];O?n.voices[H][y]=O:r("Expected one of (_B, _E, _b, _e) for "+y+" in voice",t,v)}v+=w.len};v<m;){var B=o.getVoiceToken(t,v,m);if(v+=B.len,B.warn)r("Error parsing voice: "+B.warn,t,v);else{var A=null;switch(B.token){case"clef":case"cl":j("clef");var P=0;S.clef!==void 0&&(S.clef=S.clef.replace(/[',]/g,""),S.clef.indexOf("+16")!==-1&&(P+=14,S.clef=S.clef.replace("+16","")),S.verticalPos=l(S.clef,P));break;case"treble":case"bass":case"tenor":case"alto":case"perc":case"none":case"treble'":case"bass'":case"tenor'":case"alto'":case"none'":case"treble''":case"bass''":case"tenor''":case"alto''":case"none''":case"treble,":case"bass,":case"tenor,":case"alto,":case"none,":case"treble,,":case"bass,,":case"tenor,,":case"alto,,":case"none,,":case"treble+8":case"treble-8":case"treble^8":case"treble_8":case"treble1":case"treble2":case"treble3":case"treble4":case"treble5":case"bass+8":case"bass-8":case"bass^8":case"bass_8":case"bass+16":case"bass-16":case"bass^16":case"bass_16":case"bass1":case"bass2":case"bass3":case"bass4":case"bass5":case"tenor1":case"tenor2":case"tenor3":case"tenor4":case"tenor5":case"alto1":case"alto2":case"alto3":case"alto4":case"alto5":case"alto+8":case"alto-8":case"alto^8":case"alto_8":var N=0;S.clef=B.token.replace(/[',]/g,""),S.verticalPos=l(S.clef,N),n.voices[x].clef=B.token;break;case"staves":case"stave":case"stv":j("staves");break;case"brace":case"brc":j("brace");break;case"bracket":case"brk":j("bracket");break;case"name":case"nm":j("name");break;case"subname":case"sname":case"snm":j("subname");break;case"merge":S.startStaff=!1;break;case"stem":case"stems":A=o.getVoiceToken(t,v,m),A.warn!==void 0?r("Expected value for stems in voice: "+A.warn,t,v):A.err!==void 0?r("Expected value for stems in voice: "+A.err,t,v):A.token==="up"||A.token==="down"?n.voices[x].stem=A.token:r("Expected up or down for voice stem",t,v),v+=A.len;break;case"up":case"down":n.voices[x].stem=B.token;break;case"middle":case"m":j("verticalPos"),S.verticalPos=f(S.verticalPos).mid;break;case"gchords":case"gch":n.voices[x].suppressChords=!0,A=o.getVoiceToken(t,v,m),A.token==="0"&&(v=v+A.len);break;case"space":case"spc":j("spacing");break;case"scale":F(x,"scale");break;case"score":M(x,"scoreTranspose");break;case"transpose":F(x,"transpose");break;case"stafflines":F(x,"stafflines");break;case"staffscale":F(x,"staffscale");break;case"octave":F(x,"octave");break;case"volume":F(x,"volume");break;case"cue":var E=b("cue");E==="on"?n.voices[x].scale=.6:n.voices[x].scale=1;break;case"style":A=o.getVoiceToken(t,v,m),A.warn!==void 0?r("Expected value for style in voice: "+A.warn,t,v):A.err!==void 0?r("Expected value for style in voice: "+A.err,t,v):A.token==="normal"||A.token==="harmonic"||A.token==="rhythm"||A.token==="x"||A.token==="triangle"?n.voices[x].style=A.token:r("Expected one of [normal, harmonic, rhythm, x, triangle] for voice style",t,v),v+=A.len;break}}v+=o.eatWhiteSpace(t,v)}if((S.startStaff||n.staves.length===0)&&(n.staves.push({index:n.staves.length,meter:n.origMeter}),n.score_is_present||(n.staves[n.staves.length-1].numVoices=0)),n.voices[x].staffNum===void 0){n.voices[x].staffNum=n.staves.length-1;var _=0;for(var L in n.voices)n.voices.hasOwnProperty(L)&&n.voices[L].staffNum===n.voices[x].staffNum&&_++;n.voices[x].index=_-1}var D=n.staves[n.voices[x].staffNum];return n.score_is_present||D.numVoices++,S.clef&&(D.clef={type:S.clef,verticalPos:S.verticalPos}),S.spacing&&(D.spacing_below_offset=S.spacing),S.verticalPos&&(D.verticalPos=S.verticalPos),S.name&&(D.name?D.name.push(S.name):D.name=[S.name]),S.subname&&(D.subname?D.subname.push(S.subname):D.subname=[S.subname]),i(x)}}(),at=p,at}var nt,Zr;function ds(){if(Zr)return nt;Zr=1;var T=Ne(),g=Pr(),p=Lr(),o=function(r,n,c,s,l){this.reset=function(u,i,t,a){p.initialize(u,i,t,a,l),g.initialize(u,i,t,a,l)},this.reset(r,n,c,s),this.setTitle=function(u,i){c.hasMainTitle?l.addSubtitle(u,{startChar:c.iChar,endChar:c.iChar+i+2}):(l.addMetaText("title",u,{startChar:c.iChar,endChar:c.iChar+i+2}),c.hasMainTitle=!0)},this.setMeter=function(u){if(u=r.stripComment(u),u==="C")return c.havent_set_length===!0&&(c.default_length=.125,c.havent_set_length=!1),{type:"common_time"};if(u==="C|")return c.havent_set_length===!0&&(c.default_length=.125,c.havent_set_length=!1),{type:"cut_time"};if(u==="o")return c.havent_set_length===!0&&(c.default_length=.125,c.havent_set_length=!1),{type:"tempus_perfectum"};if(u==="c")return c.havent_set_length===!0&&(c.default_length=.125,c.havent_set_length=!1),{type:"tempus_imperfectum"};if(u==="o.")return c.havent_set_length===!0&&(c.default_length=.125,c.havent_set_length=!1),{type:"tempus_perfectum_prolatio"};if(u==="c.")return c.havent_set_length===!0&&(c.default_length=.125,c.havent_set_length=!1),{type:"tempus_imperfectum_prolatio"};if(u.length===0||u.toLowerCase()==="none")return c.havent_set_length===!0&&(c.default_length=.125,c.havent_set_length=!1),null;var i=r.tokenize(u,0,u.length);try{var t=function(){var x={value:0,num:""},C=i.shift();for(C.token==="("&&(C=i.shift());;){if(C.type!=="number")throw"Expected top number of meter";if(x.value+=parseInt(C.token),x.num+=C.token,i.length===0||i[0].token==="/")return x;if(C=i.shift(),C.token===")"){if(i.length===0||i[0].token==="/")return x;throw"Unexpected paren in meter"}if(C.token!=="."&&C.token!=="+"||(x.num+=C.token,i.length===0))throw"Expected top number of meter";C=i.shift()}return x},a=function(){var x=t();if(i.length===0)return x;var C=i.shift();if(C.token!=="/")throw"Expected slash in meter";if(C=i.shift(),C.type!=="number")throw"Expected bottom number of meter";return x.den=C.token,x.value=x.value/parseInt(x.den),x};if(i.length===0)throw"Expected meter definition in M: line";for(var e={type:"specified",value:[]},h=0;;){var v=a();h+=v.value;var m={num:v.num};if(v.den!==void 0&&(m.den=v.den),e.value.push(m),i.length===0)break}return c.havent_set_length===!0&&(c.default_length=h<.75?.0625:.125,c.havent_set_length=!1),e}catch(x){n(x,u,0)}return null},this.calcTempo=function(u){var i=.25;c.meter&&c.meter.type==="specified"?i=1/parseInt(c.meter.value[0].den):c.origMeter&&c.origMeter.type==="specified"&&(i=1/parseInt(c.origMeter.value[0].den));for(var t=0;t<u.duration;t++)u.duration[t]=i*u.duration[t];return u},this.resolveTempo=function(){c.tempo&&(this.calcTempo(c.tempo),s.metaText.tempo=c.tempo,delete c.tempo)},this.addUserDefinition=function(u,i,t){var a=u.indexOf("=",i);if(a===-1){n("Need an = in a macro definition",u,i);return}var e=T.strip(u.substring(i,a)),h=T.strip(u.substring(a+1));if(e.length!==1){n("Macro definitions can only be one character",u,i);return}var v="HIJKLMNOPQRSTUVWXYhijklmnopqrstuvw~";if(v.indexOf(e)===-1){n("Macro definitions must be H-Y, h-w, or tilde",u,i);return}if(h.length===0){n("Missing macro definition",u,i);return}c.macros===void 0&&(c.macros={}),c.macros[e]=h},this.setDefaultLength=function(u,i,t){var a=u.substring(i,t).replace(/ /g,""),e=a.split("/");if(e.length===2){var h=parseInt(e[0]),v=parseInt(e[1]);v>0&&(c.default_length=h/v,c.havent_set_length=!1)}else e.length===1&&e[0]==="1"&&(c.default_length=1,c.havent_set_length=!1)};var d={larghissimo:20,adagissimo:24,sostenuto:28,grave:32,largo:40,lento:50,larghetto:60,adagio:68,adagietto:74,andante:80,andantino:88,"marcia moderato":84,"andante moderato":100,moderato:112,allegretto:116,"allegro moderato":120,allegro:126,animato:132,agitato:140,veloce:148,"mosso vivo":156,vivace:164,vivacissimo:172,allegrissimo:176,presto:184,prestissimo:210};this.setTempo=function(u,i,t,a){try{var e=r.tokenize(u,i,t);if(e.length===0)throw"Missing parameter in Q: field";var h={startChar:a+i-2,endChar:a+t},v=!0,m=e.shift();if(m.type==="quote"&&(h.preString=m.token,m=e.shift(),e.length===0))return d[h.preString.toLowerCase()]&&(h.bpm=d[h.preString.toLowerCase()],h.suppressBpm=!0),{type:"immediate",tempo:h};if(m.type==="alpha"&&m.token==="C"){if(e.length===0)throw"Missing tempo after C in Q: field";if(m=e.shift(),m.type==="punct"&&m.token==="="){if(e.length===0)throw"Missing tempo after = in Q: field";if(m=e.shift(),m.type!=="number")throw"Expected number after = in Q: field";h.duration=[1],h.bpm=parseInt(m.token)}else if(m.type==="number"){if(h.duration=[parseInt(m.token)],e.length===0)throw"Missing = after duration in Q: field";if(m=e.shift(),m.type!=="punct"||m.token!=="=")throw"Expected = after duration in Q: field";if(e.length===0)throw"Missing tempo after = in Q: field";if(m=e.shift(),m.type!=="number")throw"Expected number after = in Q: field";h.bpm=parseInt(m.token)}else throw"Expected number or equal after C in Q: field"}else if(m.type==="number"){var x=parseInt(m.token);if(e.length===0||e[0].type==="quote")h.duration=[1],h.bpm=x;else{if(v=!1,m=e.shift(),m.type!=="punct"&&m.token!=="/"||(m=e.shift(),m.type!=="number"))throw"Expected fraction in Q: field";var C=parseInt(m.token);for(h.duration=[x/C];e.length>0&&e[0].token!=="="&&e[0].type!=="quote";){if(m=e.shift(),m.type!=="number"||(x=parseInt(m.token),m=e.shift(),m.type!=="punct"&&m.token!=="/")||(m=e.shift(),m.type!=="number"))throw"Expected fraction in Q: field";C=parseInt(m.token),h.duration.push(x/C)}if(m=e.shift(),m.type!=="punct"&&m.token!=="=")throw"Expected = in Q: field";if(m=e.shift(),m.type!=="number")throw"Expected tempo in Q: field";h.bpm=parseInt(m.token)}}else throw"Unknown value in Q: field";if(e.length!==0&&(m=e.shift(),m.type==="quote"&&(h.postString=m.token,m=e.shift()),e.length!==0))throw"Unexpected string at end of Q: field";return c.printTempo===!1&&(h.suppress=!0),{type:v?"delaySet":"immediate",tempo:h}}catch(S){return n(S,u,i),{type:"none"}}},this.letter_to_inline_header=function(u,i,t){var a=!1,e=r.eatWhiteSpace(u,i);if(i+=e,u.length>=i+5&&u[i]==="["&&u[i+2]===":"){var h=u.indexOf("]",i),v=c.iChar+i,m=c.iChar+h+1;switch(u.substring(i,i+3)){case"[I:":var x=g.addDirective(u.substring(i+3,h));return x&&n(x,u,i),[h-i+1+e];case"[M:":var C=this.setMeter(u.substring(i+3,h));return l.hasBeginMusic()&&C?l.appendStartingElement("meter",v,m,C):c.meter=C,[h-i+1+e];case"[K:":var S=p.parseKey(u.substring(i+3,h),!0);return S.foundClef&&l.hasBeginMusic()&&l.appendStartingElement("clef",v,m,c.clef),S.foundKey&&l.hasBeginMusic()&&l.appendStartingElement("key",v,m,p.fixKey(c.clef,c.key)),[h-i+1+e];case"[P:":var j=g.parseFontChangeLine(u.substring(i+3,h));return t||s.lines.length<=s.lineNum?c.partForNextLine={title:j,startChar:v,endChar:m}:l.appendElement("part",v,m,{title:j}),[h-i+1+e];case"[L:":return this.setDefaultLength(u,i+3,h),[h-i+1+e];case"[Q:":if(h>0){var F=this.setTempo(u,i+3,h,c.iChar);return F.type==="delaySet"?l.hasBeginMusic()?l.appendElement("tempo",v,m,this.calcTempo(F.tempo)):c.tempoForNextLine=["tempo",v,m,this.calcTempo(F.tempo)]:F.type==="immediate"&&(!t&&l.hasBeginMusic()?l.appendElement("tempo",v,m,F.tempo):c.tempoForNextLine=["tempo",v,m,F.tempo]),[h-i+1+e,u[i+1],u.substring(i+3,h)]}break;case"[V:":if(h>0)return a=p.parseVoice(u,i+3,h),[h-i+1+e,u[i+1],u.substring(i+3,h),a];break;case"[r:":return[h-i+1+e]}}return[0]},this.letter_to_body_header=function(u,i){var t=!1;if(u.length>=i+3)switch(u.substring(i,i+2)){case"I:":var a=g.addDirective(u.substring(i+2));return a&&n(a,u,i),[u.length];case"M:":var e=this.setMeter(u.substring(i+2));return l.hasBeginMusic()&&e&&l.appendStartingElement("meter",c.iChar+i,c.iChar+u.length,e),[u.length];case"K:":var h=p.parseKey(u.substring(i+2),l.hasBeginMusic());return h.foundClef&&l.hasBeginMusic()&&c.keywarn!==!1&&l.appendStartingElement("clef",c.iChar+i,c.iChar+u.length,c.clef),h.foundKey&&l.hasBeginMusic()&&c.keywarn!==!1&&l.appendStartingElement("key",c.iChar+i,c.iChar+u.length,p.fixKey(c.clef,c.key)),[u.length];case"P:":return l.hasBeginMusic()&&l.appendElement("part",c.iChar+i,c.iChar+u.length,{title:u.substring(i+2)}),[u.length];case"L:":return this.setDefaultLength(u,i+2,u.length),[u.length];case"Q:":var v=u.indexOf("",i+2);v===-1&&(v=u.length);var m=this.setTempo(u,i+2,v,c.iChar);return m.type==="delaySet"?l.appendElement("tempo",c.iChar+i,c.iChar+u.length,this.calcTempo(m.tempo)):m.type==="immediate"&&l.appendElement("tempo",c.iChar+i,c.iChar+u.length,m.tempo),[v,u[i],T.strip(u.substring(i+2))];case"V:":return t=p.parseVoice(u,i+2,u.length),[u.length,u[i],T.strip(u.substring(i+2)),t]}return[0]};var f={A:"author",B:"book",C:"composer",D:"discography",F:"url",G:"group",I:"instruction",N:"notes",O:"origin",R:"rhythm",S:"source",W:"unalignedWords",Z:"transcription"};this.parseHeader=function(u){var i=f[u[0]],t=u.length-2,a=r.translateString(r.stripComment(u.substring(2)));if(i==="unalignedWords"||i==="notes")l.addMetaTextArray(i,g.parseFontChangeLine(a),{startChar:c.iChar,endChar:c.iChar+u.length});else if(i!==void 0)l.addMetaText(i,g.parseFontChangeLine(a),{startChar:c.iChar,endChar:c.iChar+u.length});else{var e=c.iChar,h=e+u.length;switch(u[0]){case"H":for(l.addMetaTextArray("history",g.parseFontChangeLine(a),{startChar:c.iChar,endChar:c.iChar+u.length}),u=r.peekLine();u&&u[1]!==":";)r.nextLine(),l.addMetaTextArray("history",g.parseFontChangeLine(r.translateString(r.stripComment(u))),{startChar:c.iChar,endChar:c.iChar+u.length}),u=r.peekLine();break;case"K":this.resolveTempo();var v=p.parseKey(u.substring(2),!1);!c.is_in_header&&l.hasBeginMusic()&&c.keywarn!==!1&&(v.foundClef&&l.appendStartingElement("clef",e,h,c.clef),v.foundKey&&l.appendStartingElement("key",e,h,p.fixKey(c.clef,c.key))),c.is_in_header=!1;break;case"L":this.setDefaultLength(u,2,u.length);break;case"M":c.origMeter=c.meter=this.setMeter(u.substring(2));break;case"P":c.is_in_header?l.addMetaText("partOrder",g.parseFontChangeLine(a),{startChar:c.iChar,endChar:c.iChar+u.length}):c.partForNextLine={title:a,startChar:e,endChar:h};break;case"Q":var m=this.setTempo(u,2,u.length,c.iChar);m.type==="delaySet"?c.tempo=m.tempo:m.type==="immediate"&&(s.metaText.tempo?c.tempoForNextLine=["tempo",e,h,m.tempo]:s.metaText.tempo=m.tempo);break;case"T":c.titlecaps&&(a=a.toUpperCase()),this.setTitle(g.parseFontChangeLine(r.theReverser(a)),t);break;case"U":this.addUserDefinition(u,2,u.length);break;case"V":if(p.parseVoice(u,2,u.length),!c.is_in_header)return{newline:!0};break;case"s":return{symbols:!0};case"w":return{words:!0};case"X":break;case"E":case"m":n("Ignored header",u,0);break;default:return{regular:!0}}}return{}}};return nt=o,nt}var Ce={},ea;function fs(){return ea||(ea=1,Ce.legalAccents=["trill","trillh","lowermordent","uppermordent","mordent","pralltriller","accent","fermata","invertedfermata","tenuto","0","1","2","3","4","5","+","wedge","open","thumb","snap","turn","roll","breath","shortphrase","mediumphrase","longphrase","segno","coda","D.S.","D.C.","fine","beambr1","beambr2","slide","marcato","upbow","downbow","/","//","///","////","trem1","trem2","trem3","trem4","turnx","invertedturn","invertedturnx","trill(","trill)","arpeggio","xstem","mark","umarcato","style=normal","style=harmonic","style=rhythm","style=x","style=triangle","D.C.alcoda","D.C.alfine","D.S.alcoda","D.S.alfine","editorial","courtesy"],Ce.volumeDecorations=["p","pp","f","ff","mf","mp","ppp","pppp","fff","ffff","sfz"],Ce.dynamicDecorations=["crescendo(","crescendo)","diminuendo(","diminuendo)","glissando(","glissando)","~(","~)"],Ce.accentPseudonyms=[["<","accent"],[">","accent"],["tr","trill"],["plus","+"],["emphasis","accent"],["^","umarcato"],["marcato","umarcato"]],Ce.accentDynamicPseudonyms=[["<(","crescendo("],["<)","crescendo)"],[">(","diminuendo("],[">)","diminuendo)"]],Ce.nonDecorations="ABCDEFGabcdefgxyzZ[]|^_{",Ce.durations=[.5,.75,.875,.9375,.96875,.984375,.25,.375,.4375,.46875,.484375,.4921875,.125,.1875,.21875,.234375,.2421875,.24609375,.0625,.09375,.109375,.1171875,.12109375,.123046875,.03125,.046875,.0546875,.05859375,.060546875,.0615234375,.015625,.0234375,.02734375,.029296875,.0302734375,.03076171875],Ce.pitches={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11},Ce.rests={x:"invisible",X:"invisible-multimeasure",y:"spacer",z:"rest",Z:"multimeasure"},Ce.accMap={dblflat:"__",flat:"_",natural:"=",sharp:"^",dblsharp:"^^",quarterflat:"_/",quartersharp:"^/"},Ce.tripletQ={2:3,3:2,4:3,5:2,6:2,7:2,8:3,9:2}),Ce}var it,ta;function ps(){if(ta)return it;ta=1;var T=Lr(),g=Bi(),p,o,r,n,c,s,{legalAccents:l,volumeDecorations:d,dynamicDecorations:f,accentPseudonyms:u,accentDynamicPseudonyms:i,nonDecorations:t,durations:a,pitches:e,rests:h,accMap:v,tripletQ:m}=fs(),x=function(y,k,w,O,z,V){p=y,o=k,r=w,n=O,c=z,s=V,this.lineContinuation=!1},C=function(y,k,w){if(y.inTie[k]===void 0)return!1;var O=y.currentVoice?y.currentVoice.staffNum*100+y.currentVoice.index:0;return!!(y.inTie[k][O]&&(w.pitches!==void 0||w.rest.type!=="spacer"))},S={};x.prototype.parseMusic=function(y){s.resolveTempo(),r.is_in_header=!1;for(var k=0,w=r.iChar;p.isWhiteSpace(y[k])&&k<y.length;)k++;if(!(k===y.length||y[k]==="%")){var O=r.start_new_line;r.continueall===void 0?r.start_new_line=!0:r.start_new_line=!1;var z=0,V=s.letter_to_body_header(y,k);V[0]>0&&(k+=V[0],V[1]==="V"&&this.startNewLine());for(var I=0;k<y.length;){var K=k;if(y[k]==="%")break;var Q=s.letter_to_inline_header(y,k,O);if(Q[0]>0)k+=Q[0],Q[1]==="V"&&(O=!0);else{(!c.hasBeginMusic()||O&&!this.lineContinuation)&&(this.startNewLine(),O=!1);for(var G;;)if(G=p.eatWhiteSpace(y,k),G>0&&(k+=G),k>0&&y[k-1]===""&&(G=s.letter_to_body_header(y,k),G[0]>0&&(G[1]==="V"&&this.startNewLine(),k=G[0],r.start_new_line=!1)),G=P(y,k),G[0]>0&&(k+=G[0]),G=F(y,k),G[0]>0){S.chord||(S.chord=[]);var ee=p.translateString(G[1]);ee=ee.replace(/;/g,`
|
|
4
4
|
`);for(var te=!1,ne=0;ne<S.chord.length;ne++)S.chord[ne].position===G[2]&&(te=!0,S.chord[ne].name+=`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{O as U,ab as H,Q}from"./index
|
|
1
|
+
import{O as U,ab as H,Q}from"./index--DBVktm0.js";var O=function(){var c=function(a,t,n,e){for(n=n||{},e=a.length;e--;n[a[e]]=t);return n},f=[6,9,10],_={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(a,t,n,e,s,i,o){switch(i.length-1,s){case 1:return e;case 4:break;case 6:e.setInfo(!0);break}},table:[{3:1,4:[1,2]},{1:[3]},c(f,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},c(f,[2,3]),c(f,[2,4]),c(f,[2,5]),c(f,[2,6])],defaultActions:{4:[2,1]},parseError:function(a,t){if(t.recoverable)this.trace(a);else{var n=new Error(a);throw n.hash=t,n}},parse:function(a){var t=this,n=[0],e=[],s=[null],i=[],o=this.table,P="",k=0,$=0,T=2,L=1,z=i.slice.call(arguments,1),r=Object.create(this.lexer),p={yy:{}};for(var I in this.yy)Object.prototype.hasOwnProperty.call(this.yy,I)&&(p.yy[I]=this.yy[I]);r.setInput(a,p.yy),p.yy.lexer=r,p.yy.parser=this,typeof r.yylloc>"u"&&(r.yylloc={});var w=r.yylloc;i.push(w);var F=r.options&&r.options.ranges;typeof p.yy.parseError=="function"?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function R(){var u;return u=e.pop()||r.lex()||L,typeof u!="number"&&(u instanceof Array&&(e=u,u=e.pop()),u=t.symbols_[u]||u),u}for(var h,g,l,E,m={},x,y,j,b;;){if(g=n[n.length-1],this.defaultActions[g]?l=this.defaultActions[g]:((h===null||typeof h>"u")&&(h=R()),l=o[g]&&o[g][h]),typeof l>"u"||!l.length||!l[0]){var S="";b=[];for(x in o[g])this.terminals_[x]&&x>T&&b.push("'"+this.terminals_[x]+"'");r.showPosition?S="Parse error on line "+(k+1)+`:
|
|
2
2
|
`+r.showPosition()+`
|
|
3
3
|
Expecting `+b.join(", ")+", got '"+(this.terminals_[h]||h)+"'":S="Parse error on line "+(k+1)+": Unexpected "+(h==L?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(S,{text:r.match,token:this.terminals_[h]||h,line:r.yylineno,loc:w,expected:b})}if(l[0]instanceof Array&&l.length>1)throw new Error("Parse Error: multiple actions possible at state: "+g+", token: "+h);switch(l[0]){case 1:n.push(h),s.push(r.yytext),i.push(r.yylloc),n.push(l[1]),h=null,$=r.yyleng,P=r.yytext,k=r.yylineno,w=r.yylloc;break;case 2:if(y=this.productions_[l[1]][1],m.$=s[s.length-y],m._$={first_line:i[i.length-(y||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(y||1)].first_column,last_column:i[i.length-1].last_column},F&&(m._$.range=[i[i.length-(y||1)].range[0],i[i.length-1].range[1]]),E=this.performAction.apply(m,[P,$,k,p.yy,l[1],s,i].concat(z)),typeof E<"u")return E;y&&(n=n.slice(0,-1*y*2),s=s.slice(0,-1*y),i=i.slice(0,-1*y)),n.push(this.productions_[l[1]][0]),s.push(m.$),i.push(m._$),j=o[n[n.length-2]][n[n.length-1]],n.push(j);break;case 3:return!0}}return!0}},d=function(){var a={EOF:1,parseError:function(t,n){if(this.yy.parser)this.yy.parser.parseError(t,n);else throw new Error(t)},setInput:function(t,n){return this.yy=n||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var n=t.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var n=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var s=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),e.length-1&&(this.yylineno-=e.length-1);var i=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:e?(e.length===s.length?this.yylloc.first_column:0)+s[s.length-e.length].length-e[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),n=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{L as ut,D as yt,R as pt,N as ft,j as dt,M as gt,E as P,F as z,Q as mt,I as xt}from"./index
|
|
1
|
+
import{L as ut,D as yt,R as pt,N as ft,j as dt,M as gt,E as P,F as z,Q as mt,I as xt}from"./index--DBVktm0.js";import{x as kt,p as nt,d as _t,l as bt}from"./svgDrawCommon-b86b1483-CXPkN8HW-C4vufBue.js";import{h as Z}from"./arc-m8RC5oDD-D4A9YAA9.js";var W=function(){var t=function(d,i,r,c){for(r=r||{},c=d.length;c--;r[d[c]]=i);return r},e=[6,8,10,11,12,14,16,17,18],s=[1,9],o=[1,10],n=[1,11],l=[1,12],u=[1,13],y=[1,14],p={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:function(d,i,r,c,h,a,g){var x=a.length-1;switch(h){case 1:return a[x-1];case 2:this.$=[];break;case 3:a[x-1].push(a[x]),this.$=a[x-1];break;case 4:case 5:this.$=a[x];break;case 6:case 7:this.$=[];break;case 8:c.setDiagramTitle(a[x].substr(6)),this.$=a[x].substr(6);break;case 9:this.$=a[x].trim(),c.setAccTitle(this.$);break;case 10:case 11:this.$=a[x].trim(),c.setAccDescription(this.$);break;case 12:c.addSection(a[x].substr(8)),this.$=a[x].substr(8);break;case 13:c.addTask(a[x-1],a[x]),this.$="task";break}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:o,14:n,16:l,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:o,14:n,16:l,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:function(d,i){if(i.recoverable)this.trace(d);else{var r=new Error(d);throw r.hash=i,r}},parse:function(d){var i=this,r=[0],c=[],h=[null],a=[],g=this.table,x="",L=0,G=0,ot=2,H=1,lt=a.slice.call(arguments,1),k=Object.create(this.lexer),T={yy:{}};for(var N in this.yy)Object.prototype.hasOwnProperty.call(this.yy,N)&&(T.yy[N]=this.yy[N]);k.setInput(d,T.yy),T.yy.lexer=k,T.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var R=k.yylloc;a.push(R);var ct=k.options&&k.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ht(){var $;return $=c.pop()||k.lex()||H,typeof $!="number"&&($ instanceof Array&&(c=$,$=c.pop()),$=i.symbols_[$]||$),$}for(var _,S,b,B,C={},D,w,Q,F;;){if(S=r[r.length-1],this.defaultActions[S]?b=this.defaultActions[S]:((_===null||typeof _>"u")&&(_=ht()),b=g[S]&&g[S][_]),typeof b>"u"||!b.length||!b[0]){var Y="";F=[];for(D in g[S])this.terminals_[D]&&D>ot&&F.push("'"+this.terminals_[D]+"'");k.showPosition?Y="Parse error on line "+(L+1)+`:
|
|
2
2
|
`+k.showPosition()+`
|
|
3
3
|
Expecting `+F.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Y="Parse error on line "+(L+1)+": Unexpected "+(_==H?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Y,{text:k.match,token:this.terminals_[_]||_,line:k.yylineno,loc:R,expected:F})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+S+", token: "+_);switch(b[0]){case 1:r.push(_),h.push(k.yytext),a.push(k.yylloc),r.push(b[1]),_=null,G=k.yyleng,x=k.yytext,L=k.yylineno,R=k.yylloc;break;case 2:if(w=this.productions_[b[1]][1],C.$=h[h.length-w],C._$={first_line:a[a.length-(w||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(w||1)].first_column,last_column:a[a.length-1].last_column},ct&&(C._$.range=[a[a.length-(w||1)].range[0],a[a.length-1].range[1]]),B=this.performAction.apply(C,[x,G,L,T.yy,b[1],h,a].concat(lt)),typeof B<"u")return B;w&&(r=r.slice(0,-1*w*2),h=h.slice(0,-1*w),a=a.slice(0,-1*w)),r.push(this.productions_[b[1]][0]),h.push(C.$),a.push(C._$),Q=g[r[r.length-2]][r[r.length-1]],r.push(Q);break;case 3:return!0}}return!0}},m=function(){var d={EOF:1,parseError:function(i,r){if(this.yy.parser)this.yy.parser.parseError(i,r);else throw new Error(i)},setInput:function(i,r){return this.yy=r||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var r=i.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},unput:function(i){var r=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;var h=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var a=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===h.length?this.yylloc.first_column:0)+h[h.length-c.length].length-c[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(i){this.unput(this.match.slice(i))},pastInput:function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var i=this.pastInput(),r=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T,B as O,E as Dn,k as Kn,b as bn,X as L,m as f,K as m,C as mn,c as k,P as b,$ as yn,d as xn,M as F,O as Xn,R,U as Hn,I as kn,G as Jn,e as Qn,T as Un,f as Wn}from"./graph-BV6jB5rk-CELreG_k.js";import{aq as En,ar as Zn,as as nr,at as J,au as On,av as $,aw as Nn,ax as rr,ay as S,az as X,aA as Q,aB as tr,aC as er,aD as or,aE as _n,aF as ir,aG as ur}from"./index-BaIhc-dj.js";var ar=/\s/;function cr(n){for(var r=n.length;r--&&ar.test(n.charAt(r)););return r}var dr=/^\s+/;function fr(n){return n&&n.slice(0,cr(n)+1).replace(dr,"")}var un=NaN,sr=/^[-+]0x[0-9a-f]+$/i,hr=/^0b[01]+$/i,vr=/^0o[0-7]+$/i,gr=parseInt;function lr(n){if(typeof n=="number")return n;if(L(n))return un;if(S(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=S(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=fr(n);var t=hr.test(n);return t||vr.test(n)?gr(n.slice(2),t?2:8):sr.test(n)?un:+n}var an=1/0,pr=17976931348623157e292;function C(n){if(!n)return n===0?n:0;if(n=lr(n),n===an||n===-an){var r=n<0?-1:1;return r*pr}return n===n?n:0}function wr(n){var r=C(n),t=r%1;return r===r?t?r-t:r:0}function N(n){var r=n==null?0:n.length;return r?bn(n):[]}function br(n){return Zn(nr(n,void 0,N),n+"")}var mr=1,yr=4;function xr(n){return Hn(n,mr|yr)}var In=Object.prototype,kr=In.hasOwnProperty,Er=En(function(n,r){n=Object(n);var t=-1,e=r.length,o=e>2?r[2]:void 0;for(o&&$(r[0],r[1],o)&&(e=1);++t<e;)for(var u=r[t],i=Nn(u),a=-1,c=i.length;++a<c;){var d=i[a],s=n[d];(s===void 0||rr(s,In[d])&&!kr.call(n,d))&&(n[d]=u[d])}return n});function G(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}function Or(n){return function(r,t,e){var o=Object(r);if(!On(r)){var u=O(t);r=Qn(r),t=function(a){return u(o[a],a,o)}}var i=n(r,t,e);return i>-1?o[u?r[i]:i]:void 0}}var Nr=Math.max;function _r(n,r,t){var e=n==null?0:n.length;if(!e)return-1;var o=t==null?0:wr(t);return o<0&&(o=Nr(e+o,0)),Wn(n,O(r),o)}var U=Or(_r);function Pn(n,r){var t=-1,e=On(n)?Array(n.length):[];return Kn(n,function(o,u,i){e[++t]=r(o,u,i)}),e}function p(n,r){var t=J(n)?T:Pn;return t(n,O(r))}function Ir(n,r){return n==null?n:ur(n,kn(r),Nn)}function Pr(n,r){return n&&yn(n,kn(r))}function jr(n,r){return n>r}var Rr=Object.prototype,Mr=Rr.hasOwnProperty;function Tr(n,r){return n!=null&&Mr.call(n,r)}function jn(n,r){return n!=null&&Xn(n,r,Tr)}function Rn(n,r){return n<r}function V(n,r){var t={};return r=O(r),yn(n,function(e,o,u){er(t,o,r(e,o,u))}),t}function W(n,r,t){for(var e=-1,o=n.length;++e<o;){var u=n[e],i=r(u);if(i!=null&&(a===void 0?i===i&&!L(i):t(i,a)))var a=i,c=u}return c}function y(n){return n&&n.length?W(n,Q,jr):void 0}function P(n){return n&&n.length?W(n,Q,Rn):void 0}function Z(n,r){return n&&n.length?W(n,O(r),Rn):void 0}function Cr(n,r,t,e){if(!S(n))return n;r=xn(r,n);for(var o=-1,u=r.length,i=u-1,a=n;a!=null&&++o<u;){var c=Jn(r[o]),d=t;if(c==="__proto__"||c==="constructor"||c==="prototype")return n;if(o!=i){var s=a[c];d=void 0,d===void 0&&(d=S(s)?s:or(r[o+1])?[]:{})}_n(a,c,d),a=a[c]}return n}function Lr(n,r,t){for(var e=-1,o=r.length,u={};++e<o;){var i=r[e],a=mn(n,i);t(a,i)&&Cr(u,xn(i,n),a)}return u}function $r(n,r){var t=n.length;for(n.sort(r);t--;)n[t]=n[t].value;return n}function Sr(n,r){if(n!==r){var t=n!==void 0,e=n===null,o=n===n,u=L(n),i=r!==void 0,a=r===null,c=r===r,d=L(r);if(!a&&!d&&!u&&n>r||u&&i&&c&&!a&&!d||e&&i&&c||!t&&c||!o)return 1;if(!e&&!u&&!d&&n<r||d&&t&&o&&!e&&!u||a&&t&&o||!i&&o||!c)return-1}return 0}function Gr(n,r,t){for(var e=-1,o=n.criteria,u=r.criteria,i=o.length,a=t.length;++e<i;){var c=Sr(o[e],u[e]);if(c){if(e>=a)return c;var d=t[e];return c*(d=="desc"?-1:1)}}return n.index-r.index}function Br(n,r,t){r.length?r=T(r,function(u){return J(u)?function(i){return mn(i,u.length===1?u[0]:u)}:u}):r=[Q];var e=-1;r=T(r,tr(O));var o=Pn(n,function(u,i,a){var c=T(r,function(d){return d(u)});return{criteria:c,index:++e,value:u}});return $r(o,function(u,i){return Gr(u,i,t)})}function Fr(n,r){return Lr(n,r,function(t,e){return Un(n,e)})}var B=br(function(n,r){return n==null?{}:Fr(n,r)}),Vr=Math.ceil,qr=Math.max;function zr(n,r,t,e){for(var o=-1,u=qr(Vr((r-n)/(t||1)),0),i=Array(u);u--;)i[++o]=n,n+=t;return i}function Ar(n){return function(r,t,e){return e&&typeof e!="number"&&$(r,t,e)&&(t=e=void 0),r=C(r),t===void 0?(t=r,r=0):t=C(t),e=e===void 0?r<t?1:-1:C(e),zr(r,t,e)}}var E=Ar(),M=En(function(n,r){if(n==null)return[];var t=r.length;return t>1&&$(n,r[0],r[1])?r=[]:t>2&&$(r[0],r[1],r[2])&&(r=[r[0]]),Br(n,bn(r),[])}),Yr=0;function nn(n){var r=++Yr;return Dn(n)+r}function Dr(n,r,t){for(var e=-1,o=n.length,u=r.length,i={};++e<o;){var a=e<u?r[e]:void 0;t(i,n[e],a)}return i}function Kr(n,r){return Dr(n||[],r||[],_n)}class Xr{constructor(){var r={};r._next=r._prev=r,this._sentinel=r}dequeue(){var r=this._sentinel,t=r._prev;if(t!==r)return cn(t),t}enqueue(r){var t=this._sentinel;r._prev&&r._next&&cn(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t}toString(){for(var r=[],t=this._sentinel,e=t._prev;e!==t;)r.push(JSON.stringify(e,Hr)),e=e._prev;return"["+r.join(", ")+"]"}}function cn(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function Hr(n,r){if(n!=="_next"&&n!=="_prev")return r}var Jr=ir(1);function Qr(n,r){if(n.nodeCount()<=1)return[];var t=Wr(n,r||Jr),e=Ur(t.graph,t.buckets,t.zeroIdx);return N(p(e,function(o){return n.outEdges(o.v,o.w)}))}function Ur(n,r,t){for(var e=[],o=r[r.length-1],u=r[0],i;n.nodeCount();){for(;i=u.dequeue();)z(n,r,t,i);for(;i=o.dequeue();)z(n,r,t,i);if(n.nodeCount()){for(var a=r.length-2;a>0;--a)if(i=r[a].dequeue(),i){e=e.concat(z(n,r,t,i,!0));break}}}return e}function z(n,r,t,e,o){var u=o?[]:void 0;return f(n.inEdges(e.v),function(i){var a=n.edge(i),c=n.node(i.v);o&&u.push({v:i.v,w:i.w}),c.out-=a,H(r,t,c)}),f(n.outEdges(e.v),function(i){var a=n.edge(i),c=i.w,d=n.node(c);d.in-=a,H(r,t,d)}),n.removeNode(e.v),u}function Wr(n,r){var t=new m,e=0,o=0;f(n.nodes(),function(a){t.setNode(a,{v:a,in:0,out:0})}),f(n.edges(),function(a){var c=t.edge(a.v,a.w)||0,d=r(a),s=c+d;t.setEdge(a.v,a.w,s),o=Math.max(o,t.node(a.v).out+=d),e=Math.max(e,t.node(a.w).in+=d)});var u=E(o+e+3).map(function(){return new Xr}),i=e+1;return f(t.nodes(),function(a){H(u,i,t.node(a))}),{graph:t,buckets:u,zeroIdx:i}}function H(n,r,t){t.out?t.in?n[t.out-t.in+r].enqueue(t):n[n.length-1].enqueue(t):n[0].enqueue(t)}function Zr(n){var r=n.graph().acyclicer==="greedy"?Qr(n,t(n)):nt(n);f(r,function(e){var o=n.edge(e);n.removeEdge(e),o.forwardName=e.name,o.reversed=!0,n.setEdge(e.w,e.v,o,nn("rev"))});function t(e){return function(o){return e.edge(o).weight}}}function nt(n){var r=[],t={},e={};function o(u){Object.prototype.hasOwnProperty.call(e,u)||(e[u]=!0,t[u]=!0,f(n.outEdges(u),function(i){Object.prototype.hasOwnProperty.call(t,i.w)?r.push(i):o(i.w)}),delete t[u])}return f(n.nodes(),o),r}function rt(n){f(n.edges(),function(r){var t=n.edge(r);if(t.reversed){n.removeEdge(r);var e=t.forwardName;delete t.reversed,delete t.forwardName,n.setEdge(r.w,r.v,t,e)}})}function _(n,r,t,e){var o;do o=nn(e);while(n.hasNode(o));return t.dummy=r,n.setNode(o,t),o}function tt(n){var r=new m().setGraph(n.graph());return f(n.nodes(),function(t){r.setNode(t,n.node(t))}),f(n.edges(),function(t){var e=r.edge(t.v,t.w)||{weight:0,minlen:1},o=n.edge(t);r.setEdge(t.v,t.w,{weight:e.weight+o.weight,minlen:Math.max(e.minlen,o.minlen)})}),r}function Mn(n){var r=new m({multigraph:n.isMultigraph()}).setGraph(n.graph());return f(n.nodes(),function(t){n.children(t).length||r.setNode(t,n.node(t))}),f(n.edges(),function(t){r.setEdge(t,n.edge(t))}),r}function dn(n,r){var t=n.x,e=n.y,o=r.x-t,u=r.y-e,i=n.width/2,a=n.height/2;if(!o&&!u)throw new Error("Not possible to find intersection inside of the rectangle");var c,d;return Math.abs(u)*i>Math.abs(o)*a?(u<0&&(a=-a),c=a*o/u,d=a):(o<0&&(i=-i),c=i,d=i*u/o),{x:t+c,y:e+d}}function q(n){var r=p(E(Tn(n)+1),function(){return[]});return f(n.nodes(),function(t){var e=n.node(t),o=e.rank;b(o)||(r[o][e.order]=t)}),r}function et(n){var r=P(p(n.nodes(),function(t){return n.node(t).rank}));f(n.nodes(),function(t){var e=n.node(t);jn(e,"rank")&&(e.rank-=r)})}function ot(n){var r=P(p(n.nodes(),function(u){return n.node(u).rank})),t=[];f(n.nodes(),function(u){var i=n.node(u).rank-r;t[i]||(t[i]=[]),t[i].push(u)});var e=0,o=n.graph().nodeRankFactor;f(t,function(u,i){b(u)&&i%o!==0?--e:e&&f(u,function(a){n.node(a).rank+=e})})}function fn(n,r,t,e){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=e),_(n,"border",o,r)}function Tn(n){return y(p(n.nodes(),function(r){var t=n.node(r).rank;if(!b(t))return t}))}function it(n,r){var t={lhs:[],rhs:[]};return f(n,function(e){r(e)?t.lhs.push(e):t.rhs.push(e)}),t}function ut(n,r){return r()}function at(n){function r(t){var e=n.children(t),o=n.node(t);if(e.length&&f(e,r),Object.prototype.hasOwnProperty.call(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var u=o.minRank,i=o.maxRank+1;u<i;++u)sn(n,"borderLeft","_bl",t,o,u),sn(n,"borderRight","_br",t,o,u)}}f(n.children(),r)}function sn(n,r,t,e,o,u){var i={width:0,height:0,rank:u,borderType:r},a=o[r][u-1],c=_(n,"border",i,t);o[r][u]=c,n.setParent(c,e),a&&n.setEdge(a,c,{weight:1})}function ct(n){var r=n.graph().rankdir.toLowerCase();(r==="lr"||r==="rl")&&Cn(n)}function dt(n){var r=n.graph().rankdir.toLowerCase();(r==="bt"||r==="rl")&&ft(n),(r==="lr"||r==="rl")&&(st(n),Cn(n))}function Cn(n){f(n.nodes(),function(r){hn(n.node(r))}),f(n.edges(),function(r){hn(n.edge(r))})}function hn(n){var r=n.width;n.width=n.height,n.height=r}function ft(n){f(n.nodes(),function(r){A(n.node(r))}),f(n.edges(),function(r){var t=n.edge(r);f(t.points,A),Object.prototype.hasOwnProperty.call(t,"y")&&A(t)})}function A(n){n.y=-n.y}function st(n){f(n.nodes(),function(r){Y(n.node(r))}),f(n.edges(),function(r){var t=n.edge(r);f(t.points,Y),Object.prototype.hasOwnProperty.call(t,"x")&&Y(t)})}function Y(n){var r=n.x;n.x=n.y,n.y=r}function ht(n){n.graph().dummyChains=[],f(n.edges(),function(r){vt(n,r)})}function vt(n,r){var t=r.v,e=n.node(t).rank,o=r.w,u=n.node(o).rank,i=r.name,a=n.edge(r),c=a.labelRank;if(u!==e+1){n.removeEdge(r);var d=void 0,s,h;for(h=0,++e;e<u;++h,++e)a.points=[],d={width:0,height:0,edgeLabel:a,edgeObj:r,rank:e},s=_(n,"edge",d,"_d"),e===c&&(d.width=a.width,d.height=a.height,d.dummy="edge-label",d.labelpos=a.labelpos),n.setEdge(t,s,{weight:a.weight},i),h===0&&n.graph().dummyChains.push(s),t=s;n.setEdge(t,o,{weight:a.weight},i)}}function gt(n){f(n.graph().dummyChains,function(r){var t=n.node(r),e=t.edgeLabel,o;for(n.setEdge(t.edgeObj,e);t.dummy;)o=n.successors(r)[0],n.removeNode(r),e.points.push({x:t.x,y:t.y}),t.dummy==="edge-label"&&(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height),r=o,t=n.node(r)})}function rn(n){var r={};function t(e){var o=n.node(e);if(Object.prototype.hasOwnProperty.call(r,e))return o.rank;r[e]=!0;var u=P(p(n.outEdges(e),function(i){return t(i.w)-n.edge(i).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),o.rank=u}f(n.sources(),t)}function j(n,r){return n.node(r.w).rank-n.node(r.v).rank-n.edge(r).minlen}function Ln(n){var r=new m({directed:!1}),t=n.nodes()[0],e=n.nodeCount();r.setNode(t,{});for(var o,u;lt(r,n)<e;)o=pt(r,n),u=r.hasNode(o.v)?j(n,o):-j(n,o),wt(r,n,u);return r}function lt(n,r){function t(e){f(r.nodeEdges(e),function(o){var u=o.v,i=e===u?o.w:u;!n.hasNode(i)&&!j(r,o)&&(n.setNode(i,{}),n.setEdge(e,i,{}),t(i))})}return f(n.nodes(),t),n.nodeCount()}function pt(n,r){return Z(r.edges(),function(t){if(n.hasNode(t.v)!==n.hasNode(t.w))return j(r,t)})}function wt(n,r,t){f(n.nodes(),function(e){r.node(e).rank+=t})}function $n(n,r,t){J(r)||(r=[r]);var e=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],u={};return f(r,function(i){if(!n.hasNode(i))throw new Error("Graph does not have node: "+i);Sn(n,i,t==="post",u,e,o)}),o}function Sn(n,r,t,e,o,u){Object.prototype.hasOwnProperty.call(e,r)||(e[r]=!0,t||u.push(r),f(o(r),function(i){Sn(n,i,t,e,o,u)}),t&&u.push(r))}function bt(n,r){return $n(n,r,"post")}function mt(n,r){return $n(n,r,"pre")}x.initLowLimValues=en;x.initCutValues=tn;x.calcCutValue=Gn;x.leaveEdge=Fn;x.enterEdge=Vn;x.exchangeEdges=qn;function x(n){n=tt(n),rn(n);var r=Ln(n);en(r),tn(r,n);for(var t,e;t=Fn(r);)e=Vn(r,n,t),qn(r,n,t,e)}function tn(n,r){var t=bt(n,n.nodes());t=t.slice(0,t.length-1),f(t,function(e){yt(n,r,e)})}function yt(n,r,t){var e=n.node(t),o=e.parent;n.edge(t,o).cutvalue=Gn(n,r,t)}function Gn(n,r,t){var e=n.node(t),o=e.parent,u=!0,i=r.edge(t,o),a=0;return i||(u=!1,i=r.edge(o,t)),a=i.weight,f(r.nodeEdges(t),function(c){var d=c.v===t,s=d?c.w:c.v;if(s!==o){var h=d===u,v=r.edge(c).weight;if(a+=h?v:-v,kt(n,t,s)){var g=n.edge(t,s).cutvalue;a+=h?-g:g}}}),a}function en(n,r){arguments.length<2&&(r=n.nodes()[0]),Bn(n,{},1,r)}function Bn(n,r,t,e,o){var u=t,i=n.node(e);return r[e]=!0,f(n.neighbors(e),function(a){Object.prototype.hasOwnProperty.call(r,a)||(t=Bn(n,r,t,a,e))}),i.low=u,i.lim=t++,o?i.parent=o:delete i.parent,t}function Fn(n){return U(n.edges(),function(r){return n.edge(r).cutvalue<0})}function Vn(n,r,t){var e=t.v,o=t.w;r.hasEdge(e,o)||(e=t.w,o=t.v);var u=n.node(e),i=n.node(o),a=u,c=!1;u.lim>i.lim&&(a=i,c=!0);var d=R(r.edges(),function(s){return c===vn(n,n.node(s.v),a)&&c!==vn(n,n.node(s.w),a)});return Z(d,function(s){return j(r,s)})}function qn(n,r,t,e){var o=t.v,u=t.w;n.removeEdge(o,u),n.setEdge(e.v,e.w,{}),en(n),tn(n,r),xt(n,r)}function xt(n,r){var t=U(n.nodes(),function(o){return!r.node(o).parent}),e=mt(n,t);e=e.slice(1),f(e,function(o){var u=n.node(o).parent,i=r.edge(o,u),a=!1;i||(i=r.edge(u,o),a=!0),r.node(o).rank=r.node(u).rank+(a?i.minlen:-i.minlen)})}function kt(n,r,t){return n.hasEdge(r,t)}function vn(n,r,t){return t.low<=r.lim&&r.lim<=t.lim}function Et(n){switch(n.graph().ranker){case"network-simplex":gn(n);break;case"tight-tree":Nt(n);break;case"longest-path":Ot(n);break;default:gn(n)}}var Ot=rn;function Nt(n){rn(n),Ln(n)}function gn(n){x(n)}function _t(n){var r=_(n,"root",{},"_root"),t=It(n),e=y(k(t))-1,o=2*e+1;n.graph().nestingRoot=r,f(n.edges(),function(i){n.edge(i).minlen*=o});var u=Pt(n)+1;f(n.children(),function(i){zn(n,r,o,u,e,t,i)}),n.graph().nodeRankFactor=o}function zn(n,r,t,e,o,u,i){var a=n.children(i);if(!a.length){i!==r&&n.setEdge(r,i,{weight:0,minlen:t});return}var c=fn(n,"_bt"),d=fn(n,"_bb"),s=n.node(i);n.setParent(c,i),s.borderTop=c,n.setParent(d,i),s.borderBottom=d,f(a,function(h){zn(n,r,t,e,o,u,h);var v=n.node(h),g=v.borderTop?v.borderTop:h,l=v.borderBottom?v.borderBottom:h,w=v.borderTop?e:2*e,I=g!==l?1:o-u[i]+1;n.setEdge(c,g,{weight:w,minlen:I,nestingEdge:!0}),n.setEdge(l,d,{weight:w,minlen:I,nestingEdge:!0})}),n.parent(i)||n.setEdge(r,c,{weight:0,minlen:o+u[i]})}function It(n){var r={};function t(e,o){var u=n.children(e);u&&u.length&&f(u,function(i){t(i,o+1)}),r[e]=o}return f(n.children(),function(e){t(e,1)}),r}function Pt(n){return F(n.edges(),function(r,t){return r+n.edge(t).weight},0)}function jt(n){var r=n.graph();n.removeNode(r.nestingRoot),delete r.nestingRoot,f(n.edges(),function(t){var e=n.edge(t);e.nestingEdge&&n.removeEdge(t)})}function Rt(n,r,t){var e={},o;f(t,function(u){for(var i=n.parent(u),a,c;i;){if(a=n.parent(i),a?(c=e[a],e[a]=i):(c=o,o=i),c&&c!==i){r.setEdge(c,i);return}i=a}})}function Mt(n,r,t){var e=Tt(n),o=new m({compound:!0}).setGraph({root:e}).setDefaultNodeLabel(function(u){return n.node(u)});return f(n.nodes(),function(u){var i=n.node(u),a=n.parent(u);(i.rank===r||i.minRank<=r&&r<=i.maxRank)&&(o.setNode(u),o.setParent(u,a||e),f(n[t](u),function(c){var d=c.v===u?c.w:c.v,s=o.edge(d,u),h=b(s)?0:s.weight;o.setEdge(d,u,{weight:n.edge(c).weight+h})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&o.setNode(u,{borderLeft:i.borderLeft[r],borderRight:i.borderRight[r]}))}),o}function Tt(n){for(var r;n.hasNode(r=nn("_root")););return r}function Ct(n,r){for(var t=0,e=1;e<r.length;++e)t+=Lt(n,r[e-1],r[e]);return t}function Lt(n,r,t){for(var e=Kr(t,p(t,function(d,s){return s})),o=N(p(r,function(d){return M(p(n.outEdges(d),function(s){return{pos:e[s.w],weight:n.edge(s).weight}}),"pos")})),u=1;u<t.length;)u<<=1;var i=2*u-1;u-=1;var a=p(new Array(i),function(){return 0}),c=0;return f(o.forEach(function(d){var s=d.pos+u;a[s]+=d.weight;for(var h=0;s>0;)s%2&&(h+=a[s+1]),s=s-1>>1,a[s]+=d.weight;c+=d.weight*h})),c}function $t(n){var r={},t=R(n.nodes(),function(a){return!n.children(a).length}),e=y(p(t,function(a){return n.node(a).rank})),o=p(E(e+1),function(){return[]});function u(a){if(!jn(r,a)){r[a]=!0;var c=n.node(a);o[c.rank].push(a),f(n.successors(a),u)}}var i=M(t,function(a){return n.node(a).rank});return f(i,u),o}function St(n,r){return p(r,function(t){var e=n.inEdges(t);if(e.length){var o=F(e,function(u,i){var a=n.edge(i),c=n.node(i.v);return{sum:u.sum+a.weight*c.order,weight:u.weight+a.weight}},{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:t}})}function Gt(n,r){var t={};f(n,function(o,u){var i=t[o.v]={indegree:0,in:[],out:[],vs:[o.v],i:u};b(o.barycenter)||(i.barycenter=o.barycenter,i.weight=o.weight)}),f(r.edges(),function(o){var u=t[o.v],i=t[o.w];!b(u)&&!b(i)&&(i.indegree++,u.out.push(t[o.w]))});var e=R(t,function(o){return!o.indegree});return Bt(e)}function Bt(n){var r=[];function t(u){return function(i){i.merged||(b(i.barycenter)||b(u.barycenter)||i.barycenter>=u.barycenter)&&Ft(u,i)}}function e(u){return function(i){i.in.push(u),--i.indegree===0&&n.push(i)}}for(;n.length;){var o=n.pop();r.push(o),f(o.in.reverse(),t(o)),f(o.out,e(o))}return p(R(r,function(u){return!u.merged}),function(u){return B(u,["vs","i","barycenter","weight"])})}function Ft(n,r){var t=0,e=0;n.weight&&(t+=n.barycenter*n.weight,e+=n.weight),r.weight&&(t+=r.barycenter*r.weight,e+=r.weight),n.vs=r.vs.concat(n.vs),n.barycenter=t/e,n.weight=e,n.i=Math.min(r.i,n.i),r.merged=!0}function Vt(n,r){var t=it(n,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),e=t.lhs,o=M(t.rhs,function(s){return-s.i}),u=[],i=0,a=0,c=0;e.sort(qt(!!r)),c=ln(u,o,c),f(e,function(s){c+=s.vs.length,u.push(s.vs),i+=s.barycenter*s.weight,a+=s.weight,c=ln(u,o,c)});var d={vs:N(u)};return a&&(d.barycenter=i/a,d.weight=a),d}function ln(n,r,t){for(var e;r.length&&(e=G(r)).i<=t;)r.pop(),n.push(e.vs),t++;return t}function qt(n){return function(r,t){return r.barycenter<t.barycenter?-1:r.barycenter>t.barycenter?1:n?t.i-r.i:r.i-t.i}}function An(n,r,t,e){var o=n.children(r),u=n.node(r),i=u?u.borderLeft:void 0,a=u?u.borderRight:void 0,c={};i&&(o=R(o,function(l){return l!==i&&l!==a}));var d=St(n,o);f(d,function(l){if(n.children(l.v).length){var w=An(n,l.v,t,e);c[l.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&At(l,w)}});var s=Gt(d,t);zt(s,c);var h=Vt(s,e);if(i&&(h.vs=N([i,h.vs,a]),n.predecessors(i).length)){var v=n.node(n.predecessors(i)[0]),g=n.node(n.predecessors(a)[0]);Object.prototype.hasOwnProperty.call(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+v.order+g.order)/(h.weight+2),h.weight+=2}return h}function zt(n,r){f(n,function(t){t.vs=N(t.vs.map(function(e){return r[e]?r[e].vs:e}))})}function At(n,r){b(n.barycenter)?(n.barycenter=r.barycenter,n.weight=r.weight):(n.barycenter=(n.barycenter*n.weight+r.barycenter*r.weight)/(n.weight+r.weight),n.weight+=r.weight)}function Yt(n){var r=Tn(n),t=pn(n,E(1,r+1),"inEdges"),e=pn(n,E(r-1,-1,-1),"outEdges"),o=$t(n);wn(n,o);for(var u=Number.POSITIVE_INFINITY,i,a=0,c=0;c<4;++a,++c){Dt(a%2?t:e,a%4>=2),o=q(n);var d=Ct(n,o);d<u&&(c=0,i=xr(o),u=d)}wn(n,i)}function pn(n,r,t){return p(r,function(e){return Mt(n,e,t)})}function Dt(n,r){var t=new m;f(n,function(e){var o=e.graph().root,u=An(e,o,t,r);f(u.vs,function(i,a){e.node(i).order=a}),Rt(e,t,u.vs)})}function wn(n,r){f(r,function(t){f(t,function(e,o){n.node(e).order=o})})}function Kt(n){var r=Ht(n);f(n.graph().dummyChains,function(t){for(var e=n.node(t),o=e.edgeObj,u=Xt(n,r,o.v,o.w),i=u.path,a=u.lca,c=0,d=i[c],s=!0;t!==o.w;){if(e=n.node(t),s){for(;(d=i[c])!==a&&n.node(d).maxRank<e.rank;)c++;d===a&&(s=!1)}if(!s){for(;c<i.length-1&&n.node(d=i[c+1]).minRank<=e.rank;)c++;d=i[c]}n.setParent(t,d),t=n.successors(t)[0]}})}function Xt(n,r,t,e){var o=[],u=[],i=Math.min(r[t].low,r[e].low),a=Math.max(r[t].lim,r[e].lim),c,d;c=t;do c=n.parent(c),o.push(c);while(c&&(r[c].low>i||a>r[c].lim));for(d=c,c=e;(c=n.parent(c))!==d;)u.push(c);return{path:o.concat(u.reverse()),lca:d}}function Ht(n){var r={},t=0;function e(o){var u=t;f(n.children(o),e),r[o]={low:u,lim:t++}}return f(n.children(),e),r}function Jt(n,r){var t={};function e(o,u){var i=0,a=0,c=o.length,d=G(u);return f(u,function(s,h){var v=Ut(n,s),g=v?n.node(v).order:c;(v||s===d)&&(f(u.slice(a,h+1),function(l){f(n.predecessors(l),function(w){var I=n.node(w),on=I.order;(on<i||g<on)&&!(I.dummy&&n.node(l).dummy)&&Yn(t,w,l)})}),a=h+1,i=g)}),u}return F(r,e),t}function Qt(n,r){var t={};function e(u,i,a,c,d){var s;f(E(i,a),function(h){s=u[h],n.node(s).dummy&&f(n.predecessors(s),function(v){var g=n.node(v);g.dummy&&(g.order<c||g.order>d)&&Yn(t,v,s)})})}function o(u,i){var a=-1,c,d=0;return f(i,function(s,h){if(n.node(s).dummy==="border"){var v=n.predecessors(s);v.length&&(c=n.node(v[0]).order,e(i,d,h,a,c),d=h,a=c)}e(i,d,i.length,c,u.length)}),i}return F(r,o),t}function Ut(n,r){if(n.node(r).dummy)return U(n.predecessors(r),function(t){return n.node(t).dummy})}function Yn(n,r,t){if(r>t){var e=r;r=t,t=e}Object.prototype.hasOwnProperty.call(n,r)||Object.defineProperty(n,r,{enumerable:!0,configurable:!0,value:{},writable:!0});var o=n[r];Object.defineProperty(o,t,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Wt(n,r,t){if(r>t){var e=r;r=t,t=e}return!!n[r]&&Object.prototype.hasOwnProperty.call(n[r],t)}function Zt(n,r,t,e){var o={},u={},i={};return f(r,function(a){f(a,function(c,d){o[c]=c,u[c]=c,i[c]=d})}),f(r,function(a){var c=-1;f(a,function(d){var s=e(d);if(s.length){s=M(s,function(w){return i[w]});for(var h=(s.length-1)/2,v=Math.floor(h),g=Math.ceil(h);v<=g;++v){var l=s[v];u[d]===d&&c<i[l]&&!Wt(t,d,l)&&(u[l]=d,u[d]=o[d]=o[l],c=i[l])}}})}),{root:o,align:u}}function ne(n,r,t,e,o){var u={},i=re(n,r,t,o),a=o?"borderLeft":"borderRight";function c(h,v){for(var g=i.nodes(),l=g.pop(),w={};l;)w[l]?h(l):(w[l]=!0,g.push(l),g=g.concat(v(l))),l=g.pop()}function d(h){u[h]=i.inEdges(h).reduce(function(v,g){return Math.max(v,u[g.v]+i.edge(g))},0)}function s(h){var v=i.outEdges(h).reduce(function(l,w){return Math.min(l,u[w.w]-i.edge(w))},Number.POSITIVE_INFINITY),g=n.node(h);v!==Number.POSITIVE_INFINITY&&g.borderType!==a&&(u[h]=Math.max(u[h],v))}return c(d,i.predecessors.bind(i)),c(s,i.successors.bind(i)),f(e,function(h){u[h]=u[t[h]]}),u}function re(n,r,t,e){var o=new m,u=n.graph(),i=ue(u.nodesep,u.edgesep,e);return f(r,function(a){var c;f(a,function(d){var s=t[d];if(o.setNode(s),c){var h=t[c],v=o.edge(h,s);o.setEdge(h,s,Math.max(i(n,d,c),v||0))}c=d})}),o}function te(n,r){return Z(k(r),function(t){var e=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return Ir(t,function(u,i){var a=ae(n,i)/2;e=Math.max(u+a,e),o=Math.min(u-a,o)}),e-o})}function ee(n,r){var t=k(r),e=P(t),o=y(t);f(["u","d"],function(u){f(["l","r"],function(i){var a=u+i,c=n[a],d;if(c!==r){var s=k(c);d=i==="l"?e-P(s):o-y(s),d&&(n[a]=V(c,function(h){return h+d}))}})})}function oe(n,r){return V(n.ul,function(t,e){if(r)return n[r.toLowerCase()][e];var o=M(p(n,e));return(o[1]+o[2])/2})}function ie(n){var r=q(n),t=X(Jt(n,r),Qt(n,r)),e={},o;f(["u","d"],function(i){o=i==="u"?r:k(r).reverse(),f(["l","r"],function(a){a==="r"&&(o=p(o,function(h){return k(h).reverse()}));var c=(i==="u"?n.predecessors:n.successors).bind(n),d=Zt(n,o,t,c),s=ne(n,o,d.root,d.align,a==="r");a==="r"&&(s=V(s,function(h){return-h})),e[i+a]=s})});var u=te(n,e);return ee(e,u),oe(e,n.graph().align)}function ue(n,r,t){return function(e,o,u){var i=e.node(o),a=e.node(u),c=0,d;if(c+=i.width/2,Object.prototype.hasOwnProperty.call(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":d=-i.width/2;break;case"r":d=i.width/2;break}if(d&&(c+=t?d:-d),d=0,c+=(i.dummy?r:n)/2,c+=(a.dummy?r:n)/2,c+=a.width/2,Object.prototype.hasOwnProperty.call(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":d=a.width/2;break;case"r":d=-a.width/2;break}return d&&(c+=t?d:-d),d=0,c}}function ae(n,r){return n.node(r).width}function ce(n){n=Mn(n),de(n),Pr(ie(n),function(r,t){n.node(t).x=r})}function de(n){var r=q(n),t=n.graph().ranksep,e=0;f(r,function(o){var u=y(p(o,function(i){return n.node(i).height}));f(o,function(i){n.node(i).y=e+u/2}),e+=u+t})}function $e(n,r){var t=ut;t("layout",()=>{var e=t(" buildLayoutGraph",()=>ye(n));t(" runLayout",()=>fe(e,t)),t(" updateInputGraph",()=>se(n,e))})}function fe(n,r){r(" makeSpaceForEdgeLabels",()=>xe(n)),r(" removeSelfEdges",()=>Re(n)),r(" acyclic",()=>Zr(n)),r(" nestingGraph.run",()=>_t(n)),r(" rank",()=>Et(Mn(n))),r(" injectEdgeLabelProxies",()=>ke(n)),r(" removeEmptyRanks",()=>ot(n)),r(" nestingGraph.cleanup",()=>jt(n)),r(" normalizeRanks",()=>et(n)),r(" assignRankMinMax",()=>Ee(n)),r(" removeEdgeLabelProxies",()=>Oe(n)),r(" normalize.run",()=>ht(n)),r(" parentDummyChains",()=>Kt(n)),r(" addBorderSegments",()=>at(n)),r(" order",()=>Yt(n)),r(" insertSelfEdges",()=>Me(n)),r(" adjustCoordinateSystem",()=>ct(n)),r(" position",()=>ce(n)),r(" positionSelfEdges",()=>Te(n)),r(" removeBorderNodes",()=>je(n)),r(" normalize.undo",()=>gt(n)),r(" fixupEdgeLabelCoords",()=>Ie(n)),r(" undoCoordinateSystem",()=>dt(n)),r(" translateGraph",()=>Ne(n)),r(" assignNodeIntersects",()=>_e(n)),r(" reversePoints",()=>Pe(n)),r(" acyclic.undo",()=>rt(n))}function se(n,r){f(n.nodes(),function(t){var e=n.node(t),o=r.node(t);e&&(e.x=o.x,e.y=o.y,r.children(t).length&&(e.width=o.width,e.height=o.height))}),f(n.edges(),function(t){var e=n.edge(t),o=r.edge(t);e.points=o.points,Object.prototype.hasOwnProperty.call(o,"x")&&(e.x=o.x,e.y=o.y)}),n.graph().width=r.graph().width,n.graph().height=r.graph().height}var he=["nodesep","edgesep","ranksep","marginx","marginy"],ve={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ge=["acyclicer","ranker","rankdir","align"],le=["width","height"],pe={width:0,height:0},we=["minlen","weight","width","height","labeloffset"],be={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},me=["labelpos"];function ye(n){var r=new m({multigraph:!0,compound:!0}),t=K(n.graph());return r.setGraph(X({},ve,D(t,he),B(t,ge))),f(n.nodes(),function(e){var o=K(n.node(e));r.setNode(e,Er(D(o,le),pe)),r.setParent(e,n.parent(e))}),f(n.edges(),function(e){var o=K(n.edge(e));r.setEdge(e,X({},be,D(o,we),B(o,me)))}),r}function xe(n){var r=n.graph();r.ranksep/=2,f(n.edges(),function(t){var e=n.edge(t);e.minlen*=2,e.labelpos.toLowerCase()!=="c"&&(r.rankdir==="TB"||r.rankdir==="BT"?e.width+=e.labeloffset:e.height+=e.labeloffset)})}function ke(n){f(n.edges(),function(r){var t=n.edge(r);if(t.width&&t.height){var e=n.node(r.v),o=n.node(r.w),u={rank:(o.rank-e.rank)/2+e.rank,e:r};_(n,"edge-proxy",u,"_ep")}})}function Ee(n){var r=0;f(n.nodes(),function(t){var e=n.node(t);e.borderTop&&(e.minRank=n.node(e.borderTop).rank,e.maxRank=n.node(e.borderBottom).rank,r=y(r,e.maxRank))}),n.graph().maxRank=r}function Oe(n){f(n.nodes(),function(r){var t=n.node(r);t.dummy==="edge-proxy"&&(n.edge(t.e).labelRank=t.rank,n.removeNode(r))})}function Ne(n){var r=Number.POSITIVE_INFINITY,t=0,e=Number.POSITIVE_INFINITY,o=0,u=n.graph(),i=u.marginx||0,a=u.marginy||0;function c(d){var s=d.x,h=d.y,v=d.width,g=d.height;r=Math.min(r,s-v/2),t=Math.max(t,s+v/2),e=Math.min(e,h-g/2),o=Math.max(o,h+g/2)}f(n.nodes(),function(d){c(n.node(d))}),f(n.edges(),function(d){var s=n.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&c(s)}),r-=i,e-=a,f(n.nodes(),function(d){var s=n.node(d);s.x-=r,s.y-=e}),f(n.edges(),function(d){var s=n.edge(d);f(s.points,function(h){h.x-=r,h.y-=e}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=r),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=e)}),u.width=t-r+i,u.height=o-e+a}function _e(n){f(n.edges(),function(r){var t=n.edge(r),e=n.node(r.v),o=n.node(r.w),u,i;t.points?(u=t.points[0],i=t.points[t.points.length-1]):(t.points=[],u=o,i=e),t.points.unshift(dn(e,u)),t.points.push(dn(o,i))})}function Ie(n){f(n.edges(),function(r){var t=n.edge(r);if(Object.prototype.hasOwnProperty.call(t,"x"))switch((t.labelpos==="l"||t.labelpos==="r")&&(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset;break}})}function Pe(n){f(n.edges(),function(r){var t=n.edge(r);t.reversed&&t.points.reverse()})}function je(n){f(n.nodes(),function(r){if(n.children(r).length){var t=n.node(r),e=n.node(t.borderTop),o=n.node(t.borderBottom),u=n.node(G(t.borderLeft)),i=n.node(G(t.borderRight));t.width=Math.abs(i.x-u.x),t.height=Math.abs(o.y-e.y),t.x=u.x+t.width/2,t.y=e.y+t.height/2}}),f(n.nodes(),function(r){n.node(r).dummy==="border"&&n.removeNode(r)})}function Re(n){f(n.edges(),function(r){if(r.v===r.w){var t=n.node(r.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:r,label:n.edge(r)}),n.removeEdge(r)}})}function Me(n){var r=q(n);f(r,function(t){var e=0;f(t,function(o,u){var i=n.node(o);i.order=u+e,f(i.selfEdges,function(a){_(n,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:u+ ++e,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Te(n){f(n.nodes(),function(r){var t=n.node(r);if(t.dummy==="selfedge"){var e=n.node(t.e.v),o=e.x+e.width/2,u=e.y,i=t.x-o,a=e.height/2;n.setEdge(t.e,t.label),n.removeNode(r),t.label.points=[{x:o+2*i/3,y:u-a},{x:o+5*i/6,y:u-a},{x:o+i,y:u},{x:o+5*i/6,y:u+a},{x:o+2*i/3,y:u+a}],t.label.x=t.x,t.label.y=t.y}})}function D(n,r){return V(B(n,r),Number)}function K(n){var r={};return f(n,function(t,e){r[e.toLowerCase()]=t}),r}export{$e as A,E as a,nn as e,B as j,Er as k,p as w};
|
|
1
|
+
import{a as T,B as O,E as Dn,k as Kn,b as bn,X as L,m as f,K as m,C as mn,c as k,P as b,$ as yn,d as xn,M as F,O as Xn,R,U as Hn,I as kn,G as Jn,e as Qn,T as Un,f as Wn}from"./graph-BV6jB5rk-CdEYXCfk.js";import{aq as En,ar as Zn,as as nr,at as J,au as On,av as $,aw as Nn,ax as rr,ay as S,az as X,aA as Q,aB as tr,aC as er,aD as or,aE as _n,aF as ir,aG as ur}from"./index--DBVktm0.js";var ar=/\s/;function cr(n){for(var r=n.length;r--&&ar.test(n.charAt(r)););return r}var dr=/^\s+/;function fr(n){return n&&n.slice(0,cr(n)+1).replace(dr,"")}var un=NaN,sr=/^[-+]0x[0-9a-f]+$/i,hr=/^0b[01]+$/i,vr=/^0o[0-7]+$/i,gr=parseInt;function lr(n){if(typeof n=="number")return n;if(L(n))return un;if(S(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=S(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=fr(n);var t=hr.test(n);return t||vr.test(n)?gr(n.slice(2),t?2:8):sr.test(n)?un:+n}var an=1/0,pr=17976931348623157e292;function C(n){if(!n)return n===0?n:0;if(n=lr(n),n===an||n===-an){var r=n<0?-1:1;return r*pr}return n===n?n:0}function wr(n){var r=C(n),t=r%1;return r===r?t?r-t:r:0}function N(n){var r=n==null?0:n.length;return r?bn(n):[]}function br(n){return Zn(nr(n,void 0,N),n+"")}var mr=1,yr=4;function xr(n){return Hn(n,mr|yr)}var In=Object.prototype,kr=In.hasOwnProperty,Er=En(function(n,r){n=Object(n);var t=-1,e=r.length,o=e>2?r[2]:void 0;for(o&&$(r[0],r[1],o)&&(e=1);++t<e;)for(var u=r[t],i=Nn(u),a=-1,c=i.length;++a<c;){var d=i[a],s=n[d];(s===void 0||rr(s,In[d])&&!kr.call(n,d))&&(n[d]=u[d])}return n});function G(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}function Or(n){return function(r,t,e){var o=Object(r);if(!On(r)){var u=O(t);r=Qn(r),t=function(a){return u(o[a],a,o)}}var i=n(r,t,e);return i>-1?o[u?r[i]:i]:void 0}}var Nr=Math.max;function _r(n,r,t){var e=n==null?0:n.length;if(!e)return-1;var o=t==null?0:wr(t);return o<0&&(o=Nr(e+o,0)),Wn(n,O(r),o)}var U=Or(_r);function Pn(n,r){var t=-1,e=On(n)?Array(n.length):[];return Kn(n,function(o,u,i){e[++t]=r(o,u,i)}),e}function p(n,r){var t=J(n)?T:Pn;return t(n,O(r))}function Ir(n,r){return n==null?n:ur(n,kn(r),Nn)}function Pr(n,r){return n&&yn(n,kn(r))}function jr(n,r){return n>r}var Rr=Object.prototype,Mr=Rr.hasOwnProperty;function Tr(n,r){return n!=null&&Mr.call(n,r)}function jn(n,r){return n!=null&&Xn(n,r,Tr)}function Rn(n,r){return n<r}function V(n,r){var t={};return r=O(r),yn(n,function(e,o,u){er(t,o,r(e,o,u))}),t}function W(n,r,t){for(var e=-1,o=n.length;++e<o;){var u=n[e],i=r(u);if(i!=null&&(a===void 0?i===i&&!L(i):t(i,a)))var a=i,c=u}return c}function y(n){return n&&n.length?W(n,Q,jr):void 0}function P(n){return n&&n.length?W(n,Q,Rn):void 0}function Z(n,r){return n&&n.length?W(n,O(r),Rn):void 0}function Cr(n,r,t,e){if(!S(n))return n;r=xn(r,n);for(var o=-1,u=r.length,i=u-1,a=n;a!=null&&++o<u;){var c=Jn(r[o]),d=t;if(c==="__proto__"||c==="constructor"||c==="prototype")return n;if(o!=i){var s=a[c];d=void 0,d===void 0&&(d=S(s)?s:or(r[o+1])?[]:{})}_n(a,c,d),a=a[c]}return n}function Lr(n,r,t){for(var e=-1,o=r.length,u={};++e<o;){var i=r[e],a=mn(n,i);t(a,i)&&Cr(u,xn(i,n),a)}return u}function $r(n,r){var t=n.length;for(n.sort(r);t--;)n[t]=n[t].value;return n}function Sr(n,r){if(n!==r){var t=n!==void 0,e=n===null,o=n===n,u=L(n),i=r!==void 0,a=r===null,c=r===r,d=L(r);if(!a&&!d&&!u&&n>r||u&&i&&c&&!a&&!d||e&&i&&c||!t&&c||!o)return 1;if(!e&&!u&&!d&&n<r||d&&t&&o&&!e&&!u||a&&t&&o||!i&&o||!c)return-1}return 0}function Gr(n,r,t){for(var e=-1,o=n.criteria,u=r.criteria,i=o.length,a=t.length;++e<i;){var c=Sr(o[e],u[e]);if(c){if(e>=a)return c;var d=t[e];return c*(d=="desc"?-1:1)}}return n.index-r.index}function Br(n,r,t){r.length?r=T(r,function(u){return J(u)?function(i){return mn(i,u.length===1?u[0]:u)}:u}):r=[Q];var e=-1;r=T(r,tr(O));var o=Pn(n,function(u,i,a){var c=T(r,function(d){return d(u)});return{criteria:c,index:++e,value:u}});return $r(o,function(u,i){return Gr(u,i,t)})}function Fr(n,r){return Lr(n,r,function(t,e){return Un(n,e)})}var B=br(function(n,r){return n==null?{}:Fr(n,r)}),Vr=Math.ceil,qr=Math.max;function zr(n,r,t,e){for(var o=-1,u=qr(Vr((r-n)/(t||1)),0),i=Array(u);u--;)i[++o]=n,n+=t;return i}function Ar(n){return function(r,t,e){return e&&typeof e!="number"&&$(r,t,e)&&(t=e=void 0),r=C(r),t===void 0?(t=r,r=0):t=C(t),e=e===void 0?r<t?1:-1:C(e),zr(r,t,e)}}var E=Ar(),M=En(function(n,r){if(n==null)return[];var t=r.length;return t>1&&$(n,r[0],r[1])?r=[]:t>2&&$(r[0],r[1],r[2])&&(r=[r[0]]),Br(n,bn(r),[])}),Yr=0;function nn(n){var r=++Yr;return Dn(n)+r}function Dr(n,r,t){for(var e=-1,o=n.length,u=r.length,i={};++e<o;){var a=e<u?r[e]:void 0;t(i,n[e],a)}return i}function Kr(n,r){return Dr(n||[],r||[],_n)}class Xr{constructor(){var r={};r._next=r._prev=r,this._sentinel=r}dequeue(){var r=this._sentinel,t=r._prev;if(t!==r)return cn(t),t}enqueue(r){var t=this._sentinel;r._prev&&r._next&&cn(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t}toString(){for(var r=[],t=this._sentinel,e=t._prev;e!==t;)r.push(JSON.stringify(e,Hr)),e=e._prev;return"["+r.join(", ")+"]"}}function cn(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function Hr(n,r){if(n!=="_next"&&n!=="_prev")return r}var Jr=ir(1);function Qr(n,r){if(n.nodeCount()<=1)return[];var t=Wr(n,r||Jr),e=Ur(t.graph,t.buckets,t.zeroIdx);return N(p(e,function(o){return n.outEdges(o.v,o.w)}))}function Ur(n,r,t){for(var e=[],o=r[r.length-1],u=r[0],i;n.nodeCount();){for(;i=u.dequeue();)z(n,r,t,i);for(;i=o.dequeue();)z(n,r,t,i);if(n.nodeCount()){for(var a=r.length-2;a>0;--a)if(i=r[a].dequeue(),i){e=e.concat(z(n,r,t,i,!0));break}}}return e}function z(n,r,t,e,o){var u=o?[]:void 0;return f(n.inEdges(e.v),function(i){var a=n.edge(i),c=n.node(i.v);o&&u.push({v:i.v,w:i.w}),c.out-=a,H(r,t,c)}),f(n.outEdges(e.v),function(i){var a=n.edge(i),c=i.w,d=n.node(c);d.in-=a,H(r,t,d)}),n.removeNode(e.v),u}function Wr(n,r){var t=new m,e=0,o=0;f(n.nodes(),function(a){t.setNode(a,{v:a,in:0,out:0})}),f(n.edges(),function(a){var c=t.edge(a.v,a.w)||0,d=r(a),s=c+d;t.setEdge(a.v,a.w,s),o=Math.max(o,t.node(a.v).out+=d),e=Math.max(e,t.node(a.w).in+=d)});var u=E(o+e+3).map(function(){return new Xr}),i=e+1;return f(t.nodes(),function(a){H(u,i,t.node(a))}),{graph:t,buckets:u,zeroIdx:i}}function H(n,r,t){t.out?t.in?n[t.out-t.in+r].enqueue(t):n[n.length-1].enqueue(t):n[0].enqueue(t)}function Zr(n){var r=n.graph().acyclicer==="greedy"?Qr(n,t(n)):nt(n);f(r,function(e){var o=n.edge(e);n.removeEdge(e),o.forwardName=e.name,o.reversed=!0,n.setEdge(e.w,e.v,o,nn("rev"))});function t(e){return function(o){return e.edge(o).weight}}}function nt(n){var r=[],t={},e={};function o(u){Object.prototype.hasOwnProperty.call(e,u)||(e[u]=!0,t[u]=!0,f(n.outEdges(u),function(i){Object.prototype.hasOwnProperty.call(t,i.w)?r.push(i):o(i.w)}),delete t[u])}return f(n.nodes(),o),r}function rt(n){f(n.edges(),function(r){var t=n.edge(r);if(t.reversed){n.removeEdge(r);var e=t.forwardName;delete t.reversed,delete t.forwardName,n.setEdge(r.w,r.v,t,e)}})}function _(n,r,t,e){var o;do o=nn(e);while(n.hasNode(o));return t.dummy=r,n.setNode(o,t),o}function tt(n){var r=new m().setGraph(n.graph());return f(n.nodes(),function(t){r.setNode(t,n.node(t))}),f(n.edges(),function(t){var e=r.edge(t.v,t.w)||{weight:0,minlen:1},o=n.edge(t);r.setEdge(t.v,t.w,{weight:e.weight+o.weight,minlen:Math.max(e.minlen,o.minlen)})}),r}function Mn(n){var r=new m({multigraph:n.isMultigraph()}).setGraph(n.graph());return f(n.nodes(),function(t){n.children(t).length||r.setNode(t,n.node(t))}),f(n.edges(),function(t){r.setEdge(t,n.edge(t))}),r}function dn(n,r){var t=n.x,e=n.y,o=r.x-t,u=r.y-e,i=n.width/2,a=n.height/2;if(!o&&!u)throw new Error("Not possible to find intersection inside of the rectangle");var c,d;return Math.abs(u)*i>Math.abs(o)*a?(u<0&&(a=-a),c=a*o/u,d=a):(o<0&&(i=-i),c=i,d=i*u/o),{x:t+c,y:e+d}}function q(n){var r=p(E(Tn(n)+1),function(){return[]});return f(n.nodes(),function(t){var e=n.node(t),o=e.rank;b(o)||(r[o][e.order]=t)}),r}function et(n){var r=P(p(n.nodes(),function(t){return n.node(t).rank}));f(n.nodes(),function(t){var e=n.node(t);jn(e,"rank")&&(e.rank-=r)})}function ot(n){var r=P(p(n.nodes(),function(u){return n.node(u).rank})),t=[];f(n.nodes(),function(u){var i=n.node(u).rank-r;t[i]||(t[i]=[]),t[i].push(u)});var e=0,o=n.graph().nodeRankFactor;f(t,function(u,i){b(u)&&i%o!==0?--e:e&&f(u,function(a){n.node(a).rank+=e})})}function fn(n,r,t,e){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=e),_(n,"border",o,r)}function Tn(n){return y(p(n.nodes(),function(r){var t=n.node(r).rank;if(!b(t))return t}))}function it(n,r){var t={lhs:[],rhs:[]};return f(n,function(e){r(e)?t.lhs.push(e):t.rhs.push(e)}),t}function ut(n,r){return r()}function at(n){function r(t){var e=n.children(t),o=n.node(t);if(e.length&&f(e,r),Object.prototype.hasOwnProperty.call(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var u=o.minRank,i=o.maxRank+1;u<i;++u)sn(n,"borderLeft","_bl",t,o,u),sn(n,"borderRight","_br",t,o,u)}}f(n.children(),r)}function sn(n,r,t,e,o,u){var i={width:0,height:0,rank:u,borderType:r},a=o[r][u-1],c=_(n,"border",i,t);o[r][u]=c,n.setParent(c,e),a&&n.setEdge(a,c,{weight:1})}function ct(n){var r=n.graph().rankdir.toLowerCase();(r==="lr"||r==="rl")&&Cn(n)}function dt(n){var r=n.graph().rankdir.toLowerCase();(r==="bt"||r==="rl")&&ft(n),(r==="lr"||r==="rl")&&(st(n),Cn(n))}function Cn(n){f(n.nodes(),function(r){hn(n.node(r))}),f(n.edges(),function(r){hn(n.edge(r))})}function hn(n){var r=n.width;n.width=n.height,n.height=r}function ft(n){f(n.nodes(),function(r){A(n.node(r))}),f(n.edges(),function(r){var t=n.edge(r);f(t.points,A),Object.prototype.hasOwnProperty.call(t,"y")&&A(t)})}function A(n){n.y=-n.y}function st(n){f(n.nodes(),function(r){Y(n.node(r))}),f(n.edges(),function(r){var t=n.edge(r);f(t.points,Y),Object.prototype.hasOwnProperty.call(t,"x")&&Y(t)})}function Y(n){var r=n.x;n.x=n.y,n.y=r}function ht(n){n.graph().dummyChains=[],f(n.edges(),function(r){vt(n,r)})}function vt(n,r){var t=r.v,e=n.node(t).rank,o=r.w,u=n.node(o).rank,i=r.name,a=n.edge(r),c=a.labelRank;if(u!==e+1){n.removeEdge(r);var d=void 0,s,h;for(h=0,++e;e<u;++h,++e)a.points=[],d={width:0,height:0,edgeLabel:a,edgeObj:r,rank:e},s=_(n,"edge",d,"_d"),e===c&&(d.width=a.width,d.height=a.height,d.dummy="edge-label",d.labelpos=a.labelpos),n.setEdge(t,s,{weight:a.weight},i),h===0&&n.graph().dummyChains.push(s),t=s;n.setEdge(t,o,{weight:a.weight},i)}}function gt(n){f(n.graph().dummyChains,function(r){var t=n.node(r),e=t.edgeLabel,o;for(n.setEdge(t.edgeObj,e);t.dummy;)o=n.successors(r)[0],n.removeNode(r),e.points.push({x:t.x,y:t.y}),t.dummy==="edge-label"&&(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height),r=o,t=n.node(r)})}function rn(n){var r={};function t(e){var o=n.node(e);if(Object.prototype.hasOwnProperty.call(r,e))return o.rank;r[e]=!0;var u=P(p(n.outEdges(e),function(i){return t(i.w)-n.edge(i).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),o.rank=u}f(n.sources(),t)}function j(n,r){return n.node(r.w).rank-n.node(r.v).rank-n.edge(r).minlen}function Ln(n){var r=new m({directed:!1}),t=n.nodes()[0],e=n.nodeCount();r.setNode(t,{});for(var o,u;lt(r,n)<e;)o=pt(r,n),u=r.hasNode(o.v)?j(n,o):-j(n,o),wt(r,n,u);return r}function lt(n,r){function t(e){f(r.nodeEdges(e),function(o){var u=o.v,i=e===u?o.w:u;!n.hasNode(i)&&!j(r,o)&&(n.setNode(i,{}),n.setEdge(e,i,{}),t(i))})}return f(n.nodes(),t),n.nodeCount()}function pt(n,r){return Z(r.edges(),function(t){if(n.hasNode(t.v)!==n.hasNode(t.w))return j(r,t)})}function wt(n,r,t){f(n.nodes(),function(e){r.node(e).rank+=t})}function $n(n,r,t){J(r)||(r=[r]);var e=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],u={};return f(r,function(i){if(!n.hasNode(i))throw new Error("Graph does not have node: "+i);Sn(n,i,t==="post",u,e,o)}),o}function Sn(n,r,t,e,o,u){Object.prototype.hasOwnProperty.call(e,r)||(e[r]=!0,t||u.push(r),f(o(r),function(i){Sn(n,i,t,e,o,u)}),t&&u.push(r))}function bt(n,r){return $n(n,r,"post")}function mt(n,r){return $n(n,r,"pre")}x.initLowLimValues=en;x.initCutValues=tn;x.calcCutValue=Gn;x.leaveEdge=Fn;x.enterEdge=Vn;x.exchangeEdges=qn;function x(n){n=tt(n),rn(n);var r=Ln(n);en(r),tn(r,n);for(var t,e;t=Fn(r);)e=Vn(r,n,t),qn(r,n,t,e)}function tn(n,r){var t=bt(n,n.nodes());t=t.slice(0,t.length-1),f(t,function(e){yt(n,r,e)})}function yt(n,r,t){var e=n.node(t),o=e.parent;n.edge(t,o).cutvalue=Gn(n,r,t)}function Gn(n,r,t){var e=n.node(t),o=e.parent,u=!0,i=r.edge(t,o),a=0;return i||(u=!1,i=r.edge(o,t)),a=i.weight,f(r.nodeEdges(t),function(c){var d=c.v===t,s=d?c.w:c.v;if(s!==o){var h=d===u,v=r.edge(c).weight;if(a+=h?v:-v,kt(n,t,s)){var g=n.edge(t,s).cutvalue;a+=h?-g:g}}}),a}function en(n,r){arguments.length<2&&(r=n.nodes()[0]),Bn(n,{},1,r)}function Bn(n,r,t,e,o){var u=t,i=n.node(e);return r[e]=!0,f(n.neighbors(e),function(a){Object.prototype.hasOwnProperty.call(r,a)||(t=Bn(n,r,t,a,e))}),i.low=u,i.lim=t++,o?i.parent=o:delete i.parent,t}function Fn(n){return U(n.edges(),function(r){return n.edge(r).cutvalue<0})}function Vn(n,r,t){var e=t.v,o=t.w;r.hasEdge(e,o)||(e=t.w,o=t.v);var u=n.node(e),i=n.node(o),a=u,c=!1;u.lim>i.lim&&(a=i,c=!0);var d=R(r.edges(),function(s){return c===vn(n,n.node(s.v),a)&&c!==vn(n,n.node(s.w),a)});return Z(d,function(s){return j(r,s)})}function qn(n,r,t,e){var o=t.v,u=t.w;n.removeEdge(o,u),n.setEdge(e.v,e.w,{}),en(n),tn(n,r),xt(n,r)}function xt(n,r){var t=U(n.nodes(),function(o){return!r.node(o).parent}),e=mt(n,t);e=e.slice(1),f(e,function(o){var u=n.node(o).parent,i=r.edge(o,u),a=!1;i||(i=r.edge(u,o),a=!0),r.node(o).rank=r.node(u).rank+(a?i.minlen:-i.minlen)})}function kt(n,r,t){return n.hasEdge(r,t)}function vn(n,r,t){return t.low<=r.lim&&r.lim<=t.lim}function Et(n){switch(n.graph().ranker){case"network-simplex":gn(n);break;case"tight-tree":Nt(n);break;case"longest-path":Ot(n);break;default:gn(n)}}var Ot=rn;function Nt(n){rn(n),Ln(n)}function gn(n){x(n)}function _t(n){var r=_(n,"root",{},"_root"),t=It(n),e=y(k(t))-1,o=2*e+1;n.graph().nestingRoot=r,f(n.edges(),function(i){n.edge(i).minlen*=o});var u=Pt(n)+1;f(n.children(),function(i){zn(n,r,o,u,e,t,i)}),n.graph().nodeRankFactor=o}function zn(n,r,t,e,o,u,i){var a=n.children(i);if(!a.length){i!==r&&n.setEdge(r,i,{weight:0,minlen:t});return}var c=fn(n,"_bt"),d=fn(n,"_bb"),s=n.node(i);n.setParent(c,i),s.borderTop=c,n.setParent(d,i),s.borderBottom=d,f(a,function(h){zn(n,r,t,e,o,u,h);var v=n.node(h),g=v.borderTop?v.borderTop:h,l=v.borderBottom?v.borderBottom:h,w=v.borderTop?e:2*e,I=g!==l?1:o-u[i]+1;n.setEdge(c,g,{weight:w,minlen:I,nestingEdge:!0}),n.setEdge(l,d,{weight:w,minlen:I,nestingEdge:!0})}),n.parent(i)||n.setEdge(r,c,{weight:0,minlen:o+u[i]})}function It(n){var r={};function t(e,o){var u=n.children(e);u&&u.length&&f(u,function(i){t(i,o+1)}),r[e]=o}return f(n.children(),function(e){t(e,1)}),r}function Pt(n){return F(n.edges(),function(r,t){return r+n.edge(t).weight},0)}function jt(n){var r=n.graph();n.removeNode(r.nestingRoot),delete r.nestingRoot,f(n.edges(),function(t){var e=n.edge(t);e.nestingEdge&&n.removeEdge(t)})}function Rt(n,r,t){var e={},o;f(t,function(u){for(var i=n.parent(u),a,c;i;){if(a=n.parent(i),a?(c=e[a],e[a]=i):(c=o,o=i),c&&c!==i){r.setEdge(c,i);return}i=a}})}function Mt(n,r,t){var e=Tt(n),o=new m({compound:!0}).setGraph({root:e}).setDefaultNodeLabel(function(u){return n.node(u)});return f(n.nodes(),function(u){var i=n.node(u),a=n.parent(u);(i.rank===r||i.minRank<=r&&r<=i.maxRank)&&(o.setNode(u),o.setParent(u,a||e),f(n[t](u),function(c){var d=c.v===u?c.w:c.v,s=o.edge(d,u),h=b(s)?0:s.weight;o.setEdge(d,u,{weight:n.edge(c).weight+h})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&o.setNode(u,{borderLeft:i.borderLeft[r],borderRight:i.borderRight[r]}))}),o}function Tt(n){for(var r;n.hasNode(r=nn("_root")););return r}function Ct(n,r){for(var t=0,e=1;e<r.length;++e)t+=Lt(n,r[e-1],r[e]);return t}function Lt(n,r,t){for(var e=Kr(t,p(t,function(d,s){return s})),o=N(p(r,function(d){return M(p(n.outEdges(d),function(s){return{pos:e[s.w],weight:n.edge(s).weight}}),"pos")})),u=1;u<t.length;)u<<=1;var i=2*u-1;u-=1;var a=p(new Array(i),function(){return 0}),c=0;return f(o.forEach(function(d){var s=d.pos+u;a[s]+=d.weight;for(var h=0;s>0;)s%2&&(h+=a[s+1]),s=s-1>>1,a[s]+=d.weight;c+=d.weight*h})),c}function $t(n){var r={},t=R(n.nodes(),function(a){return!n.children(a).length}),e=y(p(t,function(a){return n.node(a).rank})),o=p(E(e+1),function(){return[]});function u(a){if(!jn(r,a)){r[a]=!0;var c=n.node(a);o[c.rank].push(a),f(n.successors(a),u)}}var i=M(t,function(a){return n.node(a).rank});return f(i,u),o}function St(n,r){return p(r,function(t){var e=n.inEdges(t);if(e.length){var o=F(e,function(u,i){var a=n.edge(i),c=n.node(i.v);return{sum:u.sum+a.weight*c.order,weight:u.weight+a.weight}},{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:t}})}function Gt(n,r){var t={};f(n,function(o,u){var i=t[o.v]={indegree:0,in:[],out:[],vs:[o.v],i:u};b(o.barycenter)||(i.barycenter=o.barycenter,i.weight=o.weight)}),f(r.edges(),function(o){var u=t[o.v],i=t[o.w];!b(u)&&!b(i)&&(i.indegree++,u.out.push(t[o.w]))});var e=R(t,function(o){return!o.indegree});return Bt(e)}function Bt(n){var r=[];function t(u){return function(i){i.merged||(b(i.barycenter)||b(u.barycenter)||i.barycenter>=u.barycenter)&&Ft(u,i)}}function e(u){return function(i){i.in.push(u),--i.indegree===0&&n.push(i)}}for(;n.length;){var o=n.pop();r.push(o),f(o.in.reverse(),t(o)),f(o.out,e(o))}return p(R(r,function(u){return!u.merged}),function(u){return B(u,["vs","i","barycenter","weight"])})}function Ft(n,r){var t=0,e=0;n.weight&&(t+=n.barycenter*n.weight,e+=n.weight),r.weight&&(t+=r.barycenter*r.weight,e+=r.weight),n.vs=r.vs.concat(n.vs),n.barycenter=t/e,n.weight=e,n.i=Math.min(r.i,n.i),r.merged=!0}function Vt(n,r){var t=it(n,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),e=t.lhs,o=M(t.rhs,function(s){return-s.i}),u=[],i=0,a=0,c=0;e.sort(qt(!!r)),c=ln(u,o,c),f(e,function(s){c+=s.vs.length,u.push(s.vs),i+=s.barycenter*s.weight,a+=s.weight,c=ln(u,o,c)});var d={vs:N(u)};return a&&(d.barycenter=i/a,d.weight=a),d}function ln(n,r,t){for(var e;r.length&&(e=G(r)).i<=t;)r.pop(),n.push(e.vs),t++;return t}function qt(n){return function(r,t){return r.barycenter<t.barycenter?-1:r.barycenter>t.barycenter?1:n?t.i-r.i:r.i-t.i}}function An(n,r,t,e){var o=n.children(r),u=n.node(r),i=u?u.borderLeft:void 0,a=u?u.borderRight:void 0,c={};i&&(o=R(o,function(l){return l!==i&&l!==a}));var d=St(n,o);f(d,function(l){if(n.children(l.v).length){var w=An(n,l.v,t,e);c[l.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&At(l,w)}});var s=Gt(d,t);zt(s,c);var h=Vt(s,e);if(i&&(h.vs=N([i,h.vs,a]),n.predecessors(i).length)){var v=n.node(n.predecessors(i)[0]),g=n.node(n.predecessors(a)[0]);Object.prototype.hasOwnProperty.call(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+v.order+g.order)/(h.weight+2),h.weight+=2}return h}function zt(n,r){f(n,function(t){t.vs=N(t.vs.map(function(e){return r[e]?r[e].vs:e}))})}function At(n,r){b(n.barycenter)?(n.barycenter=r.barycenter,n.weight=r.weight):(n.barycenter=(n.barycenter*n.weight+r.barycenter*r.weight)/(n.weight+r.weight),n.weight+=r.weight)}function Yt(n){var r=Tn(n),t=pn(n,E(1,r+1),"inEdges"),e=pn(n,E(r-1,-1,-1),"outEdges"),o=$t(n);wn(n,o);for(var u=Number.POSITIVE_INFINITY,i,a=0,c=0;c<4;++a,++c){Dt(a%2?t:e,a%4>=2),o=q(n);var d=Ct(n,o);d<u&&(c=0,i=xr(o),u=d)}wn(n,i)}function pn(n,r,t){return p(r,function(e){return Mt(n,e,t)})}function Dt(n,r){var t=new m;f(n,function(e){var o=e.graph().root,u=An(e,o,t,r);f(u.vs,function(i,a){e.node(i).order=a}),Rt(e,t,u.vs)})}function wn(n,r){f(r,function(t){f(t,function(e,o){n.node(e).order=o})})}function Kt(n){var r=Ht(n);f(n.graph().dummyChains,function(t){for(var e=n.node(t),o=e.edgeObj,u=Xt(n,r,o.v,o.w),i=u.path,a=u.lca,c=0,d=i[c],s=!0;t!==o.w;){if(e=n.node(t),s){for(;(d=i[c])!==a&&n.node(d).maxRank<e.rank;)c++;d===a&&(s=!1)}if(!s){for(;c<i.length-1&&n.node(d=i[c+1]).minRank<=e.rank;)c++;d=i[c]}n.setParent(t,d),t=n.successors(t)[0]}})}function Xt(n,r,t,e){var o=[],u=[],i=Math.min(r[t].low,r[e].low),a=Math.max(r[t].lim,r[e].lim),c,d;c=t;do c=n.parent(c),o.push(c);while(c&&(r[c].low>i||a>r[c].lim));for(d=c,c=e;(c=n.parent(c))!==d;)u.push(c);return{path:o.concat(u.reverse()),lca:d}}function Ht(n){var r={},t=0;function e(o){var u=t;f(n.children(o),e),r[o]={low:u,lim:t++}}return f(n.children(),e),r}function Jt(n,r){var t={};function e(o,u){var i=0,a=0,c=o.length,d=G(u);return f(u,function(s,h){var v=Ut(n,s),g=v?n.node(v).order:c;(v||s===d)&&(f(u.slice(a,h+1),function(l){f(n.predecessors(l),function(w){var I=n.node(w),on=I.order;(on<i||g<on)&&!(I.dummy&&n.node(l).dummy)&&Yn(t,w,l)})}),a=h+1,i=g)}),u}return F(r,e),t}function Qt(n,r){var t={};function e(u,i,a,c,d){var s;f(E(i,a),function(h){s=u[h],n.node(s).dummy&&f(n.predecessors(s),function(v){var g=n.node(v);g.dummy&&(g.order<c||g.order>d)&&Yn(t,v,s)})})}function o(u,i){var a=-1,c,d=0;return f(i,function(s,h){if(n.node(s).dummy==="border"){var v=n.predecessors(s);v.length&&(c=n.node(v[0]).order,e(i,d,h,a,c),d=h,a=c)}e(i,d,i.length,c,u.length)}),i}return F(r,o),t}function Ut(n,r){if(n.node(r).dummy)return U(n.predecessors(r),function(t){return n.node(t).dummy})}function Yn(n,r,t){if(r>t){var e=r;r=t,t=e}Object.prototype.hasOwnProperty.call(n,r)||Object.defineProperty(n,r,{enumerable:!0,configurable:!0,value:{},writable:!0});var o=n[r];Object.defineProperty(o,t,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Wt(n,r,t){if(r>t){var e=r;r=t,t=e}return!!n[r]&&Object.prototype.hasOwnProperty.call(n[r],t)}function Zt(n,r,t,e){var o={},u={},i={};return f(r,function(a){f(a,function(c,d){o[c]=c,u[c]=c,i[c]=d})}),f(r,function(a){var c=-1;f(a,function(d){var s=e(d);if(s.length){s=M(s,function(w){return i[w]});for(var h=(s.length-1)/2,v=Math.floor(h),g=Math.ceil(h);v<=g;++v){var l=s[v];u[d]===d&&c<i[l]&&!Wt(t,d,l)&&(u[l]=d,u[d]=o[d]=o[l],c=i[l])}}})}),{root:o,align:u}}function ne(n,r,t,e,o){var u={},i=re(n,r,t,o),a=o?"borderLeft":"borderRight";function c(h,v){for(var g=i.nodes(),l=g.pop(),w={};l;)w[l]?h(l):(w[l]=!0,g.push(l),g=g.concat(v(l))),l=g.pop()}function d(h){u[h]=i.inEdges(h).reduce(function(v,g){return Math.max(v,u[g.v]+i.edge(g))},0)}function s(h){var v=i.outEdges(h).reduce(function(l,w){return Math.min(l,u[w.w]-i.edge(w))},Number.POSITIVE_INFINITY),g=n.node(h);v!==Number.POSITIVE_INFINITY&&g.borderType!==a&&(u[h]=Math.max(u[h],v))}return c(d,i.predecessors.bind(i)),c(s,i.successors.bind(i)),f(e,function(h){u[h]=u[t[h]]}),u}function re(n,r,t,e){var o=new m,u=n.graph(),i=ue(u.nodesep,u.edgesep,e);return f(r,function(a){var c;f(a,function(d){var s=t[d];if(o.setNode(s),c){var h=t[c],v=o.edge(h,s);o.setEdge(h,s,Math.max(i(n,d,c),v||0))}c=d})}),o}function te(n,r){return Z(k(r),function(t){var e=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return Ir(t,function(u,i){var a=ae(n,i)/2;e=Math.max(u+a,e),o=Math.min(u-a,o)}),e-o})}function ee(n,r){var t=k(r),e=P(t),o=y(t);f(["u","d"],function(u){f(["l","r"],function(i){var a=u+i,c=n[a],d;if(c!==r){var s=k(c);d=i==="l"?e-P(s):o-y(s),d&&(n[a]=V(c,function(h){return h+d}))}})})}function oe(n,r){return V(n.ul,function(t,e){if(r)return n[r.toLowerCase()][e];var o=M(p(n,e));return(o[1]+o[2])/2})}function ie(n){var r=q(n),t=X(Jt(n,r),Qt(n,r)),e={},o;f(["u","d"],function(i){o=i==="u"?r:k(r).reverse(),f(["l","r"],function(a){a==="r"&&(o=p(o,function(h){return k(h).reverse()}));var c=(i==="u"?n.predecessors:n.successors).bind(n),d=Zt(n,o,t,c),s=ne(n,o,d.root,d.align,a==="r");a==="r"&&(s=V(s,function(h){return-h})),e[i+a]=s})});var u=te(n,e);return ee(e,u),oe(e,n.graph().align)}function ue(n,r,t){return function(e,o,u){var i=e.node(o),a=e.node(u),c=0,d;if(c+=i.width/2,Object.prototype.hasOwnProperty.call(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":d=-i.width/2;break;case"r":d=i.width/2;break}if(d&&(c+=t?d:-d),d=0,c+=(i.dummy?r:n)/2,c+=(a.dummy?r:n)/2,c+=a.width/2,Object.prototype.hasOwnProperty.call(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":d=a.width/2;break;case"r":d=-a.width/2;break}return d&&(c+=t?d:-d),d=0,c}}function ae(n,r){return n.node(r).width}function ce(n){n=Mn(n),de(n),Pr(ie(n),function(r,t){n.node(t).x=r})}function de(n){var r=q(n),t=n.graph().ranksep,e=0;f(r,function(o){var u=y(p(o,function(i){return n.node(i).height}));f(o,function(i){n.node(i).y=e+u/2}),e+=u+t})}function $e(n,r){var t=ut;t("layout",()=>{var e=t(" buildLayoutGraph",()=>ye(n));t(" runLayout",()=>fe(e,t)),t(" updateInputGraph",()=>se(n,e))})}function fe(n,r){r(" makeSpaceForEdgeLabels",()=>xe(n)),r(" removeSelfEdges",()=>Re(n)),r(" acyclic",()=>Zr(n)),r(" nestingGraph.run",()=>_t(n)),r(" rank",()=>Et(Mn(n))),r(" injectEdgeLabelProxies",()=>ke(n)),r(" removeEmptyRanks",()=>ot(n)),r(" nestingGraph.cleanup",()=>jt(n)),r(" normalizeRanks",()=>et(n)),r(" assignRankMinMax",()=>Ee(n)),r(" removeEdgeLabelProxies",()=>Oe(n)),r(" normalize.run",()=>ht(n)),r(" parentDummyChains",()=>Kt(n)),r(" addBorderSegments",()=>at(n)),r(" order",()=>Yt(n)),r(" insertSelfEdges",()=>Me(n)),r(" adjustCoordinateSystem",()=>ct(n)),r(" position",()=>ce(n)),r(" positionSelfEdges",()=>Te(n)),r(" removeBorderNodes",()=>je(n)),r(" normalize.undo",()=>gt(n)),r(" fixupEdgeLabelCoords",()=>Ie(n)),r(" undoCoordinateSystem",()=>dt(n)),r(" translateGraph",()=>Ne(n)),r(" assignNodeIntersects",()=>_e(n)),r(" reversePoints",()=>Pe(n)),r(" acyclic.undo",()=>rt(n))}function se(n,r){f(n.nodes(),function(t){var e=n.node(t),o=r.node(t);e&&(e.x=o.x,e.y=o.y,r.children(t).length&&(e.width=o.width,e.height=o.height))}),f(n.edges(),function(t){var e=n.edge(t),o=r.edge(t);e.points=o.points,Object.prototype.hasOwnProperty.call(o,"x")&&(e.x=o.x,e.y=o.y)}),n.graph().width=r.graph().width,n.graph().height=r.graph().height}var he=["nodesep","edgesep","ranksep","marginx","marginy"],ve={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ge=["acyclicer","ranker","rankdir","align"],le=["width","height"],pe={width:0,height:0},we=["minlen","weight","width","height","labeloffset"],be={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},me=["labelpos"];function ye(n){var r=new m({multigraph:!0,compound:!0}),t=K(n.graph());return r.setGraph(X({},ve,D(t,he),B(t,ge))),f(n.nodes(),function(e){var o=K(n.node(e));r.setNode(e,Er(D(o,le),pe)),r.setParent(e,n.parent(e))}),f(n.edges(),function(e){var o=K(n.edge(e));r.setEdge(e,X({},be,D(o,we),B(o,me)))}),r}function xe(n){var r=n.graph();r.ranksep/=2,f(n.edges(),function(t){var e=n.edge(t);e.minlen*=2,e.labelpos.toLowerCase()!=="c"&&(r.rankdir==="TB"||r.rankdir==="BT"?e.width+=e.labeloffset:e.height+=e.labeloffset)})}function ke(n){f(n.edges(),function(r){var t=n.edge(r);if(t.width&&t.height){var e=n.node(r.v),o=n.node(r.w),u={rank:(o.rank-e.rank)/2+e.rank,e:r};_(n,"edge-proxy",u,"_ep")}})}function Ee(n){var r=0;f(n.nodes(),function(t){var e=n.node(t);e.borderTop&&(e.minRank=n.node(e.borderTop).rank,e.maxRank=n.node(e.borderBottom).rank,r=y(r,e.maxRank))}),n.graph().maxRank=r}function Oe(n){f(n.nodes(),function(r){var t=n.node(r);t.dummy==="edge-proxy"&&(n.edge(t.e).labelRank=t.rank,n.removeNode(r))})}function Ne(n){var r=Number.POSITIVE_INFINITY,t=0,e=Number.POSITIVE_INFINITY,o=0,u=n.graph(),i=u.marginx||0,a=u.marginy||0;function c(d){var s=d.x,h=d.y,v=d.width,g=d.height;r=Math.min(r,s-v/2),t=Math.max(t,s+v/2),e=Math.min(e,h-g/2),o=Math.max(o,h+g/2)}f(n.nodes(),function(d){c(n.node(d))}),f(n.edges(),function(d){var s=n.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&c(s)}),r-=i,e-=a,f(n.nodes(),function(d){var s=n.node(d);s.x-=r,s.y-=e}),f(n.edges(),function(d){var s=n.edge(d);f(s.points,function(h){h.x-=r,h.y-=e}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=r),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=e)}),u.width=t-r+i,u.height=o-e+a}function _e(n){f(n.edges(),function(r){var t=n.edge(r),e=n.node(r.v),o=n.node(r.w),u,i;t.points?(u=t.points[0],i=t.points[t.points.length-1]):(t.points=[],u=o,i=e),t.points.unshift(dn(e,u)),t.points.push(dn(o,i))})}function Ie(n){f(n.edges(),function(r){var t=n.edge(r);if(Object.prototype.hasOwnProperty.call(t,"x"))switch((t.labelpos==="l"||t.labelpos==="r")&&(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset;break}})}function Pe(n){f(n.edges(),function(r){var t=n.edge(r);t.reversed&&t.points.reverse()})}function je(n){f(n.nodes(),function(r){if(n.children(r).length){var t=n.node(r),e=n.node(t.borderTop),o=n.node(t.borderBottom),u=n.node(G(t.borderLeft)),i=n.node(G(t.borderRight));t.width=Math.abs(i.x-u.x),t.height=Math.abs(o.y-e.y),t.x=u.x+t.width/2,t.y=e.y+t.height/2}}),f(n.nodes(),function(r){n.node(r).dummy==="border"&&n.removeNode(r)})}function Re(n){f(n.edges(),function(r){if(r.v===r.w){var t=n.node(r.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:r,label:n.edge(r)}),n.removeEdge(r)}})}function Me(n){var r=q(n);f(r,function(t){var e=0;f(t,function(o,u){var i=n.node(o);i.order=u+e,f(i.selfEdges,function(a){_(n,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:u+ ++e,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Te(n){f(n.nodes(),function(r){var t=n.node(r);if(t.dummy==="selfedge"){var e=n.node(t.e.v),o=e.x+e.width/2,u=e.y,i=t.x-o,a=e.height/2;n.setEdge(t.e,t.label),n.removeNode(r),t.label.points=[{x:o+2*i/3,y:u-a},{x:o+5*i/6,y:u-a},{x:o+i,y:u},{x:o+5*i/6,y:u+a},{x:o+2*i/3,y:u+a}],t.label.x=t.x,t.label.y=t.y}})}function D(n,r){return V(B(n,r),Number)}function K(n){var r={};return f(n,function(t,e){r[e.toLowerCase()]=t}),r}export{$e as A,E as a,nn as e,B as j,Er as k,p as w};
|