mermaid 13.0.0-alpha.2 → 13.0.0-alpha.3
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/THIRD_PARTY_NOTICES +95 -0
- package/dist/api.js +30 -10
- package/dist/chunks/chunk-2G45NV5W.mjs +2 -0
- package/dist/chunks/chunk-2G45NV5W.mjs.map +1 -0
- package/dist/chunks/chunk-2MDKOWUQ.mjs +11 -0
- package/dist/chunks/chunk-2MDKOWUQ.mjs.map +1 -0
- package/dist/chunks/chunk-33QZBPQK.mjs +2 -0
- package/dist/chunks/chunk-33QZBPQK.mjs.map +1 -0
- package/dist/chunks/{chunk-BFIZPEAM.mjs → chunk-4DR73ZXX.mjs} +2 -2
- package/dist/chunks/{chunk-3SMLKEUJ.mjs → chunk-4XJZCOJ5.mjs} +3 -3
- package/dist/chunks/chunk-53XKVPPJ.mjs +2 -0
- package/dist/chunks/chunk-53XKVPPJ.mjs.map +1 -0
- package/dist/chunks/chunk-55IU7BZR.mjs +2 -0
- package/dist/chunks/chunk-55IU7BZR.mjs.map +1 -0
- package/dist/chunks/{chunk-2SBABYQO.mjs → chunk-66W4K2AQ.mjs} +2 -2
- package/dist/chunks/{chunk-X3VGHK3G.mjs → chunk-7M5U2MEN.mjs} +2 -2
- package/dist/chunks/chunk-7ZMEJOJJ.mjs +7 -0
- package/dist/chunks/chunk-7ZMEJOJJ.mjs.map +1 -0
- package/dist/chunks/chunk-AVHUPARR.mjs +3 -0
- package/dist/chunks/chunk-AVHUPARR.mjs.map +1 -0
- package/dist/chunks/{chunk-J2CYG3BU.mjs → chunk-AWBQHRRG.mjs} +2 -2
- package/dist/chunks/chunk-B3YRDLFF.mjs +2 -0
- package/dist/chunks/chunk-B3YRDLFF.mjs.map +1 -0
- package/dist/chunks/chunk-BNYOSPTM.mjs +7 -0
- package/dist/chunks/chunk-BNYOSPTM.mjs.map +1 -0
- package/dist/chunks/chunk-CR7BS4ZT.mjs +2 -0
- package/dist/chunks/{chunk-IY435URU.mjs.map → chunk-CR7BS4ZT.mjs.map} +1 -1
- package/dist/chunks/{chunk-WBKKKHXZ.mjs → chunk-D57VZ7SP.mjs} +2 -2
- package/dist/chunks/{chunk-WBKKKHXZ.mjs.map → chunk-D57VZ7SP.mjs.map} +1 -1
- package/dist/chunks/{chunk-ZVYEDT2M.mjs → chunk-DAWKCFB3.mjs} +2 -2
- package/dist/chunks/{chunk-JL46TWOM.mjs → chunk-DXRKQGX5.mjs} +2 -2
- package/dist/chunks/{chunk-X3UAU7VF.mjs → chunk-E6QAXEJ5.mjs} +2 -2
- package/dist/chunks/{chunk-3QHCWLG2.mjs → chunk-ECJELNAF.mjs} +2 -2
- package/dist/chunks/{chunk-3QHCWLG2.mjs.map → chunk-ECJELNAF.mjs.map} +1 -1
- package/dist/chunks/chunk-F4JMGHZK.mjs +2 -0
- package/dist/chunks/chunk-F4JMGHZK.mjs.map +1 -0
- package/dist/chunks/{chunk-JN7HU5Z4.mjs → chunk-FSPKR3UC.mjs} +2 -2
- package/dist/chunks/chunk-GAH5QBYB.mjs +6 -0
- package/dist/chunks/chunk-GAH5QBYB.mjs.map +1 -0
- package/dist/chunks/{chunk-IOHHGREU.mjs → chunk-GBVNGTXG.mjs} +2 -2
- package/dist/chunks/{chunk-DTOBFHMA.mjs → chunk-HVBYWS5S.mjs} +7 -7
- package/dist/chunks/chunk-HVBYWS5S.mjs.map +1 -0
- package/dist/chunks/{chunk-VRD5GZ6G.mjs → chunk-I22UEOUC.mjs} +2 -2
- package/dist/chunks/chunk-IJ5P4GFV.mjs +2 -0
- package/dist/chunks/chunk-IJ5P4GFV.mjs.map +1 -0
- package/dist/chunks/chunk-IPLCT667.mjs +2 -0
- package/dist/chunks/chunk-IPLCT667.mjs.map +1 -0
- package/dist/chunks/{chunk-RUW4Q76Y.mjs → chunk-IXOM253I.mjs} +2 -2
- package/dist/chunks/chunk-J6NFIU3A.mjs +5 -0
- package/dist/chunks/chunk-J6NFIU3A.mjs.map +1 -0
- package/dist/chunks/chunk-JDIMSSA6.mjs +6 -0
- package/dist/chunks/chunk-JDIMSSA6.mjs.map +1 -0
- package/dist/chunks/chunk-JDOD4XCT.mjs +2 -0
- package/dist/chunks/chunk-JDOD4XCT.mjs.map +1 -0
- package/dist/chunks/{chunk-TJOE3FON.mjs → chunk-JYMLZQ2B.mjs} +2 -2
- package/dist/chunks/{chunk-ICB73T2E.mjs → chunk-KJT4SRSJ.mjs} +17 -17
- package/dist/chunks/{chunk-ICB73T2E.mjs.map → chunk-KJT4SRSJ.mjs.map} +1 -1
- package/dist/chunks/chunk-KX2OAC2D.mjs +5 -0
- package/dist/chunks/chunk-KX2OAC2D.mjs.map +1 -0
- package/dist/chunks/chunk-LKH6V7B5.mjs +2 -0
- package/dist/chunks/chunk-LKH6V7B5.mjs.map +1 -0
- package/dist/chunks/chunk-LQYFD6JY.mjs +10 -0
- package/dist/chunks/chunk-LQYFD6JY.mjs.map +1 -0
- package/dist/chunks/{chunk-NGL2KHQW.mjs → chunk-LXCHQLNA.mjs} +2 -2
- package/dist/chunks/chunk-MBJJBXJZ.mjs +16 -0
- package/dist/chunks/chunk-MBJJBXJZ.mjs.map +1 -0
- package/dist/chunks/{chunk-FSN3B5SH.mjs → chunk-ODVGAOCZ.mjs} +2 -2
- package/dist/chunks/{chunk-DUKAL7EW.mjs → chunk-OKDL7PKZ.mjs} +2 -2
- package/dist/chunks/chunk-PVRCMZP4.mjs +6 -0
- package/dist/chunks/chunk-PVRCMZP4.mjs.map +1 -0
- package/dist/chunks/{chunk-NM2RNLMZ.mjs → chunk-Q7W6MMRR.mjs} +2 -2
- package/dist/chunks/chunk-QYJEIDIR.mjs +6 -0
- package/dist/chunks/chunk-QYJEIDIR.mjs.map +1 -0
- package/dist/chunks/{chunk-G5JCFFZO.mjs → chunk-SE5N425R.mjs} +2 -2
- package/dist/chunks/{chunk-WINJRA54.mjs → chunk-SYA7GVFH.mjs} +2 -2
- package/dist/chunks/{chunk-WJD3LR33.mjs → chunk-UN4MBN2V.mjs} +2 -2
- package/dist/chunks/{chunk-FYF7T3FM.mjs → chunk-UWZJI5W3.mjs} +2 -2
- package/dist/chunks/chunk-V4K3YOUF.mjs +11 -0
- package/dist/chunks/chunk-V4K3YOUF.mjs.map +1 -0
- package/dist/chunks/chunk-VXHJOKOD.mjs +2 -0
- package/dist/chunks/chunk-VXHJOKOD.mjs.map +1 -0
- package/dist/chunks/{chunk-HVRHH7BT.mjs → chunk-X5LC6Z6E.mjs} +2 -2
- package/dist/chunks/chunk-YKQIHLV5.mjs +2 -0
- package/dist/chunks/chunk-YKQIHLV5.mjs.map +1 -0
- package/dist/chunks/chunk-YQGIJV4G.mjs +2 -0
- package/dist/chunks/chunk-YQGIJV4G.mjs.map +1 -0
- package/dist/chunks/{chunk-KHWLAZE2.mjs → chunk-ZPEZXPWQ.mjs} +2 -2
- package/dist/chunks/core-layout-compass-index.mjs +2 -0
- package/dist/chunks/core-layout-compass-index.mjs.map +1 -0
- package/dist/chunks/core-layout-hops-index.mjs +2 -0
- package/dist/chunks/core-layout-hops-index.mjs.map +1 -0
- package/dist/chunks/core-layout-swimlane-index.mjs +2 -0
- package/dist/chunks/core-layout-swimlane-index.mjs.map +1 -0
- package/dist/chunks/core-layout-tree-index.mjs +1 -1
- package/dist/chunks/core-layout-tree-index.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-base.mjs +1 -1
- package/dist/chunks/core-theme-specs-base.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-dark.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-default.mjs +1 -1
- package/dist/chunks/core-theme-specs-default.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-forest.mjs +1 -1
- package/dist/chunks/core-theme-specs-forest.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neo-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-neo-dark.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neo.mjs +1 -1
- package/dist/chunks/core-theme-specs-neo.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neutral.mjs +1 -1
- package/dist/chunks/core-theme-specs-neutral.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-redux-dark-color.mjs +1 -1
- package/dist/chunks/core-theme-specs-redux-dark-color.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-redux-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-redux-dark.mjs.map +1 -1
- package/dist/chunks/diagram-agentflow-ascii.mjs +5 -0
- package/dist/chunks/diagram-agentflow-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-agentflow-language.mjs +32 -0
- package/dist/chunks/diagram-agentflow-language.mjs.map +1 -0
- package/dist/chunks/diagram-agentflow.mjs +2 -0
- package/dist/chunks/diagram-agentflow.mjs.map +1 -0
- package/dist/chunks/diagram-architecture-language.mjs +23 -0
- package/dist/chunks/diagram-architecture-language.mjs.map +1 -0
- package/dist/chunks/diagram-architecture.mjs +2 -0
- package/dist/chunks/diagram-architecture.mjs.map +1 -0
- package/dist/chunks/diagram-block-ascii.mjs +4 -0
- package/dist/chunks/diagram-block-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-block-language.mjs +14 -0
- package/dist/chunks/diagram-block-language.mjs.map +1 -0
- package/dist/chunks/diagram-block.mjs +2 -0
- package/dist/chunks/diagram-block.mjs.map +1 -0
- package/dist/chunks/diagram-c4-ascii.mjs +4 -0
- package/dist/chunks/diagram-c4-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-c4-language.mjs +20 -0
- package/dist/chunks/diagram-c4-language.mjs.map +1 -0
- package/dist/chunks/diagram-c4.mjs +2 -0
- package/dist/chunks/diagram-c4.mjs.map +1 -0
- package/dist/chunks/diagram-class-language.mjs +1 -1
- package/dist/chunks/diagram-class-language.mjs.map +1 -1
- package/dist/chunks/diagram-class.mjs +1 -1
- package/dist/chunks/diagram-cynefin-language.mjs +1 -1
- package/dist/chunks/diagram-cynefin-language.mjs.map +1 -1
- package/dist/chunks/diagram-cynefin.mjs +1 -1
- package/dist/chunks/diagram-er-ascii.mjs +1 -1
- package/dist/chunks/diagram-er-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-er-language.mjs +1 -1
- package/dist/chunks/diagram-er-language.mjs.map +1 -1
- package/dist/chunks/diagram-er.mjs +1 -1
- package/dist/chunks/diagram-eventmodeling-language.mjs +21 -0
- package/dist/chunks/diagram-eventmodeling-language.mjs.map +1 -0
- package/dist/chunks/diagram-eventmodeling.mjs +3 -0
- package/dist/chunks/diagram-eventmodeling.mjs.map +1 -0
- package/dist/chunks/diagram-flowchart-ascii.mjs +3 -3
- package/dist/chunks/diagram-flowchart-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart-lanes.mjs +2 -0
- package/dist/chunks/diagram-flowchart-lanes.mjs.map +1 -0
- package/dist/chunks/diagram-flowchart-language.mjs +1 -1
- package/dist/chunks/diagram-flowchart-language.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart.mjs +1 -1
- package/dist/chunks/diagram-flowchart.mjs.map +1 -1
- package/dist/chunks/diagram-gantt-language.mjs +1 -1
- package/dist/chunks/diagram-gantt-language.mjs.map +1 -1
- package/dist/chunks/diagram-gantt.mjs +1 -1
- package/dist/chunks/diagram-gitgraph-language.mjs +1 -1
- package/dist/chunks/diagram-gitgraph-language.mjs.map +1 -1
- package/dist/chunks/diagram-gitgraph.mjs +1 -1
- package/dist/chunks/diagram-gitgraph.mjs.map +1 -1
- package/dist/chunks/diagram-info-ascii.mjs +1 -1
- package/dist/chunks/diagram-info-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-info-language.mjs +1 -1
- package/dist/chunks/diagram-info-language.mjs.map +1 -1
- package/dist/chunks/diagram-info.mjs +1 -1
- package/dist/chunks/diagram-ishikawa-ascii.mjs +4 -0
- package/dist/chunks/diagram-ishikawa-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-ishikawa-language.mjs +13 -0
- package/dist/chunks/diagram-ishikawa-language.mjs.map +1 -0
- package/dist/chunks/diagram-ishikawa.mjs +2 -0
- package/dist/chunks/diagram-ishikawa.mjs.map +1 -0
- package/dist/chunks/diagram-journey-language.mjs +1 -1
- package/dist/chunks/diagram-journey-language.mjs.map +1 -1
- package/dist/chunks/diagram-journey.mjs +1 -1
- package/dist/chunks/diagram-journey.mjs.map +1 -1
- package/dist/chunks/diagram-kanban-ascii.mjs +2 -2
- package/dist/chunks/diagram-kanban-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-kanban-language.mjs +1 -1
- package/dist/chunks/diagram-kanban-language.mjs.map +1 -1
- package/dist/chunks/diagram-kanban.mjs +1 -1
- package/dist/chunks/diagram-mindmap-language.mjs +1 -1
- package/dist/chunks/diagram-mindmap-language.mjs.map +1 -1
- package/dist/chunks/diagram-mindmap.mjs +1 -1
- package/dist/chunks/diagram-mindmap.mjs.map +1 -1
- package/dist/chunks/diagram-packet-ascii.mjs +1 -1
- package/dist/chunks/diagram-packet-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-packet-language.mjs +1 -1
- package/dist/chunks/diagram-packet-language.mjs.map +1 -1
- package/dist/chunks/diagram-packet.mjs +1 -1
- package/dist/chunks/diagram-pie-language.mjs +1 -1
- package/dist/chunks/diagram-pie-language.mjs.map +1 -1
- package/dist/chunks/diagram-pie.mjs +1 -1
- package/dist/chunks/diagram-quadrant-language.mjs +1 -1
- package/dist/chunks/diagram-quadrant-language.mjs.map +1 -1
- package/dist/chunks/diagram-quadrant.mjs +1 -1
- package/dist/chunks/diagram-quadrant.mjs.map +1 -1
- package/dist/chunks/diagram-radar-language.mjs +1 -1
- package/dist/chunks/diagram-radar-language.mjs.map +1 -1
- package/dist/chunks/diagram-radar.mjs +1 -1
- package/dist/chunks/diagram-radar.mjs.map +1 -1
- package/dist/chunks/diagram-railroad-ascii.mjs +2 -0
- package/dist/chunks/diagram-railroad-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-railroad-language.mjs +18 -0
- package/dist/chunks/diagram-railroad-language.mjs.map +1 -0
- package/dist/chunks/diagram-railroad.mjs +2 -0
- package/dist/chunks/diagram-railroad.mjs.map +1 -0
- package/dist/chunks/diagram-requirement-ascii.mjs +5 -0
- package/dist/chunks/diagram-requirement-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-requirement-language.mjs +25 -0
- package/dist/chunks/diagram-requirement-language.mjs.map +1 -0
- package/dist/chunks/diagram-requirement.mjs +2 -0
- package/dist/chunks/diagram-requirement.mjs.map +1 -0
- package/dist/chunks/diagram-sankey-language.mjs +1 -1
- package/dist/chunks/diagram-sankey-language.mjs.map +1 -1
- package/dist/chunks/diagram-sankey.mjs +1 -1
- package/dist/chunks/diagram-sequence-ascii.mjs +1 -1
- package/dist/chunks/diagram-sequence-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-sequence-language.mjs +1 -1
- package/dist/chunks/diagram-sequence-language.mjs.map +1 -1
- package/dist/chunks/diagram-sequence.mjs +1 -1
- package/dist/chunks/diagram-sequence.mjs.map +1 -1
- package/dist/chunks/diagram-state-language.mjs +1 -1
- package/dist/chunks/diagram-state-language.mjs.map +1 -1
- package/dist/chunks/diagram-state.mjs +1 -1
- package/dist/chunks/diagram-timeline-language.mjs +1 -1
- package/dist/chunks/diagram-timeline-language.mjs.map +1 -1
- package/dist/chunks/diagram-timeline.mjs +1 -1
- package/dist/chunks/diagram-treemap-language.mjs +1 -1
- package/dist/chunks/diagram-treemap-language.mjs.map +1 -1
- package/dist/chunks/diagram-treemap.mjs +1 -1
- package/dist/chunks/diagram-treeview-ascii.mjs +4 -0
- package/dist/chunks/diagram-treeview-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-treeview-language.mjs +10 -0
- package/dist/chunks/diagram-treeview-language.mjs.map +1 -0
- package/dist/chunks/diagram-treeview.mjs +2 -0
- package/dist/chunks/diagram-treeview.mjs.map +1 -0
- package/dist/chunks/diagram-usecase-ascii.mjs +5 -0
- package/dist/chunks/diagram-usecase-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-usecase-language.mjs +17 -0
- package/dist/chunks/diagram-usecase-language.mjs.map +1 -0
- package/dist/chunks/diagram-usecase.mjs +3 -0
- package/dist/chunks/diagram-usecase.mjs.map +1 -0
- package/dist/chunks/diagram-venn-language.mjs +1 -1
- package/dist/chunks/diagram-venn-language.mjs.map +1 -1
- package/dist/chunks/diagram-venn.mjs +1 -1
- package/dist/chunks/diagram-wardley-language.mjs +1 -1
- package/dist/chunks/diagram-wardley-language.mjs.map +1 -1
- package/dist/chunks/diagram-wardley.mjs +1 -1
- package/dist/chunks/diagram-xychart-language.mjs +1 -1
- package/dist/chunks/diagram-xychart-language.mjs.map +1 -1
- package/dist/chunks/diagram-xychart.mjs +1 -1
- package/dist/chunks/mermaid-ascii.mjs +1 -1
- package/dist/config-snapshot.d.ts +10 -3
- package/dist/config-snapshot.js +29 -14
- package/dist/generated/detectors.gen.js +15 -15
- package/dist/generated/registry.gen.js +113 -14
- package/dist/mermaid.esm.min.mjs +3 -3
- package/dist/mermaid.esm.min.mjs.map +1 -1
- package/dist/registry.d.ts +36 -5
- package/dist/registry.js +66 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +34 -24
- package/dist/chunks/chunk-BBQQRPRV.mjs +0 -3
- package/dist/chunks/chunk-BBQQRPRV.mjs.map +0 -1
- package/dist/chunks/chunk-DTOBFHMA.mjs.map +0 -1
- package/dist/chunks/chunk-IY435URU.mjs +0 -2
- package/dist/chunks/chunk-MTHJHLUH.mjs +0 -2
- package/dist/chunks/chunk-MTHJHLUH.mjs.map +0 -1
- package/dist/chunks/chunk-SNYNP3PS.mjs +0 -5
- package/dist/chunks/chunk-SNYNP3PS.mjs.map +0 -1
- /package/dist/chunks/{chunk-BFIZPEAM.mjs.map → chunk-4DR73ZXX.mjs.map} +0 -0
- /package/dist/chunks/{chunk-3SMLKEUJ.mjs.map → chunk-4XJZCOJ5.mjs.map} +0 -0
- /package/dist/chunks/{chunk-2SBABYQO.mjs.map → chunk-66W4K2AQ.mjs.map} +0 -0
- /package/dist/chunks/{chunk-X3VGHK3G.mjs.map → chunk-7M5U2MEN.mjs.map} +0 -0
- /package/dist/chunks/{chunk-J2CYG3BU.mjs.map → chunk-AWBQHRRG.mjs.map} +0 -0
- /package/dist/chunks/{chunk-ZVYEDT2M.mjs.map → chunk-DAWKCFB3.mjs.map} +0 -0
- /package/dist/chunks/{chunk-JL46TWOM.mjs.map → chunk-DXRKQGX5.mjs.map} +0 -0
- /package/dist/chunks/{chunk-X3UAU7VF.mjs.map → chunk-E6QAXEJ5.mjs.map} +0 -0
- /package/dist/chunks/{chunk-JN7HU5Z4.mjs.map → chunk-FSPKR3UC.mjs.map} +0 -0
- /package/dist/chunks/{chunk-IOHHGREU.mjs.map → chunk-GBVNGTXG.mjs.map} +0 -0
- /package/dist/chunks/{chunk-VRD5GZ6G.mjs.map → chunk-I22UEOUC.mjs.map} +0 -0
- /package/dist/chunks/{chunk-RUW4Q76Y.mjs.map → chunk-IXOM253I.mjs.map} +0 -0
- /package/dist/chunks/{chunk-TJOE3FON.mjs.map → chunk-JYMLZQ2B.mjs.map} +0 -0
- /package/dist/chunks/{chunk-NGL2KHQW.mjs.map → chunk-LXCHQLNA.mjs.map} +0 -0
- /package/dist/chunks/{chunk-FSN3B5SH.mjs.map → chunk-ODVGAOCZ.mjs.map} +0 -0
- /package/dist/chunks/{chunk-DUKAL7EW.mjs.map → chunk-OKDL7PKZ.mjs.map} +0 -0
- /package/dist/chunks/{chunk-NM2RNLMZ.mjs.map → chunk-Q7W6MMRR.mjs.map} +0 -0
- /package/dist/chunks/{chunk-G5JCFFZO.mjs.map → chunk-SE5N425R.mjs.map} +0 -0
- /package/dist/chunks/{chunk-WINJRA54.mjs.map → chunk-SYA7GVFH.mjs.map} +0 -0
- /package/dist/chunks/{chunk-WJD3LR33.mjs.map → chunk-UN4MBN2V.mjs.map} +0 -0
- /package/dist/chunks/{chunk-FYF7T3FM.mjs.map → chunk-UWZJI5W3.mjs.map} +0 -0
- /package/dist/chunks/{chunk-HVRHH7BT.mjs.map → chunk-X5LC6Z6E.mjs.map} +0 -0
- /package/dist/chunks/{chunk-KHWLAZE2.mjs.map → chunk-ZPEZXPWQ.mjs.map} +0 -0
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -32,6 +32,101 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
32
32
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
33
|
SOFTWARE.
|
|
34
34
|
|
|
35
|
+
Pele, in @mermaid-js/diagram-agentflow
|
|
36
|
+
--------------------------------------
|
|
37
|
+
|
|
38
|
+
The CDN build also bundles @mermaid-js/diagram-agentflow without its legal comments. That
|
|
39
|
+
package's parser/lexer.ts, parser/parser.ts, parser/base.ts, parser/statements.ts,
|
|
40
|
+
parser/model.ts, layout/prepare.ts, layout/shapes.ts, render/shapes.ts and render/edges.ts are
|
|
41
|
+
local copies of @mermaid-js/diagram-flowchart's lexer, parser, builder, shapes and edges (D446,
|
|
42
|
+
D467), which are ported from, or based on, Pele (https://github.com/obsidianmd/pele) at commit
|
|
43
|
+
3a2f075 (release 1.13.0). Pele is used under the MIT License:
|
|
44
|
+
|
|
45
|
+
MIT License
|
|
46
|
+
|
|
47
|
+
Copyright (c) 2026 kepano
|
|
48
|
+
|
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
+
in the Software without restriction, including without limitation the rights
|
|
52
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
+
furnished to do so, subject to the following conditions:
|
|
55
|
+
|
|
56
|
+
The above copyright notice and this permission notice shall be included in all
|
|
57
|
+
copies or substantial portions of the Software.
|
|
58
|
+
|
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
+
SOFTWARE.
|
|
66
|
+
|
|
67
|
+
Pele, in @mermaid-js/diagram-block
|
|
68
|
+
----------------------------------
|
|
69
|
+
|
|
70
|
+
The CDN build also bundles @mermaid-js/diagram-block without its legal comments. That
|
|
71
|
+
package's shapes/leaf.ts, shapes/draw.ts and render/arrowheads.ts are local copies of
|
|
72
|
+
@mermaid-js/diagram-flowchart's shapes and arrowheads (D446), which are ported from, or based
|
|
73
|
+
on, Pele (https://github.com/obsidianmd/pele) at commit 3a2f075 (release 1.13.0). Pele is used
|
|
74
|
+
under the MIT License:
|
|
75
|
+
|
|
76
|
+
MIT License
|
|
77
|
+
|
|
78
|
+
Copyright (c) 2026 kepano
|
|
79
|
+
|
|
80
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
81
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
82
|
+
in the Software without restriction, including without limitation the rights
|
|
83
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
84
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
85
|
+
furnished to do so, subject to the following conditions:
|
|
86
|
+
|
|
87
|
+
The above copyright notice and this permission notice shall be included in all
|
|
88
|
+
copies or substantial portions of the Software.
|
|
89
|
+
|
|
90
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
91
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
92
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
93
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
94
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
95
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
96
|
+
SOFTWARE.
|
|
97
|
+
|
|
98
|
+
Pele, in @mermaid-js/diagram-c4
|
|
99
|
+
-------------------------------
|
|
100
|
+
|
|
101
|
+
The CDN build also bundles @mermaid-js/diagram-c4 without its legal comments. That package's
|
|
102
|
+
layout/grid.ts, layout/layout.ts, layout/metrics.ts, layout/path.ts, layout/route.ts and
|
|
103
|
+
layout/shapes.ts are ported from Pele's C4 grid, relation router and label placement, and its
|
|
104
|
+
render/shapes.ts is a local copy of @mermaid-js/diagram-flowchart's shapes (D446), all ported
|
|
105
|
+
from, or based on, Pele (https://github.com/obsidianmd/pele) at commit 3a2f075 (release
|
|
106
|
+
1.13.0). Pele is used under the MIT License:
|
|
107
|
+
|
|
108
|
+
MIT License
|
|
109
|
+
|
|
110
|
+
Copyright (c) 2026 kepano
|
|
111
|
+
|
|
112
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
113
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
114
|
+
in the Software without restriction, including without limitation the rights
|
|
115
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
116
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
117
|
+
furnished to do so, subject to the following conditions:
|
|
118
|
+
|
|
119
|
+
The above copyright notice and this permission notice shall be included in all
|
|
120
|
+
copies or substantial portions of the Software.
|
|
121
|
+
|
|
122
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
123
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
124
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
125
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
126
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
127
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
128
|
+
SOFTWARE.
|
|
129
|
+
|
|
35
130
|
d3-sankey
|
|
36
131
|
---------
|
|
37
132
|
|
package/dist/api.js
CHANGED
|
@@ -18,7 +18,7 @@ import { createDomAdapter } from "./dom.js";
|
|
|
18
18
|
import { toMermaidError, toWarning } from "./errors.js";
|
|
19
19
|
import { iconPackRegistry, packsUnsupported } from "./icon-packs.js";
|
|
20
20
|
import { selectMeasurer } from "./measurer.js";
|
|
21
|
-
import { builtIn, isElkName, Registry, layoutName, } from "./registry.js";
|
|
21
|
+
import { builtIn, isElkName, LINE_HOPS, Registry, layoutName, } from "./registry.js";
|
|
22
22
|
import { DiscoveryQueue, registerSeam } from "./seam.js";
|
|
23
23
|
import { VERSION } from "./version.js";
|
|
24
24
|
export { defaultIdPrefix } from "./config-snapshot.js";
|
|
@@ -56,10 +56,18 @@ function missingFor(registry, a, text = false) {
|
|
|
56
56
|
const { config } = a.prepared;
|
|
57
57
|
// Text output lays out with core's own `layered`, never a registered engine (D179).
|
|
58
58
|
if (a.plugin.layoutKind === 'graph' && !text) {
|
|
59
|
-
const
|
|
59
|
+
const name = layoutName(config, a.plugin);
|
|
60
|
+
const { need } = registry.layout(name, a.plugin.layoutEngine);
|
|
60
61
|
if (need !== undefined)
|
|
61
62
|
missing.push({ kind: 'layout', name: need });
|
|
62
|
-
|
|
63
|
+
const [part, loaded] = registry.layoutPart(a.plugin, name);
|
|
64
|
+
if (part && !loaded)
|
|
65
|
+
missing.push({ kind: 'layout', name: part });
|
|
66
|
+
}
|
|
67
|
+
// D537: the line-hop chunk when the shared key turns hops on. An engine whose own `lineHops`
|
|
68
|
+
// defaults on (`swimlane`, ELK) carries the step, so loading it loads them.
|
|
69
|
+
if (!text && !registry.hops && config.lineHops)
|
|
70
|
+
missing.push({ kind: 'layout', name: LINE_HOPS });
|
|
63
71
|
// Text output draws no colours, so it needs no theme (D82).
|
|
64
72
|
for (const name of text ? [] : themeNames(config)) {
|
|
65
73
|
if (!loadedTheme(name))
|
|
@@ -153,8 +161,11 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
153
161
|
const overlays = new Overlays();
|
|
154
162
|
// `core/ascii`'s cell measurer and width, loaded by the first text `prepare` (D87).
|
|
155
163
|
let textBackend;
|
|
164
|
+
// A type may read its own section on top of its plugin's (`swimlane` over `flowchart`,
|
|
165
|
+
// D534): both are given, highest first.
|
|
156
166
|
function sectionOf(detected, plugin) {
|
|
157
|
-
|
|
167
|
+
const own = plugin?.configSection ?? plugin?.id ?? detected.id;
|
|
168
|
+
return detected.section && detected.section !== own ? [detected.section, own] : own;
|
|
158
169
|
}
|
|
159
170
|
// Detect, resolve config and parse with a loaded plugin (DESIGN §3 steps 1–4).
|
|
160
171
|
function analyse(text, snap, plugin, detected, pre) {
|
|
@@ -188,6 +199,7 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
188
199
|
plugin,
|
|
189
200
|
prepared: { diagramType: detected.type, config, parse, warnings },
|
|
190
201
|
...(title !== undefined ? { title } : {}),
|
|
202
|
+
sources: [hit.site.site, front, ...directives],
|
|
191
203
|
};
|
|
192
204
|
}
|
|
193
205
|
function detect(text, s) {
|
|
@@ -344,7 +356,7 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
344
356
|
}
|
|
345
357
|
for (const w of packsUnsupported(iconPacks, hooks.claims()))
|
|
346
358
|
warn(w);
|
|
347
|
-
let engine;
|
|
359
|
+
let engine, part;
|
|
348
360
|
let elkName;
|
|
349
361
|
if (plugin.layoutKind === 'graph') {
|
|
350
362
|
const asked = layoutName(config, plugin);
|
|
@@ -381,6 +393,10 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
381
393
|
});
|
|
382
394
|
}
|
|
383
395
|
engine = found.engine;
|
|
396
|
+
// The layout's part of the drawing (`layoutParts`), only when that layout lays it out:
|
|
397
|
+
// ready (a stand-in engine never is).
|
|
398
|
+
if (found.state === 'ready')
|
|
399
|
+
part = registry.layoutPart(plugin, name)[1];
|
|
384
400
|
}
|
|
385
401
|
// The theme reads the id prefix only for the gradient (D182), after ctx exists.
|
|
386
402
|
const tables = { rules: registry.themeRules(), diagram: plugin.theme };
|
|
@@ -408,6 +424,7 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
408
424
|
now,
|
|
409
425
|
availableWidth: width,
|
|
410
426
|
iconPacks: packs,
|
|
427
|
+
layoutPart: part,
|
|
411
428
|
layout: (graph) => {
|
|
412
429
|
if (!engine)
|
|
413
430
|
throw new TypeError(`${plugin.id} has no graph layout`);
|
|
@@ -503,13 +520,16 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
503
520
|
units: pxProfile,
|
|
504
521
|
width: options?.availableWidth,
|
|
505
522
|
});
|
|
523
|
+
// D537: the line-hop step, when its chunk is loaded and decides that this render hops.
|
|
524
|
+
const edges = registry.hops?.(analysis);
|
|
506
525
|
const renderHooks = hooksFor(analysis);
|
|
507
526
|
if (renderHooks.size === 0) {
|
|
508
|
-
const drawn = drawDiagram(plugin, prepared.parse.model, ctx);
|
|
527
|
+
const drawn = drawDiagram(plugin, prepared.parse.model, ctx, undefined, edges);
|
|
509
528
|
return { ...drawn, diagramType: prepared.diagramType, warnings };
|
|
510
529
|
}
|
|
511
530
|
const run = renderHooks.start(ctx, plugin.id);
|
|
512
|
-
const
|
|
531
|
+
const hooked = { run, ast: prepared.parse.ast };
|
|
532
|
+
const drawn = drawDiagram(plugin, prepared.parse.model, ctx, hooked, edges);
|
|
513
533
|
const result = { ...drawn, diagramType: prepared.diagramType, warnings };
|
|
514
534
|
// The DOM adapter's afterMount entry point (DESIGN §12.2, §12.3); `run`/`mount` call it.
|
|
515
535
|
if (run.mounts)
|
|
@@ -595,9 +615,9 @@ export function createMermaid(firstParty, firstPartyNames) {
|
|
|
595
615
|
tasks.push(registry.load(t).then((p) => {
|
|
596
616
|
if (!p)
|
|
597
617
|
throw new MermaidError('UNSUPPORTED_DIAGRAM', `Diagram type "${t}" is not supported.`);
|
|
598
|
-
// The plugin's own default engine (D284)
|
|
599
|
-
|
|
600
|
-
|
|
618
|
+
// The plugin's own default engine (D284), or the type's (D534), comes with it.
|
|
619
|
+
const layout = registry.layoutOf(t) ?? p.layoutEngine?.default;
|
|
620
|
+
return Promise.all([layout, registry.layoutPart(p, layout)[0]].map((n) => n && registry.loadLayout(n)));
|
|
601
621
|
}));
|
|
602
622
|
if (ascii)
|
|
603
623
|
tasks.push(registry.loadAscii(t).then((hook) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["node_modules/@mermaid-js/diagram-treeview/src/model.ts"],"sourcesContent":["/**\n * The treeView model (spec #518): what the parser (#572) produces and the layout (#573) and the\n * renderers read. Plain, frozen data in source order (R-ARCH-7). Shared contract of the treeView\n * tickets: change it only additively, and say so in the run notes\n * (`v13/docs/agents/runs/518/GAPS.md`).\n */\nimport type { AstId, Diagnostic, Range } from '@mermaid-js/core/parser-kit';\n\n/** One node (a row of the tree), as v12's DB stored it, and where it sits. */\nexport interface TreeViewNode {\n /**\n * The name as v12 converted it: quotes stripped, a bare name's trailing blanks cut (inner\n * runs kept), then a trailing `/` cut (`/` alone gives `''`).\n */\n readonly name: string;\n /** Whether the name ended with `/` (v12's `nodeType: 'directory'`, else `'file'`). */\n readonly directory: boolean;\n /** 0 for a node at the top; v12 hangs those under its virtual root `/`. */\n readonly depth: number;\n /**\n * v12's level: the length of the blank run before the name (a tab counts 1; after the box\n * pass four per depth), else 0. A node goes under the nearest earlier node with a smaller\n * level.\n */\n readonly level: number;\n /**\n * The `icon(…)` written for it, as v12's DB held it: the icon name (`folder`, `logos:react`),\n * `'none'` for `icon(none)` and `icon()`; absent with no `icon(…)`. Resolving it (built-ins,\n * `defaultIconPack`, `showIcons`, the maps) is the renderer's (`resolveIcon`).\n */\n readonly icon?: string;\n /** The class of its `:::name` (the last one written wins); absent with none. */\n readonly cssClass?: string;\n /** The text of its `## …` (the last one written wins), trimmed; absent when empty. */\n readonly description?: string;\n /** The nodes under it, in source order. */\n readonly children: readonly TreeViewNode[];\n /** `node:<dir>/<dir>/<name>`, `@2`, … for a repeat in one directory (D487). */\n readonly astId: AstId;\n /** From the name (the blanks before it off) to the end of its last annotation. */\n readonly range: Range;\n}\n\nexport interface TreeViewModel {\n /** The nodes at the top, in source order (v12's `getRoot().children`). */\n readonly roots: readonly TreeViewNode[];\n /** Every node in source order, which is the tree read depth first. */\n readonly nodes: readonly TreeViewNode[];\n /**\n * The in-text `title` if non-empty, else the front-matter `title`; absent when neither. Kept\n * and not drawn (D484, D218).\n */\n readonly title?: string;\n /** The AST id of the `title` statement the title comes from; absent for a front-matter title. */\n readonly titleAstId?: AstId;\n readonly accTitle: string;\n readonly accDescr: string;\n /** Warning diagnostics of the parse (also in `ParseResult.diagnostics`). */\n readonly warnings: readonly Diagnostic[];\n /**\n * The icons the nodes draw through the extensions' glyphs (`DiagramPlugin.icons`, D293):\n * every name `resolveIcon` gives a node under the parse's `treeView` options but the built-in\n * glyphs, in source order without repeats. Set by the plugin's `parse` (#575), which has the\n * config; absent from `parseTreeView` alone.\n */\n readonly glyphIcons?: readonly string[];\n}\n\n/**\n * Whether a node's row is highlighted: v12 split the class on blanks and looked for\n * `highlight`; the grammar's class is one name, so it is that name.\n */\nexport function highlighted(node: TreeViewNode | undefined): boolean {\n return node?.cssClass === 'highlight';\n}\n"],"mappings":"AAwEO,SAASA,EAAYC,EAAyC,CACnE,OAAOA,GAAM,WAAa,WAC5B","names":["highlighted","node"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{m as a,s as u}from"./chunk-BNYOSPTM.mjs";function c(e,t){return t==="indented"?{text:`treeView-beta
|
|
2
|
+
x
|
|
3
|
+
${e}
|
|
4
|
+
y
|
|
5
|
+
`,nodes:3,at:1}:t==="box-top"?{text:`treeView-beta
|
|
6
|
+
${e}
|
|
7
|
+
\u2514\u2500\u2500 x
|
|
8
|
+
`,nodes:2,at:0}:{text:`treeView-beta
|
|
9
|
+
\u251C\u2500\u2500 ${e}
|
|
10
|
+
`,nodes:1,at:0}}function m(e,t,r,i){let{text:o,nodes:d,at:f}=c(e,i),s=u(o);if(s.diagnostics.length>0||s.model.nodes.length!==d)return!1;let n=s.model.nodes[f];return n!==void 0&&n.name===t&&n.directory===r&&n.depth===0&&n.children.length===(i==="box-top"?1:0)&&n.icon===void 0&&n.cssClass===void 0&&n.description===void 0}function p(e){return e!==""&&!/^\s|\s$|[^\S ]/u.test(e)&&!/^(?:title|acc|treeView)/i.test(e)&&!/:::|icon\(|["'#%&<─━│┃└┗├┣]/u.test(e)}function l(e,t,r,i){if(r!==""&&e.includes(r))return;let o=a(e,t);if(r===""&&p(o))return o;let d=`${r}${o}${r}`;return m(d,e,t,i)?d:void 0}export{l as a};
|
|
11
|
+
//# sourceMappingURL=chunk-2MDKOWUQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["node_modules/@mermaid-js/diagram-treeview/src/parser/written.ts"],"sourcesContent":["// cspell:words treeview\n/**\n * How a node's name is written so that it reads back (D487, D488): the one place both the\n * language facet's rename (`facet/names.ts`) and the text output (`ascii/names.ts`) ask. A\n * written form is taken only when the parser reads it, where it will stand, back to the name, as\n * a node of its own with no annotation. Where it stands is the line it is on:\n *\n * - `indented`: an indented line of its own between two nodes (the facet's rename);\n * - `box-top`: a box-drawn tree's line at column 0, a node at the top (the text output);\n * - `box-branch`: after a box branch, `├── ` (the text output).\n */\nimport type { TreeViewNode } from '../model.ts';\nimport { writtenName } from './convert.ts';\nimport { parseTreeView } from './parser.ts';\n\nexport type NameLine = 'indented' | 'box-top' | 'box-branch';\n\n/** A quote a name can be written in, or `''` for bare. */\nexport type NameQuote = '' | '\"' | \"'\";\n\n/** The text around a written form `w` on `line`, and the node it is, by index. */\nfunction around(w: string, line: NameLine): { text: string; nodes: number; at: number } {\n if (line === 'indented') return { text: `treeView-beta\\n x\\n ${w}\\n y\\n`, nodes: 3, at: 1 };\n // A box line under it, so that the box pass runs with no glyph in `w`.\n if (line === 'box-top') return { text: `treeView-beta\\n${w}\\n└── x\\n`, nodes: 2, at: 0 };\n return { text: `treeView-beta\\n├── ${w}\\n`, nodes: 1, at: 0 };\n}\n\n/** Whether `w`, on `line`, reads back as a node named `name` (a directory when `directory`). */\nexport function readsBack(w: string, name: string, directory: boolean, line: NameLine): boolean {\n const { text, nodes, at } = around(w, line);\n const r = parseTreeView(text);\n if (r.diagnostics.length > 0 || r.model.nodes.length !== nodes) return false;\n const n: TreeViewNode | undefined = r.model.nodes[at];\n return (\n n !== undefined &&\n n.name === name &&\n n.directory === directory &&\n n.depth === 0 &&\n n.children.length === (line === 'box-top' ? 1 : 0) &&\n n.icon === undefined &&\n n.cssClass === undefined &&\n n.description === undefined\n );\n}\n\n/**\n * Whether the bare form `w` surely reads back on any line without asking the parser, so a tree\n * of plain names is not parsed name by name. It mirrors the lexer: BARE_NAME starts with none\n * of `[ \\t\"']` and stops at a blank run before `:::`, `icon(` or `##` (`parser/lexer.ts`\n * `bareName`), and its trailing blanks are cut; the keyword terminals start `title`, `acc` or\n * `treeView-beta`; `%%` is a comment and `#name;` an entity (`ampEntities`); the view reads the\n * quotes in a tag (`<…>`); the box pass reads the box glyphs and skips the blanks after a\n * branch. A name with none of these is plainly bare; any other goes to the parser.\n */\nexport function plainlyBare(w: string): boolean {\n return (\n w !== '' &&\n !/^\\s|\\s$|[^\\S ]/u.test(w) &&\n !/^(?:title|acc|treeView)/i.test(w) &&\n !/:::|icon\\(|[\"'#%&<─━│┃└┗├┣]/u.test(w)\n );\n}\n\n/**\n * `name` (a directory's with its `/`) written bare (`quote` `''`) or in `quote`, if that form\n * reads back on `line`; undefined when it does not, or when the name holds that quote.\n */\nexport function nameForm(\n name: string,\n directory: boolean,\n quote: NameQuote,\n line: NameLine\n): string | undefined {\n if (quote !== '' && name.includes(quote)) return undefined;\n const bare = writtenName(name, directory);\n if (quote === '' && plainlyBare(bare)) return bare;\n const w = `${quote}${bare}${quote}`;\n return readsBack(w, name, directory, line) ? w : undefined;\n}\n"],"mappings":"gDAqBA,SAASA,EAAOC,EAAWC,EAA6D,CACtF,OAAIA,IAAS,WAAmB,CAAE,KAAM;AAAA;AAAA,IAAyBD,CAAC;AAAA;AAAA,EAAW,MAAO,EAAG,GAAI,CAAE,EAEzFC,IAAS,UAAkB,CAAE,KAAM;AAAA,EAAkBD,CAAC;AAAA;AAAA,EAAa,MAAO,EAAG,GAAI,CAAE,EAChF,CAAE,KAAM;AAAA,qBAAsBA,CAAC;AAAA,EAAM,MAAO,EAAG,GAAI,CAAE,CAC9D,CAGO,SAASE,EAAUF,EAAWG,EAAcC,EAAoBH,EAAyB,CAC9F,GAAM,CAAE,KAAAI,EAAM,MAAAC,EAAO,GAAAC,CAAG,EAAIR,EAAOC,EAAGC,CAAI,EACpCO,EAAIC,EAAcJ,CAAI,EAC5B,GAAIG,EAAE,YAAY,OAAS,GAAKA,EAAE,MAAM,MAAM,SAAWF,EAAO,MAAO,GACvE,IAAM,EAA8BE,EAAE,MAAM,MAAMD,CAAE,EACpD,OACE,IAAM,QACN,EAAE,OAASJ,GACX,EAAE,YAAcC,GAChB,EAAE,QAAU,GACZ,EAAE,SAAS,UAAYH,IAAS,UAAY,EAAI,IAChD,EAAE,OAAS,QACX,EAAE,WAAa,QACf,EAAE,cAAgB,MAEtB,CAWO,SAASS,EAAYV,EAAoB,CAC9C,OACEA,IAAM,IACN,CAAC,kBAAkB,KAAKA,CAAC,GACzB,CAAC,2BAA2B,KAAKA,CAAC,GAClC,CAAC,+BAA+B,KAAKA,CAAC,CAE1C,CAMO,SAASW,EACdR,EACAC,EACAQ,EACAX,EACoB,CACpB,GAAIW,IAAU,IAAMT,EAAK,SAASS,CAAK,EAAG,OAC1C,IAAMC,EAAOC,EAAYX,EAAMC,CAAS,EACxC,GAAIQ,IAAU,IAAMF,EAAYG,CAAI,EAAG,OAAOA,EAC9C,IAAMb,EAAI,GAAGY,CAAK,GAAGC,CAAI,GAAGD,CAAK,GACjC,OAAOV,EAAUF,EAAGG,EAAMC,EAAWH,CAAI,EAAID,EAAI,MACnD","names":["around","w","line","readsBack","name","directory","text","nodes","at","r","parseTreeView","plainlyBare","nameForm","quote","bare","writtenName"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function H(e,r){return e<=0?{px:r,py:0}:e===1?{px:0,py:r}:{px:r%e,py:Math.floor(r/e)}}function N(e,r,n){return r+(e>0?Math.min(n,e-r%e):n)}function k(e){let r=0,n=0;for(let o of e.children){if(o.space)continue;let y=o.w/o.span;y>r&&(r=y),o.h>n&&(n=o.h)}return{mW:r,mH:n}}function M(e,r,n,o){for(let y of e.children)y.w=r*y.span+o*(y.span-1),y.h=n}function z({node:e,max:r,sibling:n,padding:o}){let{mW:y,mH:t}=r,{mW:x,mH:s}=n,l=e.columns??-1,f=e.children,m=0;for(let a of f)m+=a.span;let c=l>0&&l<m?l:f.length,u=Math.ceil(m/c),b=c*(y+o)+o,G=u*(t+o)+o+e.band;if(b<x){b=x,G=s;let a=(x-c*o-o)/c,A=Math.max(0,(s-e.band-u*o-o)/u);for(let w of f)w.w=a,w.h=A}if(b<(e.w||0)){b=e.w||0;let a=l>0?Math.min(f.length,l):f.length,A=(b-a*o-o)/a;for(let w of f)w.w=A}e.w=b,e.h=G}function F(e){let r=[],n=[e];for(;n.length>0;){let o=n.pop();r.push(o);for(let y=o.children.length-1;y>=0;y--)n.push(o.children[y])}return r}function C(e,r,n){let o=new Map,y=[],t=(x,s)=>{if(x.children.length>0){let l=o.get(x)??0;if(l>=n)return;o.set(x,l+1)}x.w||(x.w=s.mW,x.h=s.mH),x.children.length>0&&y.push({node:x,sibling:s,next:0,second:!1,max:{mW:0,mH:0}})};for(e.w=0,t(e,{mW:0,mH:0});y.length>0;){let x=y[y.length-1],s=x.node.children;x.next<s.length?t(s[x.next++],x.second?x.max:{mW:0,mH:0}):x.second?(y.pop(),z({node:x.node,max:x.max,sibling:x.sibling,padding:r})):(x.max=k(x.node),M(x.node,x.max.mW,x.max.mH,r),x.second=!0,x.next=0)}}function E(e,r){e.x=0,e.y=0;for(let n of F(e)){if(n.children.length===0)continue;let o=n.columns??-1,y=[],t=0;for(let c of n.children){let{py:u}=H(o,t);c.h>(y[u]??0)&&(y[u]=c.h),t=N(o,t,c.span)}let x=[],s=0;for(let c=0;c<y.length;c++)y[c]!==void 0&&(x[c]=s,s+=y[c]+r);let l=()=>n.x?n.x+(-n.w/2||0):-r,f=l(),m=0;t=0;for(let c of n.children){let{py:u}=H(o,t);u!==m&&(m=u,f=l()),c.x=f+r+c.w/2,f=c.x+c.w/2;let b=y[u]??c.h;c.y=n.y-n.h/2+n.band+(x[u]??0)+b/2+r,t=N(o,t,c.span)}}}var v=["right","left","up","down"],P="point",D=e=>{let r=new Set;for(let n of e)switch(n){case"x":r.add("right"),r.add("left");break;case"y":r.add("up"),r.add("down");break;case"right":case"left":case"up":case"down":r.add(n);break;default:break}return r},O=e=>v.filter(r=>e.has(r)).join("|")||P,W=new Map([["right|left|up|down",({height:e,midpoint:r,padding:n,width:o})=>[{x:0,y:0},{x:r,y:0},{x:o/2,y:2*n},{x:o-r,y:0},{x:o,y:0},{x:o,y:-e/3},{x:o+2*n,y:-e/2},{x:o,y:-2*e/3},{x:o,y:-e},{x:o-r,y:-e},{x:o/2,y:-e-2*n},{x:r,y:-e},{x:0,y:-e},{x:0,y:-2*e/3},{x:-2*n,y:-e/2},{x:0,y:-e/3}]],["right|left|up",({height:e,midpoint:r,width:n})=>[{x:r,y:0},{x:n-r,y:0},{x:n,y:-e/2},{x:n-r,y:-e},{x:r,y:-e},{x:0,y:-e/2}]],["right|left|down",({height:e,midpoint:r,width:n})=>[{x:0,y:0},{x:r,y:-e},{x:n-r,y:-e},{x:n,y:0}]],["right|up|down",({height:e,midpoint:r,width:n})=>[{x:0,y:0},{x:n,y:-r},{x:n,y:-e+r},{x:0,y:-e}]],["left|up|down",({height:e,midpoint:r,width:n})=>[{x:n,y:0},{x:0,y:-r},{x:0,y:-e+r},{x:n,y:-e}]],["right|left",({height:e,midpoint:r,padding:n,width:o})=>[{x:r,y:0},{x:r,y:-n},{x:o-r,y:-n},{x:o-r,y:0},{x:o,y:-e/2},{x:o-r,y:-e},{x:o-r,y:-e+n},{x:r,y:-e+n},{x:r,y:-e},{x:0,y:-e/2}]],["up|down",({height:e,midpoint:r,padding:n,width:o})=>[{x:o/2,y:0},{x:0,y:-n},{x:r,y:-n},{x:r,y:-e+n},{x:0,y:-e+n},{x:o/2,y:-e},{x:o,y:-e+n},{x:o-r,y:-e+n},{x:o-r,y:-n},{x:o,y:-n}]],["right|up",({height:e,midpoint:r,width:n})=>[{x:0,y:0},{x:n,y:-r},{x:0,y:-e}]],["right|down",({height:e,width:r})=>[{x:0,y:0},{x:r,y:0},{x:0,y:-e}]],["left|up",({height:e,midpoint:r,width:n})=>[{x:n,y:0},{x:0,y:-r},{x:n,y:-e}]],["left|down",({height:e,width:r})=>[{x:r,y:0},{x:0,y:0},{x:r,y:-e}]],["right",({height:e,midpoint:r,padding:n,width:o})=>[{x:r,y:-n},{x:r,y:-n},{x:o-r,y:-n},{x:o-r,y:0},{x:o,y:-e/2},{x:o-r,y:-e},{x:o-r,y:-e+n},{x:r,y:-e+n},{x:r,y:-e+n}]],["left",({height:e,midpoint:r,padding:n,width:o})=>[{x:r,y:0},{x:r,y:-n},{x:o-r,y:-n},{x:o-r,y:-e+n},{x:r,y:-e+n},{x:r,y:-e},{x:0,y:-e/2}]],["up",({height:e,midpoint:r,padding:n,width:o})=>[{x:r,y:-n},{x:r,y:-e+n},{x:0,y:-e+n},{x:o/2,y:-e},{x:o,y:-e+n},{x:o-r,y:-e+n},{x:o-r,y:-n}]],["down",({height:e,midpoint:r,padding:n,width:o})=>[{x:o/2,y:0},{x:0,y:-n},{x:r,y:-n},{x:r,y:-e+n},{x:o-r,y:-e+n},{x:o-r,y:-n},{x:o,y:-n}]],[P,()=>[{x:0,y:0}]]]);function S(e,r,n){let o=r/2,y=e.height+4*o,t=y/2;return{height:y,midpoint:t,padding:o,width:n??e.width+2*t+2*o}}var i=(e,r,n,o)=>{let y=O(D(e));return(W.get(y)??W.get(P))(S(r,n.padding??0,o))};function R(e,r){let{width:n,height:o}=S(e,r);return{w:n,h:o}}function K({directions:e,label:r,padding:n,width:o}){let{height:y}=S(r,n,o);return i(e,r,{padding:n},o).map(t=>({x:t.x-o/2,y:t.y+y/2}))}export{H as a,N as b,C as c,E as d,D as e,R as f,K as g};
|
|
2
|
+
//# sourceMappingURL=chunk-33QZBPQK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["node_modules/@mermaid-js/diagram-block/src/layout/grid.ts","node_modules/@mermaid-js/diagram-block/src/shapes/block-arrow.ts"],"sourcesContent":["/**\n * v12's block grid (`fa796a943:…/block/layout.ts`), linear in blocks and depth: sizes, then\n * centres, of a tree of blocks whose leaves are already measured. Pure: it reads the tree and\n * `padding`, and writes each node's `w`, `h`, `x` and `y` (v12's `block.size`).\n *\n * **Sizes.** v12's `setBlockSizes(block, siblingWidth, siblingHeight)` sizes a container from its\n * children's sizes: each non-space child's width per column (`w / span`) and height, their\n * largest `maxW × maxH`; every child set to its cell, `span · maxW + (span − 1) · padding` by\n * `maxH`; the container `xSize · (maxW + padding) + padding` by\n * `ySize · (maxH + padding) + padding` (`xSize` is `columns` when set and below the total span, else the child count;\n * `ySize = ⌈total span / xSize⌉`); then stretched where it is narrower than `siblingWidth`\n * (children evened out over the sibling size) or than its own width (children widened). It\n * calls itself on every child twice, once with no sibling size before the cells are set and once\n * with `maxW × maxH` after, so a block at depth d is sized 2^d times, and the repeats are not\n * idempotent (a spanning child grows by `padding · (span − 1) / span` each time). The grid\n * replays those calls, but sizes a block with children at most `maxSizings` times, which keeps\n * it linear and v12's numbers wherever composites nest at most log2(`maxSizings`) deep\n * (GAPS #555).\n *\n * **Centres.** v12's `layoutBlocks`, unchanged: children packed left to right by width from the\n * container's left edge (`−padding` when its centre is at 0, v12's falsy test), wrapping by\n * `columns`, with per-row heights; a block wider than the rest of its row keeps its width and\n * the next one starts a row.\n *\n * D444: a labelled composite has a band of `band` px above its grid; the grid's heights and\n * centres are below it. With no band the numbers are v12's.\n */\n\n/** One block of the grid: what v12's layout reads and writes on a `Block`. */\nexport interface GridNode {\n /** v12's `type` as far as the grid reads it: spaces are skipped when sizing columns. */\n readonly space: boolean;\n /** v12 `widthInColumns`. */\n readonly span: number;\n /** v12 `columns`: -1 (or undefined) for auto. */\n readonly columns?: number;\n /** A labelled composite's label band (D444), 0 otherwise. */\n readonly band: number;\n readonly children: readonly GridNode[];\n /** The size: the measured size of a leaf before the grid runs, its cell after. */\n w: number;\n h: number;\n /** The centre, set by {@link placeGrid}. */\n x: number;\n y: number;\n}\n\n/** v12 `calculateBlockPosition`: the column and row of grid position `position`. */\nexport function gridPosition(columns: number, position: number): { px: number; py: number } {\n if (columns <= 0) return { px: position, py: 0 };\n if (columns === 1) return { px: 0, py: position };\n return { px: position % columns, py: Math.floor(position / columns) };\n}\n\n/**\n * The grid position after a child of `span` columns at `position` (v12's `columnsFilled`): with\n * `columns`, a child wider than the rest of its row takes only the rest, so the next one starts\n * a row.\n */\nexport function gridAdvance(columns: number, position: number, span: number): number {\n return position + (columns > 0 ? Math.min(span, columns - (position % columns)) : span);\n}\n\n/** v12 `getMaxChildSize`: the widest width per column and the tallest height. */\nfunction maxChildSize(node: GridNode): { mW: number; mH: number } {\n let mW = 0;\n let mH = 0;\n for (const child of node.children) {\n if (child.space) continue;\n const perColumn = child.w / child.span;\n if (perColumn > mW) mW = perColumn;\n if (child.h > mH) mH = child.h;\n }\n return { mW, mH };\n}\n\n/** v12's cells: each child `span · maxW + (span − 1) · padding` by `maxH`. */\nfunction setCells(node: GridNode, mW: number, mH: number, padding: number): void {\n for (const child of node.children) {\n child.w = mW * child.span + padding * (child.span - 1);\n child.h = mH;\n }\n}\n\ninterface FinishParts {\n readonly node: GridNode;\n /** The container's own widest width per column and tallest height. */\n readonly max: { readonly mW: number; readonly mH: number };\n /** Its parent's (v12's `siblingWidth`, `siblingHeight`). */\n readonly sibling: { readonly mW: number; readonly mH: number };\n readonly padding: number;\n}\n\n/**\n * The end of v12's `setBlockSizes` on a container: its own size from `maxW × maxH`, stretched\n * to `siblingWidth × siblingHeight` when narrower (the children evened out), then to its own\n * width before the call when narrower still (the children widened).\n */\nfunction finish({ node, max, sibling, padding }: FinishParts): void {\n const { mW, mH } = max;\n const { mW: sw, mH: sh } = sibling;\n const columns = node.columns ?? -1;\n const kids = node.children;\n let numItems = 0;\n for (const child of kids) numItems += child.span;\n const xSize = columns > 0 && columns < numItems ? columns : kids.length;\n const ySize = Math.ceil(numItems / xSize);\n let width = xSize * (mW + padding) + padding;\n let height = ySize * (mH + padding) + padding + node.band;\n if (width < sw) {\n width = sw;\n height = sh;\n const cw = (sw - xSize * padding - padding) / xSize;\n // Never below 0 (D445): a label band (D444) taller than the sibling height leaves no room.\n const ch = Math.max(0, (sh - node.band - ySize * padding - padding) / ySize);\n for (const child of kids) {\n child.w = cw;\n child.h = ch;\n }\n }\n if (width < (node.w || 0)) {\n width = node.w || 0;\n const num = columns > 0 ? Math.min(kids.length, columns) : kids.length;\n const cw = (width - num * padding - padding) / num;\n for (const child of kids) child.w = cw;\n }\n node.w = width;\n node.h = height;\n}\n\n/** The tree in pre-order (parents before children), without recursion. */\nfunction preOrder(root: GridNode): GridNode[] {\n const out: GridNode[] = [];\n const stack = [root];\n while (stack.length > 0) {\n const node = stack.pop()!;\n out.push(node);\n for (let i = node.children.length - 1; i >= 0; i--) stack.push(node.children[i]!);\n }\n return out;\n}\n\n/** One `setBlockSizes` call in progress: the explicit stack's frame. */\ninterface Sizing {\n readonly node: GridNode;\n readonly sibling: { readonly mW: number; readonly mH: number };\n /** The next child to size, and whether the cells are set (the second round of calls). */\n next: number;\n second: boolean;\n /** The container's own widest width per column and tallest height, once the cells are set. */\n max: { mW: number; mH: number };\n}\n\n/**\n * Sizes every block of the tree under `root`: v12's `setBlockSizes(root)`, call for call, with\n * an explicit stack, except that a block with children is sized at most `maxSizings` times.\n * v12 sizes a block at depth d (the root's children at 1) 2^d times, so the two agree wherever\n * composites nest at most log2(`maxSizings`) deep; past that, a block keeps what its first\n * `maxSizings` sizings gave it. Each sizing costs its children, so the whole is linear in\n * blocks and depth. A leaf's calls (the size given by its sibling when it has none) are never\n * skipped.\n */\nexport function sizeGrid(root: GridNode, padding: number, maxSizings: number): void {\n const sizings = new Map<GridNode, number>();\n const stack: Sizing[] = [];\n const call = (node: GridNode, sibling: Sizing['sibling']): void => {\n if (node.children.length > 0) {\n const done = sizings.get(node) ?? 0;\n if (done >= maxSizings) return;\n sizings.set(node, done + 1);\n }\n if (!node.w) {\n node.w = sibling.mW;\n node.h = sibling.mH;\n }\n if (node.children.length > 0) {\n stack.push({ node, sibling, next: 0, second: false, max: { mW: 0, mH: 0 } });\n }\n };\n // v12's root block has no size: its first step gives it 0 × 0.\n root.w = 0;\n call(root, { mW: 0, mH: 0 });\n while (stack.length > 0) {\n const top = stack[stack.length - 1]!;\n const kids = top.node.children;\n if (top.next < kids.length) {\n call(kids[top.next++]!, top.second ? top.max : { mW: 0, mH: 0 });\n } else if (!top.second) {\n top.max = maxChildSize(top.node);\n setCells(top.node, top.max.mW, top.max.mH, padding);\n top.second = true;\n top.next = 0;\n } else {\n stack.pop();\n finish({ node: top.node, max: top.max, sibling: top.sibling, padding });\n }\n }\n}\n\n/** v12 `layoutBlocks(root)`: every block's centre, from the sizes, top down. */\nexport function placeGrid(root: GridNode, padding: number): void {\n root.x = 0;\n root.y = 0;\n for (const node of preOrder(root)) {\n if (node.children.length === 0) continue;\n const columns = node.columns ?? -1;\n // Per-row heights, so rows of different heights do not overlap (v12).\n const rowHeights: number[] = [];\n let pos = 0;\n for (const child of node.children) {\n const { py } = gridPosition(columns, pos);\n if (child.h > (rowHeights[py] ?? 0)) rowHeights[py] = child.h;\n pos = gridAdvance(columns, pos, child.span);\n }\n const rowOffsets: number[] = [];\n let offset = 0;\n for (let row = 0; row < rowHeights.length; row++) {\n // A row v12's map never saw (every block in it of height 0) takes no room.\n if (rowHeights[row] === undefined) continue;\n rowOffsets[row] = offset;\n offset += rowHeights[row]! + padding;\n }\n const left = (): number => (node.x ? node.x + (-node.w / 2 || 0) : -padding);\n let startX = left();\n let rowPos = 0;\n pos = 0;\n for (const child of node.children) {\n const { py } = gridPosition(columns, pos);\n if (py !== rowPos) {\n rowPos = py;\n startX = left();\n }\n child.x = startX + padding + child.w / 2;\n startX = child.x + child.w / 2;\n const rowHeight = rowHeights[py] ?? child.h;\n child.y = node.y - node.h / 2 + node.band + (rowOffsets[py] ?? 0) + rowHeight / 2 + padding;\n pos = gridAdvance(columns, pos, child.span);\n }\n }\n}\n","/**\n * The block arrow (`id<[\"label\"]>(right, down)`), v12's\n * `rendering-util/rendering-elements/shapes/blockArrow.ts` at fa796a943 (D446): its point sets, its natural size, and its outline\n * as a polygon about the block's centre. v13 had no block arrow before; the drawing is #556's.\n *\n * The point sets are v12's: one factory per set of directions (`x` is `right` and `left`, `y` is\n * `up` and `down`, repeats count once), in v12's frame (x right from the left end, y up from the\n * bottom: `insertPolygonShape` moved them by `(−w/2, h/2)`); no direction is one point, which\n * draws nothing. `padding` is the shape's padding, the block's `block.padding`.\n */\nimport type { Point } from './outline.ts';\n\nexport type { Point } from './outline.ts';\n\n/** A direction as v12's grammar takes it (`DIR`), trimmed (D445). */\nexport type ArrowDirection = 'right' | 'left' | 'up' | 'down' | 'x' | 'y';\n\n/** A side a block arrow points to: `x` and `y` expanded. */\nexport type ArrowSide = Exclude<ArrowDirection, 'x' | 'y'>;\ninterface ArrowMetrics {\n height: number;\n midpoint: number;\n padding: number;\n width: number;\n}\n\ntype ArrowPointsFactory = (metrics: ArrowMetrics) => Point[];\n\nconst DIRECTION_ORDER: ArrowSide[] = ['right', 'left', 'up', 'down'];\nconst POINT_KEY = 'point';\n\n/**\n * The sides `directions` point to, each once (`x` is `right` and `left`, `y` is `up` and\n * `down`); any other text points nowhere. The SVG polygon and the text box's arrowheads read it.\n */\nexport const arrowSides = (directions: readonly string[]): Set<ArrowSide> => {\n const uniqueDirections = new Set<ArrowSide>();\n\n for (const direction of directions) {\n switch (direction) {\n case 'x':\n uniqueDirections.add('right');\n uniqueDirections.add('left');\n break;\n case 'y':\n uniqueDirections.add('up');\n uniqueDirections.add('down');\n break;\n case 'right':\n case 'left':\n case 'up':\n case 'down':\n uniqueDirections.add(direction);\n break;\n // v12 added any other text too, which then matched no factory (the point fallback).\n default:\n break;\n }\n }\n\n return uniqueDirections;\n};\n\nconst getDirectionKey = (directions: Set<ArrowSide>) =>\n DIRECTION_ORDER.filter((direction) => directions.has(direction)).join('|') || POINT_KEY;\n\nconst arrowPointFactories = /* @__PURE__ */ new Map<string, ArrowPointsFactory>([\n [\n 'right|left|up|down',\n ({ height, midpoint, padding, width }) => [\n { x: 0, y: 0 },\n { x: midpoint, y: 0 },\n { x: width / 2, y: 2 * padding },\n { x: width - midpoint, y: 0 },\n { x: width, y: 0 },\n { x: width, y: -height / 3 },\n { x: width + 2 * padding, y: -height / 2 },\n { x: width, y: (-2 * height) / 3 },\n { x: width, y: -height },\n { x: width - midpoint, y: -height },\n { x: width / 2, y: -height - 2 * padding },\n { x: midpoint, y: -height },\n { x: 0, y: -height },\n { x: 0, y: (-2 * height) / 3 },\n { x: -2 * padding, y: -height / 2 },\n { x: 0, y: -height / 3 },\n ],\n ],\n [\n 'right|left|up',\n ({ height, midpoint, width }) => [\n { x: midpoint, y: 0 },\n { x: width - midpoint, y: 0 },\n { x: width, y: -height / 2 },\n { x: width - midpoint, y: -height },\n { x: midpoint, y: -height },\n { x: 0, y: -height / 2 },\n ],\n ],\n [\n 'right|left|down',\n ({ height, midpoint, width }) => [\n { x: 0, y: 0 },\n { x: midpoint, y: -height },\n { x: width - midpoint, y: -height },\n { x: width, y: 0 },\n ],\n ],\n [\n 'right|up|down',\n ({ height, midpoint, width }) => [\n { x: 0, y: 0 },\n { x: width, y: -midpoint },\n { x: width, y: -height + midpoint },\n { x: 0, y: -height },\n ],\n ],\n [\n 'left|up|down',\n ({ height, midpoint, width }) => [\n { x: width, y: 0 },\n { x: 0, y: -midpoint },\n { x: 0, y: -height + midpoint },\n { x: width, y: -height },\n ],\n ],\n [\n 'right|left',\n ({ height, midpoint, padding, width }) => [\n { x: midpoint, y: 0 },\n { x: midpoint, y: -padding },\n { x: width - midpoint, y: -padding },\n { x: width - midpoint, y: 0 },\n { x: width, y: -height / 2 },\n { x: width - midpoint, y: -height },\n { x: width - midpoint, y: -height + padding },\n { x: midpoint, y: -height + padding },\n { x: midpoint, y: -height },\n { x: 0, y: -height / 2 },\n ],\n ],\n [\n 'up|down',\n ({ height, midpoint, padding, width }) => [\n { x: width / 2, y: 0 },\n { x: 0, y: -padding },\n { x: midpoint, y: -padding },\n { x: midpoint, y: -height + padding },\n { x: 0, y: -height + padding },\n { x: width / 2, y: -height },\n { x: width, y: -height + padding },\n { x: width - midpoint, y: -height + padding },\n { x: width - midpoint, y: -padding },\n { x: width, y: -padding },\n ],\n ],\n [\n 'right|up',\n ({ height, midpoint, width }) => [\n { x: 0, y: 0 },\n { x: width, y: -midpoint },\n { x: 0, y: -height },\n ],\n ],\n [\n 'right|down',\n ({ height, width }) => [\n { x: 0, y: 0 },\n { x: width, y: 0 },\n { x: 0, y: -height },\n ],\n ],\n [\n 'left|up',\n ({ height, midpoint, width }) => [\n { x: width, y: 0 },\n { x: 0, y: -midpoint },\n { x: width, y: -height },\n ],\n ],\n [\n 'left|down',\n ({ height, width }) => [\n { x: width, y: 0 },\n { x: 0, y: 0 },\n { x: width, y: -height },\n ],\n ],\n [\n 'right',\n ({ height, midpoint, padding, width }) => [\n { x: midpoint, y: -padding },\n { x: midpoint, y: -padding },\n { x: width - midpoint, y: -padding },\n { x: width - midpoint, y: 0 },\n { x: width, y: -height / 2 },\n { x: width - midpoint, y: -height },\n { x: width - midpoint, y: -height + padding },\n { x: midpoint, y: -height + padding },\n { x: midpoint, y: -height + padding },\n ],\n ],\n [\n 'left',\n ({ height, midpoint, padding, width }) => [\n { x: midpoint, y: 0 },\n { x: midpoint, y: -padding },\n { x: width - midpoint, y: -padding },\n { x: width - midpoint, y: -height + padding },\n { x: midpoint, y: -height + padding },\n { x: midpoint, y: -height },\n { x: 0, y: -height / 2 },\n ],\n ],\n [\n 'up',\n ({ height, midpoint, padding, width }) => [\n { x: midpoint, y: -padding },\n { x: midpoint, y: -height + padding },\n { x: 0, y: -height + padding },\n { x: width / 2, y: -height },\n { x: width, y: -height + padding },\n { x: width - midpoint, y: -height + padding },\n { x: width - midpoint, y: -padding },\n ],\n ],\n [\n 'down',\n ({ height, midpoint, padding, width }) => [\n { x: width / 2, y: 0 },\n { x: 0, y: -padding },\n { x: midpoint, y: -padding },\n { x: midpoint, y: -height + padding },\n { x: width - midpoint, y: -height + padding },\n { x: width - midpoint, y: -padding },\n { x: width, y: -padding },\n ],\n ],\n [POINT_KEY, () => [{ x: 0, y: 0 }]],\n]);\n\n/**\n * v12's arrow metrics about a label box: half the node padding as the arrow's `padding`, the\n * label's height plus twice the node padding as its height, the midpoint half that, and by\n * default the label's width plus the height and the node padding as its width (`getArrowPoints`\n * and `block_arrow` derived the same numbers each their own way).\n */\nfunction arrowMetrics(\n bbox: { readonly width: number; readonly height: number },\n nodePadding: number,\n totalWidth?: number\n): ArrowMetrics {\n const padding = nodePadding / 2;\n const height = bbox.height + 4 * padding;\n const midpoint = height / 2;\n return {\n height,\n midpoint,\n padding,\n width: totalWidth ?? bbox.width + 2 * midpoint + 2 * padding,\n };\n}\n\n/**\n * v12 `getArrowPoints`: the polygon for `directions` around a label box `bbox`, in v12's frame,\n * `totalWidth` wide (by default the natural width).\n */\nexport const getArrowPoints = (\n duplicatedDirections: readonly string[],\n bbox: { readonly width: number; readonly height: number },\n node: { readonly padding?: number },\n totalWidth?: number\n): Point[] => {\n const key = getDirectionKey(arrowSides(duplicatedDirections));\n const pointFactory = arrowPointFactories.get(key) ?? arrowPointFactories.get(POINT_KEY)!;\n return pointFactory(arrowMetrics(bbox, node.padding ?? 0, totalWidth));\n};\n\n/** v12 `block_arrow`'s natural size about a label box, with the block padding. */\nexport function blockArrowSize(\n label: { readonly width: number; readonly height: number },\n padding: number\n): { w: number; h: number } {\n const { width, height } = arrowMetrics(label, padding);\n return { w: width, h: height };\n}\n\n/** What {@link blockArrowPolygon} draws. */\nexport interface ArrowParts {\n readonly directions: readonly string[];\n /** The label's box. */\n readonly label: { readonly width: number; readonly height: number };\n /** The block padding. */\n readonly padding: number;\n /**\n * The width: v12 stretched the arrow to its cell only when it spans more than one column and\n * the cell is wider; the caller decides.\n */\n readonly width: number;\n}\n\n/** The arrow's polygon about the block's centre. */\nexport function blockArrowPolygon({ directions, label, padding, width }: ArrowParts): Point[] {\n const { height } = arrowMetrics(label, padding, width);\n return getArrowPoints(directions, label, { padding }, width).map((p) => ({\n x: p.x - width / 2,\n y: p.y + height / 2,\n }));\n}\n"],"mappings":"AAgDO,SAASA,EAAaC,EAAiBC,EAA8C,CAC1F,OAAID,GAAW,EAAU,CAAE,GAAIC,EAAU,GAAI,CAAE,EAC3CD,IAAY,EAAU,CAAE,GAAI,EAAG,GAAIC,CAAS,EACzC,CAAE,GAAIA,EAAWD,EAAS,GAAI,KAAK,MAAMC,EAAWD,CAAO,CAAE,CACtE,CAOO,SAASE,EAAYF,EAA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AAMK,EAAK,SAAW,EAAGH,CAAU,CAAC,CACvE,EAGO,SAASK,EACdC,EACAX,EAC0B,CAC1B,GAAM,CAAE,MAAAC,EAAO,OAAAH,CAAO,EAAII,EAAaS,EAAOX,CAAO,EACrD,MAAO,CAAE,EAAGC,EAAO,EAAGH,CAAO,CAC/B,CAiBO,SAASc,EAAkB,CAAE,WAAAnB,EAAY,MAAAkB,EAAO,QAAAX,EAAS,MAAAC,CAAM,EAAwB,CAC5F,GAAM,CAAE,OAAAH,CAAO,EAAII,EAAaS,EAAOX,EAASC,CAAK,EACrD,OAAOK,EAAeb,EAAYkB,EAAO,CAAE,QAAAX,CAAQ,EAAGC,CAAK,EAAE,IAAKY,IAAO,CACvE,EAAGA,EAAE,EAAIZ,EAAQ,EACjB,EAAGY,EAAE,EAAIf,EAAS,CACpB,EAAE,CACJ","names":["gridPosition","columns","position","gridAdvance","span","maxChildSize","node","mW","mH","child","perColumn","setCells","padding","finish","max","sibling","sw","sh","kids","numItems","xSize","ySize","width","height","cw","ch","num","preOrder","root","out","stack","i","sizeGrid","maxSizings","sizings","call","done","top","placeGrid","rowHeights","pos","py","rowOffsets","offset","row","left","startX","rowPos","rowHeight","DIRECTION_ORDER","POINT_KEY","arrowSides","directions","uniqueDirections","direction","getDirectionKey","arrowPointFactories","height","midpoint","padding","width","arrowMetrics","bbox","nodePadding","totalWidth","getArrowPoints","duplicatedDirections","node","key","blockArrowSize","label","blockArrowPolygon","p"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as at}from"./chunk-ZOQOZJZV.mjs";import{a as h,b as J,
|
|
1
|
+
import{c as at}from"./chunk-ZOQOZJZV.mjs";import{a as h,b as J,d as q,f as w,k as tt,m as et,n as it,p as rt,q as st,r as C,s as B,t as x,u as nt,v as ot}from"./chunk-4XJZCOJ5.mjs";import{A as E,D as g,E as Z,i as Y,l as F,p as m,q as b,r as v,s as N,x as Q}from"./chunk-KJT4SRSJ.mjs";var f=J,c={PacketBeta:f,Packet:f+1,Dash:f+2,Plus:f+3,Colon:f+4,AccDescr:f+5,AccTitle:f+6,Title:f+7,Int:f+8,String:f+9,Yaml:f+10},K=w(h.Comment,h.Directive,h.Space,c.Yaml);var $=1e4,kt=(o,t)=>t.start===o.start&&t.end===o.end,S=class{constructor(t){this.bitsPerRow=t}fields=[];done=[];word=[];row=1;capped=!1;add(t){let e=this.fields.length,i=this.bitsPerRow,r=t.start,s=!1,n;for(;;){if(this.done.length>=1e4){this.capped||(n=r),this.capped=!0;break}let a=this.row*i-1,l=Math.min(t.end,a);if(this.word.push(Object.freeze({field:e,start:r,end:l})),s=!0,l===a&&(this.done.push(Object.freeze(this.word)),this.word=[],this.row++),l===t.end)break;r=l+1}return s&&this.fields.push(Object.freeze(t)),n}rows(){return this.word.length>0&&this.done.push(Object.freeze(this.word)),this.word=[],this.done}};var gt={b:"\b",f:"\f",n:`
|
|
2
2
|
`,r:"\r",t:" ",v:"\v",0:"\0"};function ct(o){let t=o.slice(1,-1);if(!t.includes("\\"))return t;let e="";for(let i=0;i<t.length;i++){let r=t[i]??"";if(r.charCodeAt(0)!==92){e+=r;continue}let s=t[++i]??"";e+=gt[s]??s}return e}function W(o){let t=o.trim();return/[\t ]{2}/.test(t)?t.replace(/[\t ]{2,}/g," "):t}function ht(o){return W(o.slice(o.indexOf("title")+5))}function lt(o){return W(o.slice(o.indexOf(":",o.indexOf("accTitle"))+1))}function dt(o){let t=o.indexOf("accDescr")+8;for(;b(o.charCodeAt(t));)t++;if(o[t]===":")return W(o.slice(t+1));let e=o.slice(o.indexOf("{",t)+1,o.lastIndexOf("}"));return Tt(Pt(e)).replace(/[\t ]{2,}/g," ").replace(/[\n\r]{2,}/g,`
|
|
3
3
|
`)}function Pt(o){let t="",e=0,i=o.length;for(;;){for(;e<i&&m(o.charCodeAt(e));)e++;let r=e;for(;e<i&&!v(o.charCodeAt(e));)e++;if(e>=i)return t+o.slice(r);t+=o.slice(r,++e)}}function Tt(o){let t="",e=0,i=o.length;for(;e<i;){let r=e;for(;e<i&&!m(o.charCodeAt(e));)e++;if(t+=o.slice(r,e),e>=i)break;let s=e,n=-1;for(;e<i&&m(o.charCodeAt(e));e++)e>s&&v(o.charCodeAt(e))&&(n=e);if(e===i)break;t+=o.slice(n<0?s:n,e)}return t}var j=-1,ft=-2,St=43,R=o=>o===10||o===13;function y(o,t,e){return new M(o,t,e).run()}var M=class{constructor(t,e,i){this.src=t;let r=i.mask?Rt(i):i.text;this.text=r+`
|
|
4
4
|
`,this.len=r.length,this.n=this.text.length,this.offsets=i.runs&&new B(i.runs),this.holes=i.holes,this.hole=ot(i,e),this.p=nt(i,e),this.w=new q(Math.ceil((this.len-this.p)/6)+8)}text;len;n;offsets;holes;hole;w;p;kind=j;stringFails=[-1,-1];braceFrom=-1;braceAt=ft;yamlFails=1/0;directiveFails=1/0;run(){let{text:t,n:e}=this;for(;this.p<this.len&&m(t.charCodeAt(this.p));)this.p++;let i=-1;for(;this.p<e;){let r=this.p,s=this.scan(r);if(s<0){i<0&&(i=r),this.p=Q(t,r);continue}i>=0&&(this.emit(h.Error,i,r),i=-1),this.kind!==j&&this.emit(this.kind,r,s),this.p=s}return this.trivia(this.src.length+1),this.w.finish(this.src)}scan(t){let{text:e}=this,i=e.charCodeAt(t),r=e.startsWith("packet-beta",t)?this.match(c.PacketBeta,t+11):-1;return r<0&&(r=this.keyword("packet",t,c.Packet)),r<0&&i===45&&(r=this.yaml(t),r<0&&(r=this.match(c.Dash,t+1))),r<0&&i===St&&(r=this.match(c.Plus,t+1)),r<0&&i===58&&(r=this.match(c.Colon,t+1)),r<0&&(r=this.accessibility(t)),r<0&&N(i)&&(r=this.int(t)),r<0&&(i===34||i===39)&&(r=this.string(t,i)),r<0&&R(i)&&(r=this.match(h.Newline,t+E(this.text,t))),r<0&&b(i)&&(r=this.match(j,this.blanks(t))),r<0&&i===37&&this.text.charCodeAt(t+1)===37&&(r=this.directive(t),r<0&&(r=this.match(h.Comment,this.lineEnd(t+2)))),r}match(t,e){return this.kind=t,e}keyword(t,e,i){if(!this.text.startsWith(t,e))return-1;let r=e+t.length,s=this.text.charCodeAt(r);return r>=this.n||m(s)||s===37&&this.text.charCodeAt(r+1)===37?this.match(i,r):-1}int(t){let{text:e}=this;if(e.charCodeAt(t)===48)return this.match(c.Int,t+1);let i=t+1;for(;i<this.n&&N(e.charCodeAt(i));)i++;return e.charCodeAt(i)!==46?this.match(c.Int,i):i-t>=2?this.match(c.Int,i-1):-1}accessibility(t){let{text:e}=this,i=b(e.charCodeAt(t))?this.blanks(t):t;if(e.startsWith("accDescr",i)){let r=this.accDescr(i+8);if(r>=0)return this.match(c.AccDescr,r)}if(e.startsWith("accTitle",i)){let r=this.blanks(i+8);if(e.charCodeAt(r)===58)return this.match(c.AccTitle,this.lineTail(r+1))}if(e.startsWith("title",i)){let r=i+5;return this.match(c.Title,b(e.charCodeAt(r))?this.lineTail(r+1):r)}return-1}accDescr(t){let{text:e}=this,i=this.blanks(t);if(e.charCodeAt(i)===58)return this.lineTail(i+1);let r=t;for(;r<this.n&&m(e.charCodeAt(r));)r++;if(e.charCodeAt(r)!==123)return-1;let s=this.brace(r+1);return s<0?-1:s+1}string(t,e){let i=e===34?0:1;if(t<(this.stringFails[i]??-1))return-1;let{text:r,n:s}=this,n=t+1;for(;n<s;){let a=r.charCodeAt(n);if(a===e)return this.match(c.String,n+1);if(a===92){if(n+1>=s||v(r.charCodeAt(n+1)))break;n+=2}else n++}return this.stringFails[i]=n,-1}yaml(t){let{text:e,n:i}=this;if(!e.startsWith("---",t))return-1;let r=this.blanks(t+3),s=E(e,r);if(s===0)return-1;let n=r+s;if(n>=this.yamlFails)return-1;for(let l=n+1;l<i;l++){if(!R(e.charCodeAt(l-1))||!e.startsWith("---",l))continue;let d=this.closer(l+3);if(d>=0)return this.match(c.Yaml,d)}let a=e.startsWith("---",n)?this.closer(n+3):-1;return a>=0?this.match(c.Yaml,a):(this.yamlFails=n,-1)}directive(t){let{text:e}=this;if(e.charCodeAt(t+2)!==123)return-1;let i=t+3;if(i>=this.directiveFails)return-1;for(let r=e.indexOf("}%%",i);r!==-1;r=e.indexOf("}%%",r+1)){let s=this.closer(r+3);if(s>=0)return this.match(h.Directive,s)}return this.directiveFails=i,-1}closer(t){let e=E(this.text,t);return e>0?t+e:t>=this.n||m(this.text.charCodeAt(t))?t:-1}blanks(t){let e=t;for(;e<this.n&&b(this.text.charCodeAt(e));)e++;return e}lineEnd(t){let e=t;for(;e<this.n&&!R(this.text.charCodeAt(e));)e++;return e}lineTail(t){let{text:e,n:i}=this,r=t;for(;r<i;){let s=e.charCodeAt(r);if(R(s)||s===37&&e.charCodeAt(r+1)===37)break;r++}return r}brace(t){let e=this.braceAt;return e!==ft&&t>=this.braceFrom&&(e===-1||t<=e)?e:(this.braceFrom=t,this.braceAt=this.text.indexOf(String.fromCharCode(125),t),this.braceAt)}source(t){return t>=this.len?this.src.length:this.offsets?this.offsets.source(t):t}trivia(t){let e=this.holes;for(let i=e[this.hole];i&&i.start<t;i=e[++this.hole])i.kind==="comment"?this.w.push(h.Comment,i.start,i.end):i.kind==="directive"&&this.w.push(h.Directive,i.start,i.end)}emit(t,e,i){let r=this.source(e),s=Math.min(i,this.len),n=s>e?this.source(s-1)+1:r;this.holes.length>0&&(this.trivia(r),n>r&&(n=this.dropAt(n))),this.w.push(t,r,n)}dropAt(t){let e=this.holes,i=this.hole;for(;i<e.length&&(e[i]?.start??t)<t;)i++;let r=e[i];return r&&r.start===t&&r.kind==="drop"?r.end:t}};function Rt(o){let{text:t,mask:e,runs:i}=o;if(!e)return t;let r=i?new B(i):void 0,s="",n=0;for(let a=t.indexOf('"');a!==-1;a=t.indexOf('"',a+1))((e[r?r.source(a):a]??0)&st)!==0&&(s+=t.slice(n,a)+"'",n=a+1);return s+t.slice(n)}var Ot=["PACKET_END_BEFORE_START","PACKET_NOT_CONTIGUOUS","PACKET_ZERO_BITS"],T=[c.Packet,c.PacketBeta],I=[c.Title,c.AccTitle,c.AccDescr],D=[c.Int,c.Plus],z=[...D,...I],pt=[...z,h.Newline,h.EOF],mt=[h.Newline,h.EOF],yt=[...T,h.Newline],bt=[c.Dash,c.Colon],Dt=w(h.Newline,h.EOF),It=w(c.Colon,c.Plus,c.Dash,c.String),_t={[c.Title]:"title",[c.AccTitle]:"accTitle",[c.AccDescr]:"accDescr"};function Ft(o,t,e){for(let i=0;i<t.length;i++){let r=t.start[i]??0,s=t.end[i]??0;if(r>=e)break;if(s<e)continue;let n=t.kind[i]??h.EOF,a=o.charCodeAt(r);if(n===c.String&&e<s||n===h.Error&&(a===34||a===39))return"string";let l=_t[n];if(!l)continue;let d=r;for(;/[\t ]/.test(o.charAt(d));)d++;d+=l.length;let p=n===c.AccDescr&&/^\s*\{/.test(o.slice(d,s));if(e>d&&(e<s||!p))return l}return"INITIAL"}var Nt=new F([["`packet`",T],["a bit number such as `16`",[c.Int]],["`-` and the last bit",[c.Dash]],["`+` and a number of bits",[c.Plus]],["`:` and a label",[c.Colon]],['a label in quotes, such as `"Source Port"`',[c.String]],["`title`, `accTitle:` or `accDescr`",I],["a line break",[h.Newline]],["the end of the text",[h.EOF]]]),Bt=new F([["`packet`",T],['a field such as `0-15: "Source Port"` or `+16: "Data"`',D],["`title`, `accTitle:` or `accDescr`",I],["a line break",[h.Newline]],["the end of the text",[h.EOF]]]),Kt={[c.Title]:"Title",[c.AccTitle]:"AccTitle",[c.AccDescr]:"AccDescr"},$t={Title:"title",AccTitle:"accTitle",AccDescr:"accDescr"},H="put each field and statement on a line of its own",A='write a field as `0-15: "label"`, `16: "label"` or `+8: "label"`',X=class extends Error{},k=new X;function Lt(o,t={}){return new G(o,t).parse()}var G=class{constructor(t,e){this.src=t;this.options=e;let i=this.pre=e.preprocessed??g(t);e.preprocessed||this.st.diagnostics.list.push(...i.diagnostics),this.view=C(t,i.bodyStart,i.directives.map(a=>a.range)),this.full=y(t,i.bodyStart,this.view),this.t=et(this.full,K);let{config:r,problems:s}=at(e.config);this.bitsPerRow=r.bitsPerRow,this.rows=new S(r.bitsPerRow);let n={start:i.bodyStart,end:i.bodyStart};for(let a of s)this.st.diagnostics.warning("PACKET_CONFIG_INVALID",a.message,n);if(e.probe!==void 0){let a=this.probe=new tt(t,e.probe,It);i.frontMatter&&a.offset<i.bodyStart?a.outside("frontMatter"):a.trivia(this.full),a.lexed(a.offset,a.offset,Ft(t,this.full,a.offset))}}pre;view;full;t;i=0;st=new rt;probe;children=[];lines;mentions=new Map;bitsPerRow;lastBit=-1;rows;title="";accTitle="";accDescr="";parse(){let{st:t,src:e}=this;this.statement(()=>this.header()),this.document();let i=t.diagnostics.list.filter(a=>a.severity==="warning"),r=this.title||this.pre.frontMatter?.title,s=Object.freeze({fields:Object.freeze(this.rows.fields),rows:Object.freeze(this.rows.rows()),bitsPerRow:this.bitsPerRow,...r?{title:r}:{},accTitle:this.accTitle,accDescr:this.accDescr,warnings:Object.freeze(i)}),n={id:"doc",type:"Document",range:{start:this.pre.bodyStart,end:e.length},children:this.children};return t.result(s,n,this.full,this.options,this.probe)}kind(t=this.i){return this.t.kind[t]??h.EOF}range(t=this.i){return{start:this.t.start[t]??0,end:this.t.end[t]??0}}span(t,e){return{start:this.range(t).start,end:this.range(e).end}}raw(t=this.i){let{start:e,end:i}=this.range(t);return x(this.src,e,i,this.view)}tested(t){let e=this.probe;e?.isAt(this.t,this.i,this.pre.bodyStart)&&e.tested(t,this.range().start)}expect(t,e){return this.tested([t]),this.kind()!==t&&this.fail([t],e),this.i++}id(t){let e=(this.mentions.get(t)??0)+1;return this.mentions.set(t,e),e===1?t:`${t}@${e}`}lineOf(t){return(this.lines??=new Y(this.src)).position(t).line+1}found(){let t=this.kind();if(t===h.EOF)return"the end of the text";if(t===h.Newline)return"a line break";let e=this.raw().trim(),i=e.split(`
|
|
5
5
|
`,1)[0]??"";return i.length>24||i!==e?`\`${i.slice(0,24)}\u2026\``:`\`${i}\``}fail(t,e,i=Nt){let{st:r}=this,s=this.range();this.kind()===h.Error&&this.badCharacters(s,t);let n=r.diagnostics.unexpected("UNEXPECTED",s,i.names(t),this.found()),a=e??this.explain();throw a&&(n.message=`${n.message.slice(0,-1)}; ${a}.`),k}badCharacters(t,e){let{st:i}=this,r=this.raw(),s=this.lineOf(t.start);if(r.startsWith('"')||r.startsWith("'")){let d=r[0]??'"';throw i.diagnostics.error("UNCLOSED_STRING",`Unclosed label: the \`${d}\` at line ${s} has no closing \`${d}\`. Add \`${d}\` after the label.`,t,{expected:[`\`${d}\``]}),k}let n=/^[\t ]*(accDescr|accTitle)/.exec(r)?.[1];if(n==="accDescr")throw i.diagnostics.error("UNCLOSED_ACC_DESCR",`Unclosed accessible description: the \`accDescr {\` at line ${s} has no closing \`}\`, and \`accDescr\` without \`{\` takes a \`:\`. Write \`accDescr: \u2026\` or \`accDescr { \u2026 }\`.`,t),k;if(n==="accTitle")throw i.diagnostics.error("UNEXPECTED_CHARACTER","Expected `:` after `accTitle`; write it as `accTitle: \u2026`.",t,{expected:["`:`"]}),k;let a=r.length>24?`${r.slice(0,24)}\u2026`:r,l="";throw e.includes(c.String)?l='; a label goes in quotes, such as `"Source Port"`':e.includes(c.Colon)?l=`; ${A}`:e.includes(c.Packet)?l="; a diagram starts with `packet` or `packet-beta`":r===";"?l=`; \`;\` does not end a statement in a packet diagram: ${H}`:/^[0-9]/.test(r)&&(l="; a bit number is a whole number such as `16`"),i.diagnostics.error("UNEXPECTED_CHARACTER",`Unexpected character \`${a}\`${l}.`,t),k}explain(){let t=this.kind();if(T.includes(t))return"a diagram has one `packet`, at its start";if(z.includes(t))return H;if(t===c.String||t===c.Colon||t===c.Dash)return A}recover(){this.probe?.freeze(),this.i=it(this.t,this.i,Dt)}statement(t){try{t()}catch(e){if(e!==k)throw e;this.recover()}}header(){for(;this.tested(yt),this.kind()===h.Newline;)this.i++;let t=this.kind();T.includes(t)||this.fail(T);let e=this.range(this.i++);this.st.statement("header",e),this.children.push({id:"packet",type:"Header",range:e,beta:t===c.PacketBeta})}document(){let t=!1;for(;;){this.tested(pt);let e=this.kind();if(e===h.EOF)return;if(e===h.Newline){this.i++;continue}if(D.includes(e)||this.startsLikeBits()){t=this.fieldStatement(t);continue}this.statement(()=>{I.includes(e)?this.text(e):this.fail(pt,void 0,Bt)})}}startsLikeBits(){return this.kind()===h.Error&&/^[0-9]/.test(this.raw())}fieldStatement(t){let e=!1;try{this.kind()===h.Error&&this.fail(D);let i=this.bits();e=!0,this.field(i,t)}catch(i){if(i!==k)throw i;this.recover()}return!e}eol(){this.tested(mt);let t=this.kind();t!==h.EOF&&(t!==h.Newline&&this.fail(mt,z.includes(t)?H:void 0),this.i++)}bits(){let t=this.i;if(this.kind()===c.Plus){this.i++;let s=this.expect(c.Int,A);return{bits:Number(this.raw(s)),range:this.span(t,s)}}let e=this.i++,i=Number(this.raw(e));if(this.tested(bt),this.kind()===c.Int&&this.fail(bt,"a bit number has no leading zeros, and a range is written `0-15`"),this.kind()!==c.Dash)return{start:i,range:this.range(e)};this.i++;let r=this.expect(c.Int,A);return{start:i,end:Number(this.raw(r)),range:this.span(t,r)}}field(t,e){let{start:i,end:r,error:s}=this.resolve(t,e);this.expect(c.Colon,A);let n=this.expect(c.String),a=this.range(n),l=ct(this.raw(n)),d={start:t.range.start,end:a.end},p=this.id(`field:${i}-${r}`),u=s;!u&&!this.place({start:i,end:r,bits:r-i+1,label:l,astId:p},d)&&(u={reason:"rowCap"}),this.children.push({id:p,type:"Field",range:d,start:i,end:r,label:l,labelRange:a,bitsRange:t.range,...u?{dropped:u}:{}}),this.st.statement("field",d),this.st.symbol(l,"field",a,"def"),this.eol()}resolve(t,e){let i=t.range,{start:r,end:s}=t,n=(u,_)=>(this.st.diagnostics.error(u,_,i),{reason:"error",code:u,message:_});if(r!==void 0&&s!==void 0&&s<r){let u=n("PACKET_END_BEFORE_START",`Packet block ${r} - ${s} is invalid. End must be greater than start.`);return this.lastBit=r,{start:r,end:s,error:u}}let a=e&&r!==void 0?r:this.lastBit+1,l=r??a,d=s??l+(t.bits??1)-1;if(t.bits===0){let u=n("PACKET_ZERO_BITS",`Packet block ${l} is invalid. Cannot have a zero bit field.`);return{start:l,end:d,error:u}}if(this.lastBit=d,l===a)return{start:l,end:d};let p=n("PACKET_NOT_CONTIGUOUS",`Packet block ${l} - ${s??l} is not contiguous. It should start from ${a}.`);return{start:l,end:d,error:p}}place(t,e){let i=this.rows.fields.length,r=this.rows.add(t);return r!==void 0&&this.st.diagnostics.warning("PACKET_TRUNCATED",`The packet has more than ${1e4} rows: bit ${r} and the bits after it are not drawn.`,e),this.rows.fields.length>i}text(t){let e=this.i++,i=this.raw(e),r=Kt[t]??"Title",s=this.range(e);for(;s.start<s.end&&/[\t ]/.test(this.src[s.start]??"");)s.start++;let n;r==="Title"?n=this.title=ht(i):r==="AccTitle"?n=this.accTitle=lt(i):n=this.accDescr=dt(i);let a=$t[r];this.children.push({id:this.id(a),type:r,range:s,text:n}),this.st.statement(a,s),this.eol()}};function Wt(o,t=g(o)){return o.startsWith("packet",Z(o,t))}function ce(o){let t=g(o),e=C(o,t.bodyStart,t.directives.map(a=>a.range)),i=y(o,t.bodyStart,e),r=e.holes.filter(a=>a.kind!=="drop"),s=0,n=[];for(let a=0;a<i.length;a++){let l=i.kind[a]??h.EOF,d=i.start[a]??0,p=i.end[a]??0;if(l===h.EOF)continue;for(;(r[s]?.start??1/0)<d;)s++;let u=r[s];(l===h.Comment||l===h.Directive)&&u?.start===d&&u.end===p||n.push({kind:l,text:x(o,d,p,e),range:{start:d,end:p}})}return n}export{c as a,K as b,$ as c,kt as d,Ot as e,Lt as f,Wt as g,ce as h};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-4DR73ZXX.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{k as M,p as y,r as x,v as K}from"./chunk-
|
|
1
|
+
import{k as M,p as y,r as x,v as K}from"./chunk-KJT4SRSJ.mjs";var h={EOF:0,Newline:1,Comment:2,Directive:3,Space:4,Error:5},ee=16;function V(r,e){return r.source.slice(r.start[e]??0,r.end[e]??0)}var P=class{kind;start;end;n=0;constructor(e=16){let t=Math.max(4,e|0);this.kind=new Uint16Array(t),this.start=new Uint32Array(t),this.end=new Uint32Array(t)}push(e,t,n){this.n===this.kind.length&&this.grow(),this.kind[this.n]=e,this.start[this.n]=t,this.end[this.n]=n,this.n++}finish(e){this.push(h.EOF,e.length,e.length);let t=this.n;return{kind:this.kind.slice(0,t),start:this.start.slice(0,t),end:this.end.slice(0,t),source:e,length:t}}grow(){let e=this.kind.length*2,t=new Uint16Array(e);t.set(this.kind),this.kind=t;let n=new Uint32Array(e);n.set(this.start),this.start=n;let o=new Uint32Array(e);o.set(this.end),this.end=o}};var j=Object.freeze({[h.EOF]:"Other",[h.Newline]:"Other",[h.Comment]:"Comment",[h.Directive]:"Meta",[h.Space]:"Other",[h.Error]:"Other"});function te(r,e){let t={...j};for(let n of Object.keys(e))t[r[n]]=e[n];return Object.freeze(t)}function z(...r){let e=new Uint8Array(Math.max(0,...r)+1);for(let t of r)e[t]=1;return e}function ne(r,e){return r[e]===1}var S=z(h.Comment,h.Directive,h.Space),R=class{constructor(e,t=S){this.tokens=e;this.trivia=t;this.pos=this.skip(0)}pos;skip(e){let t=this.tokens.length-1;for(;e<t&&this.trivia[this.tokens.kind[e]??0]===1;)e++;return Math.min(e,t)}get kind(){return this.tokens.kind[this.pos]??h.EOF}get text(){return V(this.tokens,this.pos)}get start(){return this.tokens.start[this.pos]??0}get end(){return this.tokens.end[this.pos]??0}get range(){return{start:this.start,end:this.end}}peek(){return this.tokens.kind[this.skip(this.pos+1)]??h.EOF}next(){let e=this.pos;return this.pos=this.skip(e+1),e}peekAt(e){return this.peek()===e}at(e){return this.kind===e}eat(e){return this.kind!==e?!1:(this.next(),!0)}tested(e){}recovering(){}},H=class extends R{constructor(t,n,o=S){super(t,o);this.probe=n;n.trivia(t),this.target=n.targetIn(t,0,o)}target;record(t,n){t===this.target&&this.probe.tested(n,this.tokens.start[t]??0)}peekAt(t){return this.record(this.skip(this.pos+1),t),super.peekAt(t)}at(t){return this.record(this.pos,t),super.at(t)}eat(t){return this.record(this.pos,t),super.eat(t)}tested(t){this.record(this.pos,t)}recovering(){this.probe.freeze()}};var G=r=>y(r)||x(r),Q=new Uint8Array(0),F=class{constructor(e,t,n=Q){this.source=e;this.follow=n;let o=0;Number.isFinite(t)?o=Math.trunc(t):t>0&&(o=e.length),this.offset=Math.max(0,Math.min(o,e.length))}offset;mode="";kinds=[];start=-1;frozen=!1;modeSet=!1;off=!1;view;viewFrom=-1;target=-1;follows(e){return e===h.Newline||e===h.Space||this.follow[e]===1}covers(e,t,n){let o=this.offset;if(t<o||e===t)return t>=o;let s=this.follows(n),i=t;for(;i>e&&G(this.source.charCodeAt(i-1));)i--;if(i>e){if(i<o)return!1;if(i===o)return!s}else if(t===o)return!s;if(s){for(let u=e;u<o;u++)if(x(this.source.charCodeAt(u)))return!1}return!0}blankIn(e,t){if(t>e&&G(this.source.charCodeAt(t-1)))return!0;for(let n=e;n<t;n++)if(x(this.source.charCodeAt(n)))return!0;return!1}targetIn(e,t=0,n=Q){if(e===this.view&&t===this.viewFrom)return this.target;if(this.view=e,this.viewFrom=t,this.target=-1,t>this.offset)return-1;let{kind:o,start:s,end:i}=e,u=0;for(;u<e.length&&(n[o[u]??0]===1||!this.covers(s[u]??0,i[u]??0,o[u]??0));)u++;if(u===e.length)return-1;let d=l=>(s[l]??0)<(i[l]??0)&&!this.follows(o[l]??0);if(d(u))for(let l=u-1;l>=0&&n[o[l]??0]!==1;l--){let a=s[u]??0;if(!d(l)||i[l]!==a||y(this.source.charCodeAt(a))||this.blankIn(s[l]??0,a))break;u=l}return this.target=u,u}isAt(e,t,n=0){return t===this.targetIn(e,n)}outside(e){this.off=!0,this.mode=e,this.modeSet=!0}trivia(e){let t=this.offset;for(let n=0;n<e.length;n++){let o=e.kind[n];if(o!==h.Comment&&o!==h.Directive)continue;let s=e.end[n]??0,i=t<s||t===s&&!x(this.source.charCodeAt(s-1));if((e.start[n]??0)<t&&i){this.outside(o===h.Comment?"comment":"directive");return}}}tested(e,t){if(!(this.frozen||this.off)){if(this.start<0&&(this.start=t),typeof e=="number"){this.kinds.includes(e)||this.kinds.push(e);return}for(let n of e)this.kinds.includes(n)||this.kinds.push(n)}}freeze(e=!1){(e||this.start>=0)&&(this.frozen=!0)}reset(){this.kinds=[],this.start=-1,this.frozen=!1,this.off||(this.modeSet=!1)}lexed(e,t,n){if(this.modeSet)return;let o=this.offset;(e>=o||t>o)&&(this.mode=n,this.modeSet=!0)}result(){let e=this.offset,t=this.start>=0&&this.start<e?this.start:e;for(;t<e&&y(this.source.charCodeAt(t));)t++;return{offset:e,expected:[...this.kinds],mode:this.mode,prefix:{start:t,end:e}}}};function re(r,e){r.recovering();let t=r.start,n=t;for(;r.kind!==h.EOF&&e[r.kind]!==1;)n=r.end,r.next();return{start:t,end:n}}function oe(r,e=S){let t=0;for(let d=0;d<r.length;d++)e[r.kind[d]??h.EOF]===1&&t++;if(t===0)return r;let n=r.length-t,o=new Uint16Array(n),s=new Uint32Array(n),i=new Uint32Array(n),u=0;for(let d=0;d<r.length;d++){let l=r.kind[d]??h.EOF;e[l]!==1&&(o[u]=l,s[u]=r.start[d]??0,i[u]=r.end[d]??0,u++)}return{kind:o,start:s,end:i,length:n}}function ie(r,e,t){let n=e;for(;n<r.length&&t[r.kind[n]??h.EOF]!==1;)n++;return n}function O(r){for(let e=0;e<r.length;e++){let t=r.charCodeAt(e);if(t===37||t===62||t===64||t===35)return r.replace(/[%>@#]/g,n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`)}return r}function v(r,e){let t=(r.get(e)??0)+1;return r.set(e,t),t}function W(r){return`n:${O(r)}`}var T=class{nodes=new Map;edges=new Map;subgraphs=new Map;statements=new Map;node(e){let t=v(this.nodes,e),n=W(e);return t===1?n:`${n}@${t}`}edge(e,t){let n=this.edges.get(e);n||this.edges.set(e,n=new Map);let o=v(n,t),s=`e:${O(e)}>${O(t)}`;return o===1?s:`${s}#${o}`}subgraph(e){let t=v(this.subgraphs,e),n=`s:${O(e)}`;return t===1?n:`${n}@${t}`}statement(e){return`${e}:${v(this.statements,e)}`}};var $=class{diagnostics=new M;symbols=[];statements=[];ids=new T;open=[];symbol(e,t,n,o){this.symbols.push({name:e,kind:t,range:n,role:o})}place(e){let t=this.open[this.open.length-1];return t?(t.children??=[]).push(e):this.statements.push(e),e}statement(e,t){return this.place({kind:e,range:t})}beginStatement(e,t){let n=this.place({kind:e,range:{start:t,end:t}});return this.open.push(n),n}endStatement(e,t){let n=this.open.lastIndexOf(e);if(!(n<0))for(let o of this.open.splice(n))o.range.end=t}result(e,t,n,o,s){let i={model:e,ast:t,diagnostics:this.diagnostics.list,symbols:this.symbols,statements:this.statements};return o?.keepTokens&&(i.tokens=n),s&&(i.probe=s.result()),i}};var D=1,N=2,J=r=>r===10||r===13;function de(r,e,t,n={}){let o,s=(d,l)=>{o??=new Uint8Array(r.length),o[d]=(o[d]??0)|l};n.tagQuotes!==!1&&le(r,e,s);let i=pe(r,e,t);if(n.styleSemicolons!==!1&&ce(r,e,i.length>0)){let d=q(r,i),l=d.runs?new C(d.runs):void 0;he(d.text,e,a=>l?l.source(a):a,s,()=>o)}let u=o;if(u){let d=i.length,l=0;for(let a=e;a<u.length;a++){if(!((u[a]??0)&N))continue;for(;l<d&&(i[l]?.end??0)<=a;)l++;let f=l<d?i[l]:void 0;(!f||f.start>a)&&i.push({start:a,end:a+1,kind:"drop"})}i.sort((a,f)=>a.start-f.start)}return{mask:o,holes:i,...q(r,i),braceNewline:n.braceNewline===!0}}function q(r,e){if(e.length===0)return{text:r,runs:void 0};let t=[],n=new Uint32Array(2*e.length+2),o=0,s=0,i=0,u=d=>{d<=i||(t.push(r.slice(i,d)),n[o++]=s,n[o++]=i,s+=d-i)};for(let d of e)u(d.start),d.end>i&&(i=d.end);return u(r.length),o===0&&(o=2),{text:t.join(""),runs:n.subarray(0,o)}}var C=class{constructor(e,t=0){this.runs=e;this.last=(e.length>>1)-1;let n=this.last;for(;this.k<n;){let o=this.k+n+1>>1;(e[2*o]??0)<=t?this.k=o:n=o-1}}k=0;last;source(e){let t=this.runs,n=this.k;for(;n<this.last&&(t[2*n+2]??0)<=e;)n++;for(;n>0&&(t[2*n]??0)>e;)n--;return this.k=n,(t[2*n+1]??0)+e-(t[2*n]??0)}};function le(r,e,t){let n=-1,o=r.indexOf("<",e);for(;o!==-1&&o+1<r.length;){if(!K(r.charCodeAt(o+1))){o=r.indexOf("<",o+1);continue}if(n<o&&(n=r.indexOf(">",o)),n===-1)return;let s=o+1;for(;s<n;)if(r.charCodeAt(s)===61&&r.charCodeAt(s+1)===34){let i=s+2;for(;i<n&&r.charCodeAt(i)!==34;)i++;if(i>=n)break;t(s+1,D),t(i,D),s=i+1}else s++;o=r.indexOf("<",n+1)}}var ue=[`
|
|
2
2
|
`,"\r"],Y=[`
|
|
3
3
|
`,"\r","\u2028","\u2029"];function L(r,e=ue){let t=e.map(()=>-2);return n=>{let o=r.length;for(let s=0;s<e.length;s++){let i=t[s]??-1;i!==-1&&i<n&&(t[s]=i=r.indexOf(e[s]??"",n)),i!==-1&&i<o&&(o=i)}return o}}function ce(r,e,t){return r.includes(";",e)&&(t||r.includes("style",e)||r.includes("classDef",e))}function he(r,e,t,n,o){if(!r.includes("style",e)&&!r.includes("classDef",e))return;let s=["style","classDef"],i=[-2,-2],u=L(r,Y),d=e;for(;d<=r.length;){let l=u(d);for(let a=0;a<2;a++){let f=s[a]??"";(i[a]??0)!==-1&&(i[a]??0)<d&&(i[a]=r.indexOf(f,d));let g=i[a]??-1;if(g===-1||g>=l)continue;let m=o(),c=p=>m!==void 0&&((m[t(p)]??0)&N)!==0,b=!1,k=-1;for(let p=g+f.length;p<l;p++){let A=r.charCodeAt(p);if(!c(p))if(A===58)b=!0;else if(A===35&&b){k=p;break}else y(A)&&(b=!1)}if(!(k<0)){for(let p=l-1;p>k;p--)if(r.charCodeAt(p)===59&&!c(p)){n(t(p),N);break}}}if(l>=r.length)break;d=l+(r.charCodeAt(l)===13&&r.charCodeAt(l+1)===10?2:1)}}function X(r,e){if(e.length===0)return r;let t=0;return n=>{for(;;){let o=r(n);for(;t<e.length&&(e[t]?.end??0)<=o;)t++;let s=e[t];if(!s||s.start>o)return o;n=s.end}}}function fe(r,e,t){let n=[],o=0;for(let s of e){if(s.start<t)continue;for(;o<r.length&&r[o].end<=s.start;)n.push(r[o++]);let i=r[o];i&&i.start<=s.start&&s.end<=i.end||(i&&i.start<=s.start&&n.push(r[o++]),n.push({start:s.start,end:s.end,kind:"directive"}))}for(;o<r.length;)n.push(r[o++]);return n}function pe(r,e,t){if(t.length===0&&!r.includes("%%",e))return[];let n=[],o=0,s=a=>{for(;o<t.length&&(t[o]?.end??0)<=a;)o++;let f=t[o];return f&&f.start===a?f:void 0},i=X(L(r),t),u=X(L(r,Y),t),d=a=>{for(let f=s(a);f;f=s(a))a=f.end;return a},l=e;for(;l<r.length;){let a=l;if(t.length===0)for(;a<r.length&&y(r.charCodeAt(a));)a++;else for(;a<r.length;){let c=s(a);if(c)a=c.end;else if(y(r.charCodeAt(a)))a++;else break}let f=r.charCodeAt(a)===37?d(a+1):a+1,g=r.charCodeAt(f)===37?d(f+1):f+1;if(r.charCodeAt(a)===37&&r.charCodeAt(f)===37&&r.charCodeAt(g)!==123&&g<r.length&&!J(r.charCodeAt(g))){let c=i(g);r.charCodeAt(c)===13&&c++,r.charCodeAt(c)===10&&c++,n.push({start:l,end:c,kind:"comment"}),l=c;continue}let m=u(a);if(m>=r.length)break;l=m+(r.charCodeAt(m)===13&&r.charCodeAt(m+1)===10?2:1)}return t.length===0?n:fe(n,t,e)}function me(r,e,t,n){let{text:o,mask:s,braceNewline:i}=n,u=n.holes,d=Z(n,e);if(!((u[d]?.start??t)<t||d>0&&u[d-1]?.end===e)&&!(i?/[\r#}]/:/[\r#]/).test(r.slice(e,t))&&(!i||r.charCodeAt(e-1)!==125)&&!ge(s,e,t))return r.slice(e,t);let a=_(n,e),f=_(n,t),g=n.runs?new C(n.runs,a):void 0,m="";for(let c=a;c<f;c++){let b=o.charCodeAt(c);if(((s?.[g?g.source(c):c]??0)&D)!==0){m+="'";continue}if(b===13){m+=`
|
|
4
4
|
`,o.charCodeAt(c+1)===10&&(!g||g.source(c+1)===g.source(c)+1)&&c++;continue}if(b===35){let k=c+1;for(;k<f&&K(o.charCodeAt(k));)k++;if(k>c+1&&k<f&&o.charCodeAt(k)===59){let p=o.slice(c+1,k);m+=/^\d+$/.test(p)?`&#${p};`:`&${p};`,c=k;continue}}if(i&&(b===125||c===a&&o.charCodeAt(c-1)===125&&y(b))){let k=b===125?c+1:c;b===125&&(m+="}");let p=k,A=-1;for(;p<f&&y(o.charCodeAt(p));)J(o.charCodeAt(p))&&(A=p),p++;if(p>=o.length){c=p-1;continue}if(A>=0){m+=`
|
|
5
|
-
`,c=o.charCodeAt(A)===13&&o.charCodeAt(A+1)===10?A+1:A;continue}if(b===125)continue}m+=o[c]}return m}function _(r,e){let t=r.runs;if(!t)return e;let n=0,o=(t.length>>1)-1;for(;n<o;){let d=n+o+1>>1;(t[2*d+1]??0)<=e?n=d:o=d-1}let s=t[2*n]??0,i=t[2*n+1]??0;if(e<i)return s;let u=2*n+2<t.length?t[2*n+2]??0:r.text.length;return Math.min(s+e-i,u)}function Z(r,e){let t=r.holes,n=0,o=t.length;for(;n<o;){let s=n+o>>1;(t[s]?.end??0)<=e?n=s+1:o=s}return n}function ge(r,e,t){if(!r)return!1;for(let n=e;n<t;n++)if(r[n])return!0;return!1}export{h as a,ee as b,
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
`,c=o.charCodeAt(A)===13&&o.charCodeAt(A+1)===10?A+1:A;continue}if(b===125)continue}m+=o[c]}return m}function _(r,e){let t=r.runs;if(!t)return e;let n=0,o=(t.length>>1)-1;for(;n<o;){let d=n+o+1>>1;(t[2*d+1]??0)<=e?n=d:o=d-1}let s=t[2*n]??0,i=t[2*n+1]??0;if(e<i)return s;let u=2*n+2<t.length?t[2*n+2]??0:r.text.length;return Math.min(s+e-i,u)}function Z(r,e){let t=r.holes,n=0,o=t.length;for(;n<o;){let s=n+o>>1;(t[s]?.end??0)<=e?n=s+1:o=s}return n}function ge(r,e,t){if(!r)return!1;for(let n=e;n<t;n++)if(r[n])return!0;return!1}export{h as a,ee as b,V as c,P as d,te as e,z as f,ne as g,S as h,R as i,H as j,F as k,re as l,oe as m,ie as n,W as o,$ as p,D as q,de as r,C as s,me as t,_ as u,Z as v};
|
|
6
|
+
//# sourceMappingURL=chunk-4XJZCOJ5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["node_modules/@mermaid-js/diagram-block/src/model.ts"],"sourcesContent":["/**\n * BlockModel: the plain-data result of a block parse (spec #521 §Parser, T2) and the input of\n * the block layout. It keeps the data of v12's `blockDB.ts` (`getBlocks()`, `getEdges()`,\n * `getClasses()`), so model parity holds against it, with v12's five model bugs fixed (D442):\n *\n * - blocks form a tree in source order: each block sits where its id first appears (a leaf, a\n * composite header or an edge end); a later mention merges into it, as v12's DB did: a type\n * other than `na` replaces the type, a label other than the id replaces the label, and the\n * span, directions and position stay the first's. A later `block:id … end` makes the block a\n * composite and appends its children to the block's (D442; v12 dropped them);\n * - an `a --> b --> c` chain declares `a`, `b` and `c` and draws both edges (D442); as in v12,\n * the span written after a chain's first node is dropped (`a:2 --> b` spans 1);\n * - `class` applies to an id declared later too (D442), and its id list is trimmed; `style`\n * applies after every statement (D443), so later and unknown ids are fine (a\n * `BLOCK_STYLE_UNKNOWN` warning lists the unknown ones);\n * - `root` is an ordinary id (D442): the top level is {@link BlockModel.blocks};\n * - degenerate sizes (D445): `columns 0` is `auto` (-1) and a span `:0` is 1\n * (`BLOCK_SIZE_INVALID`); spans are capped at 1,000 and `space:n` at 100,000 cells\n * (`BLOCK_TRUNCATED`); block-arrow directions are trimmed;\n * - generated ids (spaces, anonymous composites) are `id-<n>`, numbered from 1 in source order\n * (R-ARCH-6), where v12 drew a `Math.random` id; no author id can take that form (`-` is not\n * an id character);\n * - labels as v12's grammar handed them to its DB: entities as written (v12's `#35;` form reads\n * `#`), nothing decoded or sanitised (v13 writes text escaped).\n */\nimport type { AstId, Diagnostic } from '@mermaid-js/core/parser-kit';\n\n/** v12's block types (`blockTypes.ts`) that a block can have. */\nexport type BlockType =\n | 'na'\n | 'square'\n | 'round'\n | 'circle'\n | 'rect_left_inv_arrow'\n | 'diamond'\n | 'hexagon'\n | 'stadium'\n | 'subroutine'\n | 'cylinder'\n | 'doublecircle'\n | 'lean_right'\n | 'lean_left'\n | 'trapezoid'\n | 'inv_trapezoid'\n | 'block_arrow'\n | 'composite'\n | 'space';\n\nexport interface Block {\n /** The AST id of the block's first occurrence (`block:<id>`, `block:id-<n>`). */\n readonly ast: AstId;\n /** v12's `id`: as written, or `id-<n>` for a space or an anonymous composite. */\n readonly id: string;\n readonly type: BlockType;\n /** The quoted label, the id for a leaf without one, `''` for a composite without one. */\n readonly label: string;\n /** Columns taken (v12 `widthInColumns`), 1 to 1,000. */\n readonly span: number;\n /** A composite's last `columns` (-1 for `auto`); undefined without one. */\n readonly columns?: number;\n /** For a space: how many cells of one column it takes (v12 cloned one block per cell). */\n readonly cells?: number;\n /** Block-arrow directions as written (trimmed): `right`, `left`, `x`, `y`, `up`, `down`. */\n readonly directions?: readonly string[];\n /** v12's `classes`: one entry per `class` statement naming the block, in source order. */\n readonly classes: readonly string[];\n /** v12's `styles`: the last `style` statement's text split at `,`, as written. */\n readonly styles: readonly string[];\n /** True for an anonymous `block … end`, whose id is generated (`id-<n>`). */\n readonly anonymous?: true;\n /** A composite's palette slot: composites numbered in declaration order (v12 `colorIndex`). */\n readonly colorIndex?: number;\n readonly children: readonly Block[];\n}\n\n/** v12's edge arrowheads. */\nexport type BlockArrowType = 'arrow_point' | 'arrow_circle' | 'arrow_cross' | 'arrow_open' | '';\n\nexport interface BlockEdge {\n /** `edge:<start>-><end>`, `@2`, `@3` for repeats (D448). */\n readonly ast: AstId;\n /** v12's `id`: `<k>-<start>-<end>` for the k-th edge between the two. */\n readonly id: string;\n readonly start: string;\n readonly end: string;\n /** The quoted label, or `''`. */\n readonly label: string;\n readonly arrowTypeStart: BlockArrowType;\n readonly arrowTypeEnd: BlockArrowType;\n readonly thickness: 'normal' | 'thick';\n readonly pattern: 'solid' | 'dotted';\n}\n\n/** A `classDef` (v12 `ClassDef`); repeats add to the first. */\nexport interface BlockClassDef {\n readonly id: string;\n readonly styles: readonly string[];\n /** The styles with `color` in them, `fill` → `bgFill` and `color` → `fill` (v12). */\n readonly textStyles: readonly string[];\n}\n\nexport interface BlockModel {\n /** The top-level blocks in source order. */\n readonly blocks: readonly Block[];\n /** The top level's last `columns` (-1 for `auto` or none). */\n readonly columns: number;\n /** In source order. Edges never merge. */\n readonly edges: readonly BlockEdge[];\n /** In order of first definition. */\n readonly classDefs: readonly BlockClassDef[];\n /** Warning diagnostics of the parse (also in `ParseResult.diagnostics`). */\n readonly warnings: readonly Diagnostic[];\n}\n\n/**\n * Whether `block` is drawn as a composite, a frame around its children: its type, by v12's\n * merge rule (a later type other than `na` wins, GAPS #554), never whether it holds children.\n * A composite a later mention turns into a leaf type (`block:a … end` then `a((\"x\"))`) keeps\n * its children but is drawn as that leaf. The layout, the SVG renderer, the text grid and the\n * hover all read this.\n */\nexport const isComposite = (block: Pick<Block, 'type'>): boolean => block.type === 'composite';\n"],"mappings":"AAyHO,IAAMA,EAAeC,GAAwCA,EAAM,OAAS","names":["isComposite","block"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var E="USECASE_CONFLICT",S="USECASE_DUPLICATE_ID",_="USECASE_UNRESOLVED",A="USECASE_INVALID_METADATA",C="USECASE_INVALID_RELATION",U="USECASE_UNDECLARED_CLASS",N="USECASE_INVALID_ELEMENT",D="USECASE_INVALID_NOTE",t="USECASE_INVALID_JSON",L="USECASE_UNCLOSED_STEREOTYPE",O="USECASE_UNCLOSED_MARKDOWN",o="USECASE_UNCLOSED_JSON",I="USECASE_UNCLOSED_BOUNDARY",e="USECASE_UNCLOSED_ACC_DESCR",n="USECASE_CONFIG_IGNORED",T="USECASE_STYLE_IGNORED",R=new Set([E,S,_,A,C,U,N,D,t]);export{E as a,S as b,_ as c,A as d,C as e,U as f,N as g,D as h,t as i,L as j,O as k,o as l,I as m,e as n,n as o,T as p,R as q};
|
|
2
|
+
//# sourceMappingURL=chunk-55IU7BZR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["node_modules/@mermaid-js/diagram-usecase/src/codes.ts"],"sourcesContent":["/**\n * Usecase's own diagnostic codes, one definition each. The model's codes stand for the errors\n * v12's model builder threw (`usecaseModelBuilder.ts`), each now a diagnostic with v12's message\n * minus its location (D473). Syntax codes shared with other types (`UNEXPECTED`,\n * `UNEXPECTED_CHARACTER`, `UNCLOSED_STRING`) are core's or other diagrams' as well.\n */\n\n/** Two declarations of one id disagree: kind, label, shape, boundary, stereotype or metadata. */\nexport const USECASE_CONFLICT = 'USECASE_CONFLICT';\n/** An id declared twice where only one is allowed: a JSON table, an edge id, a generated id. */\nexport const USECASE_DUPLICATE_ID = 'USECASE_DUPLICATE_ID';\n/** A metadata, note, `class` or `style` target that no element declares. */\nexport const USECASE_UNRESOLVED = 'USECASE_UNRESOLVED';\n/** A metadata key or value the target does not take. */\nexport const USECASE_INVALID_METADATA = 'USECASE_INVALID_METADATA';\n/** A relation whose ends cannot take it (a boundary end, an include between actors, …). */\nexport const USECASE_INVALID_RELATION = 'USECASE_INVALID_RELATION';\n/** `A --> B:::c` where `B` is only named, not declared. */\nexport const USECASE_UNDECLARED_CLASS = 'USECASE_UNDECLARED_CLASS';\n/** An element whose metadata cannot be drawn together (an icon with a type, …). */\nexport const USECASE_INVALID_ELEMENT = 'USECASE_INVALID_ELEMENT';\n/** A note attached to something other than an actor or use case. */\nexport const USECASE_INVALID_NOTE = 'USECASE_INVALID_NOTE';\n/** The object of a `json` statement is not valid JSON. */\nexport const USECASE_INVALID_JSON = 'USECASE_INVALID_JSON';\n/** `<<` without `>>` on its line. */\nexport const USECASE_UNCLOSED_STEREOTYPE = 'USECASE_UNCLOSED_STEREOTYPE';\n/** A Markdown text (a quote and a backtick) without its closing backtick and quote. */\nexport const USECASE_UNCLOSED_MARKDOWN = 'USECASE_UNCLOSED_MARKDOWN';\n/** A `json` object without its closing `}`. */\nexport const USECASE_UNCLOSED_JSON = 'USECASE_UNCLOSED_JSON';\n/** A `systemBoundary` without its `end`. */\nexport const USECASE_UNCLOSED_BOUNDARY = 'USECASE_UNCLOSED_BOUNDARY';\n/** An `accDescr {` without its `}`. */\nexport const USECASE_UNCLOSED_ACC_DESCR = 'USECASE_UNCLOSED_ACC_DESCR';\n\n/** A `usecase` config value the layout cannot use: it draws with the default (pitfall 22). */\nexport const USECASE_CONFIG_IGNORED = 'USECASE_CONFIG_IGNORED';\n\n/**\n * A styled `font-size` the layout cannot measure (`vw`, `vh`, 0, 10000px and up): the label is\n * measured, and so drawn, at the element's own size (pitfall 22).\n */\nexport const USECASE_STYLE_IGNORED = 'USECASE_STYLE_IGNORED';\n\n/** The codes of the model's checks (v12's model builder and its JSON reader). */\nexport const MODEL_CODES: ReadonlySet<string> = new Set([\n USECASE_CONFLICT,\n USECASE_DUPLICATE_ID,\n USECASE_UNRESOLVED,\n USECASE_INVALID_METADATA,\n USECASE_INVALID_RELATION,\n USECASE_UNDECLARED_CLASS,\n USECASE_INVALID_ELEMENT,\n USECASE_INVALID_NOTE,\n USECASE_INVALID_JSON,\n]);\n"],"mappings":"AAQO,IAAMA,EAAmB,mBAEnBC,EAAuB,uBAEvBC,EAAqB,qBAErBC,EAA2B,2BAE3BC,EAA2B,2BAE3BC,EAA2B,2BAE3BC,EAA0B,0BAE1BC,EAAuB,uBAEvBC,EAAuB,uBAEvBC,EAA8B,8BAE9BC,EAA4B,4BAE5BC,EAAwB,wBAExBC,EAA4B,4BAE5BC,EAA6B,6BAG7BC,EAAyB,yBAMzBC,EAAwB,wBAGxBC,EAAmC,IAAI,IAAI,CACtDhB,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CACF,CAAC","names":["USECASE_CONFLICT","USECASE_DUPLICATE_ID","USECASE_UNRESOLVED","USECASE_INVALID_METADATA","USECASE_INVALID_RELATION","USECASE_UNDECLARED_CLASS","USECASE_INVALID_ELEMENT","USECASE_INVALID_NOTE","USECASE_INVALID_JSON","USECASE_UNCLOSED_STEREOTYPE","USECASE_UNCLOSED_MARKDOWN","USECASE_UNCLOSED_JSON","USECASE_UNCLOSED_BOUNDARY","USECASE_UNCLOSED_ACC_DESCR","USECASE_CONFIG_IGNORED","USECASE_STYLE_IGNORED","MODEL_CODES"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a,b as J,
|
|
1
|
+
import{a,b as J,d as Z,f as w,k as q,m as tt,n as et,p as it,q as rt,r as S,s as N,t as C,u as st,v as nt}from"./chunk-4XJZCOJ5.mjs";import{A as x,D as g,E as Q,i as Y,l as z,p as u,q as m,r as T,s as E,x as X}from"./chunk-KJT4SRSJ.mjs";var f=J,o={ShowData:f,Pie:f+1,Colon:f+2,Number:f+3,AccDescr:f+4,AccTitle:f+5,Title:f+6,String:f+7,Yaml:f+8},R=w(a.Comment,a.Directive,a.Space,o.Yaml),pt={[o.ShowData]:"showData",[o.Pie]:"pie",[o.Colon]:":",[o.Number]:"NUMBER_PIE",[o.AccDescr]:"ACC_DESCR",[o.AccTitle]:"ACC_TITLE",[o.Title]:"TITLE",[o.String]:"STRING",[a.Newline]:"NEWLINE",[o.Yaml]:"YAML",[a.Directive]:"DIRECTIVE",[a.Comment]:"SINGLE_LINE_COMMENT",[a.Error]:"LEXICAL_ERROR"};var mt={b:"\b",f:"\f",n:`
|
|
2
2
|
`,r:"\r",t:" ",v:"\v",0:"\0"};function ot(n){let t=n.slice(1,-1);if(!t.includes("\\"))return t;let e="";for(let i=0;i<t.length;i++){let r=t[i]??"";if(r.charCodeAt(0)!==92){e+=r;continue}let s=t[++i]??"";e+=mt[s]??s}return e}function _(n){let t=n.trim();return/[\t ]{2}/.test(t)?t.replace(/[\t ]{2,}/g," "):t}function ct(n){return _(n.slice(n.indexOf("title")+5))}function at(n){return _(n.slice(n.indexOf(":",n.indexOf("accTitle"))+1))}function ht(n){let t=n.indexOf("accDescr")+8;for(;m(n.charCodeAt(t));)t++;if(n[t]===":")return _(n.slice(t+1));let e=n.slice(n.indexOf("{",t)+1,n.lastIndexOf("}"));return gt(bt(e)).replace(/[\t ]{2,}/g," ").replace(/[\n\r]{2,}/g,`
|
|
3
3
|
`)}function bt(n){let t="",e=0,i=n.length;for(;;){for(;e<i&&u(n.charCodeAt(e));)e++;let r=e;for(;e<i&&!T(n.charCodeAt(e));)e++;if(e>=i)return t+n.slice(r);t+=n.slice(r,++e)}}function gt(n){let t="",e=0,i=n.length;for(;e<i;){let r=e;for(;e<i&&!u(n.charCodeAt(e));)e++;if(t+=n.slice(r,e),e>=i)break;let s=e,c=-1;for(;e<i&&u(n.charCodeAt(e));e++)e>s&&T(n.charCodeAt(e))&&(c=e);if(e===i)break;t+=n.slice(c<0?s:c,e)}return t}var V=-1,dt=-2,P=n=>n===10||n===13;function y(n,t,e){return new $(n,t,e).run()}var $=class{constructor(t,e,i){this.src=t;let r=i.mask?wt(i):i.text;this.text=r+`
|
|
4
4
|
`,this.len=r.length,this.n=this.text.length,this.offsets=i.runs&&new N(i.runs),this.holes=i.holes,this.hole=nt(i,e),this.p=st(i,e),this.w=new Z((this.len-this.p>>3)+8)}text;len;n;offsets;holes;hole;w;p;kind=V;digitsFrom=-1;digitsTo=-1;stringFails=[-1,-1];braceFrom=-1;braceAt=dt;yamlFails=1/0;directiveFails=1/0;run(){let{text:t,n:e}=this;for(;this.p<this.len&&u(t.charCodeAt(this.p));)this.p++;let i=-1;for(;this.p<e;){let r=this.p,s=this.scan(r);if(s<0){i<0&&(i=r),this.p=X(t,r);continue}i>=0&&(this.emit(a.Error,i,r),i=-1),this.kind!==V&&this.emit(this.kind,r,s),this.p=s}return this.trivia(this.src.length+1),this.w.finish(this.src)}scan(t){let e=this.text.charCodeAt(t),i=this.keyword("showData",t,o.ShowData);return i<0&&(i=this.keyword("pie",t,o.Pie)),i<0&&e===58&&(i=this.match(o.Colon,t+1)),i<0&&(e===45||E(e))&&(i=this.number(t)),i<0&&(i=this.accessibility(t)),i<0&&(e===34||e===39)&&(i=this.string(t,e)),i<0&&P(e)&&(i=this.match(a.Newline,t+x(this.text,t))),i<0&&m(e)&&(i=this.match(V,this.blanks(t))),i<0&&e===45&&(i=this.yaml(t)),i<0&&e===37&&this.text.charCodeAt(t+1)===37&&(i=this.directive(t),i<0&&(i=this.match(a.Comment,this.lineEnd(t+2)))),i}match(t,e){return this.kind=t,e}keyword(t,e,i){if(!this.text.startsWith(t,e))return-1;let r=e+t.length,s=this.text.charCodeAt(r);return r>=this.n||u(s)||s===37&&this.text.charCodeAt(r+1)===37?this.match(i,r):-1}number(t){let{text:e}=this,i=e.charCodeAt(t)===45?t+1:t;if(!E(e.charCodeAt(i)))return-1;let r=this.digits(i);if(e.charCodeAt(r)===46&&E(e.charCodeAt(r+1))){let s=this.digits(r+1);if(e.charCodeAt(s)!==46)return this.match(o.Number,s);if(s-(r+1)>=2)return this.match(o.Number,s-1)}return e.charCodeAt(i)===48?e.charCodeAt(i+1)===46?-1:this.match(o.Number,i+1):e.charCodeAt(r)!==46?this.match(o.Number,r):r-i>=2?this.match(o.Number,r-1):-1}accessibility(t){let{text:e}=this,i=m(e.charCodeAt(t))?this.blanks(t):t;if(e.startsWith("accDescr",i)){let r=this.accDescr(i+8);if(r>=0)return this.match(o.AccDescr,r)}if(e.startsWith("accTitle",i)){let r=this.blanks(i+8);if(e.charCodeAt(r)===58)return this.match(o.AccTitle,this.lineTail(r+1))}if(e.startsWith("title",i)){let r=i+5;return this.match(o.Title,m(e.charCodeAt(r))?this.lineTail(r+1):r)}return-1}accDescr(t){let{text:e}=this,i=this.blanks(t);if(e.charCodeAt(i)===58)return this.lineTail(i+1);let r=t;for(;r<this.n&&u(e.charCodeAt(r));)r++;if(e.charCodeAt(r)!==123)return-1;let s=this.brace(r+1);return s<0?-1:s+1}string(t,e){let i=e===34?0:1;if(t<(this.stringFails[i]??-1))return-1;let{text:r,n:s}=this,c=t+1;for(;c<s;){let h=r.charCodeAt(c);if(h===e)return this.match(o.String,c+1);if(h===92){if(c+1>=s||T(r.charCodeAt(c+1)))break;c+=2}else c++}return this.stringFails[i]=c,-1}yaml(t){let{text:e,n:i}=this;if(!e.startsWith("---",t))return-1;let r=this.blanks(t+3),s=x(e,r);if(s===0)return-1;let c=r+s;if(c>=this.yamlFails)return-1;for(let l=c+1;l<i;l++){if(!P(e.charCodeAt(l-1))||!e.startsWith("---",l))continue;let d=this.closer(l+3);if(d>=0)return this.match(o.Yaml,d)}let h=e.startsWith("---",c)?this.closer(c+3):-1;return h>=0?this.match(o.Yaml,h):(this.yamlFails=c,-1)}directive(t){let{text:e}=this;if(e.charCodeAt(t+2)!==123)return-1;let i=t+3;if(i>=this.directiveFails)return-1;for(let r=e.indexOf("}%%",i);r!==-1;r=e.indexOf("}%%",r+1)){let s=this.closer(r+3);if(s>=0)return this.match(a.Directive,s)}return this.directiveFails=i,-1}closer(t){let e=x(this.text,t);return e>0?t+e:t>=this.n||u(this.text.charCodeAt(t))?t:-1}blanks(t){let e=t;for(;e<this.n&&m(this.text.charCodeAt(e));)e++;return e}digits(t){if(t>=this.digitsFrom&&t<this.digitsTo)return this.digitsTo;let e=t;for(;e<this.n&&E(this.text.charCodeAt(e));)e++;return this.digitsFrom=t,this.digitsTo=e,e}lineEnd(t){let e=t;for(;e<this.n&&!P(this.text.charCodeAt(e));)e++;return e}lineTail(t){let{text:e,n:i}=this,r=t;for(;r<i;){let s=e.charCodeAt(r);if(P(s)||s===37&&e.charCodeAt(r+1)===37)break;r++}return r}brace(t){let e=this.braceAt;return e!==dt&&t>=this.braceFrom&&(e===-1||t<=e)?e:(this.braceFrom=t,this.braceAt=this.text.indexOf(String.fromCharCode(125),t),this.braceAt)}source(t){return t>=this.len?this.src.length:this.offsets?this.offsets.source(t):t}trivia(t){let e=this.holes;for(let i=e[this.hole];i&&i.start<t;i=e[++this.hole])i.kind==="comment"?this.w.push(a.Comment,i.start,i.end):i.kind==="directive"&&this.w.push(a.Directive,i.start,i.end)}emit(t,e,i){let r=this.source(e),s=Math.min(i,this.len),c=s>e?this.source(s-1)+1:r;this.holes.length>0&&(this.trivia(r),c>r&&(c=this.dropAt(c))),this.w.push(t,r,c)}dropAt(t){let e=this.holes,i=this.hole;for(;i<e.length&&(e[i]?.start??t)<t;)i++;let r=e[i];return r&&r.start===t&&r.kind==="drop"?r.end:t}};function wt(n){let{text:t,mask:e,runs:i}=n;if(!e)return t;let r=i?new N(i):void 0,s="",c=0;for(let h=t.indexOf('"');h!==-1;h=t.indexOf('"',h+1))((e[r?r.source(h):h]??0)&rt)!==0&&(s+=t.slice(c,h)+"'",c=h+1);return s+t.slice(c)}var B=[o.Title,o.AccTitle,o.AccDescr],j=[o.String,...B],W=[...j,a.Newline,a.EOF],xt=[o.ShowData,...W],ut=[a.Newline,a.EOF],St=[o.Pie,a.Newline],Ct=w(a.Newline,a.EOF),Dt=w(o.Colon,o.String),Pt={[o.Title]:"title",[o.AccTitle]:"accTitle",[o.AccDescr]:"accDescr"};function kt(n,t,e){for(let i=0;i<t.length;i++){let r=t.start[i]??0,s=t.end[i]??0;if(r>=e)break;if(s<e)continue;let c=t.kind[i]??a.EOF,h=n.charCodeAt(r);if(c===o.String&&e<s||c===a.Error&&(h===34||h===39))return"string";let l=Pt[c];if(!l)continue;let d=r;for(;/[\t ]/.test(n.charAt(d));)d++;d+=l.length;let p=c===o.AccDescr&&/^\s*\{/.test(n.slice(d,s));if(e>d&&(e<s||!p))return l}return"INITIAL"}var yt=new z([["`pie`",[o.Pie]],["`showData`",[o.ShowData]],['a section such as `"Dogs" : 42`',[o.String]],["`title`, `accTitle:` or `accDescr`",B],["`:` and a value",[o.Colon]],["a value such as `42` or `3.5`",[o.Number]],["a line break",[a.Newline]],["the end of the text",[a.EOF]]]),Ot={[o.Title]:"Title",[o.AccTitle]:"AccTitle",[o.AccDescr]:"AccDescr"},Nt={Title:"title",AccTitle:"accTitle",AccDescr:"accDescr"},M="put each section and statement on a line of its own",H=class extends Error{},A=new H,ft="%>@#\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\ud800-\\udfff\\ufffe\\uffff",Rt=new RegExp(`[${ft}]`,"u"),It=new RegExp(`[${ft}]`,"gu"),_t=128;function Lt(n){return Rt.test(n)?n.replace(It,t=>{let e=t.charCodeAt(0);return`%${e.toString(16).toUpperCase().padStart(e<_t?2:4,"0")}`}):n}function Ft(n,t={}){return new G(n,t).parse()}var G=class{constructor(t,e){this.src=t;this.options=e;let i=this.pre=e.preprocessed??g(t);if(e.preprocessed||this.st.diagnostics.list.push(...i.diagnostics),this.view=S(t,i.bodyStart,i.directives.map(r=>r.range)),this.full=y(t,i.bodyStart,this.view),this.t=tt(this.full,R),e.probe!==void 0){let r=this.probe=new q(t,e.probe,Dt);i.frontMatter&&r.offset<i.bodyStart?r.outside("frontMatter"):r.trivia(this.full),r.lexed(r.offset,r.offset,kt(t,this.full,r.offset))}}pre;view;full;t;i=0;st=new it;probe;children=[];lines;mentions=new Map;byLabel=new Map;sections=[];showData=!1;title="";accTitle="";accDescr="";parse(){let{st:t,src:e}=this;this.statement(()=>this.header()),this.document();let i=t.diagnostics.list.filter(h=>h.severity==="warning"),r=this.title||this.pre.frontMatter?.title,s=Object.freeze({showData:this.showData,sections:Object.freeze(this.sections),...r?{title:r}:{},accTitle:this.accTitle,accDescr:this.accDescr,warnings:Object.freeze(i)}),c={id:"doc",type:"Document",range:{start:this.pre.bodyStart,end:e.length},children:this.children};return t.result(s,c,this.full,this.options,this.probe)}kind(t=this.i){return this.t.kind[t]??a.EOF}range(t=this.i){return{start:this.t.start[t]??0,end:this.t.end[t]??0}}raw(t=this.i){let{start:e,end:i}=this.range(t);return C(this.src,e,i,this.view)}tested(t){let e=this.probe;e?.isAt(this.t,this.i,this.pre.bodyStart)&&e.tested(t,this.range().start)}expect(t,e){return this.tested([t]),this.kind()!==t&&this.fail([t],e),this.i++}id(t){let e=(this.mentions.get(t)??0)+1;return this.mentions.set(t,e),e===1?t:`${t}@${e}`}repeated(t){return(this.mentions.get(t)??0)>1}lineOf(t){return(this.lines??=new Y(this.src)).position(t).line+1}found(){let t=this.kind();if(t===a.EOF)return"the end of the text";if(t===a.Newline)return"a line break";let e=this.raw().trim(),i=e.split(`
|
|
5
5
|
`,1)[0]??"";return i.length>24||i!==e?`\`${i.slice(0,24)}\u2026\``:`\`${i}\``}fail(t,e){let{st:i}=this,r=this.range();this.kind()===a.Error&&this.badCharacters(r);let s=i.diagnostics.unexpected("UNEXPECTED",r,yt.names(t),this.found()),c=e??this.explain();throw c&&(s.message=`${s.message.slice(0,-1)}; ${c}.`),A}badCharacters(t){let{st:e}=this,i=this.raw(),r=this.lineOf(t.start);if(i.startsWith('"')||i.startsWith("'")){let l=i[0]??'"';throw e.diagnostics.error("UNCLOSED_STRING",`Unclosed label: the \`${l}\` at line ${r} has no closing \`${l}\`. Add \`${l}\` after the label.`,t,{expected:[`\`${l}\``]}),A}let s=/^[\t ]*(accDescr|accTitle)/.exec(i)?.[1];if(s==="accDescr")throw e.diagnostics.error("UNCLOSED_ACC_DESCR",`Unclosed accessible description: the \`accDescr {\` at line ${r} has no closing \`}\`, and \`accDescr\` without \`{\` takes a \`:\`. Write \`accDescr: \u2026\` or \`accDescr { \u2026 }\`.`,t),A;if(s==="accTitle")throw e.diagnostics.error("UNEXPECTED_CHARACTER","Expected `:` after `accTitle`; write it as `accTitle: \u2026`.",t,{expected:["`:`"]}),A;let c=i.length>24?`${i.slice(0,24)}\u2026`:i,h="";throw i===";"?h=`; \`;\` does not end a statement in a pie chart: ${M}`:/^[0-9]/.test(i)&&(h="; a value is a number such as `42` or `3.5`, with digits on both sides of a `.`"),e.diagnostics.error("UNEXPECTED_CHARACTER",`Unexpected character \`${c}\`${h}.`,t),A}explain(){let t=this.kind();if(t===o.Number)return"a value has no leading zeros, and only one per section";if(t===o.ShowData)return"`showData` goes on the `pie` line, right after `pie`";if(t===o.Pie)return"a chart has one `pie`, at its start";if(j.includes(t))return M}recover(){this.probe?.freeze(),this.i=et(this.t,this.i,Ct)}statement(t){try{t()}catch(e){if(e!==A)throw e;this.recover()}}header(){for(;this.tested(St),this.kind()===a.Newline;)this.i++;let t=this.expect(o.Pie),e=this.range(t);this.tested(xt),this.kind()===o.ShowData&&(e.end=this.range(this.i++).end,this.showData=!0),this.st.statement("header",e),this.children.push({id:"pie",type:"Header",range:e,showData:this.showData})}document(){for(;;){this.tested(W);let t=this.kind();if(t===a.EOF)return;if(t===a.Newline){this.i++;continue}this.statement(()=>{t===o.String?this.section():B.includes(t)?this.text(t):this.fail(W)})}}eol(){this.tested(ut);let t=this.kind();t!==a.EOF&&(t!==a.Newline&&this.fail(ut,j.includes(t)?M:void 0),this.i++)}section(){let t=this.i++;this.expect(o.Colon,'write a section as `"label" : value`, e.g. `"Dogs" : 42`');let e=this.expect(o.Number),i=this.range(t),r=this.range(e),s=ot(this.raw(t)),c=Number(this.raw(e)),h={start:i.start,end:r.end},l=`slice:${Lt(s)}`,d=this.id(l),p={id:d,type:"Slice",range:h,label:s,labelRange:i,value:c,valueRange:r};this.children.push(p),this.st.statement("slice",h),this.st.symbol(s,"slice",i,this.repeated(l)?"ref":"def");let{diagnostics:b}=this.st;if(c<0)b.error("PIE_NEGATIVE_VALUE",`"${s}" has invalid value: ${c}. Negative values are not allowed in pie charts. All slice values must be >= 0.`,r);else if(!Number.isFinite(c))b.warning("PIE_VALUE_TOO_LARGE",`"${s}" has a value too large to draw: the section is left out. Slice values must be below 1.8e308.`,r);else{let O=this.byLabel.get(s);if(O)b.warning("PIE_DUPLICATE_SLICE",`Section "${s}" is repeated: the value ${c} is ignored and the first value, ${O.value}, is kept. Give each section its own label.`,h);else{let K=Object.freeze({label:s,value:c,astId:d});this.byLabel.set(s,K),this.sections.push(K)}}this.eol()}text(t){let e=this.i++,i=this.raw(e),r=Ot[t]??"Title",s=this.range(e);for(;s.start<s.end&&/[\t ]/.test(this.src[s.start]??"");)s.start++;let c;r==="Title"?c=this.title=ct(i):r==="AccTitle"?c=this.accTitle=at(i):c=this.accDescr=ht(i);let h=Nt[r];this.children.push({id:this.id(h),type:r,range:s,text:c}),this.st.statement(h,s),this.eol()}};function Vt(n,t=g(n)){return n.startsWith("pie",Q(n,t))}function ie(n){let t=g(n),e=S(n,t.bodyStart,t.directives.map(h=>h.range)),i=y(n,t.bodyStart,e),r=e.holes.filter(h=>h.kind!=="drop"),s=0,c=[];for(let h=0;h<i.length;h++){let l=i.kind[h]??a.EOF,d=i.start[h]??0,p=i.end[h]??0;if(l===a.EOF)continue;for(;(r[s]?.start??1/0)<d;)s++;let b=r[s];(l===a.Comment||l===a.Directive)&&b?.start===d&&b.end===p||c.push({kind:l,text:C(n,d,p,e),range:{start:d,end:p}})}return c}function ce(n){let t=0,e=0;for(let r of n)t+=r,r>e&&(e=r);if(Number.isFinite(t))return{unit:1,sum:t};let i=0;for(let r of n)i+=r/e;return{unit:e,sum:i}}export{ce as a,o as b,Ft as c,Vt as d,ie as e};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-66W4K2AQ.mjs.map
|