@theruansilva/omp-web 2.0.0 → 2.2.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/dist/cli.js +83 -3
- package/dist/cli.js.map +1 -1
- package/dist/client/assets/CodeViewer-DEVekDfo.js +4 -0
- package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/client/assets/{TerminalPanel-B9-LUv7E.js → TerminalPanel-CLZRR8T3.js} +8 -8
- package/dist/client/assets/{UnifiedDiffViewer-BUqme4se.js → UnifiedDiffViewer-DkUYn4xn.js} +2 -2
- package/dist/client/assets/_basePickBy-vr4256UX.js +1 -0
- package/dist/client/assets/_baseUniq-CHc60b6y.js +1 -0
- package/dist/client/assets/abnfDiagram-O67JEVCF-CN3HoUk0.js +1 -0
- package/dist/client/assets/arc-DfCyV39Y.js +1 -0
- package/dist/client/assets/architectureDiagram-NJMV4G6O-B18ZPEpX.js +36 -0
- package/dist/client/assets/blockDiagram-BEXU5L5S-DauyTopu.js +140 -0
- package/dist/client/assets/c4Diagram-YGBWAQC7-BzItBhD8.js +38 -0
- package/dist/client/assets/channel-BeMMNdGw.js +1 -0
- package/dist/client/assets/chunk-2Q5K7J3B-CTeOQu6b.js +1 -0
- package/dist/client/assets/chunk-3FUC2YCW-OWYL0CxB.js +2 -0
- package/dist/client/assets/chunk-5VM5RSS4-BPto9x5-.js +15 -0
- package/dist/client/assets/chunk-GTNCS2PH-DqPy7R2d.js +88 -0
- package/dist/client/assets/chunk-GWA4HPMP-C4N-dUua.js +1 -0
- package/dist/client/assets/chunk-JWPE2WC7-C4b1ijjH.js +1 -0
- package/dist/client/assets/chunk-NETBCI7D-Ds_9Juid.js +1 -0
- package/dist/client/assets/chunk-WEXAMYUT-DC9hisqc.js +1 -0
- package/dist/client/assets/chunk-XXDRQBXY-DZnUPupk.js +1 -0
- package/dist/client/assets/classDiagram-v2-NBCMYWYE-CDSg6Hoa.js +217 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-B4ISJxq4.js +1 -0
- package/dist/client/assets/cynefin-OW5HDTMX-Dk9BE-CS.js +166 -0
- package/dist/client/assets/cynefinDiagram-VND7K2PF-D4LOjD3M.js +62 -0
- package/dist/client/assets/cytoscape.esm-BB4DxJjf.js +321 -0
- package/dist/client/assets/dagre-6A5THRUB-BdboVbbt.js +4 -0
- package/dist/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/client/assets/diagram-22UHCM2B-D_zb_SLQ.js +200 -0
- package/dist/client/assets/diagram-3UASUU5V-D5rEpDmK.js +24 -0
- package/dist/client/assets/diagram-ATOU4E4O-BdTFXxOS.js +3 -0
- package/dist/client/assets/diagram-CDSNMT55-B8gtHdg9.js +30 -0
- package/dist/client/assets/diagram-MLGK6HIB-C-NGINWH.js +24 -0
- package/dist/client/assets/diagram-MPIPVDR6-D3_T-c5C.js +41 -0
- package/dist/client/assets/ebnfDiagram-ZINNZB2B-BIASbt52.js +1 -0
- package/dist/client/assets/elk-276RUBZZ-CuNF0hHg.js +27 -0
- package/dist/client/assets/erDiagram-OPXOYQCR-Cmi_qmGj.js +99 -0
- package/dist/client/assets/flowDiagram-KWPJA3E3-DP-SrXc2.js +213 -0
- package/dist/client/assets/ganttDiagram-FUAMR5RP-olLEnoMM.js +292 -0
- package/dist/client/assets/gitGraphDiagram-X574FWY7-uPZ9lEq1.js +106 -0
- package/dist/client/assets/graph-C2De1HlQ.js +1 -0
- package/dist/client/assets/index-D-PvDSJs.js +5657 -0
- package/dist/client/assets/{index-DGBYb2j9.css → index-DSGiUJZL.css} +1 -1
- package/dist/client/assets/infoDiagram-VRGFBTTK-D0Q5E5gc.js +2 -0
- package/dist/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/client/assets/ishikawaDiagram-OU5B5YK6-C21L3hk6.js +70 -0
- package/dist/client/assets/journeyDiagram-ZHPQQLJL-C9o5XEso.js +139 -0
- package/dist/client/assets/kanban-definition-PNTS6WVX-BioH9OyY.js +89 -0
- package/dist/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/client/assets/linear-BwJ7-DLx.js +1 -0
- package/dist/client/assets/mindmap-definition-NLK3R4M7-ogoKSGSi.js +96 -0
- package/dist/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/client/assets/pegDiagram-GJSIUBJH-Ck2_wE3g.js +1 -0
- package/dist/client/assets/pieDiagram-5QR66LMP-C5wm07EA.js +39 -0
- package/dist/client/assets/quadrantDiagram-O4NWA36T-UKQ2brr3.js +7 -0
- package/dist/client/assets/railroadDiagram-XR7U4H2S-BgY4ABv4.js +1 -0
- package/dist/client/assets/requirementDiagram-PLB6GJNP-B50WsncI.js +84 -0
- package/dist/client/assets/sankeyDiagram-IPEJSGJF-BHtyWxOk.js +40 -0
- package/dist/client/assets/sequenceDiagram-PO4LG4MO-D_kxHIBS.js +169 -0
- package/dist/client/assets/sizeCapture-INFHLROL-MzN60-aT.js +1 -0
- package/dist/client/assets/stateDiagram-v2-GCMORJYK-CBiPlAo0.js +291 -0
- package/dist/client/assets/swimlanes-2SLR337P-BCdsVfp-.js +1 -0
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-Da17CLQY.js +8 -0
- package/dist/client/assets/timeline-definition-EJHVYXUP-BemXf1bb.js +120 -0
- package/dist/client/assets/usecaseDiagram-POWQR4AR-Vqj4Zp6V.js +370 -0
- package/dist/client/assets/vendor-editor-core-BG7M-EQ-.js +10 -0
- package/dist/client/assets/vendor-editor-languages-pDmyn-oC.js +26 -0
- package/dist/client/assets/vennDiagram-UO4OBE2U-2mimeV2G.js +34 -0
- package/dist/client/assets/wardleyDiagram-VNRHLVJA-Bg2MjtpE.js +78 -0
- package/dist/client/assets/xychartDiagram-PMCCYNJV-7_nvdM0t.js +7 -0
- package/dist/client/index.html +4 -4
- package/dist/omp-web-plugins/mcps/mcpsLogic.js +78 -0
- package/dist/omp-web-plugins/mcps/mcpsPanelElement.js +417 -0
- package/dist/omp-web-plugins/mcps/omp-web-plugin.js +45 -0
- package/dist/omp-web-plugins/mcps/package.json +9 -0
- package/dist/omp-web-plugins/mcps/types.js +2 -0
- package/dist/plugin-api.d.ts +1 -0
- package/dist/server/app.js +24 -1
- package/dist/server/app.js.map +1 -1
- package/dist/server/index.js +0 -0
- package/dist/server/machines/machineService.js +3 -0
- package/dist/server/machines/machineService.js.map +1 -1
- package/dist/server/mcpRoutes.js +73 -0
- package/dist/server/mcpRoutes.js.map +1 -0
- package/dist/server/push/PushNotificationService.js +16 -3
- package/dist/server/push/PushNotificationService.js.map +1 -1
- package/dist/server/security.js +172 -0
- package/dist/server/security.js.map +1 -0
- package/dist/server/sessiond/sessionProxyRoutes.js +11 -5
- package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
- package/dist/server/sessiond.js +28 -1
- package/dist/server/sessiond.js.map +1 -1
- package/dist/server/sessions/piAgentSession.js +2 -1
- package/dist/server/sessions/piAgentSession.js.map +1 -1
- package/dist/server/sessions/piSessionService.js +168 -16
- package/dist/server/sessions/piSessionService.js.map +1 -1
- package/dist/server/sessions/schedulePrompt/scheduler.js +17 -13
- package/dist/server/sessions/schedulePrompt/scheduler.js.map +1 -1
- package/dist/server/sessions/schedulePrompt/tool.js +13 -1
- package/dist/server/sessions/schedulePrompt/tool.js.map +1 -1
- package/dist/server/sessions/sessionEventMapper.js +36 -2
- package/dist/server/sessions/sessionEventMapper.js.map +1 -1
- package/dist/server/sessions/sessionRoutes.js +3 -0
- package/dist/server/sessions/sessionRoutes.js.map +1 -1
- package/dist/server/workspaceExplorerRoutes.js +16 -9
- package/dist/server/workspaceExplorerRoutes.js.map +1 -1
- package/dist/server/workspaces/fileContentService.js +9 -4
- package/dist/server/workspaces/fileContentService.js.map +1 -1
- package/dist/server/workspaces/imagePreviewService.js +63 -13
- package/dist/server/workspaces/imagePreviewService.js.map +1 -1
- package/dist/shared/apiTypes.d.ts +16 -1
- package/dist/shared/federatedRoutes.js +2 -0
- package/dist/shared/federatedRoutes.js.map +1 -1
- package/package.json +4 -1
- package/dist/client/assets/CodeViewer-CJNBz-Ox.js +0 -4
- package/dist/client/assets/index-uWm_YNRB.js +0 -4427
- package/dist/client/assets/vendor-editor-core-D9EJm1dE.js +0 -10
- package/dist/client/assets/vendor-editor-languages-N6dcxgRO.js +0 -26
- package/dist/client-react/assets/index-BQ6zLLfz.js +0 -51
- package/dist/client-react/assets/index-Befs78HG.css +0 -1
- package/dist/client-react/index.html +0 -16
- package/dist/docker/piWebDockerCommandPlan.js +0 -211
- package/dist/docker/piWebDockerCommandPlan.js.map +0 -1
- package/dist/pi-web-plugins/info/package.json +0 -9
- package/dist/pi-web-plugins/info/pi-web-plugin.js +0 -51
- package/dist/pi-web-plugins/schedule-prompts/package.json +0 -9
- package/dist/pi-web-plugins/schedule-prompts/pi-web-plugin.js +0 -43
- package/dist/pi-web-plugins/schedule-prompts/schedulePromptsPanelElement.js +0 -226
- package/dist/pi-web-plugins/schedule-prompts/types.js +0 -2
- package/dist/pi-web-plugins/updates/package.json +0 -9
- package/dist/pi-web-plugins/updates/pi-web-plugin.js +0 -173
- package/dist/pi-web-plugins/updates/updatesLogic.js +0 -97
- package/dist/piWebVersionReport.js +0 -225
- package/dist/piWebVersionReport.js.map +0 -1
- package/dist/server/diagnostics/nodePtySpawnHelper.js +0 -130
- package/dist/server/diagnostics/nodePtySpawnHelper.js.map +0 -1
- package/dist/server/piWebPluginService.js +0 -283
- package/dist/server/piWebPluginService.js.map +0 -1
- package/dist/server/piWebStatus.js +0 -602
- package/dist/server/piWebStatus.js.map +0 -1
- package/dist/server/piWebStatusCache.js +0 -32
- package/dist/server/piWebStatusCache.js.map +0 -1
- package/dist/server/workspaces/projectPiWebConfig.js +0 -61
- package/dist/server/workspaces/projectPiWebConfig.js.map +0 -1
- package/dist/shared/piWebStatusParsing.js +0 -102
- package/dist/shared/piWebStatusParsing.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{bg as Wt,s as Kt,g as Ht,t as Yt,q as Xt,a as Zt,b as Qt,_ as w,L as wt,Q as Jt,k as ot,at as $t,a1 as te,a2 as ee,a3 as ne,d as se,A as ie,N as oe,O as re}from"./index-D-PvDSJs.js";import"./vendor-editor-core-BG7M-EQ-.js";import"./vendor-editor-languages-pDmyn-oC.js";const It=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),E=Math.atan2(f.x-p.x,f.y-p.y);let _=E-M;_<0&&(_+=2*Math.PI);const S=E-_/2;let g=q(y,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*r>=0&&(n=a),Math.abs(f)<o||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt($(t,t))}function ft(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Z(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let v=0;v<b;++v){const c=n.slice();c[v]=c[v]?c[v]*i:o,p[v+1]=c,p[v+1].fx=t(c),p[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)p[b][c]=v[c];p[b].fx=v.fx}const E=(v,c)=>v.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v<e;++v){if(p.sort(E),s.history){const x=p.map(d=>{const C=d.slice();return C.fx=d.fx,C.id=d.id,C});x.sort((d,C)=>d.id-C.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x<b;++x)h=Math.max(h,Math.abs(p[0][x]-p[1][x]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let x=0;x<b;++x){_[x]=0;for(let d=0;d<b;++d)_[x]+=p[d][x];_[x]/=b}const c=p[b];if(Z(S,1+f,_,-f,c),S.fx=t(S),S.fx<p[0].fx)Z(m,1+u,_,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let x=!1;if(S.fx>c.fx?(Z(g,1+a,_,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Z(g,1-a*f,_,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):x=!0),x){if(y>=1)break;for(let d=1;d<p.length;++d)Z(p[d],1-y,p[0],y,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(E),{fx:p[0].fx,x:p[0]}}function ue(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,y=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,E){for(let _=0;_<16;++_)if(i=(p+M)/2,Z(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||u>=E)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(Z(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ue(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ft(r,e.fxprime,-1);else{Z(o,1,i.fxprime,-1,e.fxprime);const y=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/y);Z(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||tt,i=he(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=zt(a=>{const y={};for(let h=0;h<r.length;++h){const b=r[h];y[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(y,i)},l,n).x;for(let a=0;a<r.length;++a){const y=r[a];o[y].x=u[2*a],o[y].y=u[2*a+1]}return o}const Rt=1e-10;function ht(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const h=String(f.sets[y]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-y*y;h>0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=de(t,e,i);const l=ut(o.map(ut))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=ct(o.length*2).map(Math.random),p=fe(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,y={};for(let h=0;h<e.length;++h){const b=e[h];y[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ft(h.x,l);return y}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const y of t)if(y.sets.length===1){const h=y.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[h]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;b<i[y].length;++b)h+=i[y][b].size*i[y][b].weight;o.push({set:y,size:h})});function r(y,h){return h.size-y.size}o.sort(r);const l={};function f(y){return y.set in l}function u(y,h){e[h].x=y.x,e[h].y=y.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let y=1;y<o.length;++y){const h=o[y].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ht(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){const v=e[b[m].set],c=ht(p.radius,v.radius,b[m].size),x=Tt({x:S.x,y:S.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,_=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<E&&(E=g,_=S)}u(_,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=xt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const o=Ft(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=dt(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),y=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Ot(o.map(b=>({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in E)return E[x];var d=E[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const C=new Set;d.forEach(I=>{I.size==0&&I.sets.length==1&&C.add(I.sets[0])}),d=d.filter(I=>!I.sets.some(N=>C.has(N)));let k={},D={};if(d.length>0){let I=m(d,{lossFunction:v,distinct:b});l&&(I=Dt(I,r,h)),k=Nt(I,s,e,i,f),D=Lt(k,d,M)}const U={};d.forEach(I=>{I.label&&(U[I.sets]=I.label)});function V(I){if(I.sets in U)return U[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const F=x.select("svg");n?F.attr("viewBox",`0 0 ${s} ${e}`):F.attr("width",s).attr("height",e);const R={};let T=!1;F.selectAll(".venn-area path").each(function(I){const N=this.getAttribute("d");I.sets.length==1&&N&&!b&&(T=!0,R[I.sets[0]]=Me(N))});function A(I){return N=>{const K=I.sets.map(et=>{let Y=R[et],X=k[et];return Y||(Y={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-N)+X.x*N,y:Y.y*(1-N)+X.y*N,radius:Y.radius*(1-N)+X.radius*N}});return St(K,p)}}const G=F.selectAll(".venn-area").data(d,I=>I.sets),P=G.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),B=P.append("path"),W=P.append("text").attr("class","label").text(I=>V(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),W.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function L(I){return typeof I.transition=="function"?I.transition("venn").duration(o):I}let z=x;T&&typeof z.transition=="function"?(z=L(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",I=>St(I.sets.map(N=>k[N])),p);const O=z.selectAll("text").filter(I=>I.sets in D).text(I=>V(I)).attr("x",I=>Math.floor(D[I.sets].x)).attr("y",I=>Math.floor(D[I.sets].y));u&&(T?"on"in O?O.on("end",rt(k,V)):O.each("end",rt(k,V)):O.each(rt(k,V)));const j=L(G.exit()).remove();typeof G.transition=="function"&&j.selectAll("path").attrTween("d",A);const J=j.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(W.style("font-size","0px"),O.style("font-size",y),J.style("font-size","0px")),{circles:k,textCentres:D,nodes:G,enter:P,update:z,exit:j}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Ct:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const E=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function ke(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=ke(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const y=jt(u,a,s);e[r]=y,y.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
|
|
2
|
+
M`,t,n),e.push(`
|
|
3
|
+
m`,-s,0),e.push(`
|
|
4
|
+
a`,s,s,0,1,0,s*2,0),e.push(`
|
|
5
|
+
a`,s,s,0,1,0,-s*2,0),e.join(" ")}function Me(t){const n=t.split(" ");return{x:Number.parseFloat(n[1]),y:Number.parseFloat(n[2]),radius:-Number.parseFloat(n[4])}}function Pt(t){if(t.length===0)return[];const n={};return st(t,n),n.arcs}function Bt(t,n){if(t.length===0)return"M 0 0";const s=Math.pow(10,n||0),e=n!=null?o=>Math.round(o*s)/s:o=>o;if(t.length==1){const o=t[0].circle;return Ie(e(o.x),e(o.y),e(o.radius))}const i=[`
|
|
6
|
+
M`,e(t[0].p2.x),e(t[0].p2.y)];for(const o of t){const r=e(o.circle.radius);i.push(`
|
|
7
|
+
A`,r,r,0,o.large?1:0,o.sweep?1:0,e(o.p1.x),e(o.p1.y))}return i.join(" ")}function St(t,n){return Bt(Pt(t),n)}function Se(t,n={}){const{lossFunction:s,layoutFunction:e=At,normalize:i=!0,orientation:o=Math.PI/2,orientationOrder:r,width:l=600,height:f=350,padding:u=15,scaleToFit:a=!1,symmetricalTextCentre:y=!1,distinct:h,round:b=2}=n;let p=e(t,{lossFunction:s==="default"||!s?tt:s==="logRatio"?Ct:s,distinct:h});i&&(p=Dt(p,o,r));const M=Nt(p,l,f,u,a),E=Lt(M,t,y),_=new Map(Object.keys(M).map(m=>[m,{set:m,x:M[m].x,y:M[m].y,radius:M[m].radius}])),S=t.map(m=>{const v=m.sets.map(d=>_.get(d)),c=Pt(v),x=Bt(c,b);return{circles:v,arcs:c,path:x,area:m,has:new Set(m.sets)}});function g(m){let v="";for(const c of S)c.has.size>m.length&&m.every(x=>c.has.has(x))&&(v+=" "+c.path);return v}return S.map(({circles:m,arcs:v,path:c,area:x})=>({data:x,text:E[x.sets],circles:m,arcs:v,path:c,distinctPath:c+g(x.sets)}))}var gt=(function(){var t=w(function(S,g,m,v){for(m=m||{},v=S.length;v--;m[S[v]]=g);return m},"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],e=[1,17],i=[1,18],o=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],r=[1,31],l=[1,39],f=[7,8,11,12,17,19,22,24,27],u=[1,57],a=[1,56],y=[1,58],h=[1,59],b=[1,60],p=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],M={trace:w(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:w(function(g,m,v,c,x,d,C){var k=d.length-1;switch(x){case 1:return d[k-1];case 2:case 3:case 4:this.$=[];break;case 5:d[k-1].push(d[k]),this.$=d[k-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=d[k];break;case 8:c.setDiagramTitle(d[k].substr(6)),this.$=d[k].substr(6);break;case 9:c.addSubsetData([d[k]],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 10:c.addSubsetData([d[k-1]],d[k],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 11:c.addSubsetData([d[k-2]],void 0,parseFloat(d[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 12:c.addSubsetData([d[k-3]],d[k-2],parseFloat(d[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 13:if(d[k].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(d[k]),c.addSubsetData(d[k],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 14:if(d[k-1].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(d[k-1]),c.addSubsetData(d[k-1],d[k],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 15:if(d[k-2].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(d[k-2]),c.addSubsetData(d[k-2],void 0,parseFloat(d[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 16:if(d[k-3].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(d[k-3]),c.addSubsetData(d[k-3],d[k-2],parseFloat(d[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 17:case 18:case 19:c.addTextData(d[k-1],d[k],void 0);break;case 20:case 21:c.addTextData(d[k-2],d[k-1],d[k]);break;case 23:c.addStyleData(d[k-1],d[k]);break;case 24:case 25:case 26:var D=c.getCurrentSets();if(!D)throw new Error("text requires set");c.addTextData(D,d[k],void 0);break;case 27:case 28:var D=c.getCurrentSets();if(!D)throw new Error("text requires set");c.addTextData(D,d[k-1],d[k]);break;case 29:case 41:this.$=[d[k]];break;case 30:case 42:this.$=[...d[k-2],d[k]];break;case 31:this.$=[d[k-2],d[k]];break;case 33:this.$=d[k].join(" ");break;case 34:this.$=[d[k]];break;case 35:d[k-1].push(d[k]),this.$=d[k-1];break;case 43:case 44:this.$=d[k];break}},"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,[2,4],{6:5}),t(n,[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(s,[2,5]),t(s,[2,6]),t(s,[2,7]),t(s,[2,8]),{13:16,20:e,21:i},{13:20,18:19,20:e,21:i},{13:20,18:21,20:e,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:e,21:i},t(s,[2,9],{14:[1,27],15:[1,28]}),t(o,[2,43]),t(o,[2,44]),t(s,[2,13],{14:[1,29],15:[1,30],27:r}),t(o,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:r},t(s,[2,22]),t(s,[2,24],{14:[1,35]}),t(s,[2,25],{14:[1,36]}),t(s,[2,26]),{20:l,25:37,26:38,27:r},t(s,[2,10],{15:[1,40]}),{16:[1,41]},t(s,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:e,21:i},t(s,[2,17],{14:[1,45]}),t(s,[2,18],{14:[1,46]}),t(s,[2,19]),t(s,[2,27]),t(s,[2,28]),t(s,[2,23],{27:[1,47]}),t(f,[2,29]),{15:[1,48]},{16:[1,49]},t(s,[2,11]),{16:[1,50]},t(s,[2,15]),t(o,[2,42]),t(s,[2,20]),t(s,[2,21]),{20:l,26:51},{16:u,20:a,21:[1,53],28:52,29:54,30:55,31:y,32:h,33:b},t(s,[2,12]),t(s,[2,16]),t(f,[2,30]),t(f,[2,31]),t(f,[2,32]),t(f,[2,33],{30:61,16:u,20:a,31:y,32:h,33:b}),t(p,[2,34]),t(p,[2,36]),t(p,[2,37]),t(p,[2,38]),t(p,[2,39]),t(p,[2,40]),t(p,[2,35])],defaultActions:{6:[2,1]},parseError:w(function(g,m){if(m.recoverable)this.trace(g);else{var v=new Error(g);throw v.hash=m,v}},"parseError"),parse:w(function(g){var m=this,v=[0],c=[],x=[null],d=[],C=this.table,k="",D=0,U=0,V=2,F=1,R=d.slice.call(arguments,1),T=Object.create(this.lexer),A={yy:{}};for(var G in this.yy)Object.prototype.hasOwnProperty.call(this.yy,G)&&(A.yy[G]=this.yy[G]);T.setInput(g,A.yy),A.yy.lexer=T,A.yy.parser=this,typeof T.yylloc>"u"&&(T.yylloc={});var P=T.yylloc;d.push(P);var B=T.options&&T.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function W(H){v.length=v.length-2*H,x.length=x.length-H,d.length=d.length-H}w(W,"popStack");function L(){var H;return H=c.pop()||T.lex()||F,typeof H!="number"&&(H instanceof Array&&(c=H,H=c.pop()),H=m.symbols_[H]||H),H}w(L,"lex");for(var z,O,j,J,I={},N,K,et,Y;;){if(O=v[v.length-1],this.defaultActions[O]?j=this.defaultActions[O]:((z===null||typeof z>"u")&&(z=L()),j=C[O]&&C[O][z]),typeof j>"u"||!j.length||!j[0]){var X="";Y=[];for(N in C[O])this.terminals_[N]&&N>V&&Y.push("'"+this.terminals_[N]+"'");T.showPosition?X="Parse error on line "+(D+1)+`:
|
|
8
|
+
`+T.showPosition()+`
|
|
9
|
+
Expecting `+Y.join(", ")+", got '"+(this.terminals_[z]||z)+"'":X="Parse error on line "+(D+1)+": Unexpected "+(z==F?"end of input":"'"+(this.terminals_[z]||z)+"'"),this.parseError(X,{text:T.match,token:this.terminals_[z]||z,line:T.yylineno,loc:P,expected:Y})}if(j[0]instanceof Array&&j.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+z);switch(j[0]){case 1:v.push(z),x.push(T.yytext),d.push(T.yylloc),v.push(j[1]),z=null,U=T.yyleng,k=T.yytext,D=T.yylineno,P=T.yylloc;break;case 2:if(K=this.productions_[j[1]][1],I.$=x[x.length-K],I._$={first_line:d[d.length-(K||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(K||1)].first_column,last_column:d[d.length-1].last_column},B&&(I._$.range=[d[d.length-(K||1)].range[0],d[d.length-1].range[1]]),J=this.performAction.apply(I,[k,U,D,A.yy,j[1],x,d].concat(R)),typeof J<"u")return J;K&&(v=v.slice(0,-1*K*2),x=x.slice(0,-1*K),d=d.slice(0,-1*K)),v.push(this.productions_[j[1]][0]),x.push(I.$),d.push(I._$),et=C[v[v.length-2]][v[v.length-1]],v.push(et);break;case 3:return!0}}return!0},"parse")},E=(function(){var S={EOF:1,parseError:w(function(m,v){if(this.yy.parser)this.yy.parser.parseError(m,v);else throw new Error(m)},"parseError"),setInput:w(function(g,m){return this.yy=m||this.yy||{},this._input=g,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:w(function(){var g=this._input[0];this.yytext+=g,this.yyleng++,this.offset++,this.match+=g,this.matched+=g;var m=g.match(/(?:\r\n?|\n).*/g);return m?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),g},"input"),unput:w(function(g){var m=g.length,v=g.split(/(?:\r\n?|\n)/g);this._input=g+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-m),this.offset-=m;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),v.length-1&&(this.yylineno-=v.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:v?(v.length===c.length?this.yylloc.first_column:0)+c[c.length-v.length].length-v[0].length:this.yylloc.first_column-m},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-m]),this.yyleng=this.yytext.length,this},"unput"),more:w(function(){return this._more=!0,this},"more"),reject:w(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:w(function(g){this.unput(this.match.slice(g))},"less"),pastInput:w(function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:w(function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:w(function(){var g=this.pastInput(),m=new Array(g.length+1).join("-");return g+this.upcomingInput()+`
|
|
11
|
+
`+m+"^"},"showPosition"),test_match:w(function(g,m){var v,c,x;if(this.options.backtrack_lexer&&(x={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&&(x.yylloc.range=this.yylloc.range.slice(0))),c=g[0].match(/(?:\r\n?|\n).*/g),c&&(this.yylineno+=c.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+g[0].length},this.yytext+=g[0],this.match+=g[0],this.matches=g,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(g[0].length),this.matched+=g[0],v=this.performAction.call(this,this.yy,this,m,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var d in x)this[d]=x[d];return!1}return!1},"test_match"),next:w(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var g,m,v,c;this._more||(this.yytext="",this.match="");for(var x=this._currentRules(),d=0;d<x.length;d++)if(v=this._input.match(this.rules[x[d]]),v&&(!m||v[0].length>m[0].length)){if(m=v,c=d,this.options.backtrack_lexer){if(g=this.test_match(v,x[d]),g!==!1)return g;if(this._backtrack){m=!1;continue}else return!1}else if(!this.options.flex)break}return m?(g=this.test_match(m,x[c]),g!==!1?g:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
12
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:w(function(){var m=this.next();return m||this.lex()},"lex"),begin:w(function(m){this.conditionStack.push(m)},"begin"),popState:w(function(){var m=this.conditionStack.length-1;return m>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:w(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:w(function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:w(function(m){this.begin(m)},"pushState"),stateStackSize:w(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:w(function(m,v,c,x){switch(c){case 0:break;case 1:break;case 2:break;case 3:if(m.getIndentMode&&m.getIndentMode())return m.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:m.setIndentMode&&m.setIndentMode(!1),this.begin("INITIAL"),this.unput(v.yytext);break;case 6:return this.begin("bol"),8;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(m.consumeIndentText)m.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return v.yytext=v.yytext.slice(2,-2),14;case 17:return v.yytext=v.yytext.slice(1,-1).trim(),14;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 S})();M.lexer=E;function _(){this.yy={}}return w(_,"Parser"),_.prototype=M,M.Parser=_,new _})();gt.parser=gt;var we=gt,yt=[],pt=[],mt=[],bt=new Set,vt,kt=!1,_e=w((t,n,s)=>{const e=it(t).sort(),i=s??10/Math.pow(t.length,2);vt=e,e.length===1&&bt.add(e[0]),yt.push({sets:e,size:i,label:n?nt(n):void 0})},"addSubsetData"),Te=w(()=>yt,"getSubsetData"),nt=w(t=>{const n=t.trim();return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n},"normalizeText"),Ee=w(t=>t&&nt(t),"normalizeStyleValue"),ze=w((t,n,s)=>{const e=nt(n);pt.push({sets:it(t).sort(),id:e,label:s?nt(s):void 0})},"addTextData"),Ae=w((t,n)=>{const s=it(t).sort(),e={};for(const[i,o]of n)e[i]=Ee(o)??o;mt.push({targets:s,styles:e})},"addStyleData"),Re=w(()=>mt,"getStyleData"),it=w(t=>t.map(n=>nt(n)),"normalizeIdentifierList"),Ce=w(t=>{const s=it(t).filter(e=>!bt.has(e));if(s.length>0)throw new Error(`unknown set identifier: ${s.join(", ")}`)},"validateUnionIdentifiers"),De=w(()=>pt,"getTextData"),Ne=w(()=>vt,"getCurrentSets"),Oe=w(()=>kt,"getIndentMode"),Fe=w(t=>{kt=t},"setIndentMode"),je=re.venn;function Vt(){return oe(je,wt().venn)}w(Vt,"getConfig");var Le=w(()=>{ie(),yt.length=0,pt.length=0,mt.length=0,bt.clear(),vt=void 0,kt=!1},"customClear"),Pe={getConfig:Vt,clear:Le,setAccTitle:Qt,getAccTitle:Zt,setDiagramTitle:Xt,getDiagramTitle:Yt,getAccDescription:Ht,setAccDescription:Kt,addSubsetData:_e,getSubsetData:Te,addTextData:ze,addStyleData:Ae,validateUnionIdentifiers:Ce,getTextData:De,getStyleData:Re,getCurrentSets:Ne,getIndentMode:Oe,setIndentMode:Fe},Be=w(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"),Ve=Be;function qt(t){const n=new Map;for(const s of t){const e=s.targets.join("|"),i=n.get(e);i?Object.assign(i,s.styles):n.set(e,{...s.styles})}return n}w(qt,"buildStyleByKey");var qe=w((t,n,s,e)=>{const i=e.db,o=i.getConfig?.(),{themeVariables:r,look:l,handDrawnSeed:f}=wt(),u=l==="handDrawn",a=[r.venn1,r.venn2,r.venn3,r.venn4,r.venn5,r.venn6,r.venn7,r.venn8].filter(Boolean),y=i.getDiagramTitle?.(),h=i.getSubsetData(),b=i.getTextData(),p=qt(i.getStyleData()),M=Gt(h),E=o?.width??800,_=o?.height??450,g=E/1600,m=y?48*g:0,v=r.primaryTextColor??r.textColor,c=Jt(n);c.attr("viewBox",`0 0 ${E} ${_}`),y&&c.append("text").text(y).attr("class","venn-title").attr("font-size",`${32*g}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*g).style("fill",r.vennTitleTextColor||r.titleColor);const x=ot(document.createElement("div")),d=ve().width(E).height(_-m);x.datum(M).call(d);const C=u?$t.svg(x.select("svg").node()):void 0,k=Se(M,{width:E,height:_-m,padding:o?.padding??15}),D=new Map;for(const R of k){const T=Q([...R.data.sets].sort());D.set(T,R)}b.length>0&&Ut(o,D,x,b,g,p);const U=te(r.background||"#f4f4f4");x.selectAll(".venn-circle").each(function(R,T){const A=ot(this),P=Q([...R.sets].sort()),B=p.get(P),W=a.length>0?a[T%a.length]:void 0,L=B?.fill||W||r.primaryColor;A.classed(`venn-set-${T%8}`,!0);const z=B?.["fill-opacity"]??.1,O=B?.stroke||L,j=B?.["stroke-width"]||`${5*g}`;if(u&&C){const I=D.get(P);if(I&&I.circles.length>0){const N=I.circles[0],K=C.circle(N.x,N.y,N.radius*2,{roughness:.7,seed:f,fill:It(L,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+T*60,stroke:O,strokeWidth:parseFloat(String(j))});A.select("path").remove(),A.node()?.insertBefore(K,A.select("text").node())}}else A.select("path").style("fill",L).style("fill-opacity",z).style("stroke",O).style("stroke-width",j).style("stroke-opacity",.95);const J=B?.color||(U?ee(L,30):ne(L,30));A.select("text").style("font-size",`${48*g}px`).style("fill",J)}),u&&C?x.selectAll(".venn-intersection").each(function(R){const T=ot(this),G=Q([...R.sets].sort()),P=p.get(G),B=P?.fill;if(B){const W=T.select("path"),L=W.attr("d");if(L){const z=C.path(L,{roughness:.7,seed:f,fill:It(B,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),O=W.node();O?.parentNode?.insertBefore(z,O),W.remove()}}else T.select("path").style("fill-opacity",0);T.select("text").style("font-size",`${48*g}px`).style("fill",P?.color??r.vennSetTextColor??v)}):(x.selectAll(".venn-intersection text").style("font-size",`${48*g}px`).style("fill",R=>{const A=Q([...R.sets].sort());return p.get(A)?.color??r.vennSetTextColor??v}),x.selectAll(".venn-intersection path").style("fill-opacity",R=>{const A=Q([...R.sets].sort());return p.get(A)?.fill?1:0}).style("fill",R=>{const A=Q([...R.sets].sort());return p.get(A)?.fill??"transparent"}));const V=c.append("g").attr("transform",`translate(0, ${m})`),F=x.select("svg").node();if(F&&"childNodes"in F)for(const R of[...F.childNodes])V.node()?.appendChild(R);se(c,_,E,o?.useMaxWidth??!0)},"draw");function Q(t){return t.join("|")}w(Q,"stableSetsKey");function Ut(t,n,s,e,i,o){const r=t?.useDebugLayout??!1,f=s.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(const a of e){const y=Q(a.sets),h=u.get(y);h?h.push(a):u.set(y,[a])}for(const[a,y]of u.entries()){const h=n.get(a);if(!h?.text)continue;const b=h.text.x,p=h.text.y,M=Math.min(...h.circles.map(F=>F.radius)),E=Math.min(...h.circles.map(F=>F.radius-Math.hypot(b-F.x,p-F.y)));let _=Number.isFinite(E)?Math.max(0,E):0;_===0&&Number.isFinite(M)&&(_=M*.6);const S=f.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);r&&S.append("circle").attr("class","venn-text-debug-circle").attr("cx",b).attr("cy",p).attr("r",_).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const g=Math.max(80*i,_*2*.95),m=Math.max(60*i,_*2*.95),x=(h.data.label&&h.data.label.length>0?Math.min(32*i,_*.25):0)+(y.length<=2?30*i:0),d=b-g/2,C=p-m/2+x,k=Math.max(1,Math.ceil(Math.sqrt(y.length))),D=Math.max(1,Math.ceil(y.length/k)),U=g/k,V=m/D;for(const[F,R]of y.entries()){const T=F%k,A=Math.floor(F/k),G=d+U*(T+.5),P=C+V*(A+.5);r&&S.append("rect").attr("class","venn-text-debug-cell").attr("x",d+U*T).attr("y",C+V*A).attr("width",U).attr("height",V).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const B=U*.9,W=V*.9,L=S.append("foreignObject").attr("class","venn-text-node-fo").attr("width",B).attr("height",W).attr("x",G-B/2).attr("y",P-W/2).attr("overflow","visible"),z=o.get(R.id)?.color,O=L.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(R.label??R.id);z&&O.style("color",z)}}}w(Ut,"renderTextNodes");function Gt(t){const n=new Set(t.map(i=>[...i.sets].sort().join("|"))),s=new Map(t.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),e=[];for(const i of t){if(i.sets.length<3)continue;const o=[...i.sets].sort();for(let r=0;r<o.length-1;r++)for(let l=r+1;l<o.length;l++){const f=[o[r],o[l]],u=f.join("|");if(!n.has(u)){n.add(u);const a=s.get(f[0]),y=s.get(f[1]),h=a!==void 0&&y!==void 0?Math.min(a,y)/4:2.5;e.push({sets:f,size:h,label:""})}}}return e.length>0?[...t,...e]:t}w(Gt,"ensurePairwiseSubsets");var Ue={draw:qe},He={parser:we,db:Pe,renderer:Ue,styles:Ve};export{He as diagram};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import{p as Mt}from"./chunk-JWPE2WC7-C4b1ijjH.js";import{s as Nt,g as Lt,t as zt,q as Tt,a as At,b as Xt,_ as u,R as Et,L as Yt,N as U,l as K,Q as It,d as Bt,A as Ft,c as V}from"./index-D-PvDSJs.js";import{p as Rt}from"./cynefin-OW5HDTMX-Dk9BE-CS.js";import"./vendor-editor-core-BG7M-EQ-.js";import"./vendor-editor-languages-pDmyn-oC.js";var G=u((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),A=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),J=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Mt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{const h=A(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{const h=A(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,w=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,w)}),o.notes.forEach(e=>{const h=A(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const w=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(w,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,w)})}),o.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=J(e.fromPort)??J(e.toPort);const{flow:d,label:w}=Ot(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,g=w??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{const h=r.getNode(e.component);if(h?.y!==void 0){const a=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){const e=o.annotations[0],h=A(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{const h=A(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{const h=A(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{const h=A(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void 0},parse:u(async o=>{const r=await Rt("wardley",o);K.debug(r);const e=tt.parser?.yy;if(!e||typeof e.addNode!="function")throw new 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.");Wt(r,e)},"parse")},E,Dt=(E=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={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,h]of this.nodes)if(h.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,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}},u(E,"WardleyBuilder"),E),k=new Dt;function et(){return V()["wardley-beta"]}u(et,"getConfig");function at(o,r,e,h,a,d,w,C,g){k.addNode({id:o,label:r,x:e,y:h,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(at,"addNode");function rt(o,r,e=!1,h,a){k.addLink({source:o,target:r,dashed:e,label:h,flow:a})}u(rt,"addLink");function ot(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}u(ot,"addTrend");function nt(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}u(nt,"addAnnotation");function st(o,r,e){k.addNote({text:o,x:r,y:e})}u(st,"addNote");function it(o,r,e){k.addAccelerator({name:o,x:r,y:e})}u(it,"addAccelerator");function dt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}u(dt,"addDeaccelerator");function lt(o,r){k.setAnnotationsBox(o,r)}u(lt,"setAnnotationsBox");function ct(o,r){k.setSize(o,r)}u(ct,"setSize");function pt(o){k.startPipeline(o)}u(pt,"startPipeline");function ft(o,r){k.addPipelineComponent(o,r)}u(ft,"addPipelineComponent");function ht(o){k.setAxes(o)}u(ht,"updateAxes");function xt(o){return k.getNode(o)}u(xt,"getNode");function gt(o){return k.resolveNodeId(o)}u(gt,"resolveNodeId");function yt(){return k.build()}u(yt,"getWardleyData");function ut(){k.clear(),Ft()}u(ut,"clear");var Gt={getConfig:et,addNode:at,addLink:rt,addTrend:ot,addAnnotation:nt,addNote:st,addAccelerator:it,addDeaccelerator:dt,setAnnotationsBox:lt,setSize:ct,startPipeline:pt,addPipelineComponent:ft,updateAxes:ht,getNode:xt,resolveNodeId:gt,getWardleyData:yt,clear:ut,setAccTitle:Xt,getAccTitle:At,setDiagramTitle:Tt,getDiagramTitle:zt,getAccDescription:Lt,setAccDescription:Nt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{const{themeVariables:o}=V();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=u(()=>{const o=V()["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=u((o,r,e,h)=>{K.debug(`Rendering Wardley map
|
|
2
|
+
`+o);const a=jt(),d=Ht(),w=a.nodeRadius*1.6,C=h.db,g=C.getWardleyData(),R=C.getDiagramTitle(),S=g.size?.width??a.width,b=g.size?.height??a.height,Y=It(r);Y.selectAll("*").remove(),Bt(Y,b,S,a.useMaxWidth),Y.attr("viewBox",`0 0 ${S} ${b}`);const v=Y.append("g").attr("class","wardley-map"),q=Y.append("defs");q.append("marker").attr("id",`arrow-${r}`).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",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${r}`).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",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${r}`).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",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);const I=S-a.padding*2,B=b-a.padding*2;R&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(R);const L=u(t=>a.padding+t/100*I,"projectX"),z=u(t=>b-a.padding-t/100*B,"projectY"),O=v.append("g").attr("class","wardley-axes");O.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const wt=g.axes.xLabel??"Evolution",mt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+I/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(wt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+B/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+B/2})`).text(mt);const F=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:qt;if(F.length>0){const t=v.append("g").attr("class","wardley-stages"),s=g.axes.stageBoundaries,n=[];if(s&&s.length===F.length){let i=0;s.forEach(p=>{n.push({start:i,end:p}),i=p})}else{const i=1/F.length;F.forEach((p,l)=>{n.push({start:l*i,end:(l+1)*i})})}F.forEach((i,p)=>{const l=n[p],f=a.padding+l.start*I,x=a.padding+l.end*I,y=(f+x)/2;p>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){const t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const n=s/4,i=a.padding+I*n;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-B*n).attr("y2",b-a.padding-B*n).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:L(t.x),y:z(t.y),node:t})}),g.pipelines.length>0){const t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(n=>{if(n.componentIds.length===0)return;const i=n.componentIds.map(x=>({id:x,pos:c.get(x),node:g.nodes.find(y=>y.id===x)})).filter(x=>x.pos&&x.node).sort((x,y)=>x.node.x-y.node.x);for(let x=0;x<i.length-1;x++){const y=i[x],m=i[x+1];s.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",y.pos.x).attr("y1",y.pos.y).attr("x2",m.pos.x).attr("y2",m.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let p=1/0,l=-1/0,f=0;if(n.componentIds.forEach(x=>{const y=c.get(x);y&&(p=Math.min(p,y.x),l=Math.max(l,y.x),f=y.y)}),p!==1/0&&l!==-1/0){const y=a.nodeRadius*4,m=f-y/2,P=c.get(n.nodeId);if(P){const N=(p+l)/2;P.x=N,P.y=m-w/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",m).attr("width",l-p+30).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=v.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const Q=g.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||Z.get(t.target)?.has(t.source)));_.selectAll("line").data(Q).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.x+l/x*p}).attr("y1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.y+f/x*p}).attr("x2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.x+l/x*p}).attr("y2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.y+f/x*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${r})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${r})`:null),_.selectAll("text").data(Q.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=n.y-s.y,l=n.x-s.x,f=Math.sqrt(l*l+p*p),x=8,y=p/f;return i+y*x}).attr("y",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.y+n.y)/2,p=n.x-s.x,l=n.y-s.y,f=Math.sqrt(p*p+l*l),x=8,y=-p/f;return i+y*x}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=(s.y+n.y)/2,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f),y=8,m=f/x,P=-l/x,N=i+m*y,W=p+P*y;let X=Math.atan2(f,l)*180/Math.PI;return(X>90||X<-90)&&(X+=180),`rotate(${X} ${N} ${W})`}).text(t=>t.label);const kt=v.append("g").attr("class","wardley-trends"),bt=g.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const n=L(t.targetX),i=z(t.targetY),p=n-s.x,l=i-s.y,f=Math.sqrt(p*p+l*l),x=a.nodeRadius+2,y=f>x?n-p/f*x:n,m=f>x?i-l/f*x:i;return{origin:s,targetX:n,targetY:i,adjustedX2:y,adjustedY2:m}}).filter(t=>t!==null);kt.selectAll("line").data(bt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${r})`);const M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const T=M.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-w/2).attr("y",t=>c.get(t.id).y-w/2).attr("width",w).attr("height",w).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let n=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y1",t=>{const s=c.get(t.id),n=t.isPipelineParent?w:a.nodeRadius*2;return s.y-n/2}).attr("x2",t=>{const s=c.get(t.id);let n=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y2",t=>{const s=c.get(t.id),n=t.isPipelineParent?w:a.nodeRadius*2;return s.y+n/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let n=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(n+=10);const i=t.labelOffsetX??n;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let n=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(n-=10);const i=t.labelOffsetY??n;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=v.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(s=>{const n=s.coordinates.map(i=>({x:L(i.x),y:z(i.y)}));if(n.length>1)for(let i=0;i<n.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",n[i].x).attr("y1",n[i].y).attr("x2",n[i+1].x).attr("y2",n[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach(i=>{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),g.annotationsBox){let s=L(g.annotationsBox.x),n=z(g.annotationsBox.y);const i=10,p=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),x=[...g.annotations].filter(m=>m.text).sort((m,P)=>m.number-P.number),y=[];if(x.forEach((m,P)=>{const N=f.append("text").attr("x",s+i).attr("y",n+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${m.number}. ${m.text}`);y.push(N)}),y.length>0){let m=0,P=0;y.forEach(j=>{const D=j.node(),Ct=D.getComputedTextLength();m=Math.max(m,Ct);const St=D.getBBox();P=Math.max(P,St.height)});const N=m+i*2+105,W=x.length*p+i*2+P/2,X=a.padding,$t=S-a.padding-N,vt=a.padding,Pt=b-a.padding-W;s=Math.max(X,Math.min(s,$t)),n=Math.max(vt,Math.min(n,Pt)),y.forEach((j,D)=>{j.attr("x",s+i).attr("y",n+i+(D+1)*p)}),f.insert("rect","text").attr("x",s).attr("y",n).attr("width",N).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=v.append("g").attr("class","wardley-notes");g.notes.forEach(s=>{const n=L(s.x),i=z(s.y);t.append("text").attr("x",n).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(g.accelerators.length>0){const t=v.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(s=>{const n=L(s.x),i=z(s.y),p=60,l=30,f=20,x=`
|
|
3
|
+
M ${n} ${i-l/2}
|
|
4
|
+
L ${n+p-f} ${i-l/2}
|
|
5
|
+
L ${n+p-f} ${i-l/2-8}
|
|
6
|
+
L ${n+p} ${i}
|
|
7
|
+
L ${n+p-f} ${i+l/2+8}
|
|
8
|
+
L ${n+p-f} ${i+l/2}
|
|
9
|
+
L ${n} ${i+l/2}
|
|
10
|
+
Z
|
|
11
|
+
`;t.append("path").attr("d",x).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),t.append("text").attr("x",n+p/2).attr("y",i+l/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.name)})}if(g.deaccelerators.length>0){const t=v.append("g").attr("class","wardley-deaccelerators");g.deaccelerators.forEach(s=>{const n=L(s.x),i=z(s.y),p=60,l=30,f=20,x=`
|
|
12
|
+
M ${n+p} ${i-l/2}
|
|
13
|
+
L ${n+f} ${i-l/2}
|
|
14
|
+
L ${n+f} ${i-l/2-8}
|
|
15
|
+
L ${n} ${i}
|
|
16
|
+
L ${n+f} ${i+l/2+8}
|
|
17
|
+
L ${n+f} ${i+l/2}
|
|
18
|
+
L ${n+p} ${i+l/2}
|
|
19
|
+
Z
|
|
20
|
+
`;t.append("path").attr("d",x).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),t.append("text").attr("x",n+p/2).attr("y",i+l/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.name)})}},"draw"),_t={draw:Vt},Zt=u(({wardley:o}={})=>{const r=Et(),e=Yt(),h=U(r,e.themeVariables),a=U(h.wardley,o);return`
|
|
21
|
+
.wardley-background {
|
|
22
|
+
fill: ${a.backgroundColor};
|
|
23
|
+
}
|
|
24
|
+
.wardley-axes line, .wardley-axes path {
|
|
25
|
+
stroke: ${a.axisColor};
|
|
26
|
+
}
|
|
27
|
+
.wardley-axis-label {
|
|
28
|
+
fill: ${a.axisTextColor};
|
|
29
|
+
}
|
|
30
|
+
.wardley-stage-label {
|
|
31
|
+
fill: ${a.axisTextColor};
|
|
32
|
+
}
|
|
33
|
+
.wardley-grid line {
|
|
34
|
+
stroke: ${a.gridColor};
|
|
35
|
+
}
|
|
36
|
+
.wardley-node circle {
|
|
37
|
+
fill: ${a.componentFill};
|
|
38
|
+
stroke: ${a.componentStroke};
|
|
39
|
+
}
|
|
40
|
+
.wardley-node-label {
|
|
41
|
+
fill: ${a.componentLabelColor};
|
|
42
|
+
}
|
|
43
|
+
.wardley-link {
|
|
44
|
+
stroke: ${a.linkStroke};
|
|
45
|
+
}
|
|
46
|
+
.wardley-link--dashed {
|
|
47
|
+
stroke-dasharray: 4 4;
|
|
48
|
+
}
|
|
49
|
+
.wardley-link-label {
|
|
50
|
+
fill: ${a.axisTextColor};
|
|
51
|
+
}
|
|
52
|
+
.wardley-trend line {
|
|
53
|
+
stroke: ${a.evolutionStroke};
|
|
54
|
+
}
|
|
55
|
+
.wardley-annotation-line {
|
|
56
|
+
stroke: ${a.annotationStroke};
|
|
57
|
+
}
|
|
58
|
+
.wardley-annotation circle {
|
|
59
|
+
fill: ${a.annotationFill};
|
|
60
|
+
stroke: ${a.annotationStroke};
|
|
61
|
+
}
|
|
62
|
+
.wardley-annotation text {
|
|
63
|
+
fill: ${a.annotationTextColor};
|
|
64
|
+
}
|
|
65
|
+
.wardley-annotations-box rect {
|
|
66
|
+
fill: ${a.annotationFill};
|
|
67
|
+
stroke: ${a.annotationStroke};
|
|
68
|
+
}
|
|
69
|
+
.wardley-annotations-box text {
|
|
70
|
+
fill: ${a.annotationTextColor};
|
|
71
|
+
}
|
|
72
|
+
.wardley-pipeline-box {
|
|
73
|
+
stroke: ${a.componentStroke};
|
|
74
|
+
}
|
|
75
|
+
.wardley-notes text {
|
|
76
|
+
fill: ${a.axisTextColor};
|
|
77
|
+
}
|
|
78
|
+
`},"styles"),ae={parser:tt,db:Gt,renderer:_t,styles:Zt};export{ae as diagram};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{s as pi,g as mi,t as $t,q as yi,a as bi,b as wi,_ as a,l as Ut,Q as Ai,d as Ci,A as Si,L as Dt,j as Ri,N as qt,O as _i,R as ki,aN as Ti,aO as Xt}from"./index-D-PvDSJs.js";import{i as Di}from"./init-Gi6I4Gst.js";import{o as Pi}from"./ordinal-Cboi1Yqb.js";import{l as Nt}from"./linear-BwJ7-DLx.js";import"./vendor-editor-core-BG7M-EQ-.js";import"./vendor-editor-languages-pDmyn-oC.js";import"./defaultLocale-DX6XiGOO.js";function vi(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function St(){var e=Pi().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,h,p=!1,u=0,f=0,R=.5;delete e.unknown;function C(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-u+f*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-u))*R,h=o*(1-u),p&&(v=Math.round(v),h=Math.round(h));var M=vi(y).map(function(b){return v+o*b});return i(E?M.reverse():M)}return e.domain=function(y){return arguments.length?(t(y),C()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,C()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,C()},e.bandwidth=function(){return h},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,C()):p},e.padding=function(y){return arguments.length?(u=Math.min(1,f=+y),C()):u},e.paddingInner=function(y){return arguments.length?(u=Math.min(1,y),C()):u},e.paddingOuter=function(y){return arguments.length?(f=+y,C()):f},e.align=function(y){return arguments.length?(R=Math.max(0,Math.min(1,y)),C()):R},e.copy=function(){return St(t(),[s,n]).round(p).paddingInner(u).paddingOuter(f).align(R)},Di.apply(C(),arguments)}var Rt=(function(){var e=a(function(W,l,g,d){for(g=g||{},d=W.length;d--;g[W[d]]=l);return g},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],h=[1,7],p=[1,5,10,12,14,16,18,19,21,23,36,37,38],u=[1,25],f=[1,26],R=[1,28],C=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],M=[1,34],b=[1,35],D=[1,36],c=[1,37],B=[1,43],F=[1,42],X=[1,47],N=[1,50],k=[1,10,12,14,16,18,19,21,23,36,37,38],H=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],A=[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],S=[1,65],O=[26,28],T={trace:a(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:a(function(l,g,d,x,_,r,lt){var m=r.length-1;switch(_){case 5:x.setOrientation(r[m]);break;case 9:x.setDiagramTitle(r[m].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[m]);break;case 13:x.setLineData(r[m-1],r[m]);break;case 14:x.setBarData({text:"",type:"text"},r[m]);break;case 15:x.setBarData(r[m-1],r[m]);break;case 16:this.$=r[m].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[m].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[m-1];break;case 20:case 30:this.$=[r[m-2],...r[m]];break;case 21:case 31:this.$=[r[m]];break;case 22:this.$={value:Number(r[m-1]),label:r[m]};break;case 23:this.$={value:Number(r[m]),label:""};break;case 24:x.setXAxisTitle(r[m]);break;case 25:x.setXAxisTitle(r[m-1]);break;case 26:x.setXAxisTitle({type:"text",text:""});break;case 27:x.setXAxisBand(r[m]);break;case 28:x.setXAxisRangeData(Number(r[m-2]),Number(r[m]));break;case 29:this.$=r[m-1];break;case 32:x.setYAxisTitle(r[m]);break;case 33:x.setYAxisTitle(r[m-1]);break;case 34:x.setYAxisTitle({type:"text",text:""});break;case 35:x.setYAxisRangeData(Number(r[m-2]),Number(r[m]));break;case 39:this.$={text:r[m],type:"text"};break;case 40:this.$={text:r[m],type:"text"};break;case 41:this.$={text:r[m],type:"markdown"};break;case 42:this.$=r[m];break;case 43:this.$=r[m-1]+""+r[m];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:n,37:o,38:h}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:n,37:o,38:h}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:n,37:o,38:h}),{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]},e(p,[2,36]),e(p,[2,37]),e(p,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:n,37:o,38:h}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,36:n,37:o,38:h}),{11:23,30:u,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:39,13:38,24:B,29:F,30:u,31:40,32:41,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:45,15:44,29:X,30:u,35:46,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:49,17:48,24:N,30:u,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:52,17:51,24:N,30:u,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{20:[1,53]},{22:[1,54]},e(k,[2,18]),{1:[2,2]},e(k,[2,8]),e(k,[2,9]),e(H,[2,39],{41:55,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c}),e(H,[2,40]),e(H,[2,41]),e(A,[2,42]),e(A,[2,44]),e(A,[2,45]),e(A,[2,46]),e(A,[2,47]),e(A,[2,48]),e(A,[2,49]),e(A,[2,50]),e(A,[2,51]),e(A,[2,52]),e(A,[2,53]),e(k,[2,10]),e(k,[2,24],{32:41,31:56,24:B,29:F}),e(k,[2,26]),e(k,[2,27]),{33:[1,57]},{11:59,30:u,34:58,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},e(k,[2,11]),e(k,[2,32],{35:60,29:X}),e(k,[2,34]),{33:[1,61]},e(k,[2,12]),{17:62,24:N},{25:63,27:64,29:S},e(k,[2,14]),{17:66,24:N},e(k,[2,16]),e(k,[2,17]),e(A,[2,43]),e(k,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(k,[2,33]),{29:[1,70]},e(k,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(O,[2,23],{30:[1,73]}),e(k,[2,15]),e(k,[2,28]),e(k,[2,29]),{11:59,30:u,34:74,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},e(k,[2,35]),e(k,[2,19]),{25:75,27:64,29:S},e(O,[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:a(function(l,g){if(g.recoverable)this.trace(l);else{var d=new Error(l);throw d.hash=g,d}},"parseError"),parse:a(function(l){var g=this,d=[0],x=[],_=[null],r=[],lt=this.table,m="",dt=0,Ot=0,ui=2,Vt=1,di=r.slice.call(arguments,1),P=Object.create(this.lexer),$={yy:{}};for(var bt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,bt)&&($.yy[bt]=this.yy[bt]);P.setInput(l,$.yy),$.yy.lexer=P,$.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var wt=P.yylloc;r.push(wt);var xi=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(z){d.length=d.length-2*z,_.length=_.length-z,r.length=r.length-z}a(fi,"popStack");function Ft(){var z;return z=x.pop()||P.lex()||Vt,typeof z!="number"&&(z instanceof Array&&(x=z,z=x.pop()),z=g.symbols_[z]||z),z}a(Ft,"lex");for(var I,U,V,At,j={},xt,Y,Wt,ft;;){if(U=d[d.length-1],this.defaultActions[U]?V=this.defaultActions[U]:((I===null||typeof I>"u")&&(I=Ft()),V=lt[U]&<[U][I]),typeof V>"u"||!V.length||!V[0]){var Ct="";ft=[];for(xt in lt[U])this.terminals_[xt]&&xt>ui&&ft.push("'"+this.terminals_[xt]+"'");P.showPosition?Ct="Parse error on line "+(dt+1)+`:
|
|
2
|
+
`+P.showPosition()+`
|
|
3
|
+
Expecting `+ft.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Ct="Parse error on line "+(dt+1)+": Unexpected "+(I==Vt?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Ct,{text:P.match,token:this.terminals_[I]||I,line:P.yylineno,loc:wt,expected:ft})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+I);switch(V[0]){case 1:d.push(I),_.push(P.yytext),r.push(P.yylloc),d.push(V[1]),I=null,Ot=P.yyleng,m=P.yytext,dt=P.yylineno,wt=P.yylloc;break;case 2:if(Y=this.productions_[V[1]][1],j.$=_[_.length-Y],j._$={first_line:r[r.length-(Y||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(Y||1)].first_column,last_column:r[r.length-1].last_column},xi&&(j._$.range=[r[r.length-(Y||1)].range[0],r[r.length-1].range[1]]),At=this.performAction.apply(j,[m,Ot,dt,$.yy,V[1],_,r].concat(di)),typeof At<"u")return At;Y&&(d=d.slice(0,-1*Y*2),_=_.slice(0,-1*Y),r=r.slice(0,-1*Y)),d.push(this.productions_[V[1]][0]),_.push(j.$),r.push(j._$),Wt=lt[d[d.length-2]][d[d.length-1]],d.push(Wt);break;case 3:return!0}}return!0},"parse")},ht=(function(){var W={EOF:1,parseError:a(function(g,d){if(this.yy.parser)this.yy.parser.parseError(g,d);else throw new Error(g)},"parseError"),setInput:a(function(l,g){return this.yy=g||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var g=l.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:a(function(l){var g=l.length,d=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===x.length?this.yylloc.first_column:0)+x[x.length-d.length].length-d[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(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:a(function(l){this.unput(this.match.slice(l))},"less"),pastInput:a(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var l=this.pastInput(),g=new Array(l.length+1).join("-");return l+this.upcomingInput()+`
|
|
5
|
+
`+g+"^"},"showPosition"),test_match:a(function(l,g){var d,x,_;if(this.options.backtrack_lexer&&(_={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&&(_.yylloc.range=this.yylloc.range.slice(0))),x=l[0].match(/(?:\r\n?|\n).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+l[0].length},this.yytext+=l[0],this.match+=l[0],this.matches=l,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(l[0].length),this.matched+=l[0],d=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),d)return d;if(this._backtrack){for(var r in _)this[r]=_[r];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var l,g,d,x;this._more||(this.yytext="",this.match="");for(var _=this._currentRules(),r=0;r<_.length;r++)if(d=this._input.match(this.rules[_[r]]),d&&(!g||d[0].length>g[0].length)){if(g=d,x=r,this.options.backtrack_lexer){if(l=this.test_match(d,_[r]),l!==!1)return l;if(this._backtrack){g=!1;continue}else return!1}else if(!this.options.flex)break}return g?(l=this.test_match(g,_[x]),l!==!1?l:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var g=this.next();return g||this.lex()},"lex"),begin:a(function(g){this.conditionStack.push(g)},"begin"),popState:a(function(){var g=this.conditionStack.length-1;return g>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(g){return g=this.conditionStack.length-1-Math.abs(g||0),g>=0?this.conditionStack[g]:"INITIAL"},"topState"),pushState:a(function(g){this.begin(g)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(function(g,d,x,_){switch(x){case 0:break;case 1:break;case 2:return this.popState(),36;case 3:return this.popState(),36;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";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";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 33;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 29;case 25:return this.popState(),26;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 W})();T.lexer=ht;function G(){this.yy={}}return a(G,"Parser"),G.prototype=T,T.Parser=G,new G})();Rt.parser=Rt;var Li=Rt;function pt(e){return e.type==="bar"}a(pt,"isBarPlot");function mt(e){return e.type==="band"}a(mt,"isBandAxisData");function Q(e){return e.type==="linear"}a(Q,"isLinearAxisData");var K,Pt=(K=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((o,h)=>Math.max(h.length,o),0)*i,height:i};const s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const o of t){const h=Ti(n,1,o),p=h?h.width:o.length*i,u=h?h.height:i;s.width=Math.max(s.width,p),s.height=Math.max(s.height,u)}return n.remove(),s}},a(K,"TextDimensionCalculatorWithFont"),K),Yt=.7,Ht=.2,Z,Gt=(Z=class{constructor(t,i,s,n){this.axisConfig=t,this.title=i,this.textDimensionCalculator=s,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}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){Yt*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(Yt*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=Ht*t.width;this.outerPadding=Math.min(s.width/2,n);let o=s.height;this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0&&(o=Math.max(o,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height))),o+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,o<=i&&(i-=o,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=Ht*t.height;this.outerPadding=Math.min(s.height/2,n);const o=s.width+this.axisConfig.labelPadding*2;o<=i&&(i-=o,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateOffsetByRotation(t){const i=this.normalizedLabelRotationInRad;return i===0?0:Math.sin(i)*this.getLabelDimension()[t]/2}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.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(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.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"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i)+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"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.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"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),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"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.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"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},a(Z,"BaseAxis"),Z),J,Ei=(J=class extends Gt{constructor(t,i,s,n,o){super(t,n,o,i),this.categories=s,this.scale=St().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=St().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),Ut.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},a(J,"BandAxis"),J),tt,Mi=(tt=class extends Gt{constructor(t,i,s,n,o){super(t,n,o,i),this.domain=s,this.scale=Nt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=Nt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},a(tt,"LinearAxis"),tt);function _t(e,t,i,s){const n=new Pt(s);return mt(e)?new Ei(t,i,e.categories,e.title,n):new Mi(t,i,[e.min,e.max],e.title,n)}a(_t,"getAxis");var it,Ii=(it=class{constructor(t,i,s,n){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,t.width),n=i.height+2*this.chartConfig.titlePadding;return i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.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}]}),t}},a(it,"ChartTitle"),it);function jt(e,t,i,s){const n=new Pt(s);return new Ii(n,e,t,i)}a(jt,"getChartTitleComponent");var zi=.75,Bi=.5,Oi=.35;function kt(e){return{fontSize:e,markerSize:e*zi,markerSpacing:e*Oi,itemSpacing:e*Bi}}a(kt,"getLegendLayout");var et,Vi=(et=class{constructor(t,i,s,n){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter(f=>f.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};const{fontSize:i,markerSize:s,markerSpacing:n,itemSpacing:o}=kt(this.chartConfig.legendFontSize),h=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map(f=>f.title),i),p=this.chartConfig.legendPadding*2+s+n+h.width,u=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*o;return p<=t.width&&u<=t.height?(this.boundingRect.width=p,this.boundingRect.height=u):(this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];const{fontSize:t,markerSize:i,markerSpacing:s,itemSpacing:n}=kt(this.chartConfig.legendFontSize),o=t+n,h=this.boundingRect.x+this.chartConfig.legendPadding,p=this.boundingRect.y+this.chartConfig.legendPadding,u=[],f=[];for(const[R,C]of this.visiblePlots.entries())if(pt(C))u.push({x:h,y:p+R*o,width:i,height:i,fill:C.fill,strokeFill:C.fill,strokeWidth:0});else{const y=p+R*o+i/2;f.push({path:`M ${h},${y} L ${h+i},${y}`,strokeFill:C.strokeFill,strokeWidth:C.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:u},{groupTexts:["legend","markers"],type:"path",data:f},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((R,C)=>({text:R.title,x:h+i+s,y:p+C*o+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:t,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}},a(et,"ChartLegend"),et);function Qt(e,t,i,s){const n=new Pt(s);return new Vi(n,e,t,i)}a(Qt,"getChartLegendComponent");var st,Fi=(st=class{constructor(t,i,s,n,o){this.plotData=t,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=o}getDrawableElement(){const t=this.plotData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]);let i;if(this.orientation==="horizontal"?i=Xt().y(n=>n[0]).x(n=>n[1])(t):i=Xt().x(n=>n[0]).y(n=>n[1])(t),!i)return[];const s=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){const h=[];for(const[p,[u,f]]of t.entries()){const R=this.plotData.pointLabels[p];R&&(this.orientation==="horizontal"?h.push({x:f+10,y:u,text:R,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0}):h.push({x:u,y:f-10,text:R,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0}))}h.length>0&&s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:h})}return s}},a(st,"LinePlot"),st),nt,Wi=(nt=class{constructor(t,i,s,n,o,h){this.barData=t,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=o,this.plotIndex=h}getDrawableElement(){const t=this.barData.data.map(o=>[this.xAxis.getScaleValue(o[0]),this.yAxis.getScaleValue(o[1])]),s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),n=s/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(o=>({x:this.boundingRect.x,y:o[0]-n,height:s,width:o[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(o=>({x:o[0]-n,y:o[1],width:s,height:this.boundingRect.y+this.boundingRect.height-o[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},a(nt,"BarPlot"),nt),at,Xi=(at=class{constructor(t,i,s){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");const t=[];for(const[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{const n=new Fi(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break;case"bar":{const n=new Wi(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break}return t}},a(at,"BasePlot"),at);function Kt(e,t,i){return new Xi(e,t,i)}a(Kt,"getPlotComponent");var ot,Ni=(ot=class{constructor(t,i,s,n){this.chartConfig=t,this.chartData=i,this.componentStore={title:jt(t,i,s,n),plot:Kt(t,i,s),legend:Qt(t,i,s,n),xAxis:_t(i.xAxis,t.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:_t(i.yAxis,t.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,o={width:0,height:0},h=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),p=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),u=this.componentStore.plot.calculateSpace({width:h,height:p});t-=u.width,i-=u.height,u=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=u.height,i-=u.height,this.componentStore.xAxis.setAxisPosition("bottom"),u=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=u.height,this.componentStore.yAxis.setAxisPosition("left"),u=this.componentStore.yAxis.calculateSpace({width:t,height:i}),s=u.width,t-=u.width,o=this.componentStore.legend.calculateSpace({width:t,height:p}),t-=o.width,t>0&&(h+=t,t=0),i>0&&(p+=i,i=0),this.componentStore.plot.calculateSpace({width:h,height:p}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.legend.setBoundingBoxXY({x:s+h,y:n+Math.max((p-o.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+h]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+p}),this.componentStore.yAxis.setRange([n,n+p]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(f=>pt(f))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,o=0,h={width:0,height:0},p=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),u=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),f=this.componentStore.plot.calculateSpace({width:p,height:u});t-=f.width,i-=f.height,f=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=f.height,i-=f.height,this.componentStore.xAxis.setAxisPosition("left"),f=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=f.width,n=f.width,this.componentStore.yAxis.setAxisPosition("top"),f=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=f.height,o=s+f.height,h=this.componentStore.legend.calculateSpace({width:t,height:u}),t-=h.width,t>0&&(p+=t,t=0),i>0&&(u+=i,i=0),this.componentStore.plot.calculateSpace({width:p,height:u}),this.componentStore.plot.setBoundingBoxXY({x:n,y:o}),this.componentStore.legend.setBoundingBoxXY({x:n+p,y:o+Math.max((u-h.height)/2,0)}),this.componentStore.yAxis.setRange([n,n+p]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([o,o+u]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:o}),this.chartData.plots.some(R=>pt(R))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},a(ot,"Orchestrator"),ot),rt,Yi=(rt=class{static build(t,i,s,n){return new Ni(t,i,s,n).getDrawableElement()}},a(rt,"XYChartBuilder"),rt),ct=0,Zt,gt=Et(),ut=Lt(),w=Mt(),Tt=ut.plotColorPalette.split(",").map(e=>e.trim()),yt=!1,vt=!1;function Lt(){const e=ki(),t=Dt();return qt(e.xyChart,t.themeVariables.xyChart)}a(Lt,"getChartDefaultThemeConfig");function Et(){const e=Dt();return qt(_i.xyChart,e.xyChart)}a(Et,"getChartDefaultConfig");function Mt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}a(Mt,"getChartDefaultData");function q(e){const t=Dt();return Ri(e.trim(),t)}a(q,"textSanitizer");function Jt(e){Zt=e}a(Jt,"setTmpSVGG");function ti(e){e==="horizontal"?gt.chartOrientation="horizontal":gt.chartOrientation="vertical"}a(ti,"setOrientation");function ii(e){w.xAxis.title=q(e.text)}a(ii,"setXAxisTitle");function It(e,t){w.xAxis={type:"linear",title:w.xAxis.title,min:e,max:t},yt=!0}a(It,"setXAxisRangeData");function ei(e){w.xAxis={type:"band",title:w.xAxis.title,categories:e.map(t=>q(t.text))},yt=!0}a(ei,"setXAxisBand");function si(e){w.yAxis.title=q(e.text)}a(si,"setYAxisTitle");function ni(e,t){w.yAxis={type:"linear",title:w.yAxis.title,min:e,max:t},vt=!0}a(ni,"setYAxisRangeData");function ai(e){const t=Math.min(...e),i=Math.max(...e),s=Q(w.yAxis)?w.yAxis.min:1/0,n=Q(w.yAxis)?w.yAxis.max:-1/0;w.yAxis={type:"linear",title:w.yAxis.title,min:Math.min(s,t),max:Math.max(n,i)}}a(ai,"setYAxisRangeFromPlotData");function zt(e){let t=[];if(e.length===0)return t;if(!yt){const i=Q(w.xAxis)?w.xAxis.min:1/0,s=Q(w.xAxis)?w.xAxis.max:-1/0;It(Math.min(i,1),Math.max(s,e.length))}if(mt(w.xAxis)&&e.length>w.xAxis.categories.length&&(e=e.slice(0,w.xAxis.categories.length)),vt||ai(e),mt(w.xAxis)&&(t=w.xAxis.categories.map((i,s)=>[i,e[s]])),Q(w.xAxis)){const i=w.xAxis.min,s=w.xAxis.max;if(e.length===1)t=[[`${i}`,e[0]]];else{const n=(s-i)/(e.length-1);t=e.map((o,h)=>[`${i+h*n}`,o])}}return t}a(zt,"transformDataWithoutCategory");function Bt(e){return Tt[e===0?0:e%Tt.length]}a(Bt,"getPlotColorFromPalette");function oi(e,t){const i=t.map(h=>h.value),s=t.map(h=>h.label?q(h.label):""),n=zt(i),o=s.some(h=>h!=="");w.plots.push({type:"line",title:q(e.text),strokeFill:Bt(ct),strokeWidth:2,data:n,...o?{pointLabels:s}:{}}),ct++}a(oi,"setLineData");function ri(e,t){const i=t.map(n=>n.value),s=zt(i);w.plots.push({type:"bar",title:q(e.text),fill:Bt(ct),data:s}),ct++}a(ri,"setBarData");function hi(){if(w.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return w.title=$t(),Yi.build(gt,w,ut,Zt)}a(hi,"getDrawableElem");function li(){return ut}a(li,"getChartThemeConfig");function ci(){return gt}a(ci,"getChartConfig");function gi(){return w}a(gi,"getXYChartData");var Hi=a(function(){Si(),ct=0,gt=Et(),w=Mt(),ut=Lt(),Tt=ut.plotColorPalette.split(",").map(e=>e.trim()),yt=!1,vt=!1},"clear"),$i={getDrawableElem:hi,clear:Hi,setAccTitle:wi,getAccTitle:bi,setDiagramTitle:yi,getDiagramTitle:$t,getAccDescription:mi,setAccDescription:pi,setOrientation:ti,setXAxisTitle:ii,setXAxisRangeData:It,setXAxisBand:ei,setYAxisTitle:si,setYAxisRangeData:ni,setLineData:oi,setBarData:ri,setTmpSVGG:Jt,getChartThemeConfig:li,getChartConfig:ci,getXYChartData:gi},Ui=a((e,t,i,s)=>{const n=s.db,o=n.getChartThemeConfig(),h=n.getChartConfig(),p=n.getXYChartData().plots[0].data.map(b=>b[1]);function u(b){return b==="top"?"text-before-edge":"middle"}a(u,"getDominantBaseLine");function f(b){return b==="left"?"start":b==="right"?"end":"middle"}a(f,"getTextAnchor");function R(b){return`translate(${b.x}, ${b.y}) rotate(${b.rotation||0})`}a(R,"getTextTransformation"),Ut.debug(`Rendering xychart chart
|
|
7
|
+
`+e);const C=Ai(t),y=C.append("g").attr("class","main"),E=y.append("rect").attr("width",h.width).attr("height",h.height).attr("class","background");Ci(C,h.height,h.width,!0),C.attr("viewBox",`0 0 ${h.width} ${h.height}`),E.attr("fill",o.backgroundColor),n.setTmpSVGG(C.append("g").attr("class","mermaid-tmp-group"));const v=n.getDrawableElem(),L={};function M(b){let D=y,c="";for(const[B]of b.entries()){let F=y;B>0&&L[c]&&(F=L[c]),c+=b[B],D=L[c],D||(D=L[c]=F.append("g").attr("class",b[B]))}return D}a(M,"getGroup");for(const b of v){if(b.data.length===0)continue;const D=M(b.groupTexts);switch(b.type){case"rect":if(D.selectAll("rect").data(b.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),h.showDataLabel){const c=h.showDataLabelOutsideBar;if(h.chartOrientation==="horizontal"){let B=function(S,O){const{data:T,label:ht}=S;return O*ht.length*F<=T.width-X};a(B,"fitsHorizontally");const F=.7,X=10,N=b.data.map((S,O)=>({data:S,label:p[O].toString()})).filter(S=>S.data.width>0&&S.data.height>0),k=N.map(S=>{const{data:O}=S;let T=O.height*.7;for(;!B(S,T)&&T>0;)T-=1;return T}),H=Math.floor(Math.min(...k)),A=a(S=>c?S.data.x+S.data.width+X:S.data.x+S.data.width-X,"determineLabelXPosition");D.selectAll("text").data(N).enter().append("text").attr("x",A).attr("y",S=>S.data.y+S.data.height/2).attr("text-anchor",c?"start":"end").attr("dominant-baseline","middle").attr("fill",o.dataLabelColor).attr("font-size",`${H}px`).text(S=>S.label)}else{let B=function(A,S,O){const{data:T,label:ht}=A,W=S*ht.length*.7,l=T.x+T.width/2,g=l-W/2,d=l+W/2,x=g>=T.x&&d<=T.x+T.width,_=T.y+O+S<=T.y+T.height;return x&&_};a(B,"fitsInBar");const F=10,X=b.data.map((A,S)=>({data:A,label:p[S].toString()})).filter(A=>A.data.width>0&&A.data.height>0),N=X.map(A=>{const{data:S,label:O}=A;let T=S.width/(O.length*.7);for(;!B(A,T,F)&&T>0;)T-=1;return T}),k=Math.floor(Math.min(...N)),H=a(A=>c?A.data.y-F:A.data.y+F,"determineLabelYPosition");D.selectAll("text").data(X).enter().append("text").attr("x",A=>A.data.x+A.data.width/2).attr("y",H).attr("text-anchor","middle").attr("dominant-baseline",c?"auto":"hanging").attr("fill",o.dataLabelColor).attr("font-size",`${k}px`).text(A=>A.label)}}break;case"text":D.selectAll("text").data(b.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=>u(c.verticalPos)).attr("text-anchor",c=>f(c.horizontalPos)).attr("transform",c=>R(c)).text(c=>c.text);break;case"path":D.selectAll("path").data(b.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"),qi={draw:Ui},ie={parser:Li,db:$i,renderer:qi};export{ie as diagram};
|
package/dist/client/index.html
CHANGED
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--pi-bg); color: var(--pi-text); }
|
|
58
58
|
body { min-height: 100dvh; }
|
|
59
59
|
</style>
|
|
60
|
-
<script type="module" crossorigin src="/assets/index-
|
|
61
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-editor-core-
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-editor-languages-
|
|
63
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
60
|
+
<script type="module" crossorigin src="/assets/index-D-PvDSJs.js"></script>
|
|
61
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-editor-core-BG7M-EQ-.js">
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-editor-languages-pDmyn-oC.js">
|
|
63
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DSGiUJZL.css">
|
|
64
64
|
</head>
|
|
65
65
|
<body>
|
|
66
66
|
<omp-web-app></omp-web-app>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Generated from omp-web-plugins/mcps/mcpsLogic.ts. Do not edit directly.
|
|
2
|
+
export const PROJECT_MCP_FILES = [".mcp.json", "mcp.json", ".omp/mcp.json"];
|
|
3
|
+
export function isMcpConfigFile(value) {
|
|
4
|
+
return (typeof value === "object" &&
|
|
5
|
+
value !== null &&
|
|
6
|
+
"mcpServers" in value &&
|
|
7
|
+
typeof value.mcpServers === "object" &&
|
|
8
|
+
value.mcpServers !== null);
|
|
9
|
+
}
|
|
10
|
+
export function parseMcpConfigFile(raw) {
|
|
11
|
+
try {
|
|
12
|
+
const parsed = JSON.parse(raw);
|
|
13
|
+
if (isMcpConfigFile(parsed)) {
|
|
14
|
+
return parsed;
|
|
15
|
+
}
|
|
16
|
+
return { mcpServers: {} };
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return { mcpServers: {} };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function formatTransport(config) {
|
|
23
|
+
if (config.type !== undefined)
|
|
24
|
+
return config.type;
|
|
25
|
+
if (config.url !== undefined)
|
|
26
|
+
return "http";
|
|
27
|
+
return "stdio";
|
|
28
|
+
}
|
|
29
|
+
export function formatCommandOrUrl(config) {
|
|
30
|
+
if (config.url !== undefined && config.url !== "") {
|
|
31
|
+
return config.url;
|
|
32
|
+
}
|
|
33
|
+
const cmd = config.command ?? "";
|
|
34
|
+
const args = config.args?.join(" ") ?? "";
|
|
35
|
+
return [cmd, args].filter(Boolean).join(" ");
|
|
36
|
+
}
|
|
37
|
+
export function isServerEnabled(config) {
|
|
38
|
+
return config.enabled !== false;
|
|
39
|
+
}
|
|
40
|
+
export function countActiveServers(state) {
|
|
41
|
+
let count = 0;
|
|
42
|
+
for (const server of Object.values(state.projectServers)) {
|
|
43
|
+
if (isServerEnabled(server))
|
|
44
|
+
count++;
|
|
45
|
+
}
|
|
46
|
+
for (const server of Object.values(state.globalServers)) {
|
|
47
|
+
if (isServerEnabled(server))
|
|
48
|
+
count++;
|
|
49
|
+
}
|
|
50
|
+
return count;
|
|
51
|
+
}
|
|
52
|
+
export function countFailedServers(state) {
|
|
53
|
+
if (!state.checkResults)
|
|
54
|
+
return 0;
|
|
55
|
+
let count = 0;
|
|
56
|
+
for (const check of Object.values(state.checkResults)) {
|
|
57
|
+
if (check.status === "failed")
|
|
58
|
+
count++;
|
|
59
|
+
}
|
|
60
|
+
return count;
|
|
61
|
+
}
|
|
62
|
+
export function toggleServerInConfig(raw, serverName) {
|
|
63
|
+
try {
|
|
64
|
+
const parsed = JSON.parse(raw);
|
|
65
|
+
if (isMcpConfigFile(parsed) && parsed.mcpServers !== undefined) {
|
|
66
|
+
const servers = parsed.mcpServers;
|
|
67
|
+
const target = servers[serverName];
|
|
68
|
+
if (target !== undefined) {
|
|
69
|
+
target.enabled = !isServerEnabled(target);
|
|
70
|
+
return JSON.stringify(parsed, null, 2) + "\n";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Return original on parse error
|
|
76
|
+
}
|
|
77
|
+
return raw;
|
|
78
|
+
}
|