pmx-canvas 0.9.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/extensions/pmx-canvas/runtime.json +1 -1
- package/.github/extensions/pmx-canvas/tools.json +9418 -2016
- package/CHANGELOG.md +54 -1
- package/dist/canvas/chunks/abnfDiagram-N423BO3Z-p8dtp6va.js +1 -0
- package/dist/canvas/chunks/architecture-TIHT7OUA-9tffvpsv.js +1 -0
- package/dist/canvas/chunks/architectureDiagram-T3A2C74G-5jhmxrzf.js +36 -0
- package/dist/canvas/chunks/blockDiagram-VBNYF7ZC-pw1fa9yb.js +132 -0
- package/dist/canvas/chunks/c4Diagram-5PPSVZJV-x07nq0tt.js +10 -0
- package/dist/canvas/chunks/classDiagram-JCYQIIEL-nc6g5x1r.js +1 -0
- package/dist/canvas/chunks/classDiagram-v2-OCEON4UE-0qnbpwvh.js +1 -0
- package/dist/canvas/chunks/cose-bilkent-JH36ORCC-nm39npq0.js +1 -0
- package/dist/canvas/chunks/cynefin-VYW2F7L2-ys8p46ts.js +1 -0
- package/dist/canvas/chunks/cynefinDiagram-MW4NZA55-vdxrwahz.js +62 -0
- package/dist/canvas/chunks/dagre-VZM6K2ZE-bqdm7wpd.js +4 -0
- package/dist/canvas/chunks/diagram-7IWD3JNH-gs5gpr93.js +30 -0
- package/dist/canvas/chunks/diagram-B4RE2ZJO-cgwjg47s.js +3 -0
- package/dist/canvas/chunks/diagram-LBJQPF4R-w3vahpav.js +24 -0
- package/dist/canvas/chunks/diagram-Q27KOJAE-42837z6h.js +24 -0
- package/dist/canvas/chunks/diagram-UB23O5K3-4fz83q59.js +41 -0
- package/dist/canvas/chunks/ebnfDiagram-BXEA7PRR-zphtgegj.js +1 -0
- package/dist/canvas/chunks/erDiagram-JOGREHBK-zvbbdxp4.js +85 -0
- package/dist/canvas/chunks/eventmodeling-45OFAUF4-v9q6dn4c.js +1 -0
- package/dist/canvas/chunks/flowDiagram-UKHOOZJN-yrr5z8tc.js +1 -0
- package/dist/canvas/chunks/ganttDiagram-PKOTCBZU-282jzycm.js +292 -0
- package/dist/canvas/chunks/gitGraph-TEB2WS4Q-kdwb8m0a.js +1 -0
- package/dist/canvas/chunks/gitGraphDiagram-DS77QQ5N-vqqy6p1b.js +106 -0
- package/dist/canvas/chunks/index-0rk4gp1g.js +2 -0
- package/dist/canvas/chunks/index-194m3hc3.js +2 -0
- package/dist/canvas/chunks/index-1r72hdzb.js +301 -0
- package/dist/canvas/chunks/index-353m7b0p.js +2 -0
- package/dist/canvas/chunks/index-3cy1bzwh.js +2 -0
- package/dist/canvas/chunks/index-5tv8v1hk.js +1 -0
- package/dist/canvas/chunks/index-6ceya556.js +332 -0
- package/dist/canvas/chunks/index-6qmsnxwy.js +4 -0
- package/dist/canvas/chunks/index-d3b3gqe9.js +2 -0
- package/dist/canvas/chunks/index-fjtdggjn.js +2 -0
- package/dist/canvas/chunks/index-g3pwnqeb.js +2 -0
- package/dist/canvas/chunks/index-gf4e0et4.js +2 -0
- package/dist/canvas/chunks/index-hj99nz1f.js +1 -0
- package/dist/canvas/chunks/index-nprm96xp.js +16 -0
- package/dist/canvas/chunks/index-qj8fxwsf.js +2 -0
- package/dist/canvas/chunks/index-r2fyc9w1.js +89 -0
- package/dist/canvas/chunks/index-rft2hcz5.js +2 -0
- package/dist/canvas/chunks/index-rh7nv68n.js +2 -0
- package/dist/canvas/chunks/index-s4j678gj.js +2 -0
- package/dist/canvas/chunks/index-tb1wf525.js +179 -0
- package/dist/canvas/chunks/index-vv56h019.js +2 -0
- package/dist/canvas/chunks/index-w2mra17t.js +207 -0
- package/dist/canvas/chunks/index-wgv7en21.js +232 -0
- package/dist/canvas/chunks/index-yw8h9vha.js +157 -0
- package/dist/canvas/chunks/info-DKCQHKI2-wpzs6sz3.js +1 -0
- package/dist/canvas/chunks/infoDiagram-6WML65LV-v1yvggqj.js +2 -0
- package/dist/canvas/chunks/ishikawaDiagram-WSZJBQD7-5hnq1a9p.js +70 -0
- package/dist/canvas/chunks/journeyDiagram-NVQOT4AX-zjcffveh.js +139 -0
- package/dist/canvas/chunks/kanban-definition-27J2QSJJ-dakqtfp1.js +89 -0
- package/dist/canvas/chunks/katex-dmg8k4zm.js +257 -0
- package/dist/canvas/chunks/mermaid.core-j2geswrd.js +12 -0
- package/dist/canvas/chunks/mindmap-definition-FAOFIHXS-142xhr3k.js +96 -0
- package/dist/canvas/chunks/packet-7NZHBO7P-xn439f0s.js +1 -0
- package/dist/canvas/chunks/pegDiagram-VL7TDLO6-5wvk7vsd.js +1 -0
- package/dist/canvas/chunks/pie-RZYD4A2V-0kf16rwh.js +1 -0
- package/dist/canvas/chunks/pieDiagram-7S7Q4E2Y-ztdhwycc.js +39 -0
- package/dist/canvas/chunks/quadrantDiagram-CIZ2JOQS-c5p9gmg6.js +7 -0
- package/dist/canvas/chunks/radar-I7S5WNFK-0g2pz36t.js +1 -0
- package/dist/canvas/chunks/railroad-3IZDKUUU-fcaran6j.js +1 -0
- package/dist/canvas/chunks/railroad-abnf-AHOZXSZD-wgdya41q.js +1 -0
- package/dist/canvas/chunks/railroad-ebnf-EBAXGLYW-gy07a4ka.js +1 -0
- package/dist/canvas/chunks/railroad-peg-LSFZ7HO6-ewk6wtkh.js +1 -0
- package/dist/canvas/chunks/railroadDiagram-AXF67PYL-xkmqkjwf.js +1 -0
- package/dist/canvas/chunks/requirementDiagram-LRYGKXZP-9wm2dyaw.js +84 -0
- package/dist/canvas/chunks/sankeyDiagram-W5VNT64P-2w19etgb.js +40 -0
- package/dist/canvas/chunks/sequenceDiagram-SI44F4Z6-0jn0vwmz.js +162 -0
- package/dist/canvas/chunks/sizeCapture-X5ZJPWSS-x75epwdq.js +1 -0
- package/dist/canvas/chunks/stateDiagram-OKZ733FA-schjpy6d.js +1 -0
- package/dist/canvas/chunks/stateDiagram-v2-UEYNNEHI-k8sfp2e7.js +1 -0
- package/dist/canvas/chunks/swimlanes-SLNWSIFB-gkw4xce3.js +1 -0
- package/dist/canvas/chunks/swimlanesDiagram-ULZ7WXOC-nqysw67j.js +8 -0
- package/dist/canvas/chunks/timeline-definition-Z64GVDOM-x7nkcy01.js +120 -0
- package/dist/canvas/chunks/treeView-QDETBFTQ-cesw6gp0.js +1 -0
- package/dist/canvas/chunks/treemap-6X3UGDF4-zdv4knp9.js +1 -0
- package/dist/canvas/chunks/vennDiagram-T6HMQDX7-x8dqn9yf.js +34 -0
- package/dist/canvas/chunks/wardley-OPB4EBWU-44pdddez.js +1 -0
- package/dist/canvas/chunks/wardleyDiagram-T6FBY63Y-t1j52t9r.js +78 -0
- package/dist/canvas/chunks/xychartDiagram-ELKLHX3M-38t16pme.js +7 -0
- package/dist/canvas/global.css +389 -229
- package/dist/canvas/index.js +141 -211
- package/dist/canvas/mcp-app.html +4205 -554
- package/dist/canvas/mermaid-entry.js +338 -338
- package/dist/canvas/surface-theme.css +6 -6
- package/dist/json-render/index.css +1 -1
- package/dist/json-render/index.js +49 -49
- package/dist/types/client/canvas/BarHint.d.ts +5 -3
- package/dist/types/client/canvas/CanvasNode.d.ts +0 -11
- package/dist/types/client/canvas/EdgeLayer.d.ts +1 -2
- package/dist/types/client/canvas/auto-fit.d.ts +4 -5
- package/dist/types/client/mermaid-entry.d.ts +1 -2
- package/dist/types/client/mermaid-render.d.ts +1 -0
- package/dist/types/client/nodes/BoardNode.d.ts +1 -1
- package/dist/types/client/nodes/ExtAppFrame.d.ts +7 -90
- package/dist/types/client/nodes/McpAppNode.d.ts +1 -25
- package/dist/types/client/nodes/MermaidNode.d.ts +1 -8
- package/dist/types/client/nodes/ViewerFrame.d.ts +29 -0
- package/dist/types/client/nodes/ViewerHost.d.ts +6 -0
- package/dist/types/client/nodes/iframe-document-url.d.ts +3 -9
- package/dist/types/client/nodes/primitive-copy.d.ts +5 -0
- package/dist/types/client/nodes/use-iframe-content-height.d.ts +1 -1
- package/dist/types/client/nodes/use-surface-frame.d.ts +4 -6
- package/dist/types/client/nodes/viewer-runtime-state.d.ts +2 -1
- package/dist/types/client/state/canvas-store.d.ts +3 -1
- package/dist/types/client/state/intent-bridge.d.ts +1 -0
- package/dist/types/client/state/presentation.d.ts +17 -6
- package/dist/types/json-render/server.d.ts +2 -1
- package/dist/types/mcp/canvas-access.d.ts +1 -12
- package/dist/types/mcp/resource-subscriptions.d.ts +7 -0
- package/dist/types/mcp/server.d.ts +2 -0
- package/dist/types/server/ax-wait.d.ts +1 -0
- package/dist/types/server/canvas-operations.d.ts +1 -0
- package/dist/types/server/canvas-state.d.ts +2 -0
- package/dist/types/server/index.d.ts +11 -6
- package/dist/types/server/operations/http.d.ts +10 -0
- package/dist/types/server/operations/index.d.ts +2 -2
- package/dist/types/server/operations/invoker.d.ts +4 -3
- package/dist/types/server/operations/mcp-contracts.d.ts +20 -0
- package/dist/types/server/operations/mcp.d.ts +2 -0
- package/dist/types/server/operations/ops/batch.d.ts +1 -0
- package/dist/types/server/operations/ops/boards.d.ts +0 -1
- package/dist/types/server/operations/registry.d.ts +2 -2
- package/dist/types/server/operations/types.d.ts +12 -2
- package/dist/types/server/server.d.ts +2 -0
- package/dist/types/server/tour-control.d.ts +13 -3
- package/dist/types/server/webpage-node.d.ts +1 -0
- package/dist/types/shared/ax-surface-protocol.d.ts +0 -9
- package/dist/types/shared/tour.d.ts +8 -0
- package/docs/api-reference.md +2 -2
- package/docs/cli.md +1 -1
- package/docs/design/Chrome.dc.html +32 -6
- package/docs/design/Types1.dc.html +3 -2
- package/docs/design/Types2.dc.html +1 -1
- package/docs/design/Types3.dc.html +1 -1
- package/docs/design/Zoom.dc.html +37 -60
- package/docs/design/canvas.json +1 -1
- package/docs/design.md +169 -4
- package/docs/http-api.md +82 -1
- package/docs/mcp.md +101 -21
- package/docs/node-types.md +38 -3
- package/docs/plans/plan-009-tech-debt-backlog.md +2 -2
- package/docs/plans/plan-019-post-0.9-roadmap.md +402 -13
- package/docs/product-vision-2026-09.md +9 -0
- package/docs/sdk.md +5 -2
- package/package.json +2 -2
- package/plugins/pmx-canvas/com.github.copilot/extensions/pmx-canvas/runtime.json +1 -1
- package/plugins/pmx-canvas/plugin.json +1 -1
- package/plugins/pmx-canvas/runtime.json +1 -1
- package/plugins/pmx-canvas/tools.json +9418 -2016
- package/skills/pmx-canvas/SKILL.md +19 -21
- package/skills/pmx-canvas/references/full-reference.md +44 -6
- package/skills/pmx-canvas/references/installing-pmx-canvas.md +7 -7
- package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +3 -5
- package/src/client/canvas/BarHint.tsx +6 -3
- package/src/client/canvas/CanvasNode.tsx +34 -47
- package/src/client/canvas/CanvasViewport.tsx +6 -7
- package/src/client/canvas/ContextMenu.tsx +63 -3
- package/src/client/canvas/EdgeLayer.tsx +365 -169
- package/src/client/canvas/ExpandedNodeOverlay.tsx +1 -2
- package/src/client/canvas/Presentation.tsx +53 -3
- package/src/client/canvas/ToolRail.tsx +2 -0
- package/src/client/canvas/TopBar.tsx +24 -9
- package/src/client/canvas/auto-fit.ts +9 -11
- package/src/client/canvas/canvas-area.ts +1 -1
- package/src/client/canvas/use-focus-trap.ts +6 -1
- package/src/client/mermaid-entry.ts +6 -20
- package/src/client/mermaid-render.ts +39 -0
- package/src/client/nodes/AxStepControls.tsx +45 -69
- package/src/client/nodes/BoardNode.tsx +65 -9
- package/src/client/nodes/ContextNode.tsx +88 -396
- package/src/client/nodes/ExtAppFrame.tsx +283 -1462
- package/src/client/nodes/FileNode.tsx +92 -81
- package/src/client/nodes/HtmlNode.tsx +8 -36
- package/src/client/nodes/LedgerNode.tsx +31 -17
- package/src/client/nodes/MarkdownNode.tsx +8 -17
- package/src/client/nodes/McpAppNode.tsx +48 -154
- package/src/client/nodes/MermaidNode.tsx +80 -69
- package/src/client/nodes/PromptNode.tsx +12 -14
- package/src/client/nodes/ResponseNode.tsx +8 -6
- package/src/client/nodes/StatusNode.tsx +22 -7
- package/src/client/nodes/StatusSummary.tsx +5 -3
- package/src/client/nodes/TraceNode.tsx +8 -8
- package/src/client/nodes/ViewerFrame.tsx +262 -0
- package/src/client/nodes/ViewerHost.tsx +41 -0
- package/src/client/nodes/WebpageNode.tsx +22 -24
- package/src/client/nodes/iframe-document-url.ts +20 -27
- package/src/client/nodes/primitive-copy.ts +97 -0
- package/src/client/nodes/use-iframe-content-height.ts +34 -10
- package/src/client/nodes/use-surface-frame.ts +22 -11
- package/src/client/nodes/viewer-runtime-state.ts +41 -35
- package/src/client/state/canvas-store.ts +18 -12
- package/src/client/state/intent-bridge.ts +1 -0
- package/src/client/state/presentation.ts +135 -15
- package/src/client/state/sse-bridge.ts +18 -19
- package/src/client/theme/global.css +389 -229
- package/src/client/theme/surface-theme.css +6 -6
- package/src/json-render/charts/tufte-components.tsx +44 -2
- package/src/json-render/renderer/index.css +62 -2
- package/src/json-render/renderer/index.tsx +31 -7
- package/src/json-render/server.ts +3 -2
- package/src/mcp/canvas-access.ts +6 -47
- package/src/mcp/resource-subscriptions.ts +181 -0
- package/src/mcp/server.ts +185 -219
- package/src/server/ax-wait.ts +21 -6
- package/src/server/board-export.ts +35 -24
- package/src/server/canvas-geometry.ts +1 -0
- package/src/server/canvas-operations.ts +6 -2
- package/src/server/canvas-state.ts +5 -0
- package/src/server/demo-state.json +106 -100
- package/src/server/html-primitives.ts +3 -9
- package/src/server/html-surface.ts +8 -0
- package/src/server/index.ts +30 -12
- package/src/server/operations/http.ts +69 -21
- package/src/server/operations/index.ts +8 -1
- package/src/server/operations/invoker.ts +53 -5
- package/src/server/operations/mcp-contracts.ts +354 -0
- package/src/server/operations/mcp.ts +153 -18
- package/src/server/operations/ops/ax-await.ts +18 -10
- package/src/server/operations/ops/ax-read.ts +2 -0
- package/src/server/operations/ops/ax-timeline.ts +2 -2
- package/src/server/operations/ops/batch.ts +27 -8
- package/src/server/operations/ops/boards.ts +1 -3
- package/src/server/operations/ops/nodes.ts +18 -3
- package/src/server/operations/ops/viewport.ts +11 -9
- package/src/server/operations/registry.ts +24 -4
- package/src/server/operations/types.ts +16 -2
- package/src/server/server.ts +17 -59
- package/src/server/tour-control.ts +66 -6
- package/src/server/webpage-node.ts +9 -4
- package/src/shared/ax-surface-protocol.ts +0 -11
- package/src/shared/content-height-reporter.ts +4 -3
- package/src/shared/tour.ts +8 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{e,N,fr,i,a,x,u,k,d,f,p,m,g,b,v,n,A,E,o}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";var fe=(t,r)=>fr(t,"a",-r),wt=fe;function It(t,r){let l=de(t),s=l.filter((M)=>he(M,t)),c=0,h=0,y=[];if(s.length>1){let M=Kt(s);for(let w=0;w<s.length;++w){let I=s[w];I.angle=Math.atan2(I.x-M.x,I.y-M.y)}s.sort((w,I)=>I.angle-w.angle);let _=s[s.length-1];for(let w=0;w<s.length;++w){let I=s[w];h+=(_.x+I.x)*(I.y-_.y);let C={x:(I.x+_.x)/2,y:(I.y+_.y)/2},z=null;for(let j=0;j<I.parentIndex.length;++j)if(_.parentIndex.includes(I.parentIndex[j])){let O=t[I.parentIndex[j]],B=Math.atan2(I.x-O.x,I.y-O.y),W=Math.atan2(_.x-O.x,_.y-O.y),U=W-B;if(U<0)U+=2*Math.PI;let q=W-U/2,D=at(C,{x:O.x+O.radius*Math.sin(q),y:O.y+O.radius*Math.cos(q)});if(D>O.radius*2)D=O.radius*2;if(z==null||z.width>D)z={circle:O,width:D,p1:I,p2:_,large:D>O.radius,sweep:!0}}if(z!=null)y.push(z),c+=Tt(z.circle.radius,z.width),_=I}}else{let M=t[0];for(let w=1;w<t.length;++w)if(t[w].radius<M.radius)M=t[w];let _=!1;for(let w=0;w<t.length;++w)if(at(t[w],M)>Math.abs(M.radius-t[w].radius)){_=!0;break}if(_)c=h=0;else c=M.radius*M.radius*Math.PI,y.push({circle:M,p1:{x:M.x,y:M.y+M.radius},p2:{x:M.x-0.0000000001,y:M.y+M.radius},width:M.radius*2,large:!0,sweep:!0})}if(h/=2,r)r.area=c+h,r.arcArea=c,r.polygonArea=h,r.arcs=y,r.innerPoints=s,r.intersectionPoints=l;return c+h}function he(t,r){return r.every((l)=>at(t,l)<l.radius+0.0000000001)}function de(t){let r=[];for(let l=0;l<t.length;++l)for(let s=l+1;s<t.length;++s){let c=Wt(t[l],t[s]);for(let h of c)h.parentIndex=[l,s],r.push(h)}return r}function Tt(t,r){return t*t*Math.acos(1-r/t)-(t-r)*Math.sqrt(r*(2*t-r))}function at(t,r){return Math.sqrt((t.x-r.x)*(t.x-r.x)+(t.y-r.y)*(t.y-r.y))}function Nt(t,r,l){if(l>=t+r)return 0;if(l<=Math.abs(t-r))return Math.PI*Math.min(t,r)*Math.min(t,r);let s=t-(l*l-r*r+t*t)/(2*l),c=r-(l*l-t*t+r*r)/(2*l);return Tt(t,s)+Tt(r,c)}function Wt(t,r){let l=at(t,r),s=t.radius,c=r.radius;if(l>=s+c||l<=Math.abs(s-c))return[];let h=(s*s-c*c+l*l)/(2*l),y=Math.sqrt(s*s-h*h),M=t.x+h*(r.x-t.x)/l,_=t.y+h*(r.y-t.y)/l,w=-(r.y-t.y)*(y/l),I=-(r.x-t.x)*(y/l);return[{x:M+w,y:_-I},{x:M-w,y:_+I}]}function Kt(t){let r={x:0,y:0};for(let l of t)r.x+=l.x,r.y+=l.y;return r.x/=t.length,r.y/=t.length,r}function ge(t,r,l,s){s=s||{};let c=s.maxIterations||100,h=s.tolerance||0.0000000001,y=t(r),M=t(l),_=l-r;if(y*M>0)throw"Initial bisect points must have opposite signs";if(y===0)return r;if(M===0)return l;for(let w=0;w<c;++w){_/=2;let I=r+_,C=t(I);if(C*y>=0)r=I;if(Math.abs(_)<h||C===0)return I}return r+_}function zt(t){let r=Array(t);for(let l=0;l<t;++l)r[l]=0;return r}function Ut(t,r){return zt(t).map(()=>zt(r))}function pt(t,r){let l=0;for(let s=0;s<t.length;++s)l+=t[s]*r[s];return l}function At(t){return Math.sqrt(pt(t,t))}function Dt(t,r,l){for(let s=0;s<r.length;++s)t[s]=r[s]*l}function xt(t,r,l,s,c){for(let h=0;h<t.length;++h)t[h]=r*l[h]+s*c[h]}function Ht(t,r,l){l=l||{};let s=l.maxIterations||r.length*200,c=l.nonZeroDelta||1.05,h=l.zeroDelta||0.001,y=l.minErrorDelta||0.000001,M=l.minErrorDelta||0.00001,_=l.rho!==void 0?l.rho:1,w=l.chi!==void 0?l.chi:2,I=l.psi!==void 0?l.psi:-0.5,C=l.sigma!==void 0?l.sigma:0.5,z,j=r.length,O=Array(j+1);O[0]=r,O[0].fx=t(r),O[0].id=0;for(let F=0;F<j;++F){let S=r.slice();S[F]=S[F]?S[F]*c:h,O[F+1]=S,O[F+1].fx=t(S),O[F+1].id=F+1}function B(F){for(let S=0;S<F.length;S++)O[j][S]=F[S];O[j].fx=F.fx}let W=(F,S)=>F.fx-S.fx,U=r.slice(),q=r.slice(),D=r.slice(),L=r.slice();for(let F=0;F<s;++F){if(O.sort(W),l.history){let R=O.map((T)=>{let Y=T.slice();return Y.fx=T.fx,Y.id=T.id,Y});R.sort((T,Y)=>T.id-Y.id),l.history.push({x:O[0].slice(),fx:O[0].fx,simplex:R})}z=0;for(let R=0;R<j;++R)z=Math.max(z,Math.abs(O[0][R]-O[1][R]));if(Math.abs(O[0].fx-O[j].fx)<y&&z<M)break;for(let R=0;R<j;++R){U[R]=0;for(let T=0;T<j;++T)U[R]+=O[T][R];U[R]/=j}let S=O[j];if(xt(q,1+_,U,-_,S),q.fx=t(q),q.fx<O[0].fx)if(xt(L,1+w,U,-w,S),L.fx=t(L),L.fx<q.fx)B(L);else B(q);else if(q.fx>=O[j-1].fx){let R=!1;if(q.fx>S.fx)if(xt(D,1+I,U,-I,S),D.fx=t(D),D.fx<S.fx)B(D);else R=!0;else if(xt(D,1-I*_,U,I*_,S),D.fx=t(D),D.fx<q.fx)B(D);else R=!0;if(R){if(C>=1)break;for(let T=1;T<O.length;++T)xt(O[T],1-C,O[0],C,O[T]),O[T].fx=t(O[T])}}else B(q)}return O.sort(W),{fx:O[0].fx,x:O[0]}}function xe(t,r,l,s,c,h,y){let M=l.fx,_=pt(l.fxprime,r),w=M,I=M,C=_,z=0;c=c||1,h=h||0.000001,y=y||0.1;function j(O,B,W){for(let U=0;U<16;++U)if(c=(O+B)/2,xt(s.x,1,l.x,c,r),w=s.fx=t(s.x,s.fxprime),C=pt(s.fxprime,r),w>M+h*c*_||w>=W)B=c;else{if(Math.abs(C)<=-y*_)return c;if(C*(B-O)>=0)B=O;O=c,W=w}return 0}for(let O=0;O<10;++O){if(xt(s.x,1,l.x,c,r),w=s.fx=t(s.x,s.fxprime),C=pt(s.fxprime,r),w>M+h*c*_||O&&w>=I)return j(z,c,I);if(Math.abs(C)<=-y*_)return c;if(C>=0)return j(c,z,w);I=w,z=c,c*=2}return c}function ye(t,r,l){let s={x:r.slice(),fx:0,fxprime:r.slice()},c={x:r.slice(),fx:0,fxprime:r.slice()},h=r.slice(),y,M,_=1,w;l=l||{},w=l.maxIterations||r.length*20,s.fx=t(s.x,s.fxprime),y=s.fxprime.slice(),Dt(y,s.fxprime,-1);for(let I=0;I<w;++I){if(_=xe(t,y,s,c,_),l.history)l.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:_});if(!_)Dt(y,s.fxprime,-1);else{xt(h,1,c.fxprime,-1,s.fxprime);let C=pt(s.fxprime,s.fxprime),z=Math.max(0,pt(h,c.fxprime)/C);xt(y,z,y,-1,c.fxprime),M=s,s=c,c=M}if(At(s.fxprime)<=0.00001)break}if(l.history)l.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:_});return s}function Yt(t,r={}){r.maxIterations=r.maxIterations||500;let l=r.initialLayout||ve,s=r.lossFunction||mt,c=pe(t,r),h=l(c,r),y=Object.keys(h),M=[];for(let I of y)M.push(h[I].x),M.push(h[I].y);let w=Ht((I)=>{let C={};for(let z=0;z<y.length;++z){let j=y[z];C[j]={x:I[2*z],y:I[2*z+1],radius:h[j].radius}}return s(C,c)},M,r).x;for(let I=0;I<y.length;++I){let C=y[I];h[C].x=w[2*I],h[C].y=w[2*I+1]}return h}var Xt=0.0000000001;function Rt(t,r,l){if(Math.min(t,r)*Math.min(t,r)*Math.PI<=l+Xt)return Math.abs(t-r);return ge((s)=>Nt(t,r,s)-l,0,t+r)}function pe(t,r={}){let l=r.distinct,s=t.map((M)=>Object.assign({},M));function c(M){return M.join(";")}if(l){let M=new Map;for(let _ of s)for(let w=0;w<_.sets.length;w++){let I=String(_.sets[w]);M.set(I,_.size+(M.get(I)||0));for(let C=w+1;C<_.sets.length;C++){let z=String(_.sets[C]),j=`${I};${z}`,O=`${z};${I}`;M.set(j,_.size+(M.get(j)||0)),M.set(O,_.size+(M.get(O)||0))}}for(let _ of s)if(_.sets.length<3)_.size=M.get(c(_.sets))}let h=[],y=new Set;for(let M of s)if(M.sets.length===1)h.push(M.sets[0]);else if(M.sets.length===2){let _=M.sets[0],w=M.sets[1];y.add(c(M.sets)),y.add(c([w,_]))}h.sort((M,_)=>M===_?0:M<_?-1:1);for(let M=0;M<h.length;++M){let _=h[M];for(let w=M+1;w<h.length;++w){let I=h[w];if(!y.has(c([_,I])))s.push({sets:[_,I],size:0})}}return s}function me(t,r,l){let s=Ut(r.length,r.length),c=Ut(r.length,r.length);return t.filter((h)=>h.sets.length===2).forEach((h)=>{let y=l[h.sets[0]],M=l[h.sets[1]],_=Math.sqrt(r[y].size/Math.PI),w=Math.sqrt(r[M].size/Math.PI),I=Rt(_,w,h.size);s[y][M]=s[M][y]=I;let C=0;if(h.size+0.0000000001>=Math.min(r[y].size,r[M].size))C=1;else if(h.size<=0.0000000001)C=-1;c[y][M]=c[M][y]=C}),{distances:s,constraints:c}}function be(t,r,l,s){for(let h=0;h<r.length;++h)r[h]=0;let c=0;for(let h=0;h<l.length;++h){let y=t[2*h],M=t[2*h+1];for(let _=h+1;_<l.length;++_){let w=t[2*_],I=t[2*_+1],C=l[h][_],z=s[h][_],j=(w-y)*(w-y)+(I-M)*(I-M),O=Math.sqrt(j),B=j-C*C;if(z>0&&O<=C||z<0&&O>=C)continue;c+=2*B*B,r[2*h]+=4*B*(y-w),r[2*h+1]+=4*B*(M-I),r[2*_]+=4*B*(w-y),r[2*_+1]+=4*B*(I-M)}}return c}function ve(t,r={}){let l=Ie(t,r),s=r.lossFunction||mt;if(t.length>=8){let c=ke(t,r),h=s(c,t),y=s(l,t);if(h+0.00000001<y)l=c}return l}function ke(t,r={}){let l=r.restarts||10,s=[],c={};for(let z of t)if(z.sets.length===1)c[z.sets[0]]=s.length,s.push(z);let{distances:h,constraints:y}=me(t,s,c),M=At(h.map(At))/h.length;h=h.map((z)=>z.map((j)=>j/M));let _=(z,j)=>be(z,j,h,y),w=null;for(let z=0;z<l;++z){let j=zt(h.length*2).map(Math.random),O=ye(_,j,r);if(!w||O.fx<w.fx)w=O}let I=w.x,C={};for(let z=0;z<s.length;++z){let j=s[z];C[j.sets[0]]={x:I[2*z]*M,y:I[2*z+1]*M,radius:Math.sqrt(j.size/Math.PI)}}if(r.history)for(let z of r.history)Dt(z.x,M);return C}function Ie(t,r){let l=r&&r.lossFunction?r.lossFunction:mt,s={},c={};for(let C of t)if(C.sets.length===1){let z=C.sets[0];s[z]={x:10000000000,y:10000000000,rowid:s.length,size:C.size,radius:Math.sqrt(C.size/Math.PI)},c[z]=[]}t=t.filter((C)=>C.sets.length===2);for(let C of t){let z=C.weight!=null?C.weight:1,j=C.sets[0],O=C.sets[1];if(C.size+Xt>=Math.min(s[j].size,s[O].size))z=0;c[j].push({set:O,size:C.size,weight:z}),c[O].push({set:j,size:C.size,weight:z})}let h=[];Object.keys(c).forEach((C)=>{let z=0;for(let j=0;j<c[C].length;++j)z+=c[C][j].size*c[C][j].weight;h.push({set:C,size:z})});function y(C,z){return z.size-C.size}h.sort(y);let M={};function _(C){return C.set in M}function w(C,z){s[z].x=C.x,s[z].y=C.y,M[z]=!0}w({x:0,y:0},h[0].set);for(let C=1;C<h.length;++C){let z=h[C].set,j=c[z].filter(_),O=s[z];if(j.sort(y),j.length===0)throw"ERROR: missing pairwise overlap information";let B=[];for(var I=0;I<j.length;++I){let q=s[j[I].set],D=Rt(O.radius,q.radius,j[I].size);B.push({x:q.x+D,y:q.y}),B.push({x:q.x-D,y:q.y}),B.push({y:q.y+D,x:q.x}),B.push({y:q.y-D,x:q.x});for(let L=I+1;L<j.length;++L){let F=s[j[L].set],S=Rt(O.radius,F.radius,j[L].size),R=Wt({x:q.x,y:q.y,radius:D},{x:F.x,y:F.y,radius:S});B.push(...R)}}let W=100000000000000000000000000000000000000000000000000,U=B[0];for(let q of B){s[z].x=q.x,s[z].y=q.y;let D=l(s,t);if(D<W)W=D,U=q}w(U,z)}return s}function mt(t,r){let l=0;for(let s of r){if(s.sets.length===1)continue;let c;if(s.sets.length===2){let y=t[s.sets[0]],M=t[s.sets[1]];c=Nt(y.radius,M.radius,at(y,M))}else c=It(s.sets.map((y)=>t[y]));let h=s.weight!=null?s.weight:1;l+=h*(c-s.size)*(c-s.size)}return l}function Zt(t,r){let l=0;for(let s of r){if(s.sets.length===1)continue;let c;if(s.sets.length===2){let M=t[s.sets[0]],_=t[s.sets[1]];c=Nt(M.radius,_.radius,at(M,_))}else c=It(s.sets.map((M)=>t[M]));let h=s.weight!=null?s.weight:1,y=Math.log((c+1)/(s.size+1));l+=h*y*y}return l}function Me(t,r,l){if(l==null)t.sort((c,h)=>h.radius-c.radius);else t.sort(l);if(t.length>0){let c=t[0].x,h=t[0].y;for(let y of t)y.x-=c,y.y-=h}if(t.length===2){if(at(t[0],t[1])<Math.abs(t[1].radius-t[0].radius))t[1].x=t[0].x+t[0].radius-t[1].radius-0.0000000001,t[1].y=t[0].y}if(t.length>1){let c=Math.atan2(t[1].x,t[1].y)-r,h=Math.cos(c),y=Math.sin(c);for(let M of t){let{x:_,y:w}=M;M.x=h*_-y*w,M.y=y*_+h*w}}if(t.length>2){let c=Math.atan2(t[2].x,t[2].y)-r;while(c<0)c+=2*Math.PI;while(c>2*Math.PI)c-=2*Math.PI;if(c>Math.PI){let h=t[1].y/(0.0000000001+t[1].x);for(let y of t){var s=(y.x+h*y.y)/(1+h*h);y.x=2*s-y.x,y.y=2*s*h-y.y}}}}function Se(t){t.forEach((c)=>{c.parent=c});function r(c){if(c.parent!==c)c.parent=r(c.parent);return c.parent}function l(c,h){let y=r(c),M=r(h);y.parent=M}for(let c=0;c<t.length;++c)for(let h=c+1;h<t.length;++h){let y=t[c].radius+t[h].radius;if(at(t[c],t[h])+0.0000000001<y)l(t[h],t[c])}let s=new Map;for(let c=0;c<t.length;++c){let h=r(t[c]).parent.setid;if(!s.has(h))s.set(h,[]);s.get(h).push(t[c])}return t.forEach((c)=>{delete c.parent}),Array.from(s.values())}function Ct(t){let r=(l)=>{let s=t.reduce((h,y)=>Math.max(h,y[l]+y.radius),Number.NEGATIVE_INFINITY),c=t.reduce((h,y)=>Math.min(h,y[l]-y.radius),Number.POSITIVE_INFINITY);return{max:s,min:c}};return{xRange:r("x"),yRange:r("y")}}function Jt(t,r,l){if(r==null)r=Math.PI/2;let s=te(t).map((w)=>Object.assign({},w)),c=Se(s);for(let w of c){Me(w,r,l);let I=Ct(w);w.size=(I.xRange.max-I.xRange.min)*(I.yRange.max-I.yRange.min),w.bounds=I}c.sort((w,I)=>I.size-w.size),s=c[0];let h=s.bounds,y=(h.xRange.max-h.xRange.min)/50;function M(w,I,C){if(!w)return;let z=w.bounds,j,O;if(I)j=h.xRange.max-z.xRange.min+y;else{j=h.xRange.max-z.xRange.max;let B=(z.xRange.max-z.xRange.min)/2-(h.xRange.max-h.xRange.min)/2;if(B<0)j+=B}if(C)O=h.yRange.max-z.yRange.min+y;else{O=h.yRange.max-z.yRange.max;let B=(z.yRange.max-z.yRange.min)/2-(h.yRange.max-h.yRange.min)/2;if(B<0)O+=B}for(let B of w)B.x+=j,B.y+=O,s.push(B)}let _=1;while(_<c.length)M(c[_],!0,!1),M(c[_+1],!1,!0),M(c[_+2],!0,!0),_+=3,h=Ct(s);return $t(s)}function Qt(t,r,l,s,c){let h=te(t);r-=2*s,l-=2*s;let{xRange:y,yRange:M}=Ct(h);if(y.max===y.min||M.max===M.min)return console.log("not scaling solution: zero size detected"),t;let _,w;if(c){let j=Math.sqrt(c/Math.PI)*2;_=r/j,w=l/j}else _=r/(y.max-y.min),w=l/(M.max-M.min);let I=Math.min(w,_),C=(r-(y.max-y.min)*I)/2,z=(l-(M.max-M.min)*I)/2;return $t(h.map((j)=>({radius:I*j.radius,x:s+C+(j.x-y.min)*I,y:s+z+(j.y-M.min)*I,setid:j.setid})))}function $t(t){let r={};for(let l of t)r[l.setid]=l;return r}function te(t){return Object.keys(t).map((l)=>Object.assign(t[l],{setid:l}))}function ee(t={}){let r=!1,l=600,s=350,c=15,h=1000,y=Math.PI/2,M=!0,_=null,w=!0,I=!0,C=null,z=null,j=!1,O=null,B=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,W={},U=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],q=0,D=function(R){if(R in W)return W[R];var T=W[R]=U[q];if(q+=1,q>=U.length)q=0;return T},L=Yt,F=mt;function S(R){let T=R.datum(),Y=new Set;T.forEach((P)=>{if(P.size==0&&P.sets.length==1)Y.add(P.sets[0])}),T=T.filter((P)=>!P.sets.some((st)=>Y.has(st)));let V={},X={};if(T.length>0){let P=L(T,{lossFunction:F,distinct:j});if(M)P=Jt(P,y,z);V=Qt(P,l,s,c,_),X=se(V,T,B)}let lt={};T.forEach((P)=>{if(P.label)lt[P.sets]=P.label});function it(P){if(P.sets in lt)return lt[P.sets];if(P.sets.length==1)return""+P.sets[0]}R.selectAll("svg").data([V]).enter().append("svg");let J=R.select("svg");if(r)J.attr("viewBox",`0 0 ${l} ${s}`);else J.attr("width",l).attr("height",s);let H={},Z=!1;J.selectAll(".venn-area path").each(function(P){let st=this.getAttribute("d");if(P.sets.length==1&&st&&!j)Z=!0,H[P.sets[0]]=Ee(st)});function G(P){return(st)=>{let bt=P.sets.map((gt)=>{let ht=H[gt],ot=V[gt];if(!ht)ht={x:l/2,y:s/2,radius:1};if(!ot)ot={x:l/2,y:s/2,radius:1};return{x:ht.x*(1-st)+ot.x*st,y:ht.y*(1-st)+ot.y*st,radius:ht.radius*(1-st)+ot.radius*st}});return Gt(bt,O)}}let Q=J.selectAll(".venn-area").data(T,(P)=>P.sets),rt=Q.enter().append("g").attr("class",(P)=>`venn-area venn-${P.sets.length==1?"circle":"intersection"}${P.colour||P.color?" venn-coloured":""}`).attr("data-venn-sets",(P)=>P.sets.join("_")),tt=rt.append("path"),et=rt.append("text").attr("class","label").text((P)=>it(P)).attr("text-anchor","middle").attr("dy",".35em").attr("x",l/2).attr("y",s/2);if(I)tt.style("fill-opacity","0").filter((P)=>P.sets.length==1).style("fill",(P)=>P.colour?P.colour:P.color?P.color:D(P.sets)).style("fill-opacity",".25"),et.style("fill",(P)=>{if(P.colour||P.color)return"#FFF";if(t.textFill)return t.textFill;return P.sets.length==1?D(P.sets):"#444"});function ft(P){if(typeof P.transition==="function")return P.transition("venn").duration(h);return P}let nt=R;if(Z&&typeof nt.transition==="function")nt=ft(R),nt.selectAll("path").attrTween("d",G);else nt.selectAll("path").attr("d",(P)=>Gt(P.sets.map((st)=>V[st])),O);let K=nt.selectAll("text").filter((P)=>(P.sets in X)).text((P)=>it(P)).attr("x",(P)=>Math.floor(X[P.sets].x)).attr("y",(P)=>Math.floor(X[P.sets].y));if(w)if(Z)if("on"in K)K.on("end",_t(V,it));else K.each("end",_t(V,it));else K.each(_t(V,it));let dt=ft(Q.exit()).remove();if(typeof Q.transition==="function")dt.selectAll("path").attrTween("d",G);let ct=dt.selectAll("text").attr("x",l/2).attr("y",s/2);if(C!==null)et.style("font-size","0px"),K.style("font-size",C),ct.style("font-size","0px");return{circles:V,textCentres:X,nodes:Q,enter:rt,update:nt,exit:dt}}return S.wrap=function(R){if(!arguments.length)return w;return w=R,S},S.useViewBox=function(){return r=!0,S},S.width=function(R){if(!arguments.length)return l;return l=R,S},S.height=function(R){if(!arguments.length)return s;return s=R,S},S.padding=function(R){if(!arguments.length)return c;return c=R,S},S.distinct=function(R){if(!arguments.length)return j;return j=R,S},S.colours=function(R){if(!arguments.length)return D;return D=R,S},S.colors=function(R){if(!arguments.length)return D;return D=R,S},S.fontSize=function(R){if(!arguments.length)return C;return C=R,S},S.round=function(R){if(!arguments.length)return O;return O=R,S},S.duration=function(R){if(!arguments.length)return h;return h=R,S},S.layoutFunction=function(R){if(!arguments.length)return L;return L=R,S},S.normalize=function(R){if(!arguments.length)return M;return M=R,S},S.scaleToFit=function(R){if(!arguments.length)return _;return _=R,S},S.styled=function(R){if(!arguments.length)return I;return I=R,S},S.orientation=function(R){if(!arguments.length)return y;return y=R,S},S.orientationOrder=function(R){if(!arguments.length)return z;return z=R,S},S.lossFunction=function(R){if(!arguments.length)return F;return F=R==="default"?mt:R==="logRatio"?Zt:R,S},S}function _t(t,r){return function(l){let s=this,c=t[l.sets[0]].radius||50,h=r(l)||"",y=h.split(/\s+/).reverse(),M=3,_=(h.length+y.length)/3,w=y.pop(),I=[w],C=0,z=1.1;s.textContent=null;let j=[];function O(D){let L=s.ownerDocument.createElementNS(s.namespaceURI,"tspan");return L.textContent=D,j.push(L),s.append(L),L}let B=O(w);while(!0){if(w=y.pop(),!w)break;I.push(w);let D=I.join(" ");if(B.textContent=D,D.length>_&&B.getComputedTextLength()>c)I.pop(),B.textContent=I.join(" "),I=[w],B=O(w),C++}let W=0.35-C*z/2,U=s.getAttribute("x"),q=s.getAttribute("y");j.forEach((D,L)=>{D.setAttribute("x",U),D.setAttribute("y",q),D.setAttribute("dy",`${W+L*z}em`)})}}function Et(t,r,l){let s=r[0].radius-at(r[0],t);for(let c=1;c<r.length;++c){let h=r[c].radius-at(r[c],t);if(h<=s)s=h}for(let c=0;c<l.length;++c){let h=at(l[c],t)-l[c].radius;if(h<=s)s=h}return s}function ne(t,r,l){let s=[];for(let I of t)s.push({x:I.x,y:I.y}),s.push({x:I.x+I.radius/2,y:I.y}),s.push({x:I.x-I.radius/2,y:I.y}),s.push({x:I.x,y:I.y+I.radius/2}),s.push({x:I.x,y:I.y-I.radius/2});let c=s[0],h=Et(s[0],t,r);for(let I=1;I<s.length;++I){let C=Et(s[I],t,r);if(C>=h)c=s[I],h=C}let y=Ht((I)=>-1*Et({x:I[0],y:I[1]},t,r),[c.x,c.y],{maxIterations:500,minErrorDelta:0.0000000001}).x,M={x:l?0:y[0],y:y[1]},_=!0;for(let I of t)if(at(M,I)>I.radius){_=!1;break}for(let I of r)if(at(M,I)<I.radius){_=!1;break}if(_)return M;if(t.length==1)return{x:t[0].x,y:t[0].y};let w={};if(It(t,w),w.arcs.length===0)return{x:0,y:-1000,disjoint:!0};if(w.arcs.length==1)return{x:w.arcs[0].circle.x,y:w.arcs[0].circle.y};if(r.length)return ne(t,[]);return Kt(w.arcs.map((I)=>I.p1))}function we(t){let r={},l=Object.keys(t);for(let s of l)r[s]=[];for(let s=0;s<l.length;s++){let c=l[s],h=t[c];for(let y=s+1;y<l.length;++y){let M=l[y],_=t[M],w=at(h,_);if(w+_.radius<=h.radius+0.0000000001)r[M].push(c);else if(w+h.radius<=_.radius+0.0000000001)r[c].push(M)}}return r}function se(t,r,l){let s={},c=we(t);for(let h=0;h<r.length;++h){let y=r[h].sets,M={},_={};for(let z=0;z<y.length;++z){M[y[z]]=!0;let j=c[y[z]];for(let O=0;O<j.length;++O)_[j[O]]=!0}let w=[],I=[];for(let z in t)if(z in M)w.push(t[z]);else if(!(z in _))I.push(t[z]);let C=ne(w,I,l);if(s[y]=C,C.disjoint&&r[h].size>0)console.log("WARNING: area "+y+" not represented on screen")}return s}function _e(t,r,l){let s=[];return s.push(`
|
|
2
|
+
M`,t,r),s.push(`
|
|
3
|
+
m`,-l,0),s.push(`
|
|
4
|
+
a`,l,l,0,1,0,l*2,0),s.push(`
|
|
5
|
+
a`,l,l,0,1,0,-l*2,0),s.join(" ")}function Ee(t){let r=t.split(" ");return{x:Number.parseFloat(r[1]),y:Number.parseFloat(r[2]),radius:-Number.parseFloat(r[4])}}function ie(t){if(t.length===0)return[];let r={};return It(t,r),r.arcs}function re(t,r){if(t.length===0)return"M 0 0";let l=Math.pow(10,r||0),s=r!=null?(h)=>Math.round(h*l)/l:(h)=>h;if(t.length==1){let h=t[0].circle;return _e(s(h.x),s(h.y),s(h.radius))}let c=[`
|
|
6
|
+
M`,s(t[0].p2.x),s(t[0].p2.y)];for(let h of t){let y=s(h.circle.radius);c.push(`
|
|
7
|
+
A`,y,y,0,h.large?1:0,h.sweep?1:0,s(h.p1.x),s(h.p1.y))}return c.join(" ")}function Gt(t,r){return re(ie(t),r)}function oe(t,r={}){let{lossFunction:l,layoutFunction:s=Yt,normalize:c=!0,orientation:h=Math.PI/2,orientationOrder:y,width:M=600,height:_=350,padding:w=15,scaleToFit:I=!1,symmetricalTextCentre:C=!1,distinct:z,round:j=2}=r,O=s(t,{lossFunction:l==="default"||!l?mt:l==="logRatio"?Zt:l,distinct:z});if(c)O=Jt(O,h,y);let B=Qt(O,M,_,w,I),W=se(B,t,C),U=new Map(Object.keys(B).map((L)=>[L,{set:L,x:B[L].x,y:B[L].y,radius:B[L].radius}])),q=t.map((L)=>{let F=L.sets.map((T)=>U.get(T)),S=ie(F),R=re(S,j);return{circles:F,arcs:S,path:R,area:L,has:new Set(L.sets)}});function D(L){let F="";for(let S of q)if(S.has.size>L.length&&L.every((R)=>S.has.has(R)))F+=" "+S.path;return F}return q.map(({circles:L,arcs:F,path:S,area:R})=>({data:R,text:W[R.sets],circles:L,arcs:F,path:S,distinctPath:S+D(R.sets)}))}var Ot=function(){var t=e(function(q,D,L,F){for(L=L||{},F=q.length;F--;L[q[F]]=D);return L},"o"),r=[5,8],l=[7,8,11,12,17,19,22,24],s=[1,17],c=[1,18],h=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],y=[1,31],M=[1,39],_=[7,8,11,12,17,19,22,24,27],w=[1,57],I=[1,56],C=[1,58],z=[1,59],j=[1,60],O=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],B={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:e(function(D,L,F,S,R,T,Y){var V=T.length-1;switch(R){case 1:return T[V-1];case 2:case 3:case 4:this.$=[];break;case 5:T[V-1].push(T[V]),this.$=T[V-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=T[V];break;case 8:S.setDiagramTitle(T[V].substr(6)),this.$=T[V].substr(6);break;case 9:if(S.addSubsetData([T[V]],void 0,void 0),S.setIndentMode)S.setIndentMode(!0);break;case 10:if(S.addSubsetData([T[V-1]],T[V],void 0),S.setIndentMode)S.setIndentMode(!0);break;case 11:if(S.addSubsetData([T[V-2]],void 0,parseFloat(T[V])),S.setIndentMode)S.setIndentMode(!0);break;case 12:if(S.addSubsetData([T[V-3]],T[V-2],parseFloat(T[V])),S.setIndentMode)S.setIndentMode(!0);break;case 13:if(T[V].length<2)throw Error("union requires multiple identifiers");if(S.validateUnionIdentifiers)S.validateUnionIdentifiers(T[V]);if(S.addSubsetData(T[V],void 0,void 0),S.setIndentMode)S.setIndentMode(!0);break;case 14:if(T[V-1].length<2)throw Error("union requires multiple identifiers");if(S.validateUnionIdentifiers)S.validateUnionIdentifiers(T[V-1]);if(S.addSubsetData(T[V-1],T[V],void 0),S.setIndentMode)S.setIndentMode(!0);break;case 15:if(T[V-2].length<2)throw Error("union requires multiple identifiers");if(S.validateUnionIdentifiers)S.validateUnionIdentifiers(T[V-2]);if(S.addSubsetData(T[V-2],void 0,parseFloat(T[V])),S.setIndentMode)S.setIndentMode(!0);break;case 16:if(T[V-3].length<2)throw Error("union requires multiple identifiers");if(S.validateUnionIdentifiers)S.validateUnionIdentifiers(T[V-3]);if(S.addSubsetData(T[V-3],T[V-2],parseFloat(T[V])),S.setIndentMode)S.setIndentMode(!0);break;case 17:case 18:case 19:S.addTextData(T[V-1],T[V],void 0);break;case 20:case 21:S.addTextData(T[V-2],T[V-1],T[V]);break;case 23:S.addStyleData(T[V-1],T[V]);break;case 24:case 25:case 26:var X=S.getCurrentSets();if(!X)throw Error("text requires set");S.addTextData(X,T[V],void 0);break;case 27:case 28:var X=S.getCurrentSets();if(!X)throw Error("text requires set");S.addTextData(X,T[V-1],T[V]);break;case 29:case 41:this.$=[T[V]];break;case 30:case 42:this.$=[...T[V-2],T[V]];break;case 31:this.$=[T[V-2],T[V]];break;case 33:this.$=T[V].join(" ");break;case 34:this.$=[T[V]];break;case 35:T[V-1].push(T[V]),this.$=T[V-1];break;case 43:case 44:this.$=T[V];break}},"anonymous"),table:[t(r,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(l,[2,4],{6:5}),t(r,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(l,[2,5]),t(l,[2,6]),t(l,[2,7]),t(l,[2,8]),{13:16,20:s,21:c},{13:20,18:19,20:s,21:c},{13:20,18:21,20:s,21:c},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:s,21:c},t(l,[2,9],{14:[1,27],15:[1,28]}),t(h,[2,43]),t(h,[2,44]),t(l,[2,13],{14:[1,29],15:[1,30],27:y}),t(h,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:y},t(l,[2,22]),t(l,[2,24],{14:[1,35]}),t(l,[2,25],{14:[1,36]}),t(l,[2,26]),{20:M,25:37,26:38,27:y},t(l,[2,10],{15:[1,40]}),{16:[1,41]},t(l,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:s,21:c},t(l,[2,17],{14:[1,45]}),t(l,[2,18],{14:[1,46]}),t(l,[2,19]),t(l,[2,27]),t(l,[2,28]),t(l,[2,23],{27:[1,47]}),t(_,[2,29]),{15:[1,48]},{16:[1,49]},t(l,[2,11]),{16:[1,50]},t(l,[2,15]),t(h,[2,42]),t(l,[2,20]),t(l,[2,21]),{20:M,26:51},{16:w,20:I,21:[1,53],28:52,29:54,30:55,31:C,32:z,33:j},t(l,[2,12]),t(l,[2,16]),t(_,[2,30]),t(_,[2,31]),t(_,[2,32]),t(_,[2,33],{30:61,16:w,20:I,31:C,32:z,33:j}),t(O,[2,34]),t(O,[2,36]),t(O,[2,37]),t(O,[2,38]),t(O,[2,39]),t(O,[2,40]),t(O,[2,35])],defaultActions:{6:[2,1]},parseError:e(function(D,L){if(L.recoverable)this.trace(D);else{var F=Error(D);throw F.hash=L,F}},"parseError"),parse:e(function(D){var L=this,F=[0],S=[],R=[null],T=[],Y=this.table,V="",X=0,lt=0,it=0,J=2,H=1,Z=T.slice.call(arguments,1),G=Object.create(this.lexer),Q={yy:{}};for(var rt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,rt))Q.yy[rt]=this.yy[rt];if(G.setInput(D,Q.yy),Q.yy.lexer=G,Q.yy.parser=this,typeof G.yylloc>"u")G.yylloc={};var tt=G.yylloc;T.push(tt);var et=G.options&&G.options.ranges;if(typeof Q.yy.parseError==="function")this.parseError=Q.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function ft(ut){F.length=F.length-2*ut,R.length=R.length-ut,T.length=T.length-ut}e(ft,"popStack");function nt(){var ut=S.pop()||G.lex()||H;if(typeof ut!=="number"){if(ut instanceof Array)S=ut,ut=S.pop();ut=L.symbols_[ut]||ut}return ut}e(nt,"lex");var K,dt,ct,P,st,bt,gt={},ht,ot,qt,kt;while(!0){if(ct=F[F.length-1],this.defaultActions[ct])P=this.defaultActions[ct];else{if(K===null||typeof K>"u")K=nt();P=Y[ct]&&Y[ct][K]}if(typeof P>"u"||!P.length||!P[0]){var St="";kt=[];for(ht in Y[ct])if(this.terminals_[ht]&&ht>J)kt.push("'"+this.terminals_[ht]+"'");if(G.showPosition)St="Parse error on line "+(X+1)+`:
|
|
8
|
+
`+G.showPosition()+`
|
|
9
|
+
Expecting `+kt.join(", ")+", got '"+(this.terminals_[K]||K)+"'";else St="Parse error on line "+(X+1)+": Unexpected "+(K==H?"end of input":"'"+(this.terminals_[K]||K)+"'");this.parseError(St,{text:G.match,token:this.terminals_[K]||K,line:G.yylineno,loc:tt,expected:kt})}if(P[0]instanceof Array&&P.length>1)throw Error("Parse Error: multiple actions possible at state: "+ct+", token: "+K);switch(P[0]){case 1:if(F.push(K),R.push(G.yytext),T.push(G.yylloc),F.push(P[1]),K=null,!dt){if(lt=G.yyleng,V=G.yytext,X=G.yylineno,tt=G.yylloc,it>0)it--}else K=dt,dt=null;break;case 2:if(ot=this.productions_[P[1]][1],gt.$=R[R.length-ot],gt._$={first_line:T[T.length-(ot||1)].first_line,last_line:T[T.length-1].last_line,first_column:T[T.length-(ot||1)].first_column,last_column:T[T.length-1].last_column},et)gt._$.range=[T[T.length-(ot||1)].range[0],T[T.length-1].range[1]];if(bt=this.performAction.apply(gt,[V,lt,X,Q.yy,P[1],R,T].concat(Z)),typeof bt<"u")return bt;if(ot)F=F.slice(0,-1*ot*2),R=R.slice(0,-1*ot),T=T.slice(0,-1*ot);F.push(this.productions_[P[1]][0]),R.push(gt.$),T.push(gt._$),qt=Y[F[F.length-2]][F[F.length-1]],F.push(qt);break;case 3:return!0}}return!0},"parse")},W=function(){var q={EOF:1,parseError:e(function(L,F){if(this.yy.parser)this.yy.parser.parseError(L,F);else throw Error(L)},"parseError"),setInput:e(function(D,L){if(this.yy=L||this.yy||{},this._input=D,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];return this.offset=0,this},"setInput"),input:e(function(){var D=this._input[0];this.yytext+=D,this.yyleng++,this.offset++,this.match+=D,this.matched+=D;var L=D.match(/(?:\r\n?|\n).*/g);if(L)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),D},"input"),unput:e(function(D){var L=D.length,F=D.split(/(?:\r\n?|\n)/g);this._input=D+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-L),this.offset-=L;var S=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),F.length-1)this.yylineno-=F.length-1;var R=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:F?(F.length===S.length?this.yylloc.first_column:0)+S[S.length-F.length].length-F[0].length:this.yylloc.first_column-L},this.options.ranges)this.yylloc.range=[R[0],R[0]+this.yyleng-L];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(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).
|
|
10
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(D){this.unput(this.match.slice(D))},"less"),pastInput:e(function(){var D=this.matched.substr(0,this.matched.length-this.match.length);return(D.length>20?"...":"")+D.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var D=this.match;if(D.length<20)D+=this._input.substr(0,20-D.length);return(D.substr(0,20)+(D.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var D=this.pastInput(),L=Array(D.length+1).join("-");return D+this.upcomingInput()+`
|
|
11
|
+
`+L+"^"},"showPosition"),test_match:e(function(D,L){var F,S,R;if(this.options.backtrack_lexer){if(R={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)R.yylloc.range=this.yylloc.range.slice(0)}if(S=D[0].match(/(?:\r\n?|\n).*/g),S)this.yylineno+=S.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:S?S[S.length-1].length-S[S.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+D[0].length},this.yytext+=D[0],this.match+=D[0],this.matches=D,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(D[0].length),this.matched+=D[0],F=this.performAction.call(this,this.yy,this,L,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(F)return F;else if(this._backtrack){for(var T in R)this[T]=R[T];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var D,L,F,S;if(!this._more)this.yytext="",this.match="";var R=this._currentRules();for(var T=0;T<R.length;T++)if(F=this._input.match(this.rules[R[T]]),F&&(!L||F[0].length>L[0].length)){if(L=F,S=T,this.options.backtrack_lexer)if(D=this.test_match(F,R[T]),D!==!1)return D;else if(this._backtrack){L=!1;continue}else return!1;else if(!this.options.flex)break}if(L){if(D=this.test_match(L,R[S]),D!==!1)return D;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
12
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var L=this.next();if(L)return L;else return this.lex()},"lex"),begin:e(function(L){this.conditionStack.push(L)},"begin"),popState:e(function(){var L=this.conditionStack.length-1;if(L>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(L){if(L=this.conditionStack.length-1-Math.abs(L||0),L>=0)return this.conditionStack[L];else return"INITIAL"},"topState"),pushState:e(function(L){this.begin(L)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(L,F,S,R){var T=R;switch(S){case 0:break;case 1:break;case 2:break;case 3:if(L.getIndentMode&&L.getIndentMode())return L.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:if(L.setIndentMode)L.setIndentMode(!1);this.begin("INITIAL"),this.unput(F.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(L.consumeIndentText)L.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return F.yytext=F.yytext.slice(2,-2),14;break;case 17:return F.yytext=F.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return q}();B.lexer=W;function U(){this.yy={}}return e(U,"Parser"),U.prototype=B,B.Parser=U,new U}();Ot.parser=Ot;var ze=Ot,Lt=[],jt=[],Ft=[],Pt=new Set,Vt,Bt=!1,Ae=e((t,r,l)=>{let s=Mt(t).sort(),c=l??10/Math.pow(t.length,2);if(Vt=s,s.length===1)Pt.add(s[0]);Lt.push({sets:s,size:c,label:r?vt(r):void 0})},"addSubsetData"),De=e(()=>Lt,"getSubsetData"),vt=e((t)=>{let r=t.trim();if(r.length>=2&&r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);return r},"normalizeText"),Re=e((t)=>t?vt(t):t,"normalizeStyleValue"),Ce=e((t,r,l)=>{let s=vt(r);jt.push({sets:Mt(t).sort(),id:s,label:l?vt(l):void 0})},"addTextData"),Ne=e((t,r)=>{let l=Mt(t).sort(),s={};for(let[c,h]of r)s[c]=Re(h)??h;Ft.push({targets:l,styles:s})},"addStyleData"),Oe=e(()=>Ft,"getStyleData"),Mt=e((t)=>t.map((r)=>vt(r)),"normalizeIdentifierList"),Le=e((t)=>{let l=Mt(t).filter((s)=>!Pt.has(s));if(l.length>0)throw Error(`unknown set identifier: ${l.join(", ")}`)},"validateUnionIdentifiers"),je=e(()=>jt,"getTextData"),Fe=e(()=>Vt,"getCurrentSets"),Pe=e(()=>Bt,"getIndentMode"),Ve=e((t)=>{Bt=t},"setIndentMode"),Be=x.venn;function ae(){return E(Be,u().venn)}e(ae,"getConfig");var qe=e(()=>{d(),Lt.length=0,jt.length=0,Ft.length=0,Pt.clear(),Vt=void 0,Bt=!1},"customClear"),Ue={getConfig:ae,clear:qe,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m,addSubsetData:Ae,getSubsetData:De,addTextData:Ce,addStyleData:Ne,validateUnionIdentifiers:Le,getTextData:je,getStyleData:Oe,getCurrentSets:Fe,getIndentMode:Pe,setIndentMode:Ve},Ge=e((t)=>`
|
|
13
|
+
.venn-title {
|
|
14
|
+
font-size: 32px;
|
|
15
|
+
fill: ${t.vennTitleTextColor};
|
|
16
|
+
font-family: ${t.fontFamily};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.venn-circle text {
|
|
20
|
+
font-size: 48px;
|
|
21
|
+
font-family: ${t.fontFamily};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.venn-intersection text {
|
|
25
|
+
font-size: 48px;
|
|
26
|
+
fill: ${t.vennSetTextColor};
|
|
27
|
+
font-family: ${t.fontFamily};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.venn-text-node {
|
|
31
|
+
font-family: ${t.fontFamily};
|
|
32
|
+
color: ${t.vennSetTextColor};
|
|
33
|
+
}
|
|
34
|
+
`,"getStyles"),We=Ge;function le(t){let r=new Map;for(let l of t){let s=l.targets.join("|"),c=r.get(s);if(c)Object.assign(c,l.styles);else r.set(s,{...l.styles})}return r}e(le,"buildStyleByKey");var Ke=e((t,r,l,s)=>{let c=s.db,h=c.getConfig?.(),{themeVariables:y,look:M,handDrawnSeed:_}=u(),w=M==="handDrawn",I=[y.venn1,y.venn2,y.venn3,y.venn4,y.venn5,y.venn6,y.venn7,y.venn8].filter(Boolean),C=c.getDiagramTitle?.(),z=c.getSubsetData(),j=c.getTextData(),O=le(c.getStyleData()),B=ue(z),W=h?.width??800,U=h?.height??450,q=1600,D=W/1600,L=C?48*D:0,F=y.primaryTextColor??y.textColor,S=A(r);if(S.attr("viewBox",`0 0 ${W} ${U}`),C)S.append("text").text(C).attr("class","venn-title").attr("font-size",`${32*D}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*D).style("fill",y.vennTitleTextColor||y.titleColor);let R=n(document.createElement("div")),T=ee().width(W).height(U-L);R.datum(B).call(T);let Y=w?o.svg(R.select("svg").node()):void 0,V=oe(B,{width:W,height:U-L,padding:h?.padding??15}),X=new Map;for(let H of V){let Z=yt([...H.data.sets].sort());X.set(Z,H)}if(j.length>0)ce(h,X,R,j,D,O);let lt=N(y.background||"#f4f4f4");if(R.selectAll(".venn-circle").each(function(H,Z){let G=n(this),rt=yt([...H.sets].sort()),tt=O.get(rt),et=tt?.fill||I[Z%I.length]||y.primaryColor;G.classed(`venn-set-${Z%8}`,!0);let ft=tt?.["fill-opacity"]??0.1,nt=tt?.stroke||et,K=tt?.["stroke-width"]||`${5*D}`;if(w&&Y){let ct=X.get(rt);if(ct&&ct.circles.length>0){let P=ct.circles[0],st=Y.circle(P.x,P.y,P.radius*2,{roughness:0.7,seed:_,fill:wt(et,0.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+Z*60,stroke:nt,strokeWidth:parseFloat(String(K))});G.select("path").remove(),G.node()?.insertBefore(st,G.select("text").node())}}else G.select("path").style("fill",et).style("fill-opacity",ft).style("stroke",nt).style("stroke-width",K).style("stroke-opacity",0.95);let dt=tt?.color||(lt?i(et,30):a(et,30));G.select("text").style("font-size",`${48*D}px`).style("fill",dt)}),w&&Y)R.selectAll(".venn-intersection").each(function(H){let Z=n(this),Q=yt([...H.sets].sort()),rt=O.get(Q),tt=rt?.fill;if(tt){let et=Z.select("path"),ft=et.attr("d");if(ft){let nt=Y.path(ft,{roughness:0.7,seed:_,fill:wt(tt,0.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),K=et.node();K?.parentNode?.insertBefore(nt,K),et.remove()}}else Z.select("path").style("fill-opacity",0);Z.select("text").style("font-size",`${48*D}px`).style("fill",rt?.color??y.vennSetTextColor??F)});else R.selectAll(".venn-intersection text").style("font-size",`${48*D}px`).style("fill",(H)=>{let G=yt([...H.sets].sort());return O.get(G)?.color??y.vennSetTextColor??F}),R.selectAll(".venn-intersection path").style("fill-opacity",(H)=>{let G=yt([...H.sets].sort());return O.get(G)?.fill?1:0}).style("fill",(H)=>{let G=yt([...H.sets].sort());return O.get(G)?.fill??"transparent"});let it=S.append("g").attr("transform",`translate(0, ${L})`),J=R.select("svg").node();if(J&&"childNodes"in J)for(let H of[...J.childNodes])it.node()?.appendChild(H);k(S,U,W,h?.useMaxWidth??!0)},"draw");function yt(t){return t.join("|")}e(yt,"stableSetsKey");function ce(t,r,l,s,c,h){let y=t?.useDebugLayout??!1,_=l.select("svg").append("g").attr("class","venn-text-nodes"),w=new Map;for(let I of s){let C=yt(I.sets),z=w.get(C);if(z)z.push(I);else w.set(C,[I])}for(let[I,C]of w.entries()){let z=r.get(I);if(!z?.text)continue;let j=z.text.x,O=z.text.y,B=Math.min(...z.circles.map((J)=>J.radius)),W=Math.min(...z.circles.map((J)=>J.radius-Math.hypot(j-J.x,O-J.y))),U=Number.isFinite(W)?Math.max(0,W):0;if(U===0&&Number.isFinite(B))U=B*0.6;let q=_.append("g").attr("class","venn-text-area").attr("font-size",`${40*c}px`);if(y)q.append("circle").attr("class","venn-text-debug-circle").attr("cx",j).attr("cy",O).attr("r",U).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*c).attr("stroke-dasharray",`${6*c} ${4*c}`);let D=Math.max(80*c,U*2*0.95),L=Math.max(60*c,U*2*0.95),R=(z.data.label&&z.data.label.length>0?Math.min(32*c,U*0.25):0)+(C.length<=2?30*c:0),T=j-D/2,Y=O-L/2+R,V=Math.max(1,Math.ceil(Math.sqrt(C.length))),X=Math.max(1,Math.ceil(C.length/V)),lt=D/V,it=L/X;for(let[J,H]of C.entries()){let Z=J%V,G=Math.floor(J/V),Q=T+lt*(Z+0.5),rt=Y+it*(G+0.5);if(y)q.append("rect").attr("class","venn-text-debug-cell").attr("x",T+lt*Z).attr("y",Y+it*G).attr("width",lt).attr("height",it).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*c).attr("stroke-dasharray",`${4*c} ${3*c}`);let tt=lt*0.9,et=it*0.9,ft=q.append("foreignObject").attr("class","venn-text-node-fo").attr("width",tt).attr("height",et).attr("x",Q-tt/2).attr("y",rt-et/2).attr("overflow","visible"),nt=h.get(H.id)?.color,K=ft.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(H.label??H.id);if(nt)K.style("color",nt)}}}e(ce,"renderTextNodes");function ue(t){let r=new Set(t.map((c)=>[...c.sets].sort().join("|"))),l=new Map(t.filter((c)=>c.sets.length===1&&c.size!==void 0).map((c)=>[c.sets[0],c.size])),s=[];for(let c of t){if(c.sets.length<3)continue;let h=[...c.sets].sort();for(let y=0;y<h.length-1;y++)for(let M=y+1;M<h.length;M++){let _=[h[y],h[M]],w=_.join("|");if(!r.has(w)){r.add(w);let I=l.get(_[0]),C=l.get(_[1]),z=I!==void 0&&C!==void 0?Math.min(I,C)/4:2.5;s.push({sets:_,size:z,label:""})}}}return s.length>0?[...t,...s]:t}e(ue,"ensurePairwiseSubsets");var He={draw:Ke},rn={parser:ze,db:Ue,renderer:He,styles:We};export{rn as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ri}from"./index-tb1wf525.js";export{ri as createWardleyServices};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import{R}from"./index-353m7b0p.js";import{e,t,j,u,k,d,f,p,m,g,b,v,r,A,E}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{D}from"./index-tb1wf525.js";var nt=e((o,l)=>{let s=o<=1?o*100:o;if(s<0||s>100)throw Error(`${l} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return s},"toPercent"),Z=e((o,l,s)=>({x:nt(l,`${s} evolution`),y:nt(o,`${s} visibility`)}),"toCoordinates"),ht=e((o)=>{if(!o)return;if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward";return},"getFlowFromPort"),Ft=e((o)=>{if(!o?.startsWith("+"))return{};let s=/^\+'([^']*)'/.exec(o)?.[1];if(o.includes("<>"))return{flow:"bidirectional",label:s};if(o.includes("<"))return{flow:"backward",label:s};if(o.includes(">"))return{flow:"forward",label:s};return{label:s}},"extractFlowFromArrow"),Rt=e((o,l)=>{if(R(o,l),o.size)l.setSize(o.size.width,o.size.height);if(o.evolution){let s=o.evolution.stages.map((n)=>{if(n.secondName)return`${n.name.trim()} / ${n.secondName.trim()}`;return n.name.trim()}),S=o.evolution.stages.filter((n)=>n.boundary!==void 0).map((n)=>n.boundary);l.updateAxes({stages:s,stageBoundaries:S})}if(o.anchors.forEach((s)=>{let S=Z(s.visibility,s.evolution,`Anchor "${s.name}"`);l.addNode(s.name,s.name,S.x,S.y,"anchor")}),o.components.forEach((s)=>{let S=Z(s.visibility,s.evolution,`Component "${s.name}"`),n=s.label?(s.label.negX?-1:1)*s.label.offsetX:void 0,x=s.label?(s.label.negY?-1:1)*s.label.offsetY:void 0,L=s.decorator?.strategy;l.addNode(s.name,s.name,S.x,S.y,"component",n,x,s.inertia,L)}),o.notes.forEach((s)=>{let S=Z(s.visibility,s.evolution,`Note "${s.text}"`);l.addNote(s.text,S.x,S.y)}),o.pipelines.forEach((s)=>{let S=l.getNode(s.parent);if(!S||typeof S.y!=="number")throw Error(`Pipeline "${s.parent}" must reference an existing component with coordinates.`);let n=S.y;l.startPipeline(s.parent),s.components.forEach((x)=>{let L=`${s.parent}_${x.name}`,B=x.label?(x.label.negX?-1:1)*x.label.offsetX:void 0,N=x.label?(x.label.negY?-1:1)*x.label.offsetY:void 0,et=nt(x.evolution,`Pipeline component "${x.name}" evolution`);l.addNode(L,x.name,et,n,"pipeline-component",B,N),l.addPipelineComponent(s.parent,L)})}),o.links.forEach((s)=>{let S=!!s.arrow&&(s.arrow.includes("-.->")||s.arrow.includes(".-.")),n=ht(s.fromPort)??ht(s.toPort),{flow:x,label:L}=Ft(s.arrow);if(!n&&x)n=x;let B=s.linkLabel,N=L??B;l.addLink(l.resolveNodeId(s.from),l.resolveNodeId(s.to),S,N,n)}),o.evolves.forEach((s)=>{let S=l.getNode(s.component);if(S?.y!==void 0){let n=nt(s.target,`Evolve target for "${s.component}"`);l.addTrend(s.component,n,S.y)}}),o.annotations.length>0){let s=o.annotations[0],S=Z(s.x,s.y,"Annotations box");l.setAnnotationsBox(S.x,S.y)}o.annotation.forEach((s)=>{let S=Z(s.x,s.y,`Annotation ${s.number}`);l.addAnnotation(s.number,[{x:S.x,y:S.y}],s.text)}),o.accelerators.forEach((s)=>{let S=Z(s.x,s.y,`Accelerator "${s.name}"`);l.addAccelerator(s.name,S.x,S.y)}),o.deaccelerators.forEach((s)=>{let S=Z(s.x,s.y,`Deaccelerator "${s.name}"`);l.addDeaccelerator(s.name,S.x,S.y)})},"populateDb"),ft={parser:{yy:void 0},parse:e(async(o)=>{let l=await D("wardley",o);t.debug(l);let s=ft.parser?.yy;if(!s||typeof s.addNode!=="function")throw Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rt(l,s)},"parse")},Ot=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{e(this,"WardleyBuilder")}addNode(o){let l=this.nodes.get(o.id)??{id:o.id,label:o.label},s={...l,...o,className:o.className??l.className,labelOffsetX:o.labelOffsetX??l.labelOffsetX,labelOffsetY:o.labelOffsetY??l.labelOffsetY};this.nodes.set(o.id,s)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});let l=this.nodes.get(o);if(l)l.isPipelineParent=!0}addPipelineComponent(o,l){let s=this.pipelines.get(o);if(s)s.componentIds.push(l);let S=this.nodes.get(l);if(S)S.inPipeline=!0}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,l){this.annotationsBox={x:o,y:l}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,l){this.size={width:o,height:l}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(let[l,s]of this.nodes)if(s.label===o)return l;return o}build(){let o=[];for(let l of this.nodes.values()){if(typeof l.x!=="number"||typeof l.y!=="number")throw Error(`Node "${l.label}" is missing coordinates`);o.push(l)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},W=new Ot;function xt(){return r()["wardley-beta"]}e(xt,"getConfig");function gt(o,l,s,S,n,x,L,B,N){W.addNode({id:o,label:l,x:s,y:S,className:n,labelOffsetX:x,labelOffsetY:L,inertia:B,sourceStrategy:N})}e(gt,"addNode");function yt(o,l,s=!1,S,n){W.addLink({source:o,target:l,dashed:s,label:S,flow:n})}e(yt,"addLink");function ut(o,l,s){W.addTrend({nodeId:o,targetX:l,targetY:s})}e(ut,"addTrend");function wt(o,l,s){W.addAnnotation({number:o,coordinates:l,text:s})}e(wt,"addAnnotation");function mt(o,l,s){W.addNote({text:o,x:l,y:s})}e(mt,"addNote");function kt(o,l,s){W.addAccelerator({name:o,x:l,y:s})}e(kt,"addAccelerator");function bt(o,l,s){W.addDeaccelerator({name:o,x:l,y:s})}e(bt,"addDeaccelerator");function $t(o,l){W.setAnnotationsBox(o,l)}e($t,"setAnnotationsBox");function vt(o,l){W.setSize(o,l)}e(vt,"setSize");function Pt(o){W.startPipeline(o)}e(Pt,"startPipeline");function Ct(o,l){W.addPipelineComponent(o,l)}e(Ct,"addPipelineComponent");function St(o){W.setAxes(o)}e(St,"updateAxes");function Mt(o){return W.getNode(o)}e(Mt,"getNode");function Nt(o){return W.resolveNodeId(o)}e(Nt,"resolveNodeId");function zt(){return W.build()}e(zt,"getWardleyData");function Lt(){W.clear(),d()}e(Lt,"clear");var Dt={getConfig:xt,addNode:gt,addLink:yt,addTrend:ut,addAnnotation:wt,addNote:mt,addAccelerator:kt,addDeaccelerator:bt,setAnnotationsBox:$t,setSize:vt,startPipeline:Pt,addPipelineComponent:Ct,updateAxes:St,getNode:Mt,resolveNodeId:Nt,getWardleyData:zt,clear:Lt,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m},Gt=["Genesis","Custom Built","Product","Commodity"],qt=e(()=>{let{themeVariables:o}=r();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=e(()=>{let o=r()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=e((o,l,s,S)=>{t.debug(`Rendering Wardley map
|
|
2
|
+
`+o);let n=jt(),x=qt(),L=n.nodeRadius*1.6,B=S.db,N=B.getWardleyData(),et=B.getDiagramTitle(),F=N.size?.width??n.width,X=N.size?.height??n.height,J=A(l);J.selectAll("*").remove(),k(J,X,F,n.useMaxWidth),J.attr("viewBox",`0 0 ${F} ${X}`);let Y=J.append("g").attr("class","wardley-map"),st=J.append("defs");st.append("marker").attr("id",`arrow-${l}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",x.evolutionStroke).attr("stroke","none"),st.append("marker").attr("id",`link-arrow-end-${l}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",x.linkStroke).attr("stroke","none"),st.append("marker").attr("id",`link-arrow-start-${l}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",x.linkStroke).attr("stroke","none"),Y.append("rect").attr("class","wardley-background").attr("width",F).attr("height",X).attr("fill",x.backgroundColor);let K=F-n.padding*2,Q=X-n.padding*2;if(et)Y.append("text").attr("class","wardley-title").attr("x",F/2).attr("y",n.padding/2).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(et);let q=e((a)=>n.padding+a/100*K,"projectX"),V=e((a)=>X-n.padding-a/100*Q,"projectY"),at=Y.append("g").attr("class","wardley-axes");at.append("line").attr("x1",n.padding).attr("x2",F-n.padding).attr("y1",X-n.padding).attr("y2",X-n.padding).attr("stroke",x.axisColor).attr("stroke-width",1),at.append("line").attr("x1",n.padding).attr("x2",n.padding).attr("y1",n.padding).attr("y2",X-n.padding).attr("stroke",x.axisColor).attr("stroke-width",1);let Tt=N.axes.xLabel??"Evolution",Wt=N.axes.yLabel??"Visibility";at.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",n.padding+K/2).attr("y",X-n.padding/4).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Tt),at.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",n.padding/3).attr("y",n.padding+Q/2).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${n.padding/3} ${n.padding+Q/2})`).text(Wt);let tt=N.axes.stages&&N.axes.stages.length>0?N.axes.stages:Gt;if(tt.length>0){let a=Y.append("g").attr("class","wardley-stages"),c=N.axes.stageBoundaries,i=[];if(c&&c.length===tt.length){let h=0;c.forEach((w)=>{i.push({start:h,end:w}),h=w})}else{let h=1/tt.length;tt.forEach((w,P)=>{i.push({start:P*h,end:(P+1)*h})})}tt.forEach((h,w)=>{let P=i[w],M=n.padding+P.start*K,C=n.padding+P.end*K,z=(M+C)/2;if(w>0)a.append("line").attr("x1",M).attr("x2",M).attr("y1",n.padding).attr("y2",X-n.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);a.append("text").attr("class","wardley-stage-label").attr("x",z).attr("y",X-n.padding/1.5).attr("fill",x.axisTextColor).attr("font-size",n.axisFontSize-2).attr("text-anchor","middle").text(h)})}if(n.showGrid){let a=Y.append("g").attr("class","wardley-grid");for(let c=1;c<4;c++){let i=c/4,h=n.padding+K*i;a.append("line").attr("x1",h).attr("x2",h).attr("y1",n.padding).attr("y2",X-n.padding).attr("stroke",x.gridColor).attr("stroke-dasharray","2 6"),a.append("line").attr("x1",n.padding).attr("x2",F-n.padding).attr("y1",X-n.padding-Q*i).attr("y2",X-n.padding-Q*i).attr("stroke",x.gridColor).attr("stroke-dasharray","2 6")}}let y=new Map;if(N.nodes.forEach((a)=>{y.set(a.id,{x:q(a.x),y:V(a.y),node:a})}),N.pipelines.length>0){let a=Y.append("g").attr("class","wardley-pipelines"),c=Y.append("g").attr("class","wardley-pipeline-links");N.pipelines.forEach((i)=>{if(i.componentIds.length===0)return;let h=i.componentIds.map((C)=>({id:C,pos:y.get(C),node:N.nodes.find((z)=>z.id===C)})).filter((C)=>C.pos&&C.node).sort((C,z)=>C.node.x-z.node.x);for(let C=0;C<h.length-1;C++){let z=h[C],T=h[C+1];c.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",z.pos.x).attr("y1",z.pos.y).attr("x2",T.pos.x).attr("y2",T.pos.y).attr("stroke",x.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let w=1/0,P=-1/0,M=0;if(i.componentIds.forEach((C)=>{let z=y.get(C);if(z)w=Math.min(w,z.x),P=Math.max(P,z.x),M=z.y}),w!==1/0&&P!==-1/0){let z=n.nodeRadius*4,T=M-z/2,I=y.get(i.nodeId);if(I){let G=(w+P)/2;I.x=G,I.y=T-L/6}a.append("rect").attr("class","wardley-pipeline-box").attr("x",w-15).attr("y",T).attr("width",P-w+30).attr("height",z).attr("fill","none").attr("stroke",x.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let lt=Y.append("g").attr("class","wardley-links"),ct=new Map;N.pipelines.forEach((a)=>{ct.set(a.nodeId,new Set(a.componentIds))});let pt=N.links.filter((a)=>{if(!y.has(a.source)||!y.has(a.target))return!1;if(ct.get(a.target)?.has(a.source))return!1;return!0});lt.selectAll("line").data(pt).enter().append("line").attr("class",(a)=>`wardley-link${a.dashed?" wardley-link--dashed":""}`).attr("x1",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=N.nodes.find((z)=>z.id===a.source).isPipelineParent?L/Math.sqrt(2):n.nodeRadius,P=i.x-c.x,M=i.y-c.y,C=Math.sqrt(P*P+M*M);return c.x+P/C*w}).attr("y1",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=N.nodes.find((z)=>z.id===a.source).isPipelineParent?L/Math.sqrt(2):n.nodeRadius,P=i.x-c.x,M=i.y-c.y,C=Math.sqrt(P*P+M*M);return c.y+M/C*w}).attr("x2",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=N.nodes.find((z)=>z.id===a.target).isPipelineParent?L/Math.sqrt(2):n.nodeRadius,P=c.x-i.x,M=c.y-i.y,C=Math.sqrt(P*P+M*M);return i.x+P/C*w}).attr("y2",(a)=>{let c=y.get(a.source),i=y.get(a.target),w=N.nodes.find((z)=>z.id===a.target).isPipelineParent?L/Math.sqrt(2):n.nodeRadius,P=c.x-i.x,M=c.y-i.y,C=Math.sqrt(P*P+M*M);return i.y+M/C*w}).attr("stroke",x.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(a)=>a.dashed?"6 6":null).attr("marker-end",(a)=>{if(a.flow==="forward"||a.flow==="bidirectional")return`url(#link-arrow-end-${l})`;return null}).attr("marker-start",(a)=>{if(a.flow==="backward"||a.flow==="bidirectional")return`url(#link-arrow-start-${l})`;return null}),lt.selectAll("text").data(pt.filter((a)=>a.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(a)=>{let c=y.get(a.source),i=y.get(a.target),h=(c.x+i.x)/2,w=i.y-c.y,P=i.x-c.x,M=Math.sqrt(P*P+w*w),C=8,z=w/M;return h+z*8}).attr("y",(a)=>{let c=y.get(a.source),i=y.get(a.target),h=(c.y+i.y)/2,w=i.x-c.x,P=i.y-c.y,M=Math.sqrt(w*w+P*P),C=8,z=-w/M;return h+z*8}).attr("fill",x.axisTextColor).attr("font-size",n.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(a)=>{let c=y.get(a.source),i=y.get(a.target),h=(c.x+i.x)/2,w=(c.y+i.y)/2,P=i.x-c.x,M=i.y-c.y,C=Math.sqrt(P*P+M*M),z=8,T=M/C,I=-P/C,G=h+T*8,rt=w+I*8,U=Math.atan2(M,P)*180/Math.PI;if(U>90||U<-90)U+=180;return`rotate(${U} ${G} ${rt})`}).text((a)=>a.label);let At=Y.append("g").attr("class","wardley-trends"),Xt=N.trends.map((a)=>{let c=y.get(a.nodeId);if(!c)return null;let i=q(a.targetX),h=V(a.targetY),w=i-c.x,P=h-c.y,M=Math.sqrt(w*w+P*P),C=n.nodeRadius+2,z=M>C?i-w/M*C:i,T=M>C?h-P/M*C:h;return{origin:c,targetX:i,targetY:h,adjustedX2:z,adjustedY2:T}}).filter((a)=>a!==null);At.selectAll("line").data(Xt).enter().append("line").attr("class","wardley-trend").attr("x1",(a)=>a.origin.x).attr("y1",(a)=>a.origin.y).attr("x2",(a)=>a.adjustedX2).attr("y2",(a)=>a.adjustedY2).attr("stroke",x.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${l})`);let O=Y.append("g").attr("class","wardley-nodes").selectAll("g").data(N.nodes).enter().append("g").attr("class",(a)=>["wardley-node",a.className?`wardley-node--${a.className}`:""].filter(Boolean).join(" "));O.filter((a)=>a.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","#666").attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>a.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","#ccc").attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>a.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let _=O.filter((a)=>a.sourceStrategy==="market");_.append("circle").attr("class","wardley-market-overlay").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius*2).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>!a.isPipelineParent&&a.sourceStrategy!=="market"&&a.className!=="anchor").append("circle").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y).attr("r",n.nodeRadius).attr("fill",x.componentFill).attr("stroke",x.componentStroke).attr("stroke-width",1);let it=n.nodeRadius*0.7,H=n.nodeRadius*1.2;if(_.append("line").attr("class","wardley-market-line").attr("x1",(a)=>y.get(a.id).x).attr("y1",(a)=>y.get(a.id).y-H).attr("x2",(a)=>y.get(a.id).x-H*Math.cos(Math.PI/6)).attr("y2",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("stroke",x.componentStroke).attr("stroke-width",1),_.append("line").attr("class","wardley-market-line").attr("x1",(a)=>y.get(a.id).x-H*Math.cos(Math.PI/6)).attr("y1",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("x2",(a)=>y.get(a.id).x+H*Math.cos(Math.PI/6)).attr("y2",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("stroke",x.componentStroke).attr("stroke-width",1),_.append("line").attr("class","wardley-market-line").attr("x1",(a)=>y.get(a.id).x+H*Math.cos(Math.PI/6)).attr("y1",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("x2",(a)=>y.get(a.id).x).attr("y2",(a)=>y.get(a.id).y-H).attr("stroke",x.componentStroke).attr("stroke-width",1),_.append("circle").attr("class","wardley-market-dot").attr("cx",(a)=>y.get(a.id).x).attr("cy",(a)=>y.get(a.id).y-H).attr("r",it).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",2),_.append("circle").attr("class","wardley-market-dot").attr("cx",(a)=>y.get(a.id).x-H*Math.cos(Math.PI/6)).attr("cy",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("r",it).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",2),_.append("circle").attr("class","wardley-market-dot").attr("cx",(a)=>y.get(a.id).x+H*Math.cos(Math.PI/6)).attr("cy",(a)=>y.get(a.id).y+H*Math.sin(Math.PI/6)).attr("r",it).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",2),O.filter((a)=>a.isPipelineParent===!0).append("rect").attr("x",(a)=>y.get(a.id).x-L/2).attr("y",(a)=>y.get(a.id).y-L/2).attr("width",L).attr("height",L).attr("fill",x.componentFill).attr("stroke",x.componentStroke).attr("stroke-width",1),O.filter((a)=>a.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?L/2+15:n.nodeRadius+15;if(a.sourceStrategy)i+=n.nodeRadius+10;return c.x+i}).attr("y1",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?L:n.nodeRadius*2;return c.y-i/2}).attr("x2",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?L/2+15:n.nodeRadius+15;if(a.sourceStrategy)i+=n.nodeRadius+10;return c.x+i}).attr("y2",(a)=>{let c=y.get(a.id),i=a.isPipelineParent?L:n.nodeRadius*2;return c.y+i/2}).attr("stroke",x.componentStroke).attr("stroke-width",6),O.append("text").attr("x",(a)=>{let c=y.get(a.id);if(a.className==="anchor")return a.labelOffsetX!==void 0?c.x+a.labelOffsetX:c.x;let i=n.nodeLabelOffset;if(a.sourceStrategy&&a.labelOffsetX===void 0)i+=10;let h=a.labelOffsetX??i;return c.x+h}).attr("y",(a)=>{let c=y.get(a.id);if(a.className==="anchor")return a.labelOffsetY!==void 0?c.y+a.labelOffsetY:c.y-3;let i=-n.nodeLabelOffset;if(a.sourceStrategy&&a.labelOffsetY===void 0)i-=10;let h=a.labelOffsetY??i;return c.y+h}).attr("class","wardley-node-label").attr("fill",(a)=>{if(a.className==="evolved")return x.evolutionStroke;if(a.className==="anchor")return"#000";return x.componentLabelColor}).attr("font-size",n.labelFontSize).attr("font-weight",(a)=>a.className==="anchor"?"bold":"normal").attr("text-anchor",(a)=>a.className==="anchor"?"middle":"start").attr("dominant-baseline",(a)=>a.className==="anchor"?"middle":"auto").text((a)=>a.label),N.annotations.length>0){let a=Y.append("g").attr("class","wardley-annotations");if(N.annotations.forEach((c)=>{let i=c.coordinates.map((h)=>({x:q(h.x),y:V(h.y)}));if(i.length>1)for(let h=0;h<i.length-1;h++)a.append("line").attr("class","wardley-annotation-line").attr("x1",i[h].x).attr("y1",i[h].y).attr("x2",i[h+1].x).attr("y2",i[h+1].y).attr("stroke",x.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");i.forEach((h)=>{let w=a.append("g").attr("class","wardley-annotation");w.append("circle").attr("cx",h.x).attr("cy",h.y).attr("r",10).attr("fill","white").attr("stroke",x.axisColor).attr("stroke-width",1.5),w.append("text").attr("x",h.x).attr("y",h.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.number)})}),N.annotationsBox){let c=q(N.annotationsBox.x),i=V(N.annotationsBox.y),h=10,w=16,P=11,M=a.append("g").attr("class","wardley-annotations-box"),C=[...N.annotations].filter((T)=>T.text).sort((T,I)=>T.number-I.number),z=[];if(C.forEach((T,I)=>{let G=M.append("text").attr("x",c+h).attr("y",i+h+(I+1)*w).attr("font-size",P).attr("fill",x.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${T.number}. ${T.text}`);z.push(G)}),z.length>0){let T=0,I=0;z.forEach((dt)=>{let ot=dt.node(),It=ot.getComputedTextLength();T=Math.max(T,It);let Bt=ot.getBBox();I=Math.max(I,Bt.height)});let G=T+h*2+105,rt=C.length*w+h*2+I/2,U=n.padding,Et=F-n.padding-G,Ht=n.padding,Yt=X-n.padding-rt;c=Math.max(U,Math.min(c,Et)),i=Math.max(Ht,Math.min(i,Yt)),z.forEach((dt,ot)=>{dt.attr("x",c+h).attr("y",i+h+(ot+1)*w)}),M.insert("rect","text").attr("x",c).attr("y",i).attr("width",G).attr("height",rt).attr("fill","white").attr("stroke",x.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(N.notes.length>0){let a=Y.append("g").attr("class","wardley-notes");N.notes.forEach((c)=>{let i=q(c.x),h=V(c.y);a.append("text").attr("x",i).attr("y",h).attr("text-anchor","start").attr("font-size",11).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.text)})}if(N.accelerators.length>0){let a=Y.append("g").attr("class","wardley-accelerators");N.accelerators.forEach((c)=>{let i=q(c.x),h=V(c.y),w=60,P=30,M=20,C=`
|
|
3
|
+
M ${i} ${h-15}
|
|
4
|
+
L ${i+60-20} ${h-15}
|
|
5
|
+
L ${i+60-20} ${h-15-8}
|
|
6
|
+
L ${i+60} ${h}
|
|
7
|
+
L ${i+60-20} ${h+15+8}
|
|
8
|
+
L ${i+60-20} ${h+15}
|
|
9
|
+
L ${i} ${h+15}
|
|
10
|
+
Z
|
|
11
|
+
`;a.append("path").attr("d",C).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",1),a.append("text").attr("x",i+30).attr("y",h+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.name)})}if(N.deaccelerators.length>0){let a=Y.append("g").attr("class","wardley-deaccelerators");N.deaccelerators.forEach((c)=>{let i=q(c.x),h=V(c.y),w=60,P=30,M=20,C=`
|
|
12
|
+
M ${i+60} ${h-15}
|
|
13
|
+
L ${i+20} ${h-15}
|
|
14
|
+
L ${i+20} ${h-15-8}
|
|
15
|
+
L ${i} ${h}
|
|
16
|
+
L ${i+20} ${h+15+8}
|
|
17
|
+
L ${i+20} ${h+15}
|
|
18
|
+
L ${i+60} ${h+15}
|
|
19
|
+
Z
|
|
20
|
+
`;a.append("path").attr("d",C).attr("fill","white").attr("stroke",x.componentStroke).attr("stroke-width",1),a.append("text").attr("x",i+30).attr("y",h+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",x.axisTextColor).attr("font-weight","bold").text(c.name)})}},"draw"),_t={draw:Vt},Zt=e(({wardley:o}={})=>{let l=j(),s=u(),S=E(l,s.themeVariables),n=E(S.wardley,o);return`
|
|
21
|
+
.wardley-background {
|
|
22
|
+
fill: ${n.backgroundColor};
|
|
23
|
+
}
|
|
24
|
+
.wardley-axes line, .wardley-axes path {
|
|
25
|
+
stroke: ${n.axisColor};
|
|
26
|
+
}
|
|
27
|
+
.wardley-axis-label {
|
|
28
|
+
fill: ${n.axisTextColor};
|
|
29
|
+
}
|
|
30
|
+
.wardley-stage-label {
|
|
31
|
+
fill: ${n.axisTextColor};
|
|
32
|
+
}
|
|
33
|
+
.wardley-grid line {
|
|
34
|
+
stroke: ${n.gridColor};
|
|
35
|
+
}
|
|
36
|
+
.wardley-node circle {
|
|
37
|
+
fill: ${n.componentFill};
|
|
38
|
+
stroke: ${n.componentStroke};
|
|
39
|
+
}
|
|
40
|
+
.wardley-node-label {
|
|
41
|
+
fill: ${n.componentLabelColor};
|
|
42
|
+
}
|
|
43
|
+
.wardley-link {
|
|
44
|
+
stroke: ${n.linkStroke};
|
|
45
|
+
}
|
|
46
|
+
.wardley-link--dashed {
|
|
47
|
+
stroke-dasharray: 4 4;
|
|
48
|
+
}
|
|
49
|
+
.wardley-link-label {
|
|
50
|
+
fill: ${n.axisTextColor};
|
|
51
|
+
}
|
|
52
|
+
.wardley-trend line {
|
|
53
|
+
stroke: ${n.evolutionStroke};
|
|
54
|
+
}
|
|
55
|
+
.wardley-annotation-line {
|
|
56
|
+
stroke: ${n.annotationStroke};
|
|
57
|
+
}
|
|
58
|
+
.wardley-annotation circle {
|
|
59
|
+
fill: ${n.annotationFill};
|
|
60
|
+
stroke: ${n.annotationStroke};
|
|
61
|
+
}
|
|
62
|
+
.wardley-annotation text {
|
|
63
|
+
fill: ${n.annotationTextColor};
|
|
64
|
+
}
|
|
65
|
+
.wardley-annotations-box rect {
|
|
66
|
+
fill: ${n.annotationFill};
|
|
67
|
+
stroke: ${n.annotationStroke};
|
|
68
|
+
}
|
|
69
|
+
.wardley-annotations-box text {
|
|
70
|
+
fill: ${n.annotationTextColor};
|
|
71
|
+
}
|
|
72
|
+
.wardley-pipeline-box {
|
|
73
|
+
stroke: ${n.componentStroke};
|
|
74
|
+
}
|
|
75
|
+
.wardley-notes text {
|
|
76
|
+
fill: ${n.axisTextColor};
|
|
77
|
+
}
|
|
78
|
+
`},"styles"),oe={parser:ft,db:Dt,renderer:_t,styles:Zt};export{oe as diagram};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{e,t,j,x,u,w,k,d,f,p,m,g,b,v,Le,A,E,Ei}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import"./index-5tv8v1hk.js";import{pe}from"./index-gf4e0et4.js";import{Oe}from"./index-194m3hc3.js";import{Ue}from"./index-hj99nz1f.js";function vt(i,s,a){i=+i,s=+s,a=(o=arguments.length)<2?(s=i,i=0,1):o<3?1:+a;var n=-1,o=Math.max(0,Math.ceil((s-i)/a))|0,c=Array(o);while(++n<o)c[n]=i+n*a;return c}function dt(){var i=pe().unknown(void 0),{domain:s,range:a}=i,n=0,o=1,c,y,T=!1,V=0,F=0,N=0.5;delete i.unknown;function O(){var L=s().length,G=o<n,Y=G?o:n,H=G?n:o;if(c=(H-Y)/Math.max(1,L-V+F*2),T)c=Math.floor(c);if(Y+=(H-Y-c*(L-V))*N,y=c*(1-V),T)Y=Math.round(Y),y=Math.round(y);var Q=vt(L).map(function(st){return Y+c*st});return a(G?Q.reverse():Q)}return i.domain=function(L){return arguments.length?(s(L),O()):s()},i.range=function(L){return arguments.length?([n,o]=L,n=+n,o=+o,O()):[n,o]},i.rangeRound=function(L){return[n,o]=L,n=+n,o=+o,T=!0,O()},i.bandwidth=function(){return y},i.step=function(){return c},i.round=function(L){return arguments.length?(T=!!L,O()):T},i.padding=function(L){return arguments.length?(V=Math.min(1,F=+L),O()):V},i.paddingInner=function(L){return arguments.length?(V=Math.min(1,L),O()):V},i.paddingOuter=function(L){return arguments.length?(F=+L,O()):F},i.align=function(L){return arguments.length?(N=Math.max(0,Math.min(1,L)),O()):N},i.copy=function(){return dt(s(),[n,o]).round(T).paddingInner(V).paddingOuter(F).align(N)},Ue.apply(O(),arguments)}var Lt=function(){var i=e(function(tt,h,l,S){for(l=l||{},S=tt.length;S--;l[tt[S]]=h);return l},"o"),s=[1,10,12,14,16,18,19,21,23],a=[2,6],n=[1,3],o=[1,5],c=[1,6],y=[1,7],T=[1,5,10,12,14,16,18,19,21,23,36,37,38],V=[1,25],F=[1,26],N=[1,28],O=[1,29],L=[1,30],G=[1,31],Y=[1,32],H=[1,33],Q=[1,34],st=[1,35],nt=[1,36],P=[1,37],Z=[1,43],C=[1,42],K=[1,47],J=[1,50],M=[1,10,12,14,16,18,19,21,23,36,37,38],rt=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],U=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],ut=[1,65],W=[26,28],I={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:e(function(h,l,S,R,z,r,ht){var _=r.length-1;switch(z){case 5:R.setOrientation(r[_]);break;case 9:R.setDiagramTitle(r[_].text.trim());break;case 12:R.setLineData({text:"",type:"text"},r[_]);break;case 13:R.setLineData(r[_-1],r[_]);break;case 14:R.setBarData({text:"",type:"text"},r[_]);break;case 15:R.setBarData(r[_-1],r[_]);break;case 16:this.$=r[_].trim(),R.setAccTitle(this.$);break;case 17:case 18:this.$=r[_].trim(),R.setAccDescription(this.$);break;case 19:this.$=r[_-1];break;case 20:case 30:this.$=[r[_-2],...r[_]];break;case 21:case 31:this.$=[r[_]];break;case 22:this.$={value:Number(r[_-1]),label:r[_]};break;case 23:this.$={value:Number(r[_]),label:""};break;case 24:R.setXAxisTitle(r[_]);break;case 25:R.setXAxisTitle(r[_-1]);break;case 26:R.setXAxisTitle({type:"text",text:""});break;case 27:R.setXAxisBand(r[_]);break;case 28:R.setXAxisRangeData(Number(r[_-2]),Number(r[_]));break;case 29:this.$=r[_-1];break;case 32:R.setYAxisTitle(r[_]);break;case 33:R.setYAxisTitle(r[_-1]);break;case 34:R.setYAxisTitle({type:"text",text:""});break;case 35:R.setYAxisRangeData(Number(r[_-2]),Number(r[_]));break;case 39:this.$={text:r[_],type:"text"};break;case 40:this.$={text:r[_],type:"text"};break;case 41:this.$={text:r[_],type:"markdown"};break;case 42:this.$=r[_];break;case 43:this.$=r[_-1]+""+r[_];break}},"anonymous"),table:[i(s,a,{3:1,4:2,7:4,5:n,36:o,37:c,38:y}),{1:[3]},i(s,a,{4:2,7:4,3:8,5:n,36:o,37:c,38:y}),i(s,a,{4:2,7:4,6:9,3:10,5:n,8:[1,11],36:o,37:c,38:y}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},i(T,[2,36]),i(T,[2,37]),i(T,[2,38]),{1:[2,1]},i(s,a,{4:2,7:4,3:21,5:n,36:o,37:c,38:y}),{1:[2,3]},i(T,[2,5]),i(s,[2,7],{4:22,36:o,37:c,38:y}),{11:23,30:V,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:39,13:38,24:Z,29:C,30:V,31:40,32:41,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:45,15:44,29:K,30:V,35:46,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:49,17:48,24:J,30:V,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{11:52,17:51,24:J,30:V,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},{20:[1,53]},{22:[1,54]},i(M,[2,18]),{1:[2,2]},i(M,[2,8]),i(M,[2,9]),i(rt,[2,39],{41:55,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P}),i(rt,[2,40]),i(rt,[2,41]),i(U,[2,42]),i(U,[2,44]),i(U,[2,45]),i(U,[2,46]),i(U,[2,47]),i(U,[2,48]),i(U,[2,49]),i(U,[2,50]),i(U,[2,51]),i(U,[2,52]),i(U,[2,53]),i(M,[2,10]),i(M,[2,24],{32:41,31:56,24:Z,29:C}),i(M,[2,26]),i(M,[2,27]),{33:[1,57]},{11:59,30:V,34:58,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},i(M,[2,11]),i(M,[2,32],{35:60,29:K}),i(M,[2,34]),{33:[1,61]},i(M,[2,12]),{17:62,24:J},{25:63,27:64,29:ut},i(M,[2,14]),{17:66,24:J},i(M,[2,16]),i(M,[2,17]),i(U,[2,43]),i(M,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},i(M,[2,33]),{29:[1,70]},i(M,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},i(W,[2,23],{30:[1,73]}),i(M,[2,15]),i(M,[2,28]),i(M,[2,29]),{11:59,30:V,34:74,39:24,40:F,41:27,42:N,43:O,44:L,45:G,46:Y,47:H,48:Q,49:st,50:nt,51:P},i(M,[2,35]),i(M,[2,19]),{25:75,27:64,29:ut},i(W,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:e(function(h,l){if(l.recoverable)this.trace(h);else{var S=Error(h);throw S.hash=l,S}},"parseError"),parse:e(function(h){var l=this,S=[0],R=[],z=[null],r=[],ht=this.table,_="",yt=0,Xt=0,Yt=0,ge=2,Nt=1,xe=r.slice.call(arguments,1),X=Object.create(this.lexer),lt={yy:{}};for(var St in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,St))lt.yy[St]=this.yy[St];if(X.setInput(h,lt.yy),lt.yy.lexer=X,lt.yy.parser=this,typeof X.yylloc>"u")X.yylloc={};var Rt=X.yylloc;r.push(Rt);var de=X.options&&X.options.ranges;if(typeof lt.yy.parseError==="function")this.parseError=lt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function fe(it){S.length=S.length-2*it,z.length=z.length-it,r.length=r.length-it}e(fe,"popStack");function Ht(){var it=R.pop()||X.lex()||Nt;if(typeof it!=="number"){if(it instanceof Array)R=it,it=R.pop();it=l.symbols_[it]||it}return it}e(Ht,"lex");var q,_t,ct,et,Pe,Tt,gt={},At,ot,$t,kt;while(!0){if(ct=S[S.length-1],this.defaultActions[ct])et=this.defaultActions[ct];else{if(q===null||typeof q>"u")q=Ht();et=ht[ct]&&ht[ct][q]}if(typeof et>"u"||!et.length||!et[0]){var Dt="";kt=[];for(At in ht[ct])if(this.terminals_[At]&&At>ge)kt.push("'"+this.terminals_[At]+"'");if(X.showPosition)Dt="Parse error on line "+(yt+1)+`:
|
|
2
|
+
`+X.showPosition()+`
|
|
3
|
+
Expecting `+kt.join(", ")+", got '"+(this.terminals_[q]||q)+"'";else Dt="Parse error on line "+(yt+1)+": Unexpected "+(q==Nt?"end of input":"'"+(this.terminals_[q]||q)+"'");this.parseError(Dt,{text:X.match,token:this.terminals_[q]||q,line:X.yylineno,loc:Rt,expected:kt})}if(et[0]instanceof Array&&et.length>1)throw Error("Parse Error: multiple actions possible at state: "+ct+", token: "+q);switch(et[0]){case 1:if(S.push(q),z.push(X.yytext),r.push(X.yylloc),S.push(et[1]),q=null,!_t){if(Xt=X.yyleng,_=X.yytext,yt=X.yylineno,Rt=X.yylloc,Yt>0)Yt--}else q=_t,_t=null;break;case 2:if(ot=this.productions_[et[1]][1],gt.$=z[z.length-ot],gt._$={first_line:r[r.length-(ot||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(ot||1)].first_column,last_column:r[r.length-1].last_column},de)gt._$.range=[r[r.length-(ot||1)].range[0],r[r.length-1].range[1]];if(Tt=this.performAction.apply(gt,[_,Xt,yt,lt.yy,et[1],z,r].concat(xe)),typeof Tt<"u")return Tt;if(ot)S=S.slice(0,-1*ot*2),z=z.slice(0,-1*ot),r=r.slice(0,-1*ot);S.push(this.productions_[et[1]][0]),z.push(gt.$),r.push(gt._$),$t=ht[S[S.length-2]][S[S.length-1]],S.push($t);break;case 3:return!0}}return!0},"parse")},at=function(){var tt={EOF:1,parseError:e(function(l,S){if(this.yy.parser)this.yy.parser.parseError(l,S);else throw Error(l)},"parseError"),setInput:e(function(h,l){if(this.yy=l||this.yy||{},this._input=h,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];return this.offset=0,this},"setInput"),input:e(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var l=h.match(/(?:\r\n?|\n).*/g);if(l)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),h},"input"),unput:e(function(h){var l=h.length,S=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var R=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),S.length-1)this.yylineno-=S.length-1;var z=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:S?(S.length===R.length?this.yylloc.first_column:0)+R[R.length-S.length].length-S[0].length:this.yylloc.first_column-l},this.options.ranges)this.yylloc.range=[z[0],z[0]+this.yyleng-l];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(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
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(h){this.unput(this.match.slice(h))},"less"),pastInput:e(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var h=this.match;if(h.length<20)h+=this._input.substr(0,20-h.length);return(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var h=this.pastInput(),l=Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
5
|
+
`+l+"^"},"showPosition"),test_match:e(function(h,l){var S,R,z;if(this.options.backtrack_lexer){if(z={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)z.yylloc.range=this.yylloc.range.slice(0)}if(R=h[0].match(/(?:\r\n?|\n).*/g),R)this.yylineno+=R.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:R?R[R.length-1].length-R[R.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(h[0].length),this.matched+=h[0],S=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(S)return S;else if(this._backtrack){for(var r in z)this[r]=z[r];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var h,l,S,R;if(!this._more)this.yytext="",this.match="";var z=this._currentRules();for(var r=0;r<z.length;r++)if(S=this._input.match(this.rules[z[r]]),S&&(!l||S[0].length>l[0].length)){if(l=S,R=r,this.options.backtrack_lexer)if(h=this.test_match(S,z[r]),h!==!1)return h;else if(this._backtrack){l=!1;continue}else return!1;else if(!this.options.flex)break}if(l){if(h=this.test_match(l,z[R]),h!==!1)return h;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var l=this.next();if(l)return l;else return this.lex()},"lex"),begin:e(function(l){this.conditionStack.push(l)},"begin"),popState:e(function(){var l=this.conditionStack.length-1;if(l>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(l){if(l=this.conditionStack.length-1-Math.abs(l||0),l>=0)return this.conditionStack[l];else return"INITIAL"},"topState"),pushState:e(function(l){this.begin(l)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(l,S,R,z){var r=z;switch(R){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return tt}();I.lexer=at;function B(){this.yy={}}return e(B,"Parser"),B.prototype=I,I.Parser=B,new B}();Lt.parser=Lt;var me=Lt;function Pt(i){return i.type==="bar"}e(Pt,"isBarPlot");function wt(i){return i.type==="band"}e(wt,"isBandAxisData");function xt(i){return i.type==="linear"}e(xt,"isLinearAxisData");var Gt=class{constructor(i){this.parentGroup=i}static{e(this,"TextDimensionCalculatorWithFont")}getMaxDimension(i,s){if(!this.parentGroup)return{width:i.reduce((o,c)=>Math.max(c.length,o),0)*s,height:s};let a={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",s);for(let o of i){let c=Ei(n,1,o),y=c?c.width:o.length*s,T=c?c.height:s;a.width=Math.max(a.width,y),a.height=Math.max(a.height,T)}return n.remove(),a}},Ut=0.7,qt=0.2,jt=class{constructor(i,s,a,n){this.axisConfig=i,this.title=s,this.textDimensionCalculator=a,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{e(this,"BaseAxis")}setRange(i){if(this.range=i,this.axisPosition==="left"||this.axisPosition==="right")this.boundingRect.height=i[1]-i[0];else this.boundingRect.width=i[1]-i[0];this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(i){this.axisPosition=i,this.setRange(this.range)}getTickDistance(){let i=this.getRange();return Math.abs(i[0]-i[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((i)=>i.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){if(Ut*this.getTickDistance()>this.outerPadding*2)this.outerPadding=Math.floor(Ut*this.getTickDistance()/2);this.recalculateScale()}calculateSpaceIfDrawnHorizontally(i){let s=i.height;if(this.axisConfig.showAxisLine&&s>this.axisConfig.axisLineWidth)s-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let a=this.getLabelDimension(),n=qt*i.width;this.outerPadding=Math.min(a.width/2,n);let o=a.height;if(this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0)o=Math.max(o,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*a.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*a.height));if(o+=this.axisConfig.labelPadding*2,this.labelTextHeight=a.height,o<=s)s-=o,this.showLabel=!0}if(this.axisConfig.showTick&&s>=this.axisConfig.tickLength)this.showTick=!0,s-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let a=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=a.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=a.height,n<=s)s-=n,this.showTitle=!0}this.boundingRect.width=i.width,this.boundingRect.height=i.height-s}calculateSpaceIfDrawnVertical(i){let s=i.width;if(this.axisConfig.showAxisLine&&s>this.axisConfig.axisLineWidth)s-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let a=this.getLabelDimension(),n=qt*i.height;this.outerPadding=Math.min(a.height/2,n);let o=a.width+this.axisConfig.labelPadding*2;if(o<=s)s-=o,this.showLabel=!0}if(this.axisConfig.showTick&&s>=this.axisConfig.tickLength)this.showTick=!0,s-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let a=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=a.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=a.height,n<=s)s-=n,this.showTitle=!0}this.boundingRect.width=i.width-s,this.boundingRect.height=i.height}calculateSpace(i){if(this.axisPosition==="left"||this.axisPosition==="right")this.calculateSpaceIfDrawnVertical(i);else this.calculateSpaceIfDrawnHorizontally(i);return this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(i){this.boundingRect.x=i.x,this.boundingRect.y=i.y}calculateOffsetByRotation(i){let s=this.normalizedLabelRotationInRad;if(s===0)return 0;return Math.sin(s)*this.getLabelDimension()[i]/2}getDrawableElementsForLeftAxis(){let i=[];if(this.showAxisLine){let s=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;i.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${s},${this.boundingRect.y} L ${s},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)i.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((s)=>({text:s.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(s),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))});if(this.showTick){let s=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);i.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((a)=>({path:`M ${s},${this.getScaleValue(a)} L ${s-this.axisConfig.tickLength},${this.getScaleValue(a)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)i.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]});return i}getDrawableElementsForBottomAxis(){let i=[];if(this.showAxisLine){let s=this.boundingRect.y+this.axisConfig.axisLineWidth/2;i.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${s} L ${this.boundingRect.x+this.boundingRect.width},${s}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)i.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((s)=>({text:s.toString(),x:this.getScaleValue(s)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let s=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);i.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((a)=>({path:`M ${this.getScaleValue(a)},${s} L ${this.getScaleValue(a)},${s+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)i.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return i}getDrawableElementsForTopAxis(){let i=[];if(this.showAxisLine){let s=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;i.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${s} L ${this.boundingRect.x+this.boundingRect.width},${s}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)i.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((s)=>({text:s.toString(),x:this.getScaleValue(s),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let s=this.boundingRect.y;i.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((a)=>({path:`M ${this.getScaleValue(a)},${s+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(a)},${s+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)i.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return i}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");if(this.axisPosition==="bottom")return this.getDrawableElementsForBottomAxis();if(this.axisPosition==="top")return this.getDrawableElementsForTopAxis();return[]}},be=class extends jt{static{e(this,"BandAxis")}constructor(i,s,a,n,o){super(i,n,o,s);this.categories=a,this.scale=dt().domain(this.categories).range(this.getRange())}setRange(i){super.setRange(i)}recalculateScale(){this.scale=dt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5),t.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(i){return this.scale(i)??this.getRange()[0]}},ye=class extends jt{static{e(this,"LinearAxis")}constructor(i,s,a,n,o){super(i,n,o,s);this.domain=a,this.scale=Oe().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let i=[...this.domain];if(this.axisPosition==="left")i.reverse();this.scale=Oe().domain(i).range(this.getRange())}getScaleValue(i){return this.scale(i)}};function Et(i,s,a,n){let o=new Gt(n);if(wt(i))return new be(s,a,i.categories,i.title,o);return new ye(s,a,[i.min,i.max],i.title,o)}e(Et,"getAxis");var Ae=class{constructor(i,s,a,n){this.textDimensionCalculator=i,this.chartConfig=s,this.chartData=a,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{e(this,"ChartTitle")}setBoundingBoxXY(i){this.boundingRect.x=i.x,this.boundingRect.y=i.y}calculateSpace(i){let s=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),a=Math.max(s.width,i.width),n=s.height+2*this.chartConfig.titlePadding;if(s.width<=a&&s.height<=n&&this.chartConfig.showTitle&&this.chartData.title)this.boundingRect.width=a,this.boundingRect.height=n,this.showChartTitle=!0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let i=[];if(this.showChartTitle)i.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]});return i}};function Qt(i,s,a,n){let o=new Gt(n);return new Ae(o,i,s,a)}e(Qt,"getChartTitleComponent");var ke=class{constructor(i,s,a,n,o){this.plotData=i,this.xAxis=s,this.yAxis=a,this.orientation=n,this.plotIndex=o}static{e(this,"LinePlot")}getDrawableElement(){let i=this.plotData.data.map((n)=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),s;if(this.orientation==="horizontal")s=Le().y((n)=>n[0]).x((n)=>n[1])(i);else s=Le().x((n)=>n[0]).y((n)=>n[1])(i);if(!s)return[];let a=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:s,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let c=[];for(let[y,[T,V]]of i.entries()){let F=this.plotData.pointLabels[y];if(!F)continue;if(this.orientation==="horizontal")c.push({x:V+10,y:T,text:F,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0});else c.push({x:T,y:V-10,text:F,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0})}if(c.length>0)a.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:c})}return a}},we=class{constructor(i,s,a,n,o,c){this.barData=i,this.boundingRect=s,this.xAxis=a,this.yAxis=n,this.orientation=o,this.plotIndex=c}static{e(this,"BarPlot")}getDrawableElement(){let i=this.barData.data.map((o)=>[this.xAxis.getScaleValue(o[0]),this.yAxis.getScaleValue(o[1])]),s=0.05,a=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*0.95,n=a/2;if(this.orientation==="horizontal")return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:i.map((o)=>({x:this.boundingRect.x,y:o[0]-n,height:a,width:o[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}];return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:i.map((o)=>({x:o[0]-n,y:o[1],width:a,height:this.boundingRect.y+this.boundingRect.height-o[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},Ce=class{constructor(i,s,a){this.chartConfig=i,this.chartData=s,this.chartThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0}}static{e(this,"BasePlot")}setAxes(i,s){this.xAxis=i,this.yAxis=s}setBoundingBoxXY(i){this.boundingRect.x=i.x,this.boundingRect.y=i.y}calculateSpace(i){return this.boundingRect.width=i.width,this.boundingRect.height=i.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let i=[];for(let[s,a]of this.chartData.plots.entries())switch(a.type){case"line":{let n=new ke(a,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,s);i.push(...n.getDrawableElement())}break;case"bar":{let n=new we(a,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,s);i.push(...n.getDrawableElement())}break}return i}};function Kt(i,s,a){return new Ce(i,s,a)}e(Kt,"getPlotComponent");var Se=class{constructor(i,s,a,n){this.chartConfig=i,this.chartData=s,this.componentStore={title:Qt(i,s,a,n),plot:Kt(i,s,a),xAxis:Et(s.xAxis,i.xAxis,{titleColor:a.xAxisTitleColor,labelColor:a.xAxisLabelColor,tickColor:a.xAxisTickColor,axisLineColor:a.xAxisLineColor},n),yAxis:Et(s.yAxis,i.yAxis,{titleColor:a.yAxisTitleColor,labelColor:a.yAxisLabelColor,tickColor:a.yAxisTickColor,axisLineColor:a.yAxisLineColor},n)}}static{e(this,"Orchestrator")}calculateVerticalSpace(){let i=this.chartConfig.width,s=this.chartConfig.height,a=0,n=0,o=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),c=Math.floor(s*this.chartConfig.plotReservedSpacePercent/100),y=this.componentStore.plot.calculateSpace({width:o,height:c});if(i-=y.width,s-=y.height,y=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:s}),n=y.height,s-=y.height,this.componentStore.xAxis.setAxisPosition("bottom"),y=this.componentStore.xAxis.calculateSpace({width:i,height:s}),s-=y.height,this.componentStore.yAxis.setAxisPosition("left"),y=this.componentStore.yAxis.calculateSpace({width:i,height:s}),a=y.width,i-=y.width,i>0)o+=i,i=0;if(s>0)c+=s,s=0;if(this.componentStore.plot.calculateSpace({width:o,height:c}),this.componentStore.plot.setBoundingBoxXY({x:a,y:n}),this.componentStore.xAxis.setRange([a,a+o]),this.componentStore.xAxis.setBoundingBoxXY({x:a,y:n+c}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((T)=>Pt(T)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let i=this.chartConfig.width,s=this.chartConfig.height,a=0,n=0,o=0,c=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),y=Math.floor(s*this.chartConfig.plotReservedSpacePercent/100),T=this.componentStore.plot.calculateSpace({width:c,height:y});if(i-=T.width,s-=T.height,T=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:s}),a=T.height,s-=T.height,this.componentStore.xAxis.setAxisPosition("left"),T=this.componentStore.xAxis.calculateSpace({width:i,height:s}),i-=T.width,n=T.width,this.componentStore.yAxis.setAxisPosition("top"),T=this.componentStore.yAxis.calculateSpace({width:i,height:s}),s-=T.height,o=a+T.height,i>0)c+=i,i=0;if(s>0)y+=s,s=0;if(this.componentStore.plot.calculateSpace({width:c,height:y}),this.componentStore.plot.setBoundingBoxXY({x:n,y:o}),this.componentStore.yAxis.setRange([n,n+c]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:a}),this.componentStore.xAxis.setRange([o,o+y]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:o}),this.chartData.plots.some((V)=>Pt(V)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){if(this.chartConfig.chartOrientation==="horizontal")this.calculateHorizontalSpace();else this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let i=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let s of Object.values(this.componentStore))i.push(...s.getDrawableElements());return i}},Re=class{static{e(this,"XYChartBuilder")}static build(i,s,a,n){return new Se(i,s,a,n).getDrawableElement()}},ft=0,Zt,pt=Bt(),mt=zt(),D=Vt(),It=mt.plotColorPalette.split(",").map((i)=>i.trim()),Ct=!1,Mt=!1;function zt(){let i=j(),s=u();return E(i.xyChart,s.themeVariables.xyChart)}e(zt,"getChartDefaultThemeConfig");function Bt(){let i=u();return E(x.xyChart,i.xyChart)}e(Bt,"getChartDefaultConfig");function Vt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}e(Vt,"getChartDefaultData");function bt(i){let s=u();return w(i.trim(),s)}e(bt,"textSanitizer");function Jt(i){Zt=i}e(Jt,"setTmpSVGG");function te(i){if(i==="horizontal")pt.chartOrientation="horizontal";else pt.chartOrientation="vertical"}e(te,"setOrientation");function ee(i){D.xAxis.title=bt(i.text)}e(ee,"setXAxisTitle");function Ot(i,s){D.xAxis={type:"linear",title:D.xAxis.title,min:i,max:s},Ct=!0}e(Ot,"setXAxisRangeData");function ie(i){D.xAxis={type:"band",title:D.xAxis.title,categories:i.map((s)=>bt(s.text))},Ct=!0}e(ie,"setXAxisBand");function se(i){D.yAxis.title=bt(i.text)}e(se,"setYAxisTitle");function ae(i,s){D.yAxis={type:"linear",title:D.yAxis.title,min:i,max:s},Mt=!0}e(ae,"setYAxisRangeData");function ne(i){let s=Math.min(...i),a=Math.max(...i),n=xt(D.yAxis)?D.yAxis.min:1/0,o=xt(D.yAxis)?D.yAxis.max:-1/0;D.yAxis={type:"linear",title:D.yAxis.title,min:Math.min(n,s),max:Math.max(o,a)}}e(ne,"setYAxisRangeFromPlotData");function Wt(i){let s=[];if(i.length===0)return s;if(!Ct){let a=xt(D.xAxis)?D.xAxis.min:1/0,n=xt(D.xAxis)?D.xAxis.max:-1/0;Ot(Math.min(a,1),Math.max(n,i.length))}if(wt(D.xAxis)&&i.length>D.xAxis.categories.length)i=i.slice(0,D.xAxis.categories.length);if(!Mt)ne(i);if(wt(D.xAxis))s=D.xAxis.categories.map((a,n)=>[a,i[n]]);if(xt(D.xAxis)){let a=D.xAxis.min,n=D.xAxis.max;if(i.length===1)s=[[`${a}`,i[0]]];else{let o=(n-a)/(i.length-1);s=i.map((c,y)=>[`${a+y*o}`,c])}}return s}e(Wt,"transformDataWithoutCategory");function Ft(i){return It[i===0?0:i%It.length]}e(Ft,"getPlotColorFromPalette");function oe(i,s){let a=s.map((y)=>y.value),n=s.map((y)=>y.label?bt(y.label):""),o=Wt(a),c=n.some((y)=>y!=="");D.plots.push({type:"line",strokeFill:Ft(ft),strokeWidth:2,data:o,...c?{pointLabels:n}:{}}),ft++}e(oe,"setLineData");function re(i,s){let a=s.map((o)=>o.value),n=Wt(a);D.plots.push({type:"bar",fill:Ft(ft),data:n}),ft++}e(re,"setBarData");function he(){if(D.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return D.title=v(),Re.build(pt,D,mt,Zt)}e(he,"getDrawableElem");function le(){return mt}e(le,"getChartThemeConfig");function ce(){return pt}e(ce,"getChartConfig");function ue(){return D}e(ue,"getXYChartData");var _e=e(function(){d(),ft=0,pt=Bt(),D=Vt(),mt=zt(),It=mt.plotColorPalette.split(",").map((i)=>i.trim()),Ct=!1,Mt=!1},"clear"),Te={getDrawableElem:he,clear:_e,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m,setOrientation:te,setXAxisTitle:ee,setXAxisRangeData:Ot,setXAxisBand:ie,setYAxisTitle:se,setYAxisRangeData:ae,setLineData:oe,setBarData:re,setTmpSVGG:Jt,getChartThemeConfig:le,getChartConfig:ce,getXYChartData:ue},De=e((i,s,a,n)=>{let o=n.db,c=o.getChartThemeConfig(),y=o.getChartConfig(),T=o.getXYChartData().plots[0].data.map((P)=>P[1]);function V(P){return P==="top"?"text-before-edge":"middle"}e(V,"getDominantBaseLine");function F(P){return P==="left"?"start":P==="right"?"end":"middle"}e(F,"getTextAnchor");function N(P){return`translate(${P.x}, ${P.y}) rotate(${P.rotation||0})`}e(N,"getTextTransformation"),t.debug(`Rendering xychart chart
|
|
7
|
+
`+i);let O=A(s),L=O.append("g").attr("class","main"),G=L.append("rect").attr("width",y.width).attr("height",y.height).attr("class","background");k(O,y.height,y.width,!0),O.attr("viewBox",`0 0 ${y.width} ${y.height}`),G.attr("fill",c.backgroundColor),o.setTmpSVGG(O.append("g").attr("class","mermaid-tmp-group"));let Y=o.getDrawableElem(),H={};function Q(P){let Z=L,C="";for(let[K]of P.entries()){let J=L;if(K>0&&H[C])J=H[C];if(C+=P[K],Z=H[C],!Z)Z=H[C]=J.append("g").attr("class",P[K])}return Z}e(Q,"getGroup");for(let P of Y){if(P.data.length===0)continue;let Z=Q(P.groupTexts);switch(P.type){case"rect":if(Z.selectAll("rect").data(P.data).enter().append("rect").attr("x",(C)=>C.x).attr("y",(C)=>C.y).attr("width",(C)=>C.width).attr("height",(C)=>C.height).attr("fill",(C)=>C.fill).attr("stroke",(C)=>C.strokeFill).attr("stroke-width",(C)=>C.strokeWidth),y.showDataLabel){let C=y.showDataLabelOutsideBar;if(y.chartOrientation==="horizontal"){let K=function(I,at){let{data:B,label:tt}=I;return at*tt.length*J<=B.width-M};var st=K;e(K,"fitsHorizontally");let J=0.7,M=10,rt=P.data.map((I,at)=>({data:I,label:T[at].toString()})).filter((I)=>I.data.width>0&&I.data.height>0),U=rt.map((I)=>{let{data:at}=I,B=at.height*0.7;while(!K(I,B)&&B>0)B-=1;return B}),ut=Math.floor(Math.min(...U)),W=e((I)=>{if(C)return I.data.x+I.data.width+M;else return I.data.x+I.data.width-M},"determineLabelXPosition");Z.selectAll("text").data(rt).enter().append("text").attr("x",W).attr("y",(I)=>I.data.y+I.data.height/2).attr("text-anchor",C?"start":"end").attr("dominant-baseline","middle").attr("fill",c.dataLabelColor).attr("font-size",`${ut}px`).text((I)=>I.label)}else{let K=function(W,I,at){let{data:B,label:tt}=W,h=0.7,l=I*tt.length*0.7,S=B.x+B.width/2,R=S-l/2,z=S+l/2,r=R>=B.x&&z<=B.x+B.width,ht=B.y+at+I<=B.y+B.height;return r&&ht};var nt=K;e(K,"fitsInBar");let J=10,M=P.data.map((W,I)=>({data:W,label:T[I].toString()})).filter((W)=>W.data.width>0&&W.data.height>0),rt=M.map((W)=>{let{data:I,label:at}=W,B=I.width/(at.length*0.7);while(!K(W,B,J)&&B>0)B-=1;return B}),U=Math.floor(Math.min(...rt)),ut=e((W)=>{if(C)return W.data.y-J;else return W.data.y+J},"determineLabelYPosition");Z.selectAll("text").data(M).enter().append("text").attr("x",(W)=>W.data.x+W.data.width/2).attr("y",ut).attr("text-anchor","middle").attr("dominant-baseline",C?"auto":"hanging").attr("fill",c.dataLabelColor).attr("font-size",`${U}px`).text((W)=>W.label)}}break;case"text":Z.selectAll("text").data(P.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",(C)=>C.fill).attr("font-size",(C)=>C.fontSize).attr("dominant-baseline",(C)=>V(C.verticalPos)).attr("text-anchor",(C)=>F(C.horizontalPos)).attr("transform",(C)=>N(C)).text((C)=>C.text);break;case"path":Z.selectAll("path").data(P.data).enter().append("path").attr("d",(C)=>C.path).attr("fill",(C)=>C.fill?C.fill:"none").attr("stroke",(C)=>C.strokeFill).attr("stroke-width",(C)=>C.strokeWidth);break}}},"draw"),ve={draw:De},je={parser:me,db:Te,renderer:ve};export{je as diagram};
|